1035 lines
51 KiB
Java
1035 lines
51 KiB
Java
package com.engine.salary.biz;
|
||
|
||
import com.alibaba.fastjson.JSON;
|
||
import com.alibaba.fastjson.JSONObject;
|
||
import com.alibaba.fastjson.TypeReference;
|
||
import com.api.browser.bean.SearchConditionGroup;
|
||
import com.api.browser.bean.SearchConditionItem;
|
||
import com.api.browser.bean.SearchConditionOption;
|
||
import com.api.browser.util.ConditionFactory;
|
||
import com.api.browser.util.ConditionType;
|
||
import com.cloudstore.eccom.pc.table.WeaTable;
|
||
import com.cloudstore.eccom.pc.table.WeaTableCheckboxpopedom;
|
||
import com.cloudstore.eccom.pc.table.WeaTableColumn;
|
||
import com.cloudstore.eccom.result.WeaResultMsg;
|
||
import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||
import com.engine.salary.entity.siarchives.bo.InsuranceArchivesBO;
|
||
import com.engine.salary.entity.siarchives.dto.InsuranceArchivesBaseDTO;
|
||
import com.engine.salary.entity.siarchives.dto.InsuranceArchivesFundSchemeDTO;
|
||
import com.engine.salary.entity.siarchives.dto.InsuranceArchivesOtherSchemeDTO;
|
||
import com.engine.salary.entity.siarchives.dto.InsuranceArchivesSocialSchemeDTO;
|
||
import com.engine.salary.entity.siarchives.param.*;
|
||
import com.engine.salary.entity.siarchives.po.*;
|
||
import com.engine.salary.entity.sicategory.po.ICategoryPO;
|
||
import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
|
||
import com.engine.salary.entity.sischeme.po.InsuranceSchemePO;
|
||
import com.engine.salary.entity.taxrate.TaxAgent;
|
||
import com.engine.salary.enums.UserStatusEnum;
|
||
import com.engine.salary.enums.sicategory.*;
|
||
import com.engine.salary.exception.SalaryRunTimeException;
|
||
import com.engine.salary.mapper.TaxAgentMapper;
|
||
import com.engine.salary.mapper.siarchives.FundSchemeMapper;
|
||
import com.engine.salary.mapper.siarchives.OtherSchemeMapper;
|
||
import com.engine.salary.mapper.siarchives.SocialSchemeMapper;
|
||
import com.engine.salary.mapper.sicategory.ICategoryMapper;
|
||
import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper;
|
||
import com.engine.salary.mapper.sischeme.InsuranceSchemeMapper;
|
||
import com.engine.salary.util.SalaryAssert;
|
||
import com.engine.salary.util.SalaryDateUtil;
|
||
import com.engine.salary.util.SalaryEntityUtil;
|
||
import com.engine.salary.util.SalaryFormItemUtil;
|
||
import com.engine.salary.util.db.MapperProxyFactory;
|
||
import com.engine.salary.util.page.PageInfo;
|
||
import com.engine.salary.util.page.PageUtil;
|
||
import org.apache.commons.collections.CollectionUtils;
|
||
import org.apache.ibatis.session.SqlSession;
|
||
import weaver.conn.mybatis.MyBatisFactory;
|
||
import weaver.general.Util;
|
||
import weaver.hrm.User;
|
||
|
||
import java.util.*;
|
||
import java.util.function.Function;
|
||
import java.util.stream.Collectors;
|
||
|
||
|
||
/**
|
||
* @Author weaver_cl
|
||
* @Description: TODO
|
||
* @Date 2022/3/12
|
||
* @Version V1.0
|
||
**/
|
||
public class SIArchivesBiz {
|
||
|
||
/**
|
||
*
|
||
* @param welfareType
|
||
* @param employeeId
|
||
* @param operateId
|
||
* @param user
|
||
* @return
|
||
*/
|
||
public Map<String,Object> getBaseForm(WelfareTypeEnum welfareType, Long employeeId, Long operateId, User user) {
|
||
Map<String, Object> data = new HashMap<>(16);
|
||
SalaryAssert.notNull(employeeId, "员工id不可为空");
|
||
EmployBiz employBiz = new EmployBiz();
|
||
List<DataCollectionEmployee> employeeByIds = employBiz.getEmployeeByIdsAll(Collections.singletonList(employeeId));
|
||
SalaryAssert.notEmpty(employeeByIds,"员工信息不存在");
|
||
DataCollectionEmployee item = employeeByIds.get(0);
|
||
|
||
|
||
if (welfareType == null) {
|
||
//基础信息表单
|
||
InsuranceArchivesBaseDTO insuranceArchivesBaseDTO = InsuranceArchivesBaseDTO.builder().department(item.getDepartmentName())
|
||
.hiredate(SalaryDateUtil.getFormatLocalDate(item.getCompanystartdate()))
|
||
.position(item.getJobtitleName())
|
||
.username(item.getUsername())
|
||
.telephone(item.getMobile())
|
||
.dimissionDate(SalaryDateUtil.getFormatLocalDate(item.getDissmissdate()))
|
||
.build();
|
||
|
||
// if (item.getStatus() == UserStatusEnum.unavailable) {
|
||
// InsuranceArchivesListParam insuranceArchivesListParam = new InsuranceArchivesListParam();
|
||
// insuranceArchivesListParam.setEmployeeIds(Collections.singletonList(employeeId));
|
||
// List<InsuranceArchivesEmployeePO> insuranceArchivesEmployeePOS = siArchivesSocialMapper.queryEmployeeList(insuranceArchivesListParam, tenantKey);
|
||
// if (CollectionUtils.isNotEmpty(insuranceArchivesEmployeePOS)) {
|
||
// insuranceArchivesBaseDTO.setDimissionDate(SalaryDateUtil.getFormatLocalDate(insuranceArchivesEmployeePOS.get(0).getDimissionDate()));
|
||
// }
|
||
// }
|
||
|
||
//WeaForm weaForm = SalaryFormatUtil.<InsuranceArchivesBaseDTO>getInstance().buildForm(InsuranceArchivesBaseDTO.class, insuranceArchivesBaseDTO);
|
||
// weaForm.getGroups().add(new WeaFormGroup("g1", "员工信息"));
|
||
// weaForm.getLayout().forEach(items -> items.forEach(e -> e.setGroupId("g1")));
|
||
data.put("data",insuranceArchivesBaseDTO);
|
||
return data;
|
||
}
|
||
|
||
SISchemeBiz siSchemeBiz = new SISchemeBiz();
|
||
List<InsuranceSchemePO> list = siSchemeBiz.listAll();
|
||
List<SearchConditionItem> selectItems = new ArrayList<>();
|
||
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
||
List<SearchConditionOption> paymentOptions = paymentOrganizationOptions();
|
||
List<SearchConditionOption> underTakeOptions = Arrays.stream(UndertakerEnum.values()).map(e -> new SearchConditionOption(e.name(), e.getDefaultLabel())).collect(Collectors.toList());
|
||
|
||
|
||
//返回数据
|
||
switch (welfareType) {
|
||
case SOCIAL_SECURITY:
|
||
InsuranceArchivesSocialSchemeDTO insuranceArchivesSocialSchemeDTO = buildSocialForm(employeeId, operateId );
|
||
List<InsuranceSchemePO> socialList = list.stream().filter(e -> Objects.equals(e.getWelfareType(), WelfareTypeEnum.SOCIAL_SECURITY.getValue())).collect(Collectors.toList());
|
||
List<SearchConditionOption> socialOptions = new ArrayList <>();
|
||
socialList.forEach(social -> {
|
||
socialOptions.add(new SearchConditionOption(Util.null2String(social.getId()),social.getSchemeName()));
|
||
});
|
||
SearchConditionItem socialName = SalaryFormItemUtil.selectItem(user,socialOptions, 2, 12, 6, false, "社保方案名称","socialName");
|
||
SearchConditionItem organizationName = SalaryFormItemUtil.selectItem(user, paymentOptions, 2, 12, 6, false, "社保缴纳组织","paymentOrganization");
|
||
SearchConditionItem underTakeName = SalaryFormItemUtil.selectItem(user, underTakeOptions, 2, 12, 6, false, "社保个人实际承担方","underTake");
|
||
|
||
selectItems.add(socialName);
|
||
selectItems.add(organizationName);
|
||
selectItems.add(underTakeName);
|
||
|
||
addGroups.add(new SearchConditionGroup("社保基础信息",true,selectItems));
|
||
data.put("data",insuranceArchivesSocialSchemeDTO);
|
||
data.put("items",addGroups);
|
||
break;
|
||
case ACCUMULATION_FUND:
|
||
InsuranceArchivesFundSchemeDTO insuranceArchivesFundSchemeDTO = buildFundForm(employeeId, operateId);
|
||
List<InsuranceSchemePO> fundList = list.stream().filter(e -> Objects.equals(e.getWelfareType(), WelfareTypeEnum.ACCUMULATION_FUND.getValue())).collect(Collectors.toList());
|
||
List<SearchConditionOption> fundOptions = new ArrayList <>();
|
||
fundList.forEach(social -> {
|
||
fundOptions.add(new SearchConditionOption(Util.null2String(social.getId()),social.getSchemeName()));
|
||
});
|
||
SearchConditionItem fundName = SalaryFormItemUtil.selectItem(user,fundOptions, 2, 12, 6, false, "公积金方案名称","fundName");
|
||
SearchConditionItem organizationFundName = SalaryFormItemUtil.selectItem(user, paymentOptions, 2, 12, 6, false, "公积金缴纳组织","paymentOrganization");
|
||
SearchConditionItem underTakeFundName = SalaryFormItemUtil.selectItem(user, underTakeOptions, 2, 12, 6, false, "公积金个人实际承担方","underTake");
|
||
|
||
selectItems.add(fundName);
|
||
selectItems.add(organizationFundName);
|
||
selectItems.add(underTakeFundName);
|
||
addGroups.add(new SearchConditionGroup("公积金基础信息",true,selectItems));
|
||
data.put("data",insuranceArchivesFundSchemeDTO);
|
||
data.put("items",addGroups);
|
||
break;
|
||
case OTHER:
|
||
InsuranceArchivesOtherSchemeDTO insuranceArchivesOtherSchemeDTO = buildOtherForm(employeeId, operateId);
|
||
List<InsuranceSchemePO> otherList = list.stream().filter(e -> Objects.equals(e.getWelfareType(), WelfareTypeEnum.OTHER.getValue())).collect(Collectors.toList());
|
||
List<SearchConditionOption> otherOptions = new ArrayList <>();
|
||
otherList.forEach(social -> {
|
||
otherOptions.add(new SearchConditionOption(Util.null2String(social.getId()),social.getSchemeName()));
|
||
});
|
||
SearchConditionItem otherName = SalaryFormItemUtil.selectItem(user,otherOptions, 2, 12, 6, false, "其它福利名称","otherName");
|
||
SearchConditionItem organizationOtherName = SalaryFormItemUtil.selectItem(user, paymentOptions, 2, 12, 6, false, "其它福利缴纳组织","paymentOrganization");
|
||
SearchConditionItem underTakeOtherName = SalaryFormItemUtil.selectItem(user, underTakeOptions, 2, 12, 6, false, "其它福利个人实际承担方","underTake");
|
||
|
||
selectItems.add(otherName);
|
||
selectItems.add(organizationOtherName);
|
||
selectItems.add(underTakeOtherName);
|
||
addGroups.add(new SearchConditionGroup("其它福利基础信息",true,selectItems));
|
||
data.put("data",insuranceArchivesOtherSchemeDTO);
|
||
data.put("items",addGroups);
|
||
break;
|
||
default:
|
||
}
|
||
return data;
|
||
}
|
||
|
||
/**
|
||
* 获取详细表单
|
||
* @param user
|
||
* @param welfareType
|
||
* @param employeeId
|
||
* @param operateId
|
||
* @param schemeId
|
||
* @return
|
||
*/
|
||
public Map<String, Object> getPaymentForm(User user, WelfareTypeEnum welfareType, Long employeeId, long operateId, Long schemeId) {
|
||
Map<String, Object> data = new HashMap<>(16);
|
||
switch (welfareType) {
|
||
case SOCIAL_SECURITY:
|
||
data = buildSocialPaymentForm(user,employeeId, schemeId, operateId,welfareType.getValue());
|
||
break;
|
||
case ACCUMULATION_FUND:
|
||
data = buildFundPaymentForm(user,employeeId, schemeId, operateId,welfareType.getValue());
|
||
break;
|
||
case OTHER:
|
||
data = buildOtherPaymentForm(user,employeeId, schemeId, operateId,welfareType.getValue());
|
||
break;
|
||
default:
|
||
}
|
||
return data;
|
||
}
|
||
|
||
/**
|
||
* 其他payForm
|
||
* @param employeeId
|
||
* @param schemeId
|
||
* @param operateId
|
||
* @return
|
||
*/
|
||
public Map<String, Object> buildOtherPaymentForm(User user,Long employeeId, Long schemeId, long operateId,Integer welfareType) {
|
||
Map<String, Object> dataMap = new HashMap<>();
|
||
InsuranceArchivesOtherSchemeDTO data = buildOtherForm(employeeId, operateId);
|
||
if (data != null) {
|
||
dataMap.put("data",JSONObject.parseObject(data.getOtherPaymentBaseString(), new TypeReference<Map<String, Object>>() {
|
||
}));
|
||
}
|
||
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
||
List<SearchConditionItem> inputItems = buildPaymentBase(user,schemeId,welfareType);
|
||
addGroups.add(new SearchConditionGroup("其它福利缴纳基数",true,inputItems));
|
||
dataMap.put("items",addGroups);
|
||
return dataMap;
|
||
}
|
||
|
||
/**
|
||
* 公积金payForm
|
||
* @param employeeId
|
||
* @param schemeId
|
||
* @param operateId
|
||
* @return
|
||
*/
|
||
public Map<String, Object> buildFundPaymentForm(User user,Long employeeId, Long schemeId, long operateId,Integer welfareType) {
|
||
|
||
Map<String, Object> dataMap = new HashMap<>();
|
||
InsuranceArchivesFundSchemeDTO data = buildFundForm(employeeId, operateId);
|
||
if (data != null) {
|
||
dataMap.put("data",JSONObject.parseObject(data.getFundPaymentBaseString(), new TypeReference<Map<String, Object>>() {
|
||
}));
|
||
}
|
||
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
||
List<SearchConditionItem> inputItems = buildPaymentBase(user,schemeId,welfareType);
|
||
addGroups.add(new SearchConditionGroup("公积金缴纳基数",true,inputItems));
|
||
dataMap.put("items",addGroups);
|
||
return dataMap;
|
||
}
|
||
|
||
/**
|
||
* 社保payForm
|
||
* @param employeeId
|
||
* @param schemeId
|
||
* @param operateId
|
||
* @return
|
||
*/
|
||
public Map<String, Object> buildSocialPaymentForm(User user,Long employeeId, Long schemeId, long operateId,Integer welfareType) {
|
||
Map<String, Object> dataMap = new HashMap<>();
|
||
InsuranceArchivesSocialSchemeDTO data = buildSocialForm(employeeId, operateId);
|
||
if (data != null) {
|
||
dataMap.put("data",JSONObject.parseObject(data.getSchemePaymentBaseString(), new TypeReference<Map<String, Object>>() {
|
||
}));
|
||
}
|
||
|
||
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
||
List<SearchConditionItem> inputItems = buildPaymentBase(user,schemeId,welfareType);
|
||
addGroups.add(new SearchConditionGroup("社保缴纳基数",true,inputItems));
|
||
dataMap.put("items",addGroups);
|
||
return dataMap;
|
||
|
||
}
|
||
|
||
/**
|
||
* 构造payment(items)
|
||
* @param schemeId
|
||
* @return
|
||
*/
|
||
public List<SearchConditionItem> buildPaymentBase(User user,Long schemeId,Integer welfareType) {
|
||
List<SearchConditionItem> inputItems = new ArrayList<>();
|
||
if(schemeId == null) {
|
||
return new ArrayList<>();
|
||
}
|
||
List<InsuranceSchemeDetailPO> list = queryListByPrimaryIdIsPayment(schemeId,welfareType).stream().collect(Collectors.collectingAndThen(
|
||
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceSchemeDetailPO::getInsuranceId))), ArrayList::new)
|
||
);
|
||
SICategoryBiz siCategoryBiz = new SICategoryBiz();
|
||
list.forEach(insuranceSchemeDetail-> {
|
||
ICategoryPO iCategoryPO = siCategoryBiz.getByID(insuranceSchemeDetail.getInsuranceId());
|
||
if (iCategoryPO != null) {
|
||
inputItems.add(SalaryFormItemUtil.inputNumberItem(user,"precision:2",2,12,2,iCategoryPO.getInsuranceName(),String.valueOf(insuranceSchemeDetail.getInsuranceId())));
|
||
}
|
||
});
|
||
return inputItems;
|
||
}
|
||
|
||
/**
|
||
* 获取方案明细
|
||
* @param schemeId
|
||
* @return
|
||
*/
|
||
public List<InsuranceSchemeDetailPO> queryListByPrimaryIdIsPayment(Long schemeId,Integer welfareType) {
|
||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||
try{
|
||
InsuranceSchemeDetailMapper insuranceSchemeDetailMapper = sqlSession.getMapper(InsuranceSchemeDetailMapper.class);
|
||
return insuranceSchemeDetailMapper.queryListByPrimaryIdIsPayment(schemeId, IsPaymentEnum.YES.getValue(),welfareType);
|
||
}finally {
|
||
sqlSession.close();
|
||
}
|
||
}
|
||
|
||
|
||
/**
|
||
* 社保缴纳组织
|
||
* @return
|
||
*/
|
||
public List<SearchConditionOption> paymentOrganizationOptions() {
|
||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||
try {
|
||
TaxAgentMapper taxAgentMapper = sqlSession.getMapper(TaxAgentMapper.class);
|
||
List<TaxAgent> list = taxAgentMapper.listAll();
|
||
if (CollectionUtils.isEmpty(list)) {
|
||
return new ArrayList<>();
|
||
}
|
||
return list
|
||
.stream()
|
||
.map(item -> new SearchConditionOption(String.valueOf(item.getId()), item.getName())).collect(Collectors.toList());
|
||
}finally {
|
||
sqlSession.close();
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 其它基础表单
|
||
* @param employeeId
|
||
* @param operateId
|
||
* @return
|
||
*/
|
||
public InsuranceArchivesOtherSchemeDTO buildOtherForm(Long employeeId, Long operateId) {
|
||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||
try {
|
||
OtherSchemeMapper otherSchemeMapper = sqlSession.getMapper(OtherSchemeMapper.class);
|
||
List<InsuranceArchivesOtherSchemePO> otherList = otherSchemeMapper.getOtherByEmployeeId(Collections.singletonList(employeeId));
|
||
InsuranceArchivesOtherSchemePO insuranceArchivesOtherSchemePO = otherList.size() != 0 ? otherList.get(0) : null;
|
||
InsuranceArchivesOtherSchemeDTO data = InsuranceArchivesBO.convertOtherPOtoDTO(insuranceArchivesOtherSchemePO, employeeId);
|
||
if (insuranceArchivesOtherSchemePO == null) {
|
||
data.setEmployeeId(employeeId);
|
||
data.setUnderTake(UndertakerEnum.SCOPE_COMPANY);
|
||
}
|
||
return data;
|
||
}finally {
|
||
sqlSession.close();
|
||
}
|
||
|
||
}
|
||
|
||
/**
|
||
* 公积金基础表单
|
||
* @param employeeId
|
||
* @param operateId
|
||
* @return
|
||
*/
|
||
public InsuranceArchivesFundSchemeDTO buildFundForm(Long employeeId, Long operateId) {
|
||
|
||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||
try {
|
||
FundSchemeMapper fundSchemeMapper = sqlSession.getMapper(FundSchemeMapper.class);
|
||
List<InsuranceArchivesFundSchemePO> fundList = fundSchemeMapper.getFundByEmployeeId(Collections.singletonList(employeeId));
|
||
InsuranceArchivesFundSchemePO insuranceArchivesFundSchemePO = fundList.size() != 0 ? fundList.get(0) : null;
|
||
InsuranceArchivesFundSchemeDTO data = InsuranceArchivesBO.convertFundPOtoDTO(insuranceArchivesFundSchemePO, employeeId);
|
||
if (insuranceArchivesFundSchemePO == null) {
|
||
data.setEmployeeId(employeeId);
|
||
data.setUnderTake(UndertakerEnum.SCOPE_COMPANY);
|
||
}
|
||
return data;
|
||
}finally {
|
||
sqlSession.close();
|
||
}
|
||
|
||
}
|
||
|
||
/**
|
||
* 社保基础表单
|
||
* @param employeeId
|
||
* @param operateId
|
||
* @return
|
||
*/
|
||
public InsuranceArchivesSocialSchemeDTO buildSocialForm(Long employeeId, Long operateId) {
|
||
InsuranceArchivesSocialSchemePO insuranceArchivesSocialSchemePO = getSocialByEmployeeId(employeeId);
|
||
InsuranceArchivesSocialSchemeDTO data = InsuranceArchivesBO.convertSocialPOtoDTO(insuranceArchivesSocialSchemePO, employeeId);
|
||
if (insuranceArchivesSocialSchemePO == null) {
|
||
data.setEmployeeId(employeeId);
|
||
data.setUnderTake(UndertakerEnum.SCOPE_COMPANY);
|
||
}
|
||
return data;
|
||
}
|
||
|
||
|
||
/**
|
||
* 获取社保档案表
|
||
* @param employeeId
|
||
* @return
|
||
*/
|
||
public InsuranceArchivesSocialSchemePO getSocialByEmployeeId(Long employeeId) {
|
||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||
try {
|
||
SocialSchemeMapper socialSchemeMapper = sqlSession.getMapper(SocialSchemeMapper.class);
|
||
List<InsuranceArchivesSocialSchemePO> socialList = socialSchemeMapper.getSocialByEmployeeId(Collections.singletonList(employeeId));
|
||
return socialList.size() != 0 ? socialList.get(0) : null;
|
||
}finally {
|
||
sqlSession.close();
|
||
}
|
||
}
|
||
|
||
|
||
/**
|
||
* 新增
|
||
* @param param
|
||
* @param employeeId
|
||
*/
|
||
public void insert(InsuranceArchivesSaveParam param, long employeeId) {
|
||
SalaryAssert.notNull(param.getWelfareType(), "福利类型为空");
|
||
switch (param.getWelfareType()) {
|
||
case SOCIAL_SECURITY:
|
||
socialSave(param, employeeId);
|
||
break;
|
||
case ACCUMULATION_FUND:
|
||
fundSave(param, employeeId);
|
||
break;
|
||
case OTHER:
|
||
otherSave(param, employeeId);
|
||
break;
|
||
default:
|
||
throw new SalaryRunTimeException("福利类型不存在");
|
||
}
|
||
|
||
}
|
||
|
||
/**
|
||
*
|
||
* @param paramReq
|
||
* @param employeeId
|
||
*/
|
||
public void otherSave(InsuranceArchivesSaveParam paramReq, long employeeId) {
|
||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||
try {
|
||
OtherSchemeMapper otherSchemeMapper = sqlSession.getMapper(OtherSchemeMapper.class);
|
||
|
||
InsuranceArchivesOtherSaveParam param = JSONObject.parseObject(paramReq.getBaseForm(), InsuranceArchivesOtherSaveParam.class);
|
||
SalaryAssert.notNull( "员工id为空", param, param.getEmployeeId());
|
||
otherSchemeMapper.batchDeleteByEmployeeIds(Collections.singletonList(param.getEmployeeId()));
|
||
InsuranceArchivesOtherSchemePO insuranceArchivesOtherSchemePO =
|
||
InsuranceArchivesOtherSchemePO.builder()
|
||
.otherSchemeId(param.getOtherName())
|
||
.otherStartTime(param.getOtherStartTime())
|
||
.underTake(param.getUnderTake().getValue())
|
||
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||
.welfareType(paramReq.getWelfareType().getValue())
|
||
.otherEndTime(param.getOtherEndTime())
|
||
.employeeId(param.getEmployeeId())
|
||
.deleteType(DeleteTypeEnum.NOT_DELETED.getValue())
|
||
.updateTime(new Date())
|
||
.createTime(new Date())
|
||
//.id(IdGenerator.generate())
|
||
.nonPayment(param.getNonPayment())
|
||
.creator(employeeId)
|
||
.paymentOrganization(param.getPaymentOrganization())
|
||
.otherPaymentBaseString(paramReq.getPaymentForm())
|
||
.build();
|
||
otherSchemeMapper.batchSave(Collections.singletonList(insuranceArchivesOtherSchemePO));
|
||
|
||
sqlSession.commit();
|
||
}finally {
|
||
sqlSession.close();
|
||
}
|
||
}
|
||
|
||
/**
|
||
*
|
||
* @param paramReq
|
||
* @param employeeId
|
||
*/
|
||
public void fundSave(InsuranceArchivesSaveParam paramReq, long employeeId) {
|
||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||
try {
|
||
FundSchemeMapper fundSchemeMapper = sqlSession.getMapper(FundSchemeMapper.class);
|
||
InsuranceArchivesFundSaveParam param = JSONObject.parseObject(paramReq.getBaseForm(), InsuranceArchivesFundSaveParam.class);
|
||
SalaryAssert.notNull("员工id为空", param, param.getEmployeeId());
|
||
fundSchemeMapper.batchDeleteByEmployeeIds(Collections.singletonList(param.getEmployeeId()));
|
||
InsuranceArchivesFundSchemePO insuranceArchivesFundSchemePO = InsuranceArchivesFundSchemePO.builder()
|
||
.fundSchemeId(param.getFundName())
|
||
.fundAccount(param.getFundAccount())
|
||
.fundEndTime(param.getFundEndTime())
|
||
.fundStartTime(param.getFundStartTime())
|
||
.fundPaymentBaseString(paramReq.getPaymentForm())
|
||
.supplementFundAccount(param.getSupplementFundAccount())
|
||
//.id(IdGenerator.generate())
|
||
.createTime(new Date())
|
||
.creator(employeeId)
|
||
.nonPayment(param.getNonPayment())
|
||
.deleteType(DeleteTypeEnum.NOT_DELETED.getValue())
|
||
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||
.underTake(param.getUnderTake().getValue())
|
||
.paymentOrganization(param.getPaymentOrganization())
|
||
.updateTime(new Date())
|
||
.welfareType(paramReq.getWelfareType().getValue())
|
||
.employeeId(param.getEmployeeId())
|
||
.build();
|
||
fundSchemeMapper.batchSave(Collections.singletonList(insuranceArchivesFundSchemePO));
|
||
sqlSession.commit();
|
||
}finally {
|
||
sqlSession.close();
|
||
}
|
||
|
||
}
|
||
|
||
/**
|
||
*
|
||
* @param paramReq
|
||
* @param employeeId
|
||
*/
|
||
public void socialSave(InsuranceArchivesSaveParam paramReq, long employeeId) {
|
||
|
||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||
try {
|
||
SocialSchemeMapper socialSchemeMapper = sqlSession.getMapper(SocialSchemeMapper.class);
|
||
|
||
InsuranceArchivesSocialSaveParam param = JSONObject.parseObject(paramReq.getBaseForm(), InsuranceArchivesSocialSaveParam.class);
|
||
SalaryAssert.notNull("员工id为空", param, param.getEmployeeId());
|
||
//删除社保数据
|
||
socialSchemeMapper.batchDeleteByEmployeeIds(Collections.singletonList(param.getEmployeeId()));
|
||
|
||
InsuranceArchivesSocialSchemePO insuranceArchivesSocialSchemePO =
|
||
InsuranceArchivesSocialSchemePO.builder()
|
||
//.id(IdGenerator.generate())
|
||
.welfareType(paramReq.getWelfareType().getValue())
|
||
.deleteType(DeleteTypeEnum.NOT_DELETED.getValue())
|
||
.socialPaymentBaseString(paramReq.getPaymentForm())
|
||
.socialSchemeId(param.getSocialName())
|
||
.createTime(new Date())
|
||
.socialEndTime(param.getSocialEndTime())
|
||
.socialStartTime(param.getSocialStartTime())
|
||
.creator(employeeId)
|
||
.nonPayment(param.getNonPayment())
|
||
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||
.employeeId(param.getEmployeeId())
|
||
.updateTime(new Date())
|
||
.underTake(param.getUnderTake().getValue())
|
||
.socialAccount(param.getSchemeAccount())
|
||
.paymentOrganization(param.getPaymentOrganization())
|
||
.build();
|
||
socialSchemeMapper.batchSave(Collections.singletonList(insuranceArchivesSocialSchemePO));
|
||
|
||
sqlSession.commit();
|
||
}finally {
|
||
sqlSession.close();
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 档案列表
|
||
* <p>
|
||
* 这里是一个含有比较多动态字段的列表,用的是手动拼装的方式
|
||
* @param param 高级搜索条件
|
||
* @param operateId 操作员id
|
||
* @return table
|
||
*/
|
||
public Map<String, Object> listPage(InsuranceArchivesListParam param, long operateId) {
|
||
Map<String, Object> apidatas = new HashMap<>(16);
|
||
InsuranceArchivesListParam request = InsuranceArchivesListParam.builder().build();
|
||
if (param.getHireDate() != null && param.getHireDate().length == 2) {
|
||
param.setHiredateStart(param.getHireDate()[0]);
|
||
param.setHiredateEnd(param.getHireDate()[1]);
|
||
}
|
||
if (param.getDimissionDate() != null && param.getDimissionDate().length == 2) {
|
||
param.setDimissionDateStart(param.getDimissionDate()[0]);
|
||
param.setDimissionDateEnd(param.getDimissionDate()[1]);
|
||
}
|
||
Integer current = param.getCurrent() == null ? 1 : param.getCurrent();
|
||
Integer pageSize = param.getPageSize() == null ? 10 : param.getPageSize();
|
||
long startNum = (current - 1) * pageSize;
|
||
param.setStartNum(startNum);
|
||
param.setPageSize(pageSize);
|
||
if (Objects.equals("fromQuickSearch", param.getDataSource())) {
|
||
request.setStatuses(param.getStatuses());
|
||
request.setKeyword(param.getUserName());
|
||
request.setStartNum(param.getStartNum());
|
||
request.setPageSize(param.getPageSize());
|
||
request.setCurrent(current);
|
||
} else {
|
||
request = param;
|
||
}
|
||
|
||
apidatas = listPageEmployeePOS(request, operateId);
|
||
|
||
return apidatas;
|
||
}
|
||
|
||
|
||
|
||
/**
|
||
* 获取员工的基本信息
|
||
* <p>
|
||
* 此处主要是一个公共接口,有多处引用。我们薪资系统只保存员工id(employeeId),
|
||
* 但是页面上需要展示员工的更多信息(姓名,部门,状态。。。),
|
||
* 所以这里主要是用于接收联表数据的一个接口
|
||
*
|
||
* @param param 高级搜索条件,用于过滤数据
|
||
* @param operateId 操作员id
|
||
* @return list
|
||
*/
|
||
public Map<String, Object> listPageEmployeePOS(InsuranceArchivesListParam param, long operateId) {
|
||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||
Map<String, Object> datas = new HashMap<>(16);
|
||
try {
|
||
SocialSchemeMapper socialSchemeMapper = sqlSession.getMapper(SocialSchemeMapper.class);
|
||
PageUtil.start(param.getCurrent(), param.getPageSize());
|
||
List<InsuranceArchivesEmployeePO> page = socialSchemeMapper.listPageEmployeePOS(param);
|
||
PageInfo<InsuranceArchivesEmployeePO> pageInfo = new PageInfo<>(page, InsuranceArchivesEmployeePO.class);
|
||
List<Map<String, Object>> records = buildTableData(param, page);
|
||
List<WeaTableColumn> columns = buildWeaTableColumns(page, operateId);
|
||
|
||
WeaTable table = new WeaTable();
|
||
table.setColumns(columns);
|
||
//设置check是否可用
|
||
List<WeaTableCheckboxpopedom> checkboxpopedomList = new ArrayList<>();
|
||
WeaTableCheckboxpopedom checkboxpopedom = new WeaTableCheckboxpopedom();
|
||
checkboxpopedom.setPopedompara("column:system_type");
|
||
checkboxpopedom.setShowmethod("com.engine.salary.transmethod.TaxRateTransMethod.getCheckBoxPopedom");
|
||
checkboxpopedomList.add(checkboxpopedom);
|
||
table.setCheckboxList(checkboxpopedomList);
|
||
table.setCheckboxpopedom(null);
|
||
|
||
WeaResultMsg result = new WeaResultMsg(false);
|
||
result.putAll(table.makeDataResult());
|
||
result.success();
|
||
|
||
datas.put("pageInfo", pageInfo);
|
||
datas.put("datas",records);
|
||
datas.put("columns",columns);
|
||
datas.put("dataKey",result.getResultMap());
|
||
return datas;
|
||
|
||
}finally {
|
||
sqlSession.close();
|
||
}
|
||
}
|
||
|
||
/**
|
||
*
|
||
* @param
|
||
* @param operateId
|
||
* @return
|
||
*/
|
||
private List<WeaTableColumn> buildWeaTableColumns(List<InsuranceArchivesEmployeePO> insuranceArchivesEmployeePOS, long operateId) {
|
||
Map<Integer, Map<String, String>> titleMap = buildColumnTitle(insuranceArchivesEmployeePOS, operateId);
|
||
List<WeaTableColumn> list = new ArrayList<>();
|
||
WeaTableColumn nameColumn = new WeaTableColumn( "100px","姓名", "employeeName" );
|
||
nameColumn.setFixed("left");
|
||
list.add(nameColumn);
|
||
list.add(new WeaTableColumn("150px","部门", "departmentName"));
|
||
list.add(new WeaTableColumn("150px","手机号", "mobile"));
|
||
list.add(new WeaTableColumn("150px","员工状态", "status"));
|
||
list.add(new WeaTableColumn("150px","社保方案名称", "socialName"));
|
||
titleMap.get(WelfareTypeEnum.SOCIAL_SECURITY.getValue()).forEach((k, v) -> list.add(new WeaTableColumn("150px", v, k)));
|
||
list.add(new WeaTableColumn("150px","社保账号", "socialAccount"));
|
||
list.add(new WeaTableColumn("150px","社保起始缴纳月", "socialStartTime"));
|
||
list.add(new WeaTableColumn("150px","社保最后缴纳月", "socialEndTime"));
|
||
list.add(new WeaTableColumn("150px","公积金方案名称", "fundName"));
|
||
list.add(new WeaTableColumn("150px","公积金账号", "fundAccount"));
|
||
titleMap.get(WelfareTypeEnum.ACCUMULATION_FUND.getValue()).forEach((k, v) -> list.add(new WeaTableColumn("150px", v , k)));
|
||
list.add(new WeaTableColumn("150px","补充公积金账号", "supplementFundAccount" ));
|
||
list.add(new WeaTableColumn("150px","公积金起始缴纳月", "fundStartTime"));
|
||
list.add(new WeaTableColumn("150px","公积金最后缴纳月", "fundEndTime"));
|
||
list.add(new WeaTableColumn("150px","其他福利方案名称", "otherName"));
|
||
titleMap.get(WelfareTypeEnum.OTHER.getValue()).forEach((k, v) -> list.add(new WeaTableColumn("150px", v, k)));
|
||
list.add(new WeaTableColumn("150px","其他福利起始缴纳月", "otherStartTime"));
|
||
list.add(new WeaTableColumn("150px","其他福利最后缴纳月", "otherEndTime"));
|
||
return list;
|
||
}
|
||
|
||
/**
|
||
*
|
||
* @param insuranceArchivesEmployeePOS
|
||
* @param operateId
|
||
* @return
|
||
*/
|
||
public Map<Integer, Map<String, String>> buildColumnTitle(List<InsuranceArchivesEmployeePO> insuranceArchivesEmployeePOS, long operateId) {
|
||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||
Map<Integer, Map<String, String>> result = new HashMap<>();
|
||
try {
|
||
|
||
SocialSchemeMapper socialSchemeMapper = sqlSession.getMapper(SocialSchemeMapper.class);
|
||
FundSchemeMapper fundSchemeMapper = sqlSession.getMapper(FundSchemeMapper.class);
|
||
OtherSchemeMapper otherSchemeMapper = sqlSession.getMapper(OtherSchemeMapper.class);
|
||
ICategoryMapper iCategoryMapper = sqlSession.getMapper(ICategoryMapper.class);
|
||
|
||
Set<String> socialSet = new HashSet<>();
|
||
Set<String> fundSet = new HashSet<>();
|
||
Set<String> otherSet = new HashSet<>();
|
||
insuranceArchivesEmployeePOS.forEach(item -> {
|
||
List<InsuranceArchivesSocialSchemePO> socialList = socialSchemeMapper.getSocialByEmployeeId(Collections.singletonList(item.getEmployeeId()));
|
||
InsuranceArchivesSocialSchemePO socialItem = socialList.size() != 0 ? socialList.get(0) : null;
|
||
List<InsuranceArchivesFundSchemePO> fundList = fundSchemeMapper.getFundByEmployeeId(Collections.singletonList(item.getEmployeeId()));
|
||
InsuranceArchivesFundSchemePO fundItem = fundList.size() != 0 ? fundList.get(0) : null;
|
||
List<InsuranceArchivesOtherSchemePO> otherList = otherSchemeMapper.getOtherByEmployeeId(Collections.singletonList(item.getEmployeeId()));
|
||
InsuranceArchivesOtherSchemePO otherItem = otherList.size() != 0 ? otherList.get(0) : null;
|
||
if (socialItem != null) {
|
||
Map<String, Object> socialJson = JSON.parseObject(socialItem.getSocialPaymentBaseString(), new TypeReference<Map<String, Object>>() {
|
||
});
|
||
if (socialJson != null) {
|
||
socialJson.forEach((k, v) -> socialSet.add(k));
|
||
}
|
||
}
|
||
if (fundItem != null) {
|
||
Map<String, Object> fundJson = JSON.parseObject(fundItem.getFundPaymentBaseString(), new TypeReference<Map<String, Object>>() {
|
||
});
|
||
if (fundJson != null) {
|
||
fundJson.forEach((k, v) -> fundSet.add(k));
|
||
}
|
||
}
|
||
if (otherItem != null) {
|
||
Map<String, Object> otherJson = JSON.parseObject(otherItem.getOtherPaymentBaseString(), new TypeReference<Map<String, Object>>() {
|
||
});
|
||
if (otherJson != null) {
|
||
otherJson.forEach((k, v) -> otherSet.add(k));
|
||
}
|
||
}
|
||
});
|
||
Map<String, String> socialMap = new HashMap<>();
|
||
Map<Long, ICategoryPO> socialCollect = new HashMap<>();
|
||
Map<Long, ICategoryPO> customSocial = iCategoryMapper.listByWelfareType(WelfareTypeEnum.SOCIAL_SECURITY.getValue(),null)
|
||
.stream().collect(Collectors.toMap(ICategoryPO::getId, Function.identity()));
|
||
|
||
Map<Long, ICategoryPO> sysSocial = iCategoryMapper.listByWelfareType(WelfareTypeEnum.SOCIAL_SECURITY.getValue(),DataTypeEnum.SYSTEM.getValue())
|
||
.stream().collect(Collectors.toMap(ICategoryPO::getId, Function.identity()));
|
||
|
||
socialCollect.putAll(customSocial);
|
||
socialCollect.putAll(sysSocial);
|
||
socialSet.forEach(item -> {
|
||
if (socialCollect.containsKey(Long.valueOf(item))) {
|
||
socialMap.put(item, socialCollect.get(Long.valueOf(item)).getInsuranceName() + "申报基数");
|
||
}
|
||
});
|
||
Map<String, String> fundMap = new HashMap<>();
|
||
Map<Long, ICategoryPO> fundCollect = new HashMap<>();
|
||
Map<Long, ICategoryPO> customFund = iCategoryMapper.listByWelfareType(WelfareTypeEnum.ACCUMULATION_FUND.getValue(),null).stream().collect(Collectors.toMap(ICategoryPO::getId, Function.identity()));
|
||
Map<Long, ICategoryPO> sysFund = iCategoryMapper.listByWelfareType(WelfareTypeEnum.ACCUMULATION_FUND.getValue(),DataTypeEnum.SYSTEM.getValue()).stream().collect(Collectors.toMap(ICategoryPO::getId, Function.identity()));
|
||
fundCollect.putAll(customFund);
|
||
fundCollect.putAll(sysFund);
|
||
fundSet.forEach(item -> {
|
||
if (fundCollect.containsKey(Long.valueOf(item))) {
|
||
fundMap.put(item, fundCollect.get(Long.valueOf(item)).getInsuranceName() + "申报基数");
|
||
}
|
||
});
|
||
Map<String, String> otherMap = new HashMap<>();
|
||
Map<Long, ICategoryPO> otherCollect = new HashMap<>();
|
||
Map<Long, ICategoryPO> customOther = iCategoryMapper.listByWelfareType(WelfareTypeEnum.OTHER.getValue(),null).stream().collect(Collectors.toMap(ICategoryPO::getId, Function.identity()));
|
||
Map<Long, ICategoryPO> sysOther = iCategoryMapper.listByWelfareType(WelfareTypeEnum.OTHER.getValue(),DataTypeEnum.SYSTEM.getValue()).stream().collect(Collectors.toMap(ICategoryPO::getId, Function.identity()));
|
||
otherCollect.putAll(customOther);
|
||
otherCollect.putAll(sysOther);
|
||
otherSet.forEach(item -> {
|
||
if (otherCollect.containsKey(Long.valueOf(item))) {
|
||
otherMap.put(item, otherCollect.get(Long.valueOf(item)).getInsuranceName() + "申报基数");
|
||
}
|
||
});
|
||
|
||
result.put(WelfareTypeEnum.SOCIAL_SECURITY.getValue(), socialMap);
|
||
result.put(WelfareTypeEnum.ACCUMULATION_FUND.getValue(), fundMap);
|
||
result.put(WelfareTypeEnum.OTHER.getValue(), otherMap);
|
||
return result;
|
||
}finally {
|
||
sqlSession.close();
|
||
}
|
||
|
||
|
||
}
|
||
|
||
|
||
/**
|
||
*
|
||
* @param param
|
||
* @param insuranceArchivesEmployeePOS
|
||
* @return
|
||
*/
|
||
private List<Map<String, Object>> buildTableData(InsuranceArchivesListParam param, List<InsuranceArchivesEmployeePO> insuranceArchivesEmployeePOS) {
|
||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||
List<Map<String, Object>> records = new ArrayList<>();
|
||
try {
|
||
SocialSchemeMapper socialSchemeMapper = sqlSession.getMapper(SocialSchemeMapper.class);
|
||
FundSchemeMapper fundSchemeMapper = sqlSession.getMapper(FundSchemeMapper.class);
|
||
OtherSchemeMapper otherSchemeMapper = sqlSession.getMapper(OtherSchemeMapper.class);
|
||
InsuranceSchemeMapper insuranceSchemeMapper = sqlSession.getMapper(InsuranceSchemeMapper.class);
|
||
|
||
List<Long> employeeIds = insuranceArchivesEmployeePOS.stream().map(InsuranceArchivesEmployeePO::getEmployeeId).collect(Collectors.toList());
|
||
Map<Long, InsuranceArchivesSocialSchemePO> socialSchemePOMap = socialSchemeMapper.getSocialByEmployeeId(employeeIds)
|
||
.stream().collect(Collectors.toMap(InsuranceArchivesSocialSchemePO::getEmployeeId, Function.identity()));
|
||
|
||
Map<Long, InsuranceArchivesFundSchemePO> fundSchemePOMap = fundSchemeMapper.getFundByEmployeeId(employeeIds)
|
||
.stream().collect(Collectors.toMap(InsuranceArchivesFundSchemePO::getEmployeeId, Function.identity()));
|
||
Map<Long, InsuranceArchivesOtherSchemePO> otherSchemePOMap = otherSchemeMapper.getOtherByEmployeeId(employeeIds)
|
||
.stream().collect(Collectors.toMap(InsuranceArchivesOtherSchemePO::getEmployeeId, Function.identity()));
|
||
insuranceArchivesEmployeePOS.forEach(item -> {
|
||
InsuranceArchivesSocialSchemePO socialItem = socialSchemePOMap.get(item.getEmployeeId());
|
||
InsuranceArchivesFundSchemePO fundItem = fundSchemePOMap.get(item.getEmployeeId());
|
||
InsuranceArchivesOtherSchemePO otherItem = otherSchemePOMap.get(item.getEmployeeId());
|
||
Map<String, Object> map = new HashMap<>();
|
||
map.put("employeeName", item.getUserName());
|
||
map.put("employeeId", item.getEmployeeId());
|
||
map.put("departmentName", item.getDepartmentName());
|
||
map.put("departmentId", item.getDepartmentId());
|
||
map.put("jobNum", item.getJobNum());
|
||
map.put("mobile", item.getTelephone());
|
||
map.put("status", item.getUserStatusEnum() == null ? "" : item.getUserStatusEnum().getDescription());
|
||
if (socialItem != null) {
|
||
map.put("socialName", insuranceSchemeMapper.querySchemeName(socialItem.getSocialSchemeId()));
|
||
Map<String, Object> socialJson = JSON.parseObject(socialItem.getSocialPaymentBaseString(), new TypeReference<Map<String, Object>>() {
|
||
});
|
||
if (socialJson != null) {
|
||
SalaryEntityUtil.thousandthConvert(socialJson, map);
|
||
}
|
||
map.put("socialAccount", socialItem.getSocialAccount());
|
||
map.put("socialStartTime", socialItem.getSocialStartTime());
|
||
map.put("socialEndTime", socialItem.getSocialEndTime());
|
||
}
|
||
if (fundItem != null) {
|
||
map.put("fundName", insuranceSchemeMapper.querySchemeName(fundItem.getFundSchemeId()));
|
||
map.put("fundAccount", fundItem.getFundAccount());
|
||
Map<String, Object> fundJson = JSON.parseObject(fundItem.getFundPaymentBaseString(), new TypeReference<Map<String, Object>>() {
|
||
});
|
||
if (fundJson != null) {
|
||
SalaryEntityUtil.thousandthConvert(fundJson, map);
|
||
}
|
||
map.put("supplementFundAccount", fundItem.getSupplementFundAccount());
|
||
map.put("fundStartTime", fundItem.getFundStartTime());
|
||
map.put("fundEndTime", fundItem.getFundEndTime());
|
||
|
||
}
|
||
if (otherItem != null) {
|
||
map.put("otherName", insuranceSchemeMapper.querySchemeName(otherItem.getOtherSchemeId()));
|
||
Map<String, Object> otherJson = JSON.parseObject(otherItem.getOtherPaymentBaseString(), new TypeReference<Map<String, Object>>() {
|
||
});
|
||
if (otherJson != null) {
|
||
SalaryEntityUtil.thousandthConvert(otherJson, map);
|
||
}
|
||
map.put("otherStartTime", otherItem.getOtherStartTime());
|
||
map.put("otherEndTime", otherItem.getOtherEndTime());
|
||
}
|
||
records.add(map);
|
||
});
|
||
return records;
|
||
|
||
}finally {
|
||
sqlSession.close();
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 获取信息提示
|
||
*/
|
||
public void tips() {
|
||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||
try {
|
||
SocialSchemeMapper socialSchemeMapper = sqlSession.getMapper(SocialSchemeMapper.class);
|
||
List<Long> employeeIds = socialSchemeMapper.tips();
|
||
SalaryAssert.isEmpty(employeeIds, "当前有离职人员档案存在福利缴纳起始月,未维护福利最后缴纳月,请尽快处理");
|
||
|
||
}finally {
|
||
sqlSession.close();
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 高级搜索
|
||
* @return
|
||
*/
|
||
public Map<String, Object> getSearchCondition(User user) {
|
||
|
||
List<SearchConditionOption> userStatusOptions = Arrays.stream(UserStatusEnum.values()).map(e -> new SearchConditionOption(String.valueOf(e.getValue()), e.getDescription())).collect(Collectors.toList());
|
||
List<InsuranceSchemePO> list = new SISchemeBiz().listAll();
|
||
|
||
List<SearchConditionOption> schemeOption = list.stream().filter(item -> Objects.equals(item.getWelfareType(), WelfareTypeEnum.SOCIAL_SECURITY.getValue()))
|
||
.collect(Collectors.toList())
|
||
.stream().map(item -> new SearchConditionOption(item.getId().toString(), item.getSchemeName())).collect(Collectors.toList());
|
||
|
||
List<SearchConditionOption> fundOption = list.stream().filter(item -> Objects.equals(item.getWelfareType(), WelfareTypeEnum.ACCUMULATION_FUND.getValue()))
|
||
.collect(Collectors.toList())
|
||
.stream().map(item -> new SearchConditionOption(item.getId().toString(), item.getSchemeName())).collect(Collectors.toList());
|
||
|
||
List<SearchConditionOption> otherOption = list.stream().filter(item -> Objects.equals(item.getWelfareType(), WelfareTypeEnum.OTHER.getValue()))
|
||
.collect(Collectors.toList())
|
||
.stream().map(item -> new SearchConditionOption(item.getId().toString(), item.getSchemeName())).collect(Collectors.toList());
|
||
|
||
|
||
|
||
|
||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||
|
||
//条件组
|
||
List<SearchConditionGroup> addGroups = new ArrayList<SearchConditionGroup>();
|
||
|
||
List<SearchConditionItem> conditionItems = new ArrayList<SearchConditionItem>();
|
||
|
||
//文本输入框
|
||
SearchConditionItem username = conditionFactory.createCondition(ConditionType.INPUT,25034, "username");
|
||
username.setColSpan(2);//定义一行显示条件数,默认值为2,当值为1时标识该条件单独占一行
|
||
username.setFieldcol(16); //条件输入框所占宽度,默认值18
|
||
username.setLabelcol(8);
|
||
username.setViewAttr(2); // 编辑权限 1:只读,2:可编辑, 3:必填 默认2
|
||
username.setLabel("姓名"); //设置文本值 这个将覆盖多语言标签的值
|
||
conditionItems.add(username);
|
||
|
||
//文本输入框
|
||
SearchConditionItem jobNum = conditionFactory.createCondition(ConditionType.INPUT,25034, "jobNum");
|
||
username.setColSpan(2);//定义一行显示条件数,默认值为2,当值为1时标识该条件单独占一行
|
||
username.setFieldcol(16); //条件输入框所占宽度,默认值18
|
||
username.setLabelcol(8);
|
||
username.setViewAttr(2); // 编辑权限 1:只读,2:可编辑, 3:必填 默认2
|
||
username.setLabel("工号"); //设置文本值 这个将覆盖多语言标签的值
|
||
conditionItems.add(jobNum);
|
||
|
||
|
||
SearchConditionItem departmentIds = conditionFactory.createCondition(ConditionType.BROWSER,502327,"departmentIds", "57");
|
||
departmentIds.setColSpan(2);
|
||
departmentIds.setFieldcol(16);
|
||
departmentIds.setLabelcol(8);
|
||
departmentIds.setIsQuickSearch(true);
|
||
departmentIds.setLabel("部门");
|
||
conditionItems.add(departmentIds);
|
||
|
||
|
||
SearchConditionItem statuses = conditionFactory.createCondition(ConditionType.SELECT,502327,"statuses");
|
||
statuses.setOptions(userStatusOptions);
|
||
statuses.setColSpan(2);
|
||
statuses.setFieldcol(16);
|
||
statuses.setLabelcol(8);
|
||
statuses.setIsQuickSearch(true);
|
||
statuses.setLabel("状态");
|
||
conditionItems.add(statuses);
|
||
|
||
|
||
|
||
SearchConditionItem positions = conditionFactory.createCondition(ConditionType.BROWSER,502327,"positions", "278");
|
||
positions.setColSpan(2);
|
||
positions.setFieldcol(16);
|
||
positions.setLabelcol(8);
|
||
positions.setIsQuickSearch(true);
|
||
positions.setLabel("岗位");
|
||
conditionItems.add(positions);
|
||
|
||
|
||
SearchConditionItem hireDate = conditionFactory.createCondition(ConditionType.TIMEPICKER,502327,new String[]{"hireDate", "hireDate"});
|
||
hireDate.setColSpan(2);
|
||
hireDate.setFieldcol(16);
|
||
hireDate.setViewAttr(8);
|
||
hireDate.setLabel("入职日期");
|
||
conditionItems.add(hireDate);
|
||
|
||
|
||
SearchConditionItem dimissionDate = conditionFactory.createCondition(ConditionType.TIMEPICKER,502327,new String[]{"dimissionDate", "dimissionDate"});
|
||
dimissionDate.setColSpan(2);
|
||
dimissionDate.setFieldcol(16);
|
||
dimissionDate.setViewAttr(8);
|
||
dimissionDate.setLabel("离职日期");
|
||
conditionItems.add(dimissionDate);
|
||
|
||
|
||
SearchConditionItem siSchemeId = conditionFactory.createCondition(ConditionType.SELECT,502327,"siSchemeId");
|
||
siSchemeId.setOptions(schemeOption);
|
||
siSchemeId.setColSpan(2);
|
||
siSchemeId.setFieldcol(16);
|
||
siSchemeId.setLabelcol(8);
|
||
siSchemeId.setIsQuickSearch(true);
|
||
siSchemeId.setLabel("社保方案");
|
||
conditionItems.add(siSchemeId);
|
||
|
||
|
||
SearchConditionItem fundSchemeId = conditionFactory.createCondition(ConditionType.SELECT,502327,"fundSchemeId");
|
||
fundSchemeId.setOptions(fundOption);
|
||
fundSchemeId.setColSpan(2);
|
||
fundSchemeId.setFieldcol(16);
|
||
fundSchemeId.setLabelcol(8);
|
||
fundSchemeId.setIsQuickSearch(true);
|
||
fundSchemeId.setLabel("公积金方案");
|
||
conditionItems.add(fundSchemeId);
|
||
|
||
SearchConditionItem otherSchemeId = conditionFactory.createCondition(ConditionType.SELECT,502327,"otherSchemeId");
|
||
otherSchemeId.setOptions(otherOption);
|
||
otherSchemeId.setColSpan(2);
|
||
otherSchemeId.setFieldcol(16);
|
||
otherSchemeId.setLabelcol(8);
|
||
otherSchemeId.setIsQuickSearch(true);
|
||
otherSchemeId.setLabel("其它福利方案");
|
||
conditionItems.add(otherSchemeId);
|
||
|
||
addGroups.add(new SearchConditionGroup("常用条件",true,conditionItems));
|
||
apidatas.put("condition",addGroups);
|
||
return apidatas;
|
||
}
|
||
|
||
/**
|
||
* 组装员工的社保,公积金,其他福利数据
|
||
*
|
||
* @param ids 员工id集合
|
||
* @param tenantKey 租户key
|
||
* @return map
|
||
*/
|
||
public Map<Long, InsuranceArchivesAccountPO> buildBatchAccount(List<Long> ids, String tenantKey) {
|
||
if (CollectionUtils.isEmpty(ids)) {
|
||
return new HashMap<>();
|
||
}
|
||
Map<Long, InsuranceArchivesAccountPO> result = new HashMap<>();
|
||
Map<Long, InsuranceArchivesSocialSchemePO> socialMap = new HashMap<>();
|
||
Map<Long, InsuranceArchivesFundSchemePO> funMap = new HashMap<>();
|
||
Map<Long, InsuranceArchivesOtherSchemePO> otherMap = new HashMap<>();
|
||
List<InsuranceArchivesSocialSchemePO> socialPOS = MapperProxyFactory.getProxy(SocialSchemeMapper.class).getSocialByEmployeeId(ids);
|
||
if (CollectionUtils.isNotEmpty(socialPOS)) {
|
||
socialMap = socialPOS.stream().collect(Collectors.toMap(InsuranceArchivesSocialSchemePO::getEmployeeId, Function.identity()));
|
||
}
|
||
List<InsuranceArchivesFundSchemePO> fundPOS = MapperProxyFactory.getProxy(FundSchemeMapper.class).getFundByEmployeeId(ids);
|
||
if (CollectionUtils.isNotEmpty(fundPOS)) {
|
||
funMap = fundPOS.stream().collect(Collectors.toMap(InsuranceArchivesFundSchemePO::getEmployeeId, Function.identity()));
|
||
}
|
||
List<InsuranceArchivesOtherSchemePO> otherPOS = MapperProxyFactory.getProxy(OtherSchemeMapper.class).getOtherByEmployeeId(ids);
|
||
if (CollectionUtils.isNotEmpty(otherPOS)) {
|
||
otherMap = otherPOS.stream().collect(Collectors.toMap(InsuranceArchivesOtherSchemePO::getEmployeeId, Function.identity()));
|
||
}
|
||
for (Long id : ids) {
|
||
InsuranceArchivesAccountPO po = new InsuranceArchivesAccountPO();
|
||
po.setSocial(socialMap.get(id));
|
||
po.setFund(funMap.get(id));
|
||
po.setOther(otherMap.get(id));
|
||
result.put(id, po);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
}
|