福利台账分权

This commit is contained in:
MustangDeng 2022-06-09 18:31:36 +08:00
parent 2fe1613868
commit 85f0b1164c
11 changed files with 57 additions and 9 deletions

View File

@ -178,10 +178,9 @@ public class SIAccountBiz extends Service {
if (CollectionUtils.isEmpty(param.getIds())) {
// 需要分权的情况
if(getTaxAgentService().isNeedAuth(employeeId)) {
List<TaxAgentEmployeeDTO> taxAgentEmployeeDTOS = getTaxAgentService().listTaxAgentAndEmployee((long) user.getUID());
ids = taxAgentEmployeeDTOS.stream().map(TaxAgentEmployeeDTO::getEmployeeId).collect(Collectors.toList());
} else {
ids = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectAccountIds(SalaryDateUtil.getMonthBegin(param.getBillMonth()), param.getPaymentOrganization());
} else {
ids = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectAccountIds(SalaryDateUtil.getMonthBegin(param.getBillMonth()), null);
}
} else {
ids = param.getIds();
@ -687,7 +686,7 @@ public class SIAccountBiz extends Service {
public void updateBatchAccount(AccountParam param, Long employeeId, String tenantKey, String currentUserName) {
String billMonth = param.getBillMonth();
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectList(billMonth);
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectList(billMonth, String.valueOf(param.getPaymentOrganization()));
Map<Long, List<InsuranceAccountDetailPO>> map = insuranceAccountDetailPOS.stream().filter(item -> item.getEmployeeId() != null)
.collect(Collectors.groupingBy(InsuranceAccountDetailPO::getEmployeeId));
int socialAccountPerson = 0;
@ -1375,7 +1374,7 @@ public class SIAccountBiz extends Service {
public PageInfo<InsuranceAccountViewListDTO> overView(InsuranceAccountDetailParam queryParam) {
// SalaryPageUtil.start(queryParam.getCurrent(),queryParam.getPageSize());
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectList(queryParam.getBillMonth());
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectList(queryParam.getBillMonth(), queryParam.getPaymentOrganization());
//获取扣缴义务人信息
List<TaxAgent> paymentList = MapperProxyFactory.getProxy(TaxAgentMapper.class).listAll();

View File

@ -4,8 +4,10 @@ package com.engine.salary.entity.siaccount.bo;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountBatchListDTO;
import com.engine.salary.entity.siaccount.po.InsuranceAccountBatchPO;
import com.engine.salary.enums.siaccount.BillStatusEnum;
import com.engine.salary.mapper.TaxAgentMapper;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryEnumUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import org.apache.commons.collections.CollectionUtils;
import java.text.SimpleDateFormat;
@ -61,6 +63,8 @@ public class InsuranceAccountBO {
.remarks(e.getRemarks())
.socialNum(e.getSocialNum())
.socialPay(SalaryEntityUtil.thousandthConvert(e.getSocialPay()))
.paymentOrganization(e.getPaymentOrganization() != null ? MapperProxyFactory.getProxy(TaxAgentMapper.class).getById(e.getPaymentOrganization()).getName() : "")
.paymentOrganizationId(e.getPaymentOrganization())
.build()
).collect(Collectors.toList());
}

View File

@ -44,6 +44,8 @@ public class InsuranceAccountBatchListDTO {
@TableTitle(title = "个税扣缴义务人", dataIndex = "paymentOrganization", key = "paymentOrganization")
private String paymentOrganization;
private Long paymentOrganizationId;
/**
* 账单状态 0-未归档 1-已归档
*/

View File

@ -6,6 +6,8 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @Author weaver_cl
* @Description: TODO
@ -23,4 +25,6 @@ public class InsuranceAccountBatchParam extends BaseQueryParam {
//结束时间
private String endTime;
private List<Long> taxAgents;
}

View File

@ -25,4 +25,6 @@ public class InsuranceAccountDetailParam extends BaseQueryParam {
private List<Long> employeeIds;
private String userName;
private String paymentOrganization;
}

View File

@ -22,4 +22,6 @@ public class InsuranceExportParam {
//@NotBlank
@DataCheck(require = true,message = "账单月份不可为空")
private String billMonth;
private String paymentOrganization;
}

View File

@ -136,14 +136,22 @@
AND
t.bill_month between #{param.startTime} and #{param.endTime}
</if>
<if test="param.taxAgents != null and param.taxAgents.size() > 0 ">
AND
t.payment_organization in
<foreach collection="param.taxAgents" open="(" item="taxAgent" separator="," close=")">
#{taxAgent}
</foreach>
</if>
</sql>
<select id="list" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
<include refid="baseColumns" />
FROM
hrsa_bill_batch t
left join hrsa_tax_agent t1 on t.payment_organization = t1.id
WHERE t.delete_type = 0
<include refid="paramSql"/>
ORDER BY t.bill_month DESC

View File

@ -54,7 +54,7 @@ public interface InsuranceAccountDetailMapper {
* @param billMonth
* @return
*/
List<InsuranceAccountDetailPO> selectList(@Param("billMonth") String billMonth);
List<InsuranceAccountDetailPO> selectList(@Param("billMonth") String billMonth, @Param("paymentOrganization") String paymentOrganization);
List<InsuranceAccountDetailPO> queryList(@Param("billMonth") String billMonth,@Param("employeeIds") Collection<Long> employeeIds);

View File

@ -106,6 +106,10 @@
AND
t.payment_status = #{param.paymentStatus}
</if>
<if test="param.paymentOrganization != null and param.paymentOrganization != ''">
AND
t.payment_organization = #{param.paymentOrganization}
</if>
</sql>
<sql id="paramSql">
@ -158,6 +162,9 @@
hrsa_bill_detail t
WHERE t.delete_type = 0
AND t.bill_month = #{billMonth}
<if test="paymentOrganization != null and paymentOrganization != ''">
AND t.payment_organization = #{paymentOrganization}
</if>
</select>
<select id="queryList" resultMap="BaseResultMap">
@ -217,6 +224,11 @@
LEFT JOIN hrsa_other_archives other ON t.ID = other.employee_id
WHERE (
fund.fund_start_time IS NOT NULL AND fund.fund_start_time != ''
<if test="paymentOrganization != null and paymentOrganization != ''">
AND
-- 个税扣缴义务人
fund.payment_organization = #{paymentOrganization}
</if>
AND(
fund.fund_end_time IS NULL
OR fund.fund_end_time = ''
@ -224,9 +236,12 @@
)
)
OR (
social.social_start_time IS NOT NULL AND social.social_start_time != '' AND
social.social_start_time IS NOT NULL AND social.social_start_time != ''
<if test="paymentOrganization != null and paymentOrganization != ''">
AND
-- 个税扣缴义务人
social.payment_organization = #{paymentOrganization}
</if>
AND(
social.social_end_time IS NULL
OR social.social_end_time = ''
@ -235,6 +250,11 @@
)
OR (
other.other_start_time IS NOT NULL AND other.other_start_time != ''
<if test="paymentOrganization != null and paymentOrganization != ''">
AND
-- 个税扣缴义务人
other.payment_organization = #{paymentOrganization}
</if>
AND(
other.other_end_time IS NULL
OR other.other_end_time = ''

View File

@ -89,6 +89,13 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
Long employeeId = (long)user.getUID();
Map<String,Object> datas = new HashMap<>();
// 分权逻辑
if(getTaxAgentService(user).isNeedAuth((long) user.getUID())) {
Collection<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAllTaxAgents((long) user.getUID());
List<Long> taxAgents = taxAgentPOS.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
queryParam.setTaxAgents(taxAgents);
}
//福利台账列表
PageInfo<InsuranceAccountBatchPO> pageInfo = getSiAccountBiz(user).listPage(queryParam,employeeId);
Collection<InsuranceAccountBatchPO> insuranceAccountBatchPOS = pageInfo.getList();

View File

@ -56,7 +56,7 @@ public class SIExportServiceImpl extends Service implements SIExportService {
@Override
public XSSFWorkbook exportOverView(InsuranceExportParam queryParam) {
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectList(queryParam.getBillMonth());
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectList(queryParam.getBillMonth(), queryParam.getPaymentOrganization());
//获取扣缴义务人信息
List<TaxAgent> paymentList = MapperProxyFactory.getProxy(TaxAgentMapper.class).listAll();