1、核算账套增加多选框,选择多个账套后批量发起核算;
2、核算记录下核算状态,显示在核算列表中。核算中,核算完成; 3、全部核算完成后,提醒当前操作人员薪资数据全部核算完成;
This commit is contained in:
parent
5a0ef67816
commit
a96a19b07f
|
|
@ -0,0 +1 @@
|
|||
messageType=s298S6Yc
|
||||
|
|
@ -106,6 +106,7 @@ public class SalaryAcctRecordBO {
|
|||
.updateTime(SalaryDateUtil.getFormatLocalDateTime(salaryAcctRecordPO.getUpdateTime()))
|
||||
.description(salaryAcctRecordPO.getDescription())
|
||||
.approvalStatus(salaryAcctRecordPO.getApprovalStatus())
|
||||
.runStatus(salaryAcctRecordPO.getRunStatus())
|
||||
.operate(btnList)
|
||||
.build();
|
||||
}).collect(Collectors.toList());
|
||||
|
|
@ -136,6 +137,7 @@ public class SalaryAcctRecordBO {
|
|||
.setCreator(employeeId)
|
||||
.setCreateTime(now)
|
||||
.setUpdateTime(now)
|
||||
.setRunStatus("核算中")
|
||||
.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,6 +76,9 @@ public class SalaryAcctRecordListDTO {
|
|||
@TableTitle(title = "审批状态", dataIndex = "approvalStatus", key = "approvalStatus")
|
||||
private String approvalStatus;
|
||||
|
||||
@TableTitle(title = "执行状态", dataIndex = "runStatus", key = "runStatus")
|
||||
private String runStatus;
|
||||
|
||||
@TableTitle(title = "操作", dataIndex = "operate", key = "operate")
|
||||
private List<WeaTableOperate> operate;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
package com.engine.salary.entity.salaryacct.param;
|
||||
|
||||
import com.engine.salary.util.valid.DataCheck;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.YearMonth;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 薪资核算基本信息保存参数
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
//薪资核算基本信息保存参数
|
||||
public class SalaryAcctRecordBatchSaveParam {
|
||||
|
||||
//薪资所属月
|
||||
@DataCheck(require = true, message = "薪资所属月格式错误")
|
||||
private YearMonth salaryMonth;
|
||||
|
||||
private String salaryMonthStr;
|
||||
|
||||
//薪资账套id
|
||||
private List<Long> salarySobIds;
|
||||
|
||||
//备注
|
||||
@DataCheck(max = 80, message = "备注不能超过80个字符")
|
||||
private String description;
|
||||
}
|
||||
|
|
@ -131,6 +131,11 @@ public class SalaryAcctRecordPO {
|
|||
*/
|
||||
private String approvalStatus;
|
||||
|
||||
/**
|
||||
* 二开,核算状态:核算中,核算完成
|
||||
*/
|
||||
private String runStatus;
|
||||
|
||||
/**
|
||||
* 锁定的薪资项目
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -80,5 +80,5 @@ public interface SalaryAcctRecordMapper {
|
|||
|
||||
List<SalaryAcctRecordPO> getBackCalcRecordByIds(@Param("collection") Set<Long> salaryAcctIds);
|
||||
|
||||
void updateDate(@Param("id")Long id, @Param("updateTime")Date updateTime);
|
||||
void updateDate(@Param("id")Long id, @Param("updateTime")Date updateTime,@Param("runStatus")String runStatus);
|
||||
}
|
||||
|
|
@ -16,6 +16,7 @@
|
|||
<result column="tenant_key" property="tenantKey"/>
|
||||
<result column="back_calc_status" property="backCalcStatus"/>
|
||||
<result column="lock_salary_item_ids" property="lockSalaryItemIds" typeHandler="com.engine.salary.handle.SalaryListTypeHandler"/>
|
||||
<result column="run_status" property="runStatus"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 表字段 -->
|
||||
|
|
@ -38,6 +39,7 @@
|
|||
, t.lock_salary_item_ids
|
||||
, t.approval_status
|
||||
, t.approval_id
|
||||
, t.run_status
|
||||
</sql>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
|
|
@ -203,6 +205,9 @@
|
|||
<if test="tenantKey != null">
|
||||
tenant_key,
|
||||
</if>
|
||||
<if test="runStatus != null">
|
||||
run_status,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
|
|
@ -241,6 +246,9 @@
|
|||
<if test="tenantKey != null">
|
||||
#{tenantKey},
|
||||
</if>
|
||||
<if test="runStatus != null">
|
||||
#{runStatus},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
|
@ -286,8 +294,8 @@
|
|||
<if test="deleteType != null">
|
||||
delete_type,
|
||||
</if>
|
||||
<if test="tenantKey != null">
|
||||
tenant_key,
|
||||
<if test="runStatus != null">
|
||||
run_status,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
|
|
@ -327,6 +335,9 @@
|
|||
<if test="tenantKey != null">
|
||||
#{tenantKey},
|
||||
</if>
|
||||
<if test="runStatus != null">
|
||||
#{runStatus},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
|
@ -345,6 +356,7 @@
|
|||
update_time=#{updateTime},
|
||||
delete_type=#{deleteType},
|
||||
tenant_key=#{tenantKey},
|
||||
run_status=#{runStatus},
|
||||
</set>
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</update>
|
||||
|
|
@ -396,6 +408,9 @@
|
|||
<if test="approvalStatus != null">
|
||||
approval_status=#{approvalStatus},
|
||||
</if>
|
||||
<if test="runStatus != null">
|
||||
run_status=#{runStatus},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</update>
|
||||
|
|
@ -432,7 +447,8 @@
|
|||
|
||||
<update id="updateDate">
|
||||
UPDATE hrsa_salary_acct_record
|
||||
SET update_time=#{updateTime}
|
||||
SET update_time=#{updateTime},
|
||||
run_status=#{runStatus}
|
||||
WHERE delete_type = 0
|
||||
AND id = #{id}
|
||||
</update>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.engine.salary.service;
|
||||
|
||||
import com.engine.salary.common.LocalDateRange;
|
||||
import com.engine.salary.entity.salaryacct.param.SalaryAcctRecordBatchSaveParam;
|
||||
import com.engine.salary.entity.salaryacct.param.SalaryAcctRecordQueryParam;
|
||||
import com.engine.salary.entity.salaryacct.param.SalaryAcctRecordSaveParam;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
|
||||
|
|
@ -123,6 +124,7 @@ public interface SalaryAcctRecordService {
|
|||
* @return
|
||||
*/
|
||||
Long save(SalaryAcctRecordSaveParam saveParam);
|
||||
List<Long> batchSave(SalaryAcctRecordBatchSaveParam saveParam);
|
||||
|
||||
/**
|
||||
* 更新薪资核算记录的状态
|
||||
|
|
@ -209,5 +211,5 @@ public interface SalaryAcctRecordService {
|
|||
|
||||
List<SalaryAcctRecordPO> listSome(SalaryAcctRecordPO po);
|
||||
|
||||
void updateDate(Long id, Date updateTime);
|
||||
void updateDate(Long id, Date updateTime,String runStatus);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,11 +3,12 @@ package com.engine.salary.service.impl;
|
|||
import com.api.formmode.mybatis.util.SqlProxyHandle;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.hrmelog.entity.dto.LoggerContext;
|
||||
import com.engine.salary.common.LocalDateRange;
|
||||
import com.engine.salary.config.SalaryElogConfig;
|
||||
import com.engine.hrmelog.entity.dto.LoggerContext;
|
||||
import com.engine.salary.entity.salaryBill.po.SalarySendPO;
|
||||
import com.engine.salary.entity.salaryacct.bo.SalaryAcctRecordBO;
|
||||
import com.engine.salary.entity.salaryacct.param.SalaryAcctRecordBatchSaveParam;
|
||||
import com.engine.salary.entity.salaryacct.param.SalaryAcctRecordQueryParam;
|
||||
import com.engine.salary.entity.salaryacct.param.SalaryAcctRecordSaveParam;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
|
||||
|
|
@ -312,6 +313,11 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
|
|||
return salaryAcctRecordPO.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> batchSave(SalaryAcctRecordBatchSaveParam saveParam) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存之前检查一下是否可以新建核算
|
||||
|
|
@ -826,7 +832,7 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateDate(Long id, Date updateTime) {
|
||||
getSalaryAcctRecordMapper().updateDate(id,updateTime);
|
||||
public void updateDate(Long id, Date updateTime,String runStatus) {
|
||||
getSalaryAcctRecordMapper().updateDate(id,updateTime,runStatus);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -193,6 +193,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
private VariableItemService getVariableItemService(User user) {
|
||||
return ServiceUtil.getService(VariableItemServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryApprovalRuleService getSalaryApprovalRuleService(User user) {
|
||||
return ServiceUtil.getService(SalaryApprovalRuleServiceImpl.class, user);
|
||||
}
|
||||
|
|
@ -918,7 +919,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
getSalaryAcctProgressService(user).finish(SalaryCacheKey.ACCT_PROGRESS + calculateParam.getSalaryAcctRecordId(), true);
|
||||
|
||||
//更新薪资核算记录最后操作日期
|
||||
getSalaryAcctRecordService(user).updateDate(salaryAcctRecordPO.getId(),new Date());
|
||||
getSalaryAcctRecordService(user).updateDate(salaryAcctRecordPO.getId(), new Date(), "核算完成");
|
||||
|
||||
stopWatch.stop();
|
||||
log.info(stopWatch.prettyPrint());
|
||||
|
|
|
|||
|
|
@ -113,6 +113,17 @@ public class SalaryAcctController {
|
|||
return new ResponseResult<SalaryAcctRecordSaveParam, Long>(user).run(getSalaryAcctRecordWrapper(user)::save, param);
|
||||
}
|
||||
|
||||
|
||||
//批量保存并核算
|
||||
@POST
|
||||
@Path("/batch/basic/save")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String batchSave(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryAcctRecordBatchSaveParam param) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
param.setSalaryMonth(SalaryDateUtil.String2YearMonth(param.getSalaryMonthStr()));
|
||||
return new ResponseResult<SalaryAcctRecordBatchSaveParam, List<Long>>(user).run(getSalaryAcctRecordWrapper(user)::batchSave, param);
|
||||
}
|
||||
|
||||
//删除薪资核算记录
|
||||
@POST
|
||||
@Path("/delete")
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
package com.engine.salary.wrapper;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.cloudstore.dev.api.bean.MessageBean;
|
||||
import com.cloudstore.dev.api.bean.MessageType;
|
||||
import com.cloudstore.dev.api.util.Util_Message;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.cache.SalaryCacheKey;
|
||||
|
|
@ -10,12 +14,13 @@ import com.engine.salary.entity.salaryacct.bo.SalaryAcctRecordBO;
|
|||
import com.engine.salary.entity.salaryacct.dto.SalaryAcctEmployeeCountDTO;
|
||||
import com.engine.salary.entity.salaryacct.dto.SalaryAcctRecordFormDTO;
|
||||
import com.engine.salary.entity.salaryacct.dto.SalaryAcctRecordListDTO;
|
||||
import com.engine.salary.entity.salaryacct.param.SalaryAcctCalculateParam;
|
||||
import com.engine.salary.entity.salaryacct.param.SalaryAcctRecordBatchSaveParam;
|
||||
import com.engine.salary.entity.salaryacct.param.SalaryAcctRecordQueryParam;
|
||||
import com.engine.salary.entity.salaryacct.param.SalaryAcctRecordSaveParam;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctSobConfigPO;
|
||||
import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO;
|
||||
import com.engine.salary.entity.salarysob.po.SalaryApprovalRulePO;
|
||||
import com.engine.salary.entity.salarysob.po.*;
|
||||
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
|
||||
import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum;
|
||||
|
|
@ -34,11 +39,14 @@ import com.engine.salary.util.page.Column;
|
|||
import com.engine.salary.util.page.PageInfo;
|
||||
import com.engine.salary.util.valid.ValidUtil;
|
||||
import com.engine.salary.wrapper.proxy.SalaryAcctRecordWrapperProxy;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -50,6 +58,7 @@ import java.util.stream.Collectors;
|
|||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Slf4j
|
||||
public class SalaryAcctRecordWrapper extends Service implements SalaryAcctRecordWrapperProxy {
|
||||
|
||||
private SalaryAcctRecordService getSalaryAcctRecordService(User user) {
|
||||
|
|
@ -97,6 +106,10 @@ public class SalaryAcctRecordWrapper extends Service implements SalaryAcctRecord
|
|||
return ServiceUtil.getService(SalarySysConfServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryAcctResultWrapper getSalaryAcctResultWrapper(User user) {
|
||||
return ServiceUtil.getService(SalaryAcctResultWrapper.class, user);
|
||||
}
|
||||
|
||||
// private ComInfoCache comInfoCache;
|
||||
|
||||
public PageInfo<SalaryAcctRecordListDTO> listPage(SalaryAcctRecordQueryParam queryParam) {
|
||||
|
|
@ -270,6 +283,63 @@ public class SalaryAcctRecordWrapper extends Service implements SalaryAcctRecord
|
|||
return getSalaryAcctRecordService(user).save(saveParam);
|
||||
}
|
||||
|
||||
public List<Long> batchSave(SalaryAcctRecordBatchSaveParam saveParam) {
|
||||
|
||||
List<Long> ids = saveParam.getSalarySobIds().stream().map(salarySobId -> {
|
||||
SalaryAcctRecordSaveParam build = SalaryAcctRecordSaveParam.builder()
|
||||
.salarySobId(salarySobId)
|
||||
.salaryMonth(saveParam.getSalaryMonth())
|
||||
.description(saveParam.getDescription())
|
||||
.build();
|
||||
return save(build);
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
ids.forEach(salaryAcctRecordId -> {
|
||||
getSalaryAcctResultWrapper(user).calculate(SalaryAcctCalculateParam.builder().salaryAcctRecordId(salaryAcctRecordId).build());
|
||||
});
|
||||
|
||||
//核算完毕给出提醒
|
||||
new Thread() {
|
||||
public void run() {
|
||||
boolean b = sendMsg(ids);
|
||||
while (b) {
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
b = sendMsg(ids);
|
||||
} catch (InterruptedException e) {
|
||||
log.error("核算完毕提醒异常", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
|
||||
return ids;
|
||||
}
|
||||
|
||||
private boolean sendMsg(List<Long> ids) {
|
||||
String id = CollUtil.join(ids, ",");
|
||||
List<SalaryAcctRecordPO> salaryAcctRecordPOS = getSalaryAcctRecordService(user).listByIds(ids);
|
||||
boolean running = salaryAcctRecordPOS.stream().anyMatch(salaryAcctRecordPO -> "核算中".equals(salaryAcctRecordPO.getRunStatus()));
|
||||
if (!running) {
|
||||
String messageTypeTargetId = new BaseBean().getPropValue("hrmSalaryCustom", "messageType");
|
||||
MessageType messageType = MessageType.newInstance(Integer.parseInt(messageTypeTargetId)); // 消息来源(见文档第四点补充 必填)
|
||||
Set<String> userIdList = new HashSet<>(); // 接收人id 必填
|
||||
userIdList.add(user.getUID() + "");
|
||||
String title = "薪资核算完毕,请前往【薪资核算】查看"; // 标题
|
||||
String context = "点击查看详情"; // 内容
|
||||
try {
|
||||
MessageBean messageBean = Util_Message.createMessage(messageType, userIdList, title, context, "", "");
|
||||
messageBean.setCreater(user.getUID());// 创建人id
|
||||
messageBean.setBizState("0");// 需要修改消息为已处理等状态时传入,表示消息最初状态为待处理
|
||||
messageBean.setTargetId(messageTypeTargetId + "|" + id); //消息来源code +“|”+业务id需要修改消息为已处理等状态时传入
|
||||
Util_Message.store(messageBean);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return running;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue