人员报送接口

This commit is contained in:
钱涛 2023-08-20 14:03:43 +08:00
parent 988139610b
commit 2f59f8283a
21 changed files with 216 additions and 75 deletions

View File

@ -44,7 +44,6 @@ import java.util.stream.Collectors;
* @version 1.0
**/
public class TaxDeclarationBO {
private static EncryptUtil encryptUtil = new EncryptUtil();
public static List<TaxDeclarationListDTO> convert2ListDTO(List<TaxDeclarationPO> taxDeclarations,
List<DataCollectionEmployee> simpleEmployees,
@ -469,7 +468,6 @@ public class TaxDeclarationBO {
.tenantKey(taxDeclaration.getTenantKey())
.deleteType(NumberUtils.INTEGER_ZERO)
.build();
encryptUtil.encrypt(accumulatedSituation, AddUpSituation.class);
result.getNeedInsertAddUpSituations().add(accumulatedSituation);
});
}

View File

@ -39,13 +39,13 @@ public class TaxDeclarationValueList {
*/
public static List<WeaTableColumn> buildTableColumns(List<TaxReportColumnPO> taxReportColumns) {
List<WeaTableColumn> weaTableColumns = Lists.newArrayList();
weaTableColumns.add(new WeaTableColumn(SalaryI18nUtil.getI18nLabel(86317, "工号"), "jobNum", "120"));
weaTableColumns.add(new WeaTableColumn(SalaryI18nUtil.getI18nLabel(85429, "姓名"), "username", "120"));
weaTableColumns.add(new WeaTableColumn(SalaryI18nUtil.getI18nLabel(105139, "证件类型"), "cardType", "120"));
weaTableColumns.add(new WeaTableColumn(SalaryI18nUtil.getI18nLabel(86318, "证件号码"), "cardNum", "150"));
weaTableColumns.add(new WeaTableColumn(SalaryI18nUtil.getI18nLabel(102786, "所得项目"), "incomeCategory", "120"));
weaTableColumns.add(new WeaTableColumn("120", SalaryI18nUtil.getI18nLabel(86317, "工号"), "jobNum"));
weaTableColumns.add(new WeaTableColumn("120", SalaryI18nUtil.getI18nLabel(85429, "姓名"), "username"));
weaTableColumns.add(new WeaTableColumn("120", SalaryI18nUtil.getI18nLabel(105139, "证件类型"), "cardType"));
weaTableColumns.add(new WeaTableColumn("120", SalaryI18nUtil.getI18nLabel(86318, "证件号码"), "cardNum"));
weaTableColumns.add(new WeaTableColumn("120", SalaryI18nUtil.getI18nLabel(102786, "所得项目"), "incomeCategory"));
for (TaxReportColumnPO taxReportColumn : taxReportColumns) {
weaTableColumns.add(new WeaTableColumn(SalaryI18nUtil.getI18nLabel(taxReportColumn.getReportColumnLabel(), taxReportColumn.getReportColumnName()), taxReportColumn.getReportColumnDataIndex(), "120"));
weaTableColumns.add(new WeaTableColumn("120", SalaryI18nUtil.getI18nLabel(taxReportColumn.getReportColumnLabel(), taxReportColumn.getReportColumnName()), taxReportColumn.getReportColumnDataIndex()));
}
return weaTableColumns;
}

View File

@ -1,9 +1,9 @@
package com.engine.salary.entity.taxdeclaration.dto;
import com.engine.salary.annotation.TableTitle;
import com.engine.salary.enums.employeedeclare.DeclareStatusEnum;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
@ -30,20 +30,25 @@ public class AbnormalEmployeeListDTO {
private Long employeeId;
//姓名")
@TableTitle(title = "姓名",dataIndex = "employeeName",key = "employeeName")
private String employeeName;
//工号")
@TableTitle(title = "工号",dataIndex = "jobNum",key = "jobNum")
private String jobNum;
//证件类型")
@TableTitle(title = "证件类型",dataIndex = "cardType",key = "cardType")
private String cardType;
//证件号码")
@TableTitle(title = "证件号码",dataIndex = "cardNum",key = "cardNum")
private String cardNum;
//报送状态")
private DeclareStatusEnum declareStatus;
//报送状态")
@TableTitle(title = "报送状态",dataIndex = "declareStatusDesc",key = "declareStatusDesc")
private String declareStatusDesc;
}

View File

@ -2,6 +2,7 @@ package com.engine.salary.entity.taxdeclaration.dto;
import com.engine.salary.enums.taxdeclaration.TaxDeclareStatusEnum;
import com.engine.salary.enums.taxdeclaration.TaxDeclareTypeEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;
@ -27,11 +28,11 @@ public class TaxDeclarationInfoDTO {
@ApiModelProperty("薪资所属月")
@JsonSerialize(using = ToStringSerializer.class)
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date salaryMonth;
@ApiModelProperty("税款所属期")
@JsonSerialize(using = ToStringSerializer.class)
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date taxCycle;
@ApiModelProperty("个税扣缴义务人id")

View File

@ -54,6 +54,4 @@ public class TaxDeclarationSaveParam {
* 备注
*/
private String description;
private String salaryMonthStr;
}

View File

@ -78,5 +78,5 @@ public interface EmployeeDeclareRecordMapper {
*/
void deleteByIds(@Param("ids") Collection<Long> ids);
void deleteByTaxCycleAndTaxAgentId(Date taxCycle, Long taxAgentId);
void deleteByTaxCycleAndTaxAgentId(@Param("taxCycle")Date taxCycle,@Param("taxAgentId") Long taxAgentId);
}

View File

@ -1,10 +1,8 @@
package com.engine.salary.mapper.taxdeclaration;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationEmployeeDTO;
import com.engine.salary.entity.taxdeclaration.param.AbnormalEmployeeListQueryParam;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationDetailListQueryParam;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationDetailPO;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclareEmployeePO;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
@ -72,12 +70,4 @@ public interface TaxDeclarationDetailMapper {
List<TaxDeclarationDetailPO> listAll();
int batchUpdate(@Param("collection") List<TaxDeclarationDetailPO> taxDeclarationDetailPos);
List<TaxDeclareEmployeePO> listPage4NotDeclareByParam(AbnormalEmployeeListQueryParam queryParam);
List<TaxDeclareEmployeePO> list4NotDeclareByParam(AbnormalEmployeeListQueryParam queryParam);
List<TaxDeclareEmployeePO> listPage4NoValueByParam(AbnormalEmployeeListQueryParam queryParam);
List<TaxDeclareEmployeePO> list4NoValueByParam(AbnormalEmployeeListQueryParam queryParam);
}

View File

@ -1,6 +1,8 @@
package com.engine.salary.mapper.taxdeclaration;
import com.engine.salary.entity.taxdeclaration.param.AbnormalEmployeeListQueryParam;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationValuePO;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclareEmployeePO;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
@ -78,4 +80,44 @@ public interface TaxDeclarationValueMapper {
void deleteByIds(@Param("ids") Collection<Long> ids);
void deleteBytaxDeclareRecordIds(@Param("taxDeclareRecordIds")Collection<Long> taxDeclareRecordIds);
/**
* 查询个税申报表明细中未报送成功的人员
*
* @param queryParam
* @return
*/
List<TaxDeclareEmployeePO> listPage4NotDeclareByParam(@Param("param") AbnormalEmployeeListQueryParam queryParam);
/**
* 查询个税申报表明细中未报送成功的人员
*
* @param queryParam
* @return
*/
List<TaxDeclareEmployeePO> list4NotDeclareByParam(@Param("param") AbnormalEmployeeListQueryParam queryParam);
/**
* 查询个税申报表明细中未报送成功的人员
*
* @param queryParam
* @return
*/
List<TaxDeclareEmployeePO> listPage4NoValueByParam(@Param("param") AbnormalEmployeeListQueryParam queryParam);
/**
* 查询个税申报表明细中未报送成功的人员
*
* @param queryParam
* @return
*/
List<TaxDeclareEmployeePO> list4NoValueByParam(@Param("param") AbnormalEmployeeListQueryParam queryParam);
/**
* 批量插入
*
* @param taxDeclarationValues
*/
void batchInsert(@Param("collection") Collection<TaxDeclarationValuePO> taxDeclarationValues);
}

View File

@ -361,5 +361,64 @@
</foreach>
</delete>
<resultMap id="TaxDeclareEmployeeMap" type="com.engine.salary.entity.taxdeclaration.po.TaxDeclareEmployeePO">
<result column="employee_id" property="employeeId"/>
<result column="employee_type" property="employeeType"/>
</resultMap>
<sql id="TaxDeclareEmployeeSql">
employee_id, employee_type
</sql>
<sql id="NotDeclareSql">
SELECT DISTINCT
<include refid="TaxDeclareEmployeeSql"/>
FROM hrsa_tax_declaration_value
WHERE delete_type = 0
AND tax_declare_record_id = #{param.taxDeclareRecordId}
AND employee_id NOT IN (
SELECT employee_id
FROM hrsa_employee_declare hed
WHERE hed.delete_type = 0
AND hed.tax_agent_id = #{param.taxAgentId}
AND hed.tax_cycle = #{param.taxCycle}
AND hed.successfully_declared = 1
AND hed.employment_status = 0
AND hed.declare_status IN (4)
)
</sql>
<select id="listPage4NotDeclareByParam" resultMap="TaxDeclareEmployeeMap">
<include refid="NotDeclareSql"/>
</select>
<select id="list4NotDeclareByParam" resultMap="TaxDeclareEmployeeMap">
<include refid="NotDeclareSql"/>
</select>
<sql id="NoValueSql">
SELECT
<include refid="TaxDeclareEmployeeSql"/>
FROM hrsa_employee_declare
WHERE delete_type = 0
AND tax_agent_id = #{param.taxAgentId}
AND tax_cycle = #{param.taxCycle}
AND successfully_declared = 1
AND employment_status = 0
AND employee_id NOT IN (
SELECT employee_id
FROM hrsa_tax_declaration_value htdv
WHERE htdv.delete_type = 0
AND htdv.tax_declare_record_id = #{param.taxDeclareRecordId}
)
</sql>
<select id="listPage4NoValueByParam" resultMap="TaxDeclareEmployeeMap">
<include refid="NoValueSql"/>
</select>
<select id="list4NoValueByParam" resultMap="TaxDeclareEmployeeMap">
<include refid="NoValueSql"/>
</select>
</mapper>

View File

@ -1150,6 +1150,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
@Override
public void batchSave(List<AddUpSituation> list) {
if (CollectionUtils.isNotEmpty(list)) {
list = encryptUtil.encryptList(list,AddUpSituation.class);
List<List<AddUpSituation>> partition = Lists.partition(list, 50);
partition.forEach(getAddUpSituationMapper()::insertData);
}

View File

@ -563,7 +563,7 @@ public class EmployeeDeclareServiceImpl extends Service implements EmployeeDecla
// 企业信息
Map<String, Object> requestParam = TaxAgentTaxReturnBO.convert2RequestMap(taxAgent, taxAgentTaxReturn);
// 税款所属期
requestParam.put("skssq", param.getTaxCycle().toString().replace("-", ""));
requestParam.put("skssq", SalaryDateUtil.getFormatYearMonth(param.getTaxCycle()).replace("-", ""));
// 人员列表
requestParam.put("rylb", employeeInfoMapList);

View File

@ -11,6 +11,7 @@ import com.engine.salary.service.SalaryEmployeeService;
import com.engine.salary.service.TaxAgentService;
import com.engine.salary.service.TaxDeclarationApiBillingService;
import com.engine.salary.service.TaxDeclarationApiFlowWarnService;
import com.engine.salary.util.db.MapperProxyFactory;
import com.google.common.collect.Lists;
import lombok.AllArgsConstructor;
import lombok.Data;
@ -30,8 +31,9 @@ import java.util.Map;
@Slf4j
public class TaxDeclarationApiBillingServiceImpl extends Service implements TaxDeclarationApiBillingService {
private TaxDeclarationApiFlowRecordMapper taxDeclarationApiFlowRecordMapper;
private TaxDeclarationApiFlowRecordMapper getTaxDeclarationApiFlowRecordMapper() {
return MapperProxyFactory.getProxy(TaxDeclarationApiFlowRecordMapper.class);
}
public TaxAgentService getTaxAgentService(User user) {
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
}
@ -41,7 +43,9 @@ public class TaxDeclarationApiBillingServiceImpl extends Service implements Tax
// private SalaryBatchService salaryBatchService;
private TaxDeclarationApiFlowWarnService taxDeclarationApiFlowWarnService;
// public TaxDeclarationApiFlowWarnService getTaxDeclarationApiFlowWarnService(User user) {
// return ServiceUtil.getService(TaxDeclarationApiFlowWarnServiceImpl.class, user);
// }
// private ComInfoCache comInfoCache;
// private ExtEmployeeService extEmployeeService;
@ -51,13 +55,13 @@ public class TaxDeclarationApiBillingServiceImpl extends Service implements Tax
// 保存流量使用详情
saveApiFlowRecord(updateWrapper);
// 流量不足提醒
taxDeclarationApiFlowWarnService.sendFlowWarnMessage(updateWrapper);
// taxDeclarationApiFlowWarnService.sendFlowWarnMessage(updateWrapper);
}
private void saveApiFlowRecord(ApiFlowUpdateWrapper updateWrapper) {
if (!updateWrapper.getApiFlowDetailPOList().isEmpty()) {
List<List<TaxDeclarationApiFlowRecordPO>> failPartition = Lists.partition(updateWrapper.getApiFlowDetailPOList(), 1000);
failPartition.forEach(list -> taxDeclarationApiFlowRecordMapper.batchInsert(list));
failPartition.forEach(list -> getTaxDeclarationApiFlowRecordMapper().batchInsert(list));
}
}
@ -106,7 +110,7 @@ public class TaxDeclarationApiBillingServiceImpl extends Service implements Tax
// }
//
// private LambdaQueryChainWrapper<TaxDeclarationApiFlowRecordPO> getFlowRecordQueryChainWrapper(TaxDeclarationApiFlowRecordQueryParam queryParam, String currentTenantKey) {
// LambdaQueryChainWrapper<TaxDeclarationApiFlowRecordPO> chainWrapper = new LambdaQueryChainWrapper<>(taxDeclarationApiFlowRecordMapper)
// LambdaQueryChainWrapper<TaxDeclarationApiFlowRecordPO> chainWrapper = new LambdaQueryChainWrapper<>(getTaxDeclarationApiFlowRecordMapper())
// .eq(TaxDeclarationApiFlowRecordPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue())
// .eq(TaxDeclarationApiFlowRecordPO::getTenantKey)
// .eq(queryParam.getTaxAgentId() != null, TaxDeclarationApiFlowRecordPO::getTaxAgentId, queryParam.getTaxAgentId())

View File

@ -45,21 +45,27 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar
private TaxDeclarationValueMapper getTaxDeclarationValueMapper() {
return MapperProxyFactory.getProxy(TaxDeclarationValueMapper.class);
}
private SalaryEmployeeService getSalaryEmployeeService(User user) {
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
}
private ExtEmpService getExtEmpService(User user) {
return ServiceUtil.getService(ExtEmpServiceImpl.class, user);
}
private EmployeeDeclareService getEmployeeDeclareService(User user) {
return ServiceUtil.getService(EmployeeDeclareServiceImpl.class, user);
}
private TaxReportColumnService getTaxReportColumnService(User user) {
return ServiceUtil.getService(TaxReportColumnServiceImpl.class, user);
}
@Override
public PageInfo<TaxDeclarationValuePO> listPageByTaxDeclarationIds(TaxDeclarationValueListQueryParam queryParam, Collection<Long> taxDeclarationIds) {
List<TaxDeclarationValuePO> taxDeclarationValuePOS = getTaxDeclarationValueMapper().listSome(TaxDeclarationValuePO.builder().taxDeclarationIds(taxDeclarationIds).build());
taxDeclarationValuePOS = decryptBatch(taxDeclarationValuePOS);
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), taxDeclarationValuePOS, TaxDeclarationValuePO.class);
}
@ -118,7 +124,8 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar
// 分批保存
List<List<TaxDeclarationValuePO>> partition = Lists.partition(taxDeclarationValues, 100);
for (List<TaxDeclarationValuePO> subTaxDeclarationValues : partition) {
getTaxDeclarationValueMapper().batchInsert(subTaxDeclarationValues);
subTaxDeclarationValues.forEach(getTaxDeclarationValueMapper()::insertIgnoreNull);
// getTaxDeclarationValueMapper().batchInsert(subTaxDeclarationValues);
}
}
}

View File

@ -1,5 +1,6 @@
package com.engine.salary.service.impl;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO;
@ -10,16 +11,17 @@ import com.engine.salary.entity.taxdeclaration.param.AbnormalEmployeeListQueryPa
import com.engine.salary.entity.taxdeclaration.po.TaxDeclareEmployeePO;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclareRecordPO;
import com.engine.salary.enums.salaryaccounting.EmployeeTypeEnum;
import com.engine.salary.mapper.taxdeclaration.TaxDeclarationDetailMapper;
import com.engine.salary.mapper.taxdeclaration.TaxDeclarationValueMapper;
import com.engine.salary.service.EmployeeDeclareService;
import com.engine.salary.service.ExtEmpService;
import com.engine.salary.service.SalaryEmployeeService;
import com.engine.salary.service.TaxDeclareEmployeeService;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;
import org.apache.commons.collections4.CollectionUtils;
import weaver.hrm.User;
import java.util.Collections;
import java.util.List;
@ -37,37 +39,42 @@ import java.util.stream.Collectors;
public class TaxDeclareEmployeeServiceImpl extends Service implements TaxDeclareEmployeeService {
// private TaxDeclarationValueMapper taxDeclarationValueMapper;
private TaxDeclarationDetailMapper taxDeclarationValueMapper;
private TaxDeclarationValueMapper getTaxDeclarationValueMapper() {
return MapperProxyFactory.getProxy(TaxDeclarationValueMapper.class);
}
private SalaryEmployeeService hrmCommonEmployeeService;
private SalaryEmployeeService getSalaryEmployeeService(User user) {
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
}
private SalaryEmployeeService salaryEmployeeService;
private ExtEmpService getExtEmpService(User user) {
return ServiceUtil.getService(ExtEmpServiceImpl.class, user);
}
private ExtEmpService extEmployeeService;
private EmployeeDeclareService employeeDeclareService;
private EmployeeDeclareService getEmployeeDeclareService(User user) {
return ServiceUtil.getService(EmployeeDeclareServiceImpl.class, user);
}
@Override
public PageInfo<TaxDeclareEmployeePO> listPage4NotDeclareByParam(AbnormalEmployeeListQueryParam queryParam) {
List<TaxDeclareEmployeePO> list = taxDeclarationValueMapper.listPage4NotDeclareByParam(queryParam);
List<TaxDeclareEmployeePO> list = getTaxDeclarationValueMapper().listPage4NotDeclareByParam(queryParam);
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list, TaxDeclareEmployeePO.class);
}
@Override
public List<TaxDeclareEmployeePO> list4NotDeclareByParam(AbnormalEmployeeListQueryParam queryParam) {
return taxDeclarationValueMapper.list4NotDeclareByParam(queryParam);
return getTaxDeclarationValueMapper().list4NotDeclareByParam(queryParam);
}
@Override
public PageInfo<TaxDeclareEmployeePO> listPage4NoValueByParam(AbnormalEmployeeListQueryParam queryParam) {
List<TaxDeclareEmployeePO> list = taxDeclarationValueMapper.listPage4NoValueByParam(queryParam);
List<TaxDeclareEmployeePO> list = getTaxDeclarationValueMapper().listPage4NoValueByParam(queryParam);
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list, TaxDeclareEmployeePO.class);
}
@Override
public List<TaxDeclareEmployeePO> list4NoValueByParam(AbnormalEmployeeListQueryParam queryParam) {
return taxDeclarationValueMapper.list4NoValueByParam(queryParam);
return getTaxDeclarationValueMapper().list4NoValueByParam(queryParam);
}
@Override
@ -78,7 +85,7 @@ public class TaxDeclareEmployeeServiceImpl extends Service implements TaxDeclare
// 人员id
Set<Long> employeeIds = SalaryEntityUtil.properties(taxDeclareEmployees, TaxDeclareEmployeePO::getEmployeeId);
// 查询报送的人员
List<EmployeeDeclarePO> employeeDeclares = employeeDeclareService.listByTaxCycleAndTaxAgentIdAndEmployeeIds(
List<EmployeeDeclarePO> employeeDeclares = getEmployeeDeclareService(user).listByTaxCycleAndTaxAgentIdAndEmployeeIds(
taxDeclareRecord.getTaxCycle(), taxDeclareRecord.getTaxAgentId(), employeeIds);
// 查询人员信息
List<Long> simpleEmployeeIds = taxDeclareEmployees.stream()
@ -86,15 +93,15 @@ public class TaxDeclareEmployeeServiceImpl extends Service implements TaxDeclare
.map(TaxDeclareEmployeePO::getEmployeeId)
.distinct()
.collect(Collectors.toList());
List<DataCollectionEmployee> simpleEmployees = hrmCommonEmployeeService.getEmployeeByIds(simpleEmployeeIds);
List<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).getEmployeeByIds(simpleEmployeeIds);
// 查询人员薪资身份证号码等
List<DataCollectionEmployee> simpleUserInfos = salaryEmployeeService.listByIds(simpleEmployeeIds);
List<DataCollectionEmployee> simpleUserInfos = getSalaryEmployeeService(user).listByIds(simpleEmployeeIds);
// 查询外部人员
List<Long> extEmployeeIds = taxDeclareEmployees.stream()
.filter(taxDeclarationValue -> Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.EXT_EMPLOYEE.getValue()))
.map(TaxDeclareEmployeePO::getEmployeeId)
.collect(Collectors.toList());
List<ExtEmpPO> extEmployees = extEmployeeService.getExtEmpByIds(extEmployeeIds);
List<ExtEmpPO> extEmployees = getExtEmpService(user).getExtEmpByIds(extEmployeeIds);
return TaxDeclareEmployeeBO.convert2AbnormalEmployee(taxDeclareEmployees, employeeDeclares, simpleEmployees, simpleUserInfos, extEmployees);
}

