Merge branch 'feature/年终奖' into release/2.6.1.2301.02
This commit is contained in:
commit
cdfced412f
|
|
@ -231,4 +231,43 @@ public class TaxDeclarationDataIndexConstant {
|
|||
* 备注
|
||||
*/
|
||||
public static final String DESCRIPTION = "description";
|
||||
|
||||
|
||||
//----------------------------年终奖-----------------------------
|
||||
|
||||
/**
|
||||
* 年终奖收入
|
||||
*/
|
||||
public static final String ANNUAL_INCOME = "annualIncome";
|
||||
|
||||
/**
|
||||
* 免税收入
|
||||
*/
|
||||
public static final String ANNUAL_TAX_FREE_INCOME = "annualTaxFreeIncome";
|
||||
|
||||
/**
|
||||
* 其他
|
||||
*/
|
||||
public static final String ANNUAL_OTHER = "annualOther";
|
||||
|
||||
/**
|
||||
* 准予扣除的捐赠额
|
||||
*/
|
||||
public static final String ANNUAL_DONATE_TAX = "annualDonateTax";
|
||||
|
||||
/**
|
||||
* 减免税额
|
||||
*/
|
||||
public static final String ANNUAL_TAX_SAVINGS = "annualTaxSavings";
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
public static final String ANNUAL_REMARK = "annualRemark";
|
||||
|
||||
/**
|
||||
* 税率
|
||||
*/
|
||||
public static final String ANNUAL_TAX_RATE = "annualTaxRate";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.engine.salary.entity.salaryitem.dto.SalaryItemListDTO;
|
|||
import com.engine.salary.entity.salaryitem.param.SalaryItemSaveParam;
|
||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import com.engine.salary.entity.salaryitem.po.SysSalaryItemPO;
|
||||
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationAnnualListDTO;
|
||||
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationLaborListDTO;
|
||||
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationWageListDTO;
|
||||
import com.engine.salary.enums.SalaryRoundingModeEnum;
|
||||
|
|
@ -168,6 +169,18 @@ public class SalaryItemBO {
|
|||
return SalaryI18nUtil.getI18nLabel((int) annotation.labelId(), annotation.text());
|
||||
}
|
||||
}
|
||||
|
||||
// 是否是个税申报表(全年一次性奖金)中的字段
|
||||
for (Field declaredField : TaxDeclarationAnnualListDTO.class.getDeclaredFields()) {
|
||||
if (!declaredField.isAnnotationPresent(SalaryTableColumn.class)) {
|
||||
continue;
|
||||
}
|
||||
// 时间紧迫,临时处理
|
||||
if (Objects.equals(code, declaredField.getName()) || Objects.equals(code, declaredField.getName() + "2")) {
|
||||
SalaryTableColumn annotation = declaredField.getAnnotation(SalaryTableColumn.class);
|
||||
return SalaryI18nUtil.getI18nLabel((int) annotation.labelId(), annotation.text());
|
||||
}
|
||||
}
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -170,6 +170,10 @@ public class TaxDeclarationBO {
|
|||
// 生成个税申报表
|
||||
handleTaxDeclaration4Labor(result, taxDeclaration, salaryAcctResultPOS, salaryItemMap);
|
||||
}
|
||||
if (Objects.equals(incomeCategory, IncomeCategoryEnum.ONETIME_ANNUAL_BONUS.getValue())) {
|
||||
// 生成个税申报表
|
||||
handleTaxDeclaration4Annual(result, taxDeclaration, salaryAcctResultPOS, salaryItemMap);
|
||||
}
|
||||
});
|
||||
});
|
||||
return result;
|
||||
|
|
@ -316,6 +320,51 @@ public class TaxDeclarationBO {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成个税申报表明细(年终奖)
|
||||
*
|
||||
* @param result
|
||||
* @param taxDeclaration
|
||||
* @param salaryAcctResults
|
||||
* @param salaryItemMap
|
||||
*/
|
||||
private static void handleTaxDeclaration4Annual(Result result,
|
||||
TaxDeclarationPO taxDeclaration,
|
||||
List<SalaryAcctResultPO> salaryAcctResults,
|
||||
Map<String, Long> salaryItemMap) {
|
||||
if (CollectionUtils.isEmpty(salaryAcctResults)) {
|
||||
return;
|
||||
}
|
||||
// 核算结果按照人员id分类
|
||||
Map<String, List<SalaryAcctResultPO>> salaryAcctResultPOMap = SalaryEntityUtil.group2Map(salaryAcctResults, salaryAcctResultPO -> EmployeeTypeEnum.ORGANIZATION.getValue() + "_" + salaryAcctResultPO.getEmployeeId());
|
||||
salaryAcctResultPOMap.forEach((key, salaryAcctResultPOS) -> {
|
||||
String[] keyArray = StringUtils.split(key, "_");
|
||||
Integer employeeType = Integer.parseInt(keyArray[0]);
|
||||
Long employeeId = Long.parseLong(keyArray[1]);
|
||||
Map<String, String> valueMap = Maps.newHashMapWithExpectedSize(7);
|
||||
Map<Long, List<SalaryAcctResultPO>> resultMap = SalaryEntityUtil.group2Map(salaryAcctResultPOS, SalaryAcctResultPO::getSalaryItemId);
|
||||
// 全年一次性奖金额
|
||||
BigDecimal laborIncome = findValue(TaxDeclarationDataIndexConstant.ANNUAL_INCOME, resultMap, salaryItemMap);
|
||||
valueMap.put(TaxDeclarationDataIndexConstant.ANNUAL_INCOME, laborIncome.toPlainString());
|
||||
// 免税收入
|
||||
BigDecimal laborTaxFreeIncome = findValue(TaxDeclarationDataIndexConstant.ANNUAL_TAX_FREE_INCOME, resultMap, salaryItemMap);
|
||||
valueMap.put(TaxDeclarationDataIndexConstant.ANNUAL_TAX_FREE_INCOME, laborTaxFreeIncome.toPlainString());
|
||||
// 其他
|
||||
BigDecimal other = findValue(TaxDeclarationDataIndexConstant.ANNUAL_OTHER, resultMap, salaryItemMap);
|
||||
valueMap.put(TaxDeclarationDataIndexConstant.ANNUAL_OTHER, other.toPlainString());
|
||||
// 准予扣除的捐赠额
|
||||
BigDecimal allowedDonation = findValue(TaxDeclarationDataIndexConstant.ANNUAL_DONATE_TAX, resultMap, salaryItemMap);
|
||||
valueMap.put(TaxDeclarationDataIndexConstant.ANNUAL_DONATE_TAX, allowedDonation.toPlainString());
|
||||
// 减免税额
|
||||
BigDecimal annualTaxSavings = findValue(TaxDeclarationDataIndexConstant.ANNUAL_TAX_SAVINGS, resultMap, salaryItemMap);
|
||||
valueMap.put(TaxDeclarationDataIndexConstant.ANNUAL_TAX_SAVINGS, annualTaxSavings.toPlainString());
|
||||
// 备注
|
||||
BigDecimal annualRemark = findValue(TaxDeclarationDataIndexConstant.ANNUAL_REMARK, resultMap, salaryItemMap);
|
||||
valueMap.put(TaxDeclarationDataIndexConstant.ANNUAL_REMARK, annualRemark.toPlainString());
|
||||
// 生成个税申报表详情
|
||||
result.getNeedInsertTaxDeclarationDetails().addAll(convert2DetailPO(taxDeclaration, employeeType, employeeId, valueMap));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 往期累计情况
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.engine.salary.entity.taxdeclaration.bo;
|
|||
|
||||
import com.engine.salary.constant.TaxDeclarationDataIndexConstant;
|
||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationAnnualListDTO;
|
||||
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationEmployeeDTO;
|
||||
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationLaborListDTO;
|
||||
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationWageListDTO;
|
||||
|
|
@ -132,4 +133,47 @@ public class TaxDeclarationDetailBO {
|
|||
}
|
||||
return taxDeclarationLaborListDTOS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换成个税申报表详情列表(年终奖)
|
||||
*
|
||||
* @param taxDeclarationDetailPOS
|
||||
* @param simpleEmployees
|
||||
* @return
|
||||
*/
|
||||
public static List<TaxDeclarationAnnualListDTO> convert2ListDTO4Annual(List<TaxDeclarationDetailPO> taxDeclarationDetailPOS,
|
||||
List<TaxDeclarationEmployeeDTO> taxDeclarationEmployeeDTOS,
|
||||
List<DataCollectionEmployee> simpleEmployees) {
|
||||
if (CollectionUtils.isEmpty(taxDeclarationDetailPOS)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<TaxDeclarationAnnualListDTO> taxDeclarationLaborListDTOS = Lists.newArrayListWithExpectedSize(taxDeclarationEmployeeDTOS.size());
|
||||
Map<String, List<TaxDeclarationDetailPO>> employeeIdKeyTaxDeclarationDetailPOMap = SalaryEntityUtil.group2Map(taxDeclarationDetailPOS,
|
||||
taxDeclarationDetailPO -> taxDeclarationDetailPO.getEmployeeType() + "_" + taxDeclarationDetailPO.getEmployeeId());
|
||||
Map<Long, DataCollectionEmployee> simpleEmployeeMap = SalaryEntityUtil.convert2Map(simpleEmployees, DataCollectionEmployee::getEmployeeId);
|
||||
for (TaxDeclarationEmployeeDTO dto : taxDeclarationEmployeeDTOS) {
|
||||
Map<String, String> fieldCodeKeyFieldValueMap = SalaryEntityUtil.convert2Map(employeeIdKeyTaxDeclarationDetailPOMap.get(dto.getEmployeeType() + "_" + dto.getEmployeeId()),
|
||||
TaxDeclarationDetailPO::getFieldCode, TaxDeclarationDetailPO::getFieldValue);
|
||||
TaxDeclarationAnnualListDTO taxDeclarationLaborListDTO = new TaxDeclarationAnnualListDTO()
|
||||
.setId(dto.getEmployeeId())
|
||||
.setEmployeeId(dto.getEmployeeId())
|
||||
.setCardType(SalaryI18nUtil.getI18nLabel(105564, "居民身份证"))
|
||||
.setAnnualIncome(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.ANNUAL_INCOME))
|
||||
.setAnnualTaxFreeIncome(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.ANNUAL_TAX_FREE_INCOME))
|
||||
.setAnnualOther(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.ANNUAL_OTHER))
|
||||
.setAnnualDonateTax(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.ANNUAL_DONATE_TAX))
|
||||
.setAnnualTaxSavings(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.ANNUAL_TAX_SAVINGS))
|
||||
.setAnnualRemark(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.ANNUAL_REMARK));
|
||||
if (dto.getEmployeeType() == null || Objects.equals(dto.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue())) {
|
||||
DataCollectionEmployee simpleEmployee = simpleEmployeeMap.get(dto.getEmployeeId());
|
||||
taxDeclarationLaborListDTO.setJobNum(simpleEmployee.getWorkcode())
|
||||
.setUsername(simpleEmployee.getUsername())
|
||||
.setCardNum(Optional.ofNullable(simpleEmployee).map(DataCollectionEmployee::getIdNo).orElse(StringUtils.EMPTY));
|
||||
} else {
|
||||
|
||||
}
|
||||
taxDeclarationLaborListDTOS.add(taxDeclarationLaborListDTO);
|
||||
}
|
||||
return taxDeclarationLaborListDTOS;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,89 @@
|
|||
package com.engine.salary.entity.taxdeclaration.dto;
|
||||
|
||||
import com.engine.salary.annotation.SalaryTableColumn;
|
||||
import com.engine.salary.annotation.TableTitle;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 个税申报表详情列表(劳务报酬所得)
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class TaxDeclarationAnnualListDTO {
|
||||
|
||||
//主键id
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
//人员id
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long employeeId;
|
||||
|
||||
@SalaryTableColumn(
|
||||
text = "工号", width = "10%", column = "jobNum"
|
||||
)
|
||||
@TableTitle(title ="工号",dataIndex = "jobNum",key = "jobNum")
|
||||
private String jobNum;
|
||||
|
||||
@SalaryTableColumn(
|
||||
text = "姓名", width = "10%", column = "username"
|
||||
)
|
||||
@TableTitle(title ="姓名",dataIndex = "username",key = "username")
|
||||
private String username;
|
||||
|
||||
@SalaryTableColumn(
|
||||
text = "证件类型", width = "10%", column = "cardType"
|
||||
)
|
||||
@TableTitle(title ="证件类型",dataIndex = "cardType",key = "cardType")
|
||||
private String cardType;
|
||||
|
||||
@SalaryTableColumn(
|
||||
text = "证件号码", width = "10%", column = "cardNum"
|
||||
)
|
||||
@TableTitle(title ="证件号码",dataIndex = "cardNum",key = "cardNum")
|
||||
private String cardNum;
|
||||
|
||||
@SalaryTableColumn(
|
||||
text = "全年一次性奖金额", width = "10%", column = "annualIncome"
|
||||
)
|
||||
@TableTitle(title ="全年一次性奖金额",dataIndex = "annualIncome",key = "annualIncome")
|
||||
private String annualIncome;
|
||||
|
||||
@SalaryTableColumn(
|
||||
text = "免税收入", width = "10%", column = "annualTaxFreeIncome"
|
||||
)
|
||||
@TableTitle(title ="免税收入",dataIndex = "annualTaxFreeIncome",key = "annualTaxFreeIncome")
|
||||
private String annualTaxFreeIncome;
|
||||
|
||||
@SalaryTableColumn(
|
||||
text = "其他", width = "10%", column = "annualOther"
|
||||
)
|
||||
@TableTitle(title ="其他",dataIndex = "annualOther",key = "annualOther")
|
||||
private String annualOther;
|
||||
|
||||
@SalaryTableColumn(
|
||||
text = "准予扣除的捐赠额", width = "10%", column = "annualDonateTax"
|
||||
)
|
||||
@TableTitle(title ="准予扣除的捐赠额",dataIndex = "annualDonateTax",key = "annualDonateTax")
|
||||
private String annualDonateTax;
|
||||
|
||||
@SalaryTableColumn(
|
||||
text = "减免税额", width = "10%", column = "annualTaxSavings"
|
||||
)
|
||||
@TableTitle(title ="减免税额",dataIndex = "annualTaxSavings",key = "annualTaxSavings")
|
||||
private String annualTaxSavings;
|
||||
|
||||
@SalaryTableColumn(
|
||||
text = "备注", width = "10%", column = "annualRemark"
|
||||
)
|
||||
@TableTitle(title ="备注",dataIndex = "annualRemark",key = "annualRemark")
|
||||
private String annualRemark;
|
||||
}
|
||||
|
|
@ -19,7 +19,7 @@ public enum IncomeCategoryEnum implements BaseEnum<Integer> {
|
|||
REMUNERATION_FOR_LABOR(4, "劳务报酬所得", 105218),
|
||||
|
||||
// 暂时注释掉,后续会开放
|
||||
// ONETIME_ANNUAL_BONUS(2,"全年一次性奖金收入", 0),
|
||||
ONETIME_ANNUAL_BONUS(2,"全年一次性奖金收入", 0)
|
||||
//
|
||||
// OTHER(11, "其他所得", 0),
|
||||
;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
package com.engine.salary.service;
|
||||
|
||||
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationDetailListDTO;
|
||||
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationEmployeeDTO;
|
||||
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationLaborListDTO;
|
||||
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationWageListDTO;
|
||||
import com.engine.salary.entity.taxdeclaration.dto.*;
|
||||
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationDetailListQueryParam;
|
||||
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationDetailPO;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
|
|
@ -54,6 +51,9 @@ public interface TaxDeclarationDetailService {
|
|||
*/
|
||||
PageInfo<TaxDeclarationLaborListDTO> listDtoPageByParam4Labor(TaxDeclarationDetailListQueryParam queryParam);
|
||||
|
||||
|
||||
PageInfo<TaxDeclarationAnnualListDTO> listDtoPageByParam4Annual(TaxDeclarationDetailListQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 查询个税申报列表明细(劳务报酬所得)
|
||||
*
|
||||
|
|
|
|||
|
|
@ -178,9 +178,6 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
|
|||
for (List<Long> salaryItemIds : salaryAcctCalculateBO.getSalaryItemIdWithPriorityList()) {
|
||||
// 同一运算优先级下的薪资项目逐个独立运算
|
||||
for (Long salaryItemId : salaryItemIds) {
|
||||
if(salaryItemId.equals(1667443666942L)){
|
||||
System.out.println("00");
|
||||
}
|
||||
String resultValue;
|
||||
SalaryItemPO salaryItemPO = salaryItemMap.get(salaryItemId);
|
||||
ExpressFormula expressFormula;
|
||||
|
|
@ -196,9 +193,6 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
|
|||
} else {
|
||||
expressFormula = expressFormulaMap.get(salaryItemPO.getFormulaId());
|
||||
}
|
||||
// if(Objects.equals(1667443666946L, salaryItemId)){
|
||||
// System.out.println("-0");
|
||||
// }
|
||||
if (Objects.nonNull(expressFormula)) {
|
||||
// 运行公式
|
||||
resultValue = runExpressFormula(expressFormula, formulaVarValueMap, simpleEmployee);
|
||||
|
|
@ -207,15 +201,6 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
|
|||
String key = SalaryFormulaReferenceEnum.SALARY_ITEM.getValue() + SalaryFormulaFieldConstant.FIELD_ID_SEPARATOR + salaryItemPO.getCode();
|
||||
resultValue = formulaVarValueMap.getOrDefault(key, StringUtils.EMPTY);
|
||||
}
|
||||
// if(Objects.equals(1667443666946L, salaryItemId)){
|
||||
// System.out.println("--");
|
||||
// Long i = Long.valueOf(expressFormula.getParameters().get(0).getContent()) + Long.valueOf(expressFormula.getParameters().get(1).getContent());
|
||||
// String a= Long.toString(i);
|
||||
// if(!resultValue.equals(a)){
|
||||
// System.out.println("-0");
|
||||
// resultValue = runExpressFormula(expressFormula, formulaVarValueMap, simpleEmployee);
|
||||
// }
|
||||
// }
|
||||
// 处理薪资档案
|
||||
if (Objects.equals(salaryItemPO.getUseInEmployeeSalary(), NumberUtils.INTEGER_ONE)) {
|
||||
String key = SalaryFormulaReferenceEnum.SALARY_ARCHIVES.getValue() + SalaryFormulaFieldConstant.FIELD_ID_SEPARATOR + salaryItemPO.getCode();
|
||||
|
|
@ -232,9 +217,6 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
|
|||
}
|
||||
// 将已经计算过的薪资项目的值转换成公式变量的值添加到集合中
|
||||
String key = SalaryFormulaReferenceEnum.SALARY_ITEM.getValue() + SalaryFormulaFieldConstant.FIELD_ID_SEPARATOR + salaryItemPO.getCode();
|
||||
if(salaryItemPO.getCode().equals("ressueTotal") ||salaryItemPO.getCode().equals("issuedTotal") ){
|
||||
System.out.println("--");
|
||||
}
|
||||
formulaVarValueMap.put(key, resultValue);
|
||||
// 值保存薪资账套下的薪资项目的核算结果
|
||||
if (salaryItemIdKeySalarySobItemPOMap.containsKey(salaryItemId) || salarySobBackItemIds.contains(salaryItemId)) {
|
||||
|
|
|
|||
|
|
@ -7,10 +7,7 @@ import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
|||
import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO;
|
||||
import com.engine.salary.entity.taxdeclaration.bo.TaxDeclarationBO;
|
||||
import com.engine.salary.entity.taxdeclaration.bo.TaxDeclarationDetailBO;
|
||||
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationDetailListDTO;
|
||||
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationEmployeeDTO;
|
||||
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationLaborListDTO;
|
||||
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationWageListDTO;
|
||||
import com.engine.salary.entity.taxdeclaration.dto.*;
|
||||
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationDetailListQueryParam;
|
||||
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationDetailPO;
|
||||
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO;
|
||||
|
|
@ -146,6 +143,30 @@ public class TaxDeclarationDetailServiceImpl extends Service implements TaxDecla
|
|||
return dtoPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<TaxDeclarationAnnualListDTO> listDtoPageByParam4Annual(TaxDeclarationDetailListQueryParam queryParam) {
|
||||
// 查询个税申报主表
|
||||
TaxDeclarationPO taxDeclarationPO = getTaxDeclarationService(user).getById(queryParam.getTaxDeclarationId());
|
||||
// 判断是否有权限查看
|
||||
boolean canSee = getTaxDeclarationService(user).checkByAuthority(taxDeclarationPO, (long) user.getUID());
|
||||
if (!canSee) {
|
||||
throw new SalaryRunTimeException("对不起,您暂时没有权限查看");
|
||||
}
|
||||
// 查询个税申报表明细的人员
|
||||
PageInfo<TaxDeclarationEmployeeDTO> employeeIdPage = listPage4EmployeeIdByParam(queryParam);
|
||||
PageInfo<TaxDeclarationAnnualListDTO> dtoPage = new PageInfo<>(TaxDeclarationAnnualListDTO.class);
|
||||
dtoPage.setPageSize(employeeIdPage.getPageSize());
|
||||
dtoPage.setPageNum(employeeIdPage.getPageNum());
|
||||
dtoPage.setTotal(employeeIdPage.getTotal());
|
||||
List list = employeeIdPage.getList();
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
// 转换成列表dto
|
||||
List<TaxDeclarationAnnualListDTO> taxDeclarationLaborListDTOS = listDto4Annual(queryParam.getTaxDeclarationId(), list);
|
||||
dtoPage.setList(taxDeclarationLaborListDTOS);
|
||||
}
|
||||
return dtoPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaxDeclarationLaborListDTO> listDto4Labor(Long taxDeclarationId, List<TaxDeclarationEmployeeDTO> taxDeclarationEmployees) {
|
||||
long employeeId = (long) user.getUID();
|
||||
|
|
@ -165,6 +186,24 @@ public class TaxDeclarationDetailServiceImpl extends Service implements TaxDecla
|
|||
return TaxDeclarationDetailBO.convert2ListDTO4Labor(taxDeclarationDetailPOS, taxDeclarationEmployees, simpleEmployees);
|
||||
}
|
||||
|
||||
public List<TaxDeclarationAnnualListDTO> listDto4Annual(Long taxDeclarationId, List<TaxDeclarationEmployeeDTO> taxDeclarationEmployees) {
|
||||
long employeeId = (long) user.getUID();
|
||||
// 查询个税申报主表
|
||||
TaxDeclarationPO taxDeclarationPO = getTaxDeclarationService(user).getById(taxDeclarationId);
|
||||
// 判断是否有权限查看
|
||||
boolean canSee = getTaxDeclarationService(user).checkByAuthority(taxDeclarationPO, employeeId);
|
||||
if (!canSee) {
|
||||
throw new SalaryRunTimeException("对不起,您暂时没有权限查看");
|
||||
}
|
||||
// 查询个税申报表明细
|
||||
List<Long> employeeIds = taxDeclarationEmployees.stream().map(TaxDeclarationEmployeeDTO::getEmployeeId).collect(Collectors.toList());
|
||||
List<TaxDeclarationDetailPO> taxDeclarationDetailPOS = listByTaxDeclarationIdAndEmployeeIds(taxDeclarationId, employeeIds);
|
||||
// 查询人员信息
|
||||
List<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService().listByIds(employeeIds);
|
||||
// 转换成列表dto
|
||||
return TaxDeclarationDetailBO.convert2ListDTO4Annual(taxDeclarationDetailPOS, taxDeclarationEmployees, simpleEmployees);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据权限范围过滤
|
||||
*
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.engine.salary.service.impl;
|
|||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.annotation.SalaryTableColumn;
|
||||
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationAnnualListDTO;
|
||||
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationLaborListDTO;
|
||||
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationWageListDTO;
|
||||
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationDetailListQueryParam;
|
||||
|
|
@ -107,6 +108,28 @@ public class TaxDeclarationExcelServiceImpl extends Service implements TaxDeclar
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Objects.equals(taxDeclarationPO.getIncomeCategory(), IncomeCategoryEnum.ONETIME_ANNUAL_BONUS.getValue())) {
|
||||
// 解析表头
|
||||
parseHeader(TaxDeclarationAnnualListDTO.class, headerList, dataIndexList);
|
||||
rows.add(headerList);
|
||||
for (int i = 0; i < totalPages; i++) {
|
||||
TaxDeclarationDetailListQueryParam queryParam = new TaxDeclarationDetailListQueryParam();
|
||||
queryParam.setTaxDeclarationId(taxDeclarationId);
|
||||
queryParam.setCurrent(i);
|
||||
queryParam.setPageSize(1000);
|
||||
PageInfo<TaxDeclarationAnnualListDTO> dtoPage = getTaxDeclarationDetailService(user).listDtoPageByParam4Annual(queryParam);
|
||||
List<TaxDeclarationAnnualListDTO> list = dtoPage.getList();
|
||||
for (TaxDeclarationAnnualListDTO taxDeclarationLaborListDTO : list) {
|
||||
List<Object> row = Lists.newArrayListWithExpectedSize(dataIndexList.size());
|
||||
Map<String, Object> map = JsonUtil.parseMap(taxDeclarationLaborListDTO, Object.class);
|
||||
for (String dataIndex : dataIndexList) {
|
||||
row.add(map.get(dataIndex));
|
||||
}
|
||||
rows.add(row);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ExcelUtil.genWorkbookV2(rows, sheetName);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -68,10 +68,12 @@ public class SalaryPageUtil {
|
|||
* @param <T> 范型制定类
|
||||
* @return
|
||||
*/
|
||||
public static <T> List<T> subList(int pageNo, int pageSize, List<T> source) {
|
||||
public static <T> List<T> subList(Integer pageNo, Integer pageSize, List<T> source) {
|
||||
if (CollectionUtils.isEmpty(source)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
pageNo = pageNo == null || pageNo <= 0 ? 1 : pageNo;
|
||||
pageSize = pageSize == null || pageSize <= 0 ? 10 : pageSize;
|
||||
int endIndex = pageNo * pageSize;
|
||||
int startIndex = (pageNo - 1) * pageSize;
|
||||
startIndex = startIndex < 0 ? 0 : startIndex;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package com.engine.salary.wrapper;
|
|||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationLaborListDTO;
|
||||
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationDetailListQueryParam;
|
||||
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO;
|
||||
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
|
||||
|
|
@ -53,8 +52,12 @@ public class TaxDeclarationDetailWrapper extends Service {
|
|||
}
|
||||
// 劳务报酬所得
|
||||
if (Objects.equals(taxDeclarationPO.getIncomeCategory(), IncomeCategoryEnum.REMUNERATION_FOR_LABOR.getValue())) {
|
||||
PageInfo<TaxDeclarationLaborListDTO> taxDeclarationLaborListDTOPageInfo = getTaxDeclarationDetailService(user).listDtoPageByParam4Labor(queryParam);
|
||||
return taxDeclarationLaborListDTOPageInfo;
|
||||
return getTaxDeclarationDetailService(user).listDtoPageByParam4Labor(queryParam);
|
||||
}
|
||||
|
||||
// 全年一次性奖金收入
|
||||
if (Objects.equals(taxDeclarationPO.getIncomeCategory(), IncomeCategoryEnum.ONETIME_ANNUAL_BONUS.getValue())) {
|
||||
return getTaxDeclarationDetailService(user).listDtoPageByParam4Annual(queryParam);
|
||||
}
|
||||
|
||||
return new PageInfo();
|
||||
|
|
|
|||
Loading…
Reference in New Issue