导入时人员唯一校验

This commit is contained in:
钱涛 2022-06-13 17:05:36 +08:00
parent b78e96c875
commit bf7d8dd634
4 changed files with 116 additions and 87 deletions

View File

@ -24,6 +24,7 @@ import com.engine.salary.entity.taxagent.bo.TaxAgentBO;
import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO;
import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.datacollection.AddUpDeductionMapper;
@ -229,11 +230,9 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
//相同的姓名
String userName = dto.getUsername();
String deparmentName = dto.getDepartmentName();
List<Long> employeeSameIds = employees.stream().filter(e -> (StringUtils.isBlank(userName) || Objects.equals(e.getUsername(), userName))
&& (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName))).map(DataCollectionEmployee::getEmployeeId)
List<DataCollectionEmployee> employeeSameIds = employees.stream().filter(e -> (StringUtils.isBlank(userName) || Objects.equals(e.getUsername(), userName))
&& (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName)))
.collect(Collectors.toList());
if (StringUtils.isBlank(userName)) {
//姓名 不能为空
//错误消息对象
@ -241,13 +240,24 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
errorMessageMap.put("message", rowIndex + "姓名不能为空");
errorData.add(errorMessageMap);
errorSum += 1;
} else if (CollectionUtils.isEmpty(employeeSameIds) || employeeSameIds.size() > 1) {
} else if (CollectionUtils.isEmpty(employeeSameIds)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "员工信息不能为空且不可重复(姓名与部门同时确认唯一)");
errorMessageMap.put("message", rowIndex + "员工信息不存在");
errorData.add(errorMessageMap);
errorSum += 1;
} else if (employeeSameIds.size() > 1) {
//存在离职和在职状态取在职状态
employeeSameIds = employeeSameIds.stream()
.filter(e -> UserStatusEnum.getNormalStatus().contains(e.getStatus()))
.collect(Collectors.toList());
if (employeeSameIds.size() != 1) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "员工信息不能为空且不可重复(姓名与部门同时确认唯一)");
errorData.add(errorMessageMap);
errorSum += 1;
}
} else {
Long employeeId = CollectionUtils.isNotEmpty(employeeSameIds) && employeeSameIds.size() == 1 ? employeeSameIds.get(0) : null;
Long employeeId = CollectionUtils.isNotEmpty(employeeSameIds) && employeeSameIds.size() == 1 ? employeeSameIds.get(0).getEmployeeId() : null;
if (employeeId != null && employeeId > 0) {
addUpDeduction.setEmployeeId(employeeId);
} else {
@ -430,7 +440,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
long employeeId = (long) user.getUID();
Boolean needAuth = getTaxAgentService(user).isNeedAuth(employeeId);
if(needAuth){
if (needAuth) {
List<Long> taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(taxAgentIdsAsAdmin)) {
return new PageInfo<>(AddUpDeductionRecordDTO.class);
@ -530,10 +540,10 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
List<Long> taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
// List<AddUpDeduction> lastList = getLastListByModifier(employeeId, tenantKey);
list = list.stream().filter(f ->
// 作为管理员
taxAgentIdsAsAdmin.contains(f.getTaxAgentId())
// 作为分管理员
|| TaxAgentBO.checkTaxAgentAndEmployee(taxAgentEmployees, f.getTaxAgentId(), f.getEmployeeId())
// 作为管理员
taxAgentIdsAsAdmin.contains(f.getTaxAgentId())
// 作为分管理员
|| TaxAgentBO.checkTaxAgentAndEmployee(taxAgentEmployees, f.getTaxAgentId(), f.getEmployeeId())
).collect(Collectors.toList());
}
@ -626,10 +636,10 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
List<TaxAgentEmployeeDTO> taxAgentEmployees = getTaxAgentService(user).listTaxAgentAndEmployee(employeeId);
List<Long> taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
list = list.stream().filter(f ->
// 作为管理员
taxAgentIdsAsAdmin.contains(f.getTaxAgentId())
// 作为分管理员
|| TaxAgentBO.checkTaxAgentAndEmployee(taxAgentEmployees, f.getTaxAgentId(), f.getEmployeeId())
// 作为管理员
taxAgentIdsAsAdmin.contains(f.getTaxAgentId())
// 作为分管理员
|| TaxAgentBO.checkTaxAgentAndEmployee(taxAgentEmployees, f.getTaxAgentId(), f.getEmployeeId())
).collect(Collectors.toList());
}

View File

@ -20,6 +20,7 @@ import com.engine.salary.entity.datacollection.param.AddUpSituationQueryParam;
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.datacollection.AddUpSituationMapper;
import com.engine.salary.service.AddUpDeductionService;
@ -608,8 +609,8 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
//相同的姓名
String userName = dto.getUsername();
String deparmentName = dto.getDepartmentName();
List<Long> employeeSameIds = employees.stream().filter(e -> (StringUtils.isBlank(userName) || Objects.equals(e.getUsername(), userName))
&& (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName))).map(DataCollectionEmployee::getEmployeeId)
List<DataCollectionEmployee> employeeSameIds = employees.stream().filter(e -> (StringUtils.isBlank(userName) || Objects.equals(e.getUsername(), userName))
&& (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName)))
.collect(Collectors.toList());
@ -620,13 +621,24 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
errorMessageMap.put("message", rowIndex + "姓名不能为空");
errorData.add(errorMessageMap);
errorSum += 1;
} else if (CollectionUtils.isEmpty(employeeSameIds) || employeeSameIds.size() > 1) {
} else if (CollectionUtils.isEmpty(employeeSameIds)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "员工信息不能为空且不可重复(姓名与部门同时确认唯一)");
errorMessageMap.put("message", rowIndex + "员工信息不存在");
errorData.add(errorMessageMap);
errorSum += 1;
} else if (employeeSameIds.size() > 1) {
//存在离职和在职状态取在职状态
employeeSameIds = employeeSameIds.stream()
.filter(e -> UserStatusEnum.getNormalStatus().contains(e.getStatus()))
.collect(Collectors.toList());
if (employeeSameIds.size() != 1) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "员工信息不能为空且不可重复(姓名与部门同时确认唯一)");
errorData.add(errorMessageMap);
errorSum += 1;
}
} else {
Long employeeId = CollectionUtils.isNotEmpty(employeeSameIds) && employeeSameIds.size() == 1 ? employeeSameIds.get(0) : null;
Long employeeId = CollectionUtils.isNotEmpty(employeeSameIds) && employeeSameIds.size() == 1 ? employeeSameIds.get(0).getEmployeeId() : null;
if (employeeId != null && employeeId > 0) {
po.setEmployeeId(employeeId);
} else {

View File

@ -638,15 +638,13 @@ public class AttendQuoteDataServiceImpl extends Service implements AttendQuoteDa
if (SalaryI18nUtil.getI18nLabel(85429, "姓名").equals(key.toString())) {
if (StringUtils.isEmpty(cellVal)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", SalaryI18nUtil.getI18nLabel(100579, "不能为空"));
errorMessageMap.put("message", SalaryI18nUtil.getI18nLabel(100579, "姓名不能为空"));
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel( 100577, "不能为空"), errorCount + 1, errorCount + 1, j, j);
errorSum += 1;
} else if (CollectionUtils.isEmpty(employeeSameIds) || employeeSameIds.size() > 1) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", SalaryI18nUtil.getI18nLabel(100579, "员工信息不能为空且不可重复(姓名与部门同时确认唯一)"));
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel( 100578, "员工信息不能为空且不可重复(姓名与部门同时确认唯一)"), errorCount + 1, errorCount + 1, j, j);
errorSum += 1;
} else {
Long employeeId = CollectionUtils.isNotEmpty(employeeSameIds) && employeeSameIds.size() == 1 ? employeeSameIds.get(0) : null;
@ -656,7 +654,6 @@ public class AttendQuoteDataServiceImpl extends Service implements AttendQuoteDa
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", SalaryI18nUtil.getI18nLabel(100579, "姓名错误,系统内不存在该姓名"));
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel( 100579, "姓名错误,系统内不存在该姓名"), errorCount + 1, errorCount + 1, j, j);
errorSum += 1;
}
}

