Merge branch 'release/个税版本' into custom/艾志工业

This commit is contained in:
Harryxzy 2025-06-13 09:32:46 +08:00
commit ea516aca99
31 changed files with 418 additions and 90 deletions

View File

@ -7,6 +7,8 @@ import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeTaxAgentDTO;
import com.engine.salary.mapper.salarybill.SalarySendRangeObjMapper;
import com.engine.salary.service.TaxAgentService;
import com.engine.salary.service.impl.TaxAgentServiceImpl;
import com.engine.salary.util.db.MapperProxyFactory;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
@ -23,6 +25,10 @@ public class SalarySendRangeObjBiz {
return ServiceUtil.getService(TaxAgentServiceImpl.class);
}
private SalarySendRangeObjMapper getSalarySendRangeObjMapper() {
return MapperProxyFactory.getProxy(SalarySendRangeObjMapper.class);
}
public <R> R applyMapper(Function<SalarySendRangeObjMapper, R> mapper) {
try (SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession()) {
final SalarySendRangeObjMapper salarySendRangeObjMapper = sqlSession.getMapper(SalarySendRangeObjMapper.class);
@ -41,7 +47,13 @@ public class SalarySendRangeObjBiz {
}
public List<SalarySendUserInfoDTO> getSalarySendUserInfoDTOs(List<Long> employees) {
List<SalarySendUserInfoDTO> userDTOs = applyMapper(mapper -> mapper.getUserInfoByEmployeeIds(employees));
List<SalarySendUserInfoDTO> userDTOs = new ArrayList<>();
List<List<Long>> partition = Lists.partition(employees, 500);
partition.forEach(l->{
List<SalarySendUserInfoDTO> userInfos = getSalarySendRangeObjMapper().getUserInfoByEmployeeIds(l);
userDTOs.addAll(userInfos);
});
Map<Long, SalarySendUserInfoDTO> userMap = userDTOs.stream()
.collect(Collectors.toMap(SalarySendUserInfoDTO::getResourceId, Function.identity()));

View File

@ -62,6 +62,11 @@ public class EmployeeDeclareRequest {
// *任职受雇类型
EmploymentTypeEnum employmentTypeEnum = SalaryEnumUtil.enumMatchByValue(employeeDeclare.getEmploymentType(), EmploymentTypeEnum.class);
employeeInfoMap.put("sfgy", employmentTypeEnum == null ? "" : employmentTypeEnum.getDefaultLabel());
//其他情况说明qtqksm有3个选择的值可选择"扣缴申报利息股息红利所得”、“扣缴申报偶然所得”、”申报其他所得”
//一般劳务所得处理可以统一用申报其他所得作为默认就好
if (employmentTypeEnum == EmploymentTypeEnum.OTHER) {
employeeInfoMap.put("qtqksm", "申报其他所得");
}
// 入职年度就业情形
employeeInfoMap.put("rzndjyqk", employeeDeclare.getEmploymentFirstYear());
// *手机号码

View File

@ -267,7 +267,7 @@ public class SalaryBillBO {
}
Util_Message.store(messageBean);
} catch (IOException e) {
log.error("消息发送失败",e);
log.error("消息发送失败", e);
}
}
@ -649,7 +649,8 @@ public class SalaryBillBO {
} else {
for (Object keyName : e.keySet()) {
if ((salaryItem.getId() + SalaryArchiveConstant.DYNAMIC_SUFFIX).equals(keyName.toString())) {
boolean isHide = (isHideNull && StringUtils.isEmpty(e.getOrDefault(keyName.toString(), StringUtils.EMPTY).toString()))
String itemValue = Util.null2String(e.get(keyName.toString()));
boolean isHide = (isHideNull && StringUtils.isEmpty(itemValue))
||
(isHideZero && NumberUtils.isCreatable(e.getOrDefault(keyName.toString(), "0").toString())
&& BigDecimal.ZERO.compareTo(new BigDecimal(e.getOrDefault(keyName.toString(), "0").toString())) == 0);
@ -660,7 +661,7 @@ public class SalaryBillBO {
emailContent.append("</th>");
emailContent.append("<td style=\"padding: 16px 24px;display: table-cell;flex: 1;color: #000000d9;font-size: 12px;line-height: 1.5715;word-break: break-word;overflow-wrap: break-word;border-collapse: collapse;border: 1px solid rgba(0,0,0,.06);\">");
emailContent.append(e.get(keyName.toString()));
emailContent.append(itemValue.replaceAll("null", ""));
emailContent.append("</td>");
}
break;
@ -729,7 +730,8 @@ public class SalaryBillBO {
SalaryTemplateSalaryItemListDTO salaryItem = itemPartition.get(i);
for (Object keyName : e.keySet()) {
if ((salaryItem.getId() + SalaryArchiveConstant.DYNAMIC_SUFFIX).equals(keyName.toString())) {
boolean isHide = (isHideNull && StringUtils.isEmpty(e.getOrDefault(keyName.toString(), StringUtils.EMPTY).toString()))
String itemValue = Util.null2String(e.get(keyName.toString()));
boolean isHide = (isHideNull && StringUtils.isEmpty(itemValue))
||
(isHideZero && NumberUtils.isCreatable(e.getOrDefault(keyName.toString(), "0").toString())
&& BigDecimal.ZERO.compareTo(new BigDecimal(e.getOrDefault(keyName.toString(), "0").toString())) == 0);
@ -740,7 +742,7 @@ public class SalaryBillBO {
emailContent.append("</th>");
emailContent.append("<td style=\"padding: 16px 24px;display: table-cell;flex: 1;color: #000000d9;font-size: 12px;line-height: 1.5715;word-break: break-word;overflow-wrap: break-word;border-collapse: collapse;border: 1px solid rgba(0,0,0,.06);\">");
emailContent.append(e.get(keyName.toString()));
emailContent.append(itemValue.replaceAll("null", ""));
emailContent.append("</td>");
}
break;

View File

@ -1,5 +1,6 @@
package com.engine.salary.entity.salaryacct.bo;
import cn.hutool.core.util.StrUtil;
import com.engine.salary.constant.TaxDeclarationDataIndexConstant;
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
@ -73,6 +74,9 @@ public class SalaryAcctConsolidatedTaxBO {
.filter(e -> Objects.equals(e.getSalaryItemId(), optional.get()))
.map(e -> SalaryEntityUtil.empty2Zero(e.getResultValue()))
.reduce(BigDecimal.ZERO, BigDecimal::add);
if (StrUtil.isBlank(resultValue)) {
resultValue = "0.00";
}
return new BigDecimal(resultValue).add(income).toPlainString();
}
// 个税调差为0
@ -98,6 +102,9 @@ public class SalaryAcctConsolidatedTaxBO {
.map(e -> SalaryEntityUtil.empty2Zero(e.getResultValue()))
.reduce(BigDecimal.ZERO, BigDecimal::add);
}
if (StrUtil.isBlank(resultValue)) {
resultValue = "0.00";
}
return new BigDecimal(resultValue).add(refundedOrSupplementedTax).subtract(taxAdjustment).toPlainString();
}
return resultValue;

View File

@ -20,7 +20,7 @@ import java.util.Collection;
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalaryAcctCalculateParam {
public class SalaryAcctCalculateParam {
//核算人员的id,不是employeeId而是salaryAcctEmpId
private Collection<Long> ids;

View File

@ -7,6 +7,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.YearMonth;
import java.util.List;
/**
* 薪资核算列表查询参数
@ -31,6 +32,11 @@ public class SalaryAcctRecordQueryParam extends BaseQueryParam {
//账套名称")
private String name;
/**
* 扣缴义务人id集合
*/
private List<Long> taxAgentIds;
private String startMonthStr;
private String endMonthStr;
}

View File

@ -75,6 +75,7 @@ public class TaxDeclarationRequest {
} else if (incomeCategoryEnum == IncomeCategoryEnum.COMPENSATION_FOR_DISMISS) {
// 解除劳动合同一次性补偿金
List<Map<String, Object>> employeeRequestParams = listRequestParam.computeIfAbsent("jcldhtycxbcjlb", k -> Lists.newArrayList());
employeeRequestParam.put("sfzdscmsfb","");
employeeRequestParams.add(employeeRequestParam);
} else if (incomeCategoryEnum == IncomeCategoryEnum.INCOME_FOR_INDIVIDUAL_EQUITY_INCENTIVE) {
// 个人股权激励收入
@ -125,6 +126,7 @@ public class TaxDeclarationRequest {
} else if (incomeCategoryEnum == IncomeCategoryEnum.REMUNERATION_FOR_AUTHOR) {
// 稿酬所得
List<Map<String, Object>> employeeRequestParams = listRequestParam.computeIfAbsent("gcsdlb", k -> Lists.newArrayList());
employeeRequestParam.put("sfzdscmsfb","");
employeeRequestParams.add(employeeRequestParam);
} else if (incomeCategoryEnum == IncomeCategoryEnum.ROYALTIES) {
// 特许权使用费所得
@ -167,9 +169,6 @@ public class TaxDeclarationRequest {
}
}
String string = employeeRequestParam.getOrDefault("syjkbx", "0").toString();
System.out.println();
if (new BigDecimal(employeeRequestParam.getOrDefault("syjkbx", "0").toString()).compareTo(new BigDecimal("0")) > 0) {
Map<String, ? extends List> healthInsuranceMap = taxFreeMap.get(TaxFreeTypeEnum.HEALTH_INSURANCE);
List<HealthInsurancePO> pos = (List<HealthInsurancePO>) healthInsuranceMap.get(employeeDeclare.getTaxAgentId() + "-" + employeeDeclare.getEmployeeId() + "-" + SalaryDateUtil.getFormatYearMonth(employeeDeclare.getTaxCycle()));

View File

@ -37,6 +37,10 @@ public class TaxDeclarationListDTO {
@TableTitle(title = "薪资类型", dataIndex = "incomeCategory", key = "incomeCategory")
private String incomeCategory;
@JsonFormat(pattern = "yyyy-MM", timezone = "GMT+8")
@TableTitle(title = "税款所属期", dataIndex = "taxCycle", key = "taxCycle")
private Date taxCycle;
@JsonFormat(pattern = "yyyy-MM", timezone = "GMT+8")
@TableTitle(title = "薪资所属月", dataIndex = "salaryMonth", key = "salaryMonth")
private Date salaryMonth;
@ -47,10 +51,6 @@ public class TaxDeclarationListDTO {
@TableTitle(title = "个税扣缴义务人", dataIndex = "taxAgentName", key = "taxAgentName")
private String taxAgentName;
@JsonFormat(pattern = "yyyy-MM", timezone = "GMT+8")
@TableTitle(title = "税款所属期", dataIndex = "taxCycle", key = "taxCycle")
private Date taxCycle;
//@TableTitle(title = "操作人id", dataIndex = "operateEmployeeId", key = "operateEmployeeId")
private Long operateEmployeeId;

View File

@ -7,6 +7,7 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**

View File

@ -100,6 +100,13 @@ public class TaxDeclarationPO {
LocalDateRange salaryMonths;
//"开始日期
private Date taxCycleFromDate;
//结束日期
private Date taxCycleEndDate;
/**
* 税款所属期
*/

View File

@ -711,7 +711,7 @@ public enum IncomeCategoryEnum implements BaseEnum<Integer> {
}
List<GetASynIndividualIncomeTaxFeedbackResponse.Body.rysbsb> rysbsblb = feedbackResponse.getBody().getRysbsblb();
if (CollectionUtil.isNotEmpty(rysbsblb)) {
String err = rysbsblb.stream().map(GetASynIndividualIncomeTaxFeedbackResponse.Body.rysbsb::getSbyy).collect(Collectors.joining(";"));
String err = rysbsblb.stream().map(sb -> Util.null2String(sb.getXm()) + Util.null2String(sb.getSbyy())).collect(Collectors.joining(";"));
throw new OnlineCalculateTaxException(err);
}
}

View File

@ -571,7 +571,6 @@ public class DateTimeServiceImpl implements DateTimeService {
cale.set(cale.get(Calendar.YEAR), month, 1);
String lastday = formatTemp.format(cale.getTime());
System.out.println(lastday);
return new DataType(DataType.STRING, lastday);
}

View File

@ -69,6 +69,12 @@
<if test="taxMonths != null and taxMonths.endDate != null">
AND tax_cycle <![CDATA[ <= ]]> #{taxMonths.endDate}
</if>
<if test="taxCycleFromDate != null">
AND tax_cycle <![CDATA[ >= ]]> #{taxCycleFromDate}
</if>
<if test="taxCycleEndDate != null">
AND tax_cycle <![CDATA[ <= ]]> #{taxCycleEndDate}
</if>
<if test="taxAgentIds != null and taxAgentIds.size()>0">
AND tax_agent_id IN
<foreach collection="taxAgentIds" open="(" item="id" separator="," close=")">

View File

@ -45,6 +45,9 @@ public class SalaryStatisticsDataPerspectiveQueryParam extends BaseQueryParam {
//个税扣缴义务人配置
private List<Long> taxAgent;
@JsonIgnore
private List<Long> salarySob;
@JsonIgnore
//收入所得项目配置
private List<Integer> incomeCategory;

View File

@ -469,12 +469,21 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
if (reportPO.getTaxAgentSetting() != null) {
param.setTaxAgent(((List<Map>) JSON.parseArray(reportPO.getTaxAgentSetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList()));
}
if (reportPO.getSalarySobSetting() != null) {
param.setSalarySob(((List<Map>) JSON.parseArray(reportPO.getSalarySobSetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList()));
}
if (reportPO.getSubCompanySetting() != null) {
param.setSubCompany(((List<Map>) JSON.parseArray(reportPO.getSubCompanySetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList()));
}
if (reportPO.getDepartSetting() != null) {
param.setDepart(((List<Map>) JSON.parseArray(reportPO.getDepartSetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList()));
}
if (reportPO.getPositionSetting() != null) {
param.setPosition(((List<Map>) JSON.parseArray(reportPO.getPositionSetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList()));
}
if (reportPO.getStatusSetting() != null) {
param.setStatus(((List<Map>) JSON.parseArray(reportPO.getStatusSetting(), Map.class)).stream().map(m -> m.get(key).toString()).collect(Collectors.toList()));
}
if (reportPO.getEmployeeSetting() != null) {
param.setEmployee(((List<Map>) JSON.parseArray(reportPO.getEmployeeSetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList()));
}

View File

@ -642,10 +642,14 @@ public class EmployeeDeclareExcelServiceImpl extends Service implements Employee
Set<String> emptyNames = new HashSet<>();
for (PropertyDescriptor pd : pds) {
Object srcValue = src.getPropertyValue(pd.getName());
String name = pd.getName();
if("dismissDate".equals(name)){
continue;
}
Object srcValue = src.getPropertyValue(name);
// 此处判断可根据需求修改
if (srcValue == null) {
emptyNames.add(pd.getName());
emptyNames.add(name);
}
}
String[] result = new String[emptyNames.size()];

View File

@ -703,6 +703,7 @@ public class EmployeeDeclareServiceImpl extends Service implements EmployeeDecla
ImmutableMap<String, String> requestParam = ImmutableMap.of("requestId", employeeDeclareRecord.getRequestId());
Map<String, String> header = SingnatureData.initHeader(Collections.emptyMap(), apiConfig.getAppKey(), apiConfig.getAppSecret());
String res = HttpUtil.getRequest(url, header, requestParam);
log.info("人员报送反馈:{}", res);
DeclareEmployeeFeedbackResponse declareEmployeeFeedbackResponse = JsonUtil.parseObject(res, DeclareEmployeeFeedbackResponse.class);
if (Objects.isNull(declareEmployeeFeedbackResponse) || Objects.isNull(declareEmployeeFeedbackResponse.getHead())) {
log.error("服务异常:" + res);

View File

@ -172,7 +172,8 @@ public class SIAComparisonResultServiceImpl extends Service implements SIACompar
List<InsuranceArchivesBaseInfoPO> baseInfoPOList = getInsuranceBaseInfoMapper().listAll();
List<Long> canAccountIds = baseInfoPOList.stream()
.filter(f->f.getPaymentOrganization().toString().equals(queryParam.getPaymentOrganization())
&& (f.getRunStatus().equals(EmployeeStatusEnum.PAYING.getValue()) || f.getRunStatus().equals(EmployeeStatusEnum.STAY_DEL.getValue())))
&& !f.getRunStatus().equals(EmployeeStatusEnum.STAY_ADD.getValue())
)
.map(InsuranceArchivesBaseInfoPO::getEmployeeId)
.collect(Collectors.toList());
accountExportPOS = accountExportPOS.stream().filter(v -> canAccountIds.contains(v.getEmployeeId())).collect(Collectors.toList());

View File

@ -1,5 +1,6 @@
package com.engine.salary.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.api.formmode.mybatis.util.SqlProxyHandle;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
@ -198,6 +199,21 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
Set<Long> salarySobIds = SalaryEntityUtil.properties(salarySobPOS, SalarySobPO::getId);
po.setSalarySobIds(salarySobIds);
}
if (CollUtil.isNotEmpty(queryParam.getTaxAgentIds())) {
List<SalarySobPO> salarySobPOS = getSalarySobService(user).listByTaxAgentIds(queryParam.getTaxAgentIds());
if (CollectionUtils.isEmpty(salarySobPOS)) {
return page;
}
Set<Long> salarySobIds = SalaryEntityUtil.properties(salarySobPOS, SalarySobPO::getId);
Collection<Long> existIds = po.getSalarySobIds();
if (CollectionUtils.isNotEmpty(existIds)) {
existIds = SalaryEntityUtil.intersectionForList(existIds, salarySobIds);
po.setSalarySobIds(existIds);
} else {
po.setSalarySobIds(salarySobIds);
}
}
LocalDateRange localDateRange = new LocalDateRange();
if (Objects.nonNull(queryParam.getStartMonth())) {
localDateRange.setFromDate(SalaryDateUtil.localDateToDate(queryParam.getStartMonth().atDay(1)));
@ -520,6 +536,12 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
*/
@Override
public void checkBeforeSave(SalaryAcctRecordPO salaryAcctRecord, List<SalaryAcctTaxAgentPO> salaryAcctTaxAgents) {
// 如果个税申报功能是关闭的则不需要检查
TaxDeclarationFunctionEnum taxDeclarationFunctionEnum = getSalarySysConfService(user).getTaxDeclaration();
if (taxDeclarationFunctionEnum == TaxDeclarationFunctionEnum.CLOSURE) {
return;
}
// 查询薪资账套
SalarySobPO salarySobPO = getSalarySobService(user).getById(salaryAcctRecord.getSalarySobId());
IncomeCategoryEnum incomeCategoryEnums = IncomeCategoryEnum.parseByValue(salarySobPO.getIncomeCategory());
@ -1014,6 +1036,6 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
@Override
public void updateDate(Long id, Date updateTime) {
getSalaryAcctRecordMapper().updateDate(id,updateTime);
getSalaryAcctRecordMapper().updateDate(id, updateTime);
}
}

View File

@ -1576,7 +1576,12 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
if (CollectionUtils.isEmpty(employeeIds)) {
return Collections.emptyList();
}
return getSalaryArchiveMapper().listPayEndDateIsNull(employeeIds);
List<List<Long>> partition = Lists.partition(employeeIds, 500);
List<SalaryArchivePO> resultList = new ArrayList<>();
partition.forEach(part -> {
resultList.addAll(getSalaryArchiveMapper().listPayEndDateIsNull(part));
});
return resultList;
}
@Override
public Map<Long, String> getAzRyflInfo(List<Long> employeeIds) {

View File

@ -169,16 +169,6 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
&& Optional.ofNullable(salaryBillProgress.getProgress()).orElse(BigDecimal.ZERO).compareTo(BigDecimal.ONE) < 0) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(136104, "有其他人员正在发送中,请等待其他人员发送结束后再操作"));
}
// 初始化进度
ProgressDTO initProgress = ProgressDTO.builder()
.title(SalaryI18nUtil.getI18nLabel(136097, "发送中"))
.totalQuantity(NumberUtils.INTEGER_ZERO)
.calculatedQuantity(NumberUtils.INTEGER_ZERO)
.progress(BigDecimal.ZERO)
.status(true)
.message("")
.build();
getProgressService(user).initProgress(SalaryCacheKey.SALARY_GRANT_PROGRESS + "_" + salarySend.getId(), initProgress);
List<Long> ids = param.getIds();
@ -190,6 +180,17 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
throw new SalaryRunTimeException("工资发放范围内没有匹配员工");
}
}
// 初始化进度
ProgressDTO initProgress = ProgressDTO.builder()
.title(SalaryI18nUtil.getI18nLabel(136097, "发送中"))
.totalQuantity(NumberUtils.INTEGER_ZERO)
.calculatedQuantity(NumberUtils.INTEGER_ZERO)
.progress(BigDecimal.ZERO)
.status(true)
.message("")
.build();
getProgressService(user).initProgress(SalaryCacheKey.SALARY_GRANT_PROGRESS + "_" + salarySend.getId(), initProgress);
// 异步执行
List<Long> finalIds = ids;
LocalRunnable localRunnable = new LocalRunnable() {

View File

@ -485,6 +485,11 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
if (salarySendInfo == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100511, "工资单信息不存在"));
}
if (!Objects.equals(salarySendInfo.getSendStatus(), 1)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100511, "工资单信息不存在"));
}
Long employeeId = salarySendInfo.getEmployeeId();
if (currentEmployeeId.compareTo(employeeId) != 0) {
@ -1343,7 +1348,6 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
}
@Override
public Map<String, Object> withdraw(SalarySendWithdrawParam param) {
if (param.getSalarySendId() == null) {

View File

@ -9,20 +9,29 @@ import com.engine.salary.biz.SalarySobItemGroupBiz;
import com.engine.salary.biz.SalarySobItemHideBiz;
import com.engine.salary.config.SalaryElogConfig;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.datacollection.AddUpDeduction;
import com.engine.salary.entity.datacollection.AddUpSituation;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.datacollection.dto.AttendQuoteDataDTO;
import com.engine.salary.entity.datacollection.dto.AttendQuoteFieldListDTO;
import com.engine.salary.entity.datacollection.po.OtherDeductionPO;
import com.engine.salary.entity.datacollection.po.VariableItemPO;
import com.engine.salary.entity.salaryacct.bo.CalculateFormulaVarBO;
import com.engine.salary.entity.salaryacct.bo.SalaryAcctCalculateBO;
import com.engine.salary.entity.salaryacct.bo.SalaryAcctCalculatePriorityBO;
import com.engine.salary.entity.salaryacct.bo.SalaryAcctConfig;
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
import com.engine.salary.entity.salaryarchive.config.ArchiveFieldConfig;
import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveDataDTO;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryformula.po.FormulaVar;
import com.engine.salary.entity.salaryformula.config.FormluaConfig;
import com.engine.salary.entity.salaryformula.po.FormulaPO;
import com.engine.salary.entity.salaryformula.po.FormulaVar;
import com.engine.salary.entity.salaryitem.config.SalaryItemAllConfig;
import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.bo.SalarySobItemAggregateBO;
import com.engine.salary.entity.salarysob.dto.SalaryItemTopologyDTO;
import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO;
import com.engine.salary.entity.salarysob.dto.SalarySobItemAggregateDTO;
import com.engine.salary.entity.salarysob.dto.SalarySobItemFormDTO;
import com.engine.salary.entity.salarysob.param.SalaryItemTopologyQueryParam;
@ -46,11 +55,13 @@ import com.engine.salary.util.valid.ValidUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import weaver.general.BaseBean;
import weaver.hrm.User;
import java.time.Month;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -121,6 +132,59 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
}
// private LoggerTemplate salarySobLoggerTemplate;
private SalaryAcctEmployeeService getSalaryAcctEmployeeService(User user) {
return ServiceUtil.getService(SalaryAcctEmployeeServiceImpl.class, user);
}
private SalaryAcctRecordService getSalaryAcctRecordService(User user) {
return ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user);
}
private SalarySobService getSalarySobService(User user) {
return ServiceUtil.getService(SalarySobServiceImpl.class, user);
}
private SIAccountService getSIAccountService(User user) {
return ServiceUtil.getService(SIAccountServiceImpl.class, user);
}
private AttendQuoteFieldService getAttendQuoteFieldService(User user) {
return ServiceUtil.getService(AttendQuoteFieldServiceImpl.class, user);
}
private VariableItemService getVariableItemService(User user) {
return ServiceUtil.getService(VariableItemServiceImpl.class, user);
}
private SalaryEmployeeService getSalaryEmployeeService(User user) {
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
}
private SalaryArchiveService getSalaryArchiveService(User user) {
return ServiceUtil.getService(SalaryArchiveServiceImpl.class, user);
}
private AddUpSituationService getAddUpSituationService(User user) {
return ServiceUtil.getService(AddUpSituationServiceImpl.class, user);
}
private AddUpDeductionService getAddUpDeductionService(User user) {
return ServiceUtil.getService(AddUpDeductionServiceImpl.class, user);
}
private OtherDeductionService getOtherDeductionService(User user) {
return ServiceUtil.getService(OtherDeductionServiceImpl.class, user);
}
private AttendQuoteDataService getAttendQuoteDataService(User user) {
return ServiceUtil.getService(AttendQuoteDataServiceImpl.class, user);
}
private VariableArchiveService getVariableArchiveService(User user) {
return ServiceUtil.getService(VariableArchiveServiceImpl.class, user);
}
@Override
public List<SalarySobItemPO> list() {
return salarySobItemMapper.listAll();
@ -629,7 +693,7 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
}
salarySobItemPO.setFormula(formulaPO);
}
if(SalaryEntityUtil.isNotNullOrEmpty(salarySobItemPO.getSalaryItemId())){
if (SalaryEntityUtil.isNotNullOrEmpty(salarySobItemPO.getSalaryItemId())) {
SalaryItemPO salaryItemPO = itemIdMap.get(salarySobItemPO.getSalaryItemId());
salarySobItemPO.setSalaryItem(salaryItemPO);
}
@ -677,7 +741,7 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
salarySobItemFormDTO
.setId(salarySobItemPO.getId())
.setName(salaryItemPO.getName())
.setItemHide(salarySobItemPO.getItemHide()==null?0:Integer.parseInt(salarySobItemPO.getItemHide().toString()))
.setItemHide(salarySobItemPO.getItemHide() == null ? 0 : Integer.parseInt(salarySobItemPO.getItemHide().toString()))
.setDataType(salaryItemPO.getDataType())
.setRoundingMode(salarySobItemPO.getRoundingMode() == null ? salaryItemPO.getRoundingMode() : salarySobItemPO.getRoundingMode())
.setPattern(salarySobItemPO.getPattern() == null ? salaryItemPO.getPattern() : salarySobItemPO.getPattern())
@ -726,7 +790,7 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
salaryItemTopologyDTO.setSalaryItemId(salaryItemPO.getId());
salaryItemTopologyDTO.setSalaryItemName(salaryItemPO.getName());
salaryItemTopologyDTO.setFormula(expressFormula);
salaryItemTopologyDTO.setResult(topologyData.getResultItemMap().getOrDefault(salaryItemPO.getId(), ""));
salaryItemTopologyDTO.setResult(topologyData.getResultItemMap().getOrDefault(SalaryFormulaReferenceEnum.SALARY_ITEM.getValue() + "_" + salaryItemPO.getCode(), ""));
topology(salaryItemTopologyDTO, topologyData);
@ -767,7 +831,8 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
for (int i = 0; i < parameters.size(); i++) {
FormulaVar formulaVar = parameters.get(i);
String source = formulaVar.getSource();
String fieldId = formulaVar.getFieldId().replace(source + "_", "");
String fieldId = formulaVar.getFieldId();
String code = fieldId.replace(source + "_", "");
String name = formulaVar.getName();
String fieldName = formulaVar.getFieldName();
//是否是薪资项目
@ -785,26 +850,26 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
}
ExpressFormula expressFormula;
if (salarySobItemCodeMap.containsKey(fieldId)) {
if (salarySobItemCodeMap.containsKey(code)) {
// 如果薪资账套下重新定义了薪资项目的公式则使用薪资账套下的公式否则使用薪资项目本身的公式
expressFormula = expressFormulaIdMap.get(salarySobItemCodeMap.get(fieldId).getFormulaId());
} else if (salaryItemCodeMap.containsKey(fieldId)) {
expressFormula = expressFormulaIdMap.get(salaryItemCodeMap.get(fieldId).getFormulaId());
expressFormula = expressFormulaIdMap.get(salarySobItemCodeMap.get(code).getFormulaId());
} else if (salaryItemCodeMap.containsKey(code)) {
expressFormula = expressFormulaIdMap.get(salaryItemCodeMap.get(code).getFormulaId());
} else {
expressFormula = null;
}
SalaryItemPO salaryItemChild = isSalaryItemVar ? salaryItemCodeMap.get(fieldId) : new SalaryItemPO();
SalaryItemPO salaryItemChild = isSalaryItemVar ? salaryItemCodeMap.get(code) : new SalaryItemPO();
SalaryItemTopologyDTO salaryItemTopologyChild = new SalaryItemTopologyDTO();
salaryItemTopologyChild.setSalaryItemId(isSalaryItemVar ? salaryItemChild.getId() : null);
salaryItemTopologyChild.setSalaryItemName(isSalaryItemVar ? salaryItemChild.getName() : fieldName);
salaryItemTopologyChild.setFormula(expressFormula);
salaryItemTopologyChild.setResult(isSalaryItemVar ? topologyData.getResultItemMap().getOrDefault(salaryItemChild.getId(), "") : "");
salaryItemTopologyChild.setResult(topologyData.getResultItemMap().getOrDefault(fieldId, ""));
salaryItemTopologyDTOChildren.add(salaryItemTopologyChild);
if (isSalaryItemVar) {
SalaryItemPO salaryItemChildChild = salaryItemCodeMap.get(fieldId);
SalaryItemPO salaryItemChildChild = salaryItemCodeMap.get(code);
SalaryValueTypeEnum salaryValueTypeEnum = SalaryValueTypeEnum.parseByValue(salaryItemChildChild.getValueType());
if (salaryValueTypeEnum != SalaryValueTypeEnum.INPUT) {
topologyData.setSalaryItemId(salaryItemChildChild.getId());
@ -849,9 +914,119 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
//薪资结果
Long acctEmpId = param.getAcctEmpId();
if (acctEmpId != null) {
List<SalaryAcctResultPO> results = getSalaryAcctResultService(user).listBySalaryAcctEmployeeId(acctEmpId);
Map<Long, String> resultItemMap = SalaryEntityUtil.convert2Map(results, SalaryAcctResultPO::getSalaryItemId, SalaryAcctResultPO::getResultValue);
topologyData.setResultItemMap(resultItemMap);
SalaryAcctEmployeePO acctEmployeePO = getSalaryAcctEmployeeService(user).getById(acctEmpId);
List<SalaryAcctEmployeePO> acctEmployeePOS = new ArrayList<>();
acctEmployeePOS.add(acctEmployeePO);
Long salaryAcctRecordId = acctEmployeePO.getSalaryAcctRecordId();
// 1查询薪资核算记录
SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(salaryAcctRecordId);
if (Objects.isNull(salaryAcctRecordPO)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98747, "薪资核算记录不存在或已被删除"));
}
//查询对应账套
SalarySobPO salarySobPO = getSalarySobService(user).getById(salaryAcctRecordPO.getSalarySobId());
if (Objects.isNull(salarySobPO)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98747, "薪资账套不存在或已被删除"));
}
// 不是查询薪资账套下实时的薪资项目而是查询发起薪资核算时存储的薪资项目快照
SalaryAcctConfig salaryAcctSobConfig = getSalaryAcctSobConfigService(user).getSalaryAcctConfig(salaryAcctRecordId);
// 2查询薪资核算记录的薪资周期考勤周期等
SalarySobCycleDTO salarySobCycleDTO = getSalaryAcctRecordService(user).getSalarySobCycleById(salaryAcctRecordId);
// 3查询薪资核算记录所用薪资账套的薪资项目副本
List<SalarySobItemPO> salarySobItemPOS = salaryAcctSobConfig.getSalarySobItems();
// 回算薪资项目
List<SalarySobBackItemPO> salarySobBackItems = Collections.emptyList();
if (Objects.equals(salaryAcctRecordPO.getBackCalcStatus(), 1)) {
salarySobBackItems = salaryAcctSobConfig.getSalarySobBackItems();
}
// 4查询当前租户的所有薪资项目
List<SalaryItemPO> salaryItemPOS = getSalaryItemService(user).listAll();
// 6查询社保福利的所有字段
Map<String, String> welfareColumns = getSIAccountService(user).welfareColumns();
// 7查询考勤引用的所有字段
List<AttendQuoteFieldListDTO> attendQuoteFieldListDTOS = getAttendQuoteFieldService(user).listAll();
List<VariableItemPO> variableItemPOS = getVariableItemService(user).listAll();
// 8查询公式详情
Set<Long> formulaIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getFormulaId);
formulaIds.addAll(SalaryEntityUtil.properties(salaryItemPOS, SalaryItemPO::getFormulaId));
formulaIds.addAll(SalaryEntityUtil.properties(salarySobBackItems, SalarySobBackItemPO::getFormulaId));
List<ExpressFormula> formulas = getSalaryFormulaService(user).listExpressFormula(formulaIds);
// 本次运算的回算薪资项目所涉及的变量
// Set<String> issuedFieldIds = getIssuedFieldIds(salarySobBackItems);
// 10根据id查询其他合并计税的薪资核算记录
List<SalaryAcctRecordPO> otherSalaryAcctRecordPOS = getSalaryAcctRecordService(user).listById4OtherConsolidatedTax(salaryAcctRecordPO.getId());
// 12.3生成本次运算的key
String calculateKey = UUID.randomUUID().toString();
// 12.5多线程运算运算结果存放在临时表中
SalaryAcctCalculateBO salaryAcctCalculateBO = new SalaryAcctCalculateBO()
.setSalaryAcctRecordPO(salaryAcctRecordPO)
.setSalarySobPO(salarySobPO)
.setSalarySobCycleDTO(salarySobCycleDTO)
.setOtherSalaryAcctRecordPOS(otherSalaryAcctRecordPOS)
.setSalarySobItemPOS(salarySobItemPOS)
.setSalaryItemIdWithPriorityList(new ArrayList<>())
.setExpressFormulas(formulas)
.setSalaryItemPOS(salaryItemPOS)
.setSalarySobAdjustRulePOS(new ArrayList<>())
.setWelfareColumns(MapUtils.emptyIfNull(welfareColumns))
.setAttendQuoteFieldListDTOS(attendQuoteFieldListDTOS)
.setSalaryAcctEmployeePOS(acctEmployeePOS)
.setIssuedFieldIds(new HashSet<>())
.setResults(null)
.setCalculateKey(calculateKey)
.setVariableItems(variableItemPOS)
.setTaxDeclarationFunction(null)
.setTaxIds(null);
List<Long> employeeIds = Collections.singletonList(acctEmployeePO.getEmployeeId());
List<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).getEmployeeByIdsAll(employeeIds);
Long taxAgentId = salaryAcctCalculateBO.getSalarySobPO().getTaxAgentId();
List<SalaryArchiveDataDTO> salaryArchiveData = getSalaryArchiveService(user).getSalaryArchiveData(salarySobCycleDTO.getSalaryCycle(), employeeIds, taxAgentId);
List<AddUpSituation> addUpSituationPOS;
if (salarySobCycleDTO.getTaxCycle().getMonth() == Month.JANUARY) {
// 3.1如果当前税款所属期是本年度第一个税款所属期就不需要查询往期累计情况
addUpSituationPOS = Collections.emptyList();
} else {
addUpSituationPOS = getAddUpSituationService(user).getAddUpSituationList(salarySobCycleDTO.getTaxCycle().plusMonths(-1), employeeIds);
}
List<AddUpDeduction> addUpDeductionPOS = getAddUpDeductionService(user).getAddUpDeductionList(salarySobCycleDTO.getTaxCycle(), employeeIds, taxAgentId);
List<OtherDeductionPO> otherDeductionPOS = getOtherDeductionService(user).getOtherDeductionList(salarySobCycleDTO.getTaxCycle(), employeeIds, taxAgentId);
List<Map<String, Object>> welfareData = new ArrayList<>();
welfareData.addAll(getSIAccountService(user).welfareData(salarySobCycleDTO.getSocialSecurityCycle().toString(), employeeIds, taxAgentId));
List<AttendQuoteDataDTO> attendQuoteDataDTOS = getAttendQuoteDataService(user).getAttendQuoteData(salarySobCycleDTO.getSalaryMonth(), salarySobCycleDTO.getSalarySobId(), employeeIds);
List<Long> salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctCalculateBO.getSalaryAcctEmployeePOS(), SalaryAcctEmployeePO::getId, Collectors.toList());
List<SalaryAcctResultPO> salaryAcctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds);
Map<String, String> empItemValueMap = SalaryEntityUtil.convert2Map(salaryAcctResultPOS, p -> p.getSalaryAcctEmpId() + "_" + p.getSalaryItemId(), SalaryAcctResultPO::getResultValue);
List<Map<String, Object>> variableArchiveList = getVariableArchiveService(user).listBySalaryMonthAndEmployeeIds(salarySobCycleDTO.getSalaryMonth(), employeeIds, taxAgentId);
Map<String, List<SalaryAcctResultPO>> collect = salaryAcctResultPOS.stream().collect(Collectors.groupingBy(k -> k.getEmployeeId() + "-" + k.getTaxAgentId() + "-" + k.getSalaryItemId()));
Map<String, String> salaryAcctResultPOMap = new HashMap<>();
for (Map.Entry<String, List<SalaryAcctResultPO>> et : collect.entrySet()) {
salaryAcctResultPOMap.put(et.getKey(), et.getValue().get(0).getOriginResultValue());
}
Set<Long> otherSalaryAcctRecordIds = SalaryEntityUtil.properties(salaryAcctCalculateBO.getOtherSalaryAcctRecordPOS(), SalaryAcctRecordPO::getId);
List<SalaryAcctResultPO> otherSalaryAcctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctRecordIdsAndEmployeeIds(otherSalaryAcctRecordIds, employeeIds);
Map<String, List<SalaryAcctResultPO>> otherSalaryAcctResultPOMap = SalaryEntityUtil.group2Map(otherSalaryAcctResultPOS, e -> e.getEmployeeId() + "_" + e.getTaxAgentId());
List<SalaryAcctEmployeePO> otherSalaryAcctEmployeePOS = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIdsAndEmployeeIds(otherSalaryAcctRecordIds, employeeIds);
Map<String, List<SalaryAcctEmployeePO>> otherSalaryAcctEmployeePOMap = SalaryEntityUtil.group2Map(otherSalaryAcctEmployeePOS, salaryAcctEmployeePO -> salaryAcctEmployeePO.getEmployeeId() + "_" + salaryAcctEmployeePO.getTaxAgentId());
// List<SalaryAcctResultPO> lastMonthResultPOS = getSalaryAcctResultService(user).listBySobSalaryMonth(SalaryDateUtil.toDate(salarySobCycleDTO.getSalaryMonth().minusMonths(1), 1), salaryAcctCalculateBO.getSalarySobPO().getId(), employeeIds);
CalculateFormulaVarBO calculateFormulaVarBO = new CalculateFormulaVarBO(simpleEmployees, salaryArchiveData, addUpSituationPOS, addUpDeductionPOS, otherDeductionPOS, welfareData, attendQuoteDataDTOS, salaryAcctResultPOS, variableArchiveList);
Map<String, List<CalculateFormulaVarBO.FormulaVarValue>> formulaVarMap = calculateFormulaVarBO.convert2FormulaVar(salaryAcctCalculateBO);
Map<String, String> resultMap = new HashMap<>();
formulaVarMap.entrySet().forEach(e -> {
e.getValue().forEach(f -> {
resultMap.put(f.getFieldId(), f.getFieldValue());
});
});
topologyData.setResultItemMap(resultMap);
} else {
topologyData.setResultItemMap(new HashMap<>());
}
@ -885,7 +1060,7 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
/**
* 核算结果
*/
Map<Long, String> resultItemMap;
Map<String, String> resultItemMap;
}

View File

@ -1,5 +1,6 @@
package com.engine.salary.service.impl;
import cn.hutool.core.util.StrUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.hrmelog.entity.dto.LoggerContext;
@ -11,6 +12,7 @@ import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.entity.taxdeclaration.bo.TaxDeclarationBO;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationAddParam;
@ -152,15 +154,12 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration
// 分页参数
TaxDeclarationPO po = TaxDeclarationPO.builder().build();
LocalDateRange localDateRange = new LocalDateRange();
if (Objects.nonNull(queryParam.getFromSalaryMonth())) {
localDateRange.setFromDate(queryParam.getFromSalaryMonth());
po.setTaxCycleFromDate(queryParam.getFromSalaryMonth());
}
if (Objects.nonNull(queryParam.getEndSalaryMonth())) {
localDateRange.setEndDate(SalaryDateUtil.localDateToDate(SalaryDateUtil.localDate2YearMonth(queryParam.getEndSalaryMonth()).atEndOfMonth()));
po.setTaxCycleEndDate(queryParam.getEndSalaryMonth());
}
po.setSalaryMonths(localDateRange);
// 分权
Boolean openDevolution = getTaxAgentService(user).isNeedAuth(currentEmployeeId);
@ -176,6 +175,15 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration
// 查询个税申报表
List<TaxDeclarationPO> taxDeclarationPOS = getTaxDeclarationMapper().listSome(po);
if (StrUtil.isNotBlank(queryParam.getTaxAgentName())) {
List<TaxAgentPO> taxAgentPOs = getTaxAgentService(user).list(TaxAgentQueryParam.builder().name(queryParam.getTaxAgentName()).build());
Set<Long> taxAgentIds = SalaryEntityUtil.properties(taxAgentPOs, TaxAgentPO::getId);
taxDeclarationPOS = taxDeclarationPOS.stream().filter(tax -> taxAgentIds.contains(tax.getTaxAgentId())).collect(Collectors.toList());
}
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(),
taxDeclarationPOS, TaxDeclarationPO.class);

View File

@ -1,5 +1,7 @@
package com.engine.salary.service.impl;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.hrmelog.entity.dto.LoggerContext;
@ -23,6 +25,7 @@ import com.engine.salary.entity.salarysob.po.SalarySobAddUpRulePO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.entity.salarysob.po.SalarySobTaxReportRulePO;
import com.engine.salary.entity.taxagent.bo.TaxAgentTaxReturnBO;
import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.entity.taxagent.po.TaxAgentTaxReturnPO;
import com.engine.salary.entity.taxapiflow.bo.TaxApiFlowBO;
@ -258,6 +261,13 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe
}
List<TaxDeclareRecordPO> taxDeclareRecordPOS = getTaxDeclareRecordMapper().listSome(build);
if (StrUtil.isNotBlank(queryParam.getTaxAgentName())) {
List<TaxAgentPO> taxAgentPOs = getTaxAgentService(user).list(TaxAgentQueryParam.builder().name(queryParam.getTaxAgentName()).build());
Set<Long> taxAgentIds = SalaryEntityUtil.properties(taxAgentPOs, TaxAgentPO::getId);
taxDeclareRecordPOS = taxDeclareRecordPOS.stream().filter(tax -> taxAgentIds.contains(tax.getTaxAgentId())).collect(Collectors.toList());
}
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), taxDeclareRecordPOS, TaxDeclareRecordPO.class);
}
@ -916,7 +926,8 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe
declareStatus.setTaxDeclareStatus(taxDeclareStatusEnum.getValue());
// 申报类型
declareStatus.setTaxPayAmount(Util.null2String(declareTaxFeedbackResponse.getBody().get("ykjse")));
declareStatus.setPersonNum(Integer.parseInt(Optional.ofNullable(declareTaxFeedbackResponse.getBody().get("nsrc")).orElse("0").toString()));
String nsrc = Util.null2String(declareTaxFeedbackResponse.getBody().get("nsrc"));
declareStatus.setPersonNum(Integer.parseInt(NumberUtil.isNumber(nsrc) ? nsrc : "0"));
declareStatus.setDeclareRequestId(declareStatus.getRequestId());
declareStatus.setRequestId("");
//实缴不含滞纳金

