1、福利方案分权

2、累计、往期、其他导入分权
3、导入精度
This commit is contained in:
钱涛 2022-08-25 16:46:12 +08:00
parent bc794b4585
commit bfcda3525a
8 changed files with 173 additions and 110 deletions

View File

@ -95,6 +95,10 @@ public class SIAccountBiz extends Service {
return MapperProxyFactory.getProxy(SIAccountUtilMapper.class);
}
private InsuranceAccountInspectMapper getInsuranceAccountInspectMapper() {
return MapperProxyFactory.getProxy(InsuranceAccountInspectMapper.class);
}
public PageInfo<InsuranceAccountBatchPO> listPage(InsuranceAccountBatchParam queryParam) {
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<InsuranceAccountBatchPO> list = getInsuranceAccountBatchMapper().list(queryParam);
@ -732,33 +736,14 @@ public class SIAccountBiz extends Service {
}
public void batchDelInspectDetail(List<InsuranceAccountInspectPO> list) {
MapperProxyFactory.getProxy(InsuranceAccountInspectMapper.class).batchDelInspectDetails(list);
//上报删除日志
// list.forEach(item -> {
// LoggerContext<InsuranceAccountInspectPO> insuranceSchemeContext = new LoggerContext<>();
// insuranceSchemeContext.setTargetId(String.valueOf(item.getId()));
// insuranceSchemeContext.setTargetName(String.valueOf(item.getEmployeeId()));
// insuranceSchemeContext.setOperateType(OperateTypeEnum.DELETE.getValue());
// insuranceSchemeContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(100445, "删除核算异常记录"));
// insuranceSchemeContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(100445, "删除核算异常记录"));
// insuranceSchemeContext.setNewValues(item);
// siAccountLoggerTemplate.write(insuranceSchemeContext);
// });
List<List<InsuranceAccountInspectPO>> lists = Lists.partition(list, 100);
lists.forEach(getInsuranceAccountInspectMapper()::batchDelInspectDetails);
}
public void batchSaveInspectDetail(List<InsuranceAccountInspectPO> list) {
MapperProxyFactory.getProxy(InsuranceAccountInspectMapper.class).batchSaveInspectDetails(list);
//上报新增日志
// list.forEach(item -> {
// LoggerContext<InsuranceAccountInspectPO> insuranceSchemeContext = new LoggerContext<>();
// insuranceSchemeContext.setTargetId(String.valueOf(item.getId()));
// insuranceSchemeContext.setTargetName(String.valueOf(item.getEmployeeId()));
// insuranceSchemeContext.setOperateType(OperateTypeEnum.ADD.getValue());
// insuranceSchemeContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(100447, "新建核算异常记录"));
// insuranceSchemeContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(100447, "新建核算异常记录"));
// insuranceSchemeContext.setNewValues(item);
// siAccountLoggerTemplate.write(insuranceSchemeContext);
// });
List<List<InsuranceAccountInspectPO>> lists = Lists.partition(list, 100);
lists.forEach(getInsuranceAccountInspectMapper()::batchSaveInspectDetails);
}

View File

@ -33,7 +33,6 @@ import java.util.stream.Collectors;
/**
* @Author weaver_cl
*
* @Date 2022/3/7
* @Version V1.0
**/
@ -42,15 +41,17 @@ public class SISchemeBiz {
private SIAccountUtilMapper getSIAccountUtilMapper() {
return SqlProxyHandle.getProxy(SIAccountUtilMapper.class);
}
/**
* 获取社保方案
*
* @param id
* @param welfareTypeEnum
* @return
*/
public InsuranceSchemeFormVO getForm(Long id, WelfareTypeEnum welfareTypeEnum) {
InsuranceSchemeDTO insuranceSchemeDTO = getSchemeFormDTO(welfareTypeEnum,id);
List<InsuranceSchemeDetailDTO> insuranceSchemeDetailDTOList = getSchemeDetailFormDTO(welfareTypeEnum,id);
public InsuranceSchemeFormVO getForm(Long id, WelfareTypeEnum welfareTypeEnum) {
InsuranceSchemeDTO insuranceSchemeDTO = getSchemeFormDTO(welfareTypeEnum, id);
List<InsuranceSchemeDetailDTO> insuranceSchemeDetailDTOList = getSchemeDetailFormDTO(welfareTypeEnum, id);
return InsuranceSchemeFormVO.builder().schemeBatch(insuranceSchemeDTO).schemeDetailList(insuranceSchemeDetailDTOList).build();
}
@ -68,7 +69,7 @@ public class SISchemeBiz {
PaymentScopeEnum[] paymentScopeEnums = SalaryEnumUtil.stringToEnums(item.getPaymentScope(), ",");
Arrays.stream(paymentScopeEnums).forEach(e -> {
InsuranceSchemeDetailDTO insuranceSchemeDetailDTO = InsuranceSchemeDetailDTO.builder().build();
InsuranceSchemeDetailPO insuranceSchemeDetailPO = getByPPI(id,e.getValue(),item.getId());
InsuranceSchemeDetailPO insuranceSchemeDetailPO = getByPPI(id, e.getValue(), item.getId());
if (insuranceSchemeDetailPO == null) {
insuranceSchemeDetailDTO = InsuranceSchemeDetailDTO.builder()
.id((long) (Math.random() * 10000))
@ -125,6 +126,7 @@ public class SISchemeBiz {
/**
* 根据福利类型获取
*
* @param welfareType
* @return
*/
@ -132,7 +134,7 @@ public class SISchemeBiz {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
ICategoryMapper iCategoryMapper = sqlSession.getMapper(ICategoryMapper.class);
List<ICategoryPO> insuranceCategoryPOS = iCategoryMapper.listByWelfareType(welfareType,null);
List<ICategoryPO> insuranceCategoryPOS = iCategoryMapper.listByWelfareType(welfareType, null);
return insuranceCategoryPOS;
} finally {
sqlSession.close();
@ -150,7 +152,7 @@ public class SISchemeBiz {
InsuranceSchemeDetailPO insuranceSchemeDetailPO = insuranceSchemeDetailMapper.getByPPI(primaryId, paymentScope, insuranceId);
InsuranceSchemeDetailPOEncrypt.decryptItem(insuranceSchemeDetailPO);
return insuranceSchemeDetailPO;
}finally {
} finally {
sqlSession.close();
}
}
@ -167,7 +169,7 @@ public class SISchemeBiz {
InsuranceSchemeDTO insuranceSchemeDTO = InsuranceSchemeDTO.builder().paymentType(PaymentTypeEnum.SCHEME_TOWN).welfareType(welfareTypeEnum).build();
if (id != null) {
InsuranceSchemePO insuranceSchemePO = getById(id);
SalaryAssert.notNull(insuranceSchemePO,"福利方案不存在");
SalaryAssert.notNull(insuranceSchemePO, "福利方案不存在");
//BeanUtils.copyProperties(insuranceSchemePO, insuranceSchemeDTO);
insuranceSchemeDTO.setId(insuranceSchemePO.getId());
insuranceSchemeDTO.setPaymentArea(insuranceSchemePO.getPaymentArea());
@ -175,12 +177,15 @@ public class SISchemeBiz {
insuranceSchemeDTO.setSchemeName(insuranceSchemePO.getSchemeName());
insuranceSchemeDTO.setPaymentType(SalaryEnumUtil.enumMatchByValue(insuranceSchemePO.getPaymentType(), PaymentTypeEnum.values(), PaymentTypeEnum.class));
insuranceSchemeDTO.setWelfareType(welfareTypeEnum);
insuranceSchemeDTO.setSharedType(insuranceSchemePO.getSharedType() == null ? "0" : insuranceSchemePO.getSharedType());
insuranceSchemeDTO.setTaxAgentIds(insuranceSchemePO.getSharedType());
}
return insuranceSchemeDTO;
}
/**
*社保方案基础信息主表
* 社保方案基础信息主表
*
* @param id
* @return
*/
@ -200,6 +205,7 @@ public class SISchemeBiz {
/**
* 获取所有方案
*
* @return
*/
public List<InsuranceSchemePO> listAll() {
@ -215,9 +221,9 @@ public class SISchemeBiz {
}
/**
* 社保方案基础信息明细表
*
* @param primaryId
* @return
*/
@ -236,25 +242,36 @@ public class SISchemeBiz {
/**
* 新增
*
* @param saveParam
* @param employeeId
*/
public void save(InsuranceSchemeReqParam saveParam, long employeeId) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try{
try {
//保存福利项目主表
InsuranceSchemeMapper insuranceSchemeMapper = sqlSession.getMapper(InsuranceSchemeMapper.class);
List<InsuranceSchemePO> listResult = insuranceSchemeMapper.listByName(saveParam.getInsuranceScheme().getSchemeName());
SalaryAssert.isEmpty(listResult, "该福利名称已经存在,福利名称系统全局唯一");
SalaryAssert.isEmpty(listResult, "该福利名称已经存在,福利名称系统全局唯一");
InsuranceSchemePO insuranceSchemePO = InsuranceSchemeBO.convert2BatchPO(saveParam.getInsuranceScheme(), employeeId);
if (insuranceSchemePO.getSharedType() == null) {
insuranceSchemePO.setSharedType(SharedTypeEnum.PUBLIC.getValue());
} else {
if (insuranceSchemePO.getSharedType().equals(SharedTypeEnum.PRIVATE.getValue()) && StringUtils.isBlank(insuranceSchemePO.getTaxAgentIds())) {
throw new SalaryRunTimeException("方案可见性为私有时,未设置可见范围");
}
}
insuranceSchemeMapper.insert(insuranceSchemePO);
//日志
//保存福利项目明细表
InsuranceSchemeDetailMapper insuranceSchemeDetailMapper = sqlSession.getMapper(InsuranceSchemeDetailMapper.class);
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = InsuranceSchemeBO.convertToInsuranceSchemeDetailPoList(saveParam.getInsuranceSchemeDetailList(),employeeId,insuranceSchemePO.getId());
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = InsuranceSchemeBO.convertToInsuranceSchemeDetailPoList(saveParam.getInsuranceSchemeDetailList(), employeeId, insuranceSchemePO.getId());
InsuranceSchemeDetailPOEncrypt.encryptList(insuranceSchemeDetailPOS);
insuranceSchemeDetailPOS.forEach(insuranceSchemeDetailMapper::insert);
@ -269,6 +286,7 @@ public class SISchemeBiz {
/**
* 更新
*
* @param updateParam
* @param employeeId
*/
@ -286,9 +304,17 @@ public class SISchemeBiz {
//福利方案名称重复
List<InsuranceSchemePO> insuranceSchemePOList = insuranceSchemeMapper.listByName(updateParam.getInsuranceScheme().getSchemeName());
if(CollectionUtils.isNotEmpty(insuranceSchemePOList)) {
if (CollectionUtils.isNotEmpty(insuranceSchemePOList)) {
boolean repeat = insuranceSchemePOList.stream().anyMatch(item -> !Objects.equals(item.getId(), updateParam.getInsuranceScheme().getId()));
SalaryAssert.isTrue(!repeat,"福利方案名称重复");
SalaryAssert.isTrue(!repeat, "福利方案名称重复");
}
if (insuranceSchemePO.getSharedType() == null) {
insuranceSchemePO.setSharedType(SharedTypeEnum.PUBLIC.getValue());
} else {
if (insuranceSchemePO.getSharedType().equals(SharedTypeEnum.PRIVATE.getValue()) && StringUtils.isBlank(insuranceSchemePO.getTaxAgentIds())) {
throw new SalaryRunTimeException("方案可见性为私有时,未设置可见范围");
}
}
//更新福利方案主表
@ -305,7 +331,7 @@ public class SISchemeBiz {
//记录操作日志
sqlSession.commit();
}finally {
} finally {
sqlSession.close();
}
@ -313,6 +339,7 @@ public class SISchemeBiz {
/**
* 复制方案
*
* @param id
* @param schemeName
* @param employeeId
@ -322,14 +349,14 @@ public class SISchemeBiz {
try {
InsuranceSchemeMapper insuranceSchemeMapper = sqlSession.getMapper(InsuranceSchemeMapper.class);
List<InsuranceSchemePO> listResult = insuranceSchemeMapper.listByName(schemeName);
SalaryAssert.isEmpty(listResult, "方案名称重复");
SalaryAssert.isEmpty(listResult, "方案名称重复");
InsuranceSchemeDetailMapper insuranceSchemeDetailMapper = sqlSession.getMapper(InsuranceSchemeDetailMapper.class);
if (Objects.isNull(id)) {
throw new SalaryRunTimeException("方案id为空");
}
if(Objects.isNull(schemeName)) {
if (Objects.isNull(schemeName)) {
throw new SalaryRunTimeException("复制方案名为空");
}
@ -385,13 +412,14 @@ public class SISchemeBiz {
}
sqlSession.commit();
}finally {
} finally {
sqlSession.close();
}
}
/**
* 根据险种id和是否缴费查询社保方案明细表
*
* @param insuranceId 险种id
* @param isPayment 是否缴费
* @return list
@ -400,11 +428,11 @@ public class SISchemeBiz {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
InsuranceSchemeDetailMapper insuranceSchemeDetailMapper = sqlSession.getMapper(InsuranceSchemeDetailMapper.class);
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOList = insuranceSchemeDetailMapper.queryListByInsuranceIdIsPayment(insuranceId,isPayment);
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOList = insuranceSchemeDetailMapper.queryListByInsuranceIdIsPayment(insuranceId, isPayment);
InsuranceSchemeDetailPOEncrypt.decryptList(insuranceSchemeDetailPOList);
return insuranceSchemeDetailPOList;
}finally {
sqlSession.close();
} finally {
sqlSession.close();
}
}
@ -441,34 +469,37 @@ public class SISchemeBiz {
item.setLowerLimit(AESEncryptUtil.decrypt(item.getLowerLimit()));
return item;
}
public int checkBeforeDeleteSocialscheme(Map<String, Object> params){
return getSIAccountUtilMapper().checkBeforeDeleteSocialscheme((Collection<Long>)params.get("ids")).get(0).getNum();
}
public int checkBeforeDeleteAccumulationfund(Map<String, Object> params){
return getSIAccountUtilMapper().checkBeforeDeleteAccumulationfund((Collection<Long>)params.get("ids")).get(0).getNum();
}
public int checkBeforeDeleteOtherscheme(Map<String, Object> params){
return getSIAccountUtilMapper().checkBeforeDeleteOtherscheme((Collection<Long>)params.get("ids")).get(0).getNum();
}
public int checkBeforeDeleteBill(Map<String, Object> params,Integer welfareTypeId){
return getSIAccountUtilMapper().checkBeforeDeleteBill((Collection<Long>)params.get("ids"),welfareTypeId).get(0).getNum();
public int checkBeforeDeleteSocialscheme(Map<String, Object> params) {
return getSIAccountUtilMapper().checkBeforeDeleteSocialscheme((Collection<Long>) params.get("ids")).get(0).getNum();
}
public void deleteSocialscheme(Map<String, Object> params){
public int checkBeforeDeleteAccumulationfund(Map<String, Object> params) {
return getSIAccountUtilMapper().checkBeforeDeleteAccumulationfund((Collection<Long>) params.get("ids")).get(0).getNum();
}
public int checkBeforeDeleteOtherscheme(Map<String, Object> params) {
return getSIAccountUtilMapper().checkBeforeDeleteOtherscheme((Collection<Long>) params.get("ids")).get(0).getNum();
}
public int checkBeforeDeleteBill(Map<String, Object> params, Integer welfareTypeId) {
return getSIAccountUtilMapper().checkBeforeDeleteBill((Collection<Long>) params.get("ids"), welfareTypeId).get(0).getNum();
}
public void deleteSocialscheme(Map<String, Object> params) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
InsuranceSchemeDetailMapper insuranceSchemeDetailMapper = sqlSession.getMapper(InsuranceSchemeDetailMapper.class);
InsuranceSchemeMapper insuranceSchemeMapper = sqlSession.getMapper(InsuranceSchemeMapper.class);
insuranceSchemeMapper.deleteByIds((Collection<Long>)params.get("ids"));
insuranceSchemeDetailMapper.deleteByIds((Collection<Long>)params.get("ids"));
insuranceSchemeMapper.deleteByIds((Collection<Long>) params.get("ids"));
insuranceSchemeDetailMapper.deleteByIds((Collection<Long>) params.get("ids"));
sqlSession.commit();
}finally {
} finally {
sqlSession.close();
}
}
}

View File

@ -163,7 +163,7 @@
c.id as jobtitleId,
e.companystartdate as companystartdate,
e.mobile as mobile,
e.enddate as dismissdate
e.enddate as dismissdate
from hrmresource e
left join hrmdepartment d on e.departmentid = d.id
left join hrmjobtitles c on e.jobtitle = c.id
@ -242,8 +242,11 @@
e.subcompanyid1 as subcompanyid,
e.costcenterid as costcenterId,
e.locationid as locationId,
e.jobtitle as jobtitleId
e.jobtitle as jobtitleId,
d.departmentname as departmentName,
d.id as departmentId
from hrmresource e
left join hrmdepartment d on e.departmentid = d.id
where e.status not in (7)
and (e.accounttype is null or e.accounttype = 0)
</select>

View File

@ -303,16 +303,16 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
}
// 分权判断
if (openDevolution) {
Optional<TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee> optionalTaxAgentEmp = taxAgentEmployees.stream().filter(f -> f.getEmployeeId().equals(addUpDeduction.getEmployeeId())).findFirst();
if (!optionalTaxAgentEmp.isPresent()) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "该条数据不在个税扣缴义务人人员范围内,不可导入");
errorData.add(errorMessageMap);
errorSum += 1;
}
}
//fixme 分权判断
// if (openDevolution) {
// Optional<TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee> optionalTaxAgentEmp = taxAgentEmployees.stream().filter(f -> f.getEmployeeId().equals(addUpDeduction.getEmployeeId())).findFirst();
// if (!optionalTaxAgentEmp.isPresent()) {
// Map<String, String> errorMessageMap = Maps.newHashMap();
// errorMessageMap.put("message", rowIndex + "该条数据不在个税扣缴义务人人员范围内,不可导入");
// errorData.add(errorMessageMap);
// errorSum += 1;
// }
// }
// 判断是否有核算过
if (CollectionUtils.isNotEmpty(salaryAcctEmployees)) {

View File

@ -680,16 +680,16 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
}
}
// 分权判断
if (openDevolution) {
Optional<TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee> optionalTaxAgentEmp = taxAgentEmployees.stream().filter(f -> f.getEmployeeId().equals(po.getEmployeeId())).findFirst();
if (!optionalTaxAgentEmp.isPresent()) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "该条数据不在个税扣缴义务人人员范围内,不可导入");
errorData.add(errorMessageMap);
errorSum += 1;
}
}
// fixme 分权判断若员工离职后不在扣缴义务人范围内会有异常
// if (openDevolution) {
// Optional<TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee> optionalTaxAgentEmp = taxAgentEmployees.stream().filter(f -> f.getEmployeeId().equals(po.getEmployeeId())).findFirst();
// if (!optionalTaxAgentEmp.isPresent()) {
// Map<String, String> errorMessageMap = Maps.newHashMap();
// errorMessageMap.put("message", rowIndex + "该条数据不在个税扣缴义务人人员范围内,不可导入");
// errorData.add(errorMessageMap);
// errorSum += 1;
// }
// }
// 判断是否有核算过
if (CollectionUtils.isNotEmpty(salaryAcctEmployees)) {

View File

@ -300,17 +300,17 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
po.setDeductionAllowedDonation(deductionAllowedDonation);
// 分权判断
if (openDevolution) {
OtherDeductionPO finalPoE = po;
Optional<TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee> optionalTaxAgentEmp = taxAgentEmployees.stream().filter(f -> f.getEmployeeId().equals(finalPoE.getEmployeeId())).findFirst();
if (!optionalTaxAgentEmp.isPresent()) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "该条数据不在个税扣缴义务人人员范围内,不可导入");
errorData.add(errorMessageMap);
errorSum += 1;
}
}
//fixme 分权判断
// if (openDevolution) {
// OtherDeductionPO finalPoE = po;
// Optional<TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee> optionalTaxAgentEmp = taxAgentEmployees.stream().filter(f -> f.getEmployeeId().equals(finalPoE.getEmployeeId())).findFirst();
// if (!optionalTaxAgentEmp.isPresent()) {
// Map<String, String> errorMessageMap = Maps.newHashMap();
// errorMessageMap.put("message", rowIndex + "该条数据不在个税扣缴义务人人员范围内,不可导入");
// errorData.add(errorMessageMap);
// errorSum += 1;
// }
// }
// 判断是否有核算过
if (CollectionUtils.isNotEmpty(salaryAcctEmployees)) {
OtherDeductionPO finalPo = po;

View File

@ -25,6 +25,7 @@ import com.engine.salary.entity.salarysob.po.SalarySobEmpFieldPO;
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.SalaryValueTypeEnum;
import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.service.*;
import com.engine.salary.util.SalaryEntityUtil;
@ -347,8 +348,8 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98747, "薪资核算记录不存在或已被删除"));
}
// 模板表头(默认必带"个税扣缴义务人""姓名")
List<Object> headerList = Lists.newArrayList(SalaryI18nUtil.getI18nLabel(85429, "姓名"), SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"));
List<String> dataIndexList = Lists.newArrayList("username", "taxAgentName");
List<Object> headerList = Lists.newArrayList(SalaryI18nUtil.getI18nLabel(85429, "姓名"), "部门", SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"));
List<String> dataIndexList = Lists.newArrayList("username", "departmentName", "taxAgentName");
// 查询薪资项目
List<SalaryItemPO> salaryItemPOS = getSalaryItemService(user).listByIds(param.getSalaryItemIds());
for (SalaryItemPO salaryItemPO : salaryItemPOS) {
@ -573,6 +574,9 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
throw new RuntimeException("无数据");
}
for (int i = 0; i < data.size(); i++) {
String row = "" + (i + 2) + "";
int usernameIndex = 0;
boolean isError = false;
Map<String, Object> map = data.get(i);
@ -588,29 +592,53 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
continue;
}
String dataValue = (String) map.getOrDefault(dataKey.toString(), "");
String deparmentName = (String) map.getOrDefault("部门", "");
if (StringUtils.equals(SalaryI18nUtil.getI18nLabel(85429, "姓名"), dataKey.toString())) {
usernameIndex = j;
if (StringUtils.isEmpty(dataValue)) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", SalaryI18nUtil.getI18nLabel(102838, "姓名不能为空"));
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(102838, "姓名不能为空"));
excelComments.add(errorMessageMap);
//salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(102838, "姓名不能为空"), i, i, j, j);
} else {
employeeId = salaryEmployeeMap.getOrDefault(dataValue, 0L);
if (employeeId == null || employeeId <= 0) {
List<DataCollectionEmployee> employeeSameIds = salaryEmployees.stream().filter(e -> (StringUtils.isBlank(dataValue) || Objects.equals(e.getUsername(), dataValue))
&& (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName)))
.collect(Collectors.toList());
if (CollectionUtils.isEmpty(employeeSameIds)) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", SalaryI18nUtil.getI18nLabel(100579, "姓名错误,系统内不存在该姓名"));
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, "姓名错误,系统内不存在该姓名"));
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100579, "姓名错误,系统内不存在该姓名"), i, i, j, j);
} else if (employeeSameIds.size() > 1) {
//存在离职和在职状态取在职状态
employeeSameIds = employeeSameIds.stream()
.filter(e -> UserStatusEnum.getNormalStatus().contains(e.getStatus()))
.collect(Collectors.toList());
if (employeeSameIds.size() != 1) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", row + "员工信息不能为空且不可重复(姓名与部门同时确认唯一)");
excelComments.add(errorMessageMap);
} else {
employeeId = CollectionUtils.isNotEmpty(employeeSameIds) && employeeSameIds.size() == 1 ? employeeSameIds.get(0).getEmployeeId() : null;
}
} else {
employeeId = employeeSameIds.get(0).getEmployeeId();
}
}
}else if (StringUtils.equals(SalaryI18nUtil.getI18nLabel(86184, "部门"), dataKey.toString())) {
} else if (StringUtils.equals(SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"), dataKey.toString())) {
if (StringUtils.isEmpty(dataValue)) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", SalaryI18nUtil.getI18nLabel(100579, SalaryI18nUtil.getI18nLabel(102839, "个税扣缴义务人不能为空")));
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, SalaryI18nUtil.getI18nLabel(102839, "个税扣缴义务人不能为空")));
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(102839, "个税扣缴义务人不能为空"), i, i, j, j);
} else {
@ -618,7 +646,7 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
if (taxAgentId == null || taxAgentId <= 0) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", SalaryI18nUtil.getI18nLabel(100579, SalaryI18nUtil.getI18nLabel(102840, "个税扣缴义务人错误,系统内不存在该个税扣缴义务人")));
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, SalaryI18nUtil.getI18nLabel(102840, "个税扣缴义务人错误,系统内不存在该个税扣缴义务人")));
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(102840, "个税扣缴义务人错误,系统内不存在该个税扣缴义务人"), i, i, j, j);
}
@ -628,7 +656,7 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
if (salaryItemId == null || salaryItemId <= 0) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", SalaryI18nUtil.getI18nLabel(100579, SalaryI18nUtil.getI18nLabel(102840, "本次核算所用账套不包含该薪资项目")));
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, SalaryI18nUtil.getI18nLabel(102840, "本次核算所用账套不包含该薪资项目")));
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(102841, "表头错误,本次核算所用账套不包含该薪资项目"), i, i, j, j);
} else {
@ -686,7 +714,20 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
&& !salaryAcctEmployeeMap.containsKey(employeeId + "-" + taxAgentId)) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", SalaryI18nUtil.getI18nLabel(100579, SalaryI18nUtil.getI18nLabel(102840, "本次薪资核算不包含该人员")));
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, SalaryI18nUtil.getI18nLabel(102840, "本次薪资核算不包含该人员")));
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(102842, "本次薪资核算不包含该人员"), i, i, usernameIndex, usernameIndex);
}
// 如果个税扣缴义务人+人员目前不在核算人员里面不支持导入
if (StringUtils.equals("importSalaryAcctResult", importType)
&& (employeeId != null && employeeId > 0)
&& (taxAgentId != null && taxAgentId > 0)
&& i == data.size() - 1
&& !salaryAcctEmployeeMap.containsKey(employeeId + "-" + taxAgentId)) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, SalaryI18nUtil.getI18nLabel(102840, "本次薪资核算不包含该人员")));
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(102842, "本次薪资核算不包含该人员"), i, i, usernameIndex, usernameIndex);
}

View File

@ -8,6 +8,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.BufferedInputStream;
import java.io.InputStream;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@ -15,8 +16,6 @@ import java.util.Date;
import java.util.Iterator;
import java.util.List;
import static org.apache.poi.ss.usermodel.CellType.STRING;
public class ExcelSupport {
@ -106,6 +105,9 @@ public class ExcelSupport {
return getCellValue(sheet.getRow(rowIndex).getCell(cellIndex));
}
private static final DecimalFormat decimalFormat = new DecimalFormat("####################.###########");
/**
* 格式化解析的数据
*/
@ -117,8 +119,9 @@ public class ExcelSupport {
if (DateUtil.isCellDateFormatted(cell)) {
cellValue = getDateStr(cell.getDateCellValue(), pattern);
} else {
cell.setCellType(STRING);
cellValue = cell.getStringCellValue();
// cell.setCellType(STRING);
// cellValue = cell.getStringCellValue();
cellValue = decimalFormat.format(cell.getNumericCellValue());
}
break;
case STRING: // 字符串类型