对比线下结果,分页显示

This commit is contained in:
钱涛 2024-01-22 14:15:36 +08:00
parent 858ac8f005
commit a168aeef53
5 changed files with 47 additions and 83 deletions

View File

@ -0,0 +1,22 @@
package com.engine.salary.entity.taxdeclaration.param;
import com.engine.salary.common.BaseQueryParam;
import lombok.Data;
/**
* 对比查询
* <p>Copyright: Copyright (c) 2023</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
public class ContrastQueryParam extends BaseQueryParam {
/**
* 申报表id
*/
private Long taxDeclarationId;
}

View File

@ -1,6 +1,7 @@
package com.engine.salary.service;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationValueListDTO;
import com.engine.salary.entity.taxdeclaration.param.ContrastQueryParam;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationValueListQueryParam;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclareRecordDetailSaveParam;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO;
@ -89,9 +90,9 @@ public interface TaxDeclarationValueService {
/**
* 对比
* @param taxDeclareRecordId
* @param param
*/
Map<String, Object> contrast(Long taxDeclareRecordId);
Map<String, Object> contrast(ContrastQueryParam param);
}

View File

@ -11,6 +11,7 @@ import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO;
import com.engine.salary.entity.extemp.po.ExtEmpPO;
import com.engine.salary.entity.taxdeclaration.bo.TaxDeclarationValueList;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationValueListDTO;
import com.engine.salary.entity.taxdeclaration.param.ContrastQueryParam;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationValueListQueryParam;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclareRecordDetailSaveParam;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO;
@ -120,26 +121,18 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar
// 查询报送的人员
List<EmployeeDeclarePO> employeeDeclares = getEmployeeDeclareService(user).listByTaxCycleAndTaxAgentIdAndEmployeeIds(taxDeclaration.getTaxCycle(), taxDeclaration.getTaxAgentId(), employeeIds);
// 查询人员信息
List<Long> simpleEmployeeIds = taxDeclarationValues.stream()
.filter(taxDeclarationValue -> taxDeclarationValue.getEmployeeType() == null || Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue()))
.map(TaxDeclarationValuePO::getEmployeeId)
.distinct()
.collect(Collectors.toList());
List<Long> simpleEmployeeIds = taxDeclarationValues.stream().filter(taxDeclarationValue -> taxDeclarationValue.getEmployeeType() == null || Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue())).map(TaxDeclarationValuePO::getEmployeeId).distinct().collect(Collectors.toList());
List<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).getEmployeeByIds(simpleEmployeeIds);
// 查询人员薪资身份证号码等
List<DataCollectionEmployee> simpleUserInfos = getSalaryEmployeeService(user).getEmployeeByIds(simpleEmployeeIds);
// 查询外部人员
List<Long> extEmployeeIds = taxDeclarationValues.stream()
.filter(taxDeclarationValue -> Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.EXT_EMPLOYEE.getValue()))
.map(TaxDeclarationValuePO::getEmployeeId)
.collect(Collectors.toList());
List<Long> extEmployeeIds = taxDeclarationValues.stream().filter(taxDeclarationValue -> Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.EXT_EMPLOYEE.getValue())).map(TaxDeclarationValuePO::getEmployeeId).collect(Collectors.toList());
List<ExtEmpPO> extEmployees = getExtEmpService(user).getExtEmpByIds(extEmployeeIds);
// 列表表头
List<WeaTableColumn> weaTableColumns = TaxDeclarationValueList.buildTableColumns(taxReportColumns);
// 列表数据
List<Map<String, Object>> data = TaxDeclarationValueList.buildTableData(incomeCategoryEnum, taxReportColumns, taxDeclarationValues,
employeeDeclares, simpleEmployees, simpleUserInfos, extEmployees, false);
List<Map<String, Object>> data = TaxDeclarationValueList.buildTableData(incomeCategoryEnum, taxReportColumns, taxDeclarationValues, employeeDeclares, simpleEmployees, simpleUserInfos, extEmployees, false);
return new TaxDeclarationValueListDTO().setColumns(weaTableColumns).setData(data);
}
@ -148,8 +141,7 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar
public void batchSave(List<TaxDeclarationValuePO> taxDeclarationValues) {
if (CollectionUtils.isNotEmpty(taxDeclarationValues)) {
// 加密
taxDeclarationValues.forEach(taxDeclarationValue ->
taxDeclarationValue.setResultValueJson(JsonUtil.toJsonString(taxDeclarationValue.getResultValue())));
taxDeclarationValues.forEach(taxDeclarationValue -> taxDeclarationValue.setResultValueJson(JsonUtil.toJsonString(taxDeclarationValue.getResultValue())));
taxDeclarationValues = encryptUtil.encryptList(taxDeclarationValues, TaxDeclarationValuePO.class);
// 分批保存
List<List<TaxDeclarationValuePO>> partition = Lists.partition(taxDeclarationValues, 100);
@ -163,8 +155,7 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar
public void batchEdit(List<TaxDeclarationValuePO> taxDeclarationValues) {
if (CollectionUtils.isNotEmpty(taxDeclarationValues)) {
// 加密
taxDeclarationValues.forEach(taxDeclarationValue ->
taxDeclarationValue.setResultValueJson(JsonUtil.toJsonString(taxDeclarationValue.getResultValue())));
taxDeclarationValues.forEach(taxDeclarationValue -> taxDeclarationValue.setResultValueJson(JsonUtil.toJsonString(taxDeclarationValue.getResultValue())));
taxDeclarationValues = encryptUtil.encryptList(taxDeclarationValues, TaxDeclarationValuePO.class);
// 分批保存
List<List<TaxDeclarationValuePO>> partition = Lists.partition(taxDeclarationValues, 100);
@ -187,21 +178,7 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar
throw new SalaryRunTimeException("个税申报记录不存在!");
}
TaxDeclarationValuePO po = TaxDeclarationValuePO.builder()
.id(IdGenerator.generate())
.taxDeclarationId(param.getTaxDeclarationId())
.taxDeclareRecordId(taxDeclareRecordId)
.employeeId(param.getEmployeeId())
.employeeType(param.getEmployeeType())
.resultValue(param.getTaxReportColumnValues())
.resultValueJson(JsonUtil.toJsonString(param.getTaxReportColumnValues()))
.createTime(new Date())
.updateTime(new Date())
.source(SourceEnum.ADD.getValue())
.creator((long) user.getUID())
.deleteType(0)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build();
TaxDeclarationValuePO po = TaxDeclarationValuePO.builder().id(IdGenerator.generate()).taxDeclarationId(param.getTaxDeclarationId()).taxDeclareRecordId(taxDeclareRecordId).employeeId(param.getEmployeeId()).employeeType(param.getEmployeeType()).resultValue(param.getTaxReportColumnValues()).resultValueJson(JsonUtil.toJsonString(param.getTaxReportColumnValues())).createTime(new Date()).updateTime(new Date()).source(SourceEnum.ADD.getValue()).creator((long) user.getUID()).deleteType(0).tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY).build();
encryptUtil.encrypt(po, TaxDeclarationValuePO.class);
getTaxDeclarationValueMapper().insertIgnoreNull(po);
@ -293,52 +270,24 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar
}
taxDeclarationPO = list.get(0);
} else {
taxDeclarationPO = TaxDeclarationPO
.builder()
.id(IdGenerator.generate())
.taxDeclareRecordId(taxDeclareRecordId)
.incomeCategory(IncomeCategoryEnum.WAGES_AND_SALARIES.getValue())
.taxAgentId(taxDeclareRecord.getTaxAgentId())
.salaryMonth(taxDeclareRecord.getSalaryMonth())
.taxCycle(taxDeclareRecord.getTaxCycle())
.description(taxDeclareRecord.getRemark())
.controlView(0)
.creator((long) user.getUID())
.createTime(now)
.updateTime(now)
.deleteType(DeleteTypeEnum.NOT_DELETED.getValue())
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build();
taxDeclarationPO = TaxDeclarationPO.builder().id(IdGenerator.generate()).taxDeclareRecordId(taxDeclareRecordId).incomeCategory(IncomeCategoryEnum.WAGES_AND_SALARIES.getValue()).taxAgentId(taxDeclareRecord.getTaxAgentId()).salaryMonth(taxDeclareRecord.getSalaryMonth()).taxCycle(taxDeclareRecord.getTaxCycle()).description(taxDeclareRecord.getRemark()).controlView(0).creator((long) user.getUID()).createTime(now).updateTime(now).deleteType(DeleteTypeEnum.NOT_DELETED.getValue()).tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY).build();
List<TaxDeclarationPO> taxList = new ArrayList<>();
getTaxDeclarationService(user).saveBatch(taxList);
}
//组装数据自动补足
List<TaxDeclarationValuePO> autoAddValuePOs = autoAddIds.stream().map((empId -> {
TaxDeclarationValuePO taxDeclarationValue = TaxDeclarationValuePO.builder()
.id(IdGenerator.generate())
.taxDeclareRecordId(taxDeclarationPO.getTaxDeclareRecordId())
.taxDeclarationId(taxDeclarationPO.getId())
.employeeType(0)
.employeeId(empId)
.resultValue(valueMap)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.creator((long) user.getUID())
.deleteType(DeleteTypeEnum.NOT_DELETED.getValue())
.createTime(now)
.updateTime(now)
.source(SourceEnum.AUTO.getValue())
.build();
TaxDeclarationValuePO taxDeclarationValue = TaxDeclarationValuePO.builder().id(IdGenerator.generate()).taxDeclareRecordId(taxDeclarationPO.getTaxDeclareRecordId()).taxDeclarationId(taxDeclarationPO.getId()).employeeType(0).employeeId(empId).resultValue(valueMap).tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY).creator((long) user.getUID()).deleteType(DeleteTypeEnum.NOT_DELETED.getValue()).createTime(now).updateTime(now).source(SourceEnum.AUTO.getValue()).build();
return taxDeclarationValue;
})).collect(Collectors.toList());
batchSave(autoAddValuePOs);
}
@Override
public Map<String, Object> contrast(Long taxDeclarationId) {
public Map<String, Object> contrast(ContrastQueryParam param) {
TaxDeclarationPO taxDeclaration = getTaxDeclarationService(user).getById(taxDeclarationId);
TaxDeclarationPO taxDeclaration = getTaxDeclarationService(user).getById(param.getTaxDeclarationId());
if (taxDeclaration == null) {
throw new SalaryRunTimeException("无申报表");
}
@ -369,24 +318,16 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar
// 查询报送的人员
List<EmployeeDeclarePO> employeeDeclares = getEmployeeDeclareService(user).listByTaxCycleAndTaxAgentIdAndEmployeeIds(taxDeclaration.getTaxCycle(), taxDeclaration.getTaxAgentId(), employeeIds);
// 查询人员信息
List<Long> simpleEmployeeIds = taxDeclarationValues.stream()
.filter(taxDeclarationValue -> taxDeclarationValue.getEmployeeType() == null || Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue()))
.map(TaxDeclarationValuePO::getEmployeeId)
.distinct()
.collect(Collectors.toList());
List<Long> simpleEmployeeIds = taxDeclarationValues.stream().filter(taxDeclarationValue -> taxDeclarationValue.getEmployeeType() == null || Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue())).map(TaxDeclarationValuePO::getEmployeeId).distinct().collect(Collectors.toList());
List<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).getEmployeeByIds(simpleEmployeeIds);
// 查询人员薪资身份证号码等
List<DataCollectionEmployee> simpleUserInfos = getSalaryEmployeeService(user).getEmployeeByIds(simpleEmployeeIds);
// 查询外部人员
List<Long> extEmployeeIds = taxDeclarationValues.stream()
.filter(taxDeclarationValue -> Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.EXT_EMPLOYEE.getValue()))
.map(TaxDeclarationValuePO::getEmployeeId)
.collect(Collectors.toList());
List<Long> extEmployeeIds = taxDeclarationValues.stream().filter(taxDeclarationValue -> Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.EXT_EMPLOYEE.getValue())).map(TaxDeclarationValuePO::getEmployeeId).collect(Collectors.toList());
List<ExtEmpPO> extEmployees = getExtEmpService(user).getExtEmpByIds(extEmployeeIds);
// 列表数据
List<Map<String, Object>> localList = TaxDeclarationValueList.buildTableData(incomeCategoryEnum, taxReportColumns, taxDeclarationValues,
employeeDeclares, simpleEmployees, simpleUserInfos, extEmployees, true);
List<Map<String, Object>> localList = TaxDeclarationValueList.buildTableData(incomeCategoryEnum, taxReportColumns, taxDeclarationValues, employeeDeclares, simpleEmployees, simpleUserInfos, extEmployees, true);
Map<String, Map<String, Object>> localMap = new HashMap<>();
@ -447,7 +388,7 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar
oneResultList.add(result);
}
resultList.put("columns", columns);
resultList.put("data", oneResultList);
resultList.put("pageInfo", SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), oneResultList));
return resultList;
}
}

View File

@ -285,15 +285,15 @@ public class TaxDeclarationController {
*
* @param request
* @param response
* @param taxDeclarationId
* @param ContrastQueryParam
* @return
*/
@GET
@POST
@Path("/contrast")
@Produces(MediaType.APPLICATION_JSON)
public String contrast(@Context HttpServletRequest request, @Context HttpServletResponse response,@QueryParam(value = "taxDeclarationId") Long taxDeclarationId) {
public String contrast(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody ContrastQueryParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long, Map<String, Object>>(user).run(getTaxDeclareRecordWrapper(user)::contrast, taxDeclarationId);
return new ResponseResult<ContrastQueryParam, Map<String, Object>>(user).run(getTaxDeclareRecordWrapper(user)::contrast, param);
}

View File

@ -640,10 +640,10 @@ public class TaxDeclareRecordWrapper extends Service {
/**
* 对比算税结果
*
* @param id
* @param param
*/
public Map<String, Object> contrast(Long id) {
return getTaxDeclarationValueService(user).contrast(id);
public Map<String, Object> contrast(ContrastQueryParam param) {
return getTaxDeclarationValueService(user).contrast(param);
}
/**