package com.engine.salary.service.impl; import com.engine.core.impl.Service; import com.engine.salary.cmd.TaxRate.*; import com.engine.salary.entity.taxrate.SysTaxRateBase; import com.engine.salary.entity.taxrate.TaxRateBase; import com.engine.salary.mapper.SysTaxRateBaseMapper; import com.engine.salary.mapper.TaxRateBaseMapper; import com.engine.salary.service.TaxRateBaseService; import com.engine.salary.util.db.MapperProxyFactory; import com.google.common.collect.Lists; import org.springframework.beans.BeanUtils; import java.util.List; import java.util.Map; import java.util.stream.Collectors; public class TaxRateBaseServiceImpl extends Service implements TaxRateBaseService { private SysTaxRateBaseMapper getSysTaxRateBaseMapper(){ return MapperProxyFactory.getProxy(SysTaxRateBaseMapper.class); } private TaxRateBaseMapper getTaxRateBaseMapper(){ return MapperProxyFactory.getProxy(TaxRateBaseMapper.class); } @Override public Map listPage(Map params) { return commandExecutor.execute(new TaxRateListCmd(params, user)); } @Override public Map save(Map params) { return commandExecutor.execute(new TaxRateSaveCmd(params, user)); } @Override public Map update(Map params) { return commandExecutor.execute(new TaxRateUpdateCmd(params, user)); } @Override public Map getForm(Map params) { return commandExecutor.execute(new TaxRateGetFormCmd(params, user)); } @Override public Map delete(Map params) { return commandExecutor.execute(new TaxRateDeleteCmd(params, user)); } @Override public List list() { List resultList = Lists.newArrayList(); // 查询系统默认的税率表 List sysTaxRateBasePOS = getSysTaxRateBaseMapper().listAll(); List taxRateBasePOS4Sys = sysTaxRateBasePOS.stream() .map(sysTaxRateBasePO -> { TaxRateBase taxRateBasePO = new TaxRateBase(); BeanUtils.copyProperties(sysTaxRateBasePO, taxRateBasePO); return taxRateBasePO; }) .collect(Collectors.toList()); resultList.addAll(taxRateBasePOS4Sys); // 查询自定义税率表 List taxRateBasePOS = getTaxRateBaseMapper().listAll(); resultList.addAll(taxRateBasePOS); return resultList; } }