2022-03-01 16:45:57 +08:00
|
|
|
package com.engine.salary.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.engine.core.impl.Service;
|
2022-03-02 11:09:23 +08:00
|
|
|
import com.engine.salary.cmd.TaxRate.*;
|
2022-04-11 20:17:47 +08:00
|
|
|
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;
|
2022-03-01 16:45:57 +08:00
|
|
|
import com.engine.salary.service.TaxRateBaseService;
|
2022-04-11 20:46:25 +08:00
|
|
|
import com.engine.salary.util.db.MapperProxyFactory;
|
2022-04-11 20:17:47 +08:00
|
|
|
import com.google.common.collect.Lists;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
2022-03-01 16:45:57 +08:00
|
|
|
|
2022-04-11 20:17:47 +08:00
|
|
|
import java.util.List;
|
2022-03-01 16:45:57 +08:00
|
|
|
import java.util.Map;
|
2022-04-11 20:17:47 +08:00
|
|
|
import java.util.stream.Collectors;
|
2022-03-01 16:45:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
public class TaxRateBaseServiceImpl extends Service implements TaxRateBaseService {
|
|
|
|
|
|
2022-04-11 20:17:47 +08:00
|
|
|
|
|
|
|
|
private SysTaxRateBaseMapper getSysTaxRateBaseMapper(){
|
2022-04-11 20:46:25 +08:00
|
|
|
return MapperProxyFactory.getProxy(SysTaxRateBaseMapper.class);
|
2022-04-11 20:17:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private TaxRateBaseMapper getTaxRateBaseMapper(){
|
2022-04-11 20:46:25 +08:00
|
|
|
return MapperProxyFactory.getProxy(TaxRateBaseMapper.class);
|
2022-04-11 20:17:47 +08:00
|
|
|
}
|
|
|
|
|
|
2022-03-01 16:45:57 +08:00
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> listPage(Map<String, Object> params) {
|
2022-03-01 18:31:29 +08:00
|
|
|
return commandExecutor.execute(new TaxRateListCmd(params, user));
|
2022-03-01 16:45:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> save(Map<String, Object> params) {
|
2022-03-01 18:31:29 +08:00
|
|
|
return commandExecutor.execute(new TaxRateSaveCmd(params, user));
|
2022-03-01 16:45:57 +08:00
|
|
|
}
|
|
|
|
|
|
2022-03-01 18:31:29 +08:00
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> update(Map<String, Object> params) {
|
|
|
|
|
return commandExecutor.execute(new TaxRateUpdateCmd(params, user));
|
|
|
|
|
}
|
2022-03-01 16:45:57 +08:00
|
|
|
|
2022-03-02 11:09:23 +08:00
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> getForm(Map<String, Object> params) {
|
|
|
|
|
return commandExecutor.execute(new TaxRateGetFormCmd(params, user));
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-01 16:45:57 +08:00
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> delete(Map<String, Object> params) {
|
2022-03-01 18:31:29 +08:00
|
|
|
return commandExecutor.execute(new TaxRateDeleteCmd(params, user));
|
2022-03-01 16:45:57 +08:00
|
|
|
}
|
|
|
|
|
|
2022-04-11 20:17:47 +08:00
|
|
|
@Override
|
|
|
|
|
public List<TaxRateBase> list() {
|
|
|
|
|
List<TaxRateBase> resultList = Lists.newArrayList();
|
|
|
|
|
// 查询系统默认的税率表
|
|
|
|
|
List<SysTaxRateBase> sysTaxRateBasePOS = getSysTaxRateBaseMapper().listAll();
|
|
|
|
|
|
|
|
|
|
List<TaxRateBase> taxRateBasePOS4Sys = sysTaxRateBasePOS.stream()
|
|
|
|
|
.map(sysTaxRateBasePO -> {
|
|
|
|
|
TaxRateBase taxRateBasePO = new TaxRateBase();
|
|
|
|
|
BeanUtils.copyProperties(sysTaxRateBasePO, taxRateBasePO);
|
|
|
|
|
return taxRateBasePO;
|
|
|
|
|
})
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
resultList.addAll(taxRateBasePOS4Sys);
|
|
|
|
|
// 查询自定义税率表
|
|
|
|
|
List<TaxRateBase> taxRateBasePOS = getTaxRateBaseMapper().listAll();
|
|
|
|
|
resultList.addAll(taxRateBasePOS);
|
|
|
|
|
return resultList;
|
|
|
|
|
}
|
2022-03-01 16:45:57 +08:00
|
|
|
|
|
|
|
|
}
|