社保福利台账增减人员
This commit is contained in:
parent
bc10cfec26
commit
fb2b1f0845
|
|
@ -410,7 +410,7 @@ public class SIAccountBiz extends Service {
|
|||
/*}*/
|
||||
List<List<Long>> partition = Lists.partition((List<Long>) ids, 100);
|
||||
partition.forEach(part -> {
|
||||
getSIAccountDetailTempMapper().batchDelByEmpIdsAndMonthAndPayOrg(part, param.getBillMonth(), param.getPaymentOrganization());
|
||||
getSIAccountDetailTempMapper().batchDelByEmpIdsAndMonthAndPayOrg(part, param.getBillMonth(), param.getPaymentOrganization(), null);
|
||||
});
|
||||
log.info("更新福利核算进度······");
|
||||
getSalaryAcctProgressService(user).finish(SalaryCacheKey.ACCT_PROGRESS + param.getBillMonth(), true);
|
||||
|
|
@ -515,7 +515,7 @@ public class SIAccountBiz extends Service {
|
|||
//临时表入库前先对(可能存在的)历史数据进行删除
|
||||
List<List<Long>> partition = Lists.partition((List<Long>) ids, 100);
|
||||
partition.forEach(part -> {
|
||||
getSIAccountDetailTempMapper().batchDelByEmpIdsAndMonthAndPayOrg(part, billMonth, paymentOrganization);
|
||||
getSIAccountDetailTempMapper().batchDelByEmpIdsAndMonthAndPayOrg(part, billMonth, paymentOrganization, null);
|
||||
});
|
||||
//临时表数据入库
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
package com.engine.salary.entity.auth.param;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class FsdSocialDetailAuthParam {
|
||||
|
||||
private Long paymentOrganization;
|
||||
|
||||
private String fsdSbjndw;
|
||||
|
||||
}
|
||||
|
|
@ -199,5 +199,5 @@ public interface InsuranceAccountDetailMapper {
|
|||
*/
|
||||
void deleteByIds(@Param("ids")List<Long> ids);
|
||||
|
||||
void deleteByEmpIds(@Param("employeeIds")List<Long> deleteEmployeeIds, @Param("billMonth") String billMonth, @Param("paymentOrganization") Long paymentOrganization);
|
||||
void deleteByEmpIds(@Param("employeeIds")List<Long> deleteEmployeeIds, @Param("billMonth") String billMonth, @Param("paymentOrganization") Long paymentOrganization, @Param("fsdSbjndw") String fsdSbjndw);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1611,6 +1611,9 @@
|
|||
<foreach collection="employeeIds" open="(" item="employeeId" separator="," close=")">
|
||||
#{employeeId}
|
||||
</foreach>
|
||||
<if test="fsdSbjndw != null and fsdSbjndw != ''">
|
||||
AND fsd_sbjndw = #{fsdSbjndw}
|
||||
</if>
|
||||
</delete>
|
||||
|
||||
<select id="getOneByBpep" resultMap="BaseResultMap">
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public interface SIAccountDetailTempMapper {
|
|||
* @param employeeIds
|
||||
* @param billMonth
|
||||
*/
|
||||
void batchDelByEmpIdsAndMonthAndPayOrg(@Param("employeeIds") Collection<Long> employeeIds, @Param("billMonth") String billMonth, @Param("paymentOrganization") Long paymentOrganization);
|
||||
void batchDelByEmpIdsAndMonthAndPayOrg(@Param("employeeIds") Collection<Long> employeeIds, @Param("billMonth") String billMonth, @Param("paymentOrganization") Long paymentOrganization, @Param("fsdSbjndw") String fsdSbjndw);
|
||||
|
||||
void batchDelByMonthAndPayOrgAndSbjndw(@Param("billMonth") String billMonth, @Param("paymentOrganization") Long paymentOrganization, @Param("sbjndw") String sbjndw);
|
||||
|
||||
|
|
|
|||
|
|
@ -139,6 +139,9 @@
|
|||
<foreach collection="employeeIds" open="(" item="employeeId" separator="," close=")">
|
||||
#{employeeId}
|
||||
</foreach>
|
||||
<if test="fsdSbjndw != null and fsdSbjndw != ''">
|
||||
AND fsd_sbjndw = #{fsdSbjndw}
|
||||
</if>
|
||||
</delete>
|
||||
|
||||
<update id="batchDelByMonthAndPayOrgAndSbjndw">
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.engine.salary.service.auth;
|
|||
import com.engine.salary.entity.auth.dto.AuthRoleDTO;
|
||||
import com.engine.salary.entity.auth.param.AuthRoleListQueryParam;
|
||||
import com.engine.salary.entity.auth.param.AuthRoleSaveParam;
|
||||
import com.engine.salary.entity.auth.param.FsdSocialDetailAuthParam;
|
||||
import com.engine.salary.entity.auth.po.AuthRolePO;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
|
||||
|
|
@ -37,4 +38,5 @@ public interface AuthRoleService {
|
|||
|
||||
List<AuthRolePO> listAll();
|
||||
|
||||
String permission4FsdSocialDetail(FsdSocialDetailAuthParam param);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,15 +4,13 @@ import cn.hutool.core.collection.CollectionUtil;
|
|||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.hrmelog.entity.dto.LoggerContext;
|
||||
import com.engine.salary.common.SalaryContext;
|
||||
import com.engine.salary.config.SalaryElogConfig;
|
||||
import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
||||
import com.engine.salary.entity.auth.dto.AuthRoleDTO;
|
||||
import com.engine.salary.entity.auth.dto.AuthRoleDataDTO;
|
||||
import com.engine.salary.entity.auth.dto.AuthRoleEmpDTO;
|
||||
import com.engine.salary.entity.auth.param.AuthDataQueryParam;
|
||||
import com.engine.salary.entity.auth.param.AuthMemberQueryParam;
|
||||
import com.engine.salary.entity.auth.param.AuthRoleListQueryParam;
|
||||
import com.engine.salary.entity.auth.param.AuthRoleSaveParam;
|
||||
import com.engine.salary.entity.auth.param.*;
|
||||
import com.engine.salary.entity.auth.po.AuthOptPO;
|
||||
import com.engine.salary.entity.auth.po.AuthResourcePO;
|
||||
import com.engine.salary.entity.auth.po.AuthRolePO;
|
||||
|
|
@ -23,17 +21,19 @@ import com.engine.salary.enums.auth.ResourceTargetTypeEnum;
|
|||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.mapper.auth.AuthResourceMapper;
|
||||
import com.engine.salary.mapper.auth.AuthRoleMapper;
|
||||
import com.engine.salary.service.SIAccountService;
|
||||
import com.engine.salary.service.TaxAgentService;
|
||||
import com.engine.salary.service.impl.SIAccountServiceImpl;
|
||||
import com.engine.salary.service.impl.TaxAgentServiceImpl;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.engine.salary.util.db.IdGenerator;
|
||||
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.lang3.StringUtils;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class AuthRoleServiceImpl extends Service implements AuthRoleService {
|
||||
|
|
@ -58,6 +58,15 @@ public class AuthRoleServiceImpl extends Service implements AuthRoleService {
|
|||
return ServiceUtil.getService(AuthDataServiceImpl.class, user);
|
||||
}
|
||||
|
||||
public SIAccountService getSIAccountService(User user) {
|
||||
SalaryContext.get().setValue("user",user);
|
||||
return ServiceUtil.getService(SIAccountServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private TaxAgentService getTaxAgentService(User user) {
|
||||
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PageInfo<AuthRoleDTO> roleList(AuthRoleListQueryParam param) {
|
||||
|
|
@ -246,4 +255,23 @@ public class AuthRoleServiceImpl extends Service implements AuthRoleService {
|
|||
public List<AuthRolePO> listAll() {
|
||||
return getAuthRoleMapper().listAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String permission4FsdSocialDetail(FsdSocialDetailAuthParam param) {
|
||||
if (param.getPaymentOrganization() == null) {
|
||||
return "false";
|
||||
}
|
||||
List<Long> canManageTaxAgentIds = getTaxAgentService(user).listAllTaxAgents(Long.valueOf(user.getUID())).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
|
||||
if (StringUtils.isBlank(param.getFsdSbjndw())) {
|
||||
return String.valueOf(canManageTaxAgentIds.contains(param.getPaymentOrganization()));
|
||||
} else if (canManageTaxAgentIds.contains(param.getPaymentOrganization())) {
|
||||
return "true";
|
||||
}
|
||||
// 获取当前登录人员,在业务线中配置的人员范围对应的社保缴纳单位信息
|
||||
String sbjndw = getSIAccountService(user).getSbjndIdByUser();
|
||||
if (StringUtils.isNotBlank(sbjndw) && param.getFsdSbjndw().equals(sbjndw)) {
|
||||
return "true";
|
||||
}
|
||||
return "false";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
|||
import com.engine.salary.constant.SalaryItemConstant;
|
||||
import com.engine.salary.encrypt.EncryptUtil;
|
||||
import com.engine.salary.entity.auth.dto.TaxEmpOptAuth;
|
||||
import com.engine.salary.entity.auth.param.FsdSocialDetailAuthParam;
|
||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
import com.engine.salary.entity.progress.ProgressDTO;
|
||||
import com.engine.salary.entity.siaccount.bo.InsuranceAccountBO;
|
||||
|
|
@ -55,6 +56,8 @@ import com.engine.salary.mapper.sischeme.InsuranceSchemeMapper;
|
|||
import com.engine.salary.mapper.sys.SalarySysConfMapper;
|
||||
import com.engine.salary.mapper.taxagent.TaxAgentMapper;
|
||||
import com.engine.salary.service.*;
|
||||
import com.engine.salary.service.auth.AuthRoleService;
|
||||
import com.engine.salary.service.auth.AuthRoleServiceImpl;
|
||||
import com.engine.salary.service.auth.AuthService;
|
||||
import com.engine.salary.service.auth.AuthServiceImpl;
|
||||
import com.engine.salary.sys.constant.SalarySysConstant;
|
||||
|
|
@ -253,6 +256,9 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
|
|||
return ServiceUtil.getService(AuthServiceImpl.class, user);
|
||||
}
|
||||
|
||||
public AuthRoleService getAuthRoleService(User user) {
|
||||
return ServiceUtil.getService(AuthRoleServiceImpl.class, user);
|
||||
}
|
||||
@Override
|
||||
public Map<String, Object> listPage(InsuranceAccountBatchParam queryParam) {
|
||||
Map<String, Object> datas = new HashMap<>();
|
||||
|
|
@ -304,6 +310,10 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
|
|||
Long employeeId = (long) user.getUID();
|
||||
Map<String, Object> datas = new HashMap<>();
|
||||
|
||||
String canOperate = getAuthRoleService(user).permission4FsdSocialDetail(FsdSocialDetailAuthParam.builder().paymentOrganization(Long.valueOf(queryParam.getPaymentOrganization())).fsdSbjndw(queryParam.getFsdSbjndw()).build());
|
||||
if (canOperate.equals("false")) {
|
||||
throw new SalaryRunTimeException("无权限");
|
||||
}
|
||||
//正常缴纳列表
|
||||
// PageInfo<InsuranceAccountDetailPO> pageInfo = getSiAccountBiz(user).listCommonPage(queryParam);
|
||||
PageInfo<InsuranceAccountDetailPO> pageInfo = siBatchListCommonPage(queryParam);
|
||||
|
|
@ -351,6 +361,11 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
|
|||
Long employeeId = (long) user.getUID();
|
||||
Map<String, Object> datas = new HashMap<>();
|
||||
|
||||
String canOperate = getAuthRoleService(user).permission4FsdSocialDetail(FsdSocialDetailAuthParam.builder().paymentOrganization(Long.valueOf(queryParam.getPaymentOrganization())).fsdSbjndw(queryParam.getFsdSbjndw()).build());
|
||||
if (canOperate.equals("false")) {
|
||||
throw new SalaryRunTimeException("无权限");
|
||||
}
|
||||
|
||||
// //过滤出福利档案基础信息表中runStatus为正在缴纳和待减员的人员
|
||||
// List<InsuranceArchivesBaseInfoPO> baseInfoPOList = getInsuranceBaseInfoMapper().listAll();
|
||||
// List<Long> canAccountIds = baseInfoPOList.stream()
|
||||
|
|
@ -416,6 +431,10 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
|
|||
public Map<String, Object> listRecessionPage(InsuranceAccountDetailParam queryParam) {
|
||||
Long employeeId = (long) user.getUID();
|
||||
Map<String, Object> datas = new HashMap<>();
|
||||
String canOperate = getAuthRoleService(user).permission4FsdSocialDetail(FsdSocialDetailAuthParam.builder().paymentOrganization(Long.valueOf(queryParam.getPaymentOrganization())).fsdSbjndw(queryParam.getFsdSbjndw()).build());
|
||||
if (canOperate.equals("false")) {
|
||||
throw new SalaryRunTimeException("无权限");
|
||||
}
|
||||
|
||||
//退差列表
|
||||
queryParam.setPaymentStatus(PaymentStatusEnum.RECESSION.getValue());
|
||||
|
|
@ -464,6 +483,11 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
|
|||
Long employeeId = (long) user.getUID();
|
||||
Map<String, Object> datas = new HashMap<>();
|
||||
|
||||
String canOperate = getAuthRoleService(user).permission4FsdSocialDetail(FsdSocialDetailAuthParam.builder().paymentOrganization(Long.valueOf(queryParam.getPaymentOrganization())).fsdSbjndw(queryParam.getFsdSbjndw()).build());
|
||||
if (canOperate.equals("false")) {
|
||||
throw new SalaryRunTimeException("无权限");
|
||||
}
|
||||
|
||||
//补差列表
|
||||
queryParam.setPaymentStatus(PaymentStatusEnum.BALANCE.getValue());
|
||||
|
||||
|
|
@ -5115,7 +5139,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
|
|||
|
||||
List<List<Long>> partition = Lists.partition((List<Long>) ids, 100);
|
||||
partition.forEach(part -> {
|
||||
getSIAccountDetailTempMapper().batchDelByEmpIdsAndMonthAndPayOrg(part, param.getBillMonth(), param.getPaymentOrganization());
|
||||
getSIAccountDetailTempMapper().batchDelByEmpIdsAndMonthAndPayOrg(part, param.getBillMonth(), param.getPaymentOrganization(), param.getFsdSbjndw());
|
||||
});
|
||||
log.info("更新福利核算进度······");
|
||||
getSalaryAcctProgressService(user).finish(SalaryCacheKey.ACCT_PROGRESS + param.getBillMonth() + "_" + param.getPaymentOrganization() + "_" + Utils.null2String(param.getFsdSbjndw()), true);
|
||||
|
|
@ -5143,8 +5167,8 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
|
|||
List<DataCollectionEmployee> employeeList = getSalaryEmployeeService(user).listByIds(ids);
|
||||
List<List<Long>> partition = Lists.partition(ids, 100);
|
||||
partition.forEach(part -> {
|
||||
historyDetailData.addAll(getInsuranceAccountDetailMapper().list(InsuranceAccountDetailParam.builder().billMonth(billMonth).paymentOrganization(paymentOrganization.toString()).employeeIds(part).build()));
|
||||
historyDetailData.addAll(getInsuranceAccountDetailMapper().extList(InsuranceAccountDetailParam.builder().billMonth(billMonth).paymentOrganization(paymentOrganization.toString()).employeeIds(part).build()));
|
||||
historyDetailData.addAll(getInsuranceAccountDetailMapper().list(InsuranceAccountDetailParam.builder().billMonth(billMonth).paymentOrganization(paymentOrganization.toString()).employeeIds(part).fsdSbjndw(sbjndw).build()));
|
||||
historyDetailData.addAll(getInsuranceAccountDetailMapper().extList(InsuranceAccountDetailParam.builder().billMonth(billMonth).paymentOrganization(paymentOrganization.toString()).employeeIds(part).fsdSbjndw(sbjndw).build()));
|
||||
});
|
||||
Map<Long, InsuranceAccountDetailPO> historyDetailDataMap = SalaryEntityUtil.convert2Map(historyDetailData, InsuranceAccountDetailPO::getEmployeeId);
|
||||
Map<Long, DataCollectionEmployee> employeeMap = SalaryEntityUtil.convert2Map(employeeList, DataCollectionEmployee::getEmployeeId);
|
||||
|
|
@ -5223,7 +5247,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
|
|||
}
|
||||
//临时表入库前先对(可能存在的)历史数据进行删除
|
||||
partition.forEach(part -> {
|
||||
getSIAccountDetailTempMapper().batchDelByEmpIdsAndMonthAndPayOrg(part, billMonth, paymentOrganization);
|
||||
getSIAccountDetailTempMapper().batchDelByEmpIdsAndMonthAndPayOrg(part, billMonth, paymentOrganization, sbjndw);
|
||||
});
|
||||
// // 根据人员id删,会少删不再参与社保核算的人。
|
||||
// getSIAccountDetailTempMapper().batchDelByMonthAndPayOrgAndSbjndw(billMonth, paymentOrganization, sbjndw);
|
||||
|
|
@ -5231,8 +5255,8 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
|
|||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
if (!isFirstFlag) {
|
||||
// 点击台账内的核算按钮,核算人员不变(不增加人)
|
||||
List<String> existDataKey = historyDetailData.stream().map(po -> po.getPaymentOrganization() + "_" + po.getEmployeeId()).collect(Collectors.toList());
|
||||
list = list.stream().filter(po -> existDataKey.contains(po.getPaymentOrganization() + "_" + po.getEmployeeId())).collect(Collectors.toList());
|
||||
List<String> existDataKey = historyDetailData.stream().map(po -> po.getPaymentOrganization() + "_" + po.getEmployeeId()+ "_" + Utils.null2String(po.getFsdSbjndw())).collect(Collectors.toList());
|
||||
list = list.stream().filter(po -> existDataKey.contains(po.getPaymentOrganization() + "_" + po.getEmployeeId() + "_" + Utils.null2String(po.getFsdSbjndw()))).collect(Collectors.toList());
|
||||
}
|
||||
encryptUtil.encryptList(list, InsuranceAccountDetailTempPO.class);
|
||||
List<List<InsuranceAccountDetailTempPO>> lists = splitList(list, 20);
|
||||
|
|
@ -6764,6 +6788,10 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
|
|||
|
||||
public PageInfo<InsuranceAccountViewListDTO> siOverView(InsuranceAccountDetailParam queryParam) {
|
||||
|
||||
String canOperate = getAuthRoleService(user).permission4FsdSocialDetail(FsdSocialDetailAuthParam.builder().paymentOrganization(Long.valueOf(queryParam.getPaymentOrganization())).fsdSbjndw(queryParam.getFsdSbjndw()).build());
|
||||
if (canOperate.equals("false")) {
|
||||
throw new SalaryRunTimeException("无权限");
|
||||
}
|
||||
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = getInsuranceAccountDetailMapper().selectList(queryParam.getBillMonth(), StringUtil.isBlank(queryParam.getPaymentOrganization()) ? null : Long.valueOf(queryParam.getPaymentOrganization()));
|
||||
if (StringUtils.isNotBlank(queryParam.getFsdSbjndw())) {
|
||||
insuranceAccountDetailPOS = insuranceAccountDetailPOS.stream().filter(e -> e.getFsdSbjndw() != null && e.getFsdSbjndw().equals(queryParam.getFsdSbjndw())).collect(Collectors.toList());
|
||||
|
|
@ -6997,21 +7025,24 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
|
|||
return;
|
||||
}
|
||||
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = getInsuranceAccountDetailMapper().selectList(param.getBillMonth(), param.getPaymentOrganization());
|
||||
if (StringUtils.isNotBlank(param.getFsdSbjndw())) {
|
||||
insuranceAccountDetailPOS= insuranceAccountDetailPOS.stream().filter(d -> StringUtils.isNotBlank(d.getFsdSbjndw()) && d.getFsdSbjndw().equals(param.getFsdSbjndw())).collect(Collectors.toList());
|
||||
}
|
||||
insuranceAccountDetailPOS = insuranceAccountDetailPOS.stream().filter(detailPO -> param.getIds().contains(detailPO.getId())).collect(Collectors.toList());
|
||||
List<Long> deleteEmployeeIds = insuranceAccountDetailPOS.stream().map(InsuranceAccountDetailPO::getEmployeeId).collect(Collectors.toList());
|
||||
deleteAccountDetailsByEmpIds(deleteEmployeeIds, param.getBillMonth(), param.getPaymentOrganization());
|
||||
deleteAccountDetailsByEmpIds(deleteEmployeeIds, param.getBillMonth(), param.getPaymentOrganization(), param.getFsdSbjndw());
|
||||
if (CollectionUtils.isNotEmpty(deleteEmployeeIds)) {
|
||||
// 重新计算合计值
|
||||
updateBatchAccount((AccountParam.builder().billMonth(param.getBillMonth()).paymentOrganization(param.getPaymentOrganization())).build());
|
||||
updateBatchAccount((AccountParam.builder().billMonth(param.getBillMonth()).paymentOrganization(param.getPaymentOrganization()).fsdSbjndw(param.getFsdSbjndw())).build());
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteAccountDetailsByEmpIds(List<Long> deleteEmployeeIds, String billMonth, Long paymentOrganization) {
|
||||
public void deleteAccountDetailsByEmpIds(List<Long> deleteEmployeeIds, String billMonth, Long paymentOrganization, String fsdSbjndw) {
|
||||
if (CollectionUtils.isNotEmpty(deleteEmployeeIds)) {
|
||||
List<List<Long>> partition = Lists.partition(deleteEmployeeIds, 100);
|
||||
partition.forEach(part -> {
|
||||
// 删除该台账下,员工的所有数据
|
||||
getInsuranceAccountDetailMapper().deleteByEmpIds(part, billMonth, paymentOrganization);
|
||||
getInsuranceAccountDetailMapper().deleteByEmpIds(part, billMonth, paymentOrganization, fsdSbjndw);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -7028,7 +7059,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
|
|||
if (CollectionUtils.isEmpty(param.getIncludes())) {
|
||||
return "";
|
||||
}
|
||||
InsuranceAccountBatchPO insuranceAccountBatchPO = getInsuranceAccountBatchMapper().getByBillMonth(param.getBillMonth(), param.getPaymentOrganization());
|
||||
InsuranceAccountBatchPO insuranceAccountBatchPO = getInsuranceAccountBatchMapper().getByBillMonth(param.getBillMonth(), param.getPaymentOrganization(), param.getFsdSbjndw());
|
||||
if (insuranceAccountBatchPO == null) {
|
||||
throw new SalaryRunTimeException("台账不存在或已被删除");
|
||||
}
|
||||
|
|
@ -7038,6 +7069,9 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
|
|||
|
||||
// 获取当前台账已经存在的人员
|
||||
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = getInsuranceAccountDetailMapper().queryNormalListByBillMonth(param.getBillMonth(), param.getPaymentOrganization());
|
||||
if (StringUtils.isNotBlank(param.getFsdSbjndw())) {
|
||||
insuranceAccountDetailPOS = insuranceAccountDetailPOS.stream().filter(f -> f.getFsdSbjndw() != null && param.getFsdSbjndw().equals(f.getFsdSbjndw())).collect(Collectors.toList());
|
||||
}
|
||||
List<Long> existEmpIds = insuranceAccountDetailPOS.stream().map(InsuranceAccountDetailPO::getEmployeeId).collect(Collectors.toList());
|
||||
Optional<Long> existOptional = empIds.stream().filter(existEmpIds::contains).findFirst();
|
||||
if (existOptional.isPresent()) {
|
||||
|
|
@ -7091,7 +7125,19 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
|
|||
throw new SalaryRunTimeException("添加失败,员工:" +canNotAddName + ",社保、公积金、其他福利需至少有一种在当前账单月需缴纳,并且社保档案需为在缴员工");
|
||||
}
|
||||
|
||||
addCommonEmpAndAccount(param.getBillMonth(), empIds, param.getPaymentOrganization());
|
||||
// 校验是否有权限能够添加
|
||||
if (StringUtils.isNotBlank(param.getFsdSbjndw())) {
|
||||
String sbjndw = getSbjndIdByUser();
|
||||
if (StringUtils.isNotBlank(sbjndw)) {
|
||||
List<Long> empIdBySbjndw = getEmpIdBySbjndw(sbjndw);
|
||||
Optional<Long> noAuth = empIds.stream().filter(empId -> !empIdBySbjndw.contains(empId)).findFirst();
|
||||
if (noAuth.isPresent()) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "无权限添加该人员"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
addCommonEmpAndAccount(param.getBillMonth(), empIds, param.getPaymentOrganization(), param.getFsdSbjndw());
|
||||
return "success";
|
||||
}
|
||||
|
||||
|
|
@ -7101,7 +7147,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
|
|||
* @param ids
|
||||
* @param paymentOrganization
|
||||
*/
|
||||
public void addCommonEmpAndAccount(String billMonth, List<Long> ids, Long paymentOrganization) {
|
||||
public void addCommonEmpAndAccount(String billMonth, List<Long> ids, Long paymentOrganization, String fsdSbjndw) {
|
||||
Map<Long, InsuranceArchivesAccountPO> insuranceArchivesAccountPOS = getSIArchivesService(user).buildBatchAccount(ids, paymentOrganization);
|
||||
List<DataCollectionEmployee> employeeList = getSalaryEmployeeService(user).listByIds(ids);
|
||||
Map<Long, DataCollectionEmployee> employeeMap = SalaryEntityUtil.convert2Map(employeeList, DataCollectionEmployee::getEmployeeId);
|
||||
|
|
@ -7122,6 +7168,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
|
|||
insuranceAccountDetailPO.setResourceFrom(ResourceFromEnum.SYSTEM.getValue());
|
||||
insuranceAccountDetailPO.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
|
||||
insuranceAccountDetailPO.setPaymentOrganization(paymentOrganization);
|
||||
insuranceAccountDetailPO.setFsdSbjndw(fsdSbjndw);
|
||||
|
||||
DataCollectionEmployee employee = employeeMap.get(k);
|
||||
if (employee != null) {
|
||||
|
|
@ -7163,7 +7210,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
|
|||
lists.forEach(subList -> {
|
||||
getInsuranceAccountDetailMapper().batchSaveAccountDetails(subList);
|
||||
});
|
||||
updateBatchAccount((AccountParam.builder().billMonth(billMonth).paymentOrganization(paymentOrganization)).build());
|
||||
updateBatchAccount((AccountParam.builder().billMonth(billMonth).paymentOrganization(paymentOrganization).fsdSbjndw(fsdSbjndw)).build());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -188,6 +188,15 @@ public class AuthController {
|
|||
}
|
||||
|
||||
|
||||
@POST
|
||||
@Path("/permission4FsdSocialDetail")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String permission4FsdSocialDetail(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody FsdSocialDetailAuthParam param) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<FsdSocialDetailAuthParam, String>(user).run(getAuthWrapper(user)::permission4FsdSocialDetail, param);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
|
|
|
|||
|
|
@ -184,4 +184,7 @@ public class AuthWrapper extends Service {
|
|||
return "";
|
||||
}
|
||||
|
||||
public String permission4FsdSocialDetail(FsdSocialDetailAuthParam param) {
|
||||
return getAuthRoleService(user).permission4FsdSocialDetail(param);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue