2022-03-07 22:22:09 +08:00
|
|
|
|
package com.engine.salary.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
import com.engine.core.impl.Service;
|
2022-03-10 15:09:44 +08:00
|
|
|
|
import com.engine.salary.biz.SISchemeBiz;
|
2022-03-09 09:42:10 +08:00
|
|
|
|
import com.engine.salary.cmd.sischeme.*;
|
2022-04-22 15:17:31 +08:00
|
|
|
|
import com.engine.salary.entity.sicategory.po.ICategoryPO;
|
|
|
|
|
|
import com.engine.salary.entity.sischeme.dto.InsuranceSchemeListDTO;
|
|
|
|
|
|
import com.engine.salary.entity.sischeme.param.InsuranceSchemeParam;
|
2022-03-10 15:09:44 +08:00
|
|
|
|
import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
|
2022-04-18 20:24:43 +08:00
|
|
|
|
import com.engine.salary.entity.sischeme.po.InsuranceSchemePO;
|
2022-04-22 15:17:31 +08:00
|
|
|
|
import com.engine.salary.enums.sicategory.DeleteTypeEnum;
|
|
|
|
|
|
import com.engine.salary.enums.sicategory.IsPaymentEnum;
|
|
|
|
|
|
import com.engine.salary.enums.sicategory.PaymentTypeEnum;
|
|
|
|
|
|
import com.engine.salary.mapper.sicategory.ICategoryMapper;
|
|
|
|
|
|
import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper;
|
2022-04-18 20:24:43 +08:00
|
|
|
|
import com.engine.salary.mapper.sischeme.InsuranceSchemeMapper;
|
2022-03-07 22:22:09 +08:00
|
|
|
|
import com.engine.salary.service.SISchemeService;
|
2022-04-22 15:17:31 +08:00
|
|
|
|
import com.engine.salary.util.SalaryAssert;
|
|
|
|
|
|
import com.engine.salary.util.SalaryEnumUtil;
|
|
|
|
|
|
import com.engine.salary.util.SalaryI18nUtil;
|
2022-04-18 20:24:43 +08:00
|
|
|
|
import com.engine.salary.util.db.MapperProxyFactory;
|
2022-04-22 15:17:31 +08:00
|
|
|
|
import com.engine.salary.util.page.PageInfo;
|
|
|
|
|
|
import com.engine.salary.util.page.PageUtil;
|
2022-04-18 20:24:43 +08:00
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
2022-04-22 15:17:31 +08:00
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
2022-03-07 22:22:09 +08:00
|
|
|
|
|
2022-04-22 15:17:31 +08:00
|
|
|
|
import java.util.*;
|
2022-04-18 20:24:43 +08:00
|
|
|
|
import java.util.stream.Collectors;
|
2022-03-07 22:22:09 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @Author weaver_cl
|
|
|
|
|
|
* @Description: TODO
|
|
|
|
|
|
* @Date 2022/3/7
|
|
|
|
|
|
* @Version V1.0
|
|
|
|
|
|
**/
|
|
|
|
|
|
public class SISchemeServiceImpl extends Service implements SISchemeService {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> getForm(Map<String, Object> params) {
|
|
|
|
|
|
return commandExecutor.execute(new SISchemeGetFormCmd(params,user));
|
|
|
|
|
|
}
|
2022-03-09 09:42:10 +08:00
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> insertScheme(Map<String, Object> params) {
|
|
|
|
|
|
return commandExecutor.execute(new SISchemeInsertCmd(params,user));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> update(Map<String, Object> params) {
|
|
|
|
|
|
return commandExecutor.execute(new SISchemeUpdateCmd(params,user));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> delete(Map<String, Object> params) {
|
|
|
|
|
|
return commandExecutor.execute(new SISchemeDeleteCmd(params,user));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> copyScheme(Map<String, Object> params) {
|
|
|
|
|
|
return commandExecutor.execute(new SISchemeCopyCmd(params,user));
|
|
|
|
|
|
}
|
2022-03-10 15:09:44 +08:00
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public List<InsuranceSchemeDetailPO> queryListByInsuranceIdIsPayment(Long insuranceId, Integer isPayment) {
|
|
|
|
|
|
return new SISchemeBiz().queryListByInsuranceIdIsPayment(insuranceId,isPayment);
|
|
|
|
|
|
}
|
2022-03-10 18:23:31 +08:00
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> listPage(Map<String, Object> params) {
|
|
|
|
|
|
return commandExecutor.execute(new SISchemeListCmd(params,user));
|
|
|
|
|
|
}
|
2022-04-18 20:24:43 +08:00
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<Long, String> getSchemeIdNameMap() {
|
|
|
|
|
|
Map<Long, String> result = new HashMap<>();
|
|
|
|
|
|
List<InsuranceSchemePO> insuranceSchemePOS = MapperProxyFactory.getProxy(InsuranceSchemeMapper.class).listAll();
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(insuranceSchemePOS)) {
|
|
|
|
|
|
result = insuranceSchemePOS.stream().collect(Collectors.toMap(InsuranceSchemePO::getId, InsuranceSchemePO::getSchemeName));
|
|
|
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
2022-04-22 15:17:31 +08:00
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public PageInfo<InsuranceSchemeListDTO> list(InsuranceSchemeParam queryParam) {
|
|
|
|
|
|
SalaryAssert.notNull(queryParam.getWelfareTypeEnum(), SalaryI18nUtil.getI18nLabel( 84026, "参数错误"));
|
|
|
|
|
|
PageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
|
|
|
|
|
|
List<InsuranceSchemePO> insuranceSchemePOS = MapperProxyFactory.getProxy(InsuranceSchemeMapper.class).listByWelfareType(queryParam.getWelfareTypeEnum().getValue());
|
|
|
|
|
|
List<InsuranceSchemeListDTO> collect = insuranceSchemePOS.stream().map(item ->
|
|
|
|
|
|
InsuranceSchemeListDTO.builder()
|
|
|
|
|
|
.id(item.getId())
|
|
|
|
|
|
.paymentType(SalaryI18nUtil.getI18nLabel( buildPaymentTypeEnum(item.getPaymentType()).getLabelId(),
|
|
|
|
|
|
buildPaymentTypeEnum(item.getPaymentType()).getDefaultLabel()))
|
|
|
|
|
|
.schemeName(item.getSchemeName())
|
|
|
|
|
|
.paymentArea(item.getPaymentArea())
|
|
|
|
|
|
.paymentScope(buildPaymentScope(item.getId()))
|
|
|
|
|
|
.remarks(item.getRemarks())
|
|
|
|
|
|
.build()
|
|
|
|
|
|
).collect(Collectors.toList());
|
|
|
|
|
|
PageInfo<InsuranceSchemeListDTO> pageInfo = new PageInfo<>(collect,InsuranceSchemeListDTO.class);
|
|
|
|
|
|
return pageInfo;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public PaymentTypeEnum buildPaymentTypeEnum(Integer value) {
|
|
|
|
|
|
return SalaryEnumUtil.enumMatchByValue(value, PaymentTypeEnum.values(), PaymentTypeEnum.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 组装社保福利方案列表页【缴纳范围】
|
|
|
|
|
|
* 1、到福利方案明细表查询该方案id下面有哪些福利
|
|
|
|
|
|
* 2、去重(福利是分个人和公司的,明细表中查询出来的福利id会重复)
|
|
|
|
|
|
* 3、根据查询出来的福利id,去福利表里面查询福利的名称
|
|
|
|
|
|
* 4、组装,以“、”分割
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param id 福利方案主表id
|
|
|
|
|
|
* @return result
|
|
|
|
|
|
*/
|
|
|
|
|
|
public String buildPaymentScope(Long id) {
|
|
|
|
|
|
List<String> collect = queryInsuranceSchemeDetailList(id).stream().map(InsuranceSchemeDetailPO::getInsuranceId).distinct().collect(Collectors.toList())
|
|
|
|
|
|
.stream().map(this::queryInsuranceName).collect(Collectors.toList());
|
|
|
|
|
|
return StringUtils.join(collect, "、");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Collection<InsuranceSchemeDetailPO> queryInsuranceSchemeDetailList(Long id) {
|
|
|
|
|
|
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryInsuranceSchemeDetailList(id, IsPaymentEnum.YES.getValue());
|
|
|
|
|
|
return insuranceSchemeDetailPOS;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String queryInsuranceName(Long id) {
|
|
|
|
|
|
ICategoryPO insuranceCategoryPO = MapperProxyFactory.getProxy(ICategoryMapper.class).getById(id);
|
|
|
|
|
|
return insuranceCategoryPO == null ? "" : Objects.isNull(insuranceCategoryPO.getInsuranceName()) ? "" : insuranceCategoryPO.getInsuranceName();
|
|
|
|
|
|
}
|
2022-03-07 22:22:09 +08:00
|
|
|
|
}
|