View File

@ -8,7 +8,6 @@ import com.engine.core.impl.Service;
import com.engine.salary.biz.EmployBiz;
import com.engine.salary.biz.SISchemeBiz;
import com.engine.salary.cmd.sischeme.*;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.encrypt.AESEncryptUtil;
import com.engine.salary.encrypt.siarchives.InsuranceArchivesFundSchemePOEncrypt;
import com.engine.salary.encrypt.siarchives.InsuranceArchivesOtherSchemePOEncrypt;
@ -108,37 +107,37 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
@Override
public Map<String, Object> getForm(Map<String, Object> params) {
return commandExecutor.execute(new SISchemeGetFormCmd(params,user));
return commandExecutor.execute(new SISchemeGetFormCmd(params, user));
}
@Override
public Map<String, Object> insertScheme(Map<String, Object> params) {
return commandExecutor.execute(new SISchemeInsertCmd(params,user));
return commandExecutor.execute(new SISchemeInsertCmd(params, user));
}
@Override
public Map<String, Object> update(Map<String, Object> params) {
return commandExecutor.execute(new SISchemeUpdateCmd(params,user));
return commandExecutor.execute(new SISchemeUpdateCmd(params, user));
}
@Override
public Map<String, Object> delete(Map<String, Object> params) {
return commandExecutor.execute(new SISchemeDeleteCmd(params,user));
return commandExecutor.execute(new SISchemeDeleteCmd(params, user));
}
@Override
public Map<String, Object> copyScheme(Map<String, Object> params) {
return commandExecutor.execute(new SISchemeCopyCmd(params,user));
return commandExecutor.execute(new SISchemeCopyCmd(params, user));
}
@Override
public List<InsuranceSchemeDetailPO> queryListByInsuranceIdIsPayment(Long insuranceId, Integer isPayment) {
return new SISchemeBiz().queryListByInsuranceIdIsPayment(insuranceId,isPayment);
return new SISchemeBiz().queryListByInsuranceIdIsPayment(insuranceId, isPayment);
}
@Override
public Map<String, Object> listPage(Map<String, Object> params) {
return commandExecutor.execute(new SISchemeListCmd(params,user));
return commandExecutor.execute(new SISchemeListCmd(params, user));
}
@Override
@ -153,7 +152,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
@Override
public PageInfo<InsuranceSchemeListDTO> list(InsuranceSchemeParam queryParam) {
SalaryAssert.notNull(queryParam.getWelfareTypeEnum(), SalaryI18nUtil.getI18nLabel( 84026, "参数错误"));
SalaryAssert.notNull(queryParam.getWelfareTypeEnum(), SalaryI18nUtil.getI18nLabel(84026, "参数错误"));
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<InsuranceSchemePO> insuranceSchemePOS = MapperProxyFactory.getProxy(InsuranceSchemeMapper.class).listByWelfareType(queryParam.getWelfareTypeEnum().getValue());
@ -161,7 +160,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
List<InsuranceSchemeListDTO> collect = insuranceSchemePOS.stream().map(item ->
InsuranceSchemeListDTO.builder()
.id(item.getId())
.paymentType(SalaryI18nUtil.getI18nLabel( buildPaymentTypeEnum(item.getPaymentType()).getLabelId(),
.paymentType(SalaryI18nUtil.getI18nLabel(buildPaymentTypeEnum(item.getPaymentType()).getLabelId(),
buildPaymentTypeEnum(item.getPaymentType()).getDefaultLabel()))
.schemeName(item.getSchemeName())
.paymentArea(item.getPaymentArea())
@ -203,9 +202,9 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
List<InsuranceArchivesFundSchemePO> fundList = new ArrayList<>();
List<InsuranceArchivesOtherSchemePO> otherList = new ArrayList<>();
for(int i = 0; i < employeeIds.size(); i+=1000) {
for (int i = 0; i < employeeIds.size(); i += 1000) {
int end = i + 1000;
if(i + 1000 >= employeeIds.size()) {
if (i + 1000 >= employeeIds.size()) {
end = employeeIds.size();
}
List<Long> ids = employeeIds.subList(i, end);
@ -313,7 +312,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
try {
Object o = recordData.get(column.getColumn());
row.add(o.toString());
} catch(Exception e) {
} catch (Exception e) {
row.add("");
}
}
@ -332,7 +331,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
// .dataType(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 99915, "档案"))
// .function(exportMap.get("function")).build(), sheetList);
//获取excel
return ExcelUtil.genWorkbook(rows,"福利档案");
return ExcelUtil.genWorkbook(rows, "福利档案");
}
@ -348,7 +347,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
* 3根据查询出来的福利id去福利表里面查询福利的名称
* 4组装分割
*
* @param id 福利方案主表id
* @param id 福利方案主表id
* @return result
*/
public String buildPaymentScope(Long id) {
@ -387,32 +386,31 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
public List<WeaTableColumn> buildWeaTableColumns(List<InsuranceArchivesEmployeePO> insuranceArchivesEmployeePOS, Long employeeId) {
Map<Integer, Map<String, String>> titleMap = buildColumnTitle(insuranceArchivesEmployeePOS, employeeId);
List<WeaTableColumn> list = new ArrayList<>();
WeaTableColumn nameColumn = new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel( 85429, "姓名"), "employeeName");
WeaTableColumn nameColumn = new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(85429, "姓名"), "employeeName");
nameColumn.setFixed("left");
list.add(nameColumn);
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(86185, "部门"), "departmentName"));
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel( 86186, "手机号"), "mobile"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel(86187, "员工状态"), "status"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91323, "社保方案名称"), "socialName"));
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(86186, "手机号"), "mobile"));
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(86187, "员工状态"), "status"));
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91323, "社保方案名称"), "socialName"));
titleMap.get(WelfareTypeEnum.SOCIAL_SECURITY.getValue()).forEach((k, v) -> list.add(new WeaTableColumn("150px", v, k)));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91324, "社保账号"), "socialAccount"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel(91319, "社保起始缴纳月"), "socialStartTime"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91320, "社保最后缴纳月"), "socialEndTime"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel(91485, "公积金方案名称"), "fundName"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91486, "公积金账号"), "fundAccount"));
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91324, "社保账号"), "socialAccount"));
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91319, "社保起始缴纳月"), "socialStartTime"));
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91320, "社保最后缴纳月"), "socialEndTime"));
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91485, "公积金方案名称"), "fundName"));
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91486, "公积金账号"), "fundAccount"));
titleMap.get(WelfareTypeEnum.ACCUMULATION_FUND.getValue()).forEach((k, v) -> list.add(new WeaTableColumn("150px", v, k)));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel(91487, "补充公积金账号"), "supplementFundAccount"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel(91483, "公积金起始缴纳月"), "fundStartTime"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel(91484, "公积金最后缴纳月"), "fundEndTime"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称"), "otherName"));
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91487, "补充公积金账号"), "supplementFundAccount"));
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91483, "公积金起始缴纳月"), "fundStartTime"));
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91484, "公积金最后缴纳月"), "fundEndTime"));
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称"), "otherName"));
titleMap.get(WelfareTypeEnum.OTHER.getValue()).forEach((k, v) -> list.add(new WeaTableColumn("150px", v, k)));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel(91490, "其他福利起始缴纳月"), "otherStartTime"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel(91494, "其他福利最后缴纳月"), "otherEndTime"));
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91490, "其他福利起始缴纳月"), "otherStartTime"));
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91494, "其他福利最后缴纳月"), "otherEndTime"));
return list;
}
public Map<Integer, Map<String, String>> buildColumnTitle(List<InsuranceArchivesEmployeePO> insuranceArchivesEmployeePOS, Long employeeId) {
Map<Integer, Map<String, String>> result = new HashMap<>();
Set<String> socialSet = new HashSet<>();
@ -424,7 +422,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
}});
InsuranceArchivesSocialSchemePOEncrypt.decryptList(socialByEmployeeId);
InsuranceArchivesSocialSchemePO socialItem = null;
if(socialByEmployeeId.size() > 0) {
if (socialByEmployeeId.size() > 0) {
socialItem = socialByEmployeeId.get(0);
}
InsuranceArchivesFundSchemePO fundItem = null;
@ -434,7 +432,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
}});
InsuranceArchivesFundSchemePOEncrypt.decryptList(fundByEmployeeId);
if(fundByEmployeeId.size() > 0) {
if (fundByEmployeeId.size() > 0) {
fundItem = fundByEmployeeId.get(0);
}
InsuranceArchivesOtherSchemePO otherItem = null;
@ -443,7 +441,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
add(item.getEmployeeId());
}});
InsuranceArchivesOtherSchemePOEncrypt.decryptList(otherByEmployeeId);
if(otherByEmployeeId.size() > 0) {
if (otherByEmployeeId.size() > 0) {
otherItem = otherByEmployeeId.get(0);
}
@ -482,7 +480,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
socialCollect.putAll(sysSocial);
socialSet.forEach(item -> {
if (socialCollect.containsKey(Long.valueOf(item))) {
socialMap.put(item, socialCollect.get(Long.valueOf(item)).getInsuranceName() + SalaryI18nUtil.getI18nLabel( 100293, "申报基数"));
socialMap.put(item, socialCollect.get(Long.valueOf(item)).getInsuranceName() + SalaryI18nUtil.getI18nLabel(100293, "申报基数"));
}
});
Map<String, String> fundMap = new HashMap<>();
@ -497,7 +495,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
fundCollect.putAll(sysFund);
fundSet.forEach(item -> {
if (fundCollect.containsKey(Long.valueOf(item))) {
fundMap.put(item, fundCollect.get(Long.valueOf(item)).getInsuranceName() + SalaryI18nUtil.getI18nLabel( 100293, "申报基数"));
fundMap.put(item, fundCollect.get(Long.valueOf(item)).getInsuranceName() + SalaryI18nUtil.getI18nLabel(100293, "申报基数"));
}
});
Map<String, String> otherMap = new HashMap<>();
@ -512,7 +510,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
otherCollect.putAll(sysOther);
otherSet.forEach(item -> {
if (otherCollect.containsKey(Long.valueOf(item))) {
otherMap.put(item, otherCollect.get(Long.valueOf(item)).getInsuranceName() + SalaryI18nUtil.getI18nLabel( 100293, "申报基数"));
otherMap.put(item, otherCollect.get(Long.valueOf(item)).getInsuranceName() + SalaryI18nUtil.getI18nLabel(100293, "申报基数"));
}
});
@ -548,7 +546,6 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
ValidUtil.doValidator(param);
// List<ExcelSheet> excelSheets = message.getBatchFile().getExcelSheets();
// 租户key
// String tenantKey = message.getTenantKey().toLowerCase();
@ -558,7 +555,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
Map<String, Long> schemeNameIdMap = schemeNameIdMap();
Map<Long, String> welfareMap = welfareMap();
// 获取所有个税扣缴义务人的名称和id的map
Map<String, Long> paymentNameIdMap = getTaxAgentService().listAllTaxAgentsAsAdmin((long)user.getUID()).stream().collect(Collectors.toMap(TaxAgentPO::getName, TaxAgentPO::getId));
Map<String, Long> paymentNameIdMap = getTaxAgentService().listAllTaxAgentsAsAdmin((long) user.getUID()).stream().collect(Collectors.toMap(TaxAgentPO::getName, TaxAgentPO::getId));
// 获取所有人员信息
// 获取租户下所有的人员
List<DataCollectionEmployee> employeeByIds = employeeBiz.listEmployee();
@ -657,7 +654,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
private String userStateExchange(String userState) {
UserStatusEnum[] values = UserStatusEnum.values();
for (UserStatusEnum value : values) {
if(value.getDescription().equals(userState)) {
if (value.getDescription().equals(userState)) {
return value.getValue() + "";
}
}
@ -676,24 +673,38 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
String rowIndex = "" + index + "";
if (StringUtils.isBlank(userName) && StringUtils.isBlank(deparmentName) && StringUtils.isBlank(telephone) && StringUtils.isBlank(userStatus)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + " 用户名、部门名称、手机号、用户状态" +SalaryI18nUtil.getI18nLabel(100303, "不能同时为空"));
errorMessageMap.put("message", rowIndex + " 用户名、部门名称、手机号、用户状态" + SalaryI18nUtil.getI18nLabel(100303, "不能同时为空"));
excelComments.add(errorMessageMap);
isError = true;
}
List<Long> employees = employeeByIds.stream().filter(e -> (StringUtils.isBlank(userName) || Objects.equals(e.getUsername(), userName))
List<DataCollectionEmployee> employees = employeeByIds.stream().filter(e -> (StringUtils.isBlank(userName) || Objects.equals(e.getUsername(), userName))
&& (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName))
&& (StringUtils.isBlank(telephone) || Objects.equals(e.getMobile(), telephone))
&& (StringUtils.isBlank(userStatus) || Objects.equals(userStateExchange(e.getStatus()), userStatus))).map(DataCollectionEmployee::getEmployeeId)
&& (StringUtils.isBlank(userStatus) || Objects.equals(userStateExchange(e.getStatus()), userStatus)))
.collect(Collectors.toList());
if (CollectionUtils.isEmpty(employees) || employees.size() > 1) {
if (CollectionUtils.isEmpty(employees)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100304, "员工信息不存在或者存在多个员工"));
errorMessageMap.put("message", rowIndex + "员工信息不存在");
excelComments.add(errorMessageMap);
isError = true;
} else {
//含在职和离职选在职数据
if (employees.size() > 1) {
employees = employees.stream()
.filter(e -> UserStatusEnum.getNormalStatus().contains(e.getStatus()))
.collect(Collectors.toList());
if (employees.size() != 1) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100304, "员工信息不存在或者存在多个员工"));
excelComments.add(errorMessageMap);
isError = true;
}
}
}
Long employeeId = null;
if (CollectionUtils.isNotEmpty(employees) && employees.size() == 1) {
employeeId = employees.get(0);
employeeId = employees.get(0).getEmployeeId();
}
InsuranceArchivesAccountPO insuranceArchivesAccountPO = new InsuranceArchivesAccountPO();
InsuranceArchivesSocialSchemePO insuranceArchivesSocialSchemePO = null;
@ -718,7 +729,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
}
String socialStartMonth = (String) socialStartTimeMap.get(SalaryI18nUtil.getI18nLabel(91319, "社保起始缴纳月"));
if(StringUtils.isNotBlank(socialStartMonth) && socialStartMonth.length() > 7) {
if (StringUtils.isNotBlank(socialStartMonth) && socialStartMonth.length() > 7) {
socialStartMonth = socialStartMonth.substring(0, 7);
}
if (StringUtils.isNotBlank(socialStartMonth) && !SalaryDateUtil.checkYearMonth(socialStartMonth)) {
@ -729,7 +740,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
}
String socialEndMonth = (String) socialEndTimeMap.get(SalaryI18nUtil.getI18nLabel(91320, "社保最后缴纳月"));
if(StringUtils.isNotBlank(socialEndMonth) && socialEndMonth.length() > 7) {
if (StringUtils.isNotBlank(socialEndMonth) && socialEndMonth.length() > 7) {
socialEndMonth = socialEndMonth.substring(0, 7);
}
if (StringUtils.isNotBlank(socialEndMonth) && !SalaryDateUtil.checkYearMonth(socialEndMonth)) {
@ -740,7 +751,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
}
String fundStartMonth = (String) fundStartTimeMap.get(SalaryI18nUtil.getI18nLabel(91483, "公积金起始缴纳月"));
if(StringUtils.isNotBlank(fundStartMonth) && fundStartMonth.length() > 7) {
if (StringUtils.isNotBlank(fundStartMonth) && fundStartMonth.length() > 7) {
fundStartMonth = fundStartMonth.substring(0, 7);
}
if (StringUtils.isNotBlank(fundStartMonth) && !SalaryDateUtil.checkYearMonth(fundStartMonth)) {
@ -751,7 +762,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
}
String fundEndMonth = (String) fundEndTimeMap.get(SalaryI18nUtil.getI18nLabel(91484, "公积金最后缴纳月"));
if(StringUtils.isNotBlank(fundEndMonth) && fundEndMonth.length() > 7) {
if (StringUtils.isNotBlank(fundEndMonth) && fundEndMonth.length() > 7) {
fundEndMonth = fundEndMonth.substring(0, 7);
}
if (StringUtils.isNotBlank(fundEndMonth) && !SalaryDateUtil.checkYearMonth(fundEndMonth)) {
@ -762,7 +773,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
}
String otherStartMonth = (String) otherStartTimeMap.get(SalaryI18nUtil.getI18nLabel(91490, "其他福利起始缴纳月"));
if(StringUtils.isNotBlank(otherStartMonth) && otherStartMonth.length() > 7) {
if (StringUtils.isNotBlank(otherStartMonth) && otherStartMonth.length() > 7) {
otherStartMonth = otherStartMonth.substring(0, 7);
}
if (StringUtils.isNotBlank(otherStartMonth) && !SalaryDateUtil.checkYearMonth(otherStartMonth)) {
@ -773,7 +784,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
}
String otherEndMonth = (String) otherEndTimeMap.get(SalaryI18nUtil.getI18nLabel(91494, "其他福利最后缴纳月"));
if(StringUtils.isNotBlank(otherEndMonth) && otherEndMonth.length() > 7) {
if (StringUtils.isNotBlank(otherEndMonth) && otherEndMonth.length() > 7) {
otherEndMonth = otherEndMonth.substring(0, 7);
}
if (StringUtils.isNotBlank(otherEndMonth) && !SalaryDateUtil.checkYearMonth(otherEndMonth)) {
@ -841,17 +852,17 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
insuranceArchivesSocialSchemePO.setSocialAccount((String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91324, "社保账号")).get(
SalaryI18nUtil.getI18nLabel(91324, "社保账号")));
insuranceArchivesSocialSchemePO.setSocialSchemeId(schemeNameIdMap.get(
(String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel( 91323, "社保方案名称")).get(
(String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91323, "社保方案名称")).get(
SalaryI18nUtil.getI18nLabel(91323, "社保方案名称"))));
String socialStartDate = (String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91319, "社保起始缴纳月")).get(
SalaryI18nUtil.getI18nLabel(91319, "社保起始缴纳月"));
if(StringUtils.isNotBlank(socialStartDate) && socialStartDate.length() > 7) {
if (StringUtils.isNotBlank(socialStartDate) && socialStartDate.length() > 7) {
socialStartDate = socialStartDate.substring(0, 7);
}
insuranceArchivesSocialSchemePO.setSocialStartTime(socialStartDate);
String socialEndDate = (String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91320, "社保最后缴纳月")).get(
SalaryI18nUtil.getI18nLabel(91320, "社保最后缴纳月"));
if(StringUtils.isNotBlank(socialEndDate) && socialEndDate.length() > 7) {
if (StringUtils.isNotBlank(socialEndDate) && socialEndDate.length() > 7) {
socialEndDate = socialEndDate.substring(0, 7);
}
insuranceArchivesSocialSchemePO.setSocialEndTime(socialEndDate);
@ -910,15 +921,15 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
insuranceArchivesFundSchemePO.setSupplementFundAccount((String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91487, "补充公积金账号")).get(
SalaryI18nUtil.getI18nLabel(91487, "补充公积金账号")));
String fundStartDate = (String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91483, "公积金起始缴纳月")).get(
SalaryI18nUtil.getI18nLabel( 91483, "公积金起始缴纳月"));
if(StringUtils.isNotBlank(fundStartDate) && fundStartDate.length() > 7) {
SalaryI18nUtil.getI18nLabel(91483, "公积金起始缴纳月"));
if (StringUtils.isNotBlank(fundStartDate) && fundStartDate.length() > 7) {
fundStartDate = fundStartDate.substring(0, 7);
}
insuranceArchivesFundSchemePO.setFundStartTime(fundStartDate);
String fundEndDate = (String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91484, "公积金最后缴纳月")).get(
SalaryI18nUtil.getI18nLabel(91484, "公积金最后缴纳月"));
if(StringUtils.isNotBlank(fundEndDate) && fundEndDate.length() > 7) {
if (StringUtils.isNotBlank(fundEndDate) && fundEndDate.length() > 7) {
fundEndDate = fundEndDate.substring(0, 7);
}
insuranceArchivesFundSchemePO.setFundEndTime(fundEndDate);
@ -969,13 +980,13 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称"))));
String otherStartDate = (String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91490, "其他福利起始缴纳月")).get(
SalaryI18nUtil.getI18nLabel(91490, "其他福利起始缴纳月"));
if(StringUtils.isNotBlank(otherStartDate) && otherStartDate.length() > 7) {
if (StringUtils.isNotBlank(otherStartDate) && otherStartDate.length() > 7) {
otherStartDate = otherStartDate.substring(0, 7);
}
insuranceArchivesOtherSchemePO.setOtherStartTime(otherStartDate);
String otherEndDate = (String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91494, "其他福利最后缴纳月")).get(
SalaryI18nUtil.getI18nLabel(91494, "其他福利最后缴纳月"));
if(StringUtils.isNotBlank(otherEndDate) && otherEndDate.length() > 7) {
if (StringUtils.isNotBlank(otherEndDate) && otherEndDate.length() > 7) {
otherEndDate = otherEndDate.substring(0, 7);
}
insuranceArchivesOtherSchemePO.setOtherEndTime(otherEndDate);
@ -1049,7 +1060,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
/**
* 导出档案导入所需要的模板可根据开关选择是否导出现有的档案数据
*
* @param param 是否导出带档案数据的模板
* @param param 是否导出带档案数据的模板
*/
public XSSFWorkbook exportTemplate(InsuranceArchivesListParam param) {
return getSIImportService().exportTemplate(param);
@ -1067,5 +1078,4 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
}
}