1、福利列表显示扣税扣缴义务人

2、导入限制
3、修改福利查询异常
4、核算人员范围限制
This commit is contained in:
钱涛 2022-07-07 18:29:52 +08:00
parent 16c43f8679
commit eab3e9a6a9
19 changed files with 255 additions and 186 deletions

View File

@ -37,7 +37,9 @@ import com.engine.salary.mapper.siaccount.InsuranceAccountInspectMapper;
import com.engine.salary.mapper.siaccount.SIAccountDetailTempMapper;
import com.engine.salary.mapper.sicategory.ICategoryMapper;
import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper;
import com.engine.salary.service.SalaryEmployeeService;
import com.engine.salary.service.TaxAgentService;
import com.engine.salary.service.impl.SalaryEmployeeServiceImpl;
import com.engine.salary.service.impl.TaxAgentServiceImpl;
import com.engine.salary.util.SalaryAssert;
import com.engine.salary.util.SalaryDateUtil;
@ -78,6 +80,10 @@ public class SIAccountBiz extends Service {
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
}
private SalaryEmployeeService getSalaryEmployeeService() {
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
}
private InsuranceAccountBatchMapper getInsuranceAccountBatchMapper() {
return SqlProxyHandle.getProxy(InsuranceAccountBatchMapper.class);
}
@ -155,7 +161,8 @@ public class SIAccountBiz extends Service {
public void account(AccountParam param, Long employeeId, String tenantKey, String currentUserName) {
Long paymentOrganization = param.getPaymentOrganization();
List<Long> employeeIds = getInsuranceAccountDetailMapper().selectAccountIds(SalaryDateUtil.getMonthBegin(param.getBillMonth()), paymentOrganization);
// List<Long> employeeIds = getInsuranceAccountDetailMapper().selectAccountIds(SalaryDateUtil.getMonthBegin(param.getBillMonth()), paymentOrganization);
List<Long> employeeIds = getInsuranceAccountDetailMapper().selectEmpByPaymentOrg(paymentOrganization);
if (CollectionUtils.isEmpty(employeeIds)) {
List<InsuranceAccountBatchPO> list = Lists.newArrayList(getInsuranceAccountBatchMapper().getByBillMonth(param.getBillMonth(), paymentOrganization));
@ -195,10 +202,33 @@ public class SIAccountBiz extends Service {
public void doAccounting(AccountParam param, Long employeeId, String tenantKey, String currentUserName) {
try {
List<Long> ids;
List<Long> validIds = new ArrayList<>();
if (CollectionUtils.isEmpty(param.getIds())) {
// 需要分权的情况
// if(getTaxAgentService().isOpenDevolution()) {
ids = getInsuranceAccountDetailMapper().selectAccountIds(SalaryDateUtil.getMonthBegin(param.getBillMonth()), param.getPaymentOrganization());
List<Long> empIds = getInsuranceAccountDetailMapper().selectEmpByPaymentOrg(param.getPaymentOrganization());
List<InsuranceArchivesSocialSchemePO> socials = siArchivesBiz.getSocialByEmployeeIds(empIds);
List<Long> emp1 = socials.stream().filter(s -> StringUtils.isBlank(s.getSocialEndTime()) || (SalaryDateUtil.stringToDate(s.getSocialEndTime()) != null && SalaryDateUtil.stringToDate(param.getBillMonth() + "-01").compareTo(SalaryDateUtil.stringToDate(s.getSocialEndTime())) <= 0))
.map(InsuranceArchivesSocialSchemePO::getEmployeeId)
.collect(Collectors.toList());
List<InsuranceArchivesFundSchemePO> funds = siArchivesBiz.getFundByEmployeeIds(empIds);
List<Long> emp2 = funds.stream().filter(s -> StringUtils.isBlank(s.getFundEndTime()) || (SalaryDateUtil.stringToDate(s.getFundEndTime()) != null && SalaryDateUtil.stringToDate(param.getBillMonth() + "-01").compareTo(SalaryDateUtil.stringToDate(s.getFundEndTime())) <= 0))
.map(InsuranceArchivesFundSchemePO::getEmployeeId)
.collect(Collectors.toList());
List<InsuranceArchivesOtherSchemePO> others = siArchivesBiz.getOtherByEmployeeIds(empIds);
List<Long> emp3 = others.stream().filter(s -> StringUtils.isBlank(s.getOtherEndTime()) || (SalaryDateUtil.stringToDate(s.getOtherEndTime()) != null && SalaryDateUtil.stringToDate(param.getBillMonth() + "-01").compareTo(SalaryDateUtil.stringToDate(s.getOtherEndTime())) <= 0))
.map(InsuranceArchivesOtherSchemePO::getEmployeeId)
.collect(Collectors.toList());
validIds.addAll(emp1);
validIds.addAll(emp2);
validIds.addAll(emp3);
List<Long> finalValidIds = validIds.stream().distinct().collect(Collectors.toList());
ids = empIds.stream().filter(finalValidIds::contains).collect(Collectors.toList());
// } else {
// ids = getInsuranceAccountDetailMapper().selectAccountIds(SalaryDateUtil.getMonthBegin(param.getBillMonth()), null);
// }
@ -247,7 +277,7 @@ public class SIAccountBiz extends Service {
public void commonAccount(/*CountDownLatch countDownLatch, BlockingDeque<Boolean> results,*/ String billMonth, List<Long> ids, Long employeeId, String tenantKey, Long paymentOrganization) {
/* try {*/
SIArchivesBiz siArchivesBiz = new SIArchivesBiz();
Map<Long, InsuranceArchivesAccountPO> insuranceArchivesAccountPOS = siArchivesBiz.buildBatchAccount(ids, tenantKey);
Map<Long, InsuranceArchivesAccountPO> insuranceArchivesAccountPOS = siArchivesBiz.buildBatchAccount(ids);
List<InsuranceAccountDetailTempPO> list = new ArrayList<>();
int count = 0;
for (Map.Entry<Long, InsuranceArchivesAccountPO> entry : insuranceArchivesAccountPOS.entrySet()) {
@ -854,7 +884,7 @@ public class SIAccountBiz extends Service {
*/
public String accountSupplement(List<SupplementAccountBaseParam> baseList, List<Long> employeeIds, String billMonth, Long employeeId) {
//(k,v) k-员工id v-员工对应的福利档案数据
Map<Long, InsuranceArchivesAccountPO> longInsuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
Map<Long, InsuranceArchivesAccountPO> longInsuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds);
//核算结果集
List<InsuranceAccountDetailPO> pos = new ArrayList<>();
baseList.forEach(baseParam -> {

View File

@ -39,9 +39,11 @@ import com.engine.salary.mapper.siarchives.SocialSchemeMapper;
import com.engine.salary.mapper.sicategory.ICategoryMapper;
import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper;
import com.engine.salary.mapper.sischeme.InsuranceSchemeMapper;
import com.engine.salary.mapper.taxagent.TaxAgentMapper;
import com.engine.salary.util.SalaryAssert;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryFormItemUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;
import com.google.common.collect.Lists;
@ -70,9 +72,13 @@ import java.util.stream.Collectors;
@Slf4j
public class SIArchivesBiz {
Boolean needAuth ;
Boolean needAuth;
Collection<TaxAgentPO> taxAgentPOS;
private TaxAgentMapper getTaxAgentMapper() {
return MapperProxyFactory.getProxy(TaxAgentMapper.class);
}
/**
* @param welfareType
* @param employeeId
@ -318,7 +324,7 @@ public class SIArchivesBiz {
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = insuranceSchemeDetailMapper.queryListByPrimaryIdIsPayment(schemeId, IsPaymentEnum.YES.getValue(), welfareType);
InsuranceSchemeDetailPOEncrypt.decryptList(insuranceSchemeDetailPOS);
return insuranceSchemeDetailPOS;
}finally {
} finally {
sqlSession.close();
}
}
@ -356,7 +362,7 @@ public class SIArchivesBiz {
InsuranceArchivesOtherSchemeDTO data = InsuranceArchivesBO.convertOtherPOtoDTO(insuranceArchivesOtherSchemePO, employeeId);
if (insuranceArchivesOtherSchemePO == null) {
data.setEmployeeId(employeeId);
data.setUnderTake(UndertakerEnum.SCOPE_PERSON);
data.setUnderTake(UndertakerEnum.SCOPE_PERSON.getValue().toString());
}
return data;
} finally {
@ -383,7 +389,7 @@ public class SIArchivesBiz {
InsuranceArchivesFundSchemeDTO data = InsuranceArchivesBO.convertFundPOtoDTO(insuranceArchivesFundSchemePO, employeeId);
if (insuranceArchivesFundSchemePO == null) {
data.setEmployeeId(employeeId);
data.setUnderTake(UndertakerEnum.SCOPE_PERSON);
data.setUnderTake(UndertakerEnum.SCOPE_PERSON.getValue().toString());
}
return data;
} finally {
@ -404,7 +410,7 @@ public class SIArchivesBiz {
InsuranceArchivesSocialSchemeDTO data = InsuranceArchivesBO.convertSocialPOtoDTO(insuranceArchivesSocialSchemePO, employeeId);
if (insuranceArchivesSocialSchemePO == null) {
data.setEmployeeId(employeeId);
data.setUnderTake(UndertakerEnum.SCOPE_PERSON);
data.setUnderTake(UndertakerEnum.SCOPE_PERSON.getValue().toString());
}
return data;
}
@ -422,7 +428,7 @@ public class SIArchivesBiz {
SocialSchemeMapper socialSchemeMapper = sqlSession.getMapper(SocialSchemeMapper.class);
List<InsuranceArchivesSocialSchemePO> socialList = socialSchemeMapper.getSocialByEmployeeId(Collections.singletonList(employeeId));
InsuranceArchivesSocialSchemePOEncrypt.decryptList(socialList);
return socialList.size() != 0 ? socialList.get(0) : null;
return socialList.size() != 0 ? socialList.get(0) : null;
} finally {
sqlSession.close();
}
@ -518,7 +524,7 @@ public class SIArchivesBiz {
InsuranceArchivesOtherSchemePO.builder()
.otherSchemeId(param.getOtherName())
.otherStartTime(param.getOtherStartTime())
.underTake(param.getUnderTake().getValue())
.underTake(param.getUnderTake())
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.welfareType(paramReq.getWelfareType().getValue())
.otherEndTime(param.getOtherEndTime())
@ -565,7 +571,7 @@ public class SIArchivesBiz {
.nonPayment(param.getNonPayment())
.deleteType(DeleteTypeEnum.NOT_DELETED.getValue())
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.underTake(param.getUnderTake().getValue())
.underTake(param.getUnderTake())
.paymentOrganization(param.getPaymentOrganization())
.updateTime(new Date())
.welfareType(paramReq.getWelfareType().getValue())
@ -610,7 +616,7 @@ public class SIArchivesBiz {
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.employeeId(param.getEmployeeId())
.updateTime(new Date())
.underTake(param.getUnderTake().getValue())
.underTake(param.getUnderTake())
.socialAccount(param.getSchemeAccount())
.paymentOrganization(param.getPaymentOrganization())
.build();
@ -699,14 +705,11 @@ public class SIArchivesBiz {
PageInfo<InsuranceArchivesEmployeePO> pageInfo = new PageInfo<>(InsuranceArchivesEmployeePO.class);
if (needAuth) {
Collection<Long> taxAgentEmployeeIds = param.getTaxAgentEmployeeIds();
log.info("taxAgentEmployeeIds: ", taxAgentEmployeeIds);
page = socialSchemeMapper.queryEmployeeList(param);
log.info("page size: ", page.size());
page = page.stream().filter(f ->
// 作为管理员
taxAgentEmployeeIds.contains(f.getEmployeeId())
).collect(Collectors.toList());
log.info("page collect size: ", page.size());
// 填充总数和当页数据
// 分页参数
pageInfo = SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), InsuranceArchivesEmployeePO.class);
@ -760,6 +763,7 @@ public class SIArchivesBiz {
WeaTableColumn nameColumn = new WeaTableColumn("100px", "姓名", "employeeName");
nameColumn.setFixed("left");
list.add(nameColumn);
list.add(new WeaTableColumn("150px", "个税扣缴义务人", "paymentOrganizationName"));
list.add(new WeaTableColumn("150px", "部门", "departmentName"));
list.add(new WeaTableColumn("150px", "手机号", "mobile"));
list.add(new WeaTableColumn("150px", "员工状态", "status"));
@ -886,6 +890,10 @@ public class SIArchivesBiz {
* @return
*/
public List<Map<String, Object>> buildTableData(List<InsuranceArchivesEmployeePO> insuranceArchivesEmployeePOS) {
List<TaxAgentPO> taxAgentPOS = getTaxAgentMapper().listAll();
Map<Long, TaxAgentPO> longTaxAgentPOMap = SalaryEntityUtil.convert2Map(taxAgentPOS, TaxAgentPO::getId);
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
List<Map<String, Object>> records = new ArrayList<>();
try {
@ -896,7 +904,7 @@ public class SIArchivesBiz {
List<Long> employeeIds = insuranceArchivesEmployeePOS.stream().map(InsuranceArchivesEmployeePO::getEmployeeId).collect(Collectors.toList());
Map<Long, InsuranceArchivesSocialSchemePO> socialSchemePOMap = InsuranceArchivesSocialSchemePOEncrypt.decryptList(this.getSocialByEmployeeIds(employeeIds))
.stream().collect(Collectors.toMap(InsuranceArchivesSocialSchemePO::getEmployeeId, Function.identity()));
.stream().collect(Collectors.toMap(InsuranceArchivesSocialSchemePO::getEmployeeId, Function.identity()));
Map<Long, InsuranceArchivesFundSchemePO> fundSchemePOMap = InsuranceArchivesFundSchemePOEncrypt.decryptList(this.getFundByEmployeeIds(employeeIds))
.stream().collect(Collectors.toMap(InsuranceArchivesFundSchemePO::getEmployeeId, Function.identity()));
@ -910,6 +918,7 @@ public class SIArchivesBiz {
InsuranceArchivesOtherSchemePO otherItem = otherSchemePOMap.get(item.getEmployeeId());
Map<String, Object> map = new HashMap<>();
map.put("employeeName", item.getUserName());
map.put("paymentOrganizationName", longTaxAgentPOMap.get(item.getPaymentOrganization()) != null ? longTaxAgentPOMap.get(item.getPaymentOrganization()).getName() : "");
map.put("employeeId", item.getEmployeeId());
map.put("departmentName", item.getDepartmentName());
map.put("departmentId", item.getDepartmentId());
@ -1117,11 +1126,10 @@ public class SIArchivesBiz {
/**
* 组装员工的社保公积金其他福利数据
*
* @param ids 员工id集合
* @param tenantKey 租户key
* @param ids 员工id集合
* @return map
*/
public Map<Long, InsuranceArchivesAccountPO> buildBatchAccount(List<Long> ids, String tenantKey) {
public Map<Long, InsuranceArchivesAccountPO> buildBatchAccount(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return new HashMap<>();
}
@ -1153,8 +1161,6 @@ public class SIArchivesBiz {
}
private List<InsuranceSchemeDetailPO> decryptSchemeDetailList(List<InsuranceSchemeDetailPO> encryptList) {
encryptList.forEach(item -> {
item.setUpperLimit(AESEncryptUtil.decrypt(item.getUpperLimit()));

View File

@ -6,7 +6,6 @@ import com.engine.salary.entity.siarchives.dto.InsuranceArchivesSocialSchemeDTO;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesFundSchemePO;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesOtherSchemePO;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesSocialSchemePO;
import com.engine.salary.enums.sicategory.UndertakerEnum;
import com.engine.salary.enums.sicategory.WelfareTypeEnum;
import com.engine.salary.util.SalaryEnumUtil;
@ -35,7 +34,7 @@ public class InsuranceArchivesBO {
.socialStartTime(po.getSocialStartTime())
.schemeAccount(po.getSocialAccount())
.schemePaymentBaseString(po.getSocialPaymentBaseString())
.underTake(SalaryEnumUtil.enumMatchByValue(po.getUnderTake(), UndertakerEnum.values(), UndertakerEnum.class))
.underTake(po.getUnderTake() + "")
.build();
}
@ -55,7 +54,7 @@ public class InsuranceArchivesBO {
.fundStartTime(po.getFundStartTime())
.supplementFundAccount(po.getSupplementFundAccount())
.nonPayment(po.getNonPayment())
.underTake(SalaryEnumUtil.enumMatchByValue(po.getUnderTake(), UndertakerEnum.values(), UndertakerEnum.class))
.underTake(po.getUnderTake() + "")
.welfareType(SalaryEnumUtil.enumMatchByValue(po.getWelfareType(), WelfareTypeEnum.values(), WelfareTypeEnum.class))
.build();
}
@ -67,7 +66,7 @@ public class InsuranceArchivesBO {
return InsuranceArchivesOtherSchemeDTO.builder()
.id(po.getId())
.employeeId(po.getEmployeeId())
.underTake(SalaryEnumUtil.enumMatchByValue(po.getUnderTake(), UndertakerEnum.values(), UndertakerEnum.class))
.underTake(po.getUnderTake() + "")
.nonPayment(po.getNonPayment())
.otherName(po.getOtherSchemeId() == null ? null : String.valueOf(po.getOtherSchemeId()))
.otherSchemeId(po.getOtherSchemeId())

View File

@ -1,6 +1,5 @@
package com.engine.salary.entity.siarchives.dto;
import com.engine.salary.enums.sicategory.UndertakerEnum;
import com.engine.salary.enums.sicategory.WelfareTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
@ -62,7 +61,7 @@ public class InsuranceArchivesFundSchemeDTO {
//private List<WeaSearchConditionOption> paymentOrganizationList;
// 公积金个人实际承担方
private UndertakerEnum underTake;
private String underTake;
//缴纳基数
private String fundPaymentBaseString;

View File

@ -1,6 +1,5 @@
package com.engine.salary.entity.siarchives.dto;
import com.engine.salary.enums.sicategory.UndertakerEnum;
import com.engine.salary.enums.sicategory.WelfareTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
@ -53,7 +52,7 @@ public class InsuranceArchivesOtherSchemeDTO {
//private List<WeaSearchConditionOption> paymentOrganizationList;
//其他福利个人实际承担方
private UndertakerEnum underTake;
private String underTake;
private String otherPaymentBaseString;

View File

@ -1,6 +1,5 @@
package com.engine.salary.entity.siarchives.dto;
import com.engine.salary.enums.sicategory.UndertakerEnum;
import com.engine.salary.enums.sicategory.WelfareTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
@ -54,8 +53,8 @@ public class InsuranceArchivesSocialSchemeDTO {
//private List<WeaSearchConditionOption> paymentOrganizationList;
//社保个人实际承担方
private UndertakerEnum underTake;
//社保个人实际承担方 UndertakerEnum
private String underTake;
//社保缴纳基数
private String schemePaymentBaseString;

View File

@ -1,6 +1,5 @@
package com.engine.salary.entity.siarchives.param;
import com.engine.salary.enums.sicategory.UndertakerEnum;
import com.engine.salary.enums.sicategory.WelfareTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
@ -52,7 +51,7 @@ public class InsuranceArchivesFundSaveParam {
private Long paymentOrganization;
//公积金个人实际承担方
private UndertakerEnum underTake;
private Integer underTake;
//公积金基数jsonString
private String paymentForm;

View File

@ -1,6 +1,5 @@
package com.engine.salary.entity.siarchives.param;
import com.engine.salary.enums.sicategory.UndertakerEnum;
import com.engine.salary.enums.sicategory.WelfareTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
@ -47,7 +46,7 @@ public class InsuranceArchivesOtherSaveParam {
private Long paymentOrganization;
//其他福利个人实际承担方
private UndertakerEnum underTake;
private Integer underTake;
//其他福利基数jsonString
private String paymentForm;

View File

@ -1,6 +1,5 @@
package com.engine.salary.entity.siarchives.param;
import com.engine.salary.enums.sicategory.UndertakerEnum;
import com.engine.salary.enums.sicategory.WelfareTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
@ -51,7 +50,7 @@ public class InsuranceArchivesSocialSaveParam {
private Long paymentOrganization;
//社保个人实际承担方
private UndertakerEnum underTake;
private Integer underTake;
//基数jsonString
private String paymentForm;

View File

@ -22,6 +22,11 @@ import java.util.Date;
public class InsuranceArchivesEmployeePO {
private Long employeeId;//员工id
/**
* 缴纳组织
*/
private Long paymentOrganization;
private String userName;
private BigDecimal departmentId;

View File

@ -31,6 +31,14 @@ public interface InsuranceAccountDetailMapper {
*/
List<Long> selectAccountIds(@Param("time") String time,@Param("paymentOrganization") Long paymentOrganization);
/**
* 根据缴纳组织获取员工id
* @param paymentOrganization
* @return
*/
List<Long> selectEmpByPaymentOrg(@Param("paymentOrganization") Long paymentOrganization);
/**
* 根据id删除
* @param id

View File

@ -50,7 +50,9 @@
<!-- 表字段 -->
<sql id="baseColumns">
t.id
t
.
id
, t.employee_id
, e.status as employee_status
, t.bill_month
@ -97,7 +99,7 @@
, t.payment_organization
</sql>
<sql id="paramSqlCommon" >
<sql id="paramSqlCommon">
<if test="param.billMonth != null and param.billMonth != ''">
AND
t.bill_month = #{param.billMonth}
@ -124,7 +126,7 @@
<if test="param.userName != null and param.userName != ''">
AND
(
e.lastname like '%'||#{param.userName}||'%'
e.lastname like '%'||#{param.userName}||'%'
)
</if>
</sql>
@ -138,7 +140,6 @@
</sql>
<select id="list" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
@ -190,16 +191,16 @@
<select id="selectAccountIds" resultType="java.lang.Long">
SELECT DISTINCT a.ID
FROM (
SELECT t.ID,
social.social_start_time,
social.social_end_time,
fund.fund_start_time,
fund.fund_end_time,
other.other_start_time,
other.other_end_time
FROM (
SELECT e.ID
FROM hrmresource e
SELECT t.ID,
social.social_start_time,
social.social_end_time,
fund.fund_start_time,
fund.fund_end_time,
other.other_start_time,
other.other_end_time
FROM (
SELECT e.ID
FROM hrmresource e
LEFT JOIN (SELECT
t.*
FROM
@ -209,134 +210,142 @@
log.dismissdate
FROM
bill_hrmdismiss log ) t) l
ON e.ID = l.resource_n
WHERE(
e.status != '5'
and (e.accounttype is null or e.accounttype = 0)
OR l.dismissdate IS NULL
OR l.dismissdate = ''
OR l.dismissdate
> #{time}
)
) t
LEFT JOIN hrsa_social_archives social ON t.ID = social.employee_id
LEFT JOIN hrsa_fund_archives fund ON t.ID = fund.employee_id
LEFT JOIN hrsa_other_archives other ON t.ID = other.employee_id
WHERE (
fund.delete_type = 0 and
fund.fund_start_time IS NOT NULL AND fund.fund_start_time != ''
ON e.ID = l.resource_n
WHERE(
e.status != '5'
and (e.accounttype is null or e.accounttype = 0)
OR l.dismissdate IS NULL
OR l.dismissdate = ''
OR l.dismissdate
> #{time}
)
) t
LEFT JOIN hrsa_social_archives social ON t.ID = social.employee_id
LEFT JOIN hrsa_fund_archives fund ON t.ID = fund.employee_id
LEFT JOIN hrsa_other_archives other ON t.ID = other.employee_id
WHERE (
fund.delete_type = 0 and
fund.fund_start_time IS NOT NULL AND fund.fund_start_time != ''
AND(
fund.fund_end_time IS NULL
OR fund.fund_end_time = ''
OR fund.fund_end_time > #{time}
)
)
OR (
)
)
OR (
social.delete_type = 0 and
social.social_start_time IS NOT NULL AND social.social_start_time != ''
<if test="paymentOrganization != null">
AND
-- 个税扣缴义务人
social.payment_organization = #{paymentOrganization}
</if>
social.social_start_time IS NOT NULL AND social.social_start_time != ''
<if test="paymentOrganization != null">
AND
-- 个税扣缴义务人
social.payment_organization = #{paymentOrganization}
</if>
AND(
social.social_end_time IS NULL
OR social.social_end_time = ''
OR social.social_end_time > #{time}
)
)
OR (
other.delete_type = 0 and
other.other_start_time IS NOT NULL AND other.other_start_time != ''
)
)
OR (
other.delete_type = 0 and
other.other_start_time IS NOT NULL AND other.other_start_time != ''
AND(
other.other_end_time IS NULL
OR other.other_end_time = ''
OR other.other_end_time > #{time}
)
)
) a
)
)
) a
</select>
<!-- <select id="selectAccountIds" resultType="java.lang.Long" databaseId="oracle">-->
<!-- SELECT DISTINCT a.ID-->
<!-- FROM (-->
<!-- SELECT t.ID,-->
<!-- social.social_start_time,-->
<!-- social.social_end_time,-->
<!-- fund.fund_start_time,-->
<!-- fund.fund_end_time,-->
<!-- other.other_start_time,-->
<!-- other.other_end_time-->
<!-- FROM (-->
<!-- SELECT e.ID-->
<!-- FROM hrmresource e-->
<!-- LEFT JOIN (SELECT-->
<!-- t.*-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- log.resource_n,-->
<!-- log.dismissdate-->
<!-- FROM-->
<!-- bill_hrmdismiss log ) t) l-->
<!-- ON e.ID = l.resource_n-->
<!-- WHERE(-->
<!-- e.status != '5'-->
<!-- and (e.accounttype is null or e.accounttype = 0)-->
<!-- OR l.dismissdate IS NULL-->
<!-- OR l.dismissdate = ''-->
<!-- OR l.dismissdate-->
<!-- > #{time}-->
<!-- )-->
<!-- ) t-->
<!-- LEFT JOIN hrsa_social_archives social ON t.ID = social.employee_id-->
<!-- LEFT JOIN hrsa_fund_archives fund ON t.ID = fund.employee_id-->
<!-- LEFT JOIN hrsa_other_archives other ON t.ID = other.employee_id-->
<!-- WHERE (-->
<!-- fund.fund_start_time IS NOT NULL-->
<!-- AND(-->
<!-- fund.fund_end_time IS NULL-->
<!-- OR fund.fund_end_time = ''-->
<!-- OR fund.fund_end_time > #{time}-->
<!-- )-->
<!-- )-->
<!-- OR (-->
<!-- social.social_start_time IS NOT NULL-->
<!-- AND(-->
<!-- social.social_end_time IS NULL-->
<!-- OR social.social_end_time = ''-->
<!-- OR social.social_end_time > #{time}-->
<!-- )-->
<!-- )-->
<!-- OR (-->
<!-- other.other_start_time IS NOT NULL-->
<!-- AND(-->
<!-- other.other_end_time IS NULL-->
<!-- OR other.other_end_time = ''-->
<!-- OR other.other_end_time > #{time}-->
<!-- )-->
<!-- )-->
<!-- ) a-->
<!-- </select>-->
<!-- <select id="selectAccountIds" resultType="java.lang.Long" databaseId="oracle">-->
<!-- SELECT DISTINCT a.ID-->
<!-- FROM (-->
<!-- SELECT t.ID,-->
<!-- social.social_start_time,-->
<!-- social.social_end_time,-->
<!-- fund.fund_start_time,-->
<!-- fund.fund_end_time,-->
<!-- other.other_start_time,-->
<!-- other.other_end_time-->
<!-- FROM (-->
<!-- SELECT e.ID-->
<!-- FROM hrmresource e-->
<!-- LEFT JOIN (SELECT-->
<!-- t.*-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- log.resource_n,-->
<!-- log.dismissdate-->
<!-- FROM-->
<!-- bill_hrmdismiss log ) t) l-->
<!-- ON e.ID = l.resource_n-->
<!-- WHERE(-->
<!-- e.status != '5'-->
<!-- and (e.accounttype is null or e.accounttype = 0)-->
<!-- OR l.dismissdate IS NULL-->
<!-- OR l.dismissdate = ''-->
<!-- OR l.dismissdate-->
<!-- > #{time}-->
<!-- )-->
<!-- ) t-->
<!-- LEFT JOIN hrsa_social_archives social ON t.ID = social.employee_id-->
<!-- LEFT JOIN hrsa_fund_archives fund ON t.ID = fund.employee_id-->
<!-- LEFT JOIN hrsa_other_archives other ON t.ID = other.employee_id-->
<!-- WHERE (-->
<!-- fund.fund_start_time IS NOT NULL-->
<!-- AND(-->
<!-- fund.fund_end_time IS NULL-->
<!-- OR fund.fund_end_time = ''-->
<!-- OR fund.fund_end_time > #{time}-->
<!-- )-->
<!-- )-->
<!-- OR (-->
<!-- social.social_start_time IS NOT NULL-->
<!-- AND(-->
<!-- social.social_end_time IS NULL-->
<!-- OR social.social_end_time = ''-->
<!-- OR social.social_end_time > #{time}-->
<!-- )-->
<!-- )-->
<!-- OR (-->
<!-- other.other_start_time IS NOT NULL-->
<!-- AND(-->
<!-- other.other_end_time IS NULL-->
<!-- OR other.other_end_time = ''-->
<!-- OR other.other_end_time > #{time}-->
<!-- )-->
<!-- )-->
<!-- ) a-->
<!-- </select>-->
<select id="selectEmpByPaymentOrg" resultType="java.lang.Long">
SELECT employee_id
from hrsa_social_archives social
where delete_type = 0
and social.payment_organization = #{paymentOrganization}
</select>
<!-- 根据主键删除记录 -->
<delete id="deleteById" parameterType="com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO">
UPDATE hrsa_bill_detail
SET delete_type = 1
WHERE id = #{id}
AND delete_type = 0
AND delete_type = 0
</delete>
<delete id="batchDeleteNotFile" parameterType="com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO">
DELETE
DELETE
FROM hrsa_bill_detail
WHERE delete_type = 0
AND bill_month = #{billMonth}
AND bill_status = 0
<if test="paymentOrganization != null">
AND payment_organization = #{paymentOrganization}
</if>
WHERE delete_type = 0
AND bill_month = #{billMonth}
AND bill_status = 0
<if test="paymentOrganization != null">
AND payment_organization = #{paymentOrganization}
</if>
</delete>
@ -385,10 +394,10 @@
AND bill_month = #{billMonth}
AND payment_organization = #{paymentOrganization}
<if test="employeeIds != null and employeeIds.size()>0">
AND employee_id IN
<foreach collection="employeeIds" open="(" item="employeeId" separator="," close=")">
#{employeeId}
</foreach>
AND employee_id IN
<foreach collection="employeeIds" open="(" item="employeeId" separator="," close=")">
#{employeeId}
</foreach>
</if>
</delete>
@ -405,7 +414,7 @@
<insert id="batchSaveAccountDetails">
INSERT INTO hrsa_bill_detail
INSERT INTO hrsa_bill_detail
(employee_id,bill_month,bill_status,payment_status,supplementary_month,resource_from,social_pay_org,social_account,social_scheme_id,social_payment_base_string,
fund_pay_org,fund_account,supplement_fund_account,fund_scheme_id,fund_payment_base_string,other_pay_org,other_scheme_id,other_payment_base_string,social_per_json,
social_per_sum,fund_per_json,fund_per_sum,other_per_json,other_per_sum,per_sum,social_com_json,social_com_sum,fund_com_json,fund_com_sum,other_com_json,other_com_sum,
@ -459,7 +468,7 @@
</foreach>
</insert>
<insert id="batchSaveAccountDetails" databaseId="oracle">
INSERT INTO hrsa_bill_detail
INSERT INTO hrsa_bill_detail
(employee_id,bill_month,bill_status,payment_status,supplementary_month,resource_from,social_pay_org,social_account,social_scheme_id,social_payment_base_string,
fund_pay_org,fund_account,supplement_fund_account,fund_scheme_id,fund_payment_base_string,other_pay_org,other_scheme_id,other_payment_base_string,social_per_json,
social_per_sum,fund_per_json,fund_per_sum,other_per_json,other_per_sum,per_sum,social_com_json,social_com_sum,fund_com_json,fund_com_sum,other_com_json,other_com_sum,
@ -513,12 +522,12 @@
</insert>
<insert id="batchSaveAccountDetails" databaseId="sqlserver">
<foreach collection="accounts" item="item" separator=";">
INSERT INTO hrsa_bill_detail
(employee_id,bill_month,bill_status,payment_status,supplementary_month,resource_from,social_pay_org,social_account,social_scheme_id,social_payment_base_string,
fund_pay_org,fund_account,supplement_fund_account,fund_scheme_id,fund_payment_base_string,other_pay_org,other_scheme_id,other_payment_base_string,social_per_json,
social_per_sum,fund_per_json,fund_per_sum,other_per_json,other_per_sum,per_sum,social_com_json,social_com_sum,fund_com_json,fund_com_sum,other_com_json,other_com_sum,
com_sum,social_sum,fund_sum,other_sum,total,creator,create_time,update_time,delete_type,tenant_key,payment_organization)
VALUES
INSERT INTO hrsa_bill_detail
(employee_id,bill_month,bill_status,payment_status,supplementary_month,resource_from,social_pay_org,social_account,social_scheme_id,social_payment_base_string,
fund_pay_org,fund_account,supplement_fund_account,fund_scheme_id,fund_payment_base_string,other_pay_org,other_scheme_id,other_payment_base_string,social_per_json,
social_per_sum,fund_per_json,fund_per_sum,other_per_json,other_per_sum,per_sum,social_com_json,social_com_sum,fund_com_json,fund_com_sum,other_com_json,other_com_sum,
com_sum,social_sum,fund_sum,other_sum,total,creator,create_time,update_time,delete_type,tenant_key,payment_organization)
VALUES
(
#{item.employeeId},
#{item.billMonth},

View File

@ -305,6 +305,7 @@
a.hiredate,
l.dimissionDate,
social.siSchemeId,
social.paymentOrganization,
fund.fundSchemeId,
other.otherSchemeId
FROM
@ -334,7 +335,8 @@
LEFT JOIN(
SELECT
social.employee_id,
social.social_scheme_id AS siSchemeId
social.social_scheme_id AS siSchemeId,
social.payment_organization AS paymentOrganization
FROM
hrsa_social_archives social
WHERE social.delete_type = 0

View File

@ -29,10 +29,25 @@ public interface SalaryEmployeeService {
*/
List<DataCollectionEmployee> listBySalarySobId(Long salarySobId);
/**
* 获取人员信息
* @param ids
* @return 全量
*/
List<DataCollectionEmployee> listByIds(List<Long> ids);
/**
* 获取人员信息
* @param employeeId
* @return 全量
*/
DataCollectionEmployee getEmployeeById(Long employeeId);
/**
* 获取人员信息
* @param simpleEmployeeIds
* @return 简单
*/
List<DataCollectionEmployee> getEmployeeByIds(List<Long> simpleEmployeeIds);
/**

View File

@ -3,8 +3,8 @@ package com.engine.salary.service.impl;
import com.alibaba.fastjson.JSON;
import com.cloudstore.eccom.constant.WeaBoolAttr;
import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.engine.core.impl.Service;
import com.engine.salary.biz.SIArchivesBiz;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO;
import com.engine.salary.entity.siaccount.po.InsuranceAccountInspectPO;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesAccountPO;
@ -18,7 +18,6 @@ import com.engine.salary.service.ColumnBuildService;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import org.apache.commons.lang3.StringUtils;
import com.engine.core.impl.Service;
import java.util.*;
import java.util.stream.Collectors;
@ -267,7 +266,7 @@ public class ColumnBuildServiceImpl extends Service implements ColumnBuildServic
List<WeaTableColumn> list = new ArrayList<>();
SIArchivesBiz siArchivesBiz = new SIArchivesBiz();
List<Long> employeeIds = pos.stream().map(InsuranceAccountInspectPO::getEmployeeId).collect(Collectors.toList());
Map<Long, InsuranceArchivesAccountPO> insuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
Map<Long, InsuranceArchivesAccountPO> insuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds);
Map<String, String> categoryIdNameMap = MapperProxyFactory.getProxy(ICategoryMapper.class).listAll().stream().collect(Collectors.toMap(ICategoryPO -> String.valueOf(ICategoryPO.getId()), ICategoryPO::getInsuranceName));
Map<Integer, Map<String, String>> columns = buildInspectTableTitle(new ArrayList<>(insuranceArchivesAccountPOMap.values()), categoryIdNameMap);
WeaTableColumn weaTableNameColumn = new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 85429, "姓名"), "userName");

View File

@ -1,8 +1,8 @@
package com.engine.salary.service.impl;
import com.alibaba.fastjson.JSON;
import com.engine.core.impl.Service;
import com.engine.salary.biz.SIArchivesBiz;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO;
import com.engine.salary.entity.siaccount.po.InsuranceAccountInspectPO;
@ -18,7 +18,6 @@ import com.engine.salary.mapper.TaxAgentMapper;
import com.engine.salary.mapper.datacollection.EmployMapper;
import com.engine.salary.mapper.sischeme.InsuranceSchemeMapper;
import com.engine.salary.service.RecordsBuildService;
import com.engine.core.impl.Service;
import com.engine.salary.util.*;
import com.engine.salary.util.db.MapperProxyFactory;
import org.apache.commons.collections4.CollectionUtils;
@ -167,7 +166,7 @@ public class RecordsBuildServiceImpl extends Service implements RecordsBuildServ
return result;
}
Map<Long, DataCollectionEmployee> collect = employeeByIds.stream().collect(Collectors.toMap(DataCollectionEmployee::getEmployeeId, Function.identity()));
Map<Long, InsuranceArchivesAccountPO> insuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
Map<Long, InsuranceArchivesAccountPO> insuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds);
list.forEach(item -> {
Map<String, Object> record = new HashMap<>();
DataCollectionEmployee simpleEmployee = collect.get(item.getEmployeeId()) == null ? new DataCollectionEmployee() : collect.get(item.getEmployeeId());

View File

@ -18,6 +18,7 @@ import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.excel.ExcelUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.general.Util;
import weaver.hrm.User;
@ -67,7 +68,12 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
SIArchivesBiz siArchivesBiz = new SIArchivesBiz();
WelfareTypeEnum welfareTypeEnum = (WelfareTypeEnum) params.get("welfareTypeEnum");
Long employeeId = Long.valueOf(Util.null2String(params.get("employeeId")));
Long schemeId = Long.valueOf(Util.null2String(params.get("schemeId")));
String schemeIdStr = Util.null2String(params.get("schemeId"));
Long schemeId = null;
if (StringUtils.isNotBlank(schemeIdStr)) {
schemeId = Long.valueOf(schemeIdStr);
}
apidatas = siArchivesBiz.getPaymentForm(user, welfareTypeEnum, employeeId, (long) user.getUID(), schemeId);
return apidatas;
}

View File

@ -704,6 +704,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
errorMessageMap.put("message", rowIndex + "员工信息不存在");
excelComments.add(errorMessageMap);
isError = true;
return isError;
} else {
//含在职和离职选在职数据
if (employees.size() > 1) {
@ -745,14 +746,19 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
//社保缴纳组织=个税扣缴义务人
String paymentOrg = (String) paymentMap.get("社保缴纳组织");
if (!paymentNameIdMap.containsKey(paymentOrg)) {
if (StringUtils.isBlank(paymentOrg)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100312, "社保缴纳组织不能为空"));
excelComments.add(errorMessageMap);
isError = true;
}else if (!paymentNameIdMap.containsKey(paymentOrg)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100312, "社保缴纳组织应和个税扣缴义务人名称一致,社保缴纳组织不存在或不在权限范围内"));
excelComments.add(errorMessageMap);
isError = true;
}
if (openDevolution) {
if (openDevolution && !isError) {
Long paymentOrgId = paymentNameIdMap.get(paymentOrg);
TaxAgentManageRangeEmployeeDTO taxAgentManageRangeEmployeeDTO = taxAgentManageRangeEmployeeTree.stream().filter(tax -> tax.getTaxAgentId().equals(paymentOrgId)).findFirst().get();
Optional<Long> o = taxAgentManageRangeEmployeeDTO.getEmployeeList().stream().map(TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee::getEmployeeId).filter(e -> e.equals(employeeId)).findFirst();

View File

@ -4,7 +4,6 @@ import com.engine.common.service.HrmCommonService;
import com.engine.common.service.impl.HrmCommonServiceImpl;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.biz.SalaryRoleBiz;
import com.engine.salary.constant.SalaryAuthConstant;
import com.engine.salary.encrypt.datacollection.AddUpDeductionEncrypt;
import com.engine.salary.encrypt.datacollection.AddUpSituationEncrypt;
@ -59,8 +58,6 @@ import java.util.stream.Collectors;
@Slf4j
public class TaxAgentServiceImpl extends Service implements TaxAgentService {
// private ExtEmployeeService extEmployeeService;
SalaryRoleBiz salaryRoleBiz = new SalaryRoleBiz();
private TaxAgentBaseService getTaxAgentBaseService(User user) {
return ServiceUtil.getService(TaxAgentBaseServiceImpl.class, user);
@ -71,9 +68,6 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService {
}
private TaxAgentSubAdminService taxAgentSubAdminService;
// private TaxAgentSubAdminService getTaxAgentSubAdminService(User user) {
// return ServiceUtil.getService(TaxAgentSubAdminServiceImpl.class, user);
// }
private TaxAgentManageRangeService getTaxAgentManageRangeService(User user) {
return ServiceUtil.getService(TaxAgentManageRangeServiceImpl.class, user);
@ -84,9 +78,6 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService {
}
private TaxAgentSubAdminEmpService taxAgentSubAdminEmpService;
// private TaxAgentSubAdminEmpService getTaxAgentSubAdminEmpService(User user) {
// return ServiceUtil.getService(TaxAgentSubAdminEmpServiceImpl.class, user);
// }
private HrmCommonService getHrmCommonService(User user) {
return ServiceUtil.getService(HrmCommonServiceImpl.class, user);