View File

@ -1,5 +1,6 @@
package com.engine.salary.util.excel;
import cn.hutool.core.util.StrUtil;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationLaborListDTO;
import com.engine.salary.util.JsonUtil;
import com.engine.salary.util.SalaryDateUtil;
@ -139,8 +140,10 @@ public class ExcelUtil {
}
Object o = infoList.get(cellIndex);
if (o instanceof String) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
if (StrUtil.isNotBlank(String.valueOf(o))) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
}
} else if (o instanceof BigDecimal) {
cell.setCellType(CellType.NUMERIC);
cell.setCellValue(o == null ? 0 : ((BigDecimal) o).doubleValue());
@ -235,8 +238,10 @@ public class ExcelUtil {
}
Object o = infoList.get(cellIndex);
if (o instanceof String) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
if (StrUtil.isNotBlank(String.valueOf(o))) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
}
} else if (o instanceof BigDecimal) {
cell.setCellType(CellType.NUMERIC);
cell.setCellValue(o == null ? 0 : ((BigDecimal) o).doubleValue());
@ -311,8 +316,10 @@ public class ExcelUtil {
}
Object o = infoList.get(cellIndex);
if (o instanceof String) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
if (StrUtil.isNotBlank(String.valueOf(o))) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
}
} else if (o instanceof BigDecimal) {
cell.setCellType(CellType.NUMERIC);
cell.setCellValue(o == null ? 0 : ((BigDecimal) o).doubleValue());
@ -377,8 +384,10 @@ public class ExcelUtil {
}
Object o = infoList.get(cellIndex);
if (o instanceof String) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
if (StrUtil.isNotBlank(String.valueOf(o))) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
}
} else if (o instanceof Boolean) {
cell.setCellType(CellType.BOOLEAN);
cell.setCellValue(String.valueOf(o));
@ -458,8 +467,10 @@ public class ExcelUtil {
}
Object o = infoList.get(cellIndex);
if (o instanceof String) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
if (StrUtil.isNotBlank(String.valueOf(o))) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
}
} else if (o instanceof Boolean) {
cell.setCellType(CellType.BOOLEAN);
cell.setCellValue(String.valueOf(o));

View File

@ -1,6 +1,7 @@
package com.engine.salary.util.excel;
import com.cloudstore.eccom.pc.table.WeaTableColumn;
import cn.hutool.core.util.StrUtil;
import com.engine.salary.component.WeaTableColumnGroup;
import com.engine.salary.entity.taxdeclaration.dto.ContrastListDTO;
import com.engine.salary.util.SalaryDateUtil;
@ -9,6 +10,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.*;
import weaver.wechat.util.Utils;
import java.awt.Color;
import java.math.BigDecimal;
@ -132,10 +134,10 @@ public class ExcelUtilPlus {
for (int i = 0; i < header.size(); i++) {
WeaTableColumnGroup columnGroupItem = (WeaTableColumnGroup) header.get(i);
XSSFCell rowZeroCell = row0.createCell(i, CellType.STRING);
rowZeroCell.setCellValue(columnGroupItem.getText().toString());
rowZeroCell.setCellValue(columnGroupItem.getText());
rowZeroCell.setCellStyle(titleCellStyle);
//设置列宽
sheet.setColumnWidth(i, Math.min(255, Math.max(12, columnGroupItem.getText().length() * 4)) * 256);
sheet.setColumnWidth(i, Math.min(255, Math.max(12, Utils.null2String(columnGroupItem.getText()).length() * 4)) * 256);
patternList.add(columnGroupItem.getPattern());
}
@ -191,8 +193,10 @@ public class ExcelUtilPlus {
}
Object o = infoList.get(cellIndex);
if (o instanceof String) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
if (StrUtil.isNotBlank(String.valueOf(o))) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
}
} else if (o instanceof BigDecimal) {
if (lastRowRed && rowIndex == rowList.size() - 1) {
cell.setCellStyle(numberRedCellStyleMap.get(patternList.get(cellIndex)));
@ -200,7 +204,7 @@ public class ExcelUtilPlus {
cell.setCellStyle(numberCellStyleMap.get(patternList.get(cellIndex)));
}
cell.setCellType(CellType.NUMERIC);
cell.setCellValue(o == null ? 0 : ((BigDecimal) o).doubleValue());
cell.setCellValue(((BigDecimal) o).doubleValue());
} else if (o instanceof Boolean) {
cell.setCellType(CellType.BOOLEAN);
cell.setCellValue(String.valueOf(o));
@ -220,6 +224,7 @@ public class ExcelUtilPlus {
}
return workbook;
}
public static XSSFWorkbook genWorkbookV2(List<List<Object>> rowList, String sheetName) {
XSSFWorkbook workbook = new XSSFWorkbook();
@ -280,11 +285,13 @@ public class ExcelUtilPlus {
}
Object o = infoList.get(cellIndex);
if (o instanceof String) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
if (StrUtil.isNotBlank(String.valueOf(o))) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
}
} else if (o instanceof BigDecimal) {
cell.setCellType(CellType.NUMERIC);
cell.setCellValue(o == null ? 0 : ((BigDecimal) o).doubleValue());
cell.setCellValue(((BigDecimal) o).doubleValue());
} else if (o instanceof Boolean) {
cell.setCellType(CellType.BOOLEAN);
cell.setCellValue(String.valueOf(o));
@ -457,8 +464,10 @@ public class ExcelUtilPlus {
}
Object o = infoList.get(cellIndex);
if (o instanceof String) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
if (StrUtil.isNotBlank(String.valueOf(o))) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
}
} else if (o instanceof Boolean) {
cell.setCellType(CellType.BOOLEAN);
cell.setCellValue(String.valueOf(o));
@ -566,11 +575,13 @@ public class ExcelUtilPlus {
}
Object o = infoList.get(cellIndex);
if (o instanceof String) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
if (StrUtil.isNotBlank(String.valueOf(o))) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
}
} else if (o instanceof BigDecimal) {
cell.setCellType(CellType.NUMERIC);
cell.setCellValue(o == null ? 0 : ((BigDecimal) o).doubleValue());
cell.setCellValue(((BigDecimal) o).doubleValue());
} else if (o instanceof Boolean) {
cell.setCellType(CellType.BOOLEAN);
cell.setCellValue(String.valueOf(o));
@ -764,8 +775,10 @@ public class ExcelUtilPlus {
}
Object o = infoList.get(cellIndex);
if (o instanceof String) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
if (StrUtil.isNotBlank(String.valueOf(o))) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
}
} else if (o instanceof BigDecimal) {
if (lastRowRed && rowIndex == rowList.size() - 1) {
cell.setCellStyle(numberRedCellStyleMap.get(patternList.get(cellIndex)));
@ -929,8 +942,10 @@ public class ExcelUtilPlus {
}
Object o = infoList.get(cellIndex);
if (o instanceof String) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
if (StrUtil.isNotBlank(String.valueOf(o))) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
}
} else if (o instanceof BigDecimal) {
cell.setCellType(CellType.NUMERIC);
cell.setCellValue(o == null ? 0 : ((BigDecimal) o).doubleValue());

View File

@ -250,7 +250,9 @@ public class ValidUtil {
.replace("", "between")
.replace("", "BETWEEN")
.replace("", "union")
.replace("", "UNION");
.replace("", "UNION")
.replace("", "substr")
.replace("", "SUBSTR");
}
setValue(t, field.getName(), result);
} else if (valueTypeEnum == ValueTypeEnum.OBJECT) {

View File

@ -72,7 +72,7 @@ public class TaxDeclarationController {
@POST
@Path("/list")
@Produces(MediaType.APPLICATION_JSON)
public String listTaxDeclaration(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxDeclarationListQueryParam queryParam) {
public String list(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxDeclarationListQueryParam queryParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<TaxDeclarationListQueryParam, Map<String, Object>>(user).run(getTaxDeclareRecordWrapper(user)::listPage, queryParam);
}

View File

@ -97,7 +97,10 @@ public class SalarySobRangeWrapper extends Service {
.replace("", "between")
.replace("", "BETWEEN")
.replace("", "union")
.replace("", "UNION"));
.replace("", "UNION")
.replace("", "substr")
.replace("", "SUBSTR")
);
}
});
@ -127,7 +130,10 @@ public class SalarySobRangeWrapper extends Service {
.replace("", "between")
.replace("", "BETWEEN")
.replace("", "union")
.replace("", "UNION"));
.replace("", "UNION")
.replace("", "substr")
.replace("", "SUBSTR")
);
}
});

View File

@ -411,7 +411,10 @@ public class TaxAgentWrapper extends Service {
.replace("", "between")
.replace("", "BETWEEN")
.replace("", "union")
.replace("", "UNION"));
.replace("", "UNION")
.replace("", "substr")
.replace("", "SUBSTR")
);
}
});
@ -445,7 +448,10 @@ public class TaxAgentWrapper extends Service {
.replace("", "between")
.replace("", "BETWEEN")
.replace("", "union")
.replace("", "UNION"));
.replace("", "UNION")
.replace("", "substr")
.replace("", "SUBSTR")
);
}
});