联特 报表(4张)
This commit is contained in:
parent
3a1d2defbe
commit
fd0808bb0c
|
|
@ -0,0 +1 @@
|
||||||
|
alter table hrsa_hrm_snapshot add column lt_cbzx varchar(255);
|
||||||
|
|
@ -125,6 +125,8 @@ public class DataCollectionEmployee {
|
||||||
@SalaryFormulaVar(defaultLabel = "账号类型编码", labelId = 98622, dataType = "string")
|
@SalaryFormulaVar(defaultLabel = "账号类型编码", labelId = 98622, dataType = "string")
|
||||||
private Integer accountType;
|
private Integer accountType;
|
||||||
|
|
||||||
|
private String ltCbzx;
|
||||||
|
|
||||||
//是否是系统管理员
|
//是否是系统管理员
|
||||||
private Boolean isAdmin;
|
private Boolean isAdmin;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -74,5 +74,6 @@ public class VariableArchiveItemPO {
|
||||||
//主键id集合
|
//主键id集合
|
||||||
private Collection<Long> ids;
|
private Collection<Long> ids;
|
||||||
private Collection<Long> variableArchiveIds;
|
private Collection<Long> variableArchiveIds;
|
||||||
|
private Collection<Long> variableItemIds;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -427,6 +427,11 @@ public class HrmSnapshotPO {
|
||||||
@ElogTransform(name = "工作年限")
|
@ElogTransform(name = "工作年限")
|
||||||
private BigDecimal workyear;
|
private BigDecimal workyear;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联特 成本中心
|
||||||
|
*/
|
||||||
|
private String ltCbzx;
|
||||||
|
|
||||||
|
|
||||||
//主键id集合
|
//主键id集合
|
||||||
private Collection<Long> ids;
|
private Collection<Long> ids;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.engine.salary.entity.salaryacct.dto;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName LtSalaryReportConfigDTO
|
||||||
|
* @author Harryxzy
|
||||||
|
* @date 2025/7/30 17:45
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class LtSalaryReportConfigDTO {
|
||||||
|
|
||||||
|
// variable_id
|
||||||
|
private Long item;
|
||||||
|
|
||||||
|
// 数据库字段名
|
||||||
|
private String field;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -188,4 +188,6 @@ public interface EmployMapper {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<DataCollectionEmployee> listByKeyword(@Param("keyword") String keyword);
|
List<DataCollectionEmployee> listByKeyword(@Param("keyword") String keyword);
|
||||||
|
|
||||||
|
List<DataCollectionEmployee> listByWorkCodes(@Param("workCodes") List<String> workCodes);
|
||||||
}
|
}
|
||||||
|
|
@ -721,4 +721,22 @@
|
||||||
from hrmjobcall job
|
from hrmjobcall job
|
||||||
where job.id = #{jobCallId}
|
where job.id = #{jobCallId}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="listByWorkCodes" resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
|
||||||
|
select e.id as employeeId,
|
||||||
|
e.lastname as username,
|
||||||
|
e.status as status,
|
||||||
|
e.certificatenum as idNo,
|
||||||
|
e.workcode as workcode,
|
||||||
|
e.companystartdate as companystartdate,
|
||||||
|
e.mobile as mobile,
|
||||||
|
e.enddate as dismissdate
|
||||||
|
from hrmresource e
|
||||||
|
where e.status not in (7)
|
||||||
|
<if test="workCodes != null and workCodes.size()>0">
|
||||||
|
AND e.workcode IN
|
||||||
|
<foreach collection="workCodes" open="(" item="workCode" separator="," close=")">
|
||||||
|
#{workCode}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -92,6 +92,12 @@
|
||||||
#{varArchId}
|
#{varArchId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.variableItemIds != null and param.variableItemIds.size()>0">
|
||||||
|
AND variable_item_id IN
|
||||||
|
<foreach collection="param.variableItemIds" open="(" item="variableItemId" separator="," close=")">
|
||||||
|
#{variableItemId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
ORDER BY id DESC
|
ORDER BY id DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,7 @@
|
||||||
<result column="WORKROOM" property="workroom"/>
|
<result column="WORKROOM" property="workroom"/>
|
||||||
<result column="workstartdate" property="workstartdate"/>
|
<result column="workstartdate" property="workstartdate"/>
|
||||||
<result column="workyear" property="workyear"/>
|
<result column="workyear" property="workyear"/>
|
||||||
|
<result column="lt_cbzx" property="ltCbzx"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<!-- 表字段 -->
|
<!-- 表字段 -->
|
||||||
|
|
@ -144,6 +145,7 @@
|
||||||
, t.WORKROOM
|
, t.WORKROOM
|
||||||
, t.workstartdate
|
, t.workstartdate
|
||||||
, t.workyear
|
, t.workyear
|
||||||
|
, t.lt_cbzx
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<!-- 查询全部 -->
|
<!-- 查询全部 -->
|
||||||
|
|
@ -600,6 +602,9 @@
|
||||||
<if test="workyear != null">
|
<if test="workyear != null">
|
||||||
workyear,
|
workyear,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="ltCbzx != null">
|
||||||
|
lt_cbzx,
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||||
<if test="accountid1 != null">
|
<if test="accountid1 != null">
|
||||||
|
|
@ -806,6 +811,9 @@
|
||||||
<if test="workyear != null">
|
<if test="workyear != null">
|
||||||
#{workyear},
|
#{workyear},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="ltCbzx != null">
|
||||||
|
#{ltCbzx},
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -253,4 +253,29 @@ public interface SalaryAcctResultService {
|
||||||
Map<String, String> newResultValueMap,
|
Map<String, String> newResultValueMap,
|
||||||
SalaryLogOperateTypeEnum operateType);
|
SalaryLogOperateTypeEnum operateType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联特 - 生成部门社保明细表
|
||||||
|
* @param salaryMonth
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String ltGenBmsbmxb(String salaryMonth);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联特 - 生成部门公积金明细表
|
||||||
|
* @param salaryMonth
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String ltGenBmgjjmxb(String salaryMonth);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联特 - 生成部门工资&奖金明细表-计提
|
||||||
|
* @param salaryMonth
|
||||||
|
*/
|
||||||
|
String ltGenBmgzjjmxJt(String salaryMonth);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联特 - 生成部门工资&奖金明细表-实发
|
||||||
|
* @param salaryMonth
|
||||||
|
*/
|
||||||
|
String ltGenBmgzjjmxSf(String salaryMonth);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import com.engine.salary.util.page.PageInfo;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
@ -121,6 +122,8 @@ public interface SalaryArchiveItemService {
|
||||||
*/
|
*/
|
||||||
List<SalaryArchiveItemPO> getCurrentEffectiveItemList(Collection<Long> salaryArchivesIds, Collection<Long> salaryItemIds);
|
List<SalaryArchiveItemPO> getCurrentEffectiveItemList(Collection<Long> salaryArchivesIds, Collection<Long> salaryItemIds);
|
||||||
|
|
||||||
|
List<SalaryArchiveItemPO> getEffectiveItemListBySalaryMonth(Collection<Long> salaryArchivesIds, Collection<Long> salaryItemIds, Date SalaryMonth);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取薪资档案对应的当前生效的薪资项目忽略值
|
* 获取薪资档案对应的当前生效的薪资项目忽略值
|
||||||
|
|
|
||||||
|
|
@ -210,4 +210,6 @@ public interface SalaryEmployeeService {
|
||||||
JobCallInfo getJobCallInfoById(Long jobCallId);
|
JobCallInfo getJobCallInfoById(Long jobCallId);
|
||||||
|
|
||||||
List<DataCollectionEmployee> snapshot(List<Long> employeeIds, Date snapshotTime);
|
List<DataCollectionEmployee> snapshot(List<Long> employeeIds, Date snapshotTime);
|
||||||
|
|
||||||
|
List<DataCollectionEmployee> listByWorkCodes(List<String> workcodes);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,4 +33,6 @@ public interface VariableArchiveItemService {
|
||||||
void deleteByIds(List<Long> variableArchiveItemIds);
|
void deleteByIds(List<Long> variableArchiveItemIds);
|
||||||
|
|
||||||
void deleteByArchiveIds(List<Long> variableArchiveIds);
|
void deleteByArchiveIds(List<Long> variableArchiveIds);
|
||||||
|
|
||||||
|
List<VariableArchiveItemPO> listByVariableArchiveIdsAndItemIds(List<Long> variableArchiveIds, List<Long> variableItemIds);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,5 +71,7 @@ public interface VariableArchiveService {
|
||||||
|
|
||||||
List<Map<String, Object>> listBySalaryMonthAndEmployeeIds(YearMonth salaryMonth, List<Long> employeeIds, List<Long> taxAgentIds);
|
List<Map<String, Object>> listBySalaryMonthAndEmployeeIds(YearMonth salaryMonth, List<Long> employeeIds, List<Long> taxAgentIds);
|
||||||
|
|
||||||
|
List<Map<String, Object>> listBySalaryMonthAndItems(YearMonth salaryMonth, List<Long> variableItemIds);
|
||||||
|
|
||||||
void updateData(VariableArchiveSaveParam updateParam);
|
void updateData(VariableArchiveSaveParam updateParam);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,13 @@ import com.engine.salary.entity.progress.ProgressDTO;
|
||||||
import com.engine.salary.entity.report.po.SalaryAcctResultReportPO;
|
import com.engine.salary.entity.report.po.SalaryAcctResultReportPO;
|
||||||
import com.engine.salary.entity.salaryacct.bo.*;
|
import com.engine.salary.entity.salaryacct.bo.*;
|
||||||
import com.engine.salary.entity.salaryacct.dto.ConsolidatedTaxDetailDTO;
|
import com.engine.salary.entity.salaryacct.dto.ConsolidatedTaxDetailDTO;
|
||||||
|
import com.engine.salary.entity.salaryacct.dto.LtSalaryReportConfigDTO;
|
||||||
import com.engine.salary.entity.salaryacct.dto.SalaryAcctResultDetailDTO;
|
import com.engine.salary.entity.salaryacct.dto.SalaryAcctResultDetailDTO;
|
||||||
import com.engine.salary.entity.salaryacct.dto.SalaryAcctResultListColumnDTO;
|
import com.engine.salary.entity.salaryacct.dto.SalaryAcctResultListColumnDTO;
|
||||||
import com.engine.salary.entity.salaryacct.param.*;
|
import com.engine.salary.entity.salaryacct.param.*;
|
||||||
import com.engine.salary.entity.salaryacct.po.*;
|
import com.engine.salary.entity.salaryacct.po.*;
|
||||||
|
import com.engine.salary.entity.salaryarchive.po.SalaryArchiveItemPO;
|
||||||
|
import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO;
|
||||||
import com.engine.salary.entity.salaryformula.ExpressFormula;
|
import com.engine.salary.entity.salaryformula.ExpressFormula;
|
||||||
import com.engine.salary.entity.salaryformula.po.FormulaVar;
|
import com.engine.salary.entity.salaryformula.po.FormulaVar;
|
||||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||||
|
|
@ -51,6 +54,7 @@ import com.engine.salary.sys.entity.po.SalarySysConfPO;
|
||||||
import com.engine.salary.sys.enums.TaxDeclarationFunctionEnum;
|
import com.engine.salary.sys.enums.TaxDeclarationFunctionEnum;
|
||||||
import com.engine.salary.sys.service.SalarySysConfService;
|
import com.engine.salary.sys.service.SalarySysConfService;
|
||||||
import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
|
import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
|
||||||
|
import com.engine.salary.util.JsonUtil;
|
||||||
import com.engine.salary.util.SalaryDateUtil;
|
import com.engine.salary.util.SalaryDateUtil;
|
||||||
import com.engine.salary.util.SalaryEntityUtil;
|
import com.engine.salary.util.SalaryEntityUtil;
|
||||||
import com.engine.salary.util.SalaryI18nUtil;
|
import com.engine.salary.util.SalaryI18nUtil;
|
||||||
|
|
@ -72,10 +76,18 @@ import org.jetbrains.annotations.NotNull;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||||
import org.springframework.util.StopWatch;
|
import org.springframework.util.StopWatch;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.conn.RecordSetDataSource;
|
||||||
|
import weaver.formmode.setup.ModeRightInfo;
|
||||||
import weaver.general.BaseBean;
|
import weaver.general.BaseBean;
|
||||||
|
import weaver.general.TimeUtil;
|
||||||
import weaver.hrm.User;
|
import weaver.hrm.User;
|
||||||
|
import weaver.wechat.util.Utils;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.YearMonth;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.BlockingDeque;
|
import java.util.concurrent.BlockingDeque;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
|
@ -83,9 +95,8 @@ import java.util.concurrent.LinkedBlockingDeque;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.engine.salary.sys.constant.SalarySysConstant.SALARY_ACCT_SYNC_TYPE;
|
|
||||||
|
|
||||||
import static com.engine.salary.constant.SalaryFormulaFieldConstant.SALARY_PATTERN;
|
import static com.engine.salary.constant.SalaryFormulaFieldConstant.SALARY_PATTERN;
|
||||||
|
import static com.engine.salary.sys.constant.SalarySysConstant.SALARY_ACCT_SYNC_TYPE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 薪资核算结果
|
* 薪资核算结果
|
||||||
|
|
@ -220,6 +231,23 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
||||||
return ServiceUtil.getService(SalarySobTaxRuleServiceImpl.class, user);
|
return ServiceUtil.getService(SalarySobTaxRuleServiceImpl.class, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private VariableArchiveService getVariableArchiveService(User user) {
|
||||||
|
return ServiceUtil.getService(VariableArchiveServiceImpl.class, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
private VariableArchiveItemService getVariableArchiveItemService(User user) {
|
||||||
|
return ServiceUtil.getService(VariableArchiveItemServiceImpl.class, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
private SalaryArchiveService getSalaryArchiveService(User user) {
|
||||||
|
return ServiceUtil.getService(SalaryArchiveServiceImpl.class, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
private SalaryArchiveItemService getSalaryArchiveItemService(User user) {
|
||||||
|
return ServiceUtil.getService(SalaryArchiveItemServiceImpl.class, user);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SalaryAcctResultPO> listBySalaryAcctRecordIds(Collection<Long> salaryAcctRecordIds) {
|
public List<SalaryAcctResultPO> listBySalaryAcctRecordIds(Collection<Long> salaryAcctRecordIds) {
|
||||||
if (CollectionUtils.isEmpty(salaryAcctRecordIds)) {
|
if (CollectionUtils.isEmpty(salaryAcctRecordIds)) {
|
||||||
|
|
@ -1547,4 +1575,608 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
||||||
context.setNewValues(newResultValueMap);
|
context.setNewValues(newResultValueMap);
|
||||||
SalaryElogConfig.salaryAcctRecordLoggerTemplate.write(context);
|
SalaryElogConfig.salaryAcctRecordLoggerTemplate.write(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联特 - 生成部门社保明细表
|
||||||
|
* @param salaryMonth
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String ltGenBmsbmxb(String salaryMonth) {
|
||||||
|
if (!SalaryDateUtil.checkYearMonth(salaryMonth)) {
|
||||||
|
throw new SalaryRunTimeException("年月错误");
|
||||||
|
}
|
||||||
|
YearMonth yearMonth = SalaryDateUtil.String2YearMonth(salaryMonth);
|
||||||
|
// 查询需要生成哪些浮动薪资项目
|
||||||
|
BaseBean baseBean = new BaseBean();
|
||||||
|
String configStr = baseBean.getPropValue("ltSalaryReport", "bmsbmxb_ys_config");
|
||||||
|
List<LtSalaryReportConfigDTO> configs = JsonUtil.parseList(configStr, LtSalaryReportConfigDTO.class);
|
||||||
|
List<Long> variableItemIds = configs.stream().map(LtSalaryReportConfigDTO::getItem).collect(Collectors.toList());
|
||||||
|
// 获取浮动档案
|
||||||
|
List<Map<String, Object>> variableMapList = getVariableArchiveService(user).listBySalaryMonthAndItems(yearMonth, variableItemIds);
|
||||||
|
// 过滤数据,不能所有值为0或空
|
||||||
|
List<String> keyList = configs.stream().map(dto -> dto.getItem() + "_variableItem").collect(Collectors.toList());
|
||||||
|
variableMapList = variableMapList.stream().filter(map -> {
|
||||||
|
for (String key : keyList) {
|
||||||
|
String val = Utils.null2String(map.get(key));
|
||||||
|
if (StringUtils.isNotBlank(val) && NumberUtils.isCreatable(val) && new BigDecimal(val).compareTo(BigDecimal.ZERO) != 0 ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isEmpty(variableMapList)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
log.info("部门社保明细表size{} ",variableMapList.size());
|
||||||
|
// 获取人员信息
|
||||||
|
List<Long> empIds = variableMapList.stream().map(map -> Utils.null2String(map.get("employeeId"))).filter(NumberUtils::isCreatable).map(Long::valueOf).collect(Collectors.toList());
|
||||||
|
// Map<Long, DataCollectionEmployee> employeeMap = SalaryEntityUtil.convert2Map(getSalaryEmployeeService(user).listByIds(empIds), DataCollectionEmployee::getEmployeeId);
|
||||||
|
// 查询快照表中人员信息
|
||||||
|
Map<Long, DataCollectionEmployee> employeeMap = SalaryEntityUtil.convert2Map(getSalaryEmployeeService(user).snapshot(empIds, SalaryDateUtil.localDateToDate(yearMonth.atDay(1))), DataCollectionEmployee::getEmployeeId);
|
||||||
|
// 删除建模数据
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
rs.execute("delete from uf_bmsbmxb where xzszy = '" + salaryMonth+ "'");
|
||||||
|
// 插入建模
|
||||||
|
String currDate = String.format("'%s'", TimeUtil.getCurrentDateString());
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
|
||||||
|
String currTime = String.format("'%s'", sdf.format(new Date()));
|
||||||
|
// 获取建模模块id
|
||||||
|
String modeId = baseBean.getPropValue("ltSalaryReport", "bmsbmxb_mode_id");
|
||||||
|
// 先插入一条数据
|
||||||
|
Map<String, Object> firstData = variableMapList.get(0);
|
||||||
|
StringBuilder firstSb = new StringBuilder();
|
||||||
|
String fieldStr = configs.stream().map(LtSalaryReportConfigDTO::getField).collect(Collectors.joining(","));
|
||||||
|
DataCollectionEmployee employee = employeeMap.getOrDefault(firstData.get("employeeId"), DataCollectionEmployee.builder().build());
|
||||||
|
firstSb.append("insert into uf_bmsbmxb(formmodeid,modedatacreater,modedatacreatertype,modedatacreatedate,modedatacreatetime,gh,xm,bm,gw,xzszy,cbzx,"+fieldStr+") values (");
|
||||||
|
firstSb.append(modeId).append(",1,0,").append(currDate).append(",").append(currTime).append(",'")
|
||||||
|
.append(employee.getWorkcode()).append("',")
|
||||||
|
.append(employee.getEmployeeId()).append(",")
|
||||||
|
.append(employee.getDepartmentId()).append(",")
|
||||||
|
.append(employee.getJobtitleId()).append(",'")
|
||||||
|
.append(salaryMonth).append("','")
|
||||||
|
.append(Utils.null2String(employee.getLtCbzx())).append("'");
|
||||||
|
|
||||||
|
for (LtSalaryReportConfigDTO dto : configs) {
|
||||||
|
String val = Utils.null2String(firstData.get(Utils.null2String(dto.getItem()) + "_variableItem" ));
|
||||||
|
firstSb.append(",").append(NumberUtils.isCreatable(val) ? val : 0);
|
||||||
|
}
|
||||||
|
firstSb.append(")");
|
||||||
|
rs.execute(firstSb.toString());
|
||||||
|
variableMapList.remove(0);
|
||||||
|
// 获取最大值 作为权限重构的起始id
|
||||||
|
rs.execute("select max(id) from uf_bmsbmxb");
|
||||||
|
int minId = 0;
|
||||||
|
if (rs.next()) {
|
||||||
|
minId = rs.getInt(1);
|
||||||
|
}
|
||||||
|
int maxId = minId + variableMapList.size();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
List<List<Map<String, Object>>> partition = Lists.partition(variableMapList, 500);
|
||||||
|
partition.forEach(part -> {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("insert into uf_bmsbmxb(formmodeid,modedatacreater,modedatacreatertype,modedatacreatedate,modedatacreatetime,gh,xm,bm,gw,xzszy,cbzx,"+fieldStr+") values ");
|
||||||
|
for (Map<String, Object> data : part) {
|
||||||
|
DataCollectionEmployee employeePo = employeeMap.getOrDefault(data.get("employeeId"), DataCollectionEmployee.builder().build());
|
||||||
|
sb.append("(")
|
||||||
|
.append(modeId).append(",1,0,").append(currDate).append(",").append(currTime).append(",'")
|
||||||
|
.append(employeePo.getWorkcode()).append("',")
|
||||||
|
.append(employeePo.getEmployeeId()).append(",")
|
||||||
|
.append(employeePo.getDepartmentId()).append(",")
|
||||||
|
.append(employeePo.getJobtitleId()).append(",'")
|
||||||
|
.append(salaryMonth).append("','")
|
||||||
|
.append(Utils.null2String(employeePo.getLtCbzx())).append("'");
|
||||||
|
for (LtSalaryReportConfigDTO dto : configs) {
|
||||||
|
String val = Utils.null2String(data.getOrDefault(Utils.null2String(dto.getItem()) + "_variableItem", ""));
|
||||||
|
sb.append(",").append(NumberUtils.isCreatable(val) ? val : 0);
|
||||||
|
}
|
||||||
|
sb.append("),");
|
||||||
|
}
|
||||||
|
rs.execute(sb.substring(0,sb.length()-1).toString());
|
||||||
|
});
|
||||||
|
// 权限重构
|
||||||
|
log.info("部门社保明细表min{} max{} ",minId,maxId);
|
||||||
|
if (modeId != null && NumberUtils.isCreatable(modeId)) {
|
||||||
|
Integer modeIdValue = Integer.valueOf(modeId);
|
||||||
|
for (int i = minId; i <= maxId; i++) {
|
||||||
|
ModeRightInfo ModeRightInfo = new ModeRightInfo();
|
||||||
|
ModeRightInfo.setNewRight(true);
|
||||||
|
ModeRightInfo.editModeDataShare(1, modeIdValue, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "success";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String ltGenBmgjjmxb(String salaryMonth) {
|
||||||
|
if (!SalaryDateUtil.checkYearMonth(salaryMonth)) {
|
||||||
|
throw new SalaryRunTimeException("年月错误");
|
||||||
|
}
|
||||||
|
YearMonth yearMonth = SalaryDateUtil.String2YearMonth(salaryMonth);
|
||||||
|
// 查询需要生成哪些浮动薪资项目
|
||||||
|
BaseBean baseBean = new BaseBean();
|
||||||
|
String configStr = baseBean.getPropValue("ltSalaryReport", "bmgjjmxb_ys_config");
|
||||||
|
List<LtSalaryReportConfigDTO> configs = JsonUtil.parseList(configStr, LtSalaryReportConfigDTO.class);
|
||||||
|
List<Long> variableItemIds = configs.stream().map(LtSalaryReportConfigDTO::getItem).collect(Collectors.toList());
|
||||||
|
// 获取浮动档案
|
||||||
|
List<Map<String, Object>> variableMapList = getVariableArchiveService(user).listBySalaryMonthAndItems(yearMonth, variableItemIds);
|
||||||
|
// 过滤数据,不能所有值为0或空
|
||||||
|
List<String> keyList = configs.stream().map(dto -> dto.getItem() + "_variableItem").collect(Collectors.toList());
|
||||||
|
variableMapList = variableMapList.stream().filter(map -> {
|
||||||
|
for (String key : keyList) {
|
||||||
|
String val = Utils.null2String(map.get(key));
|
||||||
|
if (StringUtils.isNotBlank(val) && NumberUtils.isCreatable(val) && new BigDecimal(val).compareTo(BigDecimal.ZERO) != 0 ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isEmpty(variableMapList)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
log.info("部门公积金明细size{} ",variableMapList.size());
|
||||||
|
// 获取人员信息
|
||||||
|
List<Long> empIds = variableMapList.stream().map(map -> Utils.null2String(map.get("employeeId"))).filter(NumberUtils::isCreatable).map(Long::valueOf).collect(Collectors.toList());
|
||||||
|
// Map<Long, DataCollectionEmployee> employeeMap = SalaryEntityUtil.convert2Map(getSalaryEmployeeService(user).listByIds(empIds), DataCollectionEmployee::getEmployeeId);
|
||||||
|
// 查询快照表中人员信息
|
||||||
|
Map<Long, DataCollectionEmployee> employeeMap = SalaryEntityUtil.convert2Map(getSalaryEmployeeService(user).snapshot(empIds, SalaryDateUtil.localDateToDate(yearMonth.atDay(1))), DataCollectionEmployee::getEmployeeId);
|
||||||
|
// 删除建模数据
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
rs.execute("delete from uf_bmgjjmxb where xzszy = '" + salaryMonth+ "'");
|
||||||
|
// 插入建模
|
||||||
|
String currDate = String.format("'%s'", TimeUtil.getCurrentDateString());
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
|
||||||
|
String currTime = String.format("'%s'", sdf.format(new Date()));
|
||||||
|
// 获取建模模块id
|
||||||
|
String modeId = baseBean.getPropValue("ltSalaryReport", "bmgjjmxb_mode_id");
|
||||||
|
// 先插入一条数据
|
||||||
|
Map<String, Object> firstData = variableMapList.get(0);
|
||||||
|
StringBuilder firstSb = new StringBuilder();
|
||||||
|
String fieldStr = configs.stream().map(LtSalaryReportConfigDTO::getField).collect(Collectors.joining(","));
|
||||||
|
DataCollectionEmployee employee = employeeMap.getOrDefault(firstData.get("employeeId"), DataCollectionEmployee.builder().build());
|
||||||
|
firstSb.append("insert into uf_bmgjjmxb(formmodeid,modedatacreater,modedatacreatertype,modedatacreatedate,modedatacreatetime,gh,xm,bm,gw,xzszy,cbzx,"+fieldStr+") values (");
|
||||||
|
firstSb.append(modeId).append(",1,0,").append(currDate).append(",").append(currTime).append(",'")
|
||||||
|
.append(employee.getWorkcode()).append("',")
|
||||||
|
.append(employee.getEmployeeId()).append(",")
|
||||||
|
.append(employee.getDepartmentId()).append(",")
|
||||||
|
.append(employee.getJobtitleId()).append(",'")
|
||||||
|
.append(salaryMonth).append("','")
|
||||||
|
.append(Utils.null2String(employee.getLtCbzx())).append("'");
|
||||||
|
|
||||||
|
for (LtSalaryReportConfigDTO dto : configs) {
|
||||||
|
String val = Utils.null2String(firstData.getOrDefault(Utils.null2String(dto.getItem()) + "_variableItem", ""));
|
||||||
|
firstSb.append(",").append(NumberUtils.isCreatable(val) ? val : 0);
|
||||||
|
}
|
||||||
|
firstSb.append(")");
|
||||||
|
rs.execute(firstSb.toString());
|
||||||
|
variableMapList.remove(0);
|
||||||
|
// 获取最大值 作为权限重构的起始id
|
||||||
|
rs.execute("select max(id) from uf_bmgjjmxb");
|
||||||
|
int minId = 0;
|
||||||
|
if (rs.next()) {
|
||||||
|
minId = rs.getInt(1);
|
||||||
|
}
|
||||||
|
int maxId = minId + variableMapList.size();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
List<List<Map<String, Object>>> partition = Lists.partition(variableMapList, 500);
|
||||||
|
partition.forEach(part -> {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("insert into uf_bmgjjmxb(formmodeid,modedatacreater,modedatacreatertype,modedatacreatedate,modedatacreatetime,gh,xm,bm,gw,xzszy,cbzx,"+fieldStr+") values ");
|
||||||
|
for (Map<String, Object> data : part) {
|
||||||
|
DataCollectionEmployee employeePo = employeeMap.getOrDefault(data.get("employeeId"), DataCollectionEmployee.builder().build());
|
||||||
|
sb.append("(")
|
||||||
|
.append(modeId).append(",1,0,").append(currDate).append(",").append(currTime).append(",'")
|
||||||
|
.append(employeePo.getWorkcode()).append("',")
|
||||||
|
.append(employeePo.getEmployeeId()).append(",")
|
||||||
|
.append(employeePo.getDepartmentId()).append(",")
|
||||||
|
.append(employeePo.getJobtitleId()).append(",'")
|
||||||
|
.append(salaryMonth).append("','")
|
||||||
|
.append(Utils.null2String(employeePo.getLtCbzx())).append("'");
|
||||||
|
for (LtSalaryReportConfigDTO dto : configs) {
|
||||||
|
String val = Utils.null2String(data.getOrDefault(Utils.null2String(dto.getItem()) + "_variableItem", ""));
|
||||||
|
sb.append(",").append(NumberUtils.isCreatable(val) ? val : 0);
|
||||||
|
}
|
||||||
|
sb.append("),");
|
||||||
|
}
|
||||||
|
rs.execute(sb.substring(0,sb.length()-1).toString());
|
||||||
|
});
|
||||||
|
// 权限重构
|
||||||
|
log.info("部门公积金明细min{} max{} ",minId,maxId);
|
||||||
|
if (modeId != null && NumberUtils.isCreatable(modeId)) {
|
||||||
|
Integer modeIdValue = Integer.valueOf(modeId);
|
||||||
|
for (int i = minId; i <= maxId; i++) {
|
||||||
|
ModeRightInfo ModeRightInfo = new ModeRightInfo();
|
||||||
|
ModeRightInfo.setNewRight(true);
|
||||||
|
ModeRightInfo.editModeDataShare(1, modeIdValue, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "success";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String ltGenBmgzjjmxJt(String salaryMonth) {
|
||||||
|
if (!SalaryDateUtil.checkYearMonth(salaryMonth)) {
|
||||||
|
throw new SalaryRunTimeException("年月错误");
|
||||||
|
}
|
||||||
|
YearMonth yearMonth = SalaryDateUtil.String2YearMonth(salaryMonth);
|
||||||
|
// 查询需要生成哪些浮动薪资项目
|
||||||
|
BaseBean baseBean = new BaseBean();
|
||||||
|
String configStr = baseBean.getPropValue("ltSalaryReport", "bmsbmxb_ys_config");
|
||||||
|
List<LtSalaryReportConfigDTO> configs = JsonUtil.parseList(configStr, LtSalaryReportConfigDTO.class);
|
||||||
|
String gjjConfigStr = baseBean.getPropValue("ltSalaryReport", "bmgjjmxb_ys_config");
|
||||||
|
configs.addAll(JsonUtil.parseList(gjjConfigStr, LtSalaryReportConfigDTO.class));
|
||||||
|
List<Long> variableItemIds = configs.stream().map(LtSalaryReportConfigDTO::getItem).collect(Collectors.toList());
|
||||||
|
// 获取浮动档案
|
||||||
|
List<Map<String, Object>> variableMapList = getVariableArchiveService(user).listBySalaryMonthAndItems(yearMonth, variableItemIds);
|
||||||
|
log.info("部门工资奖金明细表计提size{} ",variableMapList == null ? 0 :variableMapList.size());
|
||||||
|
// 获取直接人工工资分摊表的人
|
||||||
|
String dataSourceId = baseBean.getPropValue("ltSalaryReport", "zjrycqgsft_data_source_id");
|
||||||
|
RecordSetDataSource extRs = new RecordSetDataSource(dataSourceId);
|
||||||
|
extRs.execute(" select month, user_code from dws_oa.work_hour_apportion_report where month='"+salaryMonth+"'");
|
||||||
|
List<String> needExcludeWorkCodeList = new ArrayList<>();
|
||||||
|
while (extRs.next()) {
|
||||||
|
needExcludeWorkCodeList.add(extRs.getString("user_code"));
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isNotEmpty(needExcludeWorkCodeList)) {
|
||||||
|
// 获取需要去除的人员id
|
||||||
|
List<String> excludeEmpIds = getSalaryEmployeeService(user).listByWorkCodes(needExcludeWorkCodeList).stream().map(emp -> Utils.null2String(emp.getEmployeeId())).collect(Collectors.toList());
|
||||||
|
variableMapList = variableMapList.stream().filter(map -> !excludeEmpIds.contains(Utils.null2String(map.get("employeeId")))).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
log.info("部门工资奖金明细表计提size afterexclude{} ", variableMapList == null ? 0 : variableMapList.size());
|
||||||
|
|
||||||
|
// 过滤数据,不能所有值为0或空
|
||||||
|
List<String> keyList = configs.stream().map(dto -> dto.getItem() + "_variableItem").collect(Collectors.toList());
|
||||||
|
variableMapList = variableMapList.stream().filter(map -> {
|
||||||
|
for (String key : keyList) {
|
||||||
|
String val = Utils.null2String(map.get(key));
|
||||||
|
if (StringUtils.isNotBlank(val) && NumberUtils.isCreatable(val) && new BigDecimal(val).compareTo(BigDecimal.ZERO) != 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isEmpty(variableMapList)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
log.info("部门工资奖金明细表实发size afterexclude2{} ",variableMapList.size());
|
||||||
|
List<Long> employeeIdList = variableMapList.stream().map(m -> Utils.null2String(m.get("employeeId")))
|
||||||
|
.filter(NumberUtils::isCreatable).map(Long::valueOf).collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
||||||
|
// 查询生成的报表映射关系
|
||||||
|
String reportConfigStr = baseBean.getPropValue("ltSalaryReport", "bmgzjjmxbjt_ys_config");
|
||||||
|
List<LtSalaryReportConfigDTO> reportConfigs = JsonUtil.parseList(reportConfigStr, LtSalaryReportConfigDTO.class);
|
||||||
|
List<Long> salaryItemIds = reportConfigs.stream().map(LtSalaryReportConfigDTO::getItem).collect(Collectors.toList());
|
||||||
|
List<SalaryItemPO> salaryItemList = getSalaryItemService(user).listByIds(salaryItemIds);
|
||||||
|
// 查询薪资核算结果(包含未归档)
|
||||||
|
Date salaryMonthDate = SalaryDateUtil.localDateToDate(yearMonth.atDay(1));
|
||||||
|
List<SalaryAcctRecordPO> salaryAcctRecordList = getSalaryAcctRecordService(user).listBySalaryMonth(LocalDateRange.builder().fromDate(salaryMonthDate).endDate(salaryMonthDate).build());
|
||||||
|
// 账套范围
|
||||||
|
List<Long> sobIds = Arrays.stream(baseBean.getPropValue("ltSalaryReport", "bmgzjjmxbjt_sob_ids").split(",")).filter(NumberUtils::isCreatable).map(Long::valueOf).collect(Collectors.toList());
|
||||||
|
salaryAcctRecordList = salaryAcctRecordList.stream().filter(sobId -> sobIds.contains(sobId)).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isEmpty(salaryAcctRecordList)) {
|
||||||
|
return "success";
|
||||||
|
}
|
||||||
|
List<Long> salaryAcctRecordIds = salaryAcctRecordList.stream().map(SalaryAcctRecordPO::getId).collect(Collectors.toList());
|
||||||
|
List<SalaryAcctEmployeePO> salaryAcctEmployeeList = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIdsAndEmployeeIds(salaryAcctRecordIds, employeeIdList);
|
||||||
|
List<DataCollectionEmployee> employeeList = getSalaryEmployeeService(user).listByIds(employeeIdList);
|
||||||
|
// 查询薪资核算结果
|
||||||
|
List<Long> salaryAcctEmpIds = salaryAcctEmployeeList.stream().map(SalaryAcctEmployeePO::getId).collect(Collectors.toList());
|
||||||
|
List<SalaryAcctResultPO> acctResultList = getSalaryAcctResultService(user).listByAcctEmployeeIdsAndSalaryItemIds(salaryAcctEmpIds, salaryItemIds);
|
||||||
|
List<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAll();
|
||||||
|
List<Map<String, Object>> acctResultMap = SalaryAcctResultBO.buildTableData(salaryItemList, Collections.emptyList(), employeeList, salaryAcctEmployeeList,
|
||||||
|
acctResultList, taxAgentPOS, Collections.emptySet(), Collections.emptyMap(), Collections.emptyMap(), false);
|
||||||
|
Map<String, Map<String, Object>> acctResultMapByEmpId = SalaryEntityUtil.convert2Map(acctResultMap, m -> Utils.null2String(m.get("employeeId")));
|
||||||
|
|
||||||
|
// 查询员工薪资档案
|
||||||
|
List<SalaryArchivePO> salaryArchiveList = getSalaryArchiveService(user).listSome(SalaryArchivePO.builder().employeeIds(employeeIdList).build());
|
||||||
|
Map<String, Long> archiveIdMap = SalaryEntityUtil.convert2Map(salaryArchiveList, archive -> archive.getTaxAgentId() + "_" + archive.getEmployeeId(), archive -> archive.getId());
|
||||||
|
List<Long> salaryArchiveIds = salaryArchiveList.stream().map(SalaryArchivePO::getId).collect(Collectors.toList());
|
||||||
|
// 查询档案中对应的绩效工资
|
||||||
|
Long jdjxItemId = NumberUtils.isCreatable(baseBean.getPropValue("ltSalaryReport", "jdjx_item_id")) ? Long.valueOf(baseBean.getPropValue("ltSalaryReport", "jdjx_item_id")) : 0L;
|
||||||
|
Date lastDayOfMonth = SalaryDateUtil.getLastDayOfMonth(salaryMonthDate);
|
||||||
|
List<SalaryArchiveItemPO> salaryArchiveItemCurrentList = getSalaryArchiveItemService(user).getEffectiveItemListBySalaryMonth(salaryArchiveIds, Collections.singletonList(jdjxItemId), lastDayOfMonth);
|
||||||
|
Map<Long, SalaryArchiveItemPO> archiveItemByArchiveId = SalaryEntityUtil.convert2Map(salaryArchiveItemCurrentList, archive -> archive.getSalaryArchiveId());
|
||||||
|
|
||||||
|
// 查询快照表中人员信息
|
||||||
|
Map<Long, DataCollectionEmployee> employeeMap = SalaryEntityUtil.convert2Map(getSalaryEmployeeService(user).snapshot(employeeIdList, SalaryDateUtil.localDateToDate(yearMonth.atDay(1))), DataCollectionEmployee::getEmployeeId);
|
||||||
|
|
||||||
|
// 入库
|
||||||
|
// 删除建模数据
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
rs.execute("delete from uf_bmjjjt where xzszy = '" + salaryMonth+ "'");
|
||||||
|
// 插入建模
|
||||||
|
String currDate = String.format("'%s'", TimeUtil.getCurrentDateString());
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
|
||||||
|
String currTime = String.format("'%s'", sdf.format(new Date()));
|
||||||
|
// 获取建模模块id
|
||||||
|
String modeId = baseBean.getPropValue("ltSalaryReport", "bmgzjjmxbjt_mode_id");
|
||||||
|
// 先插入一条数据
|
||||||
|
Map<String, Object> firstData = variableMapList.get(0);
|
||||||
|
StringBuilder firstSb = new StringBuilder();
|
||||||
|
String fieldStr = reportConfigs.stream().map(LtSalaryReportConfigDTO::getField).collect(Collectors.joining(","));
|
||||||
|
DataCollectionEmployee employee = employeeMap.getOrDefault(firstData.get("employeeId"), DataCollectionEmployee.builder().build());
|
||||||
|
// 获取员工档案绩效工资
|
||||||
|
Long archiveId = archiveIdMap.get(Utils.null2String(firstData.get("taxAgentId")) + "_" + employee.getEmployeeId());
|
||||||
|
SalaryArchiveItemPO salaryArchiveItemPO = archiveItemByArchiveId.get(archiveId == null ? 0L : archiveId);
|
||||||
|
String jxgz = (salaryArchiveItemPO == null || !NumberUtils.isCreatable(salaryArchiveItemPO.getItemValue())) ? "0" : new BigDecimal(salaryArchiveItemPO.getItemValue()).divide(new BigDecimal("3"), 2, RoundingMode.HALF_UP).toString();
|
||||||
|
// 获取薪资核算结果
|
||||||
|
Map<String, Object> singleAcctResultMap = acctResultMapByEmpId.get(Utils.null2String(employee.getEmployeeId()));
|
||||||
|
firstSb.append("insert into uf_bmjjjt(formmodeid,modedatacreater,modedatacreatertype,modedatacreatedate,modedatacreatetime,gh,xm,bm,gw,xzszy,cbzx,jdjxgzbz3,"+fieldStr+") values (");
|
||||||
|
firstSb.append(modeId).append(",1,0,").append(currDate).append(",").append(currTime).append(",'")
|
||||||
|
.append(employee.getWorkcode()).append("',")
|
||||||
|
.append(employee.getEmployeeId()).append(",")
|
||||||
|
.append(employee.getDepartmentId()).append(",")
|
||||||
|
.append(employee.getJobtitleId()).append(",'")
|
||||||
|
.append(salaryMonth).append("','")
|
||||||
|
.append(Utils.null2String(employee.getLtCbzx())).append("',")
|
||||||
|
.append(jxgz);
|
||||||
|
|
||||||
|
for (LtSalaryReportConfigDTO dto : reportConfigs) {
|
||||||
|
BigDecimal val = new BigDecimal("0");
|
||||||
|
if (singleAcctResultMap != null) {
|
||||||
|
String valStr = Utils.null2String(singleAcctResultMap.getOrDefault(Utils.null2String(dto.getItem()), "0"));
|
||||||
|
if (NumberUtils.isCreatable(valStr)) {
|
||||||
|
val = new BigDecimal(valStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
firstSb.append(",").append(val.toPlainString());
|
||||||
|
}
|
||||||
|
firstSb.append(")");
|
||||||
|
rs.execute(firstSb.toString());
|
||||||
|
variableMapList.remove(0);
|
||||||
|
// 获取最大值 作为权限重构的起始id
|
||||||
|
rs.execute("select max(id) from uf_bmjjjt");
|
||||||
|
int minId = 0;
|
||||||
|
if (rs.next()) {
|
||||||
|
minId = rs.getInt(1);
|
||||||
|
}
|
||||||
|
int maxId = minId + variableMapList.size();
|
||||||
|
|
||||||
|
|
||||||
|
List<List<Map<String, Object>>> partition = Lists.partition(variableMapList, 500);
|
||||||
|
for (List<Map<String, Object>> part : partition) {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("insert into uf_bmjjjt(formmodeid,modedatacreater,modedatacreatertype,modedatacreatedate,modedatacreatetime,gh,xm,bm,gw,xzszy,cbzx,jdjxgzbz3,"+fieldStr+") values ");
|
||||||
|
for (Map<String, Object> data : part) {
|
||||||
|
employee = employeeMap.getOrDefault(data.get("employeeId"), DataCollectionEmployee.builder().build());
|
||||||
|
// 获取员工档案绩效工资
|
||||||
|
// 获取员工档案绩效工资
|
||||||
|
archiveId = archiveIdMap.get(Utils.null2String(data.get("taxAgentId")) + "_" + employee.getEmployeeId());
|
||||||
|
salaryArchiveItemPO = archiveItemByArchiveId.get(archiveId == null ? 0L : archiveId);
|
||||||
|
jxgz = (salaryArchiveItemPO == null || !NumberUtils.isCreatable(salaryArchiveItemPO.getItemValue())) ? "0" : new BigDecimal(salaryArchiveItemPO.getItemValue()).divide(new BigDecimal("3"), 2, RoundingMode.HALF_UP).toString();
|
||||||
|
// 获取薪资核算结果
|
||||||
|
singleAcctResultMap = acctResultMapByEmpId.get(Utils.null2String(employee.getEmployeeId()));
|
||||||
|
|
||||||
|
sb.append("(")
|
||||||
|
.append(modeId).append(",1,0,").append(currDate).append(",").append(currTime).append(",'")
|
||||||
|
.append(employee.getWorkcode()).append("',")
|
||||||
|
.append(employee.getEmployeeId()).append(",")
|
||||||
|
.append(employee.getDepartmentId()).append(",")
|
||||||
|
.append(employee.getJobtitleId()).append(",'")
|
||||||
|
.append(salaryMonth).append("','")
|
||||||
|
.append(Utils.null2String(employee.getLtCbzx())).append("',")
|
||||||
|
.append(jxgz);
|
||||||
|
for (LtSalaryReportConfigDTO dto : reportConfigs) {
|
||||||
|
BigDecimal val = new BigDecimal("0");
|
||||||
|
if (singleAcctResultMap != null) {
|
||||||
|
String valStr = Utils.null2String(singleAcctResultMap.getOrDefault(Utils.null2String(dto.getItem()), "0"));
|
||||||
|
if (NumberUtils.isCreatable(valStr)) {
|
||||||
|
val = new BigDecimal(valStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sb.append(",").append(val.toPlainString());
|
||||||
|
}
|
||||||
|
sb.append("),");
|
||||||
|
}
|
||||||
|
rs.execute(sb.substring(0,sb.length()-1).toString());
|
||||||
|
}
|
||||||
|
// 权限重构
|
||||||
|
log.info("部门工资奖金明细表计提min{} max{} ",minId,maxId);
|
||||||
|
if (modeId != null && NumberUtils.isCreatable(modeId)) {
|
||||||
|
Integer modeIdValue = Integer.valueOf(modeId);
|
||||||
|
for (int i = minId; i <= maxId; i++) {
|
||||||
|
ModeRightInfo ModeRightInfo = new ModeRightInfo();
|
||||||
|
ModeRightInfo.setNewRight(true);
|
||||||
|
ModeRightInfo.editModeDataShare(1, modeIdValue, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "success";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String ltGenBmgzjjmxSf(String salaryMonth) {
|
||||||
|
if (!SalaryDateUtil.checkYearMonth(salaryMonth)) {
|
||||||
|
throw new SalaryRunTimeException("年月错误");
|
||||||
|
}
|
||||||
|
YearMonth yearMonth = SalaryDateUtil.String2YearMonth(salaryMonth);
|
||||||
|
// 查询需要生成哪些浮动薪资项目
|
||||||
|
BaseBean baseBean = new BaseBean();
|
||||||
|
String configStr = baseBean.getPropValue("ltSalaryReport", "bmsbmxb_ys_config");
|
||||||
|
List<LtSalaryReportConfigDTO> configs = JsonUtil.parseList(configStr, LtSalaryReportConfigDTO.class);
|
||||||
|
String gjjConfigStr = baseBean.getPropValue("ltSalaryReport", "bmgjjmxb_ys_config");
|
||||||
|
configs.addAll(JsonUtil.parseList(gjjConfigStr, LtSalaryReportConfigDTO.class));
|
||||||
|
List<Long> variableItemIds = configs.stream().map(LtSalaryReportConfigDTO::getItem).collect(Collectors.toList());
|
||||||
|
// 获取浮动档案
|
||||||
|
List<Map<String, Object>> variableMapList = getVariableArchiveService(user).listBySalaryMonthAndItems(yearMonth, variableItemIds);
|
||||||
|
log.info("部门工资奖金明细表实发size{} ",variableMapList == null ? 0 : variableMapList.size());
|
||||||
|
// 获取直接人工工资分摊表的人
|
||||||
|
String dataSourceId = baseBean.getPropValue("ltSalaryReport", "zjrycqgsft_data_source_id");
|
||||||
|
RecordSetDataSource extRs = new RecordSetDataSource(dataSourceId);
|
||||||
|
extRs.execute(" select month, user_code from dws_oa.work_hour_apportion_report where month='"+salaryMonth+"'");
|
||||||
|
List<String> needExcludeWorkCodeList = new ArrayList<>();
|
||||||
|
while (extRs.next()) {
|
||||||
|
needExcludeWorkCodeList.add(extRs.getString("user_code"));
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isNotEmpty(needExcludeWorkCodeList)) {
|
||||||
|
// 获取需要去除的人员id
|
||||||
|
List<String> excludeEmpIds = getSalaryEmployeeService(user).listByWorkCodes(needExcludeWorkCodeList).stream().map(emp -> Utils.null2String(emp.getEmployeeId())).collect(Collectors.toList());
|
||||||
|
variableMapList = variableMapList.stream().filter(map -> !excludeEmpIds.contains(Utils.null2String(map.get("employeeId")))).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
log.info("部门工资奖金明细表实发size afterexclude{} ",variableMapList == null ? 0 : variableMapList.size());
|
||||||
|
|
||||||
|
// 过滤数据,不能所有值为0或空
|
||||||
|
List<String> keyList = configs.stream().map(dto -> dto.getItem() + "_variableItem").collect(Collectors.toList());
|
||||||
|
variableMapList = variableMapList.stream().filter(map -> {
|
||||||
|
for (String key : keyList) {
|
||||||
|
String val = Utils.null2String(map.get(key));
|
||||||
|
if (StringUtils.isNotBlank(val) && NumberUtils.isCreatable(val) && new BigDecimal(val).compareTo(BigDecimal.ZERO) != 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isEmpty(variableMapList)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
log.info("部门工资奖金明细表实发size afterexclude2{} ",variableMapList.size());
|
||||||
|
List<Long> employeeIdList = variableMapList.stream().map(m -> Utils.null2String(m.get("employeeId")))
|
||||||
|
.filter(NumberUtils::isCreatable).map(Long::valueOf).collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
||||||
|
// 查询生成的报表映射关系
|
||||||
|
String reportConfigStr = baseBean.getPropValue("ltSalaryReport", "bmgzjjmxbsf_ys_config");
|
||||||
|
List<LtSalaryReportConfigDTO> reportConfigs = JsonUtil.parseList(reportConfigStr, LtSalaryReportConfigDTO.class);
|
||||||
|
List<Long> salaryItemIds = reportConfigs.stream().map(LtSalaryReportConfigDTO::getItem).collect(Collectors.toList());
|
||||||
|
List<SalaryItemPO> salaryItemList = getSalaryItemService(user).listByIds(salaryItemIds);
|
||||||
|
// 查询薪资核算结果(包含未归档)
|
||||||
|
Date salaryMonthDate = SalaryDateUtil.localDateToDate(yearMonth.atDay(1));
|
||||||
|
List<SalaryAcctRecordPO> salaryAcctRecordList = getSalaryAcctRecordService(user).listBySalaryMonth(LocalDateRange.builder().fromDate(salaryMonthDate).endDate(salaryMonthDate).build());
|
||||||
|
// 账套范围
|
||||||
|
List<Long> sobIds = Arrays.stream(baseBean.getPropValue("ltSalaryReport", "bmgzjjmxbsf_sob_ids").split(",")).filter(NumberUtils::isCreatable).map(Long::valueOf).collect(Collectors.toList());
|
||||||
|
salaryAcctRecordList = salaryAcctRecordList.stream().filter(sobId -> sobIds.contains(sobId)).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isEmpty(salaryAcctRecordList)) {
|
||||||
|
return "success";
|
||||||
|
}
|
||||||
|
List<Long> salaryAcctRecordIds = salaryAcctRecordList.stream().map(SalaryAcctRecordPO::getId).collect(Collectors.toList());
|
||||||
|
List<SalaryAcctEmployeePO> salaryAcctEmployeeList = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIdsAndEmployeeIds(salaryAcctRecordIds, employeeIdList);
|
||||||
|
List<DataCollectionEmployee> employeeList = getSalaryEmployeeService(user).listByIds(employeeIdList);
|
||||||
|
// 查询薪资核算结果
|
||||||
|
List<Long> salaryAcctEmpIds = salaryAcctEmployeeList.stream().map(SalaryAcctEmployeePO::getId).collect(Collectors.toList());
|
||||||
|
List<SalaryAcctResultPO> acctResultList = getSalaryAcctResultService(user).listByAcctEmployeeIdsAndSalaryItemIds(salaryAcctEmpIds, salaryItemIds);
|
||||||
|
List<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAll();
|
||||||
|
List<Map<String, Object>> acctResultMap = SalaryAcctResultBO.buildTableData(salaryItemList, Collections.emptyList(), employeeList, salaryAcctEmployeeList,
|
||||||
|
acctResultList, taxAgentPOS, Collections.emptySet(), Collections.emptyMap(), Collections.emptyMap(), false);
|
||||||
|
Map<String, Map<String, Object>> acctResultMapByEmpId = SalaryEntityUtil.convert2Map(acctResultMap, m -> Utils.null2String(m.get("employeeId")));
|
||||||
|
|
||||||
|
// 查询员工薪资档案
|
||||||
|
List<SalaryArchivePO> salaryArchiveList = getSalaryArchiveService(user).listSome(SalaryArchivePO.builder().employeeIds(employeeIdList).build());
|
||||||
|
Map<String, Long> archiveIdMap = SalaryEntityUtil.convert2Map(salaryArchiveList, archive -> archive.getTaxAgentId() + "_" + archive.getEmployeeId(), archive -> archive.getId());
|
||||||
|
List<Long> salaryArchiveIds = salaryArchiveList.stream().map(SalaryArchivePO::getId).collect(Collectors.toList());
|
||||||
|
// 查询档案中对应的绩效工资
|
||||||
|
Long jdjxItemId = NumberUtils.isCreatable(baseBean.getPropValue("ltSalaryReport", "jdjx_item_id")) ? Long.valueOf(baseBean.getPropValue("ltSalaryReport", "jdjx_item_id")) : 0L;
|
||||||
|
Date lastDayOfMonth = SalaryDateUtil.getLastDayOfMonth(salaryMonthDate);
|
||||||
|
List<SalaryArchiveItemPO> salaryArchiveItemCurrentList = getSalaryArchiveItemService(user).getEffectiveItemListBySalaryMonth(salaryArchiveIds, Collections.singletonList(jdjxItemId), lastDayOfMonth);
|
||||||
|
Map<Long, SalaryArchiveItemPO> archiveItemByArchiveId = SalaryEntityUtil.convert2Map(salaryArchiveItemCurrentList, archive -> archive.getSalaryArchiveId());
|
||||||
|
|
||||||
|
// 查询快照表中人员信息
|
||||||
|
Map<Long, DataCollectionEmployee> employeeMap = SalaryEntityUtil.convert2Map(getSalaryEmployeeService(user).snapshot(employeeIdList, SalaryDateUtil.localDateToDate(yearMonth.atDay(1))), DataCollectionEmployee::getEmployeeId);
|
||||||
|
|
||||||
|
// 入库
|
||||||
|
// 删除建模数据
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
rs.execute("delete from uf_bmjjjt where xzszy = '" + salaryMonth+ "'");
|
||||||
|
// 插入建模
|
||||||
|
String currDate = String.format("'%s'", TimeUtil.getCurrentDateString());
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
|
||||||
|
String currTime = String.format("'%s'", sdf.format(new Date()));
|
||||||
|
// 获取建模模块id
|
||||||
|
String modeId = baseBean.getPropValue("ltSalaryReport", "bmgzjjmxbsf_mode_id");
|
||||||
|
// 先插入一条数据
|
||||||
|
Map<String, Object> firstData = variableMapList.get(0);
|
||||||
|
StringBuilder firstSb = new StringBuilder();
|
||||||
|
String fieldStr = reportConfigs.stream().map(LtSalaryReportConfigDTO::getField).collect(Collectors.joining(","));
|
||||||
|
DataCollectionEmployee employee = employeeMap.getOrDefault(firstData.get("employeeId"), DataCollectionEmployee.builder().build());
|
||||||
|
// 获取员工档案绩效工资
|
||||||
|
Long archiveId = archiveIdMap.get(Utils.null2String(firstData.get("taxAgentId")) + "_" + employee.getEmployeeId());
|
||||||
|
SalaryArchiveItemPO salaryArchiveItemPO = archiveItemByArchiveId.get(archiveId == null ? 0L : archiveId);
|
||||||
|
String jxgz = (salaryArchiveItemPO == null || !NumberUtils.isCreatable(salaryArchiveItemPO.getItemValue())) ? "0" : new BigDecimal(salaryArchiveItemPO.getItemValue()).divide(new BigDecimal("3"), 2, RoundingMode.HALF_UP).toString();
|
||||||
|
// 获取薪资核算结果
|
||||||
|
Map<String, Object> singleAcctResultMap = acctResultMapByEmpId.get(Utils.null2String(employee.getEmployeeId()));
|
||||||
|
firstSb.append("insert into uf_bmjjsf(formmodeid,modedatacreater,modedatacreatertype,modedatacreatedate,modedatacreatetime,gh,xm,bm,gw,xzszy,cbzx,jdjxgzbz3,"+fieldStr+") values (");
|
||||||
|
firstSb.append(modeId).append(",1,0,").append(currDate).append(",").append(currTime).append(",'")
|
||||||
|
.append(employee.getWorkcode()).append("',")
|
||||||
|
.append(employee.getEmployeeId()).append(",")
|
||||||
|
.append(employee.getDepartmentId()).append(",")
|
||||||
|
.append(employee.getJobtitleId()).append(",'")
|
||||||
|
.append(salaryMonth).append("','")
|
||||||
|
.append(Utils.null2String(employee.getLtCbzx())).append("',")
|
||||||
|
.append(jxgz);
|
||||||
|
|
||||||
|
for (LtSalaryReportConfigDTO dto : reportConfigs) {
|
||||||
|
BigDecimal val = new BigDecimal("0");
|
||||||
|
if (singleAcctResultMap != null) {
|
||||||
|
String valStr = Utils.null2String(singleAcctResultMap.getOrDefault(Utils.null2String(dto.getItem()), "0"));
|
||||||
|
if (NumberUtils.isCreatable(valStr)) {
|
||||||
|
val = new BigDecimal(valStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
firstSb.append(",").append(val.toPlainString());
|
||||||
|
}
|
||||||
|
firstSb.append(")");
|
||||||
|
rs.execute(firstSb.toString());
|
||||||
|
variableMapList.remove(0);
|
||||||
|
// 获取最大值 作为权限重构的起始id
|
||||||
|
rs.execute("select max(id) from uf_bmjjsf");
|
||||||
|
int minId = 0;
|
||||||
|
if (rs.next()) {
|
||||||
|
minId = rs.getInt(1);
|
||||||
|
}
|
||||||
|
int maxId = minId + variableMapList.size();
|
||||||
|
|
||||||
|
|
||||||
|
List<List<Map<String, Object>>> partition = Lists.partition(variableMapList, 500);
|
||||||
|
for (List<Map<String, Object>> part : partition) {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("insert into uf_bmjjsf(formmodeid,modedatacreater,modedatacreatertype,modedatacreatedate,modedatacreatetime,gh,xm,bm,gw,xzszy,cbzx,jdjxgzbz3,"+fieldStr+") values ");
|
||||||
|
for (Map<String, Object> data : part) {
|
||||||
|
employee = employeeMap.getOrDefault(data.get("employeeId"), DataCollectionEmployee.builder().build());
|
||||||
|
// 获取员工档案绩效工资
|
||||||
|
archiveId = archiveIdMap.get(Utils.null2String(data.get("taxAgentId")) + "_" + employee.getEmployeeId());
|
||||||
|
salaryArchiveItemPO = archiveItemByArchiveId.get(archiveId == null ? 0L : archiveId);
|
||||||
|
jxgz = (salaryArchiveItemPO == null || !NumberUtils.isCreatable(salaryArchiveItemPO.getItemValue())) ? "0" : new BigDecimal(salaryArchiveItemPO.getItemValue()).divide(new BigDecimal("3"), 2, RoundingMode.HALF_UP).toString();
|
||||||
|
// 获取薪资核算结果
|
||||||
|
singleAcctResultMap = acctResultMapByEmpId.get(Utils.null2String(employee.getEmployeeId()));
|
||||||
|
|
||||||
|
sb.append("(")
|
||||||
|
.append(modeId).append(",1,0,").append(currDate).append(",").append(currTime).append(",'")
|
||||||
|
.append(employee.getWorkcode()).append("',")
|
||||||
|
.append(employee.getEmployeeId()).append(",")
|
||||||
|
.append(employee.getDepartmentId()).append(",")
|
||||||
|
.append(employee.getJobtitleId()).append(",'")
|
||||||
|
.append(salaryMonth).append("','")
|
||||||
|
.append(Utils.null2String(employee.getLtCbzx())).append("',")
|
||||||
|
.append(jxgz);
|
||||||
|
for (LtSalaryReportConfigDTO dto : reportConfigs) {
|
||||||
|
BigDecimal val = new BigDecimal("0");
|
||||||
|
if (singleAcctResultMap != null) {
|
||||||
|
String valStr = Utils.null2String(singleAcctResultMap.getOrDefault(Utils.null2String(dto.getItem()), "0"));
|
||||||
|
if (NumberUtils.isCreatable(valStr)) {
|
||||||
|
val = new BigDecimal(valStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sb.append(",").append(val.toPlainString());
|
||||||
|
}
|
||||||
|
sb.append("),");
|
||||||
|
}
|
||||||
|
rs.execute(sb.substring(0,sb.length()-1).toString());
|
||||||
|
}
|
||||||
|
// 权限重构
|
||||||
|
log.info("部门工资奖金明细表实发min{} max{} ",minId,maxId);
|
||||||
|
if (modeId != null && NumberUtils.isCreatable(modeId)) {
|
||||||
|
Integer modeIdValue = Integer.valueOf(modeId);
|
||||||
|
for (int i = minId; i <= maxId; i++) {
|
||||||
|
ModeRightInfo ModeRightInfo = new ModeRightInfo();
|
||||||
|
ModeRightInfo.setNewRight(true);
|
||||||
|
ModeRightInfo.editModeDataShare(1, modeIdValue, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "success";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -178,6 +178,27 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi
|
||||||
.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getSalaryArchiveId() + "-" + f.getSalaryItemId()))), ArrayList::new));
|
.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getSalaryArchiveId() + "-" + f.getSalaryItemId()))), ArrayList::new));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SalaryArchiveItemPO> getEffectiveItemListBySalaryMonth(Collection<Long> salaryArchivesIds, Collection<Long> salaryItemIds, Date SalaryMonth) {
|
||||||
|
// 没有薪资项目时,给个不存在的,否则加载所有不合理
|
||||||
|
salaryItemIds = CollectionUtils.isEmpty(salaryItemIds) ? Collections.singletonList(0L) : salaryItemIds;
|
||||||
|
// 薪资档案id
|
||||||
|
List<Long> salaryArchiveIds = CollectionUtils.isEmpty(salaryArchivesIds) ? Collections.singletonList(0L) : (List<Long>) salaryArchivesIds;
|
||||||
|
|
||||||
|
List<SalaryArchiveItemPO> salaryArchiveItems = Lists.newArrayList();
|
||||||
|
List<List<Long>> partition = Lists.partition(Lists.newArrayList(salaryArchiveIds), 999);
|
||||||
|
Collection<Long> finalSalaryItemIds = salaryItemIds;
|
||||||
|
partition.forEach(part -> salaryArchiveItems.addAll(
|
||||||
|
salaryArchiveItemMapper.getEffectiveSalaryItems(SalaryArchiveItemQueryParam.builder()
|
||||||
|
.salaryArchivesIds(part)
|
||||||
|
.salaryItemIds(finalSalaryItemIds)
|
||||||
|
.effectiveTime(SalaryMonth).build()))
|
||||||
|
);
|
||||||
|
return salaryArchiveItems.stream()
|
||||||
|
.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getSalaryArchiveId() + "-" + f.getSalaryItemId()))), ArrayList::new));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前已生效列表
|
* 获取当前已生效列表
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -697,10 +697,21 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
|
||||||
.idNo(hrmSnapshotPO.getCertificatenum())
|
.idNo(hrmSnapshotPO.getCertificatenum())
|
||||||
.accountTypeName(AccountTypeEnum.getDefaultLabelByValue(hrmSnapshotPO.getAccounttype()))
|
.accountTypeName(AccountTypeEnum.getDefaultLabelByValue(hrmSnapshotPO.getAccounttype()))
|
||||||
.accountType(hrmSnapshotPO.getAccounttype())
|
.accountType(hrmSnapshotPO.getAccounttype())
|
||||||
|
.ltCbzx(hrmSnapshotPO.getLtCbzx())
|
||||||
.build())
|
.build())
|
||||||
.orElse(currentEmployeeMap.get(employeeId));
|
.orElse(currentEmployeeMap.get(employeeId));
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
return SalaryI18nUtil.i18nList(employees);
|
return SalaryI18nUtil.i18nList(employees);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DataCollectionEmployee> listByWorkCodes(List<String> workCodes) {
|
||||||
|
List<DataCollectionEmployee> empList = new ArrayList<>();
|
||||||
|
List<List<String>> partition = Lists.partition(workCodes, 500);
|
||||||
|
partition.forEach(part -> {
|
||||||
|
empList.addAll(getEmployMapper().listByWorkCodes(part));
|
||||||
|
});
|
||||||
|
return SalaryI18nUtil.i18nList(empList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import com.engine.salary.util.db.MapperProxyFactory;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -84,4 +85,18 @@ public class VariableArchiveItemServiceImpl extends Service implements VariableA
|
||||||
partition.forEach(part -> getVariableArchiveItemMapper().deleteByIds(part));
|
partition.forEach(part -> getVariableArchiveItemMapper().deleteByIds(part));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<VariableArchiveItemPO> listByVariableArchiveIdsAndItemIds(List<Long> variableArchiveIds, List<Long> variableItemIds) {
|
||||||
|
if (CollectionUtils.isEmpty(variableArchiveIds) || CollectionUtils.isEmpty(variableItemIds)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
List<List<Long>> partition = Lists.partition(variableArchiveIds, 200);
|
||||||
|
List<VariableArchiveItemPO> resultList = new ArrayList<>();
|
||||||
|
partition.forEach(part -> {
|
||||||
|
resultList.addAll(getVariableArchiveItemMapper().listSome(VariableArchiveItemPO.builder().variableArchiveIds(part).variableItemIds(variableItemIds).build()));
|
||||||
|
});
|
||||||
|
|
||||||
|
return encryptUtil.decryptList(resultList, VariableArchiveItemPO.class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -186,6 +186,50 @@ public class VariableArchiveServiceImpl extends Service implements VariableArchi
|
||||||
return listMaps;
|
return listMaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Map<String, Object>> buildVariableArchiveData(List<VariableArchiveListDTO> variableArchives ,List<Long> variableItemIds) {
|
||||||
|
List<Long> variableArchiveIds = variableArchives.stream().map(VariableArchiveListDTO::getId).collect(Collectors.toList());
|
||||||
|
// 获取浮动薪资档案所对应的浮动薪资项目数据
|
||||||
|
List<VariableArchiveItemPO> variableArchiveItemList = getVariableArchiveItemService(user).listByVariableArchiveIdsAndItemIds(variableArchiveIds,variableItemIds);
|
||||||
|
Map<Long, List<VariableArchiveItemPO>> variableArchiveItemMap = SalaryEntityUtil.group2Map(variableArchiveItemList, VariableArchiveItemPO::getVariableArchiveId);
|
||||||
|
List<Map<String, Object>> variableArchiveItemData = variableArchives.stream().map(m -> {
|
||||||
|
Map<String, Object> map = Maps.newHashMap();
|
||||||
|
map.put("variableArchiveId", m.getId());
|
||||||
|
List<VariableArchiveItemPO> variableArchiveItemValuelList = variableArchiveItemMap.getOrDefault(m.getId(), Collections.emptyList());
|
||||||
|
variableArchiveItemValuelList.forEach(i -> {
|
||||||
|
map.put(i.getVariableItemId() + SalaryItemConstant.VARIABLE_ITEM_DYNAMIC_SUFFIX, i.getItemValue());
|
||||||
|
});
|
||||||
|
return map;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
||||||
|
// 组装数据
|
||||||
|
List<Map<String, Object>> listMaps = new ArrayList<>();
|
||||||
|
variableArchives.forEach(e -> {
|
||||||
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
|
map.put("id", e.getId());
|
||||||
|
map.put("taxAgentName", e.getTaxAgentName());
|
||||||
|
map.put("taxAgentId", e.getTaxAgentId());
|
||||||
|
map.put("username", e.getUsername());
|
||||||
|
map.put("salaryMonth", SalaryDateUtil.getFormatYearMonth(e.getSalaryMonth()));
|
||||||
|
map.put("employeeId", e.getEmployeeId());
|
||||||
|
map.put("subcompanyName", e.getSubcompanyName());
|
||||||
|
map.put("departmentName", e.getDepartmentName());
|
||||||
|
map.put("mobile", e.getMobile());
|
||||||
|
map.put("workcode", e.getWorkcode());
|
||||||
|
map.put("idNo", e.getIdNo());
|
||||||
|
map.put("companystartdate", e.getCompanystartdate());
|
||||||
|
map.put("dismissdate", e.getDismissdate());
|
||||||
|
map.put("opts", e.getOpts());
|
||||||
|
|
||||||
|
// 浮动薪资项目动态
|
||||||
|
Optional<Map<String, Object>> optionalItem = variableArchiveItemData.stream().filter(f -> f.get("variableArchiveId").toString().equals(e.getId().toString())).findFirst();
|
||||||
|
optionalItem.ifPresent(map::putAll);
|
||||||
|
|
||||||
|
listMaps.add(map);
|
||||||
|
});
|
||||||
|
return listMaps;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建浮动薪酬档案
|
* 创建浮动薪酬档案
|
||||||
*
|
*
|
||||||
|
|
@ -594,6 +638,23 @@ public class VariableArchiveServiceImpl extends Service implements VariableArchi
|
||||||
return buildVariableArchiveData(variableArchiveListDTO);
|
return buildVariableArchiveData(variableArchiveListDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> listBySalaryMonthAndItems(YearMonth salaryMonth, List<Long> variableItemIds) {
|
||||||
|
VariableArchiveQueryParam queryParam = VariableArchiveQueryParam.builder()
|
||||||
|
.salaryMonth(SalaryDateUtil.getFormatYearMonth(salaryMonth))
|
||||||
|
.build();
|
||||||
|
ValidUtil.doValidator(queryParam);
|
||||||
|
// 浮动薪酬档案列表
|
||||||
|
if (Objects.nonNull(queryParam.getSalaryMonth())) {
|
||||||
|
queryParam.setSalaryMonthDate(SalaryDateUtil.dateStrToLocalYearMonth(queryParam.getSalaryMonth()));
|
||||||
|
}
|
||||||
|
//排序配置
|
||||||
|
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
|
||||||
|
queryParam.setOrderRule(orderRule);
|
||||||
|
List<VariableArchiveListDTO> list = listDTO(queryParam);
|
||||||
|
return buildVariableArchiveData(list, variableItemIds);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateData(VariableArchiveSaveParam updateParam) {
|
public void updateData(VariableArchiveSaveParam updateParam) {
|
||||||
if (updateParam.getId() == null) {
|
if (updateParam.getId() == null) {
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,15 @@ import com.engine.salary.util.SalaryDateUtil;
|
||||||
import com.engine.salary.util.db.IdGenerator;
|
import com.engine.salary.util.db.IdGenerator;
|
||||||
import com.engine.salary.util.db.MapperProxyFactory;
|
import com.engine.salary.util.db.MapperProxyFactory;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.general.BaseBean;
|
||||||
import weaver.hrm.User;
|
import weaver.hrm.User;
|
||||||
import weaver.interfaces.schedule.BaseCronJob;
|
import weaver.interfaces.schedule.BaseCronJob;
|
||||||
|
import weaver.wechat.util.Utils;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
|
@ -32,6 +36,18 @@ public class HrmSnapshotJob extends BaseCronJob {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
List<HrmSnapshotPO> hrmSnapshotPOS = getHrmSnapshotMapper().currentEmpData();
|
List<HrmSnapshotPO> hrmSnapshotPOS = getHrmSnapshotMapper().currentEmpData();
|
||||||
|
// 获取联特成本中心数据
|
||||||
|
BaseBean baseBean = new BaseBean();
|
||||||
|
String cbzxField = baseBean.getPropValue("ltSalaryReport", "cbzx_field_name");
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
rs.execute("select id,"+cbzxField+" from cus_fielddata where scopeid=3 and "+cbzxField+" != '' ");
|
||||||
|
HashMap<Long, String> ltCbzxMap = new HashMap<>();
|
||||||
|
while (rs.next()) {
|
||||||
|
ltCbzxMap.put(Long.valueOf(rs.getInt("id")), rs.getString(cbzxField));
|
||||||
|
}
|
||||||
|
hrmSnapshotPOS.stream().forEach(po -> {
|
||||||
|
po.setLtCbzx(Utils.null2String(ltCbzxMap.get(po.getEmployeeId())));
|
||||||
|
});
|
||||||
|
|
||||||
Date snapshotTime = StrUtil.isNotBlank(appointSnapshotTime) && SalaryDateUtil.checkDay(appointSnapshotTime) ? SalaryDateUtil.dateStrToLocalDate(appointSnapshotTime) : SalaryDateUtil.localDateToDate(LocalDate.now());
|
Date snapshotTime = StrUtil.isNotBlank(appointSnapshotTime) && SalaryDateUtil.checkDay(appointSnapshotTime) ? SalaryDateUtil.dateStrToLocalDate(appointSnapshotTime) : SalaryDateUtil.localDateToDate(LocalDate.now());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -985,4 +985,81 @@ public class SalaryAcctController {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************线下对比 end*********************************/
|
/**********************************线下对比 end*********************************/
|
||||||
|
/**********************************联特 报表start*********************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联特 - 生成部门社保明细表
|
||||||
|
* @param request
|
||||||
|
* @param response
|
||||||
|
* @param salaryMonth
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Path("/ltSalaryReport/genBmsbmxb")
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
public String ltGenBmsbmxb(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "salaryMonth") String salaryMonth) {
|
||||||
|
User user = HrmUserVarify.getUser(request, response);
|
||||||
|
return new ResponseResult<String, String>(user).run(getSalaryAcctResultWrapper(user)::ltGenBmsbmxb, salaryMonth);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联特 - 生成部门公积金明细表
|
||||||
|
* @param request
|
||||||
|
* @param response
|
||||||
|
* @param salaryMonth
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Path("/ltSalaryReport/genBmgjjmxb")
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
public String ltGenBmgjjmxb(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "salaryMonth") String salaryMonth) {
|
||||||
|
User user = HrmUserVarify.getUser(request, response);
|
||||||
|
return new ResponseResult<String, String>(user).run(getSalaryAcctResultWrapper(user)::ltGenBmgjjmxb, salaryMonth);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联特 - 生成部门工资&奖金明细表-计提
|
||||||
|
* @param request
|
||||||
|
* @param response
|
||||||
|
* @param salaryMonth
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Path("/ltSalaryReport/genBmgzjjmxJt")
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
public String ltGenBmgzjjmxJt(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "salaryMonth") String salaryMonth) {
|
||||||
|
User user = HrmUserVarify.getUser(request, response);
|
||||||
|
return new ResponseResult<String, String>(user).run(getSalaryAcctResultWrapper(user)::ltGenBmgzjjmxJt, salaryMonth);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联特 - 生成部门工资&奖金明细表-实发
|
||||||
|
* @param request
|
||||||
|
* @param response
|
||||||
|
* @param salaryMonth
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Path("/ltSalaryReport/genBmgzjjmxSf")
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
public String ltGenBmgzjjmxSf(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "salaryMonth") String salaryMonth) {
|
||||||
|
User user = HrmUserVarify.getUser(request, response);
|
||||||
|
return new ResponseResult<String, String>(user).run(getSalaryAcctResultWrapper(user)::ltGenBmgzjjmxSf, salaryMonth);
|
||||||
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 联特表5 - 生成人员明细工资计提表
|
||||||
|
// * @param request
|
||||||
|
// * @param response
|
||||||
|
// * @param salaryMonth
|
||||||
|
// * @return
|
||||||
|
// */
|
||||||
|
// @GET
|
||||||
|
// @Path("/ltSalaryReport/genRymxgzjt")
|
||||||
|
// @Produces(MediaType.APPLICATION_JSON)
|
||||||
|
// public String ltGenRymxgzjt(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "salaryMonth") String salaryMonth) {
|
||||||
|
// User user = HrmUserVarify.getUser(request, response);
|
||||||
|
// return new ResponseResult<String, String>(user).run(getSalaryAcctResultWrapper(user)::ltGenRymxgzjt, salaryMonth);
|
||||||
|
// }
|
||||||
|
/**********************************联特 报表end*********************************/
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -371,4 +371,37 @@ public class SalaryAcctResultWrapper extends Service implements SalaryAcctResult
|
||||||
public void calcTaxFeedback(SalaryCalcTaxParam salaryCalcTaxParam) {
|
public void calcTaxFeedback(SalaryCalcTaxParam salaryCalcTaxParam) {
|
||||||
getSalaryCalcTaxService(user).calcTaxFeedback(salaryCalcTaxParam);
|
getSalaryCalcTaxService(user).calcTaxFeedback(salaryCalcTaxParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联特 - 生成部门社保明细表
|
||||||
|
* @param salaryMonth
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String ltGenBmsbmxb(String salaryMonth) {
|
||||||
|
return getSalaryAcctResultService(user).ltGenBmsbmxb(salaryMonth);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联特 - 生成部门公积金明细表
|
||||||
|
* @param salaryMonth
|
||||||
|
*/
|
||||||
|
public String ltGenBmgjjmxb(String salaryMonth) {
|
||||||
|
return getSalaryAcctResultService(user).ltGenBmgjjmxb(salaryMonth);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联特 - 生成部门工资&奖金明细表-计提
|
||||||
|
* @param salaryMonth
|
||||||
|
*/
|
||||||
|
public String ltGenBmgzjjmxJt(String salaryMonth) {
|
||||||
|
return getSalaryAcctResultService(user).ltGenBmgzjjmxJt(salaryMonth);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联特 - 生成部门工资&奖金明细表-实发
|
||||||
|
* @param salaryMonth
|
||||||
|
*/
|
||||||
|
public String ltGenBmgzjjmxSf(String salaryMonth) {
|
||||||
|
return getSalaryAcctResultService(user).ltGenBmgzjjmxSf(salaryMonth);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue