Merge remote-tracking branch 'remotes/origin/master' into feature/v2-addWelfareArchives-1117
This commit is contained in:
commit
e2a4a7157b
|
|
@ -123,6 +123,19 @@ public class SalaryArchiveItemBiz {
|
|||
}
|
||||
|
||||
|
||||
public void updateIgnoreNull(SalaryArchiveItemPO salaryArchiveItem) {
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
SalaryArchiveItemMapper mapper = sqlSession.getMapper(SalaryArchiveItemMapper.class);
|
||||
SalaryArchiveItemPOEncrypt.encryptSalaryArchiveItemPO(salaryArchiveItem);
|
||||
mapper.updateIgnoreNull(salaryArchiveItem);
|
||||
sqlSession.commit();
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public List<SalaryItemAdjustRecordListDTO> salaryItemAdjustRecordList(SalaryItemAdjustRecordQueryParam queryParam, List<Long> salaryItemIds) {
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,10 @@ import java.util.List;
|
|||
@Data
|
||||
public class WeaTableColumnGroup extends WeaTableColumn {
|
||||
|
||||
/**
|
||||
* 锁定状态
|
||||
*/
|
||||
private String lockStatus;
|
||||
|
||||
private List<WeaTableColumnGroup> children;
|
||||
|
||||
|
|
@ -18,8 +22,20 @@ public class WeaTableColumnGroup extends WeaTableColumn {
|
|||
super(width, text, column);
|
||||
}
|
||||
|
||||
public WeaTableColumnGroup(String width, String text, String column, String lockStatus) {
|
||||
super(width, text, column);
|
||||
this.lockStatus = lockStatus;
|
||||
}
|
||||
|
||||
|
||||
public WeaTableColumnGroup(String width, String text, String column, List<WeaTableColumnGroup> children) {
|
||||
super(width, text, column);
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
public WeaTableColumnGroup(String width, String text, String column, List<WeaTableColumnGroup> children, String lockStatus) {
|
||||
super(width, text, column);
|
||||
this.children = children;
|
||||
this.lockStatus = lockStatus;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
package com.engine.salary.entity.datacollection.param;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class OtherDeductionExtendLastParam {
|
||||
|
||||
private String declareMonth;
|
||||
|
||||
private LocalDateTime yearMonthTime;
|
||||
|
||||
private Integer taxAgentId;
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ package com.engine.salary.entity.salaryacct.bo;
|
|||
import com.engine.salary.entity.datacollection.dto.AttendQuoteFieldListDTO;
|
||||
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.salaryformula.ExpressFormula;
|
||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO;
|
||||
|
|
@ -45,6 +46,13 @@ public class SalaryAcctCalculateBO {
|
|||
*/
|
||||
private SalarySobCycleDTO salarySobCycleDTO;
|
||||
|
||||
/**
|
||||
* 核算锁定值
|
||||
*/
|
||||
private Map<String, SalaryAcctResultPO> salaryAcctLockResultPOS;
|
||||
private List<Long> lockSalaryItemIds;
|
||||
|
||||
|
||||
/**
|
||||
* 相同税款所属期内其他薪资核算记录(薪资类型为工资薪金的账套的)
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import com.engine.salary.entity.salarysob.po.SalarySobEmpFieldPO;
|
|||
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
|
||||
import com.engine.salary.entity.salarysob.po.SalarySobPO;
|
||||
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
|
||||
import com.engine.salary.enums.salaryaccounting.LockStatusEnum;
|
||||
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
|
|
@ -125,28 +126,36 @@ public class SalaryAcctResultBO {
|
|||
* @param salarySobItemAggregateDTO
|
||||
* @return
|
||||
*/
|
||||
public static List<WeaTableColumnGroup> buildTableColumns(SalarySobItemAggregateDTO salarySobItemAggregateDTO) {
|
||||
public static List<WeaTableColumnGroup> buildTableColumns(SalarySobItemAggregateDTO salarySobItemAggregateDTO, List<Long> lockSalaryItemIds) {
|
||||
List<WeaTableColumnGroup> columns = Lists.newArrayList();
|
||||
// 员工信息字段
|
||||
for (SalarySobEmpFieldDTO salarySobEmpFieldDTO : salarySobItemAggregateDTO.getEmpFields()) {
|
||||
columns.add(new WeaTableColumnGroup("150", salarySobEmpFieldDTO.getFieldName(), salarySobEmpFieldDTO.getFieldId()));
|
||||
}
|
||||
// 薪资项目分组下的薪资项目
|
||||
// 薪资项目分组下的薪资项目
|
||||
for (SalarySobItemGroupDTO salarySobItemGroupDTO : salarySobItemAggregateDTO.getItemGroups()) {
|
||||
if (CollectionUtils.isEmpty(salarySobItemGroupDTO.getItems())) {
|
||||
continue;
|
||||
}
|
||||
List<WeaTableColumnGroup> childrenColumns = Lists.newArrayList();
|
||||
for (SalarySobItemDTO salarySobItemDTO : salarySobItemGroupDTO.getItems()) {
|
||||
childrenColumns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId()));
|
||||
if (lockSalaryItemIds.contains(salarySobItemDTO.getSalaryItemId())) {
|
||||
childrenColumns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.LOCK.getValue()));
|
||||
} else {
|
||||
childrenColumns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.UNLOCK.getValue()));
|
||||
}
|
||||
}
|
||||
WeaTableColumnGroup weaTableColumnWapper = new WeaTableColumnGroup("150", salarySobItemGroupDTO.getName(), String.valueOf(salarySobItemGroupDTO.getId()), childrenColumns);
|
||||
columns.add(weaTableColumnWapper);
|
||||
}
|
||||
// 没有分类的薪资项目
|
||||
for (SalarySobItemDTO salarySobItemDTO : salarySobItemAggregateDTO.getItems()) {
|
||||
columns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId()));
|
||||
if (lockSalaryItemIds.contains(salarySobItemDTO.getSalaryItemId())) {
|
||||
columns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.LOCK.getValue()));
|
||||
} else {
|
||||
columns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.UNLOCK.getValue()));
|
||||
}
|
||||
|
||||
}
|
||||
return columns;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
package com.engine.salary.entity.salaryacct.bo;
|
||||
|
||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
|
||||
import com.engine.salary.entity.salarysob.dto.SalarySobItemAggregateDTO;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 薪资核算人员
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class SalaryAcctResultListContext {
|
||||
|
||||
private SalaryAcctRecordPO salaryAcctRecord;
|
||||
|
||||
private SalarySobItemAggregateDTO salarySobItemAggregate;
|
||||
|
||||
//存在合并计税的薪资核算人员(employeeId-taxAgentId)")
|
||||
private Set<String> sameTaxCycleKeySet;
|
||||
|
||||
//薪资核算人员")
|
||||
private List<SalaryAcctEmployeePO> salaryAcctEmployees;
|
||||
|
||||
private Integer total;
|
||||
|
||||
private Map<String, String> hrmStatusMap;
|
||||
|
||||
private Map<Long, DataCollectionEmployee> simpleEmployeeMap;
|
||||
|
||||
// private Map<Long, ExtEmployeePO> extEmployeeMap;
|
||||
|
||||
private Map<Long, String> taxAgentNameMap;
|
||||
|
||||
public SalaryAcctResultListContext() {
|
||||
this.sameTaxCycleKeySet = new HashSet<>();
|
||||
this.salaryAcctEmployees = new ArrayList<>();
|
||||
this.hrmStatusMap = new HashMap<>();
|
||||
this.simpleEmployeeMap = new HashMap<>();
|
||||
// this.extEmployeeMap = new HashMap<>();
|
||||
this.taxAgentNameMap = new HashMap<>();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package com.engine.salary.entity.salaryacct.param;
|
||||
|
||||
import com.engine.salary.common.BaseQueryParam;
|
||||
import com.engine.salary.enums.salaryaccounting.EmployeeTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 薪资核算人员列表查询条件
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
//薪资核算人员列表查询条件")
|
||||
public class SalaryAcctEmployeeListQueryParam extends BaseQueryParam {
|
||||
|
||||
/**
|
||||
* 参数错误,薪资核算记录ID不能为空
|
||||
*/
|
||||
@NotNull(message = "LABEL:99845")
|
||||
//薪资核算记录id")
|
||||
private Long salaryAcctRecordId;
|
||||
|
||||
//人员姓名")
|
||||
private String employeeName;
|
||||
|
||||
//个税扣缴义务人")
|
||||
private Long taxAgentId;
|
||||
|
||||
//人员")
|
||||
private Collection<Long> employeeIds;
|
||||
|
||||
//部门")
|
||||
private Collection<Long> departmentIds;
|
||||
|
||||
//岗位")
|
||||
private Collection<Long> positionIds;
|
||||
|
||||
//状态")
|
||||
private String status;
|
||||
|
||||
//工号")
|
||||
private String jobNum;
|
||||
|
||||
//列表主键id")
|
||||
private Collection<Long> ids;
|
||||
|
||||
//薪资核算人员类型")
|
||||
private EmployeeTypeEnum employeeType;
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.engine.salary.entity.salaryacct.param;
|
||||
|
||||
import com.engine.salary.enums.salaryaccounting.LockStatusEnum;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 更新核算锁定状态
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
public class SalaryAcctResultUpdateLockStatusParam {
|
||||
|
||||
//锁定状态
|
||||
private LockStatusEnum lockStatus;
|
||||
|
||||
//薪资项目的Id")
|
||||
private Long salaryItemId;
|
||||
|
||||
//薪资核算人员的id")
|
||||
// private Set<String> idStrSet;
|
||||
|
||||
//薪资核算记录的id")
|
||||
private Long salaryAcctRecordId;
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@ import lombok.experimental.Accessors;
|
|||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 薪资核算表
|
||||
|
|
@ -88,6 +89,11 @@ public class SalaryAcctRecordPO {
|
|||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 锁定的薪资项目
|
||||
*/
|
||||
private List<Long> lockSalaryItemIds;
|
||||
|
||||
//查询条件-------------------------------
|
||||
Collection<Long> ids;
|
||||
|
||||
|
|
|
|||
|
|
@ -210,12 +210,16 @@ public class SalaryArchiveBO {
|
|||
Date endTempItem = endItem;
|
||||
List<SalaryArchiveItemDataDTO> salaryItemValues = new ArrayList<>();
|
||||
for (Long salaryArchiveItemId : salaryArchiveItemIds) {
|
||||
boolean flag = false;
|
||||
for (SalaryArchiveItemPO salaryArchiveItem : salaryArchiveItems) {
|
||||
if (!salaryArchiveItemId.equals(salaryArchiveItem.getSalaryItemId()) || !salaryArchiveItem.getSalaryArchiveId().equals(salaryArchive.getId())) {
|
||||
continue;
|
||||
}
|
||||
Date fromDateItem = salaryArchiveItem.getEffectiveTime();
|
||||
if (fromDateItem.after(endTempItem) || !endTempItem.after(startItem)) {
|
||||
if (fromDateItem.after(endTempItem) || endTempItem.before(startItem)) {
|
||||
continue;
|
||||
}
|
||||
if ( endTempItem.equals(startItem) && flag == true) {
|
||||
continue;
|
||||
}
|
||||
SalaryArchiveItemDataDTO salaryArchiveItemData = new SalaryArchiveItemDataDTO();
|
||||
|
|
@ -223,6 +227,7 @@ public class SalaryArchiveBO {
|
|||
salaryArchiveItemData.setSalaryItemId(salaryArchiveItem.getSalaryItemId());
|
||||
salaryArchiveItemData.setValue(salaryArchiveItem.getItemValue());
|
||||
salaryItemValues.add(salaryArchiveItemData);
|
||||
flag = true;
|
||||
endTempItem = fromDateItem;
|
||||
}
|
||||
endTempItem = endItem;
|
||||
|
|
|
|||
|
|
@ -30,4 +30,7 @@ public class SalaryArchiveItemFormDTO {
|
|||
|
||||
//薪资项目调整明细")
|
||||
private Map<String,Object> salaryArchiveItemDetail;
|
||||
|
||||
//是否可以编辑
|
||||
private boolean canOperator;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,12 +30,18 @@ import java.util.Set;
|
|||
//薪资项目调整保存参数")
|
||||
public class SalaryArchiveItemSaveParam {
|
||||
|
||||
// 主键id
|
||||
private Long salaryArchiveItemId;
|
||||
|
||||
//薪资档案id
|
||||
private Long salaryArchiveId;
|
||||
|
||||
//生效时间
|
||||
private Date effectiveTime;
|
||||
|
||||
// 是否允许编辑
|
||||
private Boolean canOperator;
|
||||
|
||||
/**
|
||||
* 调整原因
|
||||
*
|
||||
|
|
@ -49,6 +55,8 @@ public class SalaryArchiveItemSaveParam {
|
|||
//薪资项目
|
||||
private List<SalaryArchiveItemDetailSaveParam> salaryArchiveItems;
|
||||
|
||||
|
||||
|
||||
public static void checkParam(SalaryArchiveItemSaveParam saveParam) {
|
||||
if (saveParam.getSalaryArchiveId() == null) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100305, "薪资档案id必传"));
|
||||
|
|
@ -56,9 +64,9 @@ public class SalaryArchiveItemSaveParam {
|
|||
if (saveParam.getAdjustReason() == null) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100306, "请选择调整原因"));
|
||||
}
|
||||
if (SalaryArchiveItemAdjustReasonEnum.parseByValue(saveParam.getAdjustReason()) == null) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100306, "调整原因不在范围内"));
|
||||
}
|
||||
// if (SalaryArchiveItemAdjustReasonEnum.parseByValue(saveParam.getAdjustReason()) == null) {
|
||||
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100306, "调整原因不在范围内"));
|
||||
// }
|
||||
if (saveParam.getEffectiveTime() == null) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100307, "请选择生效日期"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
package com.engine.salary.enums.salaryaccounting;
|
||||
|
||||
import com.engine.salary.enums.BaseEnum;
|
||||
|
||||
|
||||
public enum LockStatusEnum implements BaseEnum<String> {
|
||||
DEFAULT("DEFAULT", "默认", 0),
|
||||
LOCK("LOCK", "锁定", 0),
|
||||
UNLOCK("UNLOCK", "未锁定", 0);
|
||||
|
||||
private String value;
|
||||
|
||||
private String defaultLabel;
|
||||
|
||||
private int labelId;
|
||||
|
||||
LockStatusEnum(String value, String defaultLabel, int labelId) {
|
||||
this.value = value;
|
||||
this.defaultLabel = defaultLabel;
|
||||
this.labelId = labelId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getLabelId() {
|
||||
return labelId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultLabel() {
|
||||
return defaultLabel;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package com.engine.salary.handle;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.huawei.shade.com.alibaba.fastjson.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.type.BaseTypeHandler;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 集合的转换
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Slf4j
|
||||
public class SalaryListTypeHandler extends BaseTypeHandler<List> {
|
||||
|
||||
@Override
|
||||
public void setNonNullParameter(PreparedStatement preparedStatement, int i, List list, JdbcType jdbcType) throws SQLException {
|
||||
preparedStatement.setString(i, JSON.toJSONString(list));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getNullableResult(ResultSet resultSet, String s) throws SQLException {
|
||||
JSONArray jsonArray = JSONArray.parseArray(resultSet.getString(s));
|
||||
return jsonArray == null ? new ArrayList<>() : jsonArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getNullableResult(ResultSet resultSet, int i) throws SQLException {
|
||||
JSONArray jsonArray = JSONArray.parseArray(resultSet.getString(i));
|
||||
return jsonArray == null ? new ArrayList<>() : jsonArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getNullableResult(CallableStatement callableStatement, int i) throws SQLException {
|
||||
JSONArray jsonArray = JSONArray.parseArray(callableStatement.getString(i));
|
||||
return jsonArray == null ? new ArrayList<>() : jsonArray;
|
||||
}
|
||||
}
|
||||
|
|
@ -74,4 +74,6 @@ public interface SalaryAcctRecordMapper {
|
|||
void deleteByIds(@Param("ids") Collection<Long> ids);
|
||||
|
||||
List<SalaryAcctRecordPO> listByCreateDate(@Param(value = "createRange") LocalDateRange createRange, @Param(value = "salarySobIds") Set<Long> salarySobIds);
|
||||
|
||||
void updateLockSalaryItemIds(SalaryAcctRecordPO salaryAcctRecord);
|
||||
}
|
||||
|
|
@ -14,11 +14,14 @@
|
|||
<result column="update_time" property="updateTime"/>
|
||||
<result column="delete_type" property="deleteType"/>
|
||||
<result column="tenant_key" property="tenantKey"/>
|
||||
<result column="lock_salary_item_ids" property="lockSalaryItemIds" typeHandler="com.engine.salary.handle.SalaryListTypeHandler"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 表字段 -->
|
||||
<sql id="baseColumns">
|
||||
t.id
|
||||
t
|
||||
.
|
||||
id
|
||||
, t.salary_month
|
||||
, t.tax_cycle
|
||||
, t.salary_sob_id
|
||||
|
|
@ -30,6 +33,7 @@
|
|||
, t.update_time
|
||||
, t.delete_type
|
||||
, t.tenant_key
|
||||
,t.lock_salary_item_ids
|
||||
</sql>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
|
|
@ -222,9 +226,10 @@
|
|||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO" databaseId="oracle"
|
||||
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO"
|
||||
databaseId="oracle"
|
||||
>
|
||||
<selectKey keyProperty="id" resultType="long" order="AFTER">
|
||||
<selectKey keyProperty="id" resultType="long" order="AFTER">
|
||||
select hrsa_salary_acct_record_id.currval from dual
|
||||
</selectKey>
|
||||
INSERT INTO hrsa_salary_acct_record
|
||||
|
|
@ -387,4 +392,15 @@
|
|||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
<!-- 更新不为NULL的字段 -->
|
||||
<update id="updateLockSalaryItemIds" parameterType="com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO">
|
||||
UPDATE hrsa_salary_acct_record
|
||||
<set>
|
||||
lock_salary_item_ids =
|
||||
#{lockSalaryItemIds, jdbcType=ARRAY, typeHandler=com.engine.salary.handle.SalaryListTypeHandler},
|
||||
</set>
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -154,5 +154,5 @@ public interface AddUpDeductionService {
|
|||
* @return void
|
||||
* @author lfc
|
||||
*/
|
||||
String autoAddAll(Date yearMonth);
|
||||
String autoAddAll(Date yearMonth, Boolean isAdmin);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,10 +2,7 @@ package com.engine.salary.service;
|
|||
|
||||
import com.engine.salary.entity.datacollection.dto.OtherDeductionListDTO;
|
||||
import com.engine.salary.entity.datacollection.dto.OtherDeductionRecordDTO;
|
||||
import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordDeleteParam;
|
||||
import com.engine.salary.entity.datacollection.param.OtherDeductionImportParam;
|
||||
import com.engine.salary.entity.datacollection.param.OtherDeductionParam;
|
||||
import com.engine.salary.entity.datacollection.param.OtherDeductionQueryParam;
|
||||
import com.engine.salary.entity.datacollection.param.*;
|
||||
import com.engine.salary.entity.datacollection.po.OtherDeductionPO;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
|
@ -113,4 +110,6 @@ public interface OtherDeductionService {
|
|||
* 获取数据
|
||||
*/
|
||||
OtherDeductionRecordDTO getOtherDeduction(OtherDeductionParam otherDeductionParam);
|
||||
|
||||
String extendToLastMonth(OtherDeductionExtendLastParam param);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -180,4 +180,6 @@ public interface SalaryAcctRecordService {
|
|||
* @return
|
||||
*/
|
||||
List<SalaryAcctRecordPO> listByStatusAndEmployeeId(SalaryAcctRecordStatusEnum status, Long employeeId);
|
||||
|
||||
void updateLockSalaryItemIds(SalaryAcctRecordPO salaryAcctRecord);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.engine.salary.entity.salaryacct.dto.SalaryAcctResultListColumnDTO;
|
|||
import com.engine.salary.entity.salaryacct.param.SalaryAcctCalculateParam;
|
||||
import com.engine.salary.entity.salaryacct.param.SalaryAcctResultQueryParam;
|
||||
import com.engine.salary.entity.salaryacct.param.SalaryAcctResultSaveParam;
|
||||
import com.engine.salary.entity.salaryacct.param.SalaryAcctResultUpdateLockStatusParam;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
|
||||
|
|
@ -75,6 +76,7 @@ public interface SalaryAcctResultService {
|
|||
|
||||
/**
|
||||
* 合计行
|
||||
*
|
||||
* @param queryParam
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -107,7 +109,7 @@ public interface SalaryAcctResultService {
|
|||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param saveParam 保存参数
|
||||
* @param saveParam 保存参数
|
||||
*/
|
||||
void save(SalaryAcctResultSaveParam saveParam);
|
||||
|
||||
|
|
@ -156,4 +158,11 @@ public interface SalaryAcctResultService {
|
|||
* @return
|
||||
*/
|
||||
List<SalaryAcctResultPO> listBySalaryAcctRecordIdsAndTaxAgentIds(Collection<Long> salaryAcctRecordIds, Collection<Long> taxAgentIds);
|
||||
|
||||
/**
|
||||
* 更新锁定状态
|
||||
*
|
||||
* @param updateParam
|
||||
*/
|
||||
void updateLockStatusByParam(SalaryAcctResultUpdateLockStatusParam updateParam);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,15 @@ public interface SalaryArchiveItemService {
|
|||
*/
|
||||
String getSalaryItemAdjustBeforeValue(SalaryItemAdjustBeforeParam adjustBeforeParam);
|
||||
|
||||
|
||||
/**
|
||||
* @description 根据薪资档案id和薪资项id获取薪资项目(生效+不生效)
|
||||
* @return List<SalaryAtemPO>
|
||||
* @author Harryxzy
|
||||
* @date 2022/11/14 17:07
|
||||
*/
|
||||
List<SalaryArchiveItemPO> getSalaryItemsBySalaryArchiveIdAndItemIds(Long salaryArchiveId, List<Long> salaryItemPageIds);
|
||||
|
||||
/**
|
||||
* 获取当前已生效
|
||||
*
|
||||
|
|
@ -140,5 +149,11 @@ public interface SalaryArchiveItemService {
|
|||
Map<String, List<SalaryArchiveItemPO>> getIneffectiveItemListMap(Collection<Long> salaryArchiveIds, boolean isNoNeedSalaryItem, Collection<Long> salaryItemIds);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @description 单个档案的薪资项目调整的编辑
|
||||
* @return String
|
||||
* @author Harryxzy
|
||||
* @date 2022/11/14 13:38
|
||||
*/
|
||||
String editSingleSalaryItem(SalaryArchiveItemSaveParam salaryArchiveItemSaveParam);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -639,14 +639,15 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
|
|||
}
|
||||
|
||||
@Override
|
||||
public String autoAddAll(Date yearMonth) {
|
||||
int uid = user.getUID();
|
||||
Boolean isChief = getTaxAgentService(user).isChief((long) uid);
|
||||
public String autoAddAll(Date yearMonth, Boolean isAdmin) {
|
||||
//如果是定时任务直接查询所有,isAdmin传true
|
||||
boolean isChief = Boolean.TRUE.equals(isAdmin)
|
||||
|| getTaxAgentService(user).isChief((long) user.getUID());
|
||||
Collection<TaxAgentPO> taxAgents;
|
||||
if (isChief) {
|
||||
taxAgents = getTaxAgentService(user).listAll();
|
||||
} else {
|
||||
taxAgents = getTaxAgentService(user).listAllTaxAgentsAsAdmin((long) uid);
|
||||
taxAgents = getTaxAgentService(user).listAllTaxAgentsAsAdmin((long) user.getUID());
|
||||
}
|
||||
LocalDateTime yearMonthTime = DateUtil.toLocalDateTime(yearMonth);
|
||||
//设置时间到下一年1月1号
|
||||
|
|
@ -701,7 +702,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
|
|||
addUpDeduction.setEmployeeId(employeeId);
|
||||
addUpDeduction.setTaxAgentId(taxAgent.getId());
|
||||
addUpDeduction.setDeclareMonth(DateUtil.beginOfMonth(yearMonth));
|
||||
addUpDeduction.setCreator((long) user.getUID());
|
||||
addUpDeduction.setCreator(user == null ? 0 : (long) user.getUID());
|
||||
addUpDeduction.setTenantKey(DEFAULT_TENANT_KEY);
|
||||
|
||||
//确认当期是否有已经累计的记录
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
package com.engine.salary.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.api.formmode.mybatis.util.SqlProxyHandle;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.biz.EmployBiz;
|
||||
import com.engine.salary.biz.OtherDeductionBiz;
|
||||
import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
||||
import com.engine.salary.encrypt.datacollection.OtherDeductionListDTOEncrypt;
|
||||
import com.engine.salary.encrypt.datacollection.OtherDeductionRecordDTOEncrypt;
|
||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
|
|
@ -49,6 +51,7 @@ import weaver.hrm.User;
|
|||
|
||||
import java.io.InputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.YearMonth;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -61,6 +64,10 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
|
|||
return MapperProxyFactory.getProxy(OtherDeductionMapper.class);
|
||||
}
|
||||
|
||||
private OtherDeductionBiz getOtherDeductionBiz() {
|
||||
return new OtherDeductionBiz();
|
||||
}
|
||||
|
||||
private TaxAgentService getTaxAgentService(User user) {
|
||||
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
|
||||
}
|
||||
|
|
@ -563,12 +570,12 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
|
|||
// 获取所有个税扣缴义务人
|
||||
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId);
|
||||
OtherDeductionPO byId = OtherDeductionBiz.getById(otherDeductionParam.getId());
|
||||
if(byId == null){
|
||||
if (byId == null) {
|
||||
throw new SalaryRunTimeException("该数据不存在!");
|
||||
}
|
||||
Long taxAgentId = byId.getTaxAgentId();
|
||||
boolean canEdit = taxAgentList.stream().anyMatch(t -> Objects.equals(t.getTaxAgentId() , taxAgentId));
|
||||
if(!canEdit){
|
||||
boolean canEdit = taxAgentList.stream().anyMatch(t -> Objects.equals(t.getTaxAgentId(), taxAgentId));
|
||||
if (!canEdit) {
|
||||
//没有编辑权限
|
||||
throw new SalaryRunTimeException("该个税扣缴义务人无权限编辑此数据!");
|
||||
}
|
||||
|
|
@ -577,8 +584,8 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
|
|||
// 判断是否有核算过
|
||||
if (CollectionUtils.isNotEmpty(salaryAcctEmployees)) {
|
||||
Optional<SalaryAcctEmployeePO> optionalAcctEmp = salaryAcctEmployees.stream().filter(f -> f.getEmployeeId().equals(otherDeductionParam.getEmployeeId()) && f.getTaxAgentId().equals(otherDeductionParam.getTaxAgentId())).findFirst();
|
||||
if (optionalAcctEmp.isPresent()) {
|
||||
throw new SalaryRunTimeException("该年月这条数据已经核算过,不可进行编辑!");
|
||||
if (optionalAcctEmp.isPresent()) {
|
||||
throw new SalaryRunTimeException("该年月这条数据已经核算过,不可进行编辑!");
|
||||
}
|
||||
}
|
||||
ArrayList<OtherDeductionPO> updateList = new ArrayList<>();
|
||||
|
|
@ -622,8 +629,8 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
|
|||
.declareMonth(declareMonth).build();
|
||||
|
||||
//筛选导入人员信息可以在人力资源池中匹配到的人员信息
|
||||
boolean employeeSameId = employees.stream().anyMatch(e -> Objects.equals(e.getEmployeeId() , otherDeductionParam.getEmployeeId()));
|
||||
if(!employeeSameId){
|
||||
boolean employeeSameId = employees.stream().anyMatch(e -> Objects.equals(e.getEmployeeId(), otherDeductionParam.getEmployeeId()));
|
||||
if (!employeeSameId) {
|
||||
throw new SalaryRunTimeException("员工信息不存在");
|
||||
}
|
||||
po.setEmployeeId(otherDeductionParam.getEmployeeId());
|
||||
|
|
@ -655,7 +662,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
|
|||
String deductionAllowedDonation = otherDeductionParam.getDeductionAllowedDonation();
|
||||
po.setDeductionAllowedDonation(deductionAllowedDonation);
|
||||
|
||||
//fixme 分权判断
|
||||
//fixme 分权判断
|
||||
// if (openDevolution) {
|
||||
// OtherDeductionPO finalPoE = po;
|
||||
// Optional<TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee> optionalTaxAgentEmp = taxAgentEmployees.stream().filter(f -> f.getEmployeeId().equals(finalPoE.getEmployeeId())).findFirst();
|
||||
|
|
@ -694,15 +701,15 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
|
|||
List<SalaryAcctEmployeePO> salaryAcctEmployees = getAddUpDeductionService(user).getAccountedEmployeeData(declareMonthStr);
|
||||
// 判断是否有核算过
|
||||
List<Long> deleteList = new ArrayList<>();
|
||||
for(int i=0; i<deleteIds.size(); i++){
|
||||
for (int i = 0; i < deleteIds.size(); i++) {
|
||||
Long id = deleteIds.get(i);
|
||||
OtherDeductionPO byId = otherDeductionBiz.getById(id);
|
||||
if(byId == null){
|
||||
if (byId == null) {
|
||||
throw new SalaryRunTimeException("数据不存在或已被删除!");
|
||||
}
|
||||
// 判断是否在个税扣缴义务人范围内
|
||||
Optional<TaxAgentManageRangeEmployeeDTO> first = taxAgentList.stream().filter(m -> Objects.equals(m.getTaxAgentId() , byId.getTaxAgentId())).findFirst();
|
||||
if(!first.isPresent()){
|
||||
Optional<TaxAgentManageRangeEmployeeDTO> first = taxAgentList.stream().filter(m -> Objects.equals(m.getTaxAgentId(), byId.getTaxAgentId())).findFirst();
|
||||
if (!first.isPresent()) {
|
||||
throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内");
|
||||
}
|
||||
// 判断用户是否存在
|
||||
|
|
@ -726,32 +733,32 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
|
|||
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId);
|
||||
List<Long> taxAgentIds = taxAgentList.stream().map(TaxAgentManageRangeEmployeeDTO::getTaxAgentId).collect(Collectors.toList());
|
||||
OtherDeductionBiz otherDeductionBiz = new OtherDeductionBiz();
|
||||
Date declareMonthDate =null;
|
||||
Date declareMonthDate = null;
|
||||
try {
|
||||
declareMonthDate = sdf.parse(declareMonthStr+"-01");
|
||||
}catch (Exception e){
|
||||
declareMonthDate = sdf.parse(declareMonthStr + "-01");
|
||||
} catch (Exception e) {
|
||||
throw new SalaryRunTimeException("日期异常");
|
||||
}
|
||||
|
||||
OtherDeductionPO queryParam = null;
|
||||
if(deleteParam.getTaxAgentId() != null && (!deleteParam.getTaxAgentId().equals(""))){
|
||||
if (deleteParam.getTaxAgentId() != null && (!deleteParam.getTaxAgentId().equals(""))) {
|
||||
// 设置了个税扣缴义务人
|
||||
Long taxAgentId = SalaryEntityUtil.string2Long(deleteParam.getTaxAgentId());
|
||||
boolean canDelete = taxAgentIds.stream().anyMatch(t -> Objects.equals(t , taxAgentId));
|
||||
if(!canDelete){
|
||||
boolean canDelete = taxAgentIds.stream().anyMatch(t -> Objects.equals(t, taxAgentId));
|
||||
if (!canDelete) {
|
||||
throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内!");
|
||||
}
|
||||
ArrayList<Long> tai = new ArrayList<>();
|
||||
tai.add(taxAgentId);
|
||||
queryParam = OtherDeductionPO.builder().declareMonth(declareMonthDate).taxAgentIds(tai).build();
|
||||
}else {
|
||||
queryParam = OtherDeductionPO.builder().declareMonth(declareMonthDate).taxAgentIds(tai).build();
|
||||
} else {
|
||||
queryParam = OtherDeductionPO.builder().declareMonth(declareMonthDate).taxAgentIds(taxAgentIds).build();
|
||||
}
|
||||
// 获取所有想要删除的数据
|
||||
List<OtherDeductionPO> list = otherDeductionBiz.listSome(queryParam);
|
||||
// 获取已经核算的数据
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployees = getAddUpDeductionService(user).getAccountedEmployeeData(declareMonthStr);
|
||||
for(OtherDeductionPO item : list){
|
||||
for (OtherDeductionPO item : list) {
|
||||
if (CollectionUtils.isNotEmpty(salaryAcctEmployees)) {
|
||||
Optional<SalaryAcctEmployeePO> optionalAcctEmp = salaryAcctEmployees.stream().filter(f -> f.getEmployeeId().equals(item.getEmployeeId()) && f.getTaxAgentId().equals(item.getTaxAgentId())).findFirst();
|
||||
if (optionalAcctEmp.isPresent()) {
|
||||
|
|
@ -775,16 +782,79 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
|
|||
List<OtherDeductionRecordDTO> list = getOtherDeductionMapper().recordList(build);
|
||||
OtherDeductionRecordDTOEncrypt.decryptOtherDeductionRecordDTOList(list);
|
||||
|
||||
if(list==null || list.size()==0){
|
||||
if (list == null || list.size() == 0) {
|
||||
throw new SalaryRunTimeException("该数据不存在!");
|
||||
}
|
||||
String taxAgentName = list.get(0).getTaxAgentName();
|
||||
if(!taxAgentNames.contains(taxAgentName)){
|
||||
if (!taxAgentNames.contains(taxAgentName)) {
|
||||
throw new SalaryRunTimeException("您无权查看该数据!");
|
||||
}
|
||||
return list.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String extendToLastMonth(OtherDeductionExtendLastParam param) {
|
||||
//查询已经核算的数据
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployees =
|
||||
getAddUpDeductionService(user)
|
||||
.getAccountedEmployeeData(param.getDeclareMonth());
|
||||
Map<String, List<SalaryAcctEmployeePO>> acctInfoMap = salaryAcctEmployees.stream()
|
||||
.distinct().collect(Collectors.groupingBy(
|
||||
i -> i.getTaxAgentId() + "" + i.getEmployeeId()));
|
||||
|
||||
// 查找到所有个税扣缴义务人
|
||||
Boolean needAuth = getTaxAgentService(user).isNeedAuth((long) user.getUID());
|
||||
Collection<TaxAgentPO> taxAgentPOS;
|
||||
if (needAuth) {
|
||||
taxAgentPOS = getTaxAgentService(user).listAllTaxAgentsAsAdmin((long) user.getUID());
|
||||
} else {
|
||||
taxAgentPOS = getTaxAgentService(user).listAll();
|
||||
}
|
||||
List<Long> taxAgentIds = taxAgentPOS.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
|
||||
|
||||
//查询上月数据
|
||||
LocalDateTime lastMonth = param.getYearMonthTime().minusMonths(1);
|
||||
OtherDeductionQueryParam queryParam = OtherDeductionQueryParam.builder()
|
||||
.taxAgentIds(taxAgentIds)
|
||||
.declareMonthDate(Collections.singletonList(
|
||||
SalaryDateUtil.toDate(lastMonth))
|
||||
).build();
|
||||
List<OtherDeductionListDTO> lastMonthInfo = getOtherDeductionMapper().list(queryParam);
|
||||
|
||||
// 查询当前月id
|
||||
queryParam.setDeclareMonthDate(Collections.singletonList(
|
||||
SalaryDateUtil.toDate(param.getYearMonthTime())
|
||||
));
|
||||
Map<String, Long> updateIdMap = getOtherDeductionMapper()
|
||||
.list(queryParam).stream()
|
||||
.collect(Collectors.toMap(i -> i.getEmployeeId() + "" + i.getTaxAgentId(), OtherDeductionListDTO::getId));
|
||||
|
||||
List<OtherDeductionPO> insertInfo = new ArrayList<>();
|
||||
List<OtherDeductionPO> updatetInfo = new ArrayList<>();
|
||||
for (OtherDeductionListDTO dto : lastMonthInfo) {
|
||||
OtherDeductionPO po
|
||||
= JSONObject.parseObject(JSONObject.toJSONString(dto), OtherDeductionPO.class);
|
||||
po.setDeclareMonth(SalaryDateUtil.toDate(param.getYearMonthTime()));
|
||||
po.setUpdateTime(new Date());
|
||||
po.setId(null);
|
||||
po.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
|
||||
boolean hasOld = updateIdMap.containsKey(po.getEmployeeId() + "" + po.getTaxAgentId());
|
||||
if (hasOld && !acctInfoMap.containsKey(po.getTaxAgentId() + "" + po.getEmployeeId())) {
|
||||
//核算过的数据直接跳过不做更改
|
||||
po.setId(updateIdMap.get(po.getEmployeeId() + "" + po.getTaxAgentId()));
|
||||
updatetInfo.add(po);
|
||||
} else if (!hasOld) {
|
||||
po.setCreator((long) user.getUID());
|
||||
po.setCreateTime(new Date());
|
||||
insertInfo.add(po);
|
||||
}
|
||||
}
|
||||
|
||||
getOtherDeductionBiz().batchSave(insertInfo);
|
||||
getOtherDeductionBiz().batchUpdate(updatetInfo);
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public XSSFWorkbook downloadTemplate(OtherDeductionQueryParam param) {
|
||||
// 1.工作簿名称
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ import com.engine.salary.util.SalaryEntityUtil;
|
|||
import com.google.common.collect.Lists;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import weaver.hrm.User;
|
||||
|
|
@ -102,7 +104,6 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
|
|||
|
||||
@Override
|
||||
public void calculate(SalaryAcctCalculateBO salaryAcctCalculateBO, DataCollectionEmployee simpleEmployee) {
|
||||
log.info("开始核算V3{}", salaryAcctCalculateBO);
|
||||
Date now = new Date();
|
||||
try {
|
||||
// 数据库字段加密用
|
||||
|
|
@ -132,6 +133,9 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
|
|||
// 8、查询薪资核算人员的薪资核算结果
|
||||
Set<Long> salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctCalculateBO.getSalaryAcctEmployeePOS(), SalaryAcctEmployeePO::getId);
|
||||
List<SalaryAcctResultPO> salaryAcctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds);
|
||||
//核算锁定的值
|
||||
Map<String, SalaryAcctResultPO> salaryAcctLockResultPOS = MapUtils.emptyIfNull(salaryAcctCalculateBO.getSalaryAcctLockResultPOS());
|
||||
List<Long> lockSalaryItemIds = ListUtils.emptyIfNull(salaryAcctCalculateBO.getLockSalaryItemIds());
|
||||
// 9、查询相同税款所属期内涉及合并计税的其他薪资核算结果
|
||||
Set<Long> otherSalaryAcctRecordIds = SalaryEntityUtil.properties(salaryAcctCalculateBO.getOtherSalaryAcctRecordPOS(), SalaryAcctRecordPO::getId);
|
||||
List<SalaryAcctResultPO> otherSalaryAcctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctRecordIdsAndEmployeeIds(otherSalaryAcctRecordIds, employeeIds);
|
||||
|
|
@ -154,6 +158,7 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
|
|||
List<SalaryAcctResultTempPO> salaryAcctResultTempPOS = Lists.newArrayList();
|
||||
// 开始核算
|
||||
for (SalaryAcctEmployeePO salaryAcctEmployeePO : salaryAcctCalculateBO.getSalaryAcctEmployeePOS()) {
|
||||
Long salaryAcctEmployeePOId = salaryAcctEmployeePO.getId();
|
||||
//1 获取当前薪资核算人员的公式中的变量的值
|
||||
List<CalculateFormulaVarBO.FormulaVarValue> formulaVarValues = formulaVarMap.get(salaryAcctEmployeePO.getEmployeeId() + "_" + salaryAcctEmployeePO.getTaxAgentId());
|
||||
//2人员信息
|
||||
|
|
@ -190,6 +195,12 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
|
|||
resultValue = handleConsolidatedTax(resultValue, salaryItemPO, salaryAcctCalculateBO, otherSalaryAcctEmployeePOMap.get(salaryAcctEmployeePO.getEmployeeId() + "_" + salaryAcctEmployeePO.getTaxAgentId()), otherSalaryAcctResultPOMap.get(salaryAcctEmployeePO.getEmployeeId() + "_" + salaryAcctEmployeePO.getTaxAgentId()));
|
||||
// 处理小数点
|
||||
resultValue = SalaryAcctFormulaBO.roundResultValue(resultValue, salaryItemPO);
|
||||
|
||||
//是否锁定
|
||||
if (lockSalaryItemIds.contains(salaryItemId) && salaryAcctLockResultPOS.get(salaryItemId + "_" + salaryAcctEmployeePOId) != null) {
|
||||
resultValue = salaryAcctLockResultPOS.get(salaryItemId + "_" + salaryAcctEmployeePOId).getResultValue();
|
||||
}
|
||||
|
||||
// 将已经计算过的薪资项目的值转换成公式变量的值添加到集合中
|
||||
String key = SalaryFormulaReferenceEnum.SALARY_ITEM.getValue() + SalaryFormulaFieldConstant.FIELD_ID_SEPARATOR + salaryItemPO.getCode();
|
||||
formulaVarValueMap.put(key, resultValue);
|
||||
|
|
@ -199,7 +210,7 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
|
|||
// 转换成薪资核算结果po
|
||||
SalaryAcctResultTempPO salaryAcctResultTempPO = new SalaryAcctResultTempPO()
|
||||
.setSalaryAcctRecordId(salaryAcctEmployeePO.getSalaryAcctRecordId())
|
||||
.setSalaryAcctEmpId(salaryAcctEmployeePO.getId())
|
||||
.setSalaryAcctEmpId(salaryAcctEmployeePOId)
|
||||
.setEmployeeId(salaryAcctEmployeePO.getEmployeeId())
|
||||
.setTaxAgentId(salaryAcctEmployeePO.getTaxAgentId())
|
||||
.setSalarySobId(salaryAcctEmployeePO.getSalarySobId())
|
||||
|
|
@ -246,10 +257,14 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
|
|||
try {
|
||||
List<FormulaVar> formulaVars = ExpressFormulaBO.buildFormulaVar4Accounting(expressFormula, formulaVarValueMap);
|
||||
Object run = getFormulaRunService(user).run(expressFormula, formulaVars, simpleEmployee);
|
||||
return run == null ? StringUtils.EMPTY : run.toString();
|
||||
return run.toString();
|
||||
} catch (Exception e) {
|
||||
log.error("express execute fail ", e);
|
||||
}
|
||||
|
||||
if ("number".equals(expressFormula.getReturnType())) {
|
||||
return "0";
|
||||
}
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
|
|
@ -260,7 +275,7 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
|
|||
*/
|
||||
private String handleConsolidatedTax(String resultValue, SalaryItemPO salaryItemPO, SalaryAcctCalculateBO salaryAcctCalculateBO, List<SalaryAcctEmployeePO> otherSalaryAcctEmployeePOS, List<SalaryAcctResultPO> otherSalaryAcctResultPOS) {
|
||||
// 如果相同税款所属期内没有其他薪资核算人员,就不存在合并计税
|
||||
if (CollectionUtils.isEmpty(otherSalaryAcctEmployeePOS)||CollectionUtils.isEmpty(otherSalaryAcctResultPOS)) {
|
||||
if (CollectionUtils.isEmpty(otherSalaryAcctEmployeePOS) || CollectionUtils.isEmpty(otherSalaryAcctResultPOS)) {
|
||||
return resultValue;
|
||||
}
|
||||
// 相同税款所属期内其他薪资核算记录
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ import com.wbi.util.Util;
|
|||
import dm.jdbc.util.IdGenerator;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
|
|
@ -319,7 +320,7 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
|
|||
// 查询薪资账套下的薪资项目+员工信息字段
|
||||
SalarySobItemAggregateDTO salarySobItemAggregateDTO = getSalarySobItemService(user).getAggregateWithItemHideBySalarySobId(salaryAcctRecordPO.getSalarySobId());
|
||||
// 构建薪资核算结果列表表头
|
||||
return SalaryAcctResultBO.buildTableColumns(salarySobItemAggregateDTO);
|
||||
return SalaryAcctResultBO.buildTableColumns(salarySobItemAggregateDTO, ListUtils.emptyIfNull(salaryAcctRecordPO.getLockSalaryItemIds()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -658,6 +658,11 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
|
|||
return getSalaryAcctRecordMapper().listSome(SalaryAcctRecordPO.builder().status(status.getValue()).creator(employeeId).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLockSalaryItemIds(SalaryAcctRecordPO salaryAcctRecord) {
|
||||
getSalaryAcctRecordMapper().updateLockSalaryItemIds(salaryAcctRecord);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 开启分权后需要判断是否能查看对应的薪资核算记录
|
||||
|
|
|
|||
|
|
@ -17,10 +17,7 @@ import com.engine.salary.entity.salaryacct.dto.ConsolidatedTaxDetailDTO;
|
|||
import com.engine.salary.entity.salaryacct.dto.SalaryAcctProgressDTO;
|
||||
import com.engine.salary.entity.salaryacct.dto.SalaryAcctResultDetailDTO;
|
||||
import com.engine.salary.entity.salaryacct.dto.SalaryAcctResultListColumnDTO;
|
||||
import com.engine.salary.entity.salaryacct.param.SalaryAcctCalculateParam;
|
||||
import com.engine.salary.entity.salaryacct.param.SalaryAcctEmployeeQueryParam;
|
||||
import com.engine.salary.entity.salaryacct.param.SalaryAcctResultQueryParam;
|
||||
import com.engine.salary.entity.salaryacct.param.SalaryAcctResultSaveParam;
|
||||
import com.engine.salary.entity.salaryacct.param.*;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
|
||||
|
|
@ -30,6 +27,8 @@ import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
|||
import com.engine.salary.entity.salarysob.dto.*;
|
||||
import com.engine.salary.entity.salarysob.po.*;
|
||||
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
|
||||
import com.engine.salary.enums.SalaryValueTypeEnum;
|
||||
import com.engine.salary.enums.salaryaccounting.LockStatusEnum;
|
||||
import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum;
|
||||
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
|
||||
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
|
||||
|
|
@ -43,6 +42,7 @@ import com.engine.salary.util.db.MapperProxyFactory;
|
|||
import com.engine.salary.util.page.PageInfo;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.weaver.util.threadPool.ThreadPoolUtil;
|
||||
import com.weaver.util.threadPool.constant.ModulePoolEnum;
|
||||
import com.weaver.util.threadPool.entity.LocalRunnable;
|
||||
|
|
@ -515,7 +515,6 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
|
||||
@Override
|
||||
public void calculate(SalaryAcctCalculateParam calculateParam, DataCollectionEmployee simpleEmployee) {
|
||||
log.info("开始核算V2{}", calculateParam);
|
||||
try {
|
||||
// 1、查询薪资核算记录
|
||||
SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(calculateParam.getSalaryAcctRecordId());
|
||||
|
|
@ -546,6 +545,19 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
Map<String, String> welfareColumns = getSIAccountService(user).welfareColumns();
|
||||
// 7、查询考勤引用的所有字段
|
||||
List<AttendQuoteFieldListDTO> attendQuoteFieldListDTOS = getAttendQuoteFieldService(user).listAll();
|
||||
|
||||
//核算锁定值
|
||||
List<Long> lockSalaryItemIds = salaryAcctRecordPO.getLockSalaryItemIds();
|
||||
Map<String, SalaryAcctResultPO> acctResults = new HashMap<>();
|
||||
if (CollectionUtils.isNotEmpty(lockSalaryItemIds)) {
|
||||
List<SalaryAcctResultPO> acctResultPOS = listBySalaryAcctRecordIds(Collections.singleton(calculateParam.getSalaryAcctRecordId()));
|
||||
acctResults = Optional.ofNullable(acctResultPOS)
|
||||
.orElse(new ArrayList<>())
|
||||
.stream()
|
||||
.filter(po -> lockSalaryItemIds.contains(po.getSalaryItemId()))
|
||||
.collect(Collectors.toMap(po -> po.getSalaryItemId() + "_" + po.getSalaryAcctEmpId(), a -> a, (a, b) -> a));
|
||||
}
|
||||
|
||||
// 8、查询公式详情
|
||||
Set<Long> formulaIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getFormulaId);
|
||||
formulaIds.addAll(SalaryEntityUtil.properties(salaryItemPOS, SalaryItemPO::getFormulaId));
|
||||
|
|
@ -577,7 +589,24 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
String calculateKey = UUID.randomUUID().toString();
|
||||
// 12.4、多线程运算,运算结果存放在临时表中
|
||||
for (List<SalaryAcctEmployeePO> acctEmployeePOS : partition) {
|
||||
SalaryAcctCalculateBO salaryAcctCalculateBO = new SalaryAcctCalculateBO().setSalaryAcctRecordPO(salaryAcctRecordPO).setSalarySobPO(salarySobPO).setSalarySobCycleDTO(salarySobCycleDTO).setOtherSalaryAcctRecordPOS(otherSalaryAcctRecordPOS).setSalarySobItemPOS(salarySobItemPOS).setSalaryItemIdWithPriorityList(salarySobItemsWithPriority).setExpressFormulas(expressFormulas).setSalaryItemPOS(salaryItemPOS).setSalarySobAdjustRulePOS(salarySobAdjustRulePOS).setWelfareColumns(MapUtils.emptyIfNull(welfareColumns)).setAttendQuoteFieldListDTOS(attendQuoteFieldListDTOS).setSalaryAcctEmployeePOS(acctEmployeePOS).setChildMonitor(childMonitor).setResults(calculateResults).setCalculateKey(calculateKey);
|
||||
SalaryAcctCalculateBO salaryAcctCalculateBO = new SalaryAcctCalculateBO()
|
||||
.setSalaryAcctRecordPO(salaryAcctRecordPO)
|
||||
.setSalarySobPO(salarySobPO)
|
||||
.setSalarySobCycleDTO(salarySobCycleDTO)
|
||||
.setOtherSalaryAcctRecordPOS(otherSalaryAcctRecordPOS)
|
||||
.setSalaryAcctLockResultPOS(MapUtils.emptyIfNull(acctResults))
|
||||
.setLockSalaryItemIds(lockSalaryItemIds)
|
||||
.setSalarySobItemPOS(salarySobItemPOS)
|
||||
.setSalaryItemIdWithPriorityList(salarySobItemsWithPriority)
|
||||
.setExpressFormulas(expressFormulas)
|
||||
.setSalaryItemPOS(salaryItemPOS)
|
||||
.setSalarySobAdjustRulePOS(salarySobAdjustRulePOS)
|
||||
.setWelfareColumns(MapUtils.emptyIfNull(welfareColumns))
|
||||
.setAttendQuoteFieldListDTOS(attendQuoteFieldListDTOS)
|
||||
.setSalaryAcctEmployeePOS(acctEmployeePOS)
|
||||
.setChildMonitor(childMonitor)
|
||||
.setResults(calculateResults)
|
||||
.setCalculateKey(calculateKey);
|
||||
LocalRunnable localRunnable = new LocalRunnable() {
|
||||
@Override
|
||||
public void execute() {
|
||||
|
|
@ -667,4 +696,91 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
}
|
||||
return SalaryAcctResultPOEncrypt.decryptList(getSalaryAcctResultMapper().listSome(SalaryAcctResultPO.builder().salaryAcctRecordIds(salaryAcctRecordIds).taxAgentIds(taxAgentIds).build()));
|
||||
}
|
||||
|
||||
|
||||
// /**
|
||||
// * 查询薪资核算人员
|
||||
// *
|
||||
// * @param queryParam
|
||||
// * @param salaryAcctRecord
|
||||
// * @return
|
||||
// */
|
||||
// private List<SalaryAcctEmployeePO> querySalaryAcctEmployee(SalaryAcctResultListContext salaryAcctResultListContext, SalaryAcctResultQueryParam queryParam, SalaryAcctRecordPO salaryAcctRecord) {
|
||||
// // 构建薪资核算人员的查询参数
|
||||
// SalaryAcctEmployeeQueryParam salaryAcctEmployeeListQueryParam = new SalaryAcctEmployeeQueryParam();
|
||||
// BeanUtils.copyProperties(queryParam, salaryAcctEmployeeListQueryParam);
|
||||
// // 查询薪资核算人员
|
||||
// List<SalaryAcctEmployeePO> salaryAcctEmployees = getSalaryAcctEmployeeService(user).listByParam(salaryAcctEmployeeListQueryParam);
|
||||
// // 查询相同税款所属期内的薪资核算人员
|
||||
// List<SalaryAcctEmployeePO> sameTaxCycleSalaryAcctEmployees = salaryAcctEmployeeService
|
||||
// .listSameTaxCycle(salaryAcctEmployees, SalaryDateUtil.getFormatYearMonth(salaryAcctRecord.getTaxCycle()));
|
||||
// Set<String> sameTaxCycleKeySet = SalaryEntityUtil.properties(sameTaxCycleSalaryAcctEmployees, o -> o.getEmployeeId() + "-" + o.getTaxAgentId());
|
||||
// salaryAcctResultListContext.setSameTaxCycleKeySet(sameTaxCycleKeySet);
|
||||
// // 过滤合并计税的人员
|
||||
// if (StringUtils.isNotEmpty(queryParam.getConsolidatedTaxation())) {
|
||||
// salaryAcctEmployees = salaryAcctEmployees.stream()
|
||||
// .filter(salaryAcctEmployeePO -> sameTaxCycleKeySet.contains(salaryAcctEmployeePO.getEmployeeId() + "-" + salaryAcctEmployeePO.getTaxAgentId()))
|
||||
// .collect(Collectors.toList());
|
||||
// }
|
||||
// // 根据权限过滤
|
||||
// return salaryAcctEmployeeService.filterByAuthority(salaryAcctEmployees, employeeId);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void updateLockStatusByParam(SalaryAcctResultUpdateLockStatusParam updateParam) {
|
||||
// 查询薪资核算记录
|
||||
SalaryAcctRecordPO salaryAcctRecord = getSalaryAcctRecordService(user).getById(updateParam.getSalaryAcctRecordId());
|
||||
if (CollectionUtils.isEmpty(salaryAcctRecord.getLockSalaryItemIds())) {
|
||||
salaryAcctRecord.setLockSalaryItemIds(new ArrayList<>());
|
||||
}
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployees = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordId(updateParam.getSalaryAcctRecordId());
|
||||
if (CollectionUtils.isEmpty(salaryAcctEmployees)) {
|
||||
return;
|
||||
}
|
||||
// 查询薪资核算结果
|
||||
Set<Long> salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctEmployees, SalaryAcctEmployeePO::getId);
|
||||
List<SalaryAcctResultPO> salaryAcctResultValues = this.listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds);
|
||||
Map<Long, SalaryAcctResultPO> salaryAcctResultValueMap = SalaryEntityUtil.convert2Map(salaryAcctResultValues, SalaryAcctResultPO::getSalaryAcctEmpId);
|
||||
// 值可以锁定的薪资项目
|
||||
// Set<Long> salaryItemIds = canLockSalaryItemIds(salaryAcctRecord.getSalarySobId());
|
||||
// if (Objects.nonNull(updateParam.getSalaryItemId())) {
|
||||
// if (!salaryItemIds.contains(updateParam.getSalaryItemId())) {
|
||||
// return;
|
||||
// }
|
||||
// salaryItemIds = Collections.singleton(updateParam.getSalaryItemId());
|
||||
// }
|
||||
Set<Long> salaryItemIds = Collections.singleton(updateParam.getSalaryItemId());
|
||||
if (updateParam.getLockStatus() == LockStatusEnum.LOCK) {
|
||||
salaryAcctRecord.getLockSalaryItemIds().addAll(salaryItemIds);
|
||||
} else {
|
||||
salaryAcctRecord.getLockSalaryItemIds().removeAll(salaryItemIds);
|
||||
}
|
||||
getSalaryAcctRecordService(user).updateLockSalaryItemIds(salaryAcctRecord);
|
||||
|
||||
}
|
||||
|
||||
private Set<Long> canLockSalaryItemIds(Long salarySobId) {
|
||||
// 值可以锁定的薪资项目
|
||||
Set<Long> salaryItemIds = Sets.newHashSet();
|
||||
// 查询薪资核算记录所用的薪资账套的薪资项目
|
||||
List<SalarySobItemDTO> salarySobItems = Lists.newArrayList();
|
||||
SalarySobItemAggregateDTO salarySobItemAggregate = getSalarySobItemService(user).getAggregateBySalarySobId(salarySobId);
|
||||
for (SalarySobItemIncomeCategoryDTO incomeCategory : salarySobItemAggregate.getIncomeCategories()) {
|
||||
for (SalarySobItemGroupDTO itemGroup : incomeCategory.getItemGroups()) {
|
||||
salarySobItems.addAll(itemGroup.getItems());
|
||||
}
|
||||
salarySobItems.addAll(incomeCategory.getItems());
|
||||
}
|
||||
for (SalarySobItemDTO salarySobItem : salarySobItems) {
|
||||
if (Objects.equals(salarySobItem.getValueType(), SalaryValueTypeEnum.FORMULA.getValue()) && salarySobItem.isCanEdit()) {
|
||||
salaryItemIds.add(salarySobItem.getSalaryItemId());
|
||||
}
|
||||
}
|
||||
// for (SalarySobItemDTO backCalcItem : salarySobItemAggregate.getBackCalcItems()) {
|
||||
// if (Objects.equals(backCalcItem.getValueType(), SalaryValueTypeEnum.FORMULA.getValue()) && backCalcItem.isCanEdit()) {
|
||||
// salaryItemIds.add(backCalcItem.getSalaryItemId());
|
||||
// }
|
||||
// }
|
||||
return salaryItemIds;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.engine.core.impl.Service;
|
|||
import com.engine.salary.biz.SalaryArchiveBiz;
|
||||
import com.engine.salary.biz.SalaryArchiveItemBiz;
|
||||
import com.engine.salary.biz.SalaryItemBiz;
|
||||
import com.engine.salary.constant.SalaryArchiveConstant;
|
||||
import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
||||
import com.engine.salary.entity.salaryarchive.dto.SalaryItemAdjustRecordListDTO;
|
||||
import com.engine.salary.entity.salaryarchive.param.*;
|
||||
|
|
@ -12,6 +13,7 @@ import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO;
|
|||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import com.engine.salary.enums.UserStatusEnum;
|
||||
import com.engine.salary.enums.salaryarchive.SalaryArchiveItemAdjustReasonEnum;
|
||||
import com.engine.salary.enums.salaryarchive.SalaryArchiveStatusEnum;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.service.SalaryArchiveItemService;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
|
|
@ -26,6 +28,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -57,8 +60,11 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi
|
|||
private List<SalaryArchiveItemPO> getIneffectiveSalaryItems(Long salaryArchiveId, List<Long> salaryItemIds) {
|
||||
// 没有薪资项目时,给个不存在的,否则加载所有不合理
|
||||
salaryItemIds = CollectionUtils.isEmpty(salaryItemIds) ? Collections.singletonList(0L) : salaryItemIds;
|
||||
ArrayList<Long> salaryArchiveIds = new ArrayList<>();
|
||||
salaryArchiveIds.add(salaryArchiveId);
|
||||
return salaryArchiveItemMapper.getIneffectiveSalaryItems(SalaryArchiveItemQueryParam.builder()
|
||||
.salaryArchiveId(salaryArchiveId)
|
||||
.salaryArchivesIds(salaryArchiveIds)
|
||||
.salaryItemIds(salaryItemIds)
|
||||
.effectiveTime(new Date()).build());
|
||||
}
|
||||
|
|
@ -74,6 +80,17 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi
|
|||
.effectiveTime(new Date()).build());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<SalaryArchiveItemPO> getSalaryItemsBySalaryArchiveIdAndItemIds(Long salaryArchiveId, List<Long> salaryItemIds) {
|
||||
// 没有薪资项目时,给个不存在的,否则加载所有不合理
|
||||
salaryItemIds = CollectionUtils.isEmpty(salaryItemIds) ? Collections.singletonList(0L) : salaryItemIds;
|
||||
return salaryArchiveItemMapper.getEffectiveSalaryItems(SalaryArchiveItemQueryParam.builder()
|
||||
.salaryArchiveId(salaryArchiveId)
|
||||
.salaryItemIds(salaryItemIds)
|
||||
.build());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前已生效 gt
|
||||
*
|
||||
|
|
@ -169,6 +186,99 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi
|
|||
return SalaryEntityUtil.group2Map(salaryArchiveItems, k -> k.getSalaryArchiveId() + "-" + k.getSalaryItemId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String editSingleSalaryItem(SalaryArchiveItemSaveParam salaryArchiveItemSaveParam) {
|
||||
// 检查参数
|
||||
SalaryArchiveItemSaveParam.checkParam(salaryArchiveItemSaveParam);
|
||||
|
||||
Long salaryArchiveId = salaryArchiveItemSaveParam.getSalaryArchiveId();
|
||||
// 获取所有可被引用的薪资项目
|
||||
List<SalaryItemPO> salaryItems = getCanAdjustSalaryItems();
|
||||
Map<Long, SalaryItemPO> salaryItemMap = SalaryEntityUtil.convert2Map(salaryItems, SalaryItemPO::getId);
|
||||
// 待处理薪资项目
|
||||
List<SalaryArchiveItemDetailSaveParam> salaryArchiveItems = salaryArchiveItemSaveParam.getSalaryArchiveItems().stream()
|
||||
.filter(e -> salaryItemMap.containsKey(e.getSalaryItemId()))
|
||||
.collect(Collectors.toList());
|
||||
List<Long> salaryItemIds = salaryArchiveItems.stream().map(SalaryArchiveItemDetailSaveParam::getSalaryItemId).collect(Collectors.toList());
|
||||
// 薪资档案
|
||||
SalaryArchivePO salaryArchive = salaryArchiveMapper.getById(salaryArchiveId);
|
||||
if (salaryArchive != null) {
|
||||
// 停薪列表禁止操作
|
||||
boolean isDisabled = salaryArchive.getRunStatus().equals(SalaryArchiveStatusEnum.STOP_FROM_PENDING.getValue()) ||
|
||||
salaryArchive.getRunStatus().equals(SalaryArchiveStatusEnum.STOP_FROM_SUSPEND.getValue());
|
||||
if (isDisabled) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(115437, "停薪列表禁止操作"));
|
||||
}
|
||||
SalaryArchiveItemPO salaryArchiveItem = null;
|
||||
if (salaryArchiveItemSaveParam.getSalaryArchiveItemId() != null ) {
|
||||
salaryArchiveItem = salaryArchiveItemMapper.getById(salaryArchiveItemSaveParam.getSalaryArchiveItemId());
|
||||
if (salaryArchiveItem == null || !salaryArchiveItem.getSalaryArchiveId().equals(salaryArchiveId)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100428, "该薪资档案的薪资项目的调整记录不存在"));
|
||||
}
|
||||
if (salaryArchiveItemSaveParam.getSalaryArchiveItems().size() > 1) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(149535, "单个调整不能处理多个薪资项目"));
|
||||
} else if (!salaryArchiveItems.get(0).getSalaryItemId().equals(salaryArchiveItem.getSalaryItemId())){
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel( 149539, "单个调薪的目标项目和调整明细项目id不一致"));
|
||||
}
|
||||
}
|
||||
// 构建更新PO
|
||||
SalaryArchiveItemPO updateSalaryArchiveItemPO = buildUpdateSalaryArchiveItemPO(salaryArchiveItemSaveParam,salaryArchiveItems,salaryItemIds,salaryArchiveItem);
|
||||
salaryArchiveItemMapper.updateIgnoreNull(updateSalaryArchiveItemPO);
|
||||
}
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 构建薪资档案中调薪的更新PO
|
||||
* @return null
|
||||
* @author Harryxzy
|
||||
* @date 2022/11/14 14:24
|
||||
*/
|
||||
private SalaryArchiveItemPO buildUpdateSalaryArchiveItemPO(SalaryArchiveItemSaveParam salaryArchiveItemSaveParam,List<SalaryArchiveItemDetailSaveParam> salaryArchiveItems,List<Long> salaryItemIds,SalaryArchiveItemPO salaryArchiveItem) {
|
||||
// 获取生效+未生效的数据
|
||||
List<SalaryArchiveItemPO> salaryItemsBySalaryArchiveIdAndItemIds = getSalaryItemsBySalaryArchiveIdAndItemIds(salaryArchiveItemSaveParam.getSalaryArchiveId(), salaryItemIds);
|
||||
// 获取当前已生效数据
|
||||
// List<SalaryArchiveItemPO> effectiveSalaryItems = getEffectiveSalaryItems(salaryArchiveItemSaveParam.getSalaryArchiveId(), salaryItemIds);
|
||||
// 待保存生效时间
|
||||
Date saveEffectiveTime = salaryArchiveItemSaveParam.getEffectiveTime();
|
||||
salaryArchiveItems.forEach(e -> {
|
||||
// 已生效
|
||||
// List<SalaryArchiveItemPO> effectiveList = effectiveSalaryItems.stream().filter(i -> i.getSalaryItemId().equals(e.getSalaryItemId())).collect(Collectors.toList());
|
||||
// 当前已生效
|
||||
// SalaryArchiveItemPO effectiveSalaryItem = CollectionUtils.isNotEmpty(effectiveList) && effectiveList.size() > 0 ? effectiveList.get(0) : null;
|
||||
List<SalaryArchiveItemPO> list = salaryItemsBySalaryArchiveIdAndItemIds.stream().filter(i -> i.getSalaryItemId().equals(e.getSalaryItemId())).collect(Collectors.toList());
|
||||
boolean isNotNumber = StringUtils.isNotEmpty(e.getAdjustValue()) && !Pattern.matches(SalaryArchiveConstant.NUMBER_REGEX, e.getAdjustValue());
|
||||
if (isNotNumber) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100581, "请输入数字"));
|
||||
}
|
||||
|
||||
// 修改了生效日期
|
||||
if(!salaryArchiveItemSaveParam.getEffectiveTime().equals(salaryArchiveItem.getEffectiveTime())){
|
||||
boolean isEffectiveTimeRepeat = list.stream().anyMatch(it -> it.getEffectiveTime().equals(saveEffectiveTime));
|
||||
if (isEffectiveTimeRepeat) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(153539, "已经存在该生效日期的调整记录,请修改生效日期"));
|
||||
}
|
||||
}
|
||||
|
||||
// 1.检验是否可以调整
|
||||
// if (effectiveSalaryItem != null) {
|
||||
// 当前已经生效的时间
|
||||
// Date effectiveTime = effectiveSalaryItem.getEffectiveTime();
|
||||
// 1.1 如果保存的生效日期早于<当前已生效
|
||||
// if (saveEffectiveTime.before(effectiveTime)) {
|
||||
// if(salaryArchiveItemSaveParam.getCanOperator() == Boolean.TRUE){
|
||||
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100429, "生效日期不可早于当前已生效的调整日期"));
|
||||
// }
|
||||
// // 仅可编辑说明
|
||||
// salaryArchiveItemMapper.updateIgnoreNull( SalaryArchiveItemPO.builder().id(salaryArchiveItemSaveParam.getSalaryArchiveItemId())
|
||||
// .description(salaryArchiveItemSaveParam.getDescription()).build());
|
||||
// }
|
||||
// }
|
||||
});
|
||||
return SalaryArchiveItemPO.builder().id(salaryArchiveItemSaveParam.getSalaryArchiveItemId()).effectiveTime(salaryArchiveItemSaveParam.getEffectiveTime()).adjustReason(salaryArchiveItemSaveParam.getAdjustReason())
|
||||
.description(salaryArchiveItemSaveParam.getDescription()).itemValue(salaryArchiveItemSaveParam.getSalaryArchiveItems().get(0).getAdjustValue()).build();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<SalaryArchiveItemPO> getCurrentEffectiveItemListIngoreValue(Collection<Long> salaryArchivesIds, List<Long> salaryItemIds) {
|
||||
|
|
@ -420,13 +530,13 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi
|
|||
if (salaryArchiveItem == null) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98299, "参数错误,薪资项目不存在或已被删除"));
|
||||
}
|
||||
if (salaryArchiveItem.getEffectiveTime().after(new Date())) {
|
||||
// if (salaryArchiveItem.getEffectiveTime().after(new Date())) {
|
||||
salaryArchiveItem.setDeleteType(1);
|
||||
// 删除未生效数据
|
||||
salaryArchiveItemMapper.updateById(salaryArchiveItem);
|
||||
} else {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98299, "该薪资项目已生效不可删除"));
|
||||
}
|
||||
// } else {
|
||||
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98299, "该薪资项目已生效不可删除"));
|
||||
// }
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
|
||||
@Override
|
||||
public List<SalarySobPO> listByAdmin() {
|
||||
List<SalarySobPO> salarySobPOS = salarySobMapper.listSome(SalarySobPO.builder().disable(NumberUtils.INTEGER_ZERO).build());
|
||||
List<SalarySobPO> salarySobPOS = salarySobMapper.listSome(SalarySobPO.builder().build());
|
||||
return filterByAdmin(salarySobPOS);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
package com.engine.salary.timer;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.salary.service.AddUpDeductionService;
|
||||
import com.engine.salary.service.impl.AddUpDeductionServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import weaver.hrm.User;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Slf4j
|
||||
public class AutoAddAllSpecialAddDeductionJob extends BaseCronJob {
|
||||
|
||||
private AddUpDeductionService getAddUpDeductionService(User user) {
|
||||
return ServiceUtil.getService(AddUpDeductionServiceImpl.class, user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
Date date = new Date();
|
||||
getAddUpDeductionService(null).autoAddAll(DateUtil.beginOfMonth(date), Boolean.TRUE);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.engine.salary.util;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.engine.salary.common.LocalDateRange;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
|
@ -528,6 +529,30 @@ public class SalaryDateUtil {
|
|||
return inDataRange;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换时间对象
|
||||
* @see SalaryDateUtil#toDate(LocalDateTime, String)
|
||||
* @param dateTime LocalDateTime
|
||||
* @return Date
|
||||
*/
|
||||
public static Date toDate(LocalDateTime dateTime) {
|
||||
return toDate(dateTime, null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 转换时间对象
|
||||
* @param dateTime LocalDateTime
|
||||
* @param offset 时区,e.g. +8
|
||||
* @return Date
|
||||
*/
|
||||
public static Date toDate(LocalDateTime dateTime, String offset) {
|
||||
if (dateTime == null) {
|
||||
return null;
|
||||
}
|
||||
ZoneId zoneOffset = StrUtil.isNotEmpty(offset) ? ZoneOffset.of(offset) : ZoneOffset.systemDefault();
|
||||
return Date.from(dateTime.atZone(zoneOffset).toInstant());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,10 +3,7 @@ package com.engine.salary.web;
|
|||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.salary.entity.datacollection.dto.OtherDeductionListDTO;
|
||||
import com.engine.salary.entity.datacollection.dto.OtherDeductionRecordDTO;
|
||||
import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordDeleteParam;
|
||||
import com.engine.salary.entity.datacollection.param.OtherDeductionImportParam;
|
||||
import com.engine.salary.entity.datacollection.param.OtherDeductionParam;
|
||||
import com.engine.salary.entity.datacollection.param.OtherDeductionQueryParam;
|
||||
import com.engine.salary.entity.datacollection.param.*;
|
||||
import com.engine.salary.util.ResponseResult;
|
||||
import com.engine.salary.util.SalaryDateUtil;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
|
|
@ -346,5 +343,12 @@ public class OtherDeductionController {
|
|||
return new ResponseResult<AddUpDeductionRecordDeleteParam, Map<String, Object>>(user).run(getOtherDeductionWrapper(user)::deleteAllData, otherDeductionDeleteParam);
|
||||
}
|
||||
|
||||
|
||||
@POST
|
||||
@Path("/extendToLastMonth")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String extendToLastMonth(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
||||
@RequestBody OtherDeductionExtendLastParam param) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<OtherDeductionExtendLastParam, String>(user).run(getOtherDeductionWrapper(user)::extendToLastMonth, param);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -360,7 +360,6 @@ public class SalaryAcctController {
|
|||
}
|
||||
|
||||
|
||||
|
||||
// **********************************薪资核算人员相关 end*********************************/
|
||||
|
||||
// **********************************薪资核算结果 start*********************************/
|
||||
|
|
@ -411,6 +410,16 @@ public class SalaryAcctController {
|
|||
return new ResponseResult<SalaryAcctResultSaveParam, String>(user).run(getSalaryAcctResultWrapper(user)::save, param);
|
||||
}
|
||||
|
||||
|
||||
//更新薪资核算结果的锁定状态
|
||||
@POST
|
||||
@Path("/acctresult/updateLockStatus")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String updateLockStatus(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryAcctResultUpdateLockStatusParam param) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<SalaryAcctResultUpdateLockStatusParam, String>(user).run(getSalaryAcctResultWrapper(user)::updateLockStatusByParam, param);
|
||||
}
|
||||
|
||||
//薪资核算
|
||||
@POST
|
||||
@Path("/acctresult/accounting")
|
||||
|
|
|
|||
|
|
@ -718,6 +718,36 @@ public class SalaryArchiveController {
|
|||
return new ResponseResult<SingleSalaryItemAdjustRecordQueryParam, PageInfo<SingleSalaryItemAdjustRecordListDTO>>(user).run(getSalaryArchiveItemWrapper(user)::singleSalaryItemAdjustRecordList, queryParam);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 编辑前获取薪资项目调整信息
|
||||
* @return String
|
||||
* @author Harryxzy
|
||||
* @date 2022/11/15 9:25
|
||||
*/
|
||||
@POST
|
||||
@Path("/adjustRecord/getSingleSalaryItemInfo")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getSingleSalaryItemInfo(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SingleSalaryItemAdjustRecordListDTO queryParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<SingleSalaryItemAdjustRecordListDTO, SalaryArchiveItemFormDTO>(user).run(getSalaryArchiveItemWrapper(user)::getSingleSalaryItemInfo, queryParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 单个档案的薪资项目调整的编辑
|
||||
* @return String
|
||||
* @author Harryxzy
|
||||
* @date 2022/11/11 13:50
|
||||
*/
|
||||
@POST
|
||||
@Path("/adjustRecord/editSingleSalaryItem")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String editSingleSalaryItem(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryArchiveItemSaveParam updateParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<SalaryArchiveItemSaveParam, String>(user).run(getSalaryArchiveItemWrapper(user)::editSingleSalaryItem, updateParam);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出薪资项目调整记录列表
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -177,6 +177,6 @@ public class AddUpDeductionWrapper extends Service {
|
|||
if (yearMonth == null) {
|
||||
throw new SalaryRunTimeException("一键累计传入日期格式错误");
|
||||
}
|
||||
return getAddUpDeductionService(user).autoAddAll(yearMonth);
|
||||
return getAddUpDeductionService(user).autoAddAll(yearMonth, null);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,10 +8,7 @@ import com.engine.common.util.ServiceUtil;
|
|||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.entity.datacollection.dto.OtherDeductionListDTO;
|
||||
import com.engine.salary.entity.datacollection.dto.OtherDeductionRecordDTO;
|
||||
import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordDeleteParam;
|
||||
import com.engine.salary.entity.datacollection.param.OtherDeductionImportParam;
|
||||
import com.engine.salary.entity.datacollection.param.OtherDeductionParam;
|
||||
import com.engine.salary.entity.datacollection.param.OtherDeductionQueryParam;
|
||||
import com.engine.salary.entity.datacollection.param.*;
|
||||
import com.engine.salary.entity.datacollection.po.OtherDeductionPO;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.service.OtherDeductionService;
|
||||
|
|
@ -22,9 +19,14 @@ import com.engine.salary.service.impl.SalaryEmployeeServiceImpl;
|
|||
import com.engine.salary.service.impl.TaxAgentServiceImpl;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.Month;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
|
@ -35,16 +37,20 @@ import java.util.Map;
|
|||
* @Author: wangxiangzhong
|
||||
* @Date: 2022/3/14 16:09
|
||||
*/
|
||||
@Slf4j
|
||||
public class OtherDeductionWrapper extends Service {
|
||||
private OtherDeductionService getOtherDeductionService(User user) {
|
||||
return ServiceUtil.getService(OtherDeductionServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private TaxAgentService getTaxAgentV2Service(User user) {
|
||||
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryEmployeeService getSalaryEmployeeService(User user) {
|
||||
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据采集-其他免税扣除列表的高级搜索
|
||||
*
|
||||
|
|
@ -178,7 +184,7 @@ public class OtherDeductionWrapper extends Service {
|
|||
Long id = queryParam.getOtherTaxExemptDeductionId();
|
||||
OtherDeductionPO po = getOtherDeductionService(user).getById(id);
|
||||
if (po == null) {
|
||||
throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel( 100415, "其他免税扣除不存在") + "[id:%s]", id));
|
||||
throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel(100415, "其他免税扣除不存在") + "[id:%s]", id));
|
||||
}
|
||||
return getOtherDeductionService(user).exportDetail(queryParam);
|
||||
}
|
||||
|
|
@ -196,14 +202,14 @@ public class OtherDeductionWrapper extends Service {
|
|||
/**
|
||||
* 预览
|
||||
*/
|
||||
public Map<String, Object> preview(OtherDeductionImportParam importParam){
|
||||
public Map<String, Object> preview(OtherDeductionImportParam importParam) {
|
||||
return getOtherDeductionService(user).preview(importParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
public Map<String, Object> importData(OtherDeductionImportParam importParam){
|
||||
public Map<String, Object> importData(OtherDeductionImportParam importParam) {
|
||||
return getOtherDeductionService(user).importData(importParam);
|
||||
}
|
||||
|
||||
|
|
@ -242,4 +248,23 @@ public class OtherDeductionWrapper extends Service {
|
|||
public OtherDeductionRecordDTO getOtherDeduction(OtherDeductionParam otherDeductionParam) {
|
||||
return getOtherDeductionService(user).getOtherDeduction(otherDeductionParam);
|
||||
}
|
||||
|
||||
public String extendToLastMonth(OtherDeductionExtendLastParam param) {
|
||||
LocalDateTime localDate = null;
|
||||
try {
|
||||
localDate = LocalDate.parse(param.getDeclareMonth() + "-01",
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd")).atStartOfDay();
|
||||
param.setYearMonthTime(localDate);
|
||||
} catch (Exception e) {
|
||||
log.error("", e);
|
||||
}
|
||||
if (null == param.getDeclareMonth() || null == localDate || null == param.getYearMonthTime()) {
|
||||
throw new SalaryRunTimeException("当前年月不合法");
|
||||
}
|
||||
if (Month.JANUARY.equals(localDate.getMonth())) {
|
||||
throw new SalaryRunTimeException("操作失败,每年度内首月无法沿用上月");
|
||||
}
|
||||
param.setYearMonthTime(localDate);
|
||||
return getOtherDeductionService(user).extendToLastMonth(param);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import com.engine.salary.entity.salaryacct.dto.SalaryAcctResultListColumnDTO;
|
|||
import com.engine.salary.entity.salaryacct.param.SalaryAcctCalculateParam;
|
||||
import com.engine.salary.entity.salaryacct.param.SalaryAcctResultQueryParam;
|
||||
import com.engine.salary.entity.salaryacct.param.SalaryAcctResultSaveParam;
|
||||
import com.engine.salary.entity.salaryacct.param.SalaryAcctResultUpdateLockStatusParam;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.service.*;
|
||||
|
|
@ -142,31 +143,6 @@ public class SalaryAcctResultWrapper extends Service {
|
|||
return datas;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取薪资核算列表的高级搜索
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
// public WeaSearchCondition getSearchCondition(String tenantKey) {
|
||||
// SalaryAcctResultSearchConditionDTO searchConditionDTO = new SalaryAcctResultSearchConditionDTO();
|
||||
// WeaSearchCondition searchCondition = SalaryFormatUtil.<SalaryAcctResultSearchConditionDTO>getInstance()
|
||||
// .buildCondition(SalaryAcctResultSearchConditionDTO.class, searchConditionDTO, "SalaryAcctResultCondition");
|
||||
// // 查询个税扣缴义务人
|
||||
// List<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAll(tenantKey);
|
||||
// List<WeaSearchConditionOption> weaSearchConditionOptions = taxAgentPOS.stream()
|
||||
// .map(taxAgentPO -> new WeaSearchConditionOption(String.valueOf(taxAgentPO.getId()), taxAgentPO.getName()))
|
||||
// .collect(Collectors.toList());
|
||||
// // 给查询条件中的个税扣缴义务人填充下拉项
|
||||
// searchCondition.getItems().forEach((k, v) -> {
|
||||
// if (StringUtils.equals("taxAgentId", k)) {
|
||||
// v.setOptions(weaSearchConditionOptions);
|
||||
// }
|
||||
// });
|
||||
// // 其他条件不要
|
||||
// searchCondition.getGroups().remove(1);
|
||||
// return searchCondition;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 薪资核算结果详情
|
||||
*
|
||||
|
|
@ -208,6 +184,15 @@ public class SalaryAcctResultWrapper extends Service {
|
|||
getSalaryAcctResultService(user).save(saveParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新薪资核算结果的值的锁定状态
|
||||
*
|
||||
* @param updateParam
|
||||
*/
|
||||
public void updateLockStatusByParam(SalaryAcctResultUpdateLockStatusParam updateParam) {
|
||||
getSalaryAcctResultService(user).updateLockStatusByParam(updateParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 薪资核算-核算
|
||||
*
|
||||
|
|
|
|||
|
|
@ -280,6 +280,17 @@ public class SalaryArchiveItemWrapper extends Service implements SalaryArchiveIt
|
|||
return listPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 单个档案的薪资项目调整的编辑
|
||||
* @return void
|
||||
* @author Harryxzy
|
||||
* @date 2022/11/14 11:46
|
||||
*/
|
||||
@Override
|
||||
public String editSingleSalaryItem(SalaryArchiveItemSaveParam salaryArchiveItemSaveParam) {
|
||||
return getSalaryArchiveItemService(user).editSingleSalaryItem(salaryArchiveItemSaveParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出薪资项目调整记录列表
|
||||
*
|
||||
|
|
@ -291,4 +302,73 @@ public class SalaryArchiveItemWrapper extends Service implements SalaryArchiveIt
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 获取单个档案的单个薪资项目调整信息
|
||||
* @return void
|
||||
* @author Harryxzy
|
||||
* @date 2022/11/11 14:39
|
||||
*/
|
||||
public SalaryArchiveItemFormDTO getSingleSalaryItemInfo(SingleSalaryItemAdjustRecordListDTO queryParam) {
|
||||
SalaryArchiveItemPO byId = getSalaryArchiveItemService(user).getById(queryParam.getId());
|
||||
if(Objects.isNull(byId)){
|
||||
throw new SalaryRunTimeException("该薪资项目调整信息不存在");
|
||||
}
|
||||
// 获取所有可被引用的薪资项目
|
||||
List<SalaryItemPO> salaryItemList = getSalaryArchiveItemService(user).getCanAdjustSalaryItems();
|
||||
List<Long> salaryItemIds = salaryItemList.stream().map(SalaryItemPO::getId).collect(Collectors.toList());
|
||||
//所有调整记录
|
||||
List<SalaryItemAdjustRecordListDTO> listAll = getSalaryArchiveItemService(user).salaryItemAdjustRecordList(SalaryItemAdjustRecordQueryParam.builder().build(), salaryItemIds);
|
||||
|
||||
//根据条件查询调整记录
|
||||
List<SalaryItemAdjustRecordListDTO> adjustPageList = getSalaryArchiveItemService(user).salaryItemAdjustRecordList(SalaryItemAdjustRecordQueryParam.builder().salaryArchiveId(byId.getSalaryArchiveId()).build(), salaryItemIds);
|
||||
|
||||
List<SingleSalaryItemAdjustRecordListDTO> resultList = Lists.newArrayList();
|
||||
adjustPageList.forEach(m -> {
|
||||
if (CollectionUtils.isNotEmpty(listAll)) {
|
||||
listAll.removeIf(a -> a.getId().equals(m.getId()));
|
||||
}
|
||||
Optional<SalaryItemAdjustRecordListDTO> optional = listAll.stream().filter(f -> f.getSalaryArchiveId().equals(m.getSalaryArchiveId()) && f.getSalaryItemId().equals(m.getSalaryItemId())).findFirst();
|
||||
m.setAdjustBefore(optional.isPresent() ? optional.get().getAdjustAfter() : "");
|
||||
|
||||
m.setAdjustReason(SalaryArchiveItemAdjustReasonEnum.getDefaultLabelByValue(m.getAdjustReason()));
|
||||
|
||||
SingleSalaryItemAdjustRecordListDTO singleSalaryItemAdjustRecordList = new SingleSalaryItemAdjustRecordListDTO();
|
||||
BeanUtils.copyProperties(m, singleSalaryItemAdjustRecordList);
|
||||
resultList.add(singleSalaryItemAdjustRecordList);
|
||||
});
|
||||
|
||||
List<Long> salaryItemPageIds = resultList.stream().map(SingleSalaryItemAdjustRecordListDTO::getSalaryItemId).collect(Collectors.toList());
|
||||
List<SalaryArchiveItemPO> effectiveSalaryItems = getSalaryArchiveItemService(user).getEffectiveSalaryItems(byId.getSalaryArchiveId(), salaryItemPageIds);
|
||||
// 行记录按钮权限控制
|
||||
for (int i = 0; i < resultList.size(); i++) {
|
||||
SingleSalaryItemAdjustRecordListDTO singleSalaryItemAdjustRecord = resultList.get(i);
|
||||
if(singleSalaryItemAdjustRecord.getId().equals(queryParam.getId())){
|
||||
// Optional<SalaryArchiveItemPO> optional = effectiveSalaryItems.stream().filter(f -> f.getSalaryItemId().equals(singleSalaryItemAdjustRecord.getSalaryItemId())).findFirst();
|
||||
// Date effectiveDate = optional.map(SalaryArchiveItemPO::getEffectiveTime).orElse(null);
|
||||
// if (effectiveDate != null && singleSalaryItemAdjustRecord.getEffectiveTime().before(effectiveDate)) {
|
||||
// singleSalaryItemAdjustRecord.setCanOperator(Boolean.FALSE);
|
||||
// } else {
|
||||
// singleSalaryItemAdjustRecord.setCanOperator(Boolean.TRUE);
|
||||
// }
|
||||
singleSalaryItemAdjustRecord.setCanOperator(Boolean.TRUE);
|
||||
Map<String, Object> map = new HashMap<>(3);
|
||||
map.put("salaryItem", String.valueOf(singleSalaryItemAdjustRecord.getSalaryItemId()));
|
||||
map.put("salaryBefore", singleSalaryItemAdjustRecord.getAdjustBefore());
|
||||
map.put("adjustAfter", singleSalaryItemAdjustRecord.getAdjustAfter());
|
||||
|
||||
// 调整明细数据
|
||||
List<Map<String, Object>> tableData = Lists.newArrayList();
|
||||
tableData.add(map);
|
||||
|
||||
return SalaryArchiveItemFormDTO.builder()
|
||||
.canOperator(singleSalaryItemAdjustRecord.getCanOperator())
|
||||
.salaryArchiveId(byId.getSalaryArchiveId())
|
||||
.salaryArchiveItemForm(buildSalaryArchiveItemForm(byId.getEffectiveTime(), byId.getAdjustReason(), byId.getDescription()))
|
||||
.salaryArchiveItemDetail(buildSalaryArchiveItemAdjustDetailTable(tableData))
|
||||
.build();
|
||||
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,4 +55,13 @@ public interface SalaryArchiveItemWrapperProxy {
|
|||
PageInfo<SingleSalaryItemAdjustRecordListDTO> singleSalaryItemAdjustRecordList(SingleSalaryItemAdjustRecordQueryParam queryParam);
|
||||
|
||||
|
||||
SalaryArchiveItemFormDTO getSingleSalaryItemInfo(SingleSalaryItemAdjustRecordListDTO queryParam);
|
||||
|
||||
/**
|
||||
* @description 单个档案的薪资项目调整的编辑
|
||||
* @return void
|
||||
* @author Harryxzy
|
||||
* @date 2022/11/14 11:45
|
||||
*/
|
||||
String editSingleSalaryItem(SalaryArchiveItemSaveParam salaryArchiveItemSaveParam);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue