Merge remote-tracking branch 'remotes/origin/develop' into hotfix/checkImport0902

This commit is contained in:
sy 2022-09-02 12:43:53 +08:00
commit 43bf76b036
23 changed files with 226 additions and 47 deletions

View File

@ -774,11 +774,12 @@ public class SIAccountBiz extends Service {
boolean fundPersonFlag = false;
boolean otherPersonFlag = false;
for (InsuranceAccountDetailPO item : v) {
socialPersonFlag = StringUtils.isBlank(item.getSocialSum());
// 判断社保是否为0
socialPersonFlag = (StringUtils.isBlank(item.getSocialSum()) || item.getSocialSum().equals("0"));
BigDecimal socialPerson = socialPersonFlag ? new BigDecimal("0") : new BigDecimal(item.getSocialSum());
fundPersonFlag = StringUtils.isBlank(item.getFundSum());
fundPersonFlag = (StringUtils.isBlank(item.getFundSum()) || item.getFundSum().equals("0"));
BigDecimal fundPerson = fundPersonFlag ? new BigDecimal("0") : new BigDecimal(item.getFundSum());
otherPersonFlag = StringUtils.isBlank(item.getOtherSum());
otherPersonFlag = (StringUtils.isBlank(item.getOtherSum()) || item.getOtherSum().equals("0"));
BigDecimal otherPerson = otherPersonFlag ? new BigDecimal("0") : new BigDecimal(item.getOtherSum());
socialTemp = socialTemp.add(socialPerson);
fundTemp = fundTemp.add(fundPerson);

View File

@ -39,7 +39,8 @@ public class DataCollectionEmployee {
@SalaryFormulaVar(defaultLabel = "部门ID", labelId = 86185, dataType = "string")
private Long departmentId;
//分部
//分部名
@SalaryFormulaVar(defaultLabel = "分部", labelId = 82465, dataType = "string")
private String subcompanyName;
private Long subcompanyid;
@ -98,4 +99,5 @@ public class DataCollectionEmployee {
//是否是系统管理员
private Boolean isAdmin;
}

View File

@ -57,6 +57,15 @@ public class SalaryAcctFormulaBO {
bigDecimalValue = bigDecimalValue.setScale(salaryItem.getPattern() + 1, RoundingMode.FLOOR);
roundingMode = RoundingMode.UP;
}
//向上取偶
if (Objects.equals(salaryItem.getRoundingMode(), SalaryRoundingModeEnum.UP_EVEN.getValue())) {
bigDecimalValue = bigDecimalValue.setScale(0, RoundingMode.UP);
int number = bigDecimalValue.intValue();
if (number % 2 != 0) {
bigDecimalValue = bigDecimalValue.add(BigDecimal.valueOf(1));
}
}
return bigDecimalValue.setScale(salaryItem.getPattern(), roundingMode).toPlainString();
}
@ -71,7 +80,7 @@ public class SalaryAcctFormulaBO {
return Collections.emptyMap();
}
String sexName = Optional.ofNullable(simpleEmployee.getSex())
.map(sex -> StringUtils.equals(sex,"0") ? SalaryI18nUtil.getI18nLabel(102440, "")
.map(sex -> StringUtils.equals(sex, "0") ? SalaryI18nUtil.getI18nLabel(102440, "")
: SalaryI18nUtil.getI18nLabel(102442, ""))
.orElse(StringUtils.EMPTY);
SalaryFormulaEmployeeDTO formulaEmployee = SalaryFormulaEmployeeDTO.builder()
@ -83,6 +92,7 @@ public class SalaryAcctFormulaBO {
.sex(sexName)
.status(simpleEmployee.getStatus())
.departmentName(simpleEmployee.getDepartmentName())
.subcompanyName(simpleEmployee.getSubcompanyName())
.jobtitleName(simpleEmployee.getJobtitleName())
.jobcall(simpleEmployee.getJobcall())
.companystartdate(simpleEmployee.getCompanystartdate())

View File

@ -7,6 +7,7 @@ import com.engine.salary.util.valid.DataCheck;
import lombok.*;
import java.util.Collection;
import java.util.List;
/**
* 薪资核算人员列表查询条件
@ -33,9 +34,13 @@ public class SalaryAcctEmployeeQueryParam extends BaseQueryParam {
//个税扣缴义务人")
private Long taxAgentId;
//分部
private List<Long> subcompanyIds;
//部门")
private Collection<Long> departmentIds;
//岗位")
private Collection<Long> positionIds;

View File

@ -35,6 +35,9 @@ public class SalaryAcctResultQueryParam extends BaseQueryParam {
//个税扣缴义务人
private Long taxAgentId;
//分部
private Collection<Long> subcompanyIds;
//部门
private Collection<Long> departmentIds;

View File

@ -32,6 +32,9 @@ public class SalaryArchiveQueryParam extends BaseQueryParam {
//个税扣缴义务人id
private Long taxAgentId;
//分部id
private List<Long> subcompanyIds;
//部门id
private List<Long> departmentIds;

View File

@ -37,6 +37,12 @@ public class SalaryFormulaEmployeeDTO {
private Long departmentId;
//分部
@SalaryFormulaVar(defaultLabel = "分部", labelId = 82465, dataType = "string")
private String subcompanyName;
//岗位
@SalaryFormulaVar(defaultLabel = "岗位", labelId = 90633, dataType = "string")
private String jobtitleName;
@ -85,4 +91,8 @@ public class SalaryFormulaEmployeeDTO {
@SalaryFormulaVar(defaultLabel = "出生日期", labelId = 98624, dataType = "string")
private String birthday;
}

View File

@ -375,14 +375,14 @@ public class TaxDeclarationBO {
//累计减免税额
BigDecimal addUpTaxDeduction = findAddUpValue(TaxDeclarationDataIndexConstant.ADD_UP_TAX_DEDUCTION, resultMap, salaryItemMap);
// 累计已预扣预缴税额
// List<SalaryAcctResultPO> resultPOS = resultMap.get(salaryItemMap.getOrDefault(TaxDeclarationDataIndexConstant.ADD_UP_ADVANCE_TAX, 0L));
// BigDecimal addUpAdvanceTax = resultPOS == null ? BigDecimal.ZERO : resultPOS.stream()
// .map(salaryAcctResultPO -> SalaryEntityUtil.empty2Zero(salaryAcctResultPO.getResultValue()))
// .min(BigDecimal::compareTo)
// .orElse(BigDecimal.ZERO);
// // 本月应补退税额
// BigDecimal refundedOrSupplementedTax = SalaryEntityUtil.reduce(resultMap.get(salaryItemMap.getOrDefault(TaxDeclarationDataIndexConstant.REFUNDED_OR_SUPPLEMENTED_TAX, 0L)),
// salaryAcctResultPO -> SalaryEntityUtil.empty2Zero(salaryAcctResultPO.getResultValue()));
List<SalaryAcctResultPO> resultPOS = resultMap.get(salaryItemMap.getOrDefault(TaxDeclarationDataIndexConstant.ADD_UP_ADVANCE_TAX, 0L));
BigDecimal addUpAdvanceTax = resultPOS == null ? BigDecimal.ZERO : resultPOS.stream()
.map(salaryAcctResultPO -> SalaryEntityUtil.empty2Zero(salaryAcctResultPO.getResultValue()))
.min(BigDecimal::compareTo)
.orElse(BigDecimal.ZERO);
// 本月应补退税额
BigDecimal refundedOrSupplementedTax = SalaryEntityUtil.reduce(resultMap.get(salaryItemMap.getOrDefault(TaxDeclarationDataIndexConstant.REFUNDED_OR_SUPPLEMENTED_TAX, 0L)),
salaryAcctResultPO -> SalaryEntityUtil.empty2Zero(salaryAcctResultPO.getResultValue()));
// 生成往期累计情况
AddUpSituation accumulatedSituation = AddUpSituation.builder()
.employeeId(employeeId)
@ -405,7 +405,7 @@ public class TaxDeclarationBO {
.addUpOtherDeduction(addUpOtherDeduction.toPlainString())
.addUpTaxExemptIncome(addUpTaxFreeIncome.toPlainString())
.addUpAllowedDonation(addUpAllowedDonation.toPlainString())
.addUpAdvanceTax(addUpTaxPayable.toPlainString())
.addUpAdvanceTax(addUpAdvanceTax.add(refundedOrSupplementedTax).toPlainString())
.addUpTaxSavings(addUpTaxDeduction.toPlainString())
.creator(taxDeclaration.getCreator())
.createTime(taxDeclaration.getCreateTime())

View File

@ -18,7 +18,8 @@ public enum SalaryRoundingModeEnum implements BaseEnum<Integer> {
ROUNDING(2, "四舍五入", 84505),
ROUND_UP(3, "向上舍入", 84506),
ROUND_DOWN(4, "向下舍入", 84507),
CEILING(5, "见分进角", 84507);
CEILING(5, "见分进角", 84507),
UP_EVEN(6, "向上求偶", 84507);
private int value;

View File

@ -18,7 +18,8 @@ public enum RententionRuleEnum implements BaseEnum<Integer> {
ROUND(BigDecimal.ROUND_HALF_UP, "四舍五入", 84505),
CEIL(BigDecimal.ROUND_UP, "向上舍入", 84506),
FLOOR(BigDecimal.ROUND_DOWN, "向下舍入", 84507),
CEILING(5, "见分进角", 84507);
CEILING(5, "见分进角", 84507),
UP_EVEN(6, "向上求偶", 84507);
private int value;

View File

@ -118,6 +118,13 @@
<if test="param.username != null and param.username != ''">
AND e.lastname like CONCAT('%',#{param.username},'%')
</if>
<!-- 分部 -->
<if test="param.subcompanyIds != null and param.subcompanyIds.size()>0">
AND c.id IN
<foreach collection="param.subcompanyIds" open="(" item="subcompanyId" separator="," close=")">
#{subcompanyId}
</foreach>
</if>
<!-- 部门 -->
<if test="param.departmentIds != null and param.departmentIds.size()>0">
AND d.id IN
@ -169,6 +176,12 @@
<if test="param.username != null and param.username != ''">
AND e.lastname like '%'||#{param.username}||'%'
</if>
<if test="param.subcompanyIds != null and param.subcompanyIds.size()>0">
AND c.id IN
<foreach collection="param.subcompanyIds" open="(" item="subcompanyId" separator="," close=")">
#{subcompanyId}
</foreach>
</if>
<if test="param.departmentIds != null and param.departmentIds.size()>0">
AND d.id IN
<foreach collection="param.departmentIds" open="(" item="id" separator="," close=")">
@ -220,6 +233,12 @@
<if test="param.username != null and param.username != ''">
AND e.lastname like '%'+#{param.username}+'%'
</if>
<if test="param.subcompanyIds != null and param.subcompanyIds.size()>0">
AND c.id IN
<foreach collection="param.subcompanyIds" open="(" item="subcompanyId" separator="," close=")">
#{subcompanyId}
</foreach>
</if>
<if test="param.departmentIds != null and param.departmentIds.size()>0">
AND d.id IN
<foreach collection="param.departmentIds" open="(" item="id" separator="," close=")">

View File

@ -45,10 +45,12 @@
c.id as jobtitleId,
e.companystartdate as companystartdate,
e.mobile as mobile,
e.enddate as dismissdate
e.enddate as dismissdate,
sc.SUBCOMPANYNAME as subcompanyName
from hrmresource e
left join hrmdepartment d on e.departmentid = d.id
left join hrmjobtitles c on e.jobtitle = c.id
left join HrmSubCompany sc on e.SUBCOMPANYID1=sc.id
where e.status not in (7) and (e.accounttype is null or e.accounttype = 0)
<if test="collection != null and collection.size()>0">
AND e.id IN

View File

@ -497,6 +497,7 @@
AND tax_agent_id = #{param.taxAgentId}
</if>
<if test="(param.employeeName != null and param.employeeName != '')
or (param.subcompanyIds != null and param.subcompanyIds.size()>0)
or (param.departmentIds != null and param.departmentIds.size()>0)
or (param.positionIds != null and param.positionIds.size()>0)
or (param.status != null and param.status != 'ALL')">
@ -507,6 +508,13 @@
<if test="param.employeeName != null and param.employeeName != ''">
AND em.lastname LIKE '%'||#{param.employeeName}||'%'
</if>
-- 分部
<if test="param.subcompanyIds != null and param.subcompanyIds.size()>0">
AND em.subcompanyid1 IN
<foreach collection="param.subcompanyIds" open="(" item="subcompanyId" separator="," close=")">
#{subcompanyId}
</foreach>
</if>
<if test="param.departmentIds != null and param.departmentIds.size()>0">
AND em.departmentid IN
<foreach collection="param.departmentIds" open="(" item="departmentId" separator="," close=")">
@ -552,6 +560,7 @@
AND tax_agent_id = #{param.taxAgentId}
</if>
<if test="(param.employeeName != null and param.employeeName != '')
or (param.subcompanyIds != null and param.subcompanyIds.size()>0)
or (param.departmentIds != null and param.departmentIds.size()>0)
or (param.positionIds != null and param.positionIds.size()>0)
or (param.status != null and param.status != 'ALL')">
@ -562,6 +571,13 @@
<if test="param.employeeName != null and param.employeeName != ''">
AND em.lastname LIKE '%'+#{param.employeeName}+'%'
</if>
-- 分部
<if test="param.subcompanyIds != null and param.subcompanyIds.size()>0">
AND em.subcompanyid1 IN
<foreach collection="param.subcompanyIds" open="(" item="subcompanyId" separator="," close=")">
#{subcompanyId}
</foreach>
</if>
<if test="param.departmentIds != null and param.departmentIds.size()>0">
AND em.departmentid IN
<foreach collection="param.departmentIds" open="(" item="departmentId" separator="," close=")">
@ -719,6 +735,7 @@
AND tax_agent_id = #{param.taxAgentId}
</if>
<if test="(param.employeeName != null and param.employeeName != '')
or (param.subcompanyIds != null and param.subcompanyIds.size()>0)
or (param.departmentIds != null and param.departmentIds.size()>0)
or (param.positionIds != null and param.positionIds.size()>0)
or (param.status != null and param.status != 'ALL')">
@ -729,6 +746,14 @@
<if test="param.employeeName != null and param.employeeName != ''">
AND em.lastname LIKE CONCAT('%',#{param.employeeName},'%')
</if>
-- 分部
<if test="param.subcompanyIds != null and param.subcompanyIds.size()>0">
AND em.subcompanyid1 IN
<foreach collection="param.subcompanyIds" open="(" item="subcompanyId" separator="," close=")">
#{subcompanyId}
</foreach>
</if>
-- 部门
<if test="param.departmentIds != null and param.departmentIds.size()>0">
AND em.departmentid IN
<foreach collection="param.departmentIds" open="(" item="departmentId" separator="," close=")">

View File

@ -16,22 +16,38 @@ import java.util.Map;
public interface AddUpDeductionService {
/**
* 查询条件
* @param params
* @return
*/
Map<String, Object> getSearchCondition(Map<String, Object> params);
/**
* 导入
* @param importParam
* @return
*/
Map<String, Object> importAddUpDeduction(AddUpDeductionImportParam importParam);
/**
* 预览
* @param importParam
* @return
*/
Map<String, Object> preview(AddUpDeductionImportParam importParam );
/**
* 下载模板
* @param isChief
* @param queryParam
* @return
*/
XSSFWorkbook downloadTemplate(boolean isChief,AddUpDeductionQueryParam queryParam);
//-----------------------------------分权---------------------------------------------------
/**
* 通过id获取单条累计专项附加扣除记录
*

View File

@ -57,7 +57,14 @@ import java.util.*;
import java.util.stream.Collectors;
import static com.engine.salary.constant.SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY;
/**
* 累计专项
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class AddUpDeductionServiceImpl extends Service implements AddUpDeductionService {
private AddUpDeductionMapper getAddUpDeductionMapper() {
@ -94,11 +101,11 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
//文本输入框
SearchConditionItem username = conditionFactory.createCondition(ConditionType.INPUT, 25034, "username");
username.setInputType("input");
username.setColSpan(2);//定义一行显示条件数默认值为2,当值为1时标识该条件单独占一行
username.setFieldcol(16); //条件输入框所占宽度默认值18
username.setColSpan(2);
username.setFieldcol(16);
username.setLabelcol(8);
username.setViewAttr(2); // 编辑权限 1只读2可编辑 3必填 默认2
username.setLabel("姓名"); //设置文本值 这个将覆盖多语言标签的值
username.setViewAttr(2);
username.setLabel("姓名");
conditionItems.add(username);
@ -230,9 +237,16 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
//相同的姓名
String userName = dto.getUsername();
String deparmentName = dto.getDepartmentName();
String mobile = dto.getMobile();
// List<DataCollectionEmployee> employeeSameIds = employees.stream().filter(e -> (StringUtils.isBlank(userName) || Objects.equals(e.getUsername(), userName))
// && (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName)))
// .collect(Collectors.toList());
//20220824需求迭代增加手机号作为导入校验项
List<DataCollectionEmployee> employeeSameIds = employees.stream().filter(e -> (StringUtils.isBlank(userName) || Objects.equals(e.getUsername(), userName))
&& (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName)))
&& (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName))
&& (StringUtils.isBlank(mobile) || Objects.equals(e.getMobile(), mobile)))
.collect(Collectors.toList());
if (StringUtils.isBlank(userName)) {
//姓名 不能为空
//错误消息对象
@ -252,7 +266,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
.collect(Collectors.toList());
if (employeeSameIds.size() != 1) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "员工信息不能为空且不可重复(姓名与部门同时确认唯一)");
errorMessageMap.put("message", rowIndex + "员工信息不能为空且不可重复(姓名、部门和手机号同时确认唯一)");
errorData.add(errorMessageMap);
errorSum += 1;
}else{
@ -465,6 +479,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
*
* @return
*/
@Override
public XSSFWorkbook exportDetail(Long beLongEmployeeId, boolean isChief, AddUpDeductionQueryParam queryParam) {
queryParam.setEmployeeId(beLongEmployeeId);

View File

@ -614,8 +614,10 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
//相同的姓名
String userName = dto.getUsername();
String deparmentName = dto.getDepartmentName();
String mobile = dto.getMobile();
List<DataCollectionEmployee> employeeSameIds = employees.stream().filter(e -> (StringUtils.isBlank(userName) || Objects.equals(e.getUsername(), userName))
&& (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName)))
&& (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName))
&& (StringUtils.isBlank(mobile) || Objects.equals(e.getMobile(), mobile)))
.collect(Collectors.toList());
@ -638,7 +640,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
.collect(Collectors.toList());
if (employeeSameIds.size() != 1) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "员工信息不能为空且不可重复(姓名与部门同时确认唯一)");
errorMessageMap.put("message", rowIndex + "员工信息不能为空且不可重复(姓名、部门和手机号同时确认唯一)");
errorData.add(errorMessageMap);
errorSum += 1;
}else {

View File

@ -629,9 +629,11 @@ public class AttendQuoteDataServiceImpl extends Service implements AttendQuoteDa
String userName = Optional.ofNullable(map.get(SalaryI18nUtil.getI18nLabel(85429, "姓名"))).orElse("").toString();
String deparmentName = Optional.ofNullable(map.get(SalaryI18nUtil.getI18nLabel(86185, "部门"))).orElse("").toString();
String mobile = Optional.ofNullable(map.get(SalaryI18nUtil.getI18nLabel(86186, "手机号"))).orElse("").toString();
List<Long> employeeSameIds = new ArrayList<>();
List<DataCollectionEmployee> emps = employees.stream().filter(e -> (StringUtils.isBlank(userName) || Objects.equals(e.getUsername(), userName))
&& (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName)))
&& (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName))
&& (StringUtils.isBlank(mobile) || Objects.equals(e.getMobile(), mobile)))
.collect(Collectors.toList());
//含在职和离职选在职数据
if (CollectionUtils.isNotEmpty(emps) && emps.size() > 1) {
@ -661,7 +663,7 @@ public class AttendQuoteDataServiceImpl extends Service implements AttendQuoteDa
errorSum += 1;
} else if (CollectionUtils.isEmpty(employeeSameIds) || employeeSameIds.size() > 1) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", SalaryI18nUtil.getI18nLabel(100579, "员工信息不能为空且不可重复(姓名与部门同时确认唯一)"));
errorMessageMap.put("message", SalaryI18nUtil.getI18nLabel(100579, "员工信息不能为空且不可重复(姓名、部门和手机号同时确认唯一)"));
excelComments.add(errorMessageMap);
errorSum += 1;
} else {

View File

@ -212,10 +212,12 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
//相同的姓名
String userName = dto.getUsername();
String deparmentName = dto.getDepartmentName();
String mobile = dto.getMobile();
List<Long> employeeSameIds = new ArrayList<>();
List<DataCollectionEmployee> emps = employees.stream().filter(e -> (StringUtils.isBlank(userName) || Objects.equals(e.getUsername(), userName))
&& (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName)))
&& (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName))
&& (StringUtils.isBlank(mobile) || Objects.equals(e.getMobile(), mobile)))
.collect(Collectors.toList());
//含在职和离职选在职数据
if (CollectionUtils.isNotEmpty(emps) && emps.size() > 1) {
@ -240,7 +242,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
errorSum += 1;
} else if (CollectionUtils.isEmpty(employeeSameIds) || employeeSameIds.size() > 1) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "员工信息不能为空且不可重复(姓名与部门同时确认唯一)");
errorMessageMap.put("message", rowIndex + "员工信息不能为空且不可重复(姓名、部门和手机号同时确认唯一)");
errorData.add(errorMessageMap);
errorSum += 1;
} else {

View File

@ -18,6 +18,7 @@ import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.dto.SalarySobEmpFieldDTO;
import com.engine.salary.entity.salarysob.dto.SalarySobItemAggregateDTO;
import com.engine.salary.entity.salarysob.dto.SalarySobItemDTO;
import com.engine.salary.entity.salarysob.dto.SalarySobItemGroupDTO;
@ -348,8 +349,11 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98747, "薪资核算记录不存在或已被删除"));
}
// 模板表头(默认必带"个税扣缴义务人""姓名")
List<Object> headerList = Lists.newArrayList(SalaryI18nUtil.getI18nLabel(85429, "姓名"), "部门", SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"));
List<String> dataIndexList = Lists.newArrayList("username", "departmentName", "taxAgentName");
List<Object> headerList = Lists.newArrayList(SalaryI18nUtil.getI18nLabel(85429, "姓名"),
"部门",
SalaryI18nUtil.getI18nLabel(86186, "手机号"),
SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"));
List<String> dataIndexList = Lists.newArrayList("username", "departmentName", "mobile", "taxAgentName");
// 查询薪资项目
List<SalaryItemPO> salaryItemPOS = getSalaryItemService(user).listByIds(param.getSalaryItemIds());
for (SalaryItemPO salaryItemPO : salaryItemPOS) {
@ -447,6 +451,18 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
List<Object> headerList = Lists.newArrayList(SalaryI18nUtil.getI18nLabel(85429, "姓名"), SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"));
// 查询薪资账套下的薪资项目
SalarySobItemAggregateDTO salarySobItemAggregateDTO = getSalarySobItemService(user).getAggregateBySalarySobId(salaryAcctRecordPO.getSalarySobId());
// 员工信息
for (SalarySobEmpFieldDTO item : salarySobItemAggregateDTO.getEmpFields()) {
if (!"姓名".equals(item.getFieldName()) && !"个税扣缴义务人".equals(item.getFieldName())) {
if ("手机".equals(item.getFieldName())) {
headerList.add("手机号");
} else {
headerList.add(item.getFieldName());
}
}
}
// 薪资项目分类下的新资项目
for (SalarySobItemGroupDTO itemGroup : salarySobItemAggregateDTO.getItemGroups()) {
for (SalarySobItemDTO item : itemGroup.getItems()) {
@ -595,6 +611,8 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
String deparmentName = (String) map.getOrDefault("部门", "");
String mobile = (String) map.getOrDefault("手机号", "");
if (StringUtils.equals(SalaryI18nUtil.getI18nLabel(85429, "姓名"), dataKey.toString())) {
usernameIndex = j;
if (StringUtils.isEmpty(dataValue)) {
@ -606,7 +624,8 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
} else {
List<DataCollectionEmployee> employeeSameIds = salaryEmployees.stream().filter(e -> (StringUtils.isBlank(dataValue) || Objects.equals(e.getUsername(), dataValue))
&& (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName)))
&& (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName))
&& (StringUtils.isBlank(mobile) || Objects.equals(e.getMobile(), mobile)))
.collect(Collectors.toList());
if (CollectionUtils.isEmpty(employeeSameIds)) {
@ -623,7 +642,7 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
if (employeeSameIds.size() != 1) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", row + "员工信息不能为空且不可重复(姓名与部门同时确认唯一)");
errorMessageMap.put("message", row + "员工信息不能为空且不可重复(姓名、部门和手机号同时确认唯一)");
excelComments.add(errorMessageMap);
} else {
employeeId = CollectionUtils.isNotEmpty(employeeSameIds) && employeeSameIds.size() == 1 ? employeeSameIds.get(0).getEmployeeId() : null;

View File

@ -288,6 +288,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
// 查询人员信息
List<Long> employeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getEmployeeId, Collectors.toList());
List<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).listByIds(employeeIds);
// 查询个税扣缴义务人
Set<Long> taxAgentIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getTaxAgentId);
List<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listByIds(taxAgentIds);

View File

@ -131,6 +131,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
return pageInfo;
}
// 获取作为管理员的所有个税扣缴义务人列表
Collection<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAllTaxAgentsAsAdmin(currentEmployeeId);
Set<Long> taxAgentIds = SalaryEntityUtil.properties(taxAgentPOS, TaxAgentPO::getId);
@ -905,7 +906,11 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
// 1.姓名
String userName = Optional.ofNullable(map.get(userNameI18n)).orElse("").toString();
String deparmentName = Optional.ofNullable(map.get(SalaryI18nUtil.getI18nLabel(86185, "部门"))).orElse("").toString();
List<DataCollectionEmployee> emps = importHandleParam.getEmployees().stream().filter(e -> (StringUtils.isBlank(userName) || Objects.equals(e.getUsername(), userName)) && (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName))).collect(Collectors.toList());
String mobile = Optional.ofNullable(map.get(SalaryI18nUtil.getI18nLabel(86186, "手机号"))).orElse("").toString();
List<DataCollectionEmployee> emps = importHandleParam.getEmployees().stream().filter(e -> (StringUtils.isBlank(userName) || Objects.equals(e.getUsername(), userName))
&& (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName))
&& (StringUtils.isBlank(mobile) || Objects.equals(e.getMobile(), mobile)))
.collect(Collectors.toList());
List<Long> employeeSameIds = new ArrayList<>();
if (CollectionUtils.isNotEmpty(emps) && emps.size() > 1) {
employeeSameIds = emps.stream().filter(e -> UserStatusEnum.getNormalStatus().contains(e.getStatus())).map(DataCollectionEmployee::getEmployeeId).collect(Collectors.toList());
@ -1012,7 +1017,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
if (!isEmpty && userNameI18n.equals(key)) {
if (CollectionUtils.isEmpty(employeeSameIds) || employeeSameIds.size() > 1) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowindex + "员工信息不能为空且不可重复(姓名与部门同时确认唯一)");
errorMessageMap.put("message", rowindex + "员工信息不能为空且不可重复(姓名、部门和手机号同时确认唯一)");
excelComments.add(errorMessageMap);
isError = true;
} else if (employeeId == null) {
@ -1033,7 +1038,20 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
} else if (!isEmpty && taxAgentI18n.equals(key) && (isInit || isTaxAgentAdjust)) {
// 2.个税扣缴义务人列处理(初始化导入或调整个税扣缴义务人)
isError = handleTaxAgent(isError, isInit, excelComments, errorCount, j, taxAgentId, effectiveTime, finalSalaryArchive, adjustReason, importHandleParam, map);
} else if (!isEmpty && effectiveTimeI18n.equals(key) && effectiveTime == null) {
} else if (!isEmpty && payStartDateI18n.equals(key) && payStartDate == null) {
// 起始发薪日期
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowindex + "发薪起始日期格式不正确,正确格式示例为'2022-01-01'、'2022/1/1'");
excelComments.add(errorMessageMap);
isError = true;
}else if (!isEmpty && payEndDateI18n.equals(key) && !payEndDateCellVal.equals("") && !SalaryDateUtil.checkDay(payEndDateCellVal)) {
// 最后发薪日期
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowindex + "最后发薪日期格式不正确,正确格式示例为'2022-01-01'、'2022/1/1'");
excelComments.add(errorMessageMap);
isError = true;
// 5.薪资项目列处理(初始化导入或调薪)
}else if (!isEmpty && effectiveTimeI18n.equals(key) && effectiveTime == null) {
// 3.生效时间处理
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowindex + "生效日期错误或格式不正确,正确格式示例为'2022-01-01'、'2022/1/1'");

View File

@ -7,6 +7,7 @@ import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salarysob.bo.SalarySobRangeBO;
import com.engine.salary.entity.salarysob.param.SalarySobRangeEmpQueryParam;
import com.engine.salary.entity.salarysob.po.SalarySobRangePO;
import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.mapper.datacollection.EmployMapper;
import com.engine.salary.service.SalaryEmployeeService;
import com.engine.salary.service.SalarySobRangeService;
@ -14,13 +15,11 @@ import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import weaver.hrm.User;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -104,7 +103,21 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
for (List<Long> longs : partition) {
employeeList.addAll(getEmployMapper().getEmployeeByIds(longs));
}
return employeeList;
return employeeList;
}
public List<DataCollectionEmployee> filterEmployees(List<DataCollectionEmployee> employees, String userName, String deparmentName, String mobile) {
List<DataCollectionEmployee> employeeSameIds = employees.stream().filter(e -> (StringUtils.isBlank(userName) || Objects.equals(e.getUsername(), userName))
&& (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName))
&& (StringUtils.isBlank(mobile) || Objects.equals(e.getMobile(), mobile)))
.collect(Collectors.toList());
//存在离职和在职状态取在职状态
employeeSameIds = employeeSameIds.stream()
.filter(e -> UserStatusEnum.getNormalStatus().contains(e.getStatus()))
.collect(Collectors.toList());
return employeeSameIds;
}
}

View File

@ -1,5 +1,6 @@
package com.engine.salary.util;
import com.engine.salary.enums.SalaryRoundingModeEnum;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import org.apache.commons.collections.CollectionUtils;
@ -188,6 +189,14 @@ public class SalaryEntityUtil {
value = value.setScale(newScale + 1, RoundingMode.FLOOR);
roundingMode = RoundingMode.UP;
}
//向上取偶
if (Objects.equals(rententionRule, SalaryRoundingModeEnum.UP_EVEN.getValue())) {
value = value.setScale(0, RoundingMode.UP);
int number = value.intValue();
if (number % 2 != 0) {
value = value.add(BigDecimal.valueOf(1));
}
}
return value.setScale(newScale, roundingMode);
}