View File

@ -1,5 +1,6 @@
package com.engine.salary.service.impl;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.entity.taxdeclaration.dto.FailEmployeeListDTO;
@ -10,9 +11,11 @@ import com.engine.salary.mapper.taxdeclaration.TaxDeclareFailMapper;
import com.engine.salary.service.TaxAgentService;
import com.engine.salary.service.TaxDeclareFailService;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.apache.commons.collections4.CollectionUtils;
import weaver.hrm.User;
import java.util.Collection;
import java.util.Collections;
@ -28,22 +31,27 @@ import java.util.Map;
*/
public class TaxDeclareFailServiceImpl extends Service implements TaxDeclareFailService {
private TaxDeclareFailMapper taxDeclareFailMapper;
private TaxAgentService taxAgentService;
private TaxDeclareFailMapper getTaxDeclareFailMapper() {
return MapperProxyFactory.getProxy(TaxDeclareFailMapper.class);
}
private TaxAgentService getTaxAgentService(User user) {
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
}
@Override
public List<TaxDeclareFailPO> listPageByTaxDeclareRecordIds(Collection<Long> taxDeclareRecordIds) {
return taxDeclareFailMapper.listSome(TaxDeclareFailPO.builder().taxDeclareRecordIds(taxDeclareRecordIds).build());
return getTaxDeclareFailMapper().listSome(TaxDeclareFailPO.builder().taxDeclareRecordIds(taxDeclareRecordIds).build());
}
@Override
public List<TaxDeclareFailPO> listByTaxDeclareRecordIds(Collection<Long> taxDeclareRecordIds) {
return taxDeclareFailMapper.listSome(TaxDeclareFailPO.builder().taxDeclareRecordIds(taxDeclareRecordIds).build());
return getTaxDeclareFailMapper().listSome(TaxDeclareFailPO.builder().taxDeclareRecordIds(taxDeclareRecordIds).build());
}
@Override
public void deleteByTaxDeclareRecordIds(Collection<Long> taxDeclareRecordIds) {
taxDeclareFailMapper.deleteBytaxDeclareRecordIds(taxDeclareRecordIds);
getTaxDeclareFailMapper().deleteBytaxDeclareRecordIds(taxDeclareRecordIds);
}
@Override
@ -52,7 +60,7 @@ public class TaxDeclareFailServiceImpl extends Service implements TaxDeclareFail
return Collections.emptyList();
}
// 查询个税扣缴义务人
TaxAgentPO taxAgent = taxAgentService.getById(taxDeclareRecord.getTaxAgentId());
TaxAgentPO taxAgent = getTaxAgentService(user).getById(taxDeclareRecord.getTaxAgentId());
Map<String, IncomeCategoryEnum> incomeCategoryEnumMap = Maps.newHashMap();
for (IncomeCategoryEnum incomeCategoryEnum : IncomeCategoryEnum.values()) {
incomeCategoryEnumMap.put(incomeCategoryEnum.getCode(), incomeCategoryEnum);
@ -76,7 +84,7 @@ public class TaxDeclareFailServiceImpl extends Service implements TaxDeclareFail
@Override
public void saveBatch(List<TaxDeclareFailPO> taxDeclareFails) {
if (CollectionUtils.isNotEmpty(taxDeclareFails)) {
taxDeclareFailMapper.batchInsert(taxDeclareFails);
getTaxDeclareFailMapper().batchInsert(taxDeclareFails);
}
}
}

View File

@ -244,9 +244,9 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe
// 查询薪资核算记录关联的个税扣缴义务人
List<SalaryAcctTaxAgentPO> salaryAcctTaxAgents = getSalaryAcctRecordService(user).listBySalaryAcctRecordIds(SalaryEntityUtil.properties(salaryAcctRecords, SalaryAcctRecordPO::getId));
// 按照saveParam中的个税扣缴义务人范围过滤
Set<Long> taxAgentIds = SalaryEntityUtil.properties(taxAgents, TaxAgentPO::getId);
List<Long> taxAgentIds = SalaryEntityUtil.properties(taxAgents, TaxAgentPO::getId, Collectors.toList());
salaryAcctTaxAgents = salaryAcctTaxAgents.stream().filter(e -> taxAgentIds.contains(e.getTaxAgentId())).collect(Collectors.toList());
Set<Long> salaryAcctRecordIds = SalaryEntityUtil.properties(salaryAcctTaxAgents, SalaryAcctTaxAgentPO::getSalaryAcctRecordId);
List<Long> salaryAcctRecordIds = SalaryEntityUtil.properties(salaryAcctTaxAgents, SalaryAcctTaxAgentPO::getSalaryAcctRecordId, Collectors.toList());
salaryAcctRecords = salaryAcctRecords.stream().filter(e -> salaryAcctRecordIds.contains(e.getId())).collect(Collectors.toList());
// 校验是否可以生成个税申报表
// 返回目前已经生成的个税申报表
@ -300,6 +300,9 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe
getAddUpSituationService(user).batchSave(entry.getValue());
}
}
//更新核算记录状态
getSalaryAcctRecordService(user).updateStatusByIds(salaryAcctRecordIds, SalaryAcctRecordStatusEnum.DECLARED);
// // 记录日志
// for (TaxDeclareRecordPO taxDeclareRecord : newTaxDeclareRecords) {
// LoggerContext<TaxDeclarationPO> loggerContext = new LoggerContext<>();

View File

@ -17,7 +17,7 @@ public class SalaryI18nUtil {
* @param defaultLabel 默认中文
* @return
*/
public static String getI18nLabel(int labelId, String defaultLabel) {
public static String getI18nLabel(Integer labelId, String defaultLabel) {
return defaultLabel;
}
//

View File

@ -1,11 +1,13 @@
package com.engine.salary.util.page;
import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.github.pagehelper.PageHelper;
import org.apache.commons.collections4.CollectionUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
public class SalaryPageUtil {
@ -90,4 +92,12 @@ public class SalaryPageUtil {
return source.subList(startIndex > source.size() ? source.size() : startIndex,
endIndex > source.size() ? source.size() : endIndex);
}
public static List<Column> convertList(List<WeaTableColumn> columns){
if(CollectionUtils.isNotEmpty(columns)){
return columns.stream().map(c->Column.builder().title(c.getText()).key(c.getColumn()).dataIndex(c.getColumn()).build()).collect(Collectors.toList());
}
return new ArrayList<>();
}
}

View File

@ -523,7 +523,7 @@ public class SalaryAcctController {
@GET
@Path("/acctresult/importField")
@Produces(MediaType.APPLICATION_JSON)
public String accounting(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "salaryAcctRecordId") Long salaryAcctRecordId) {
public String importField(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "salaryAcctRecordId") Long salaryAcctRecordId) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long, SalaryAcctImportFieldDTO>(user).run(getSalaryAcctExcelService(user)::getImportField, salaryAcctRecordId);
}

View File

@ -1,10 +1,7 @@
package com.engine.salary.web;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.taxdeclaration.dto.AbnormalEmployeeListDTO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationInfoDTO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationRateDTO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationTabDTO;
import com.engine.salary.entity.taxdeclaration.dto.*;
import com.engine.salary.entity.taxdeclaration.param.*;
import com.engine.salary.service.TaxDeclarationExcelService;
import com.engine.salary.service.TaxDeclarationService;
@ -213,7 +210,7 @@ public class TaxDeclarationController {
}
/**
* 个税申报表生成
* 删除个税申报表
*
* @param ids 个税申报记录id
* @return
@ -434,7 +431,7 @@ public class TaxDeclarationController {
@Produces(MediaType.APPLICATION_JSON)
public String listEmployee4Fail(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AbnormalEmployeeListQueryParam queryParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<AbnormalEmployeeListQueryParam, PageInfo<AbnormalEmployeeListDTO>>(user).run(getTaxDeclareRecordWrapper(user)::listEmployeePage4Fail, queryParam);
return new ResponseResult<AbnormalEmployeeListQueryParam, PageInfo<FailEmployeeListDTO>>(user).run(getTaxDeclareRecordWrapper(user)::listEmployeePage4Fail, queryParam);
}
// /**

View File

@ -54,30 +54,39 @@ public class TaxDeclareRecordWrapper extends Service {
private TaxDeclareRecordService getTaxDeclareRecordService(User user) {
return ServiceUtil.getService(TaxDeclareRecordServiceImpl.class, user);
}
private TaxAgentService getTaxAgentService(User user) {
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
}
private SalaryEmployeeService getSalaryEmployeeService(User user) {
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
}
private SalaryCacheService getSalaryCacheService(User user) {
return ServiceUtil.getService(SalaryCacheServiceImpl.class, user);
}
private TaxDeclarationService getTaxDeclarationService(User user) {
return ServiceUtil.getService(TaxDeclarationServiceImpl.class, user);
}
private TaxDeclarationValueService getTaxDeclarationValueService(User user) {
return ServiceUtil.getService(TaxDeclarationValueServiceImpl.class, user);
}
private TaxDeclarationExcelService getTaxDeclarationExcelService(User user) {
return ServiceUtil.getService(TaxDeclarationExcelServiceImpl.class, user);
}
private TaxDeclareEmployeeService getTaxDeclareEmployeeService(User user) {
return ServiceUtil.getService(TaxDeclareEmployeeServiceImpl.class, user);
}
private TaxDeclareFailService getTaxDeclareFailService(User user) {
return ServiceUtil.getService(TaxDeclareFailServiceImpl.class, user);
}
/**
* 个税申报记录列表
*
@ -142,10 +151,11 @@ public class TaxDeclareRecordWrapper extends Service {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(156515, "对不起,您暂时没有权限查看"));
}
// 查询个税申报表详情
PageInfo<TaxDeclarationValuePO> page = getTaxDeclarationValueService(user).listPageByTaxDeclarationIds(queryParam,Collections.singleton(queryParam.getTaxDeclarationId()));
PageInfo<TaxDeclarationValuePO> page = getTaxDeclarationValueService(user).listPageByTaxDeclarationIds(queryParam, Collections.singleton(queryParam.getTaxDeclarationId()));
TaxDeclarationValueListDTO taxDeclarationValueListDTO = getTaxDeclarationValueService(user).convert2List(taxDeclaration, page.getList());
PageInfo<Map<String, Object>> dtoPage = new PageInfo();
dtoPage.setList(taxDeclarationValueListDTO.getData());
PageInfo<Map<String, Object>> dtoPage = SalaryPageUtil.buildPage(page.getPageNum(), page.getPageSize(), taxDeclarationValueListDTO.getData());
dtoPage.setColumns(SalaryPageUtil.convertList(taxDeclarationValueListDTO.getColumns()));
dtoPage.setTotal(page.getTotal());
return dtoPage;
}
@ -181,8 +191,8 @@ public class TaxDeclareRecordWrapper extends Service {
// 查询申报失败的数据
List<TaxDeclareFailPO> taxDeclareFailPOPageInfo = getTaxDeclareFailService(user).listPageByTaxDeclareRecordIds(Collections.singleton(taxDeclareRecord.getId()));
// 转换成dto
PageInfo<FailEmployeeListDTO> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), FailEmployeeListDTO.class);
dtoPage.setList(getTaxDeclareFailService(user).convert2FailEmployeeList(taxDeclareRecord, taxDeclareFailPOPageInfo));
List<FailEmployeeListDTO> failEmployeeListDTOS = getTaxDeclareFailService(user).convert2FailEmployeeList(taxDeclareRecord, taxDeclareFailPOPageInfo);
PageInfo<FailEmployeeListDTO> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), failEmployeeListDTOS,FailEmployeeListDTO.class);
// 转成前端所需的格式
return dtoPage;
}
@ -202,6 +212,7 @@ public class TaxDeclareRecordWrapper extends Service {
}
PageInfo<AbnormalEmployeeListDTO> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), AbnormalEmployeeListDTO.class);
dtoPage.setList(getTaxDeclareEmployeeService(user).convert2AbnormalEmployeeList(taxDeclareRecord, page.getList()));
dtoPage.setTotal(page.getTotal());
return dtoPage;
} else {
// 查询条件中包含"keyword"不好通过SQL分页所以在内存中分页
@ -266,9 +277,9 @@ public class TaxDeclareRecordWrapper extends Service {
// 查询个税申报记录下的个税申报表
List<TaxDeclarationPO> taxDeclarations = getTaxDeclarationService(user).listByTaxCycleAndTaxAgentIds(SalaryDateUtil.localDate2YearMonth(taxDeclareRecord.getTaxCycle()),
Collections.singleton(taxDeclareRecord.getTaxAgentId()));
taxDeclarations = taxDeclarations.stream()
.filter(e -> Objects.equals(e.getControlView(), 0) || Objects.equals(e.getCreator(), (long)user.getUID()))
.collect(Collectors.toList());
// taxDeclarations = taxDeclarations.stream()
// .filter(e -> Objects.equals(e.getControlView(), 0) || Objects.equals(e.getCreator(), (long)user.getUID()))
// .collect(Collectors.toList());
Map<Integer, TaxDeclarationPO> taxDeclarationMap = SalaryEntityUtil.convert2Map(taxDeclarations, TaxDeclarationPO::getIncomeCategory);
List<TaxDeclarationTabDTO> tabs = Lists.newArrayList();
for (IncomeCategoryEnum incomeCategoryEnum : IncomeCategoryEnum.values()) {
@ -287,7 +298,7 @@ public class TaxDeclareRecordWrapper extends Service {
/**
* 查询个税申报表的基本信息
*
* @param id 个税申报表id
* @param id 个税申报表id
* @return
*/
public TaxDeclarationInfoDTO getTaxDeclarationInfoById(Long id) {