Merge branch '20220505' into develop
This commit is contained in:
commit
22de36ce59
|
|
@ -609,7 +609,8 @@ public class SIArchivesBiz {
|
|||
try {
|
||||
SocialSchemeMapper socialSchemeMapper = sqlSession.getMapper(SocialSchemeMapper.class);
|
||||
PageUtil.start(param.getCurrent(), param.getPageSize());
|
||||
List<InsuranceArchivesEmployeePO> page = socialSchemeMapper.listPageEmployeePOS(param);
|
||||
// List<InsuranceArchivesEmployeePO> page = socialSchemeMapper.listPageEmployeePOS(param);
|
||||
List<InsuranceArchivesEmployeePO> page = socialSchemeMapper.queryEmployeeList(param);
|
||||
PageInfo<InsuranceArchivesEmployeePO> pageInfo = new PageInfo<>(page, InsuranceArchivesEmployeePO.class);
|
||||
List<Map<String, Object>> records = buildTableData(page);
|
||||
List<WeaTableColumn> columns = buildWeaTableColumns(page, operateId);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
package com.engine.salary.entity.sischeme.param;
|
||||
|
||||
import com.engine.salary.util.valid.DataCheck;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 福利档案导入参数
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SISchemaImportParam {
|
||||
//上传文件id
|
||||
@DataCheck(require = true,message = "imageId为空")
|
||||
String imageId;
|
||||
|
||||
}
|
||||
|
|
@ -70,5 +70,5 @@ public interface SalaryAcctRecordMapper {
|
|||
* @param ids
|
||||
*/
|
||||
void deleteByIds(@Param("ids") Collection<Long> ids);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -706,6 +706,9 @@
|
|||
<if test="po.sendTime != null">
|
||||
send_time = #{po.sendTime},
|
||||
</if>
|
||||
<if test="po.deleteType != null">
|
||||
delete_type = #{po.deleteType},
|
||||
</if>
|
||||
<if test="po.salaryTemplate != null">
|
||||
salary_template = #{po.salaryTemplate}
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -515,7 +515,7 @@
|
|||
e.jobtitle AS jobNum,
|
||||
e.departmentid AS departmentId,
|
||||
d.departmentname AS departmentName,
|
||||
e.`STATUS` AS userStatus,
|
||||
e.STATUS AS userStatus,
|
||||
e.jobtitle AS position,
|
||||
h.payment_status AS paymentStatus,
|
||||
e.companystartdate AS hiredate,
|
||||
|
|
@ -528,7 +528,7 @@
|
|||
LEFT JOIN bill_hrmdismiss l ON e.ID = l.resource_n
|
||||
LEFT JOIN hrmdepartment d ON d.ID = e.departmentid
|
||||
WHERE
|
||||
e.`STATUS` = 5 AND h.payment_status = 0
|
||||
e.STATUS = 5 AND h.payment_status = 0
|
||||
<if test="userName != null and userName != ''">
|
||||
AND e.lastname like CONCAT('%',#{userName},'%')
|
||||
</if>
|
||||
|
|
@ -594,7 +594,7 @@
|
|||
e.jobtitle AS jobNum,
|
||||
e.departmentid AS departmentId,
|
||||
d.departmentname AS departmentName,
|
||||
e.`STATUS` AS userStatus,
|
||||
e.STATUS AS userStatus,
|
||||
e.jobtitle AS position,
|
||||
e.companystartdate AS hiredate,
|
||||
l.dismissdate AS dimissionDate,
|
||||
|
|
@ -605,7 +605,7 @@
|
|||
LEFT JOIN bill_hrmdismiss l ON e.ID = l.resource_n
|
||||
LEFT JOIN hrmdepartment d ON d.ID = e.departmentid
|
||||
WHERE
|
||||
e.`STATUS` not in (4,5,6,7)
|
||||
e.STATUS not in (4,5,6,7)
|
||||
<if test="userName != null and userName != ''">
|
||||
AND e.lastname like CONCAT('%',#{userName},'%')
|
||||
</if>
|
||||
|
|
@ -684,7 +684,7 @@
|
|||
e.jobtitle AS jobNum,
|
||||
e.departmentid AS departmentId,
|
||||
d.departmentname AS departmentName,
|
||||
e.`STATUS` AS userStatus,
|
||||
e.STATUS AS userStatus,
|
||||
e.jobtitle AS position,
|
||||
h.payment_status AS paymentStatus,
|
||||
e.companystartdate AS hiredate,
|
||||
|
|
@ -763,7 +763,7 @@
|
|||
e.jobtitle AS jobNum,
|
||||
e.departmentid AS departmentId,
|
||||
d.departmentname AS departmentName,
|
||||
e.`STATUS` AS userStatus,
|
||||
e.STATUS AS userStatus,
|
||||
e.jobtitle AS position,
|
||||
e.companystartdate AS hiredate,
|
||||
l.dismissdate AS dimissionDate,
|
||||
|
|
@ -854,7 +854,7 @@
|
|||
e.jobtitle AS jobNum,
|
||||
e.departmentid AS departmentId,
|
||||
d.departmentname AS departmentName,
|
||||
e.`STATUS` AS userStatus,
|
||||
e.STATUS AS userStatus,
|
||||
e.jobtitle AS position,
|
||||
h.payment_status AS paymentStatus,
|
||||
e.companystartdate AS hiredate,
|
||||
|
|
@ -933,7 +933,7 @@
|
|||
e.jobtitle AS jobNum,
|
||||
e.departmentid AS departmentId,
|
||||
d.departmentname AS departmentName,
|
||||
e.`STATUS` AS userStatus,
|
||||
e.STATUS AS userStatus,
|
||||
e.jobtitle AS position,
|
||||
e.companystartdate AS hiredate,
|
||||
l.dismissdate AS dimissionDate,
|
||||
|
|
|
|||
|
|
@ -51,4 +51,6 @@ public interface SocialSchemeMapper {
|
|||
|
||||
List<InsuranceArchivesEmployeePO> queryEmployeeList(@Param("param") InsuranceArchivesListParam param);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -273,8 +273,9 @@
|
|||
LEFT JOIN hrsa_other_archives e ON a.id = e.employee_id
|
||||
LEFT JOIN bill_hrmdismiss f on a.id = f.resource_n
|
||||
WHERE
|
||||
c.delete_type = 0 AND d.delete_type = 0
|
||||
AND e.delete_type = 0
|
||||
-- c.delete_type = 0 AND d.delete_type = 0
|
||||
-- AND e.delete_type = 0
|
||||
1 = 1
|
||||
<include refid="paramSql"/>
|
||||
<include refid="paramSqlCommon"/>
|
||||
ORDER BY a.id asc
|
||||
|
|
@ -366,9 +367,9 @@
|
|||
WHERE
|
||||
1=1
|
||||
<include refid="condition"></include>
|
||||
<if test="param.startNum != null and param.pageSize != null">
|
||||
limit #{param.startNum},#{param.pageSize}
|
||||
</if>
|
||||
<!-- <if test="param.startNum != null and param.pageSize != null">-->
|
||||
<!-- limit #{param.startNum},#{param.pageSize}-->
|
||||
<!-- </if>-->
|
||||
</select>
|
||||
<!--]]>-->
|
||||
<sql id="condition">
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.engine.salary.service;
|
|||
import com.engine.salary.entity.siaccount.dto.InsuranceAccountTabDTO;
|
||||
import com.engine.salary.entity.siaccount.dto.InsuranceAccountViewListDTO;
|
||||
import com.engine.salary.entity.siaccount.param.*;
|
||||
import com.engine.salary.entity.siaccount.po.InsuranceAccountInspectPO;
|
||||
import com.engine.salary.entity.siexport.param.InsuranceExportParam;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
|
@ -193,5 +194,12 @@ public interface SIAccountService {
|
|||
*/
|
||||
Map<String, String> welfareColumns();
|
||||
|
||||
/**
|
||||
* 根据条件获取所有的核算异常明细
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
List<InsuranceAccountInspectPO> allInspects(Collection<Long> ids, String billMonth);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,15 @@
|
|||
package com.engine.salary.service;
|
||||
|
||||
import com.cloudstore.eccom.pc.table.WeaTableColumn;
|
||||
import com.engine.salary.entity.siarchives.param.InsuranceArchivesListParam;
|
||||
import com.engine.salary.entity.siarchives.po.InsuranceArchivesEmployeePO;
|
||||
import com.engine.salary.entity.sischeme.dto.InsuranceSchemeListDTO;
|
||||
import com.engine.salary.entity.sischeme.param.InsuranceSchemeParam;
|
||||
import com.engine.salary.entity.sischeme.param.SISchemaImportParam;
|
||||
import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -42,4 +48,26 @@ public interface SISchemeService {
|
|||
* @return
|
||||
*/
|
||||
PageInfo<InsuranceSchemeListDTO> list(InsuranceSchemeParam param);
|
||||
|
||||
List<InsuranceArchivesEmployeePO> listPageEmployeePOS(InsuranceArchivesListParam param);
|
||||
|
||||
List<Map<String, Object>> buildTableData(List<InsuranceArchivesEmployeePO> insuranceArchivesEmployeePOS);
|
||||
|
||||
XSSFWorkbook export(InsuranceArchivesListParam param);
|
||||
|
||||
/**
|
||||
* 获取方案名称
|
||||
*
|
||||
* @param schemeId 方案主键id
|
||||
* @return string
|
||||
*/
|
||||
String querySchemeName(Long schemeId);
|
||||
|
||||
List<WeaTableColumn> buildWeaTableColumns(List<InsuranceArchivesEmployeePO> insuranceArchivesEmployeePOS, Long employeeId);
|
||||
|
||||
Map<String, Object> preview(SISchemaImportParam siSchemaImportParam);
|
||||
|
||||
Map<String, Object> batchImportEbatch(SISchemaImportParam param);
|
||||
|
||||
XSSFWorkbook exportTemplate(InsuranceArchivesListParam param);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public interface SalarySendService {
|
|||
* @param currentTenantKey
|
||||
* @return
|
||||
*/
|
||||
// void revokeSalaryBill(Long salaryAccountingId, Long currentEmployeeId, String currentTenantKey);
|
||||
void revokeSalaryBill(Long salaryAccountingId, Long currentEmployeeId, String currentTenantKey);
|
||||
|
||||
/**
|
||||
* 工资单发放列表(分页)
|
||||
|
|
|
|||
|
|
@ -27,11 +27,13 @@ import com.engine.salary.enums.siaccount.BillStatusEnum;
|
|||
import com.engine.salary.enums.siaccount.InspectStatusEnum;
|
||||
import com.engine.salary.enums.siaccount.PaymentStatusEnum;
|
||||
import com.engine.salary.enums.siaccount.ProjectTypeEnum;
|
||||
import com.engine.salary.enums.sicategory.DeleteTypeEnum;
|
||||
import com.engine.salary.enums.sicategory.WelfareTypeEnum;
|
||||
import com.engine.salary.mapper.siaccount.InsuranceAccountBatchMapper;
|
||||
import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper;
|
||||
import com.engine.salary.mapper.siaccount.InsuranceAccountInspectMapper;
|
||||
import com.engine.salary.mapper.sicategory.ICategoryMapper;
|
||||
import com.engine.salary.mapper.sischeme.InsuranceSchemeMapper;
|
||||
import com.engine.salary.service.ColumnBuildService;
|
||||
import com.engine.salary.service.RecordsBuildService;
|
||||
import com.engine.salary.service.SIAccountService;
|
||||
|
|
@ -874,6 +876,17 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<InsuranceAccountInspectPO> allInspects(Collection<Long> ids, String billMonth) {
|
||||
InsuranceAccountInspectMapper siAccountInspectMapper = MapperProxyFactory.getProxy(InsuranceAccountInspectMapper.class);
|
||||
List<InsuranceAccountInspectPO> list = siAccountInspectMapper.getList(billMonth, InspectStatusEnum.IGNORE.getValue(), ids);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
return list;
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ public class SIImportServiceImpl extends Service implements SIImportService {
|
|||
for (int i = 1; i <= datas.size(); i++) {
|
||||
List<Object> row = rows.get(i - 1);
|
||||
for (int j = 4; j < headers.size(); j++) {
|
||||
if (param.getExportData()) {
|
||||
if (param.getExportData() != null && param.getExportData()) {
|
||||
Object cellValue = datas.get(i - 1).get(headers.get(j));
|
||||
row.add(cellValue);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1,32 +1,73 @@
|
|||
package com.engine.salary.service.impl;
|
||||
|
||||
import cn.hutool.core.util.BooleanUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.cloudstore.eccom.pc.table.WeaTableColumn;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
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.entity.datacollection.DataCollectionEmployee;
|
||||
import com.engine.salary.entity.datacollection.param.AttendQuoteDataImportParam;
|
||||
import com.engine.salary.entity.datacollection.po.AttendQuoteDataPO;
|
||||
import com.engine.salary.entity.datacollection.po.AttendQuoteDataValuePO;
|
||||
import com.engine.salary.entity.datacollection.po.AttendQuoteFieldPO;
|
||||
import com.engine.salary.entity.datacollection.po.AttendQuotePO;
|
||||
import com.engine.salary.entity.salaryarchive.dto.TaxAgentListDTO;
|
||||
import com.engine.salary.entity.salarysob.po.SalarySobPO;
|
||||
import com.engine.salary.entity.siaccount.param.DSTenantKeyThreadVar;
|
||||
import com.engine.salary.entity.siarchives.param.InsuranceArchivesListParam;
|
||||
import com.engine.salary.entity.siarchives.po.*;
|
||||
import com.engine.salary.entity.sicategory.po.ICategoryPO;
|
||||
import com.engine.salary.entity.sischeme.dto.InsuranceSchemeListDTO;
|
||||
import com.engine.salary.entity.sischeme.param.InsuranceSchemeParam;
|
||||
import com.engine.salary.entity.sischeme.param.SISchemaImportParam;
|
||||
import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
|
||||
import com.engine.salary.entity.sischeme.po.InsuranceSchemePO;
|
||||
import com.engine.salary.enums.sicategory.DeleteTypeEnum;
|
||||
import com.engine.salary.enums.sicategory.IsPaymentEnum;
|
||||
import com.engine.salary.enums.sicategory.PaymentTypeEnum;
|
||||
import com.engine.salary.entity.taxrate.TaxAgent;
|
||||
import com.engine.salary.enums.datacollection.AttendQuoteSourceTypeEnum;
|
||||
import com.engine.salary.enums.sicategory.*;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.mapper.siarchives.FundSchemeMapper;
|
||||
import com.engine.salary.mapper.siarchives.OtherSchemeMapper;
|
||||
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.service.SIImportService;
|
||||
import com.engine.salary.service.SISchemeService;
|
||||
import com.engine.salary.util.SalaryAssert;
|
||||
import com.engine.salary.util.SalaryEnumUtil;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.engine.salary.service.TaxAgentService;
|
||||
import com.engine.salary.util.*;
|
||||
import com.engine.salary.util.db.MapperProxyFactory;
|
||||
import com.engine.salary.util.excel.ExcelComment;
|
||||
import com.engine.salary.util.excel.ExcelParseHelper;
|
||||
import com.engine.salary.util.excel.ExcelSupport;
|
||||
import com.engine.salary.util.excel.ExcelUtil;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import com.engine.salary.util.page.PageUtil;
|
||||
import com.engine.salary.util.valid.ValidUtil;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.kingbase8.util.LOGGER;
|
||||
import dm.jdbc.util.IdGenerator;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import weaver.file.ImageFileManager;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.engine.salary.util.excel.ExcelSupport.EXCEL_TYPE_XLSX;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description: TODO
|
||||
|
|
@ -34,6 +75,44 @@ import java.util.stream.Collectors;
|
|||
* @Version V1.0
|
||||
**/
|
||||
public class SISchemeServiceImpl extends Service implements SISchemeService {
|
||||
private SocialSchemeMapper getSocialSchemeMapper() {
|
||||
return MapperProxyFactory.getProxy(SocialSchemeMapper.class);
|
||||
}
|
||||
|
||||
private FundSchemeMapper getFundSchemeMapper() {
|
||||
return MapperProxyFactory.getProxy(FundSchemeMapper.class);
|
||||
}
|
||||
|
||||
private OtherSchemeMapper getOtherSchemeMapper() {
|
||||
return MapperProxyFactory.getProxy(OtherSchemeMapper.class);
|
||||
}
|
||||
|
||||
private InsuranceSchemeMapper getInsuranceSchemeMapper() {
|
||||
return MapperProxyFactory.getProxy(InsuranceSchemeMapper.class);
|
||||
}
|
||||
|
||||
private ICategoryMapper getICategoryMapper() {
|
||||
return MapperProxyFactory.getProxy(ICategoryMapper.class);
|
||||
}
|
||||
|
||||
private SISchemeService getSiSchemeService() {
|
||||
return ServiceUtil.getService(SISchemeServiceImpl.class, user);
|
||||
}
|
||||
|
||||
|
||||
private TaxAgentService getTaxAgentService() {
|
||||
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private InsuranceSchemeDetailMapper getInsuranceSchemeDetailMapper() {
|
||||
return MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class);
|
||||
}
|
||||
|
||||
private SIImportService getSIImportService() {
|
||||
return ServiceUtil.getService(SIImportServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private EmployBiz employeeBiz = new EmployBiz();
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getForm(Map<String, Object> params) {
|
||||
|
|
@ -100,6 +179,140 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
|
|||
return pageInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InsuranceArchivesEmployeePO> listPageEmployeePOS(InsuranceArchivesListParam param) {
|
||||
return getSocialSchemeMapper().queryEmployeeList(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> buildTableData(List<InsuranceArchivesEmployeePO> insuranceArchivesEmployeePOS) {
|
||||
List<Map<String, Object>> records = new ArrayList<>();
|
||||
List<Long> employeeIds = insuranceArchivesEmployeePOS.stream().map(InsuranceArchivesEmployeePO::getEmployeeId).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(employeeIds)) {
|
||||
return records;
|
||||
}
|
||||
|
||||
Map<Long, InsuranceArchivesSocialSchemePO> socialSchemePOMap =
|
||||
getSocialSchemeMapper().getSocialByEmployeeId(employeeIds)
|
||||
.stream().collect(Collectors.toMap(InsuranceArchivesSocialSchemePO::getEmployeeId, Function.identity()));
|
||||
Map<Long, InsuranceArchivesFundSchemePO> fundSchemePOMap =
|
||||
getFundSchemeMapper().getFundByEmployeeId(employeeIds)
|
||||
.stream().collect(Collectors.toMap(InsuranceArchivesFundSchemePO::getEmployeeId, Function.identity()));
|
||||
Map<Long, InsuranceArchivesOtherSchemePO> otherSchemePOMap =
|
||||
getOtherSchemeMapper().getOtherByEmployeeId(employeeIds)
|
||||
.stream().collect(Collectors.toMap(InsuranceArchivesOtherSchemePO::getEmployeeId, Function.identity()));
|
||||
insuranceArchivesEmployeePOS.forEach(item -> {
|
||||
InsuranceArchivesSocialSchemePO socialItem = socialSchemePOMap.get(item.getEmployeeId());
|
||||
InsuranceArchivesFundSchemePO fundItem = fundSchemePOMap.get(item.getEmployeeId());
|
||||
InsuranceArchivesOtherSchemePO otherItem = otherSchemePOMap.get(item.getEmployeeId());
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("employeeName", item.getUserName());
|
||||
map.put("employeeId", item.getEmployeeId());
|
||||
map.put("departmentName", item.getDepartmentName());
|
||||
map.put("departmentId", item.getDepartmentId());
|
||||
map.put("jobNum", item.getJobNum());
|
||||
map.put("mobile", item.getTelephone());
|
||||
map.put("status", item.getUserStatusEnum() == null ? "" : item.getUserStatusEnum().getDescription());
|
||||
if (socialItem != null) {
|
||||
map.put("socialName", getSiSchemeService().querySchemeName(socialItem.getSocialSchemeId()));
|
||||
Map<String, Object> socialJson = JSON.parseObject(socialItem.getSocialPaymentBaseString(), new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
if (socialJson != null) {
|
||||
SalaryEntityUtil.thousandthConvert(socialJson, map);
|
||||
}
|
||||
map.put("socialAccount", socialItem.getSocialAccount());
|
||||
map.put("socialStartTime", socialItem.getSocialStartTime());
|
||||
map.put("socialEndTime", socialItem.getSocialEndTime());
|
||||
}
|
||||
if (fundItem != null) {
|
||||
map.put("fundName", getSiSchemeService().querySchemeName(fundItem.getFundSchemeId()));
|
||||
map.put("fundAccount", fundItem.getFundAccount());
|
||||
Map<String, Object> fundJson = JSON.parseObject(fundItem.getFundPaymentBaseString(), new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
if (fundJson != null) {
|
||||
SalaryEntityUtil.thousandthConvert(fundJson, map);
|
||||
}
|
||||
map.put("supplementFundAccount", fundItem.getSupplementFundAccount());
|
||||
map.put("fundStartTime", fundItem.getFundStartTime());
|
||||
map.put("fundEndTime", fundItem.getFundEndTime());
|
||||
|
||||
}
|
||||
if (otherItem != null) {
|
||||
map.put("otherName", getSiSchemeService().querySchemeName(otherItem.getOtherSchemeId()));
|
||||
Map<String, Object> otherJson = JSON.parseObject(otherItem.getOtherPaymentBaseString(), new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
if (otherJson != null) {
|
||||
SalaryEntityUtil.thousandthConvert(otherJson, map);
|
||||
}
|
||||
map.put("otherStartTime", otherItem.getOtherStartTime());
|
||||
map.put("otherEndTime", otherItem.getOtherEndTime());
|
||||
}
|
||||
records.add(map);
|
||||
});
|
||||
return records;
|
||||
}
|
||||
|
||||
@Override
|
||||
public XSSFWorkbook export(InsuranceArchivesListParam param) {
|
||||
InsuranceArchivesListParam request = InsuranceArchivesListParam.builder().build();
|
||||
if (param.getHireDate() != null && param.getHireDate().length == 2) {
|
||||
param.setHiredateStart(param.getHireDate()[0]);
|
||||
param.setHiredateEnd(param.getHireDate()[1]);
|
||||
}
|
||||
if (param.getDimissionDate() != null && param.getDimissionDate().length == 2) {
|
||||
param.setDimissionDateStart(param.getDimissionDate()[0]);
|
||||
param.setDimissionDateEnd(param.getDimissionDate()[1]);
|
||||
}
|
||||
if (Objects.equals("fromQuickSearch", param.getDataSource())) {
|
||||
request.setStatuses(param.getStatuses());
|
||||
request.setKeyword(param.getUserName());
|
||||
} else {
|
||||
request = param;
|
||||
}
|
||||
request.setPageSize(null);
|
||||
request.setStartNum(null);
|
||||
List<InsuranceArchivesEmployeePO> insuranceArchivesEmployeePOS = listPageEmployeePOS(request);
|
||||
if (insuranceArchivesEmployeePOS == null) {
|
||||
insuranceArchivesEmployeePOS = new ArrayList<>();
|
||||
}
|
||||
List<Map<String, Object>> records = buildTableData(insuranceArchivesEmployeePOS);
|
||||
List<WeaTableColumn> columns = buildWeaTableColumns(insuranceArchivesEmployeePOS, (long) user.getUID());
|
||||
|
||||
//工作簿list
|
||||
|
||||
|
||||
//工作簿数据
|
||||
List<List<String>> rows = new LinkedList<>();
|
||||
List<String> collect = columns.stream().map(WeaTableColumn::getText).collect(Collectors.toList());
|
||||
rows.add(collect);
|
||||
for (Map<String, Object> recordData : records) {
|
||||
List<String> row = new LinkedList<>();
|
||||
for (WeaTableColumn column : columns) {
|
||||
try {
|
||||
Object o = recordData.get(column.getColumn());
|
||||
row.add(o.toString());
|
||||
} catch(Exception e) {
|
||||
row.add("");
|
||||
}
|
||||
}
|
||||
rows.add(row);
|
||||
}
|
||||
// return salaryBatchService.simpleExportExcel(ExportExcelInfo.builder()
|
||||
// .bizId(exportMap.get("biz"))
|
||||
// .flag(true)
|
||||
// .userId(employeeId)
|
||||
// .eteamsId(eteamsId)
|
||||
// .tenantKey(tenantKey)
|
||||
// .operator(operator)
|
||||
// .module(exportMap.get("module"))
|
||||
// .fileName(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 94629, "社保福利档案") + SalaryDateUtil.getFormatLocalDateTime(LocalDateTime.now()))
|
||||
// .handlerName("insuranceArchivesExportHandler")
|
||||
// .dataType(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 99915, "档案"))
|
||||
// .function(exportMap.get("function")).build(), sheetList);
|
||||
//获取excel
|
||||
return ExcelUtil.genWorkbook(rows,"福利档案");
|
||||
}
|
||||
|
||||
|
||||
public PaymentTypeEnum buildPaymentTypeEnum(Integer value) {
|
||||
return SalaryEnumUtil.enumMatchByValue(value, PaymentTypeEnum.values(), PaymentTypeEnum.class);
|
||||
|
|
@ -131,4 +344,626 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
|
|||
ICategoryPO insuranceCategoryPO = MapperProxyFactory.getProxy(ICategoryMapper.class).getById(id);
|
||||
return insuranceCategoryPO == null ? "" : Objects.isNull(insuranceCategoryPO.getInsuranceName()) ? "" : insuranceCategoryPO.getInsuranceName();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String querySchemeName(Long schemeId) {
|
||||
if (schemeId == null) {
|
||||
return "";
|
||||
}
|
||||
InsuranceSchemePO insuranceSchemePO =
|
||||
getInsuranceSchemeMapper().getById(schemeId);
|
||||
if (insuranceSchemePO == null) {
|
||||
return "";
|
||||
} else {
|
||||
return insuranceSchemePO.getSchemeName();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
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");
|
||||
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"));
|
||||
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"));
|
||||
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"));
|
||||
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"));
|
||||
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<>();
|
||||
Set<String> fundSet = new HashSet<>();
|
||||
Set<String> otherSet = new HashSet<>();
|
||||
insuranceArchivesEmployeePOS.forEach(item -> {
|
||||
List<InsuranceArchivesSocialSchemePO> socialByEmployeeId = getSocialSchemeMapper().getSocialByEmployeeId(new ArrayList<Long>() {{
|
||||
add(item.getEmployeeId());
|
||||
}});
|
||||
InsuranceArchivesSocialSchemePO socialItem = null;
|
||||
if(socialByEmployeeId.size() > 0) {
|
||||
socialItem = socialByEmployeeId.get(0);
|
||||
}
|
||||
InsuranceArchivesFundSchemePO fundItem = null;
|
||||
|
||||
List<InsuranceArchivesFundSchemePO> fundByEmployeeId = getFundSchemeMapper().getFundByEmployeeId(new ArrayList<Long>() {{
|
||||
add(item.getEmployeeId());
|
||||
}});
|
||||
if(fundByEmployeeId.size() > 0) {
|
||||
fundItem = fundByEmployeeId.get(0);
|
||||
}
|
||||
InsuranceArchivesOtherSchemePO otherItem = null;
|
||||
|
||||
List<InsuranceArchivesOtherSchemePO> otherByEmployeeId = getOtherSchemeMapper().getOtherByEmployeeId(new ArrayList<Long>() {{
|
||||
add(item.getEmployeeId());
|
||||
}});
|
||||
if(otherByEmployeeId.size() > 0) {
|
||||
otherItem = otherByEmployeeId.get(0);
|
||||
}
|
||||
|
||||
if (socialItem != null) {
|
||||
Map<String, Object> socialJson = JSON.parseObject(socialItem.getSocialPaymentBaseString(), new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
if (socialJson != null) {
|
||||
socialJson.forEach((k, v) -> socialSet.add(k));
|
||||
}
|
||||
}
|
||||
if (fundItem != null) {
|
||||
Map<String, Object> fundJson = JSON.parseObject(fundItem.getFundPaymentBaseString(), new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
if (fundJson != null) {
|
||||
fundJson.forEach((k, v) -> fundSet.add(k));
|
||||
}
|
||||
}
|
||||
if (otherItem != null) {
|
||||
Map<String, Object> otherJson = JSON.parseObject(otherItem.getOtherPaymentBaseString(), new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
if (otherJson != null) {
|
||||
otherJson.forEach((k, v) -> otherSet.add(k));
|
||||
}
|
||||
}
|
||||
});
|
||||
Map<String, String> socialMap = new HashMap<>();
|
||||
Map<Long, ICategoryPO> socialCollect = new HashMap<>();
|
||||
Map<Long, ICategoryPO> customSocial =
|
||||
getICategoryMapper().listByWelfareType(WelfareTypeEnum.SOCIAL_SECURITY.getValue(), null)
|
||||
.stream().collect(Collectors.toMap(ICategoryPO::getId, Function.identity()));
|
||||
|
||||
Map<Long, ICategoryPO> sysSocial =
|
||||
getICategoryMapper().listByWelfareType(WelfareTypeEnum.SOCIAL_SECURITY.getValue(), DataTypeEnum.SYSTEM.getValue())
|
||||
.stream().collect(Collectors.toMap(ICategoryPO::getId, Function.identity()));
|
||||
socialCollect.putAll(customSocial);
|
||||
socialCollect.putAll(sysSocial);
|
||||
socialSet.forEach(item -> {
|
||||
if (socialCollect.containsKey(Long.valueOf(item))) {
|
||||
socialMap.put(item, socialCollect.get(Long.valueOf(item)).getInsuranceName() + SalaryI18nUtil.getI18nLabel( 100293, "申报基数"));
|
||||
}
|
||||
});
|
||||
Map<String, String> fundMap = new HashMap<>();
|
||||
Map<Long, ICategoryPO> fundCollect = new HashMap<>();
|
||||
Map<Long, ICategoryPO> customFund =
|
||||
getICategoryMapper().listByWelfareType(WelfareTypeEnum.ACCUMULATION_FUND.getValue(), null)
|
||||
.stream().collect(Collectors.toMap(ICategoryPO::getId, Function.identity()));
|
||||
Map<Long, ICategoryPO> sysFund =
|
||||
getICategoryMapper().listByWelfareType(WelfareTypeEnum.ACCUMULATION_FUND.getValue(), DataTypeEnum.SYSTEM.getValue())
|
||||
.stream().collect(Collectors.toMap(ICategoryPO::getId, Function.identity()));
|
||||
fundCollect.putAll(customFund);
|
||||
fundCollect.putAll(sysFund);
|
||||
fundSet.forEach(item -> {
|
||||
if (fundCollect.containsKey(Long.valueOf(item))) {
|
||||
fundMap.put(item, fundCollect.get(Long.valueOf(item)).getInsuranceName() + SalaryI18nUtil.getI18nLabel( 100293, "申报基数"));
|
||||
}
|
||||
});
|
||||
Map<String, String> otherMap = new HashMap<>();
|
||||
Map<Long, ICategoryPO> otherCollect = new HashMap<>();
|
||||
Map<Long, ICategoryPO> customOther =
|
||||
getICategoryMapper().listByWelfareType(WelfareTypeEnum.OTHER.getValue(), null)
|
||||
.stream().collect(Collectors.toMap(ICategoryPO::getId, Function.identity()));
|
||||
Map<Long, ICategoryPO> sysOther =
|
||||
getICategoryMapper().listByWelfareType(WelfareTypeEnum.OTHER.getValue(), DataTypeEnum.SYSTEM.getValue())
|
||||
.stream().collect(Collectors.toMap(ICategoryPO::getId, Function.identity()));
|
||||
otherCollect.putAll(customOther);
|
||||
otherCollect.putAll(sysOther);
|
||||
otherSet.forEach(item -> {
|
||||
if (otherCollect.containsKey(Long.valueOf(item))) {
|
||||
otherMap.put(item, otherCollect.get(Long.valueOf(item)).getInsuranceName() + SalaryI18nUtil.getI18nLabel( 100293, "申报基数"));
|
||||
}
|
||||
});
|
||||
|
||||
result.put(WelfareTypeEnum.SOCIAL_SECURITY.getValue(), socialMap);
|
||||
result.put(WelfareTypeEnum.ACCUMULATION_FUND.getValue(), fundMap);
|
||||
result.put(WelfareTypeEnum.OTHER.getValue(), otherMap);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入的数据插入到数据库中
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> preview(SISchemaImportParam param) {
|
||||
ValidUtil.doValidator(param);
|
||||
InputStream fileInputStream = null;
|
||||
try {
|
||||
fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(param.getImageId()));
|
||||
Sheet sheet = ExcelSupport.parseFile(fileInputStream, 0, EXCEL_TYPE_XLSX);
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
apidatas.put("headers", ExcelSupport.getSheetHeader(sheet, 0));
|
||||
apidatas.put("list", ExcelParseHelper.parse2List(sheet, 1));
|
||||
return apidatas;
|
||||
} finally {
|
||||
IOUtils.closeQuietly(fileInputStream);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入的数据插入到数据库中
|
||||
*/
|
||||
public Map<String, Object> batchImportEbatch(SISchemaImportParam param) {
|
||||
ValidUtil.doValidator(param);
|
||||
|
||||
|
||||
|
||||
// List<ExcelSheet> excelSheets = message.getBatchFile().getExcelSheets();
|
||||
// 租户key
|
||||
// String tenantKey = message.getTenantKey().toLowerCase();
|
||||
//操作员id
|
||||
Long creator = (long) user.getUID();
|
||||
//获取所有福利类型的id-name结合
|
||||
Map<String, Long> schemeNameIdMap = schemeNameIdMap();
|
||||
Map<Long, String> welfareMap = welfareMap();
|
||||
// 获取所有个税扣缴义务人的名称和id的map
|
||||
Map<String, Long> paymentNameIdMap = getTaxAgentService().findAll().stream().collect(Collectors.toMap(TaxAgent::getName, TaxAgent::getId));
|
||||
// 获取所有人员信息
|
||||
// 获取租户下所有的人员
|
||||
List<DataCollectionEmployee> employeeByIds = employeeBiz.listEmployee();
|
||||
int total = 0;
|
||||
|
||||
int index = 0;
|
||||
int successCount = 0;
|
||||
int errorCount = 0;
|
||||
|
||||
// 待导入数据
|
||||
List<InsuranceArchivesAccountPO> insuranceArchivesAccountPOS = new ArrayList<>();
|
||||
|
||||
// 待导入数据
|
||||
InputStream fileInputStream = null;
|
||||
try {
|
||||
fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(param.getImageId()));
|
||||
Sheet sheet = ExcelSupport.parseFile(fileInputStream, 0, EXCEL_TYPE_XLSX);
|
||||
// 表头
|
||||
List<String> headers = ExcelSupport.getSheetHeader(sheet, 0);
|
||||
// 错误sheet数据
|
||||
List<Map<String, Object>> errorData = new LinkedList<>();
|
||||
// 错误提示
|
||||
List<Map<String, String>> excelComments = new LinkedList<>();
|
||||
|
||||
// 处理数值
|
||||
List<Map<String, Object>> data = ExcelParseHelper.parse2Map(sheet, 1);
|
||||
total = data.size();
|
||||
|
||||
//当前sheel的单行记录
|
||||
Map<String, Object> map;
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
index += 1;
|
||||
map = data.get(i);
|
||||
boolean isError;
|
||||
List<Map<String, Object>> singleAccount = new ArrayList<>();
|
||||
for (int j = 0; j < headers.size(); j++) {
|
||||
//组装单条数据基础数据
|
||||
String key = headers.get(j);
|
||||
if (key == null) {
|
||||
continue;
|
||||
}
|
||||
Map<String, Object> cellData = new HashMap<>();
|
||||
cellData.put(key.toString(), Optional.ofNullable(map.get(key.toString())).orElse("").toString());
|
||||
cellData.put("index", j);
|
||||
singleAccount.add(cellData);
|
||||
}
|
||||
isError = singleAccountCheck(singleAccount, welfareMap, insuranceArchivesAccountPOS, employeeByIds, excelComments, errorCount + 1, schemeNameIdMap,
|
||||
paymentNameIdMap,
|
||||
creator);
|
||||
if (isError) {
|
||||
errorCount += 1;
|
||||
// 添加错误数据
|
||||
errorData.add(map);
|
||||
} else {
|
||||
successCount += 1;
|
||||
}
|
||||
// salaryBatchService.sendImportRate(message.getBizId(), total, index);
|
||||
}
|
||||
|
||||
// 如果sheet包含错误数据
|
||||
// if (CollectionUtils.isNotEmpty(errorData)) {
|
||||
// salaryBatchService.createErrorExcelSheet(headers, errorData, excelSheet.getName(), excelComments, errorExcelSheets);
|
||||
// }
|
||||
|
||||
// 数据入库处理
|
||||
handleImportData(insuranceArchivesAccountPOS);
|
||||
|
||||
// 发送导入回调信息
|
||||
// salaryBatchService.sendImportCallBackInfo(message, successCount, errorCount, errorExcelSheets);
|
||||
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
apidatas.put("successCount", successCount);
|
||||
apidatas.put("errorCount", errorCount);
|
||||
apidatas.put("errorData", excelComments);
|
||||
return apidatas;
|
||||
} finally {
|
||||
IOUtils.closeQuietly(fileInputStream);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Map<String, Long> schemeNameIdMap() {
|
||||
Map<String, Long> schemeMap = new HashMap<>();
|
||||
List<InsuranceSchemePO> schemeList = getInsuranceSchemeMapper().listAll();
|
||||
if (CollectionUtils.isNotEmpty(schemeList)) {
|
||||
schemeMap = schemeList.stream().collect(Collectors.toMap(InsuranceSchemePO::getSchemeName, InsuranceSchemePO::getId));
|
||||
}
|
||||
return schemeMap;
|
||||
}
|
||||
|
||||
public Map<Long, String> welfareMap() {
|
||||
return getICategoryMapper().listAll().stream().collect(Collectors.toMap(ICategoryPO::getId, ICategoryPO::getInsuranceName));
|
||||
}
|
||||
|
||||
|
||||
public boolean singleAccountCheck(List<Map<String, Object>> singleAccount, Map<Long, String> welfareMap, List<InsuranceArchivesAccountPO> insuranceArchivesAccountPOS,
|
||||
List<DataCollectionEmployee> employeeByIds,
|
||||
List<Map<String, String>> excelComments, int i, Map<String, Long> schemeNameIdMap, Map<String, Long> paymentNameIdMap, Long creator
|
||||
) {
|
||||
boolean isError = false;
|
||||
String userName = (String) singleAccount.get(0).get(SalaryI18nUtil.getI18nLabel(85429, "姓名"));
|
||||
String deparmentName = (String) singleAccount.get(1).get(SalaryI18nUtil.getI18nLabel(86185, "部门"));
|
||||
String telephone = (String) singleAccount.get(2).get(SalaryI18nUtil.getI18nLabel(86186, "手机号"));
|
||||
String userStatus = (String) singleAccount.get(3).get(SalaryI18nUtil.getI18nLabel(86187, "员工状态"));
|
||||
if (StringUtils.isBlank(userName) && StringUtils.isBlank(deparmentName) && StringUtils.isBlank(telephone) && StringUtils.isBlank(userStatus)) {
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", SalaryI18nUtil.getI18nLabel(100303, "不能同时为空"));
|
||||
excelComments.add(errorMessageMap);
|
||||
isError = true;
|
||||
}
|
||||
List<Long> 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) || e.getStatus() == null || Objects.equals(e.getStatus(), userStatus))).map(DataCollectionEmployee::getEmployeeId)
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(employees) || employees.size() > 1) {
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", SalaryI18nUtil.getI18nLabel(100304, "员工信息不存在或者存在多个员工"));
|
||||
excelComments.add(errorMessageMap);
|
||||
isError = true;
|
||||
}
|
||||
Long employeeId = null;
|
||||
if (CollectionUtils.isNotEmpty(employees) && employees.size() == 1) {
|
||||
employeeId = employees.get(0);
|
||||
}
|
||||
InsuranceArchivesAccountPO insuranceArchivesAccountPO = new InsuranceArchivesAccountPO();
|
||||
InsuranceArchivesSocialSchemePO insuranceArchivesSocialSchemePO = null;
|
||||
InsuranceArchivesFundSchemePO insuranceArchivesFundSchemePO = null;
|
||||
InsuranceArchivesOtherSchemePO insuranceArchivesOtherSchemePO = null;
|
||||
Map<String, Object> socialMap = findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91323, "社保方案名称"));
|
||||
Map<String, Object> fundMap = findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91485, "公积金方案名称"));
|
||||
Map<String, Object> otherMap = findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称"));
|
||||
Map<String, Object> socialStartTimeMap = findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91319, "社保起始缴纳月"));
|
||||
Map<String, Object> socialEndTimeMap = findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91320, "社保最后缴纳月"));
|
||||
Map<String, Object> fundStartTimeMap = findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91483, "公积金起始缴纳月"));
|
||||
Map<String, Object> fundEndTimeMap = findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91484, "公积金最后缴纳月"));
|
||||
Map<String, Object> otherStartTimeMap = findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91490, "其他福利起始缴纳月"));
|
||||
Map<String, Object> otherEndTimeMap = findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91494, "其他福利最后缴纳月"));
|
||||
if (StringUtils.isBlank((String) socialMap.get(SalaryI18nUtil.getI18nLabel(91323, "社保方案名称"))) && StringUtils.isBlank(
|
||||
(String) fundMap.get(SalaryI18nUtil.getI18nLabel(91485, "公积金方案名称")))
|
||||
&& StringUtils.isBlank((String) otherMap.get(SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称")))) {
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", SalaryI18nUtil.getI18nLabel(100312, "社保,公积金,其他福利方案名称不可同时为空"));
|
||||
excelComments.add(errorMessageMap);
|
||||
isError = true;
|
||||
}
|
||||
if (StringUtils.isNotBlank((String) socialStartTimeMap.get(SalaryI18nUtil.getI18nLabel(91319, "社保起始缴纳月"))) && !SalaryDateUtil.checkYearMonth(
|
||||
(String) socialStartTimeMap.get(SalaryI18nUtil.getI18nLabel(91319, "社保起始缴纳月")))) {
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", SalaryI18nUtil.getI18nLabel(100315, "社保起始缴纳时间格式错误,正确格式为YYYY-MM"));
|
||||
excelComments.add(errorMessageMap);
|
||||
isError = true;
|
||||
}
|
||||
if (StringUtils.isNotBlank((String) socialEndTimeMap.get(SalaryI18nUtil.getI18nLabel(91320, "社保最后缴纳月"))) && !SalaryDateUtil.checkYearMonth(
|
||||
(String) socialEndTimeMap.get(SalaryI18nUtil.getI18nLabel(91320, "社保最后缴纳月")))) {
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", SalaryI18nUtil.getI18nLabel(100316, "社保最后缴纳时间格式错误,正确格式为YYYY-MM"));
|
||||
excelComments.add(errorMessageMap);
|
||||
isError = true;
|
||||
}
|
||||
if (StringUtils.isNotBlank((String) fundStartTimeMap.get(SalaryI18nUtil.getI18nLabel(91483, "公积金起始缴纳月"))) && !SalaryDateUtil.checkYearMonth(
|
||||
(String) fundStartTimeMap.get(SalaryI18nUtil.getI18nLabel(91483, "公积金起始缴纳月")))) {
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", SalaryI18nUtil.getI18nLabel(100317, "公积金起始缴纳时间格式错误,正确格式为YYYY-MM"));
|
||||
excelComments.add(errorMessageMap);
|
||||
isError = true;
|
||||
}
|
||||
if (StringUtils.isNotBlank((String) fundEndTimeMap.get(SalaryI18nUtil.getI18nLabel(91484, "公积金最后缴纳月"))) && !SalaryDateUtil.checkYearMonth(
|
||||
(String) fundEndTimeMap.get(SalaryI18nUtil.getI18nLabel(91484, "公积金最后缴纳月")))) {
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", SalaryI18nUtil.getI18nLabel(100319, "公积金最后缴纳时间格式错误,正确格式为YYYY-MM"));
|
||||
excelComments.add(errorMessageMap);
|
||||
isError = true;
|
||||
}
|
||||
if (StringUtils.isNotBlank((String) otherStartTimeMap.get(SalaryI18nUtil.getI18nLabel(91490, "其他福利起始缴纳月"))) && !SalaryDateUtil.checkYearMonth(
|
||||
(String) otherStartTimeMap.get(SalaryI18nUtil.getI18nLabel(91490, "其他福利起始缴纳月")))) {
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", SalaryI18nUtil.getI18nLabel(100320, "其他福利起始缴纳时间格式错误,正确格式为YYYY-MM"));
|
||||
excelComments.add(errorMessageMap);
|
||||
isError = true;
|
||||
}
|
||||
if (StringUtils.isNotBlank((String) otherEndTimeMap.get(SalaryI18nUtil.getI18nLabel(91494, "其他福利最后缴纳月"))) && !SalaryDateUtil.checkYearMonth(
|
||||
(String) otherEndTimeMap.get(SalaryI18nUtil.getI18nLabel(91494, "其他福利最后缴纳月")))) {
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", SalaryI18nUtil.getI18nLabel(100321, "其他福利最后缴纳时间格式错误,正确格式为YYYY-MM"));
|
||||
excelComments.add(errorMessageMap);
|
||||
isError = true;
|
||||
}
|
||||
if (StringUtils.isNotBlank((String) socialMap.get(SalaryI18nUtil.getI18nLabel(91323, "社保方案名称")))
|
||||
&& schemeNameIdMap.get((String) socialMap.get(SalaryI18nUtil.getI18nLabel(91323, "社保方案名称"))) == null) {
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", SalaryI18nUtil.getI18nLabel(100322, "社保方案不存在"));
|
||||
excelComments.add(errorMessageMap);
|
||||
isError = true;
|
||||
} else {
|
||||
insuranceArchivesSocialSchemePO = buildSocialPO(employeeId, welfareMap, singleAccount, schemeNameIdMap, paymentNameIdMap, creator);
|
||||
}
|
||||
if (StringUtils.isNotBlank((String) fundMap.get(SalaryI18nUtil.getI18nLabel(91485, "公积金方案名称")))
|
||||
&& schemeNameIdMap.get((String) fundMap.get(SalaryI18nUtil.getI18nLabel(91485, "公积金方案名称"))) == null) {
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", SalaryI18nUtil.getI18nLabel(100323, "公积金方案不存在"));
|
||||
excelComments.add(errorMessageMap);
|
||||
isError = true;
|
||||
} else {
|
||||
insuranceArchivesFundSchemePO = buildFundPO(employeeId, welfareMap, singleAccount, schemeNameIdMap, paymentNameIdMap, creator);
|
||||
}
|
||||
if (StringUtils.isNotBlank((String) fundMap.get(SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称")))
|
||||
&& schemeNameIdMap.get((String) fundMap.get(SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称"))) == null) {
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", SalaryI18nUtil.getI18nLabel(100324, "其他福利方案不存在"));
|
||||
excelComments.add(errorMessageMap);
|
||||
isError = true;
|
||||
} else {
|
||||
insuranceArchivesOtherSchemePO = buildOtherPO(employeeId, welfareMap, singleAccount, schemeNameIdMap, paymentNameIdMap, creator);
|
||||
}
|
||||
if (!isError) {
|
||||
insuranceArchivesAccountPO.setSocial(insuranceArchivesSocialSchemePO);
|
||||
insuranceArchivesAccountPO.setFund(insuranceArchivesFundSchemePO);
|
||||
insuranceArchivesAccountPO.setOther(insuranceArchivesOtherSchemePO);
|
||||
insuranceArchivesAccountPOS.add(insuranceArchivesAccountPO);
|
||||
}
|
||||
return isError;
|
||||
}
|
||||
|
||||
|
||||
public Map<String, Object> findElement(List<Map<String, Object>> singleAccount, String target) {
|
||||
for (Map<String, Object> e : singleAccount) {
|
||||
if (e.containsKey(target)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
|
||||
public InsuranceArchivesSocialSchemePO buildSocialPO(Long employeeId, Map<Long, String> welfareMap, List<Map<String, Object>> singleAccount, Map<String, Long> schemeNameIdMap,
|
||||
Map<String, Long> paymentNameIdMap, Long creator) {
|
||||
|
||||
if (employeeId == null) {
|
||||
return null;
|
||||
}
|
||||
InsuranceArchivesSocialSchemePO insuranceArchivesSocialSchemePO = new InsuranceArchivesSocialSchemePO();
|
||||
insuranceArchivesSocialSchemePO.setId(IdGenerator.generate());
|
||||
insuranceArchivesSocialSchemePO.setSocialAccount((String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91324, "社保账号")).get(
|
||||
SalaryI18nUtil.getI18nLabel(91324, "社保账号")));
|
||||
insuranceArchivesSocialSchemePO.setSocialSchemeId(schemeNameIdMap.get(
|
||||
(String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel( 91323, "社保方案名称")).get(
|
||||
SalaryI18nUtil.getI18nLabel(91323, "社保方案名称"))));
|
||||
insuranceArchivesSocialSchemePO.setSocialStartTime((String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91319, "社保起始缴纳月")).get(
|
||||
SalaryI18nUtil.getI18nLabel(91319, "社保起始缴纳月")));
|
||||
insuranceArchivesSocialSchemePO.setSocialEndTime((String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91320, "社保最后缴纳月")).get(
|
||||
SalaryI18nUtil.getI18nLabel(91320, "社保最后缴纳月")));
|
||||
insuranceArchivesSocialSchemePO.setTenantKey("");
|
||||
insuranceArchivesSocialSchemePO.setWelfareType(WelfareTypeEnum.SOCIAL_SECURITY.getValue());
|
||||
insuranceArchivesSocialSchemePO.setUpdateTime(new Date());
|
||||
insuranceArchivesSocialSchemePO.setPaymentOrganization(paymentNameIdMap.get(
|
||||
(String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91325, "社保缴纳组织")).get(
|
||||
SalaryI18nUtil.getI18nLabel(91325, "社保缴纳组织"))));
|
||||
insuranceArchivesSocialSchemePO.setNonPayment(NonPaymentEnum.YES.getValue());
|
||||
insuranceArchivesSocialSchemePO.setCreator(creator);
|
||||
insuranceArchivesSocialSchemePO.setCreateTime(new Date());
|
||||
insuranceArchivesSocialSchemePO.setUpdateTime(new Date());
|
||||
insuranceArchivesSocialSchemePO.setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue());
|
||||
insuranceArchivesSocialSchemePO.setEmployeeId(employeeId);
|
||||
insuranceArchivesSocialSchemePO.setUnderTake(UndertakerEnum.SCOPE_COMPANY.getValue());
|
||||
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS =
|
||||
getInsuranceSchemeDetailMapper().queryListBySchemeId(insuranceArchivesSocialSchemePO.getSocialSchemeId());
|
||||
if (CollectionUtils.isNotEmpty(insuranceSchemeDetailPOS)) {
|
||||
List<Long> insuranceIds = insuranceSchemeDetailPOS.stream().map(InsuranceSchemeDetailPO::getInsuranceId).collect(Collectors.toList());
|
||||
HashMap<String, String> socialPaymentBase = new HashMap<>();
|
||||
for (Long insuranceId : insuranceIds) {
|
||||
if (StringUtils.isBlank(welfareMap.get(insuranceId))) {
|
||||
continue;
|
||||
}
|
||||
if (findElement(singleAccount, welfareMap.get(insuranceId) + SalaryI18nUtil.getI18nLabel(100293, "申报基数")) != null) {
|
||||
socialPaymentBase.put(String.valueOf(insuranceId),
|
||||
(String) findElement(singleAccount, welfareMap.get(insuranceId) + SalaryI18nUtil.getI18nLabel(100293, "申报基数")).get(
|
||||
welfareMap.get(insuranceId) + SalaryI18nUtil.getI18nLabel(100293, "申报基数")));
|
||||
}
|
||||
}
|
||||
insuranceArchivesSocialSchemePO.setSocialPaymentBaseString(JSON.toJSONString(socialPaymentBase));
|
||||
}
|
||||
return insuranceArchivesSocialSchemePO;
|
||||
}
|
||||
|
||||
|
||||
public InsuranceArchivesFundSchemePO buildFundPO(Long employeeId, Map<Long, String> welfareMap, List<Map<String, Object>> singleAccount, Map<String, Long> schemeNameIdMap,
|
||||
Map<String, Long> paymentNameIdMap, Long creator) {
|
||||
|
||||
if (employeeId == null) {
|
||||
return null;
|
||||
}
|
||||
InsuranceArchivesFundSchemePO insuranceArchivesFundSchemePO = new InsuranceArchivesFundSchemePO();
|
||||
insuranceArchivesFundSchemePO.setId(IdGenerator.generate());
|
||||
insuranceArchivesFundSchemePO.setCreator(creator);
|
||||
insuranceArchivesFundSchemePO.setTenantKey("");
|
||||
insuranceArchivesFundSchemePO.setCreateTime(new Date());
|
||||
insuranceArchivesFundSchemePO.setUpdateTime(new Date());
|
||||
insuranceArchivesFundSchemePO.setFundSchemeId(schemeNameIdMap.get(
|
||||
(String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91485, "公积金方案名称")).get(
|
||||
SalaryI18nUtil.getI18nLabel(91485, "公积金方案名称"))));
|
||||
insuranceArchivesFundSchemePO.setFundAccount((String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91486, "公积金账号")).get(
|
||||
SalaryI18nUtil.getI18nLabel(91486, "公积金账号")));
|
||||
insuranceArchivesFundSchemePO.setSupplementFundAccount((String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91487, "补充公积金账号")).get(
|
||||
SalaryI18nUtil.getI18nLabel(91487, "补充公积金账号")));
|
||||
insuranceArchivesFundSchemePO.setFundStartTime((String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91483, "公积金起始缴纳月")).get(
|
||||
SalaryI18nUtil.getI18nLabel( 91483, "公积金起始缴纳月")));
|
||||
insuranceArchivesFundSchemePO.setFundEndTime((String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91484, "公积金最后缴纳月")).get(
|
||||
SalaryI18nUtil.getI18nLabel(91484, "公积金最后缴纳月")));
|
||||
insuranceArchivesFundSchemePO.setWelfareType(WelfareTypeEnum.ACCUMULATION_FUND.getValue());
|
||||
insuranceArchivesFundSchemePO.setPaymentOrganization(paymentNameIdMap.get(
|
||||
(String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91488, "公积金缴纳组织")).get(
|
||||
SalaryI18nUtil.getI18nLabel(91488, "公积金缴纳组织"))));
|
||||
insuranceArchivesFundSchemePO.setNonPayment(NonPaymentEnum.YES.getValue());
|
||||
insuranceArchivesFundSchemePO.setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue());
|
||||
insuranceArchivesFundSchemePO.setUnderTake(UndertakerEnum.SCOPE_COMPANY.getValue());
|
||||
insuranceArchivesFundSchemePO.setEmployeeId(employeeId);
|
||||
|
||||
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = getInsuranceSchemeDetailMapper().queryListBySchemeId(insuranceArchivesFundSchemePO.getFundSchemeId());
|
||||
if (CollectionUtils.isNotEmpty(insuranceSchemeDetailPOS)) {
|
||||
List<Long> insuranceIds = insuranceSchemeDetailPOS.stream().map(InsuranceSchemeDetailPO::getInsuranceId).collect(Collectors.toList());
|
||||
HashMap<String, String> socialPaymentBase = new HashMap<>();
|
||||
for (Long insuranceId : insuranceIds) {
|
||||
if (StringUtils.isBlank(welfareMap.get(insuranceId))) {
|
||||
continue;
|
||||
}
|
||||
if (findElement(singleAccount, welfareMap.get(insuranceId) + SalaryI18nUtil.getI18nLabel(100293, "申报基数")) != null) {
|
||||
socialPaymentBase.put(String.valueOf(insuranceId),
|
||||
(String) findElement(singleAccount, welfareMap.get(insuranceId) + SalaryI18nUtil.getI18nLabel(100293, "申报基数")).get(
|
||||
welfareMap.get(insuranceId) + SalaryI18nUtil.getI18nLabel(100293, "申报基数")));
|
||||
}
|
||||
}
|
||||
insuranceArchivesFundSchemePO.setFundPaymentBaseString(JSON.toJSONString(socialPaymentBase));
|
||||
}
|
||||
return insuranceArchivesFundSchemePO;
|
||||
}
|
||||
|
||||
|
||||
public InsuranceArchivesOtherSchemePO buildOtherPO(Long employeeId, Map<Long, String> welfareMap, List<Map<String, Object>> singleAccount, Map<String, Long> schemeNameIdMap,
|
||||
Map<String, Long> paymentNameIdMap, Long creator) {
|
||||
|
||||
if (employeeId == null) {
|
||||
return null;
|
||||
}
|
||||
InsuranceArchivesOtherSchemePO insuranceArchivesOtherSchemePO = new InsuranceArchivesOtherSchemePO();
|
||||
insuranceArchivesOtherSchemePO.setId(IdGenerator.generate());
|
||||
insuranceArchivesOtherSchemePO.setCreator(creator);
|
||||
insuranceArchivesOtherSchemePO.setTenantKey("");
|
||||
insuranceArchivesOtherSchemePO.setCreateTime(new Date());
|
||||
insuranceArchivesOtherSchemePO.setUpdateTime(new Date());
|
||||
insuranceArchivesOtherSchemePO.setOtherSchemeId(
|
||||
schemeNameIdMap.get((String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称")).get(
|
||||
SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称"))));
|
||||
insuranceArchivesOtherSchemePO.setOtherStartTime((String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91490, "其他福利起始缴纳月")).get(
|
||||
SalaryI18nUtil.getI18nLabel(91490, "其他福利起始缴纳月")));
|
||||
insuranceArchivesOtherSchemePO.setOtherEndTime((String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91494, "其他福利最后缴纳月")).get(
|
||||
SalaryI18nUtil.getI18nLabel(91494, "其他福利最后缴纳月")));
|
||||
insuranceArchivesOtherSchemePO.setPaymentOrganization(paymentNameIdMap.get(
|
||||
(String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91497, "其他福利缴纳组织")).get(
|
||||
SalaryI18nUtil.getI18nLabel(91497, "其他福利缴纳组织"))));
|
||||
insuranceArchivesOtherSchemePO.setWelfareType(WelfareTypeEnum.OTHER.getValue());
|
||||
insuranceArchivesOtherSchemePO.setNonPayment(NonPaymentEnum.YES.getValue());
|
||||
insuranceArchivesOtherSchemePO.setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue());
|
||||
insuranceArchivesOtherSchemePO.setUnderTake(UndertakerEnum.SCOPE_COMPANY.getValue());
|
||||
insuranceArchivesOtherSchemePO.setEmployeeId(employeeId);
|
||||
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = getInsuranceSchemeDetailMapper().queryListBySchemeId(insuranceArchivesOtherSchemePO.getOtherSchemeId());
|
||||
if (CollectionUtils.isNotEmpty(insuranceSchemeDetailPOS)) {
|
||||
List<Long> insuranceIds = insuranceSchemeDetailPOS.stream().map(InsuranceSchemeDetailPO::getInsuranceId).collect(Collectors.toList());
|
||||
HashMap<String, String> socialPaymentBase = new HashMap<>();
|
||||
for (Long insuranceId : insuranceIds) {
|
||||
if (StringUtils.isBlank(welfareMap.get(insuranceId))) {
|
||||
continue;
|
||||
}
|
||||
if (findElement(singleAccount, welfareMap.get(insuranceId) + SalaryI18nUtil.getI18nLabel(100293, "申报基数")) != null) {
|
||||
socialPaymentBase.put(String.valueOf(insuranceId),
|
||||
(String) findElement(singleAccount, welfareMap.get(insuranceId) + SalaryI18nUtil.getI18nLabel(100293, "申报基数")).get(
|
||||
welfareMap.get(insuranceId) + SalaryI18nUtil.getI18nLabel(100293, "申报基数")));
|
||||
}
|
||||
}
|
||||
insuranceArchivesOtherSchemePO.setOtherPaymentBaseString(JSON.toJSONString(socialPaymentBase));
|
||||
}
|
||||
return insuranceArchivesOtherSchemePO;
|
||||
}
|
||||
|
||||
public void handleImportData(List<InsuranceArchivesAccountPO> insuranceArchivesAccountPOS) {
|
||||
//导入社保档案
|
||||
List<InsuranceArchivesSocialSchemePO> socialSchemePOS = insuranceArchivesAccountPOS.stream().filter(Objects::nonNull).map(InsuranceArchivesAccountPO::getSocial)
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(socialSchemePOS)) {
|
||||
socialSchemePOS = socialSchemePOS.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(
|
||||
() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesSocialSchemePO::getEmployeeId))
|
||||
), ArrayList::new));
|
||||
List<Long> socialEmployeeIds = socialSchemePOS.stream().map(InsuranceArchivesSocialSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
getSocialSchemeMapper().batchDeleteByEmployeeIds(socialEmployeeIds);
|
||||
getSocialSchemeMapper().batchSave(socialSchemePOS);
|
||||
}
|
||||
//导入公积金档案
|
||||
List<InsuranceArchivesFundSchemePO> fundSchemePOS = insuranceArchivesAccountPOS.stream().filter(Objects::nonNull).map(InsuranceArchivesAccountPO::getFund)
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(fundSchemePOS)) {
|
||||
fundSchemePOS = fundSchemePOS.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(
|
||||
() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesFundSchemePO::getEmployeeId))
|
||||
), ArrayList::new));
|
||||
List<Long> fundEmployeeIds = fundSchemePOS.stream().map(InsuranceArchivesFundSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
getFundSchemeMapper().batchDeleteByEmployeeIds(fundEmployeeIds);
|
||||
getFundSchemeMapper().batchSave(fundSchemePOS);
|
||||
}
|
||||
//导入其他福利档案
|
||||
List<InsuranceArchivesOtherSchemePO> otherSchemePOS = insuranceArchivesAccountPOS.stream().filter(Objects::nonNull).map(InsuranceArchivesAccountPO::getOther)
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(otherSchemePOS)) {
|
||||
otherSchemePOS = otherSchemePOS.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(
|
||||
() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesOtherSchemePO::getEmployeeId))
|
||||
), ArrayList::new));
|
||||
List<Long> otherEmployeeIds = otherSchemePOS.stream().map(InsuranceArchivesOtherSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
getOtherSchemeMapper().batchDeleteByEmployeeIds(otherEmployeeIds);
|
||||
getOtherSchemeMapper().batchSave(otherSchemePOS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出档案导入所需要的模板,可根据开关选择是否导出现有的档案数据
|
||||
*
|
||||
* @param param 是否导出带档案数据的模板
|
||||
*/
|
||||
public XSSFWorkbook exportTemplate(InsuranceArchivesListParam param) {
|
||||
return getSIImportService().exportTemplate(param);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ import com.engine.salary.exception.SalaryRunTimeException;
|
|||
import com.engine.salary.mapper.salaryacct.SalaryAcctEmployeeMapper;
|
||||
import com.engine.salary.mapper.salaryacct.SalaryAcctRecordMapper;
|
||||
import com.engine.salary.mapper.salaryacct.SalaryAcctResultMapper;
|
||||
import com.engine.salary.mapper.salarybill.SalarySendInfoMapper;
|
||||
import com.engine.salary.mapper.salarybill.SalarySendMapper;
|
||||
import com.engine.salary.service.*;
|
||||
import com.engine.salary.util.JsonUtil;
|
||||
import com.engine.salary.util.SalaryDateUtil;
|
||||
|
|
@ -42,6 +44,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
|
@ -67,6 +70,10 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
|
|||
return ServiceUtil.getService(SalaryTemplateServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalarySendMapper getSalarySendMapper() {
|
||||
return SqlProxyHandle.getProxy(SalarySendMapper.class);
|
||||
}
|
||||
|
||||
private SalarySobBiz salarySobMapper = new SalarySobBiz();
|
||||
|
||||
|
||||
|
|
@ -95,6 +102,10 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
|
|||
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalarySendInfoMapper getSalarySendInfoMapper() {
|
||||
return SqlProxyHandle.getProxy(SalarySendInfoMapper.class);
|
||||
}
|
||||
|
||||
// @RpcReference
|
||||
// private FileDownloadClient fileDownloadClient;
|
||||
// /**
|
||||
|
|
@ -216,56 +227,50 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
|
|||
return "";
|
||||
}
|
||||
|
||||
// @Override
|
||||
// @Transactional(rollbackFor = Exception.class)
|
||||
// public void revokeSalaryBill(Long salaryAccountingId, Long currentEmployeeId, String currentTenantKey) {
|
||||
// // 校验salaryAccountingId
|
||||
// if (salaryAccountingId == null) {
|
||||
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 100497, "核算id必传"));
|
||||
// }
|
||||
//
|
||||
// List<SalaryAcctRecordPO> acctRecords = new LambdaQueryChainWrapper<>(salaryAcctRecordMapper)
|
||||
// .eq(SalaryAcctRecordPO::getDeleteType, 0)
|
||||
// .eq(SalaryAcctRecordPO::getTenantKey, currentTenantKey)
|
||||
// .eq(SalaryAcctRecordPO::getId, salaryAccountingId)
|
||||
// .list();
|
||||
// // 检查核算的归档记录
|
||||
// if (CollectionUtils.isEmpty(acctRecords)) {
|
||||
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 100498, "核算记录不存在"));
|
||||
// }
|
||||
//
|
||||
// List<SalarySendPO> salarySends = new LambdaQueryChainWrapper<>(mapper)
|
||||
// .eq(SalarySendPO::getDeleteType, 0)
|
||||
// .eq(SalarySendPO::getTenantKey, currentTenantKey)
|
||||
// .eq(SalarySendPO::getSalaryAccountingId, salaryAccountingId).list();
|
||||
// if (CollectionUtils.isEmpty(salarySends)) {
|
||||
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 100505, "工资单不存在"));
|
||||
// }
|
||||
//
|
||||
// SalarySendPO salarySend = salarySends.get(0);
|
||||
// // 已发送工资单
|
||||
// List<SalarySendInfoPO> salarySendInfos = new LambdaQueryChainWrapper<>(salarySendInfoMapper)
|
||||
// .eq(SalarySendInfoPO::getDeleteType, 0)
|
||||
// .eq(SalarySendInfoPO::getTenantKey, currentTenantKey)
|
||||
// .eq(SalarySendInfoPO::getSalarySendId, salarySend.getId())
|
||||
// .eq(SalarySendInfoPO::getSendStatus, SalarySendStatusEnum.ALREADYSEND.getValue()).list();
|
||||
// if (salarySend.getSendNum() > 0 || CollectionUtils.isNotEmpty(salarySendInfos)) {
|
||||
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 100507, "工资单已经发放,不可撤销"));
|
||||
// }
|
||||
// // 删除工资单
|
||||
// new LambdaUpdateChainWrapper<>(mapper)
|
||||
// .eq(SalarySendPO::getDeleteType, 0)
|
||||
// .eq(SalarySendPO::getTenantKey, currentTenantKey)
|
||||
// .eq(SalarySendPO::getId, salarySend.getId())
|
||||
// .set(SalarySendPO::getSendNum, 0)
|
||||
// .set(SalarySendPO::getDeleteType, 1).update();
|
||||
// // 删除工资单发放
|
||||
// new LambdaUpdateChainWrapper<>(salarySendInfoMapper)
|
||||
// .eq(SalarySendInfoPO::getDeleteType, 0)
|
||||
// .eq(SalarySendInfoPO::getTenantKey, currentTenantKey)
|
||||
// .eq(SalarySendInfoPO::getSalarySendId, salarySend.getId())
|
||||
// .set(SalarySendInfoPO::getDeleteType, 1).update();
|
||||
// }
|
||||
@Override
|
||||
public void revokeSalaryBill(Long salaryAccountingId, Long currentEmployeeId, String currentTenantKey) {
|
||||
// 校验salaryAccountingId
|
||||
if (salaryAccountingId == null) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100497, "核算id必传"));
|
||||
}
|
||||
|
||||
SalaryAcctRecordPO po = SalaryAcctRecordPO.builder().id(salaryAccountingId).build();
|
||||
List<SalaryAcctRecordPO> acctRecords = getSalaryAcctRecordMapper().listSome(po);
|
||||
// 检查核算的归档记录
|
||||
if (CollectionUtils.isEmpty(acctRecords)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100498, "核算记录不存在"));
|
||||
}
|
||||
|
||||
SalarySendPO build = SalarySendPO.builder().salaryAccountingId(salaryAccountingId).deleteType(0).build();
|
||||
List<SalarySendPO> salarySends = getSalarySendMapper().listSome(build);
|
||||
if (CollectionUtils.isEmpty(salarySends)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100505, "工资单不存在"));
|
||||
}
|
||||
|
||||
SalarySendPO salarySend = salarySends.get(0);
|
||||
// 已发送工资单
|
||||
SalarySendInfoPO sendInfo = SalarySendInfoPO.builder()
|
||||
.deleteType(0)
|
||||
.salarySendId(salarySend.getId())
|
||||
.sendStatus(SalarySendStatusEnum.ALREADYSEND.getValue()).build();
|
||||
List<SalarySendInfoPO> salarySendInfos = getSalarySendInfoMapper().listSome(sendInfo);
|
||||
if (salarySend.getSendNum() > 0 || CollectionUtils.isNotEmpty(salarySendInfos)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100507, "工资单已经发放,不可撤销"));
|
||||
}
|
||||
// 删除工资单
|
||||
SalarySendPO salarySendPO = SalarySendPO.builder()
|
||||
.id(salarySend.getId())
|
||||
.sendNum(0)
|
||||
.deleteType(1)
|
||||
.build();
|
||||
getSalarySendMapper().updateIgnoreNull(salarySendPO);
|
||||
// 删除工资单发放
|
||||
SalarySendInfoPO infoPO = SalarySendInfoPO.builder()
|
||||
.salarySendId(salarySend.getId())
|
||||
.deleteType(1)
|
||||
.build();
|
||||
getSalarySendInfoMapper().updateGrantWithdraw(infoPO, salarySend.getId(), null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<SalarySendListDTO> listPage(SalarySendQueryParam queryParam) {
|
||||
|
|
|
|||
|
|
@ -2,16 +2,28 @@ package com.engine.salary.web;
|
|||
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.salary.entity.datacollection.param.AttendQuoteDataImportParam;
|
||||
import com.engine.salary.entity.siaccount.po.InsuranceAccountInspectPO;
|
||||
import com.engine.salary.entity.siarchives.param.InsuranceArchivesListParam;
|
||||
import com.engine.salary.entity.sischeme.dto.InsuranceSchemeListDTO;
|
||||
import com.engine.salary.entity.sischeme.param.InsuranceSchemeParam;
|
||||
import com.engine.salary.entity.sischeme.param.InsuranceSchemeReqParam;
|
||||
import com.engine.salary.entity.sischeme.param.SISchemaImportParam;
|
||||
import com.engine.salary.enums.sicategory.WelfareTypeEnum;
|
||||
import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper;
|
||||
import com.engine.salary.service.SIAccountService;
|
||||
import com.engine.salary.service.SISchemeService;
|
||||
import com.engine.salary.service.impl.SIAccountServiceImpl;
|
||||
import com.engine.salary.service.impl.SISchemeServiceImpl;
|
||||
import com.engine.salary.util.ResponseResult;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import com.engine.salary.wrapper.SISchemeWrapper;
|
||||
import com.wbi.util.Util;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import org.apache.axis2.wsdl.codegen.writer.CBuildScriptWriter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
|
|
@ -20,8 +32,12 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.StreamingOutput;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
|
|
@ -40,6 +56,10 @@ public class SISchemeController {
|
|||
return ServiceUtil.getService(SISchemeWrapper.class,user);
|
||||
}
|
||||
|
||||
private SIAccountService getSIAccountService(User user) {
|
||||
return ServiceUtil.getService(SIAccountServiceImpl.class, user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询福利方案表单
|
||||
* @param request
|
||||
|
|
@ -157,6 +177,86 @@ public class SISchemeController {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出档案
|
||||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Path("/export")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response export(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
InsuranceArchivesListParam param = new InsuranceArchivesListParam();
|
||||
String ids = request.getParameter("ids");
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
param.setIds( Arrays.stream(ids.split(",")).map(Long::valueOf).collect(Collectors.toList()));
|
||||
}
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
XSSFWorkbook workbook = getService(user).export(param);
|
||||
String fileName = null;
|
||||
try {
|
||||
fileName = URLEncoder.encode("福利档案.xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
StreamingOutput output = outputStream -> {
|
||||
workbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
};
|
||||
return Response.ok(output)
|
||||
.header("Content-disposition", "attachment;filename=" + fileName)
|
||||
.header("Cache-Control", "no-cache").build();
|
||||
}
|
||||
|
||||
|
||||
@POST
|
||||
@Path("/preview")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String preview(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SISchemaImportParam queryParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<SISchemaImportParam, Map<String, Object>>(user).run(getService(user)::preview, queryParam);
|
||||
}
|
||||
|
||||
|
||||
@POST
|
||||
@Path("/importBatch")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String batchImportEbatch(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SISchemaImportParam queryParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<SISchemaImportParam, Map<String, Object>>(user).run(getService(user)::batchImportEbatch, queryParam);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出档案和档案模板
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/template/export")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response exportTemplate(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody InsuranceArchivesListParam param) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
if (param.getInspectAll() != null && param.getInspectAll()) {
|
||||
List<InsuranceAccountInspectPO> insuranceAccountInspectPOS = getSIAccountService(user).allInspects(param.getIds(), param.getBillMonth());
|
||||
param.setEmployeeIds(insuranceAccountInspectPOS.stream().map(InsuranceAccountInspectPO::getEmployeeId).distinct().collect(Collectors.toList()));
|
||||
}
|
||||
XSSFWorkbook workbook = getService(user).exportTemplate(param);
|
||||
String fileName = null;
|
||||
try {
|
||||
fileName = URLEncoder.encode("福利档案模板.xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
StreamingOutput output = outputStream -> {
|
||||
workbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
};
|
||||
return Response.ok(output)
|
||||
.header("Content-disposition", "attachment;filename=" + fileName)
|
||||
.header("Cache-Control", "no-cache").build();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue