2022-03-01 18:49:22 +08:00
|
|
|
package com.engine.salary.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.engine.core.impl.Service;
|
2022-04-16 15:33:51 +08:00
|
|
|
import com.engine.salary.cmd.taxDeclaration.*;
|
|
|
|
|
import com.engine.salary.common.LocalDateRange;
|
|
|
|
|
import com.engine.salary.entity.taxdeclaration.TaxDeclaration;
|
|
|
|
|
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationListQueryParam;
|
|
|
|
|
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationSaveParam;
|
|
|
|
|
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO;
|
|
|
|
|
import com.engine.salary.entity.taxrate.TaxAgent;
|
|
|
|
|
import com.engine.salary.entity.taxrate.param.TaxAgentQueryParam;
|
|
|
|
|
import com.engine.salary.mapper.TaxAgentMapper;
|
|
|
|
|
import com.engine.salary.mapper.taxdeclaration.TaxDeclarationMapper;
|
2022-03-01 18:49:22 +08:00
|
|
|
import com.engine.salary.service.TaxDeclarationService;
|
2022-04-16 15:33:51 +08:00
|
|
|
import com.engine.salary.util.SalaryDateUtil;
|
|
|
|
|
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.collections4.CollectionUtils;
|
|
|
|
|
import org.apache.ibatis.session.SqlSession;
|
|
|
|
|
import weaver.conn.mybatis.MyBatisFactory;
|
2022-03-01 18:49:22 +08:00
|
|
|
|
2022-04-19 20:58:30 +08:00
|
|
|
import java.text.SimpleDateFormat;
|
2022-04-16 15:33:51 +08:00
|
|
|
import java.util.*;
|
2022-03-01 18:49:22 +08:00
|
|
|
|
|
|
|
|
public class TaxDeclarationServiceImpl extends Service implements TaxDeclarationService {
|
|
|
|
|
|
2022-04-16 15:33:51 +08:00
|
|
|
private TaxDeclarationMapper getTaxDeclarationMapper() {
|
|
|
|
|
return MapperProxyFactory.getProxy(TaxDeclarationMapper.class);
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-01 18:49:22 +08:00
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> listPage(Map<String, Object> params) {
|
2022-03-02 09:54:55 +08:00
|
|
|
return commandExecutor.execute(new TaxDeclarationListCmd(params, user));
|
2022-03-01 18:49:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2022-04-16 15:33:51 +08:00
|
|
|
public PageInfo<TaxDeclarationPO> listPageByParam(TaxDeclarationListQueryParam queryParam) {
|
|
|
|
|
// 分页参数
|
|
|
|
|
TaxDeclarationPO po = TaxDeclarationPO.builder().build();
|
|
|
|
|
PageInfo<TaxDeclarationPO> page = new PageInfo<>();
|
|
|
|
|
LocalDateRange localDateRange = new LocalDateRange();
|
|
|
|
|
if (Objects.nonNull(queryParam.getFromSalaryMonth())) {
|
|
|
|
|
localDateRange.setFromDate(SalaryDateUtil.localDateToDate(queryParam.getFromSalaryMonth().atDay(1)));
|
|
|
|
|
}
|
|
|
|
|
if (Objects.nonNull(queryParam.getEndSalaryMonth())) {
|
|
|
|
|
localDateRange.setEndDate(SalaryDateUtil.localDateToDate(queryParam.getEndSalaryMonth().atEndOfMonth()));
|
|
|
|
|
}
|
|
|
|
|
po.setSalaryMonths(localDateRange);
|
|
|
|
|
// 查询个税申报表
|
|
|
|
|
PageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
|
|
|
|
|
List<TaxDeclarationPO> taxDeclarationPOS = getTaxDeclarationMapper().listSome(po);
|
|
|
|
|
page.setList(taxDeclarationPOS);
|
|
|
|
|
|
|
|
|
|
return page;
|
|
|
|
|
}
|
|
|
|
|
//根据id查询taxAgents
|
|
|
|
|
@Override
|
|
|
|
|
public List<TaxAgent> countByTaxDeclarationId(Collection<Long> taxAgentIds) {
|
|
|
|
|
if (CollectionUtils.isEmpty(taxAgentIds)) {
|
|
|
|
|
return Collections.emptyList();
|
|
|
|
|
}
|
|
|
|
|
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
|
|
|
|
try {
|
|
|
|
|
TaxAgentMapper taxAgentMapper = sqlSession.getMapper(TaxAgentMapper.class);
|
|
|
|
|
return taxAgentMapper.listBySome(TaxAgentQueryParam.builder().ids(taxAgentIds).build());
|
|
|
|
|
} finally {
|
|
|
|
|
sqlSession.close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//根据id获取TaxDeclaration
|
|
|
|
|
@Override
|
|
|
|
|
public TaxDeclaration getById(Long id) {
|
|
|
|
|
return getTaxDeclarationMapper().getById(id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> getForm(Map<String, Object> params) {
|
|
|
|
|
return commandExecutor.execute(new TaxDeclarationGetFormCmd(params, user));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> getTaxDeclarationInfo(Map<String, Object> params) {
|
|
|
|
|
return commandExecutor.execute(new TaxDeclarationGetTaxDeclarationInfoCmd(params, user));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void save(TaxDeclarationSaveParam saveParam) {
|
|
|
|
|
//return commandExecutor.execute(new TaxDeclarationSaveCmd(saveParam));
|
|
|
|
|
return;
|
2022-03-01 18:49:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> update(Map<String, Object> params) {
|
2022-03-02 09:54:55 +08:00
|
|
|
return commandExecutor.execute(new TaxDeclarationUpdateCmd(params, user));
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> delete(Map<String, Object> params) {
|
|
|
|
|
return commandExecutor.execute(new TaxDeclarationDeleteCmd(params, user));
|
2022-03-01 18:49:22 +08:00
|
|
|
}
|
|
|
|
|
}
|