This commit is contained in:
钱涛 2024-01-09 10:53:59 +08:00
parent c54f9daa2d
commit e0d4820e2e
5 changed files with 105 additions and 95 deletions

View File

@ -478,8 +478,6 @@ public class GetDeclareTaxResultFeedbackResponse extends BaseResponse {
/** /**
* 累计专项附加扣除额 必填null 专项附加合计 * 累计专项附加扣除额 必填null 专项附加合计
*/ */
@SalaryTableColumn(text = "累计专项附加扣除额", width = "10%", column = "ljzxfjkce")
@ExcelHead(title = "累计专项附加扣除额", dataIndex = "ljzxfjkce")
private BigDecimal ljzxfjkce; private BigDecimal ljzxfjkce;
/** /**

View File

@ -10,6 +10,7 @@ import com.engine.salary.util.page.PageInfo;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 个税申报表明细 * 个税申报表明细
@ -90,7 +91,7 @@ public interface TaxDeclarationValueService {
* 对比 * 对比
* @param taxDeclareRecordId * @param taxDeclareRecordId
*/ */
void contrast(Long taxDeclareRecordId); Map<String, Object> contrast(Long taxDeclareRecordId);
} }

View File

@ -31,7 +31,6 @@ import com.engine.salary.util.JsonUtil;
import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryEnumUtil; import com.engine.salary.util.SalaryEnumUtil;
import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.excel.ExcelUtil;
import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil; import com.engine.salary.util.page.SalaryPageUtil;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
@ -334,51 +333,21 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar
} }
@Override @Override
public void contrast(Long taxDeclareRecordId) { public Map<String, Object> contrast(Long taxDeclarationId) {
TaxDeclareRecordPO taxDeclareRecordPO = getTaxDeclareRecordMapper().getById(taxDeclareRecordId);
TaxDeclarationPO taxDeclaration = getTaxDeclarationService(user).getById(taxDeclarationId);
if (taxDeclaration == null) {
throw new SalaryRunTimeException("无申报表");
}
TaxDeclareRecordPO taxDeclareRecordPO = getTaxDeclareRecordMapper().getById(taxDeclaration.getTaxDeclareRecordId());
if (taxDeclareRecordPO == null) { if (taxDeclareRecordPO == null) {
throw new SalaryRunTimeException("申报记录不存在!"); throw new SalaryRunTimeException("申报记录不存在!");
} }
List<TaxDeclarationPO> taxDeclarations = getTaxDeclarationService(user).listByTaxDeclareRecordId(taxDeclareRecordId);
if (CollectionUtils.isEmpty(taxDeclarations)) {
throw new SalaryRunTimeException("无申报表");
}
Map<String, List<Map<String, Object>>> localData = new HashMap<>();
for (TaxDeclarationPO taxDeclaration : taxDeclarations) {
List<TaxDeclarationValuePO> taxDeclarationValues = listByTaxDeclarationId(taxDeclaration.getId());
// 查询个税申报表表头
IncomeCategoryEnum incomeCategoryEnum = SalaryEnumUtil.enumMatchByValue(taxDeclaration.getIncomeCategory(), IncomeCategoryEnum.class);
List<TaxReportColumnPO> taxReportColumns = getTaxReportColumnService(user).listByIncomeCategory(incomeCategoryEnum);
// 人员id
Set<Long> employeeIds = SalaryEntityUtil.properties(taxDeclarationValues, TaxDeclarationValuePO::getEmployeeId);
// 查询报送的人员
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<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<ExtEmpPO> extEmployees = getExtEmpService(user).getExtEmpByIds(extEmployeeIds);
// 列表数据
List<Map<String, Object>> data = TaxDeclarationValueList.buildTableData(incomeCategoryEnum, taxReportColumns, taxDeclarationValues,
employeeDeclares, simpleEmployees, simpleUserInfos, extEmployees, true);
localData.put(incomeCategoryEnum.getDefaultLabel(), data);
}
//线上数据
DeclareClient declareClient = new DeclareClient(taxDeclareRecordPO.getTaxAgentId()); DeclareClient declareClient = new DeclareClient(taxDeclareRecordPO.getTaxAgentId());
GetDeclareTaxResultFeedbackResponse declareTaxResultFeedbackResponse = declareClient.getDeclareTaxResultFeedback(taxDeclareRecordPO.getDeclareRequestId()); GetDeclareTaxResultFeedbackResponse declareTaxResultFeedbackResponse = declareClient.getDeclareTaxResultFeedback(taxDeclareRecordPO.getDeclareRequestId());
@ -386,51 +355,88 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar
List<TaxDeclarationPO> list = getTaxDeclarationService(user).listByTaxDeclareRecordId(taxDeclareRecordPO.getId()); List<TaxDeclarationPO> list = getTaxDeclarationService(user).listByTaxDeclareRecordId(taxDeclareRecordPO.getId());
list.stream().map(TaxDeclarationPO::getIncomeCategory).map(IncomeCategoryEnum::parseByValue).forEach(e -> e.parseGetDeclareTaxResultFeedbackResponse(onlineDataMap, declareTaxResultFeedbackResponse)); list.stream().map(TaxDeclarationPO::getIncomeCategory).map(IncomeCategoryEnum::parseByValue).forEach(e -> e.parseGetDeclareTaxResultFeedbackResponse(onlineDataMap, declareTaxResultFeedbackResponse));
for (String incomeCategory : localData.keySet()) { Map<String, Object> resultList = new HashMap<>();
List<Map<String, Object>> localList = localData.get(incomeCategory); List<TaxDeclarationValuePO> taxDeclarationValues = listByTaxDeclarationId(taxDeclaration.getId());
Map<String, Map<String, Object>> localMap = new HashMap<>(); // 查询个税申报表表头
for (Map<String, Object> map : localList) { IncomeCategoryEnum incomeCategoryEnum = SalaryEnumUtil.enumMatchByValue(taxDeclaration.getIncomeCategory(), IncomeCategoryEnum.class);
String no = map.getOrDefault("证件号码", "").toString(); List<TaxReportColumnPO> taxReportColumns = getTaxReportColumnService(user).listByIncomeCategory(incomeCategoryEnum);
localMap.put(no, map); List<String> columns = SalaryEntityUtil.properties(taxReportColumns, TaxReportColumnPO::getReportColumnName, Collectors.toList());
} // 人员id
Set<Long> employeeIds = SalaryEntityUtil.properties(taxDeclarationValues, TaxDeclarationValuePO::getEmployeeId);
// 查询报送的人员
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<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<ExtEmpPO> extEmployees = getExtEmpService(user).getExtEmpByIds(extEmployeeIds);
List<List<Object>> onlineData = onlineDataMap.get(incomeCategory); // 列表数据
List<Object> heads = onlineData.get(0); List<Map<String, Object>> localList = TaxDeclarationValueList.buildTableData(incomeCategoryEnum, taxReportColumns, taxDeclarationValues,
List<List<Object>> data = onlineData.subList(1, onlineData.size()); employeeDeclares, simpleEmployees, simpleUserInfos, extEmployees, true);
List<Map<String, Object>> onlineMap = new ArrayList<>();
for (int i = 0; i < data.size(); i++) {
List<Object> row = data.get(i);
Map<String, Object> m = new HashMap<>();
for (int j = 0; j < heads.size(); j++) {
String key = heads.get(j).toString();
m.put(key, row.get(j));
}
onlineMap.add(m);
}
Map<String, Map<String, Object>> onlineNoMap = new HashMap<>();
for (Map<String, Object> map : onlineMap) {
String no = map.getOrDefault("证件号码", "").toString();
onlineNoMap.put(no, map);
}
Map<String, List<Object>> header = ExcelUtil.getHeader(GetDeclareTaxResultFeedbackResponse.Body.zhsd.zcgzxj.zhsdscjgbw.class);
List<Object> list1 = header.get(header);
List<Map<String, Object>> resultList = new ArrayList<>();
for (Map<String, Object> map : localList) {
String no = map.getOrDefault("证件号码", "").toString();
Map<String, Object> d1 = localMap.get(no);
Map<String, Object> d2 = onlineNoMap.get(no);
}
Map<String, Map<String, Object>> localMap = new HashMap<>();
for (Map<String, Object> map : localList) {
String no = map.getOrDefault("证件号码", "").toString();
localMap.put(no, map);
} }
List<List<Object>> onlineData = onlineDataMap.get(incomeCategoryEnum.getDefaultLabel());
List<Object> heads = onlineData.get(0);
List<List<Object>> data = onlineData.subList(1, onlineData.size());
List<Map<String, Object>> onlineMap = new ArrayList<>();
for (int i = 0; i < data.size(); i++) {
List<Object> row = data.get(i);
Map<String, Object> m = new HashMap<>();
for (int j = 0; j < heads.size(); j++) {
String key = heads.get(j).toString();
m.put(key, row.get(j));
}
onlineMap.add(m);
}
Map<String, Map<String, Object>> onlineNoMap = new HashMap<>();
for (Map<String, Object> map : onlineMap) {
String no = map.getOrDefault("证件号码", "").toString();
onlineNoMap.put(no, map);
}
List<Map<String, Object>> oneResultList = new ArrayList<>();
for (Map<String, Object> local : localList) {
Map<String, Object> result = new HashMap<>();
result.put("姓名", local.get("姓名"));
result.put("证件类型", local.get("证件类型"));
result.put("证件号码", local.get("证件号码"));
String no = local.getOrDefault("证件号码", "").toString();
Map<String, Object> online = onlineNoMap.get(no);
taxReportColumns.stream().forEach(col -> {
Map<String, Object> temp = Maps.newHashMap();
// 系统值
Object localValue = local.getOrDefault(col.getReportColumnName(), "");
// 线下值
Object onlineValue = online.getOrDefault(col.getReportColumnName(), "");
temp.put("local", localValue);
temp.put("online", onlineValue);
result.put(col.getReportColumnName(), temp);
});
oneResultList.add(result);
}
resultList.put("columns", columns);
resultList.put("data", oneResultList);
return resultList;
} }
public static void main(String[] args) { public static void main(String[] args) {

View File

@ -184,13 +184,14 @@ public class TaxDeclarationController {
@POST @POST
@Path("/addTaxDeclaration") @Path("/addTaxDeclaration")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public String addTaxDeclarationTab(@Context HttpServletRequest request, @Context HttpServletResponse response,TaxDeclarationAddParam param) { public String addTaxDeclarationTab(@Context HttpServletRequest request, @Context HttpServletResponse response, TaxDeclarationAddParam param) {
User user = HrmUserVarify.getUser(request, response); User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<TaxDeclarationAddParam, String>(user).run(getTaxDeclareRecordWrapper(user)::addTaxDeclaration, param); return new ResponseResult<TaxDeclarationAddParam, String>(user).run(getTaxDeclareRecordWrapper(user)::addTaxDeclaration, param);
} }
/** /**
* 删除申报表 * 删除申报表
*
* @param request * @param request
* @param response * @param response
* @param param * @param param
@ -199,7 +200,7 @@ public class TaxDeclarationController {
@POST @POST
@Path("/deleteTaxDeclaration") @Path("/deleteTaxDeclaration")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public String deleteTaxDeclaration(@Context HttpServletRequest request, @Context HttpServletResponse response,TaxDeclarationDeleteParam param) { public String deleteTaxDeclaration(@Context HttpServletRequest request, @Context HttpServletResponse response, TaxDeclarationDeleteParam param) {
User user = HrmUserVarify.getUser(request, response); User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<TaxDeclarationDeleteParam, String>(user).run(getTaxDeclareRecordWrapper(user)::deleteTaxDeclaration, param); return new ResponseResult<TaxDeclarationDeleteParam, String>(user).run(getTaxDeclareRecordWrapper(user)::deleteTaxDeclaration, param);
} }
@ -281,17 +282,18 @@ public class TaxDeclarationController {
/** /**
* 对比算税过程 * 对比算税过程
*
* @param request * @param request
* @param response * @param response
* @param taxDeclareRecordParam * @param taxDeclarationId
* @return * @return
*/ */
@POST @GET
@Path("/contrast") @Path("/contrast")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public String contrast(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxDeclareRecordParam taxDeclareRecordParam) { public String contrast(@Context HttpServletRequest request, @Context HttpServletResponse response,@QueryParam(value = "taxDeclarationId") Long taxDeclarationId) {
User user = HrmUserVarify.getUser(request, response); User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long, String>(user).run(getTaxDeclareRecordWrapper(user)::contrast, taxDeclareRecordParam.getTaxDeclareRecordId()); return new ResponseResult<Long, Map<String, Object>>(user).run(getTaxDeclareRecordWrapper(user)::contrast, taxDeclarationId);
} }
@ -380,7 +382,6 @@ public class TaxDeclarationController {
} }
/** /**
* 刷新数据 * 刷新数据
* *

View File

@ -312,6 +312,7 @@ public class TaxDeclareRecordWrapper extends Service {
/** /**
* 新增申报表 * 新增申报表
*
* @param param * @param param
*/ */
public void addTaxDeclaration(TaxDeclarationAddParam param) { public void addTaxDeclaration(TaxDeclarationAddParam param) {
@ -638,10 +639,11 @@ public class TaxDeclareRecordWrapper extends Service {
/** /**
* 对比算税结果 * 对比算税结果
*
* @param id * @param id
*/ */
public void contrast(Long id) { public Map<String, Object> contrast(Long id) {
getTaxDeclarationValueService(user).contrast(id); return getTaxDeclarationValueService(user).contrast(id);
} }
/** /**
@ -724,6 +726,7 @@ public class TaxDeclareRecordWrapper extends Service {
/** /**
* 新增表单 * 新增表单
*
* @param param * @param param
* @return * @return
*/ */
@ -735,7 +738,7 @@ public class TaxDeclareRecordWrapper extends Service {
} }
// 查询个税申报表列 // 查询个税申报表列
List<TaxReportColumnPO> taxReportColumns = getTaxReportColumnService(user).listByIncomeCategory(IncomeCategoryEnum.parseByValue(taxDeclaration.getIncomeCategory()),0); List<TaxReportColumnPO> taxReportColumns = getTaxReportColumnService(user).listByIncomeCategory(IncomeCategoryEnum.parseByValue(taxDeclaration.getIncomeCategory()), 0);
//当前税款所属期报送成功且状态正常的人员 //当前税款所属期报送成功且状态正常的人员
List<EmployeeDeclarePO> employeeDeclarePOS = getEmployeeDeclareService(user).listByParam( List<EmployeeDeclarePO> employeeDeclarePOS = getEmployeeDeclareService(user).listByParam(
EmployeeDeclareListQueryParam EmployeeDeclareListQueryParam
@ -780,6 +783,7 @@ public class TaxDeclareRecordWrapper extends Service {
/** /**
* 详细信息 * 详细信息
*
* @param id * @param id
* @return * @return
*/ */
@ -801,7 +805,7 @@ public class TaxDeclareRecordWrapper extends Service {
} }
EmployeeDeclarePO employeeDeclarePO = employeeDeclarePOS.get(0); EmployeeDeclarePO employeeDeclarePO = employeeDeclarePOS.get(0);
// 查询个税申报表列 // 查询个税申报表列
List<TaxReportColumnPO> taxReportColumns = getTaxReportColumnService(user).listByIncomeCategory(IncomeCategoryEnum.parseByValue(taxDeclarationPO.getIncomeCategory()),0); List<TaxReportColumnPO> taxReportColumns = getTaxReportColumnService(user).listByIncomeCategory(IncomeCategoryEnum.parseByValue(taxDeclarationPO.getIncomeCategory()), 0);
return TaxDeclareRecordDetailFormDTO return TaxDeclareRecordDetailFormDTO
.builder() .builder()
.id(id) .id(id)