This commit is contained in:
@@ -0,0 +1,278 @@
|
||||
package jnpf.workflow.controller;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import jnpf.base.ActionResult;
|
||||
import jnpf.constant.MsgCode;
|
||||
import jnpf.engine.enums.FlowStatusEnum;
|
||||
import jnpf.entity.workflow.ApplyAttendanceChange;
|
||||
import jnpf.entity.workflow.ApplyAttendanceOutside;
|
||||
import jnpf.entity.workflow.ApplyAttendanceRepair;
|
||||
import jnpf.enums.personnel.FtbPersonnelsCheckStatusCodeEnum;
|
||||
import jnpf.model.workflow.dto.ApplyAttendanceChangeDto;
|
||||
import jnpf.model.workflow.dto.ApplyAttendanceOutsideDto;
|
||||
import jnpf.model.workflow.dto.ApplyAttendanceRepairDto;
|
||||
import jnpf.model.workflow.dto.ApplyAttendanceViolationDto;
|
||||
import jnpf.model.workflow.vo.ApplyAttendanceChangeVo;
|
||||
import jnpf.model.workflow.vo.ApplyAttendanceOutsideVo;
|
||||
import jnpf.model.workflow.vo.ApplyAttendanceRepairVo;
|
||||
import jnpf.model.workflow.vo.ClockKindVo;
|
||||
import jnpf.util.ConstantUtil;
|
||||
import jnpf.util.JsonUtil;
|
||||
import jnpf.util.StringUtil;
|
||||
import jnpf.workflow.service.ApplyAttendanceChangeService;
|
||||
import jnpf.workflow.service.ApplyAttendanceOutsideService;
|
||||
import jnpf.workflow.service.ApplyAttendanceRepairService;
|
||||
import jnpf.workflow.service.ApplyAttendanceViolationService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 打卡申请控制器
|
||||
*
|
||||
* @author yanwenfu
|
||||
* @create 2023-12-11
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping(value = "/apply")
|
||||
public class ApplyClockInController {
|
||||
|
||||
@Resource
|
||||
private ApplyAttendanceChangeService applyAttendanceChangeService;
|
||||
|
||||
@Resource
|
||||
private ApplyAttendanceRepairService applyAttendanceRepairService;
|
||||
|
||||
@Resource
|
||||
private ApplyAttendanceOutsideService applyAttendanceOutsideService;
|
||||
|
||||
@Resource
|
||||
private ApplyAttendanceViolationService applyAttendanceViolationService;
|
||||
|
||||
/**
|
||||
* 查询审批记录
|
||||
* @param id 审批id
|
||||
* @return jnpf.base.ActionResult<jnpf.model.workflow.vo.ApplyAttendanceChangeVo>
|
||||
*/
|
||||
@GetMapping(value = "/clockIn/{id}")
|
||||
public ActionResult<ApplyAttendanceChangeVo> getApplyAttendanceChange(@PathVariable(value = "id") String id) {
|
||||
|
||||
ApplyAttendanceChangeVo vo = applyAttendanceChangeService.getApplyAttendanceChange(id);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新建考勤变更申请
|
||||
* @param applyAttendanceChangeDto 表单对象
|
||||
* @return java.lang.Object
|
||||
*/
|
||||
@PostMapping("/clockIn")
|
||||
public Object create(@RequestBody @Valid ApplyAttendanceChangeDto applyAttendanceChangeDto) {
|
||||
|
||||
log.error("出勤变更发起 -> {}", JSONUtil.toJsonStr(applyAttendanceChangeDto));
|
||||
ActionResult<Void> actionResult = new ActionResult<>();
|
||||
try {
|
||||
// 解析 changeData
|
||||
if (null == applyAttendanceChangeDto.getChangeData() || applyAttendanceChangeDto.getChangeData().length != 2) {
|
||||
throw new Exception("变更类型异常");
|
||||
}
|
||||
applyAttendanceChangeDto.setChangeType(Integer.parseInt(applyAttendanceChangeDto.getChangeData()[0]));
|
||||
applyAttendanceChangeDto.setChangeMinute(Integer.parseInt(applyAttendanceChangeDto.getChangeData()[1]));
|
||||
ApplyAttendanceChange entity = JsonUtil.getJsonToBean(applyAttendanceChangeDto, ApplyAttendanceChange.class);
|
||||
entity.setStatus(ConstantUtil.STATUS_PENDING_APPROVAL);
|
||||
applyAttendanceChangeService.save(entity, applyAttendanceChangeDto);
|
||||
} catch (Exception e) {
|
||||
actionResult.setCode(FtbPersonnelsCheckStatusCodeEnum.CHECK_REFUSE.getCode());
|
||||
actionResult.setMsg(e.getMessage());
|
||||
return actionResult;
|
||||
}
|
||||
actionResult.setCode(FtbPersonnelsCheckStatusCodeEnum.CHECK_PASS.getCode());
|
||||
actionResult.setMsg(FtbPersonnelsCheckStatusCodeEnum.CHECK_PASS.getMsg());
|
||||
return actionResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改考勤变更申请
|
||||
* @param applyAttendanceChangeDto 表单对象
|
||||
* @param id 主键
|
||||
* @return java.lang.Object
|
||||
*/
|
||||
@PutMapping("/clockIn/{id}")
|
||||
public Object update(@RequestBody @Valid ApplyAttendanceChangeDto applyAttendanceChangeDto, @PathVariable("id") String id) throws Exception {
|
||||
|
||||
ApplyAttendanceChange entity = JsonUtil.getJsonToBean(applyAttendanceChangeDto, ApplyAttendanceChange.class);
|
||||
entity.setId(id);
|
||||
if (FlowStatusEnum.save.getMessage().equals(applyAttendanceChangeDto.getStatus())) {
|
||||
applyAttendanceChangeService.save(entity, applyAttendanceChangeDto);
|
||||
return ActionResult.success(MsgCode.SU002.get());
|
||||
}
|
||||
applyAttendanceChangeService.submit(id, entity, applyAttendanceChangeDto);
|
||||
return ActionResult.success(MsgCode.SU006.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询补卡审批记录
|
||||
* @param id 审批id
|
||||
* @return jnpf.base.ActionResult<jnpf.model.workflow.vo.ApplyAttendanceChangeVo>
|
||||
*/
|
||||
@GetMapping(value = "/repair/{id}")
|
||||
public ActionResult<ApplyAttendanceRepairVo> getApplyAttendanceRepair(@PathVariable(value = "id") String id) {
|
||||
|
||||
ApplyAttendanceRepairVo vo = applyAttendanceRepairService.getApplyAttendanceRepair(id);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新建补卡审批申请
|
||||
* @param applyAttendanceRepairDto 表单对象
|
||||
* @return java.lang.Object
|
||||
*/
|
||||
@PostMapping("/repair")
|
||||
public ActionResult<Void> create(@RequestBody @Valid ApplyAttendanceRepairDto applyAttendanceRepairDto) {
|
||||
|
||||
ApplyAttendanceRepair entity = JsonUtil.getJsonToBean(applyAttendanceRepairDto, ApplyAttendanceRepair.class);
|
||||
entity.setStatus(ConstantUtil.STATUS_PENDING_APPROVAL);
|
||||
ActionResult<Void> actionResult = new ActionResult<>();
|
||||
try {
|
||||
applyAttendanceRepairService.save(entity, applyAttendanceRepairDto);
|
||||
} catch (Exception e) {
|
||||
actionResult.setCode(FtbPersonnelsCheckStatusCodeEnum.CHECK_REFUSE.getCode());
|
||||
actionResult.setMsg(e.getMessage());
|
||||
return actionResult;
|
||||
}
|
||||
actionResult.setCode(FtbPersonnelsCheckStatusCodeEnum.CHECK_PASS.getCode());
|
||||
actionResult.setMsg(FtbPersonnelsCheckStatusCodeEnum.CHECK_PASS.getMsg());
|
||||
return actionResult;
|
||||
/*if (FlowStatusEnum.save.getMessage().equals(applyAttendanceRepairDto.getStatus())) {
|
||||
applyAttendanceRepairService.save(id, entity, applyAttendanceRepairDto);
|
||||
return ActionResult.success(MsgCode.SU002.get());
|
||||
}
|
||||
applyAttendanceRepairService.submit(id, entity, applyAttendanceRepairDto);
|
||||
return ActionResult.success(MsgCode.SU006.get());*/
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改补卡审批申请
|
||||
* @param applyAttendanceRepairDto 表单对象
|
||||
* @param id 主键
|
||||
* @return java.lang.Object
|
||||
*/
|
||||
@PutMapping("/repair/{id}")
|
||||
public Object update(@RequestBody @Valid ApplyAttendanceRepairDto applyAttendanceRepairDto, @PathVariable("id") String id) throws Exception {
|
||||
|
||||
ApplyAttendanceRepair entity = JsonUtil.getJsonToBean(applyAttendanceRepairDto, ApplyAttendanceRepair.class);
|
||||
entity.setId(id);
|
||||
if (FlowStatusEnum.save.getMessage().equals(applyAttendanceRepairDto.getStatus())) {
|
||||
applyAttendanceRepairService.save(entity, applyAttendanceRepairDto);
|
||||
return ActionResult.success(MsgCode.SU002.get());
|
||||
}
|
||||
applyAttendanceRepairService.submit(id, entity, applyAttendanceRepairDto);
|
||||
return ActionResult.success(MsgCode.SU006.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询外勤审批记录
|
||||
* @param id 审批id
|
||||
* @return jnpf.base.ActionResult<jnpf.model.workflow.vo.ApplyAttendanceChangeVo>
|
||||
*/
|
||||
@GetMapping(value = "/outside/{id}")
|
||||
public ActionResult<ApplyAttendanceOutsideVo> getApplyAttendanceOutside(@PathVariable(value = "id") String id) {
|
||||
|
||||
ApplyAttendanceOutsideVo vo = applyAttendanceOutsideService.getApplyAttendanceOutside(id);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新建外勤审批申请
|
||||
* @param applyAttendanceOutsideDto 表单对象
|
||||
* @return java.lang.Object
|
||||
*/
|
||||
@PostMapping("/outside")
|
||||
public Object create(@RequestBody @Valid ApplyAttendanceOutsideDto applyAttendanceOutsideDto) {
|
||||
if (StringUtil.isNotEmpty(applyAttendanceOutsideDto.getSpecialBusinessId())) {
|
||||
applyAttendanceOutsideDto.setClockInId(applyAttendanceOutsideDto.getSpecialBusinessId());
|
||||
}
|
||||
ApplyAttendanceOutside entity = JsonUtil.getJsonToBean(applyAttendanceOutsideDto, ApplyAttendanceOutside.class);
|
||||
entity.setStatus(ConstantUtil.STATUS_PENDING_APPROVAL);
|
||||
ActionResult<Void> actionResult = new ActionResult<>();
|
||||
try {
|
||||
applyAttendanceOutsideService.save(entity, applyAttendanceOutsideDto);
|
||||
} catch (Exception e) {
|
||||
actionResult.setCode(FtbPersonnelsCheckStatusCodeEnum.CHECK_REFUSE.getCode());
|
||||
actionResult.setMsg(e.getMessage());
|
||||
return actionResult;
|
||||
}
|
||||
actionResult.setCode(FtbPersonnelsCheckStatusCodeEnum.CHECK_PASS.getCode());
|
||||
actionResult.setMsg(FtbPersonnelsCheckStatusCodeEnum.CHECK_PASS.getMsg());
|
||||
return actionResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改外勤审批申请
|
||||
* @param applyAttendanceOutsideDto 表单对象
|
||||
* @return java.lang.Object
|
||||
*/
|
||||
@PutMapping("/outside")
|
||||
public Object update(@RequestBody @Valid ApplyAttendanceOutsideDto applyAttendanceOutsideDto) throws Exception {
|
||||
ApplyAttendanceOutside entity = JsonUtil.getJsonToBean(applyAttendanceOutsideDto, ApplyAttendanceOutside.class);
|
||||
entity.setId(applyAttendanceOutsideDto.getTaskId());
|
||||
if (FlowStatusEnum.save.getMessage().equals(applyAttendanceOutsideDto.getStatus())) {
|
||||
applyAttendanceOutsideService.save(entity, applyAttendanceOutsideDto);
|
||||
return ActionResult.success(MsgCode.SU002.get());
|
||||
}
|
||||
applyAttendanceOutsideService.submit(entity, applyAttendanceOutsideDto);
|
||||
return ActionResult.success(MsgCode.SU006.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新建违规打卡审批申请
|
||||
* @param applyAttendanceViolationDto 表单对象
|
||||
* @return java.lang.Object
|
||||
*/
|
||||
@PostMapping("/violation")
|
||||
public Object createViolation(@RequestBody @Valid ApplyAttendanceViolationDto applyAttendanceViolationDto) {
|
||||
|
||||
log.error("违规打卡审批: {}", applyAttendanceViolationDto.toString());
|
||||
if (StringUtil.isNotEmpty(applyAttendanceViolationDto.getSpecialBusinessId())) {
|
||||
applyAttendanceViolationDto.setClockInId(applyAttendanceViolationDto.getSpecialBusinessId());
|
||||
}
|
||||
ActionResult<Void> actionResult = new ActionResult<>();
|
||||
try {
|
||||
applyAttendanceViolationService.saveRecord(applyAttendanceViolationDto);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
actionResult.setCode(FtbPersonnelsCheckStatusCodeEnum.CHECK_REFUSE.getCode());
|
||||
actionResult.setMsg(e.getMessage());
|
||||
return actionResult;
|
||||
}
|
||||
actionResult.setCode(FtbPersonnelsCheckStatusCodeEnum.CHECK_PASS.getCode());
|
||||
actionResult.setMsg(FtbPersonnelsCheckStatusCodeEnum.CHECK_PASS.getMsg());
|
||||
return actionResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取打卡类型
|
||||
* @return jnpf.base.ActionResult<java.util.List<jnpf.model.workflow.vo.ClockKindVo>>
|
||||
*/
|
||||
@GetMapping(value = "/violation/clock-kind")
|
||||
public ActionResult<List<ClockKindVo>> getClockKindList() {
|
||||
|
||||
List<ClockKindVo> list = List.of(new ClockKindVo(1, "内勤打卡"), new ClockKindVo(2, "外勤打卡"));
|
||||
return ActionResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取打卡设备类型
|
||||
* @return jnpf.base.ActionResult<java.util.List<jnpf.model.workflow.vo.ClockKindVo>>
|
||||
*/
|
||||
@GetMapping(value = "/violation/device-type")
|
||||
public ActionResult<List<ClockKindVo>> getDeviceTypeList() {
|
||||
|
||||
List<ClockKindVo> list = List.of(new ClockKindVo(1, "地点打卡"), new ClockKindVo(2, "WIFI打卡"), new ClockKindVo(3, "考勤机打卡"));
|
||||
return ActionResult.success(list);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
package jnpf.workflow.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import jnpf.base.ActionResult;
|
||||
import jnpf.constant.MsgCode;
|
||||
import jnpf.engine.enums.FlowStatusEnum;
|
||||
import jnpf.entity.workflow.AttendanceBusinessTripApprove;
|
||||
import jnpf.entity.workflow.AttendanceGoOutApprove;
|
||||
import jnpf.model.workflow.dto.AttendanceBusinessTripApproveDto;
|
||||
import jnpf.model.workflow.dto.AttendanceGoOutApproveDto;
|
||||
import jnpf.model.workflow.vo.AttendanceBusinessTripApproveVo;
|
||||
import jnpf.model.workflow.vo.AttendanceGoOutApproveVo;
|
||||
import jnpf.util.JsonUtil;
|
||||
import jnpf.workflow.service.BusinessTripApproveService;
|
||||
import jnpf.workflow.service.GoOutApproveService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 审批触发接口
|
||||
*
|
||||
* @Author huanglinpan
|
||||
* @Date 2024/5/14 18:15
|
||||
* @Version 1.0 (版本号)
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping(value = "/apply")
|
||||
public class ApplyController {
|
||||
|
||||
|
||||
@Resource
|
||||
private BusinessTripApproveService businessTripApproveService;
|
||||
|
||||
@Resource
|
||||
private GoOutApproveService goOutApproveService;
|
||||
|
||||
/**
|
||||
* 新建出差申请
|
||||
*
|
||||
* @param attendanceBusinessTripApproveDto 表单对象
|
||||
* @return java.lang.Object
|
||||
*/
|
||||
@PostMapping("/businessTrip/{id}")
|
||||
public Object createGoOut(@RequestBody @Valid AttendanceBusinessTripApproveDto attendanceBusinessTripApproveDto, @PathVariable("id") String id) {
|
||||
log.error("开始出差了参数................: {}", attendanceBusinessTripApproveDto);
|
||||
AttendanceBusinessTripApprove entity = JsonUtil.getJsonToBean(attendanceBusinessTripApproveDto, AttendanceBusinessTripApprove.class);
|
||||
if (!entity.getEndTime().after(entity.getStartTime())) {
|
||||
entity.setEndTime(DateUtil.endOfDay(entity.getEndTime()));
|
||||
}
|
||||
if (FlowStatusEnum.save.getMessage().equals(attendanceBusinessTripApproveDto.getStatus())) {
|
||||
businessTripApproveService.save(id, entity, attendanceBusinessTripApproveDto);
|
||||
return ActionResult.success(MsgCode.SU002.get());
|
||||
}
|
||||
businessTripApproveService.submit(id, entity, attendanceBusinessTripApproveDto);
|
||||
return ActionResult.success(MsgCode.SU006.get());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询出差审批记录
|
||||
*
|
||||
* @param id 审批id
|
||||
* @return jnpf.base.ActionResult<jnpf.model.workflow.vo.ApplyAttendanceChangeVo>
|
||||
*/
|
||||
@GetMapping(value = "/businessTrip/{id}")
|
||||
public ActionResult<AttendanceBusinessTripApproveVo> getGoOut(@PathVariable(value = "id") String id) {
|
||||
|
||||
AttendanceBusinessTripApproveVo vo = businessTripApproveService.getOne(id);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改出差申请
|
||||
*
|
||||
* @param attendanceBusinessTripApproveDto 表单对象
|
||||
* @param id 主键
|
||||
* @return java.lang.Object
|
||||
*/
|
||||
@PutMapping("/businessTrip/{id}")
|
||||
public Object updateGoOut(@RequestBody @Valid AttendanceBusinessTripApproveDto attendanceBusinessTripApproveDto, @PathVariable("id") String id) {
|
||||
|
||||
AttendanceBusinessTripApprove entity = JsonUtil.getJsonToBean(attendanceBusinessTripApproveDto, AttendanceBusinessTripApprove.class);
|
||||
entity.setId(id);
|
||||
if (FlowStatusEnum.save.getMessage().equals(attendanceBusinessTripApproveDto.getStatus())) {
|
||||
businessTripApproveService.save(id, entity, attendanceBusinessTripApproveDto);
|
||||
return ActionResult.success(MsgCode.SU002.get());
|
||||
}
|
||||
businessTripApproveService.submit(id, entity, attendanceBusinessTripApproveDto);
|
||||
return ActionResult.success(MsgCode.SU006.get());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新建外出申请
|
||||
*
|
||||
* @param attendanceGoOutApproveDto 表单对象
|
||||
* @return java.lang.Object
|
||||
*/
|
||||
@PostMapping("/out/{id}")
|
||||
public Object createBusinessTrip(@RequestBody @Valid AttendanceGoOutApproveDto attendanceGoOutApproveDto, @PathVariable("id") String id) {
|
||||
log.error("开始外出申请了参数................: {}", attendanceGoOutApproveDto);
|
||||
AttendanceGoOutApprove entity = JsonUtil.getJsonToBean(attendanceGoOutApproveDto, AttendanceGoOutApprove.class);
|
||||
if (!entity.getEndTime().after(entity.getStartTime())) {
|
||||
entity.setEndTime(DateUtil.endOfDay(entity.getEndTime()));
|
||||
}
|
||||
if (FlowStatusEnum.save.getMessage().equals(attendanceGoOutApproveDto.getStatus())) {
|
||||
goOutApproveService.save(id, entity, attendanceGoOutApproveDto);
|
||||
return ActionResult.success(MsgCode.SU002.get());
|
||||
}
|
||||
goOutApproveService.submit(id, entity, attendanceGoOutApproveDto);
|
||||
return ActionResult.success(MsgCode.SU006.get());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询外出审批记录
|
||||
*
|
||||
* @param id 审批id
|
||||
* @return jnpf.base.ActionResult<jnpf.model.workflow.vo.ApplyAttendanceChangeVo>
|
||||
*/
|
||||
@GetMapping(value = "/out/{id}")
|
||||
public ActionResult<AttendanceGoOutApproveVo> getBusinessTrip(@PathVariable(value = "id") String id) {
|
||||
|
||||
AttendanceGoOutApproveVo vo = goOutApproveService.getOne(id);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改外出申请
|
||||
*
|
||||
* @param attendanceGoOutApproveDto 表单对象
|
||||
* @param id 主键
|
||||
* @return java.lang.Object
|
||||
*/
|
||||
@PutMapping("/out/{id}")
|
||||
public Object updateBusinessTrip(@RequestBody @Valid AttendanceGoOutApproveDto attendanceGoOutApproveDto, @PathVariable("id") String id) {
|
||||
|
||||
AttendanceGoOutApprove entity = JsonUtil.getJsonToBean(attendanceGoOutApproveDto, AttendanceGoOutApprove.class);
|
||||
entity.setId(id);
|
||||
if (FlowStatusEnum.save.getMessage().equals(attendanceGoOutApproveDto.getStatus())) {
|
||||
goOutApproveService.save(id, entity, attendanceGoOutApproveDto);
|
||||
return ActionResult.success(MsgCode.SU002.get());
|
||||
}
|
||||
goOutApproveService.submit(id, entity, attendanceGoOutApproveDto);
|
||||
return ActionResult.success(MsgCode.SU006.get());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package jnpf.workflow.controller;
|
||||
|
||||
import jnpf.base.ActionResult;
|
||||
import jnpf.constant.MsgCode;
|
||||
import jnpf.engine.enums.FlowStatusEnum;
|
||||
import jnpf.entity.workflow.AttendanceLeaveApprove;
|
||||
import jnpf.model.workflow.dto.AttendanceLeaveApproveDto;
|
||||
import jnpf.model.workflow.vo.AttendanceLeaveFlowApproveVo;
|
||||
import jnpf.util.JsonUtil;
|
||||
import jnpf.workflow.service.LeaveApproveService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* describe
|
||||
*
|
||||
* @author HuangLinPan
|
||||
* @date 2023/12/11
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping(value = "/attendanceApprove/leave")
|
||||
public class LeaveApproveController {
|
||||
|
||||
@Resource
|
||||
private LeaveApproveService leaveApproveService;
|
||||
|
||||
/**
|
||||
* 新建请假申请
|
||||
* @param attendanceLeaveApproveDto 表单对象
|
||||
* @return java.lang.Object
|
||||
*/
|
||||
@PostMapping("/{id}")
|
||||
public Object create(@RequestBody @Valid AttendanceLeaveApproveDto attendanceLeaveApproveDto, @PathVariable("id") String id) {
|
||||
log.error("开始请假了................");
|
||||
log.error("开始请假了参数................: {}",attendanceLeaveApproveDto);
|
||||
AttendanceLeaveApprove entity = JsonUtil.getJsonToBean(attendanceLeaveApproveDto, AttendanceLeaveApprove.class);
|
||||
if (FlowStatusEnum.save.getMessage().equals(attendanceLeaveApproveDto.getSubmitStatus())) {
|
||||
leaveApproveService.save(id, entity, attendanceLeaveApproveDto);
|
||||
return ActionResult.success(MsgCode.SU002.get());
|
||||
}
|
||||
leaveApproveService.submit(id, entity, attendanceLeaveApproveDto);
|
||||
return ActionResult.success(MsgCode.SU006.get());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询请假审批记录
|
||||
* @param id 审批id
|
||||
* @return jnpf.base.ActionResult<jnpf.model.workflow.vo.ApplyAttendanceChangeVo>
|
||||
*/
|
||||
@GetMapping(value = "/{id}")
|
||||
public ActionResult<AttendanceLeaveFlowApproveVo> getAttendanceLeave(@PathVariable(value = "id") String id) {
|
||||
|
||||
AttendanceLeaveFlowApproveVo vo = leaveApproveService.getAttendanceLeave(id);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改请假申请
|
||||
* @param attendanceLeaveApproveDto 表单对象
|
||||
* @param id 主键
|
||||
* @return java.lang.Object
|
||||
*/
|
||||
@PutMapping("/{id}")
|
||||
public Object update(@RequestBody @Valid AttendanceLeaveApproveDto attendanceLeaveApproveDto, @PathVariable("id") String id) {
|
||||
|
||||
AttendanceLeaveApprove entity = JsonUtil.getJsonToBean(attendanceLeaveApproveDto, AttendanceLeaveApprove.class);
|
||||
entity.setId(id);
|
||||
if (FlowStatusEnum.save.getMessage().equals(attendanceLeaveApproveDto.getSubmitStatus())) {
|
||||
leaveApproveService.save(id, entity, attendanceLeaveApproveDto);
|
||||
return ActionResult.success(MsgCode.SU002.get());
|
||||
}
|
||||
leaveApproveService.submit(id, entity, attendanceLeaveApproveDto);
|
||||
return ActionResult.success(MsgCode.SU006.get());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
package jnpf.workflow.controller;
|
||||
|
||||
import jnpf.base.ActionResult;
|
||||
import jnpf.base.UserInfo;
|
||||
import jnpf.config.ConfigValueUtil;
|
||||
import jnpf.constant.MsgCode;
|
||||
import jnpf.database.util.TenantDataSourceUtil;
|
||||
import jnpf.engine.enums.FlowStatusEnum;
|
||||
import jnpf.entity.workflow.PunishmentsApproval;
|
||||
import jnpf.entity.workflow.RewardApproval;
|
||||
import jnpf.exception.LoginException;
|
||||
import jnpf.model.workflow.dto.PunishmentsApprovalDto;
|
||||
import jnpf.model.workflow.dto.RewardApprovalDto;
|
||||
import jnpf.model.workflow.vo.PunishmentsApprovalVo;
|
||||
import jnpf.model.workflow.vo.RewardApprovalVo;
|
||||
import jnpf.util.JsonUtil;
|
||||
import jnpf.util.NoDataSourceBind;
|
||||
import jnpf.util.StringUtil;
|
||||
import jnpf.util.UserProvider;
|
||||
import jnpf.util.data.DataSourceContextHolder;
|
||||
import jnpf.workflow.service.PunishmentsApprovalService;
|
||||
import jnpf.workflow.service.RewardService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 此模块已废除,奖惩审批由OA提供
|
||||
* @Author huanglinpan
|
||||
* @Date 2024/5/21 17:22
|
||||
* @Version 1.0 (版本号)
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping(value = "/approve")
|
||||
@Deprecated(since = "人事v1.2", forRemoval = true)
|
||||
public class RewardsPunishmentsApproveController {
|
||||
|
||||
|
||||
@Resource
|
||||
private RewardService rewardService;
|
||||
|
||||
@Resource
|
||||
private PunishmentsApprovalService punishmentsApprovalService;
|
||||
|
||||
@Autowired
|
||||
private ConfigValueUtil configValueUtil;
|
||||
|
||||
|
||||
/**
|
||||
* 新建奖励申请
|
||||
* @param dto 表单对象
|
||||
* @return java.lang.Object
|
||||
*/
|
||||
@PostMapping("/reward/{id}")
|
||||
public Object create(@RequestBody @Valid RewardApprovalDto dto, @PathVariable("id") String id) {
|
||||
RewardApproval entity = JsonUtil.getJsonToBean(dto, RewardApproval.class);
|
||||
if (FlowStatusEnum.save.getMessage().equals(dto.getStatus())) {
|
||||
rewardService.saveReward(id, entity, dto);
|
||||
return ActionResult.success(MsgCode.SU002.get());
|
||||
}
|
||||
rewardService.submitReward(id, entity, dto);
|
||||
return ActionResult.success(MsgCode.SU006.get());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询奖励审批记录
|
||||
* @param id 审批id
|
||||
* @return jnpf.base.ActionResult<jnpf.model.workflow.vo.ApplyAttendanceChangeVo>
|
||||
*/
|
||||
@GetMapping(value = "/reward/{id}")
|
||||
public ActionResult<RewardApprovalVo> getAttendanceLeave(@PathVariable(value = "id") String id) {
|
||||
|
||||
RewardApprovalVo vo = rewardService.getReward(id);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改奖励申请
|
||||
* @param dto 表单对象
|
||||
* @param id 主键
|
||||
* @return java.lang.Object
|
||||
*/
|
||||
@PutMapping("/reward/{id}")
|
||||
public Object update(@RequestBody @Valid RewardApprovalDto dto, @PathVariable("id") String id) {
|
||||
|
||||
RewardApproval entity = JsonUtil.getJsonToBean(dto, RewardApproval.class);
|
||||
entity.setId(id);
|
||||
if (FlowStatusEnum.save.getMessage().equals(dto.getStatus())) {
|
||||
rewardService.saveReward(id, entity, dto);
|
||||
return ActionResult.success(MsgCode.SU002.get());
|
||||
}
|
||||
rewardService.submitReward(id, entity, dto);
|
||||
return ActionResult.success(MsgCode.SU006.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 奖励审批通过/拒绝/撤回
|
||||
* @param tenantId 租户Id
|
||||
* @param applyId 审批Id
|
||||
* @param status 是否审核通过 0.待审核 1.通过 2.未通过 3.撤回
|
||||
*/
|
||||
@GetMapping("/reward/pass")
|
||||
@NoDataSourceBind
|
||||
public void rewardApprove(@RequestParam(value = "tenantId") String tenantId,@RequestParam(value = "applyId") String applyId,@RequestParam(value = "status") Integer status) {
|
||||
log.info("/reward/pass tenantId:{},applyId:{},status:{}",tenantId,applyId,status);
|
||||
checkOutTenant(tenantId);
|
||||
rewardService.rewardApprove(applyId, status);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新建奖励申请
|
||||
* @param dto 表单对象
|
||||
* @return java.lang.Object
|
||||
*/
|
||||
@PostMapping("/punishments/{id}")
|
||||
public Object createPunishments(@RequestBody @Valid PunishmentsApprovalDto dto, @PathVariable("id") String id) {
|
||||
PunishmentsApproval entity = JsonUtil.getJsonToBean(dto, PunishmentsApproval.class);
|
||||
if (FlowStatusEnum.save.getMessage().equals(dto.getStatus())) {
|
||||
punishmentsApprovalService.savePunishments(id, entity, dto);
|
||||
return ActionResult.success(MsgCode.SU002.get());
|
||||
}
|
||||
punishmentsApprovalService.submitPunishments(id, entity, dto);
|
||||
return ActionResult.success(MsgCode.SU006.get());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询奖励审批记录
|
||||
* @param id 审批id
|
||||
* @return jnpf.base.ActionResult<jnpf.model.workflow.vo.ApplyAttendanceChangeVo>
|
||||
*/
|
||||
@GetMapping(value = "/punishments/{id}")
|
||||
public ActionResult<PunishmentsApprovalVo> getPunishments(@PathVariable(value = "id") String id) {
|
||||
|
||||
PunishmentsApprovalVo vo = punishmentsApprovalService.getPunishments(id);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改奖励申请
|
||||
* @param dto 表单对象
|
||||
* @param id 主键
|
||||
* @return java.lang.Object
|
||||
*/
|
||||
@PutMapping("/punishments/{id}")
|
||||
public Object updatePunishments(@RequestBody @Valid PunishmentsApprovalDto dto, @PathVariable("id") String id) {
|
||||
|
||||
PunishmentsApproval entity = JsonUtil.getJsonToBean(dto, PunishmentsApproval.class);
|
||||
entity.setId(id);
|
||||
if (FlowStatusEnum.save.getMessage().equals(dto.getStatus())) {
|
||||
punishmentsApprovalService.savePunishments(id, entity, dto);
|
||||
return ActionResult.success(MsgCode.SU002.get());
|
||||
}
|
||||
punishmentsApprovalService.submitPunishments(id, entity, dto);
|
||||
return ActionResult.success(MsgCode.SU006.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 惩罚审批通过/拒绝/撤回
|
||||
* @param tenantId 租户Id
|
||||
* @param applyId 审批Id
|
||||
* @param status 是否审核通过 0.待审核 1.通过 2.未通过 3.撤回
|
||||
*/
|
||||
@GetMapping("/punishments/pass")
|
||||
@NoDataSourceBind
|
||||
public void punishmentsApprove(@RequestParam(value = "tenantId") String tenantId,@RequestParam(value = "applyId") String applyId,@RequestParam(value = "status") Integer status) {
|
||||
log.info("punishments/pass tenantId:{},applyId:{},status:{}",tenantId,applyId,status);
|
||||
checkOutTenant(tenantId);
|
||||
punishmentsApprovalService.punishmentsApprove(applyId, status);
|
||||
}
|
||||
|
||||
public void checkOutTenant(String tenantId) {
|
||||
if (configValueUtil.isMultiTenancy()) {
|
||||
// 判断是不是从外面直接请求
|
||||
if (StringUtil.isNotEmpty(tenantId)) {
|
||||
//切换成租户库
|
||||
try {
|
||||
TenantDataSourceUtil.switchTenant(tenantId);
|
||||
} catch (LoginException e) {
|
||||
throw new RuntimeException("切换租户失败");
|
||||
}
|
||||
} else {
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
Assert.notNull(userInfo.getUserId(), "缺少租户信息");
|
||||
DataSourceContextHolder.setDatasource(userInfo.getTenantId(), userInfo.getTenantDbConnectionString(), userInfo.isAssignDataSource());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package jnpf.workflow.controller;
|
||||
|
||||
import jnpf.base.ActionResult;
|
||||
import jnpf.constant.MsgCode;
|
||||
import jnpf.engine.enums.FlowStatusEnum;
|
||||
import jnpf.entity.workflow.SelfApprove;
|
||||
import jnpf.model.workflow.dto.SelfApproveDto;
|
||||
import jnpf.model.workflow.vo.SelfApproveVo;
|
||||
import jnpf.util.JsonUtil;
|
||||
import jnpf.workflow.service.SelfApproveService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* describe
|
||||
* 借调审批控制器
|
||||
* @author HuangLinPan
|
||||
* @date 2023/12/13
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(value = "/attendanceApprove/selfApprove")
|
||||
public class SelfApproveController {
|
||||
|
||||
@Resource
|
||||
private SelfApproveService selfApproveService;
|
||||
|
||||
/**
|
||||
* 新建借调审批
|
||||
* @param selfApproveDto 表单对象
|
||||
* @return java.lang.Object
|
||||
*/
|
||||
@PostMapping("/{id}")
|
||||
public Object create(@RequestBody @Valid SelfApproveDto selfApproveDto, @PathVariable("id") String id) {
|
||||
if (selfApproveDto.getGroupId().equals(selfApproveDto.getSelfGroupId())){
|
||||
return ActionResult.fail("不能同组借调");
|
||||
}
|
||||
SelfApprove entity = JsonUtil.getJsonToBean(selfApproveDto, SelfApprove.class);
|
||||
if (FlowStatusEnum.save.getMessage().equals(selfApproveDto.getSubmitStatus())) {
|
||||
selfApproveService.save(id, entity, selfApproveDto);
|
||||
return ActionResult.success(MsgCode.SU002.get());
|
||||
}
|
||||
selfApproveService.submit(id, entity, selfApproveDto);
|
||||
return ActionResult.success(MsgCode.SU006.get());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询借调审批记录
|
||||
* @param id 加班审批id
|
||||
* @return jnpf.base.ActionResult<jnpf.model.workflow.vo.ApplyAttendanceChangeVo>
|
||||
*/
|
||||
@GetMapping(value = "/{id}")
|
||||
public ActionResult<SelfApproveVo> getAttendanceLeave(@PathVariable(value = "id") String id) {
|
||||
|
||||
SelfApproveVo vo = selfApproveService.getAttendanceLeave(id);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改借调审批
|
||||
* @param selfApproveDto 表单对象
|
||||
* @param id 主键
|
||||
* @return java.lang.Object
|
||||
*/
|
||||
@PutMapping("/{id}")
|
||||
public Object update(@RequestBody @Valid SelfApproveDto selfApproveDto, @PathVariable("id") String id) {
|
||||
if (selfApproveDto.getGroupId().equals(selfApproveDto.getSelfGroupId())){
|
||||
return ActionResult.fail("不能同组借调");
|
||||
}
|
||||
SelfApprove entity = JsonUtil.getJsonToBean(selfApproveDto, SelfApprove.class);
|
||||
entity.setId(id);
|
||||
if (FlowStatusEnum.save.getMessage().equals(selfApproveDto.getSubmitStatus())) {
|
||||
selfApproveService.save(id, entity, selfApproveDto);
|
||||
return ActionResult.success(MsgCode.SU002.get());
|
||||
}
|
||||
selfApproveService.submit(id, entity, selfApproveDto);
|
||||
return ActionResult.success(MsgCode.SU006.get());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package jnpf.workflow.controller;
|
||||
|
||||
import jnpf.base.ActionResult;
|
||||
import jnpf.constant.MsgCode;
|
||||
import jnpf.engine.enums.FlowStatusEnum;
|
||||
import jnpf.entity.workflow.AttendanceWorkOvertimeApprove;
|
||||
import jnpf.model.workflow.dto.AttendanceWorkOvertimeApproveDto;
|
||||
import jnpf.model.workflow.vo.AttendanceWorkOvertimeApproveVo;
|
||||
import jnpf.util.JsonUtil;
|
||||
import jnpf.util.UserProvider;
|
||||
import jnpf.workflow.service.WorkOvertimeApproveService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* describe
|
||||
* 加班审批控制器
|
||||
* @author HuangLinPan
|
||||
* @date 2023/12/12
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping(value = "/attendanceApprove/workOvertime")
|
||||
public class WorkOvertimeApproveController {
|
||||
|
||||
@Resource
|
||||
private WorkOvertimeApproveService workOvertimeApproveService;
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
|
||||
/**
|
||||
* 新建加班申请
|
||||
* @param attendanceWorkOvertimeApproveDto 表单对象
|
||||
* @return java.lang.Object
|
||||
*/
|
||||
@PostMapping("/{id}")
|
||||
public Object create(@RequestBody @Valid AttendanceWorkOvertimeApproveDto attendanceWorkOvertimeApproveDto, @PathVariable("id") String id) {
|
||||
log.error("新建加班申请 参数 : {}",attendanceWorkOvertimeApproveDto);
|
||||
String userId = userProvider.get().getUserId();
|
||||
attendanceWorkOvertimeApproveDto.setUserId(userId);
|
||||
AttendanceWorkOvertimeApprove entity = JsonUtil.getJsonToBean(attendanceWorkOvertimeApproveDto, AttendanceWorkOvertimeApprove.class);
|
||||
if (FlowStatusEnum.save.getMessage().equals(attendanceWorkOvertimeApproveDto.getSubmitStatus())) {
|
||||
workOvertimeApproveService.save(id, entity, attendanceWorkOvertimeApproveDto);
|
||||
return ActionResult.success(MsgCode.SU002.get());
|
||||
}
|
||||
workOvertimeApproveService.submit(id, entity, attendanceWorkOvertimeApproveDto);
|
||||
return ActionResult.success(MsgCode.SU006.get());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询加班审批记录
|
||||
* @param id 加班审批id
|
||||
* @return jnpf.base.ActionResult<jnpf.model.workflow.vo.ApplyAttendanceChangeVo>
|
||||
*/
|
||||
@GetMapping(value = "/{id}")
|
||||
public ActionResult<AttendanceWorkOvertimeApproveVo> getAttendanceLeave(@PathVariable(value = "id") String id) {
|
||||
|
||||
AttendanceWorkOvertimeApproveVo vo = workOvertimeApproveService.getAttendanceLeave(id);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改加班申请
|
||||
* @param attendanceWorkOvertimeApproveDto 表单对象
|
||||
* @param id 主键
|
||||
* @return java.lang.Object
|
||||
*/
|
||||
@PutMapping("/{id}")
|
||||
public Object update(@RequestBody @Valid AttendanceWorkOvertimeApproveDto attendanceWorkOvertimeApproveDto, @PathVariable("id") String id) {
|
||||
log.error("修改加班申请 参数 : {}",attendanceWorkOvertimeApproveDto);
|
||||
// String userId = userProvider.get().getUserId();
|
||||
// attendanceWorkOvertimeApproveDto.setUserId(userId);
|
||||
AttendanceWorkOvertimeApprove entity = JsonUtil.getJsonToBean(attendanceWorkOvertimeApproveDto, AttendanceWorkOvertimeApprove.class);
|
||||
entity.setId(id);
|
||||
if (FlowStatusEnum.save.getMessage().equals(attendanceWorkOvertimeApproveDto.getSubmitStatus())) {
|
||||
workOvertimeApproveService.save(id, entity, attendanceWorkOvertimeApproveDto);
|
||||
return ActionResult.success(MsgCode.SU002.get());
|
||||
}
|
||||
workOvertimeApproveService.submit(id, entity, attendanceWorkOvertimeApproveDto);
|
||||
return ActionResult.success(MsgCode.SU006.get());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package jnpf.workflow.mapper;
|
||||
|
||||
import jnpf.base.mapper.SuperMapper;
|
||||
import jnpf.entity.workflow.ApplyAttendanceChange;
|
||||
import jnpf.model.attendance.vo.ApplyResultVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 出勤变更mapper
|
||||
*
|
||||
* @author yanwenfu
|
||||
* @create 2023-12-11
|
||||
*/
|
||||
public interface ApplyAttendanceChangeMapper extends SuperMapper<ApplyAttendanceChange> {
|
||||
|
||||
/**
|
||||
* 批量更新旧打卡结果
|
||||
* @param list 审批打卡结果vo
|
||||
*/
|
||||
void updateBatchOldResult(@Param("list") List<ApplyResultVo> list);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package jnpf.workflow.mapper;
|
||||
|
||||
import jnpf.base.mapper.SuperMapper;
|
||||
import jnpf.entity.workflow.ApplyAttendanceOutside;
|
||||
|
||||
/**
|
||||
* 外勤审批mapper
|
||||
*
|
||||
* @author yanwenfu
|
||||
* @create 2023-12-13
|
||||
*/
|
||||
public interface ApplyAttendanceOutsideMapper extends SuperMapper<ApplyAttendanceOutside> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package jnpf.workflow.mapper;
|
||||
|
||||
import jnpf.base.mapper.SuperMapper;
|
||||
import jnpf.entity.workflow.ApplyAttendanceRepair;
|
||||
import jnpf.model.attendance.vo.ApplyResultVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 补卡审批mapper
|
||||
*
|
||||
* @author yanwenfu
|
||||
* @create 2023-12-13
|
||||
*/
|
||||
public interface ApplyAttendanceRepairMapper extends SuperMapper<ApplyAttendanceRepair> {
|
||||
|
||||
/**
|
||||
* 批量更新旧打卡结果
|
||||
* @param list 审批打卡结果vo
|
||||
*/
|
||||
void updateBatchOldResult(@Param("list") List<ApplyResultVo> list);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package jnpf.workflow.mapper;
|
||||
|
||||
import jnpf.base.mapper.SuperMapper;
|
||||
import jnpf.entity.workflow.ApplyAttendanceViolation;
|
||||
|
||||
/**
|
||||
* 违规打卡审批mapper
|
||||
*
|
||||
* @author yanwenfu
|
||||
* @create 2025-09-22
|
||||
*/
|
||||
public interface ApplyAttendanceViolationMapper extends SuperMapper<ApplyAttendanceViolation> {
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package jnpf.workflow.mapper;
|
||||
|
||||
import jnpf.base.mapper.SuperMapper;
|
||||
import jnpf.entity.workflow.AttendanceLeaveApprove;
|
||||
|
||||
/**
|
||||
* describe
|
||||
*
|
||||
* @author HuangLinPan
|
||||
* @date 2023/12/11
|
||||
*/
|
||||
public interface AttendanceLeaveMapper extends SuperMapper<AttendanceLeaveApprove> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package jnpf.workflow.mapper;
|
||||
|
||||
import jnpf.base.mapper.SuperMapper;
|
||||
import jnpf.entity.workflow.AttendanceWorkOvertimeApprove;
|
||||
|
||||
/**
|
||||
* describe
|
||||
*
|
||||
* @author HuangLinPan
|
||||
* @date 2023/12/12
|
||||
*/
|
||||
public interface AttendanceWorkOvertimeApproveMapper extends SuperMapper<AttendanceWorkOvertimeApprove> {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package jnpf.workflow.mapper;
|
||||
|
||||
import jnpf.base.mapper.SuperMapper;
|
||||
import jnpf.entity.workflow.AttendanceBusinessTripApprove;
|
||||
import jnpf.entity.workflow.AttendanceLeaveApprove;
|
||||
|
||||
/**
|
||||
* @Author huanglinpan
|
||||
* @Date 2024/5/14 19:07
|
||||
* @Version 1.0 (版本号)
|
||||
*/
|
||||
public interface BusinessTripApproveMapper extends SuperMapper<AttendanceBusinessTripApprove> {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package jnpf.workflow.mapper;
|
||||
|
||||
import jnpf.base.mapper.SuperMapper;
|
||||
import jnpf.entity.workflow.AttendanceGoOutApprove;
|
||||
import jnpf.entity.workflow.AttendanceLeaveApprove;
|
||||
|
||||
/**
|
||||
* @Author huanglinpan
|
||||
* @Date 2024/5/14 19:07
|
||||
* @Version 1.0 (版本号)
|
||||
*/
|
||||
public interface GoOutApproveMapper extends SuperMapper<AttendanceGoOutApprove> {
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package jnpf.workflow.mapper;
|
||||
|
||||
import jnpf.base.mapper.SuperMapper;
|
||||
import jnpf.entity.workflow.PunishmentsApproval;
|
||||
import jnpf.model.workflow.dto.UserSelfDto;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author huanglinpan
|
||||
* @Date 2024/5/24 10:45
|
||||
* @Version 1.0 (版本号)
|
||||
*/
|
||||
public interface PunishmentsApprovalMapper extends SuperMapper<PunishmentsApproval> {
|
||||
void saveUser(@Param("id") String id, @Param("userDtos") List<UserSelfDto> userDtos);
|
||||
|
||||
void deleteUserById(@Param("id") String id);
|
||||
|
||||
List<UserSelfDto> getListById(@Param("id") String id);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package jnpf.workflow.mapper;
|
||||
|
||||
import jnpf.base.mapper.SuperMapper;
|
||||
import jnpf.entity.workflow.PunishmentsApprovalUser;
|
||||
|
||||
|
||||
/**
|
||||
* 惩罚审批用户映射器
|
||||
*
|
||||
* @author wangchunxiang
|
||||
* @date 2024/08/14
|
||||
*/
|
||||
public interface PunishmentsApprovalUserMapper extends SuperMapper<PunishmentsApprovalUser> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package jnpf.workflow.mapper;
|
||||
|
||||
import jnpf.base.mapper.SuperMapper;
|
||||
import jnpf.entity.workflow.RewardApproval;
|
||||
import jnpf.model.workflow.dto.UserSelfDto;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author huanglinpan
|
||||
* @Date 2024/5/21 17:27
|
||||
* @Version 1.0 (版本号)
|
||||
*/
|
||||
public interface RewardApprovalMapper extends SuperMapper<RewardApproval> {
|
||||
void saveUser(@Param("id") String id, @Param("userDtos") List<UserSelfDto> userDtos);
|
||||
|
||||
void deleteUserById(@Param("id") String id);
|
||||
|
||||
List<UserSelfDto> getListById(@Param("id") String id);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package jnpf.workflow.mapper;
|
||||
|
||||
import jnpf.base.mapper.SuperMapper;
|
||||
import jnpf.entity.workflow.RewardApprovalUser;
|
||||
|
||||
|
||||
/**
|
||||
* 奖励审批用户映射器
|
||||
*
|
||||
* @author wangchunxiang
|
||||
* @date 2024/08/14
|
||||
*/
|
||||
public interface RewardApprovalUserMapper extends SuperMapper<RewardApprovalUser> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package jnpf.workflow.mapper;
|
||||
|
||||
import jnpf.base.mapper.SuperMapper;
|
||||
import jnpf.entity.workflow.SelfApprove;
|
||||
|
||||
public interface SelfApproveMapper extends SuperMapper<SelfApprove> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package jnpf.workflow.mapper;
|
||||
|
||||
import jnpf.model.workflow.dto.UserSelfDto;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SelfApproveUserMapper {
|
||||
|
||||
/**
|
||||
* 批量新增借调申请中的被借调用户信息
|
||||
* @param userIds 被借调用户列表
|
||||
* @param id 借调申请id
|
||||
* @author hlp
|
||||
*/
|
||||
void addList(@Param("userIds") List<String> userIds, @Param("id") String id);
|
||||
|
||||
void addUserList(@Param("userSelfDtos") List<UserSelfDto> userSelfDtos, @Param("id") String id);
|
||||
|
||||
/**
|
||||
* 根据借调申请id删除关联的用户信息
|
||||
* @param id 借调申请id
|
||||
* @author hlp
|
||||
*/
|
||||
void deleteById(@Param("id") String id);
|
||||
|
||||
/**
|
||||
* 获取借调审批对应的借调用户列表
|
||||
* @param id 借调申请id
|
||||
* @return java.util.List<jnpf.model.workflow.dto.UserSelfDto>
|
||||
* @author hlp
|
||||
*/
|
||||
List<UserSelfDto> getListById(@Param("id") String id);
|
||||
|
||||
List<String> getIdListById(@Param("id") String id);
|
||||
|
||||
/**
|
||||
* 绑定被借调用户
|
||||
* @param userIds 被借调用户
|
||||
* @param id 借调Id
|
||||
*/
|
||||
void addUserListForOa(@Param("userIds") List<String> userIds, @Param("id") String id);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package jnpf.workflow.service;
|
||||
|
||||
import jnpf.base.service.SuperService;
|
||||
import jnpf.entity.workflow.ApplyAttendanceChange;
|
||||
import jnpf.model.workflow.dto.ApplyAttendanceChangeDto;
|
||||
import jnpf.model.workflow.vo.ApplyAttendanceChangeVo;
|
||||
|
||||
/**
|
||||
* 打卡申请服务
|
||||
*
|
||||
* @author yanwenfu
|
||||
* @create 2023-12-11
|
||||
*/
|
||||
public interface ApplyAttendanceChangeService extends SuperService<ApplyAttendanceChange> {
|
||||
|
||||
/**
|
||||
* 查询审批记录
|
||||
* @param id 审批id
|
||||
* @return jnpf.model.workflow.vo.ApplyAttendanceChangeVo
|
||||
*/
|
||||
ApplyAttendanceChangeVo getApplyAttendanceChange(String id);
|
||||
|
||||
/**
|
||||
* 新增审批记录
|
||||
* @param entity 实体
|
||||
* @param applyAttendanceChangeDto 考勤变更dto
|
||||
*/
|
||||
void save(ApplyAttendanceChange entity, ApplyAttendanceChangeDto applyAttendanceChangeDto) throws Exception;
|
||||
|
||||
/**
|
||||
* 提交审批记录
|
||||
* @param id 审批id
|
||||
* @param entity 实体
|
||||
* @param applyAttendanceChangeDto 考勤变更dto
|
||||
*/
|
||||
void submit(String id, ApplyAttendanceChange entity, ApplyAttendanceChangeDto applyAttendanceChangeDto);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package jnpf.workflow.service;
|
||||
|
||||
import jnpf.base.service.SuperService;
|
||||
import jnpf.entity.workflow.ApplyAttendanceOutside;
|
||||
import jnpf.model.workflow.dto.ApplyAttendanceOutsideDto;
|
||||
import jnpf.model.workflow.vo.ApplyAttendanceOutsideVo;
|
||||
|
||||
/**
|
||||
* 外勤审批服务
|
||||
*
|
||||
* @author yanwenfu
|
||||
* @create 2023-12-13
|
||||
*/
|
||||
public interface ApplyAttendanceOutsideService extends SuperService<ApplyAttendanceOutside> {
|
||||
|
||||
/**
|
||||
* 查询外勤审批记录
|
||||
* @param id 审批id
|
||||
* @return jnpf.model.workflow.vo.ApplyAttendanceOutsideVo
|
||||
*/
|
||||
ApplyAttendanceOutsideVo getApplyAttendanceOutside(String id);
|
||||
|
||||
/**
|
||||
* 新建外勤审批申请
|
||||
* @param entity 外勤实体
|
||||
* @param applyAttendanceOutsideDto 外勤dto
|
||||
*/
|
||||
void save(ApplyAttendanceOutside entity, ApplyAttendanceOutsideDto applyAttendanceOutsideDto) throws Exception;
|
||||
|
||||
/**
|
||||
* 修改外勤审批申请
|
||||
* @param entity 外勤实体
|
||||
* @param applyAttendanceOutsideDto 外勤dto
|
||||
*/
|
||||
void submit(ApplyAttendanceOutside entity, ApplyAttendanceOutsideDto applyAttendanceOutsideDto);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package jnpf.workflow.service;
|
||||
|
||||
import jnpf.base.service.SuperService;
|
||||
import jnpf.entity.workflow.ApplyAttendanceRepair;
|
||||
import jnpf.model.workflow.dto.ApplyAttendanceRepairDto;
|
||||
import jnpf.model.workflow.vo.ApplyAttendanceRepairVo;
|
||||
|
||||
/**
|
||||
* 补卡审批服务
|
||||
*
|
||||
* @author yanwenfu
|
||||
* @create 2023-12-13
|
||||
*/
|
||||
public interface ApplyAttendanceRepairService extends SuperService<ApplyAttendanceRepair> {
|
||||
|
||||
/**
|
||||
* 查询补卡审批记录
|
||||
* @param id 审批id
|
||||
* @return jnpf.model.workflow.vo.ApplyAttendanceRepairVo
|
||||
*/
|
||||
ApplyAttendanceRepairVo getApplyAttendanceRepair(String id);
|
||||
|
||||
/**
|
||||
* 保存补卡审批记录
|
||||
* @param entity 补卡实体
|
||||
* @param applyAttendanceRepairDto 补卡审批dto
|
||||
* @throws Exception 异常抛出
|
||||
*/
|
||||
void save(ApplyAttendanceRepair entity, ApplyAttendanceRepairDto applyAttendanceRepairDto) throws Exception;
|
||||
|
||||
/**
|
||||
* 提交补卡审批记录
|
||||
* @param id 审批id
|
||||
* @param entity 补卡实体
|
||||
* @param applyAttendanceRepairDto 补卡审批dto
|
||||
*/
|
||||
void submit(String id, ApplyAttendanceRepair entity, ApplyAttendanceRepairDto applyAttendanceRepairDto);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package jnpf.workflow.service;
|
||||
|
||||
import jnpf.base.service.SuperService;
|
||||
import jnpf.entity.workflow.ApplyAttendanceViolation;
|
||||
import jnpf.model.workflow.dto.ApplyAttendanceViolationDto;
|
||||
|
||||
/**
|
||||
* 违规打卡审批服务
|
||||
*
|
||||
* @author yanwenfu
|
||||
* @create 2025-09-22
|
||||
*/
|
||||
public interface ApplyAttendanceViolationService extends SuperService<ApplyAttendanceViolation> {
|
||||
|
||||
/**
|
||||
* 新建违规打卡审批申请
|
||||
* @param applyAttendanceViolationDto 违规打卡dto
|
||||
*/
|
||||
void saveRecord(ApplyAttendanceViolationDto applyAttendanceViolationDto) throws Exception;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package jnpf.workflow.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 审批图片服务
|
||||
*
|
||||
* @author yanwenfu
|
||||
* @create 2025-09-22
|
||||
*/
|
||||
public interface ApplyPicService {
|
||||
|
||||
/**
|
||||
* 获取图片数组
|
||||
* 前端给的值为[List<String>], 所以需要再转换
|
||||
* @param picUrlList 图片路径数组
|
||||
* @return java.util.List<java.lang.String>
|
||||
*/
|
||||
List<String> getPicList(List<String> picUrlList);
|
||||
|
||||
/**
|
||||
* 保存图片
|
||||
* @param taskId 任务id
|
||||
* @param urlList 图片列表
|
||||
*/
|
||||
void saveClockPic(String taskId, List<String> urlList);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package jnpf.workflow.service;
|
||||
|
||||
import jnpf.base.service.SuperService;
|
||||
import jnpf.entity.workflow.AttendanceBusinessTripApprove;
|
||||
import jnpf.model.workflow.dto.AttendanceBusinessTripApproveDto;
|
||||
import jnpf.model.workflow.dto.AttendanceBusinessTripApproveOaDto;
|
||||
import jnpf.model.workflow.vo.AttendanceBusinessTripApproveVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author huanglinpan
|
||||
* @Date 2024/5/14 18:33
|
||||
* @Version 1.0 (版本号)
|
||||
*/
|
||||
public interface BusinessTripApproveService extends SuperService<AttendanceBusinessTripApprove> {
|
||||
|
||||
void save(String id, AttendanceBusinessTripApprove entity, AttendanceBusinessTripApproveDto dto);
|
||||
|
||||
|
||||
void submit(String id, AttendanceBusinessTripApprove entity, AttendanceBusinessTripApproveDto dto);
|
||||
|
||||
|
||||
AttendanceBusinessTripApproveVo getOne(String id);
|
||||
|
||||
/**
|
||||
* 批量获取出差申请记录
|
||||
*
|
||||
* @param groupIds 考勤组ID
|
||||
* @param ids 出差申请ID
|
||||
*/
|
||||
List<AttendanceBusinessTripApprove> getBatchByIds(List<String> groupIds, List<String> ids);
|
||||
|
||||
void saveForOa(AttendanceBusinessTripApproveOaDto approveOaDto);
|
||||
|
||||
void submitForOa(String id, AttendanceBusinessTripApproveOaDto approveOaDto);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package jnpf.workflow.service;
|
||||
|
||||
import jnpf.engine.vo.ApproverByTaskIdAndNodeIdVo;
|
||||
|
||||
/**
|
||||
* 工作流服务
|
||||
*
|
||||
* @author yanwenfu
|
||||
* @create 2024-08-19
|
||||
*/
|
||||
public interface FlowTaskService {
|
||||
|
||||
/**
|
||||
* 查询下一个节点审批信息
|
||||
* @param taskId 任务id
|
||||
* @param nodeId 节点id
|
||||
* @param tenantId 租户id
|
||||
* @param type 类型 0 :不需要校验userOperators对象审核通过时使用 其他:默认需要校验
|
||||
* @return jnpf.engine.vo.ApproverByTaskIdAndNodeIdVo
|
||||
*/
|
||||
ApproverByTaskIdAndNodeIdVo getApproveInfo(String taskId, String nodeId, String tenantId, Integer type);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package jnpf.workflow.service;
|
||||
|
||||
import jnpf.base.service.SuperService;
|
||||
import jnpf.entity.workflow.AttendanceGoOutApprove;
|
||||
import jnpf.model.attendance.dto.GoOutApproveForOaDto;
|
||||
import jnpf.model.workflow.dto.AttendanceGoOutApproveDto;
|
||||
import jnpf.model.workflow.vo.AttendanceGoOutApproveVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author huanglinpan
|
||||
* @Date 2024/5/14 18:32
|
||||
* @Version 1.0 (版本号)
|
||||
*/
|
||||
public interface GoOutApproveService extends SuperService<AttendanceGoOutApprove> {
|
||||
|
||||
void save(String id, AttendanceGoOutApprove entity, AttendanceGoOutApproveDto dto);
|
||||
|
||||
|
||||
void submit(String id, AttendanceGoOutApprove entity, AttendanceGoOutApproveDto dto);
|
||||
|
||||
|
||||
AttendanceGoOutApproveVo getOne(String id);
|
||||
|
||||
/**
|
||||
* 批量获取外出申请记录
|
||||
*
|
||||
* @param groupIds 考勤组ID
|
||||
* @param ids 申请记录ID
|
||||
* @return 外出申请记录 key=用户ID+考勤组ID
|
||||
*/
|
||||
List<AttendanceGoOutApprove> getBatchByIds(List<String> groupIds, List<String> ids);
|
||||
|
||||
void saveForOa(GoOutApproveForOaDto dto);
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package jnpf.workflow.service;
|
||||
|
||||
import jnpf.base.service.SuperService;
|
||||
import jnpf.entity.workflow.AttendanceLeaveApprove;
|
||||
import jnpf.model.attendance.dto.LeaveApproveForOaDto;
|
||||
import jnpf.model.workflow.dto.AttendanceLeaveApproveDto;
|
||||
import jnpf.model.workflow.vo.AttendanceLeaveFlowApproveVo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface LeaveApproveService extends SuperService<AttendanceLeaveApprove> {
|
||||
|
||||
/**
|
||||
* 新增审批记录
|
||||
*
|
||||
* @param id 审批id
|
||||
* @param entity 实体
|
||||
* @param attendanceLeaveApproveDto 请假dto
|
||||
*/
|
||||
void save(String id, AttendanceLeaveApprove entity, AttendanceLeaveApproveDto attendanceLeaveApproveDto);
|
||||
|
||||
/**
|
||||
* 提交审批记录
|
||||
*
|
||||
* @param id 审批id
|
||||
* @param entity 实体
|
||||
* @param attendanceLeaveApproveDto 请假dto
|
||||
*/
|
||||
void submit(String id, AttendanceLeaveApprove entity, AttendanceLeaveApproveDto attendanceLeaveApproveDto);
|
||||
|
||||
/**
|
||||
* 通过请假id获取请假详情
|
||||
*
|
||||
* @param id 请假id
|
||||
* @return jnpf.model.workflow.vo.AttendanceLeaveFlowApproveVo
|
||||
* @author hlp
|
||||
*/
|
||||
AttendanceLeaveFlowApproveVo getAttendanceLeave(String id);
|
||||
|
||||
void saveForOa(LeaveApproveForOaDto dto);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package jnpf.workflow.service;
|
||||
|
||||
|
||||
import jnpf.base.service.SuperService;
|
||||
import jnpf.entity.workflow.PunishmentsApproval;
|
||||
import jnpf.model.workflow.dto.PunishmentsApprovalDto;
|
||||
import jnpf.model.workflow.vo.PunishmentsApprovalVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @Author huanglinpan
|
||||
* @Date 2024/5/24 10:43
|
||||
* @Version 1.0 (版本号)
|
||||
*/
|
||||
public interface PunishmentsApprovalService extends SuperService<PunishmentsApproval> {
|
||||
void punishmentsApprove( String applyId, Integer status);
|
||||
|
||||
void savePunishments(String id, PunishmentsApproval entity, PunishmentsApprovalDto dto);
|
||||
|
||||
void submitPunishments(String id, PunishmentsApproval entity, PunishmentsApprovalDto dto);
|
||||
|
||||
PunishmentsApprovalVo getPunishments(String id);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package jnpf.workflow.service;
|
||||
|
||||
import jnpf.base.service.SuperService;
|
||||
import jnpf.entity.workflow.RewardApproval;
|
||||
import jnpf.model.workflow.dto.RewardApprovalDto;
|
||||
import jnpf.model.workflow.vo.AttendanceLeaveFlowApproveVo;
|
||||
import jnpf.model.workflow.vo.RewardApprovalVo;
|
||||
|
||||
/**
|
||||
* @Author huanglinpan
|
||||
* @Date 2024/5/21 17:25
|
||||
* @Version 1.0 (版本号)
|
||||
*/
|
||||
public interface RewardService extends SuperService<RewardApproval> {
|
||||
|
||||
|
||||
void saveReward(String id, RewardApproval entity, RewardApprovalDto dto);
|
||||
|
||||
|
||||
void submitReward(String id, RewardApproval entity, RewardApprovalDto dto);
|
||||
|
||||
|
||||
RewardApprovalVo getReward(String id);
|
||||
|
||||
void rewardApprove(String applyId, Integer status);
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package jnpf.workflow.service;
|
||||
|
||||
import jnpf.base.service.SuperService;
|
||||
import jnpf.entity.workflow.SelfApprove;
|
||||
import jnpf.model.workflow.dto.SelfApproveDto;
|
||||
import jnpf.model.workflow.vo.SelfApproveVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SelfApproveService extends SuperService<SelfApprove> {
|
||||
|
||||
/**
|
||||
* 新增借调审批记录
|
||||
* @param id 审批id
|
||||
* @param entity 实体
|
||||
* @param selfApproveDto dto
|
||||
*/
|
||||
void save(String id, SelfApprove entity, SelfApproveDto selfApproveDto);
|
||||
|
||||
/**
|
||||
* 提交借调审批记录
|
||||
* @param id 借调审批id
|
||||
* @param entity 实体
|
||||
* @param selfApproveDto 借调审批dto
|
||||
*/
|
||||
void submit(String id, SelfApprove entity, SelfApproveDto selfApproveDto);
|
||||
|
||||
/**
|
||||
* 通过借调审批id获取借调审批详情
|
||||
* @param id 借调审批id
|
||||
* @return jnpf.model.workflow.vo.AttendanceLeaveFlowApproveVo
|
||||
* @author hlp
|
||||
*/
|
||||
SelfApproveVo getAttendanceLeave(String id);
|
||||
|
||||
/**
|
||||
* oa收拢保存借调
|
||||
* @param entity
|
||||
*/
|
||||
void saveForOa(SelfApprove entity, List<String> userIds);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package jnpf.workflow.service;
|
||||
|
||||
import jnpf.base.service.SuperService;
|
||||
import jnpf.entity.workflow.AttendanceWorkOvertimeApprove;
|
||||
import jnpf.model.workflow.dto.AttendanceWorkOvertimeApproveDto;
|
||||
import jnpf.model.workflow.vo.AttendanceWorkOvertimeApproveVo;
|
||||
|
||||
public interface WorkOvertimeApproveService extends SuperService<AttendanceWorkOvertimeApprove> {
|
||||
/**
|
||||
* 新增加班记录
|
||||
* @param id 审批id
|
||||
* @param entity 实体
|
||||
* @param attendanceWorkOvertimeApproveDto 请假dto
|
||||
*/
|
||||
void save(String id, AttendanceWorkOvertimeApprove entity, AttendanceWorkOvertimeApproveDto attendanceWorkOvertimeApproveDto);
|
||||
|
||||
/**
|
||||
* 提交加班审批记录
|
||||
* @param id 加班审批id
|
||||
* @param entity 实体
|
||||
* @param attendanceWorkOvertimeApproveDto 加班dto
|
||||
*/
|
||||
void submit(String id, AttendanceWorkOvertimeApprove entity, AttendanceWorkOvertimeApproveDto attendanceWorkOvertimeApproveDto);
|
||||
|
||||
/**
|
||||
* 通过加班id获取加班详情
|
||||
* @param id 加班id
|
||||
* @return jnpf.model.workflow.vo.AttendanceLeaveFlowApproveVo
|
||||
* @author hlp
|
||||
*/
|
||||
AttendanceWorkOvertimeApproveVo getAttendanceLeave(String id);
|
||||
|
||||
/**
|
||||
* oa收拢保存加班审批
|
||||
* @param entity
|
||||
*/
|
||||
void saveForOa(AttendanceWorkOvertimeApprove entity);
|
||||
}
|
||||
@@ -0,0 +1,246 @@
|
||||
package jnpf.workflow.service.impl;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import jnpf.attendance.antifreeze.UserAntifreeze;
|
||||
import jnpf.attendance.bean.ChangeConfig;
|
||||
import jnpf.attendance.mapper.AttendanceClockInResultMapper;
|
||||
import jnpf.attendance.service.AttendanceClockInResultService;
|
||||
import jnpf.attendance.service.AttendanceDailyRuleService;
|
||||
import jnpf.attendance.service.handle.notice.AttendanceNoticeHandler;
|
||||
import jnpf.base.service.SuperServiceImpl;
|
||||
import jnpf.constants.AttendanceConstant;
|
||||
import jnpf.engine.vo.ApproverByTaskIdAndNodeIdVo;
|
||||
import jnpf.entity.attendance.AttendanceClockInResult;
|
||||
import jnpf.entity.attendance.FtbAttendanceDailyRule;
|
||||
import jnpf.entity.workflow.ApplyAttendanceChange;
|
||||
import jnpf.enums.attendance.ApprovalSettingTypeEnum;
|
||||
import jnpf.enums.attendance.AttendanceNoticeEnum;
|
||||
import jnpf.enums.attendance.ClockInStatusEnum;
|
||||
import jnpf.exception.QueryException;
|
||||
import jnpf.model.attendance.vo.attendance.ApproveBaseImVo;
|
||||
import jnpf.model.attendance.vo.attendance.ApproveImVo;
|
||||
import jnpf.model.attendance.vo.attendance.AttendanceApproveImVo;
|
||||
import jnpf.model.workflow.dto.ApplyAttendanceChangeDto;
|
||||
import jnpf.model.workflow.vo.ApplyAttendanceChangeVo;
|
||||
import jnpf.permission.UserApi;
|
||||
import jnpf.permission.model.user.BaseUserInfoVo;
|
||||
import jnpf.permission.model.user.PartUserInfoVo;
|
||||
import jnpf.util.*;
|
||||
import jnpf.workflow.mapper.ApplyAttendanceChangeMapper;
|
||||
import jnpf.workflow.service.ApplyAttendanceChangeService;
|
||||
import jnpf.workflow.service.FlowTaskService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
||||
/**
|
||||
* 出勤变更
|
||||
*
|
||||
* @author yanwenfu
|
||||
* @create 2023-12-11
|
||||
*/
|
||||
@Service
|
||||
public class ApplyAttendanceChangeServiceImpl extends SuperServiceImpl<ApplyAttendanceChangeMapper, ApplyAttendanceChange> implements ApplyAttendanceChangeService {
|
||||
@Resource
|
||||
private AttendanceClockInResultService attendanceClockInResultService;
|
||||
@Resource
|
||||
private AttendanceDailyRuleService attendanceDailyRuleService;
|
||||
@Resource
|
||||
private FlowTaskService flowTaskService;
|
||||
@Autowired
|
||||
private UserAntifreeze userAntifreeze;
|
||||
@Autowired
|
||||
private UserApi userApi;
|
||||
@Autowired
|
||||
private AttendanceNoticeHandler attendanceNoticeHandler;
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
@Resource
|
||||
private CustomTenantUtil customTenantUtil;
|
||||
@Resource
|
||||
private ChangeConfig changeConfig;
|
||||
@Resource
|
||||
private AttendanceClockInResultMapper attendanceClockInResultMapper;
|
||||
|
||||
@Override
|
||||
public ApplyAttendanceChangeVo getApplyAttendanceChange(String id) {
|
||||
|
||||
ApplyAttendanceChange applyAttendanceChange = this.getById(id);
|
||||
return JsonUtil.getJsonToBean(applyAttendanceChange, ApplyAttendanceChangeVo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(ApplyAttendanceChange entity, ApplyAttendanceChangeDto applyAttendanceChangeDto) throws Exception {
|
||||
|
||||
int count = attendanceClockInResultMapper.getReplyingCount(applyAttendanceChangeDto.getClockInResultId());
|
||||
if (count > 0) {
|
||||
throw new QueryException("当前记录正在审批中,请审批结束后再重新执行操作");
|
||||
}
|
||||
//查询班次信息
|
||||
AttendanceClockInResult clockInResult = attendanceClockInResultService.lambdaQuery()
|
||||
.eq(AttendanceClockInResult::getId, applyAttendanceChangeDto.getClockInResultId())
|
||||
.eq(AttendanceClockInResult::getDeleteMark,0)
|
||||
.last("limit 1").one();
|
||||
if (null == clockInResult) {
|
||||
throw new QueryException("当天班次已变更,请重新发起!");
|
||||
}
|
||||
// 查询出勤规则
|
||||
FtbAttendanceDailyRule dailyRule = attendanceDailyRuleService.getById(clockInResult.getRuleId());
|
||||
if (null == dailyRule) {
|
||||
throw new QueryException("当天班次已变更,请重新发起!");
|
||||
}
|
||||
// 判定当前变更是否合法
|
||||
if (!applyAttendanceChangeDto.getChangeType().equals(ClockInStatusEnum.ROLLBACK.getValue())) {
|
||||
List<ClockInStatusEnum> clockInStatusEnums = changeConfig.getChangeMap().get(clockInResult.getClockInType()).get(ClockInStatusEnum.getClockInStatusEnum(clockInResult.getClockInStatus()));
|
||||
if (null == clockInStatusEnums || !clockInStatusEnums.contains(ClockInStatusEnum.getClockInStatusEnum(applyAttendanceChangeDto.getChangeType()))) {
|
||||
throw new Exception("无法变更为指定的状态");
|
||||
}
|
||||
}
|
||||
// 查询变更用户信息
|
||||
BaseUserInfoVo user = userApi.getUserInfoById(clockInResult.getUserId());
|
||||
entity.setChangeUserId(user.getUserId());
|
||||
entity.setChangeUserName(user.getUserName());
|
||||
entity.setApplyDate(new Date());
|
||||
// 变更结果为单个, 变更上班则将下班时间置空, 变更下班置空上班
|
||||
if (clockInResult.getClockInType().equals(ConstantUtil.ON_WORK)) {
|
||||
entity.setOnWorkTime(dailyRule.getInPoint());
|
||||
entity.setOffWorkTime(null);
|
||||
} else {
|
||||
entity.setOnWorkTime(null);
|
||||
entity.setOffWorkTime(dailyRule.getOutPoint());
|
||||
}
|
||||
entity.setId(applyAttendanceChangeDto.getTaskId());
|
||||
save(entity);
|
||||
updateClockInResult(entity.getId(), entity.getClockInResultId(), entity.getChangeType());
|
||||
//sendToIm(clockInResult.getClockInType(),entity, userProvider.get().getTenantId());
|
||||
}
|
||||
|
||||
private void updateClockInResult(String id, String clockInResultId, Integer changeType) {
|
||||
|
||||
AttendanceClockInResult clockInResult = attendanceClockInResultService.getById(clockInResultId);
|
||||
LambdaUpdateWrapper<AttendanceClockInResult> updateWrapper = new LambdaUpdateWrapper<AttendanceClockInResult>()
|
||||
.set(AttendanceClockInResult::getApplyType, ConstantUtil.APPLY_CHANGE)
|
||||
.set(AttendanceClockInResult::getApplyId, id)
|
||||
// .set(AttendanceClockInResult::getAbsenceLeader, userProvider.get().getUserId())
|
||||
.eq(AttendanceClockInResult::getDeleteMark, ConstantUtil.NUM_FALSE)
|
||||
.eq(AttendanceClockInResult::getId, clockInResult.getId());
|
||||
attendanceClockInResultService.update(updateWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void submit(String id, ApplyAttendanceChange entity, ApplyAttendanceChangeDto applyAttendanceChangeDto) {
|
||||
//查询班次信息
|
||||
AttendanceClockInResult clockInResult = attendanceClockInResultService.lambdaQuery()
|
||||
.eq(AttendanceClockInResult::getId, applyAttendanceChangeDto.getClockInResultId())
|
||||
.eq(AttendanceClockInResult::getDeleteMark,0)
|
||||
.last("limit 1").one();
|
||||
if (entity.getChangeType().equals(3) || entity.getChangeType().equals(4)) {
|
||||
if (clockInResult.getClockInType().equals(ConstantUtil.ON_WORK)) {
|
||||
entity.setOffWorkTime(null);
|
||||
} else {
|
||||
entity.setOnWorkTime(null);
|
||||
}
|
||||
}
|
||||
//表单信息
|
||||
if (StringUtil.isEmpty(entity.getId())) {
|
||||
entity.setId(id);
|
||||
save(entity);
|
||||
//sendToIm(clockInResult.getClockInType(), entity, userProvider.get().getTenantId());
|
||||
} else {
|
||||
entity.setId(id);
|
||||
updateById(entity);
|
||||
}
|
||||
updateClockInResult(entity.getId(), entity.getClockInResultId(), entity.getChangeType());
|
||||
}
|
||||
|
||||
private void sendToIm(Integer clockInType, ApplyAttendanceChange entity, String tenantId) {
|
||||
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
||||
scheduler.schedule(() -> {
|
||||
customTenantUtil.checkOutTenant(tenantId);
|
||||
ApproverByTaskIdAndNodeIdVo data = flowTaskService.getApproveInfo(entity.getId(), null, tenantId, null);
|
||||
if (null == data) {
|
||||
return;
|
||||
}
|
||||
AttendanceApproveImVo approveIm = JsonUtil.getJsonToBean(data, AttendanceApproveImVo.class);
|
||||
approveIm.setId(data.getTaskId());
|
||||
List<PartUserInfoVo> userList = userAntifreeze.getAllByIds(List.of(entity.getCreatorUserId()), tenantId);
|
||||
PartUserInfoVo userInfo = userList.stream().findFirst().orElse(null);
|
||||
// 组装消息
|
||||
ApproveImVo approveImVo = new ApproveImVo(tenantId, AttendanceNoticeEnum.APPROVE);
|
||||
String content = "%s的【出勤变更】审批";
|
||||
String title = String.format(content, null != userInfo ? userInfo.getRealName() : "--");
|
||||
ApproveBaseImVo imDetail = new ApproveBaseImVo(title, ApprovalSettingTypeEnum.ACTION_RESULT.getCode(), entity.getChangeUserName(),
|
||||
getRuleTime(clockInType,entity), getResult(entity.getClockInResultId()), getChangeResult(entity.getChangeType()));
|
||||
data.getUserOperators().forEach(v -> {
|
||||
approveIm.setTaskId(v.getTaskOperatorId());
|
||||
approveImVo.setUserIds(List.of(v.getUserId()));
|
||||
String encode = FtbUtil.encodeJson(approveIm);
|
||||
String url = AttendanceConstant.APPROVE_URL + encode;
|
||||
imDetail.setUrl(url);
|
||||
approveImVo.setApproveBaseImVo(imDetail);
|
||||
attendanceNoticeHandler.send(approveImVo);
|
||||
redisUtil.insert(ConstantUtil.APPROVE_NOTICE_CHANGE + approveIm.getId(), JSONUtil.toJsonStr(approveImVo));
|
||||
});
|
||||
}, 1, TimeUnit.SECONDS);
|
||||
scheduler.shutdown();
|
||||
}
|
||||
|
||||
private String getChangeResult(Integer changeType) {
|
||||
|
||||
switch (changeType) {
|
||||
case 1:
|
||||
return "旷工";
|
||||
case 2:
|
||||
return "撤销旷工";
|
||||
case 3:
|
||||
return "正常";
|
||||
case 4:
|
||||
return "补卡";
|
||||
default:
|
||||
return "--";
|
||||
}
|
||||
}
|
||||
|
||||
private String getRuleTime(Integer clockInType, ApplyAttendanceChange entity) {
|
||||
switch (entity.getChangeType()) {
|
||||
case 1:
|
||||
case 2:
|
||||
return DateDetail.getDate2Str(entity.getOnWorkTime(), DateDetail.DF9) + "-" + DateDetail.getDate2Str(entity.getOffWorkTime(), DateDetail.DF10);
|
||||
case 3:
|
||||
case 4:
|
||||
return clockInType.equals(ConstantUtil.ON_WORK)? DateDetail.getDate2Str(entity.getOnWorkTime(), DateDetail.DF9):DateDetail.getDate2Str(entity.getOffWorkTime(), DateDetail.DF9);
|
||||
default:
|
||||
return "变更类型不正确";
|
||||
}
|
||||
}
|
||||
|
||||
private String getResult(String resultId) {
|
||||
|
||||
AttendanceClockInResult clockInResult = attendanceClockInResultService.getById(resultId);
|
||||
if (null != clockInResult.getAbsence() && clockInResult.getAbsence().equals(ConstantUtil.NUM_TRUE)) {
|
||||
return ClockInStatusEnum.ABSENCE.getDescription();
|
||||
} else {
|
||||
switch (clockInResult.getClockInStatus()) {
|
||||
case -1:
|
||||
return ClockInStatusEnum.NO_CLOCK.getDescription();
|
||||
case 1:
|
||||
return ClockInStatusEnum.NORMAL.getDescription();
|
||||
case 2:
|
||||
return ClockInStatusEnum.WORK_LATE.getDescription();
|
||||
case 3:
|
||||
return ClockInStatusEnum.HOME_EARLY.getDescription();
|
||||
default:
|
||||
return "--";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
package jnpf.workflow.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import jnpf.attendance.antifreeze.UserAntifreeze;
|
||||
import jnpf.attendance.service.AttendanceClockInPicService;
|
||||
import jnpf.attendance.service.AttendanceClockInService;
|
||||
import jnpf.attendance.service.handle.notice.AttendanceNoticeHandler;
|
||||
import jnpf.base.UserInfo;
|
||||
import jnpf.base.service.SuperServiceImpl;
|
||||
import jnpf.constants.AttendanceConstant;
|
||||
import jnpf.engine.vo.ApproverByTaskIdAndNodeIdVo;
|
||||
import jnpf.entity.attendance.AttendanceClockInPic;
|
||||
import jnpf.entity.workflow.ApplyAttendanceOutside;
|
||||
import jnpf.enums.attendance.ApprovalSettingTypeEnum;
|
||||
import jnpf.enums.attendance.AttendanceNoticeEnum;
|
||||
import jnpf.model.attendance.vo.attendance.ApproveBaseImVo;
|
||||
import jnpf.model.attendance.vo.attendance.ApproveImVo;
|
||||
import jnpf.model.attendance.vo.attendance.AttendanceApproveImVo;
|
||||
import jnpf.model.workflow.dto.ApplyAttendanceOutsideDto;
|
||||
import jnpf.model.workflow.vo.ApplyAttendanceOutsideVo;
|
||||
import jnpf.permission.model.user.PartUserInfoVo;
|
||||
import jnpf.util.*;
|
||||
import jnpf.workflow.mapper.ApplyAttendanceOutsideMapper;
|
||||
import jnpf.workflow.service.ApplyAttendanceOutsideService;
|
||||
import jnpf.workflow.service.ApplyPicService;
|
||||
import jnpf.workflow.service.FlowTaskService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 外勤审批服务实现
|
||||
*
|
||||
* @author yanwenfu
|
||||
* @create 2023-12-13
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ApplyAttendanceOutsideServiceImpl extends SuperServiceImpl<ApplyAttendanceOutsideMapper, ApplyAttendanceOutside> implements ApplyAttendanceOutsideService {
|
||||
|
||||
@Resource
|
||||
private FlowTaskService flowTaskService;
|
||||
@Autowired
|
||||
private UserAntifreeze userAntifreeze;
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
@Autowired
|
||||
private AttendanceNoticeHandler attendanceNoticeHandler;
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
@Resource
|
||||
private CustomTenantUtil customTenantUtil;
|
||||
@Resource
|
||||
private AttendanceClockInService attendanceClockInService;
|
||||
@Resource
|
||||
private ApplyPicService applyPicService;
|
||||
|
||||
@Override
|
||||
public ApplyAttendanceOutsideVo getApplyAttendanceOutside(String id) {
|
||||
|
||||
ApplyAttendanceOutside applyAttendanceOutside = this.getById(id);
|
||||
return JsonUtil.getJsonToBean(applyAttendanceOutside, ApplyAttendanceOutsideVo.class);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void save(ApplyAttendanceOutside entity, ApplyAttendanceOutsideDto applyAttendanceOutsideDto) throws Exception {
|
||||
log.error("发起外勤审批: {}", applyAttendanceOutsideDto.toString());
|
||||
//保存外勤打卡图片 picUrlList
|
||||
List<String> urlList = applyPicService.getPicList(applyAttendanceOutsideDto.getPicUrlList());
|
||||
if (!urlList.isEmpty()) {
|
||||
applyAttendanceOutsideDto.getPicUrlList().clear();
|
||||
applyAttendanceOutsideDto.getPicUrlList().addAll(urlList);
|
||||
}
|
||||
applyPicService.saveClockPic(applyAttendanceOutsideDto.getTaskId(), applyAttendanceOutsideDto.getPicUrlList());
|
||||
UserInfo userInfo = userProvider.get();
|
||||
entity.setApplyUser(userInfo.getUserId());
|
||||
entity.setApplyDate(DateDetail.getStr2DateTime(applyAttendanceOutsideDto.getApplyDateStr()));
|
||||
entity.setTenantId(userInfo.getTenantId());
|
||||
entity.setId(applyAttendanceOutsideDto.getTaskId());
|
||||
entity.setRemark(applyAttendanceOutsideDto.getRemark());
|
||||
save(entity);
|
||||
attendanceClockInService.outsideClockIn(applyAttendanceOutsideDto.getTaskId(), userInfo.getUserId(), applyAttendanceOutsideDto.getClockInId());
|
||||
}
|
||||
|
||||
private void sendToIm(ApplyAttendanceOutside entity, String tenantId) {
|
||||
|
||||
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
||||
scheduler.schedule(() -> {
|
||||
customTenantUtil.checkOutTenant(tenantId);
|
||||
ApproverByTaskIdAndNodeIdVo data = flowTaskService.getApproveInfo(entity.getId(), null, tenantId, null);
|
||||
if (null == data) {
|
||||
return;
|
||||
}
|
||||
AttendanceApproveImVo approveIm = JsonUtil.getJsonToBean(data, AttendanceApproveImVo.class);
|
||||
approveIm.setId(data.getTaskId());
|
||||
List<PartUserInfoVo> userList = userAntifreeze.getAllByIds(List.of(entity.getApplyUserId()), tenantId);
|
||||
PartUserInfoVo userInfo = userList.stream().findFirst().orElse(null);
|
||||
// 组装消息
|
||||
ApproveImVo approveImVo = new ApproveImVo(tenantId, AttendanceNoticeEnum.APPROVE);
|
||||
String content = "%s的【外勤】审批";
|
||||
String title = String.format(content, null != userInfo ? userInfo.getRealName() : "--");
|
||||
ApproveBaseImVo imDetail = new ApproveBaseImVo(title, ApprovalSettingTypeEnum.OUT.getCode(), entity.getCreatorTime(), entity.getAddress());
|
||||
data.getUserOperators().forEach(v -> {
|
||||
approveIm.setTaskId(v.getTaskOperatorId());
|
||||
approveImVo.setUserIds(List.of(v.getUserId()));
|
||||
String encode = FtbUtil.encodeJson(approveIm);
|
||||
String url = AttendanceConstant.APPROVE_URL + encode;
|
||||
imDetail.setUrl(url);
|
||||
approveImVo.setApproveBaseImVo(imDetail);
|
||||
attendanceNoticeHandler.send(approveImVo);
|
||||
redisUtil.insert(ConstantUtil.APPROVE_NOTICE_OUTSIDE + approveIm.getId(), JSONUtil.toJsonStr(approveImVo));
|
||||
});
|
||||
}, 1, TimeUnit.SECONDS);
|
||||
scheduler.shutdown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void submit(ApplyAttendanceOutside entity, ApplyAttendanceOutsideDto applyAttendanceOutsideDto) {
|
||||
//保存外勤打卡图片
|
||||
applyPicService.saveClockPic(applyAttendanceOutsideDto.getTaskId(), applyAttendanceOutsideDto.getPicUrlList());
|
||||
//表单信息
|
||||
if (StringUtil.isEmpty(entity.getId())) {
|
||||
entity.setId(applyAttendanceOutsideDto.getTaskId());
|
||||
save(entity);
|
||||
//sendToIm(entity, userProvider.get().getTenantId());
|
||||
} else {
|
||||
entity.setId(applyAttendanceOutsideDto.getTaskId());
|
||||
updateById(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,232 @@
|
||||
package jnpf.workflow.service.impl;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import jnpf.attendance.antifreeze.UserAntifreeze;
|
||||
import jnpf.attendance.mapper.AttendanceClockInResultMapper;
|
||||
import jnpf.attendance.mapper.AttendanceDailyRuleMapper;
|
||||
import jnpf.attendance.service.AttendanceClockInResultService;
|
||||
import jnpf.attendance.service.AttendanceClockInService;
|
||||
import jnpf.attendance.service.AttendanceDayStatisticsService;
|
||||
import jnpf.attendance.service.AttendanceRepairService;
|
||||
import jnpf.attendance.service.handle.notice.AttendanceNoticeHandler;
|
||||
import jnpf.base.UserInfo;
|
||||
import jnpf.base.service.SuperServiceImpl;
|
||||
import jnpf.constants.AttendanceConstant;
|
||||
import jnpf.engine.vo.ApproverByTaskIdAndNodeIdVo;
|
||||
import jnpf.entity.attendance.AttendanceClockInResult;
|
||||
import jnpf.entity.attendance.AttendanceRepair;
|
||||
import jnpf.entity.attendance.FtbAttendanceDailyRule;
|
||||
import jnpf.entity.workflow.ApplyAttendanceRepair;
|
||||
import jnpf.enums.attendance.ApprovalSettingTypeEnum;
|
||||
import jnpf.enums.attendance.AttendanceNoticeEnum;
|
||||
import jnpf.enums.attendance.ClockInStatusEnum;
|
||||
import jnpf.exception.HandleException;
|
||||
import jnpf.exception.QueryException;
|
||||
import jnpf.model.attendance.vo.AttendanceRuleVo;
|
||||
import jnpf.model.attendance.vo.GroupRuleVo;
|
||||
import jnpf.model.attendance.vo.attendance.ApproveBaseImVo;
|
||||
import jnpf.model.attendance.vo.attendance.ApproveImVo;
|
||||
import jnpf.model.attendance.vo.attendance.AttendanceApproveImVo;
|
||||
import jnpf.model.workflow.dto.ApplyAttendanceRepairDto;
|
||||
import jnpf.model.workflow.vo.ApplyAttendanceRepairVo;
|
||||
import jnpf.permission.model.user.PartUserInfoVo;
|
||||
import jnpf.util.*;
|
||||
import jnpf.workflow.mapper.ApplyAttendanceRepairMapper;
|
||||
import jnpf.workflow.service.ApplyAttendanceRepairService;
|
||||
import jnpf.workflow.service.FlowTaskService;
|
||||
import org.apache.commons.lang3.tuple.MutablePair;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 补卡审批服务实现
|
||||
*
|
||||
* @author yanwenfu
|
||||
* @create 2023-12-13
|
||||
*/
|
||||
@Service
|
||||
public class ApplyAttendanceRepairServiceImpl extends SuperServiceImpl<ApplyAttendanceRepairMapper, ApplyAttendanceRepair> implements ApplyAttendanceRepairService {
|
||||
|
||||
@Resource
|
||||
private AttendanceClockInResultService attendanceClockInResultService;
|
||||
@Resource
|
||||
private AttendanceClockInResultMapper attendanceClockInResultMapper;
|
||||
@Resource
|
||||
private AttendanceClockInService attendanceClockInService;
|
||||
@Resource
|
||||
private AttendanceDayStatisticsService attendanceDayStatisticsService;
|
||||
@Resource
|
||||
private AttendanceDailyRuleMapper attendanceDailyRuleMapper;
|
||||
@Resource
|
||||
private AttendanceRepairService attendanceRepairService;
|
||||
@Resource
|
||||
private FlowTaskService flowTaskService;
|
||||
@Autowired
|
||||
private UserAntifreeze userAntifreeze;
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
@Autowired
|
||||
private AttendanceNoticeHandler attendanceNoticeHandler;
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
@Resource
|
||||
private CustomTenantUtil customTenantUtil;
|
||||
|
||||
@Override
|
||||
public ApplyAttendanceRepairVo getApplyAttendanceRepair(String id) {
|
||||
|
||||
ApplyAttendanceRepair applyAttendanceRepair = this.getById(id);
|
||||
return JsonUtil.getJsonToBean(applyAttendanceRepair, ApplyAttendanceRepairVo.class);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void save(ApplyAttendanceRepair entity, ApplyAttendanceRepairDto applyAttendanceRepairDto) throws Exception {
|
||||
|
||||
UserInfo userInfo = userProvider.get();
|
||||
// 提交前校验
|
||||
submitCheckRepair(entity.getClockInResultId());
|
||||
entity.setId(applyAttendanceRepairDto.getTaskId());
|
||||
entity.setApplyUser(userInfo.getUserId());
|
||||
entity.setApplyDate(new Date());
|
||||
entity.setTenantId(userInfo.getTenantId());
|
||||
setExtraValue(entity);
|
||||
save(entity);
|
||||
//sendToIm(entity, userInfo.getTenantId());
|
||||
// 表单信息
|
||||
/*if (StringUtil.isEmpty(entity.getId())) {
|
||||
entity.setId(id);
|
||||
save(entity);
|
||||
sendToIm(entity, userProvider.get().getTenantId());
|
||||
} else {
|
||||
entity.setId(id);
|
||||
updateById(entity);
|
||||
}*/
|
||||
}
|
||||
|
||||
private void submitCheckRepair(String clockInResultId) throws Exception {
|
||||
|
||||
// 判断当前出勤结果是否在进行别的审批
|
||||
int count = attendanceClockInResultMapper.getReplyingCount(clockInResultId);
|
||||
if (count > 0) {
|
||||
throw new QueryException("当前记录正在审批中,请审批结束后再重新执行操作");
|
||||
}
|
||||
AttendanceClockInResult clockInResult = attendanceClockInResultService.getById(clockInResultId);
|
||||
// 查询考勤规则
|
||||
AttendanceRuleVo rule = attendanceClockInService.getAttendanceRule(clockInResult.getRuleId());
|
||||
// 判定是否封账
|
||||
String monthDate = DateDetail.getDate2Str(rule.getDay(), DateDetail.DF15);
|
||||
Map<String, Boolean> map = attendanceDayStatisticsService.selectUserIsSeal(List.of(clockInResult.getUserId()), monthDate);
|
||||
if (map.get(clockInResult.getUserId())) {
|
||||
throw new HandleException(monthDate + "已封账,过去的考勤记录无法修改!");
|
||||
}
|
||||
// 用户补卡次数判定 (已使用次数 + 审批中的补卡)
|
||||
AttendanceRepair attendanceRepair = attendanceRepairService.getAttendanceRepair(rule.getUserId(), rule.getGroupId());
|
||||
String beginDate = String.format("%d-%02d-%02d", attendanceRepair.getGenerateYear(), attendanceRepair.getGenerateMonth(), attendanceRepair.getGenerateDay());
|
||||
String endDate = DateDetail.getDate2Str(attendanceRepair.getExpireDate(), DateDetail.DF);
|
||||
int applyCount = attendanceClockInResultMapper.selectRepairApplyCount(rule.getUserId(), rule.getGroupId(), beginDate, endDate);
|
||||
if (attendanceRepair.getRepairNum() - applyCount <= 0) {
|
||||
throw new QueryException("当前暂无补卡次数");
|
||||
}
|
||||
}
|
||||
|
||||
private void setExtraValue(ApplyAttendanceRepair entity) {
|
||||
// 根据打卡结果id查询打卡结果
|
||||
AttendanceClockInResult clockInResult = attendanceClockInResultService.getById(entity.getClockInResultId());
|
||||
LambdaUpdateWrapper<AttendanceClockInResult> updateWrapper = new LambdaUpdateWrapper<AttendanceClockInResult>()
|
||||
.eq(AttendanceClockInResult::getId, clockInResult.getId())
|
||||
.set(AttendanceClockInResult::getApplyType, ConstantUtil.APPLY_REPAIR)
|
||||
.set(AttendanceClockInResult::getApplyId, entity.getId());
|
||||
// .set(AttendanceClockInResult::getAbsenceLeader, userProvider.get().getUserId());
|
||||
attendanceClockInResultService.update(updateWrapper);
|
||||
// 查询出勤规则
|
||||
FtbAttendanceDailyRule dailyRule = attendanceDailyRuleMapper.selectById(clockInResult.getRuleId());
|
||||
Date date;
|
||||
if (clockInResult.getClockInType().equals(ConstantUtil.ON_WORK)) {
|
||||
date = dailyRule.getInPoint();
|
||||
} else {
|
||||
date = dailyRule.getOutPoint();
|
||||
}
|
||||
entity.setRepairDateStr(DateDetail.getDate2Str(date, DateDetail.DF));
|
||||
entity.setRepairTimeStr(DateDetail.getDate2Str(date, DateDetail.DF10));
|
||||
entity.setClockInStatus(clockInResult.getClockInStatus());
|
||||
entity.setAbsence(clockInResult.getAbsence());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void submit(String id, ApplyAttendanceRepair entity, ApplyAttendanceRepairDto applyAttendanceRepairDto) {
|
||||
|
||||
setExtraValue(entity);
|
||||
//表单信息
|
||||
if (StringUtil.isEmpty(entity.getId())) {
|
||||
entity.setId(id);
|
||||
save(entity);
|
||||
//sendToIm(entity, userProvider.get().getTenantId());
|
||||
} else {
|
||||
entity.setId(id);
|
||||
updateById(entity);
|
||||
}
|
||||
}
|
||||
|
||||
private void sendToIm(ApplyAttendanceRepair entity, String tenantId) {
|
||||
|
||||
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
||||
scheduler.schedule(() -> {
|
||||
customTenantUtil.checkOutTenant(tenantId);
|
||||
ApproverByTaskIdAndNodeIdVo data = flowTaskService.getApproveInfo(entity.getId(), null, tenantId,null);
|
||||
if (null == data) {
|
||||
return;
|
||||
}
|
||||
AttendanceApproveImVo approveIm = JsonUtil.getJsonToBean(data, AttendanceApproveImVo.class);
|
||||
approveIm.setId(data.getTaskId());
|
||||
List<PartUserInfoVo> userList = userAntifreeze.getAllByIds(List.of(entity.getCreatorUserId()), tenantId);
|
||||
PartUserInfoVo userInfo = userList.stream().findFirst().orElse(null);
|
||||
// 组装消息
|
||||
ApproveImVo approveImVo = new ApproveImVo(tenantId, AttendanceNoticeEnum.APPROVE);
|
||||
String content = "%s的【补卡】审批";
|
||||
String title = String.format(content, null != userInfo ? userInfo.getRealName() : "--");
|
||||
ApproveBaseImVo imDetail = new ApproveBaseImVo(title, ApprovalSettingTypeEnum.ROUTINE.getCode(), entity.getRepairDateStr() + " " + entity.getRepairTimeStr(), getResult(entity.getClockInStatus(), entity.getAbsence()));
|
||||
data.getUserOperators().forEach(v -> {
|
||||
approveIm.setTaskId(v.getTaskOperatorId());
|
||||
approveImVo.setUserIds(List.of(v.getUserId()));
|
||||
String encode = FtbUtil.encodeJson(approveIm);
|
||||
String url = AttendanceConstant.APPROVE_URL + encode;
|
||||
imDetail.setUrl(url);
|
||||
approveImVo.setApproveBaseImVo(imDetail);
|
||||
String key = ConstantUtil.APPROVE_NOTICE_REPAIR + approveIm.getId();
|
||||
redisUtil.insert(key, JSONUtil.toJsonStr(approveImVo));
|
||||
attendanceNoticeHandler.send(approveImVo);
|
||||
});
|
||||
}, 1, TimeUnit.SECONDS);
|
||||
scheduler.shutdown();
|
||||
}
|
||||
|
||||
private String getResult(Integer clockInStatus, Integer absence) {
|
||||
|
||||
if (null != absence && absence.equals(ConstantUtil.NUM_TRUE)) {
|
||||
return ClockInStatusEnum.ABSENCE.getDescription();
|
||||
} else {
|
||||
switch (clockInStatus) {
|
||||
case -1:
|
||||
return ClockInStatusEnum.NO_CLOCK.getDescription();
|
||||
case 2:
|
||||
return ClockInStatusEnum.WORK_LATE.getDescription();
|
||||
case 3:
|
||||
return ClockInStatusEnum.HOME_EARLY.getDescription();
|
||||
default:
|
||||
return "--";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package jnpf.workflow.service.impl;
|
||||
|
||||
import jnpf.attendance.service.AttendanceClockInService;
|
||||
import jnpf.base.UserInfo;
|
||||
import jnpf.base.service.SuperServiceImpl;
|
||||
import jnpf.entity.workflow.ApplyAttendanceViolation;
|
||||
import jnpf.enums.attendance.ApplyTypeEnum;
|
||||
import jnpf.model.attendance.dto.ClockInDto;
|
||||
import jnpf.model.workflow.dto.ApplyAttendanceViolationDto;
|
||||
import jnpf.util.ConstantUtil;
|
||||
import jnpf.util.DateDetail;
|
||||
import jnpf.util.JsonUtil;
|
||||
import jnpf.util.UserProvider;
|
||||
import jnpf.workflow.mapper.ApplyAttendanceViolationMapper;
|
||||
import jnpf.workflow.service.ApplyAttendanceViolationService;
|
||||
import jnpf.workflow.service.ApplyPicService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.tuple.MutablePair;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 违规打卡审批服务实现
|
||||
*
|
||||
* @author yanwenfu
|
||||
* @create 2025-09-22
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ApplyAttendanceViolationServiceImpl extends SuperServiceImpl<ApplyAttendanceViolationMapper, ApplyAttendanceViolation> implements ApplyAttendanceViolationService {
|
||||
|
||||
@Resource
|
||||
private ApplyPicService applyPicService;
|
||||
@Resource
|
||||
private AttendanceClockInService attendanceClockInService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveRecord(ApplyAttendanceViolationDto dto) throws Exception {
|
||||
|
||||
ApplyAttendanceViolation entity = JsonUtil.getJsonToBean(dto, ApplyAttendanceViolation.class);
|
||||
entity.setStatus(ConstantUtil.STATUS_PENDING_APPROVAL);
|
||||
log.error("发起异常打卡审批: 任务id: {}, 打卡类型: {}", dto.getTaskId(), dto.getClockInKind());
|
||||
//保存外勤打卡图片 picUrlList
|
||||
List<String> urlList = applyPicService.getPicList(dto.getPicUrlList());
|
||||
if (!urlList.isEmpty()) {
|
||||
dto.getPicUrlList().clear();
|
||||
dto.getPicUrlList().addAll(urlList);
|
||||
}
|
||||
applyPicService.saveClockPic(dto.getTaskId(), dto.getPicUrlList());
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
entity.setApplyUser(userInfo.getUserId());
|
||||
entity.setApplyDate(DateDetail.getStr2DateTime(dto.getApplyDateStr()));
|
||||
entity.setTenantId(userInfo.getTenantId());
|
||||
entity.setId(dto.getTaskId());
|
||||
entity.setRemark(dto.getRemark());
|
||||
ClockInDto clockInDto = new ClockInDto(dto.getDeviceType(), dto.getClockInKind(), dto.getTaskId(), ApplyTypeEnum.VIOLATION, dto.getAddress(), dto.getLng(), dto.getLat(), dto.getRemark());
|
||||
MutablePair<Integer, String> pair;
|
||||
if (StringUtils.isEmpty(dto.getClockInId())) {
|
||||
pair = attendanceClockInService.clockIn(clockInDto);
|
||||
} else {
|
||||
pair = attendanceClockInService.updateClockIn(dto.getClockInId(), clockInDto);
|
||||
}
|
||||
entity.setClockInResultId(pair.getRight());
|
||||
save(entity);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package jnpf.workflow.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import jnpf.attendance.service.AttendanceClockInPicService;
|
||||
import jnpf.entity.attendance.AttendanceClockInPic;
|
||||
import jnpf.util.FtbUtil;
|
||||
import jnpf.workflow.service.ApplyPicService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 审批图片服务实现
|
||||
*
|
||||
* @author yanwenfu
|
||||
* @create 2025-09-22
|
||||
*/
|
||||
@Service
|
||||
public class ApplyPicServiceImpl implements ApplyPicService {
|
||||
|
||||
@Resource
|
||||
private AttendanceClockInPicService attendanceClockInPicService;
|
||||
|
||||
@Override
|
||||
public List<String> getPicList(List<String> picUrlList) {
|
||||
|
||||
if (null != picUrlList && !picUrlList.isEmpty()) {
|
||||
String str = picUrlList.get(0);
|
||||
JSONArray array = new JSONArray(str);
|
||||
List<String> list = new ArrayList<>();
|
||||
array.forEach(v -> {
|
||||
JSONObject json = new JSONObject(v);
|
||||
Object o = json.get("previewUrl");
|
||||
if (null != o) {
|
||||
list.add(o.toString());
|
||||
}
|
||||
json.clear();
|
||||
});
|
||||
array.clear();
|
||||
return list;
|
||||
}
|
||||
return List.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveClockPic(String taskId, List<String> urlList) {
|
||||
|
||||
if (CollUtil.isNotEmpty(urlList)) {
|
||||
List<AttendanceClockInPic> picUrlList = CollUtil.newArrayList();
|
||||
picUrlList.addAll(urlList.stream().map(item -> {
|
||||
AttendanceClockInPic clickInPic = AttendanceClockInPic.builder()
|
||||
.approvalCode(taskId)
|
||||
.picUrl(item)
|
||||
.build();
|
||||
clickInPic.setId(FtbUtil.getId());
|
||||
return clickInPic;
|
||||
}).collect(Collectors.toList()));
|
||||
attendanceClockInPicService.remove(new LambdaQueryWrapper<AttendanceClockInPic>().eq(AttendanceClockInPic::getApprovalCode, taskId));
|
||||
attendanceClockInPicService.saveBatch(picUrlList);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
package jnpf.workflow.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import jnpf.attendance.antifreeze.UserAntifreeze;
|
||||
import jnpf.attendance.service.handle.notice.AttendanceNoticeHandler;
|
||||
import jnpf.base.service.SuperServiceImpl;
|
||||
import jnpf.constants.AttendanceConstant;
|
||||
import jnpf.engine.vo.ApproverByTaskIdAndNodeIdVo;
|
||||
import jnpf.entity.workflow.AttendanceBusinessTripApprove;
|
||||
import jnpf.enums.attendance.ApprovalSettingTypeEnum;
|
||||
import jnpf.enums.attendance.AttendanceNoticeEnum;
|
||||
import jnpf.model.attendance.vo.attendance.ApproveBaseImVo;
|
||||
import jnpf.model.attendance.vo.attendance.ApproveImVo;
|
||||
import jnpf.model.attendance.vo.attendance.AttendanceApproveImVo;
|
||||
import jnpf.model.workflow.dto.AttendanceBusinessTripApproveDto;
|
||||
import jnpf.model.workflow.dto.AttendanceBusinessTripApproveOaDto;
|
||||
import jnpf.model.workflow.vo.AttendanceBusinessTripApproveVo;
|
||||
import jnpf.permission.model.user.PartUserInfoVo;
|
||||
import jnpf.util.*;
|
||||
import jnpf.workflow.mapper.BusinessTripApproveMapper;
|
||||
import jnpf.workflow.service.BusinessTripApproveService;
|
||||
import jnpf.workflow.service.FlowTaskService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Author huanglinpan
|
||||
* @Date 2024/5/14 18:33
|
||||
* @Version 1.0 (版本号)
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class BusinessTripApproveServiceImpl extends SuperServiceImpl<BusinessTripApproveMapper, AttendanceBusinessTripApprove> implements BusinessTripApproveService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private UserAntifreeze userAntifreeze;
|
||||
|
||||
@Resource
|
||||
private FlowTaskService flowTaskService;
|
||||
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
|
||||
@Autowired
|
||||
private AttendanceNoticeHandler attendanceNoticeHandler;
|
||||
|
||||
@Resource
|
||||
private CustomTenantUtil customTenantUtil;
|
||||
|
||||
|
||||
@Override
|
||||
public void save(String id, AttendanceBusinessTripApprove entity, AttendanceBusinessTripApproveDto dto) {
|
||||
//表单信息
|
||||
if (StringUtil.isEmpty(entity.getId())) {
|
||||
entity.setId(id);
|
||||
save(entity);
|
||||
String tenantId = userProvider.get().getTenantId();
|
||||
new Thread(()->{
|
||||
// 睡眠1秒,确保事务提交完成
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
businessSendIm(entity,tenantId);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
|
||||
} else {
|
||||
entity.setId(id);
|
||||
updateById(entity);
|
||||
}
|
||||
}
|
||||
|
||||
private void businessSendIm(AttendanceBusinessTripApprove entity,String tenantId) {
|
||||
// 张三的【出差】审批
|
||||
// 出发地:地点名称地点名称地点名称地点名称
|
||||
// 目的地:地点名称地点名称地点名称地点名称
|
||||
customTenantUtil.checkOutTenant(tenantId);
|
||||
// 查询第一节点审批人
|
||||
ApproverByTaskIdAndNodeIdVo data = flowTaskService.getApproveInfo(entity.getId(), null, tenantId,null);
|
||||
if (null != data) {
|
||||
AttendanceApproveImVo jsonToBean = JsonUtil.getJsonToBean(data, AttendanceApproveImVo.class);
|
||||
jsonToBean.setId(data.getTaskId());
|
||||
List<PartUserInfoVo> allByIds = userAntifreeze.getAllByIds(CollUtil.newArrayList(entity.getUserId()), tenantId);
|
||||
PartUserInfoVo partUserInfoVo = allByIds.stream().findFirst().orElse(null);
|
||||
// 组装消息
|
||||
ApproveImVo approveImVo = new ApproveImVo();
|
||||
approveImVo.setTenantId(tenantId);
|
||||
approveImVo.setAttendanceNoticeEnum(AttendanceNoticeEnum.APPROVE);
|
||||
StringBuilder stringBuffer = new StringBuilder();
|
||||
if (!Objects.isNull(partUserInfoVo)) {
|
||||
stringBuffer.append(partUserInfoVo.getRealName());
|
||||
}
|
||||
ApproveBaseImVo approveBaseImVo = new ApproveBaseImVo();
|
||||
approveBaseImVo.setType(ApprovalSettingTypeEnum.BUSINESS_TRIP.getCode());
|
||||
approveBaseImVo.setDestination(entity.getDestination());
|
||||
approveBaseImVo.setDeparture(entity.getDeparture());
|
||||
approveBaseImVo.setTitle(stringBuffer.append("的【出差】审批").toString());
|
||||
data.getUserOperators().forEach(v->{
|
||||
// 每个人的这个Id不同,所以轮询触发
|
||||
jsonToBean.setTaskId(v.getTaskOperatorId());
|
||||
// URL 拼接
|
||||
// String encode = Base64Util.encode(JSONUtil.toJsonStr(jsonToBean));
|
||||
String encode = FtbUtil.encodeJson(jsonToBean);
|
||||
String url = AttendanceConstant.APPROVE_URL + encode;
|
||||
approveImVo.setUserIds(CollUtil.newArrayList(v.getUserId()));
|
||||
approveBaseImVo.setUrl(url);
|
||||
approveImVo.setApproveBaseImVo(approveBaseImVo);
|
||||
attendanceNoticeHandler.send(approveImVo);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void submit(String id, AttendanceBusinessTripApprove entity, AttendanceBusinessTripApproveDto dto) {
|
||||
//表单信息
|
||||
if (StringUtil.isEmpty(entity.getId())) {
|
||||
entity.setId(id);
|
||||
save(entity);
|
||||
String tenantId = userProvider.get().getTenantId();
|
||||
new Thread(()->{
|
||||
// 睡眠1秒,确保事务提交完成
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
businessSendIm(entity,tenantId);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
} else {
|
||||
entity.setId(id);
|
||||
updateById(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AttendanceBusinessTripApproveVo getOne(String id) {
|
||||
AttendanceBusinessTripApprove attendanceLeaveApprove = this.getById(id);
|
||||
return JsonUtil.getJsonToBean(attendanceLeaveApprove, AttendanceBusinessTripApproveVo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AttendanceBusinessTripApprove> getBatchByIds(List<String> groupIds, List<String> ids) {
|
||||
LambdaQueryWrapper<AttendanceBusinessTripApprove> queryWrapper = Wrappers.lambdaQuery();
|
||||
queryWrapper.in(AttendanceBusinessTripApprove::getId, ids);
|
||||
queryWrapper.in(CollUtil.isNotEmpty(groupIds), AttendanceBusinessTripApprove::getGroupId, groupIds);
|
||||
List<AttendanceBusinessTripApprove> list = this.list(queryWrapper);
|
||||
return CollUtil.isNotEmpty(list) ? list: new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveForOa(AttendanceBusinessTripApproveOaDto approveOaDto) {
|
||||
AttendanceBusinessTripApprove entity = JsonUtil.getJsonToBean(approveOaDto, AttendanceBusinessTripApprove.class);
|
||||
// 计算两个时间戳之间的日期差
|
||||
|
||||
log.error("FoeOa开始存数据库出差了参数................: {}", entity);
|
||||
save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void submitForOa(String id, AttendanceBusinessTripApproveOaDto approveOaDto) {
|
||||
AttendanceBusinessTripApprove entity = JsonUtil.getJsonToBean(approveOaDto, AttendanceBusinessTripApprove.class);
|
||||
log.error("FoeOa开始x修改数据库出差了参数................: {}", entity);
|
||||
entity.setId(id);
|
||||
updateById(entity);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package jnpf.workflow.service.impl;
|
||||
|
||||
import jnpf.engine.FlowTaskApi;
|
||||
import jnpf.engine.vo.ApproverByTaskIdAndNodeIdVo;
|
||||
import jnpf.workflow.service.FlowTaskService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 工作流服务实现
|
||||
*
|
||||
* @author yanwenfu
|
||||
* @create 2024-08-19
|
||||
*/
|
||||
@Service
|
||||
public class FlowTaskServiceImpl implements FlowTaskService {
|
||||
|
||||
@Resource
|
||||
private FlowTaskApi flowTaskApi;
|
||||
|
||||
@Override
|
||||
public ApproverByTaskIdAndNodeIdVo getApproveInfo(String taskId, String nodeId, String tenantId, Integer type) {
|
||||
|
||||
ApproverByTaskIdAndNodeIdVo vo = null;
|
||||
int index = 1;
|
||||
while (index <= 5) {
|
||||
try {
|
||||
index++;
|
||||
vo = flowTaskApi.getApproverByTaskIdAndNodeId(taskId, nodeId, tenantId).getData();
|
||||
if (null != type && type == 0 ){
|
||||
if (null != vo){
|
||||
break;
|
||||
}else {
|
||||
vo = null;
|
||||
Thread.sleep((long) index * 1000);
|
||||
}
|
||||
}else {
|
||||
if (null == vo || null == vo.getUserOperators() || vo.getUserOperators().isEmpty()) {
|
||||
vo = null;
|
||||
Thread.sleep((long) index * 1000);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
package jnpf.workflow.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import jnpf.attendance.antifreeze.UserAntifreeze;
|
||||
import jnpf.attendance.service.handle.notice.AttendanceNoticeHandler;
|
||||
import jnpf.base.service.SuperServiceImpl;
|
||||
import jnpf.constants.AttendanceConstant;
|
||||
import jnpf.engine.vo.ApproverByTaskIdAndNodeIdVo;
|
||||
import jnpf.entity.workflow.AttendanceGoOutApprove;
|
||||
import jnpf.enums.attendance.ApprovalSettingTypeEnum;
|
||||
import jnpf.enums.attendance.AttendanceNoticeEnum;
|
||||
import jnpf.model.attendance.dto.GoOutApproveForOaDto;
|
||||
import jnpf.model.attendance.vo.attendance.ApproveBaseImVo;
|
||||
import jnpf.model.attendance.vo.attendance.ApproveImVo;
|
||||
import jnpf.model.attendance.vo.attendance.AttendanceApproveImVo;
|
||||
import jnpf.model.workflow.dto.AttendanceGoOutApproveDto;
|
||||
import jnpf.model.workflow.vo.AttendanceGoOutApproveVo;
|
||||
import jnpf.permission.model.user.PartUserInfoVo;
|
||||
import jnpf.util.*;
|
||||
import jnpf.workflow.mapper.GoOutApproveMapper;
|
||||
import jnpf.workflow.service.FlowTaskService;
|
||||
import jnpf.workflow.service.GoOutApproveService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Author huanglinpan
|
||||
* @Date 2024/5/14 18:32
|
||||
* @Version 1.0 (版本号)
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class GoOutApproveServiceImpl extends SuperServiceImpl<GoOutApproveMapper, AttendanceGoOutApprove> implements GoOutApproveService {
|
||||
|
||||
@Autowired
|
||||
private UserAntifreeze userAntifreeze;
|
||||
|
||||
@Resource
|
||||
private FlowTaskService flowTaskService;
|
||||
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
|
||||
@Autowired
|
||||
private AttendanceNoticeHandler attendanceNoticeHandler;
|
||||
|
||||
@Resource
|
||||
private CustomTenantUtil customTenantUtil;
|
||||
|
||||
@Override
|
||||
public void save(String id, AttendanceGoOutApprove entity, AttendanceGoOutApproveDto dto) {
|
||||
//表单信息
|
||||
if (StringUtil.isEmpty(entity.getId())) {
|
||||
entity.setId(id);
|
||||
save(entity);
|
||||
String tenantId = userProvider.get().getTenantId();
|
||||
new Thread(() -> {
|
||||
// 睡眠1秒,确保事务提交完成
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
goOutSendIm(entity, tenantId);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
} else {
|
||||
entity.setId(id);
|
||||
updateById(entity);
|
||||
}
|
||||
}
|
||||
|
||||
private void goOutSendIm(AttendanceGoOutApprove entity, String tenantId) {
|
||||
//张三的【外出】审批
|
||||
//开始时间:2024年5月16日
|
||||
//结束时间:2024年5月17日
|
||||
//时长:2天
|
||||
customTenantUtil.checkOutTenant(tenantId);
|
||||
// 查询第一节点审批人
|
||||
ApproverByTaskIdAndNodeIdVo data = flowTaskService.getApproveInfo(entity.getId(), null, tenantId, null);
|
||||
if (null != data) {
|
||||
AttendanceApproveImVo jsonToBean = JsonUtil.getJsonToBean(data, AttendanceApproveImVo.class);
|
||||
jsonToBean.setId(data.getTaskId());
|
||||
List<PartUserInfoVo> allByIds = userAntifreeze.getAllByIds(CollUtil.newArrayList(entity.getUserId()), tenantId);
|
||||
PartUserInfoVo partUserInfoVo = allByIds.stream().findFirst().orElse(null);
|
||||
// 组装消息
|
||||
ApproveImVo approveImVo = new ApproveImVo();
|
||||
approveImVo.setTenantId(tenantId);
|
||||
approveImVo.setAttendanceNoticeEnum(AttendanceNoticeEnum.APPROVE);
|
||||
|
||||
ApproveBaseImVo approveBaseImVo = new ApproveBaseImVo();
|
||||
approveBaseImVo.setType(ApprovalSettingTypeEnum.GO_OUT.getCode());
|
||||
approveBaseImVo.setStartTime(entity.getStartTime());
|
||||
approveBaseImVo.setEndTime(entity.getEndTime());
|
||||
approveBaseImVo.setDuration(entity.getDayNum() + "天");
|
||||
StringBuilder stringBuffer = new StringBuilder();
|
||||
if (!Objects.isNull(partUserInfoVo)) {
|
||||
stringBuffer.append(partUserInfoVo.getRealName());
|
||||
}
|
||||
approveBaseImVo.setTitle(stringBuffer.append("的【外出】审批").toString());
|
||||
data.getUserOperators().forEach(v -> {
|
||||
// 每个人的这个Id不同,所以轮询触发
|
||||
jsonToBean.setTaskId(v.getTaskOperatorId());
|
||||
// URL 拼接
|
||||
// String encode = Base64Util.encode(JSONUtil.toJsonStr(jsonToBean));
|
||||
String encode = FtbUtil.encodeJson(jsonToBean);
|
||||
String url = AttendanceConstant.APPROVE_URL + encode;
|
||||
approveBaseImVo.setUrl(url);
|
||||
approveImVo.setUserIds(CollUtil.newArrayList(v.getUserId()));
|
||||
approveImVo.setApproveBaseImVo(approveBaseImVo);
|
||||
attendanceNoticeHandler.send(approveImVo);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void submit(String id, AttendanceGoOutApprove entity, AttendanceGoOutApproveDto dto) {
|
||||
//表单信息
|
||||
if (StringUtil.isEmpty(entity.getId())) {
|
||||
entity.setId(id);
|
||||
save(entity);
|
||||
String tenantId = userProvider.get().getTenantId();
|
||||
new Thread(() -> {
|
||||
// 睡眠1秒,确保事务提交完成
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
goOutSendIm(entity, tenantId);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
} else {
|
||||
entity.setId(id);
|
||||
updateById(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AttendanceGoOutApproveVo getOne(String id) {
|
||||
AttendanceGoOutApprove attendanceLeaveApprove = this.getById(id);
|
||||
return JsonUtil.getJsonToBean(attendanceLeaveApprove, AttendanceGoOutApproveVo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AttendanceGoOutApprove> getBatchByIds(List<String> groupIds, List<String> ids) {
|
||||
LambdaQueryWrapper<AttendanceGoOutApprove> queryWrapper = Wrappers.lambdaQuery();
|
||||
queryWrapper.in(AttendanceGoOutApprove::getId, ids);
|
||||
queryWrapper.in(CollUtil.isNotEmpty(groupIds), AttendanceGoOutApprove::getGroupId, groupIds);
|
||||
List<AttendanceGoOutApprove> list = this.list(queryWrapper);
|
||||
return CollUtil.isNotEmpty(list) ? list : new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveForOa(GoOutApproveForOaDto dto) {
|
||||
AttendanceGoOutApprove entity = JsonUtil.getJsonToBean(dto, AttendanceGoOutApprove.class);
|
||||
entity.setGroupId(dto.getGroupId());
|
||||
log.error("FoeOa开始存数据库出差了参数................: {}", entity);
|
||||
save(entity);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,196 @@
|
||||
package jnpf.workflow.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import jnpf.attendance.antifreeze.UserAntifreeze;
|
||||
import jnpf.attendance.service.AttendanceDailyRuleService;
|
||||
import jnpf.attendance.service.handle.notice.AttendanceNoticeHandler;
|
||||
import jnpf.base.service.SuperServiceImpl;
|
||||
import jnpf.constants.AttendanceConstant;
|
||||
import jnpf.engine.vo.ApproverByTaskIdAndNodeIdVo;
|
||||
import jnpf.entity.attendance.ApplyParam;
|
||||
import jnpf.entity.workflow.AttendanceGoOutApprove;
|
||||
import jnpf.entity.workflow.AttendanceLeaveApprove;
|
||||
import jnpf.enums.attendance.ApprovalSettingTypeEnum;
|
||||
import jnpf.enums.attendance.AttendanceNoticeEnum;
|
||||
import jnpf.enums.attendance.AttendanceTypeEnum;
|
||||
import jnpf.exception.HandleException;
|
||||
import jnpf.model.attendance.dto.LeaveApproveForOaDto;
|
||||
import jnpf.model.attendance.vo.DailyRuleResultVo;
|
||||
import jnpf.model.attendance.vo.attendance.ApproveBaseImVo;
|
||||
import jnpf.model.attendance.vo.attendance.ApproveImVo;
|
||||
import jnpf.model.attendance.vo.attendance.AttendanceApproveImVo;
|
||||
import jnpf.model.workflow.dto.AttendanceLeaveApproveDto;
|
||||
import jnpf.model.workflow.vo.AttendanceLeaveFlowApproveVo;
|
||||
import jnpf.permission.model.user.PartUserInfoVo;
|
||||
import jnpf.util.*;
|
||||
import jnpf.workflow.mapper.AttendanceLeaveMapper;
|
||||
import jnpf.workflow.service.FlowTaskService;
|
||||
import jnpf.workflow.service.LeaveApproveService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* describe
|
||||
*
|
||||
* @author HuangLinPan
|
||||
* @date 2023/12/11
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class LeaveApproveServiceImpl extends SuperServiceImpl<AttendanceLeaveMapper, AttendanceLeaveApprove> implements LeaveApproveService {
|
||||
@Autowired
|
||||
private UserAntifreeze userAntifreeze;
|
||||
|
||||
@Resource
|
||||
private FlowTaskService flowTaskService;
|
||||
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
|
||||
@Resource
|
||||
private AttendanceDailyRuleService attendanceDailyRuleService;
|
||||
|
||||
@Autowired
|
||||
private AttendanceNoticeHandler attendanceNoticeHandler;
|
||||
|
||||
@Resource
|
||||
private CustomTenantUtil customTenantUtil;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void save(String id, AttendanceLeaveApprove entity, AttendanceLeaveApproveDto attendanceLeaveApproveDto) {
|
||||
//表单信息
|
||||
if (StringUtil.isEmpty(entity.getId())) {
|
||||
entity.setId(id);
|
||||
save(entity);
|
||||
try {
|
||||
// 发送审批消息
|
||||
String tenantId = userProvider.get().getTenantId();
|
||||
new Thread(() -> {
|
||||
// 睡眠1秒,确保事务提交完成
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
leaveSendIm(entity, tenantId);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
} catch (Exception e) {
|
||||
log.error("发送请假审批消息通知第一级审批人失败", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
} else {
|
||||
entity.setId(id);
|
||||
updateById(entity);
|
||||
}
|
||||
}
|
||||
|
||||
private void leaveSendIm(AttendanceLeaveApprove entity, String tenantId) throws HandleException {
|
||||
customTenantUtil.checkOutTenant(tenantId);
|
||||
// 查询第一节点审批人
|
||||
ApproverByTaskIdAndNodeIdVo data = flowTaskService.getApproveInfo(entity.getId(), null, tenantId, null);
|
||||
if (null != data) {
|
||||
AttendanceApproveImVo jsonToBean = JsonUtil.getJsonToBean(data, AttendanceApproveImVo.class);
|
||||
jsonToBean.setId(data.getTaskId());
|
||||
List<DailyRuleResultVo> dailyRuleResultVos = attendanceDailyRuleService.applyVerifyHandle(new ApplyParam(entity.getUserId(), entity.getStartTime(), entity.getEndTime(), AttendanceTypeEnum.LEAVE));
|
||||
// 实时获取申请时长
|
||||
BigDecimal hours = new BigDecimal("0");
|
||||
for (DailyRuleResultVo dailyRuleResultVo : dailyRuleResultVos) {
|
||||
hours = hours.add(dailyRuleResultVo.getDuration());
|
||||
}
|
||||
List<PartUserInfoVo> allByIds = userAntifreeze.getAllByIds(CollUtil.newArrayList(entity.getUserId()), tenantId);
|
||||
PartUserInfoVo partUserInfoVo = allByIds.stream().findFirst().orElse(null);
|
||||
// 组装消息
|
||||
ApproveImVo approveImVo = new ApproveImVo();
|
||||
approveImVo.setTenantId(tenantId);
|
||||
approveImVo.setAttendanceNoticeEnum(AttendanceNoticeEnum.APPROVE);
|
||||
ApproveBaseImVo approveBaseImVo = new ApproveBaseImVo();
|
||||
approveBaseImVo.setType(ApprovalSettingTypeEnum.LEAVE.getCode());
|
||||
approveBaseImVo.setStartTime(entity.getStartTime());
|
||||
approveBaseImVo.setEndTime(entity.getEndTime());
|
||||
approveBaseImVo.setStartTimeType(entity.getStartTimeType());
|
||||
approveBaseImVo.setEndTimeType(entity.getEndTimeType());
|
||||
approveBaseImVo.setUnit(entity.getUnit());
|
||||
// 请假类型
|
||||
approveBaseImVo.setLeaveType(entity.getType());
|
||||
StringBuilder stringBuffer = new StringBuilder();
|
||||
if (!Objects.isNull(partUserInfoVo)) {
|
||||
stringBuffer.append(partUserInfoVo.getRealName());
|
||||
}
|
||||
approveBaseImVo.setTitle(stringBuffer.append("的【请假】审批").toString());
|
||||
data.getUserOperators().forEach(v -> {
|
||||
approveImVo.setUserIds(CollUtil.newArrayList(v.getUserId()));
|
||||
jsonToBean.setTaskId(v.getTaskOperatorId());
|
||||
// URL 拼接
|
||||
// String encode = Base64Util.encode(JSONUtil.toJsonStr(jsonToBean));
|
||||
String encode = FtbUtil.encodeJson(jsonToBean);
|
||||
String url = AttendanceConstant.APPROVE_URL + encode;
|
||||
approveBaseImVo.setUrl(url);
|
||||
approveImVo.setApproveBaseImVo(approveBaseImVo);
|
||||
attendanceNoticeHandler.send(approveImVo);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void submit(String id, AttendanceLeaveApprove entity, AttendanceLeaveApproveDto attendanceLeaveApproveDto) {
|
||||
//表单信息
|
||||
if (StringUtil.isEmpty(entity.getId())) {
|
||||
entity.setId(id);
|
||||
save(entity);
|
||||
try {
|
||||
// 发送审批消息
|
||||
String tenantId = userProvider.get().getTenantId();
|
||||
new Thread(() -> {
|
||||
// 睡眠1秒,确保事务提交完成
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
leaveSendIm(entity, tenantId);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
} catch (Exception e) {
|
||||
log.error("发送请假审批消息通知第一级审批人失败", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
} else {
|
||||
entity.setId(id);
|
||||
updateById(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AttendanceLeaveFlowApproveVo getAttendanceLeave(String id) {
|
||||
AttendanceLeaveApprove attendanceLeaveApprove = this.getById(id);
|
||||
AttendanceLeaveFlowApproveVo jsonToBean = JsonUtil.getJsonToBean(attendanceLeaveApprove, AttendanceLeaveFlowApproveVo.class);
|
||||
// 当审核未通过时动态取值
|
||||
// if (1 != jsonToBean.getStatus()){
|
||||
// 动态获取涉及班次/借调班次
|
||||
|
||||
// 实际使用余额/未抵扣余额/剩余余额(兑换券/抵扣劵)
|
||||
|
||||
|
||||
// }
|
||||
return jsonToBean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveForOa(LeaveApproveForOaDto dto) {
|
||||
AttendanceLeaveApprove entity = JsonUtil.getJsonToBean(dto, AttendanceLeaveApprove.class);
|
||||
entity.setUserId(JSONUtil.toList(dto.getApplyUser(), String.class).get(0));
|
||||
log.error("FoeOa开始存数据库请假参数................: {}", entity);
|
||||
save(entity);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package jnpf.workflow.service.impl;
|
||||
|
||||
import jnpf.base.service.SuperServiceImpl;
|
||||
import jnpf.entity.workflow.PunishmentsApproval;
|
||||
import jnpf.entity.workflow.RewardApproval;
|
||||
import jnpf.model.workflow.dto.PunishmentsApprovalDto;
|
||||
import jnpf.model.workflow.dto.UserSelfDto;
|
||||
import jnpf.model.workflow.vo.PunishmentsApprovalVo;
|
||||
import jnpf.model.workflow.vo.RewardApprovalVo;
|
||||
import jnpf.util.JsonUtil;
|
||||
import jnpf.util.StringUtil;
|
||||
import jnpf.workflow.mapper.PunishmentsApprovalMapper;
|
||||
import jnpf.workflow.service.PunishmentsApprovalService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.yaml.snakeyaml.events.Event;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author huanglinpan
|
||||
* @Date 2024/5/24 10:43
|
||||
* @Version 1.0 (版本号)
|
||||
*/
|
||||
@Service
|
||||
public class PunishmentsApprovalServiceImpl extends SuperServiceImpl<PunishmentsApprovalMapper, PunishmentsApproval> implements PunishmentsApprovalService {
|
||||
|
||||
@Resource
|
||||
private PunishmentsApprovalMapper punishmentsApprovalMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public void punishmentsApprove(String applyId, Integer status) {
|
||||
PunishmentsApproval punishmentsApproval = this.getById(applyId);
|
||||
punishmentsApproval.setStatus(status);
|
||||
if (1 == status){
|
||||
punishmentsApproval.setEffectiveDate(new Date());
|
||||
}
|
||||
updateById(punishmentsApproval);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void savePunishments(String id, PunishmentsApproval entity, PunishmentsApprovalDto dto) {
|
||||
if (StringUtil.isEmpty(entity.getId())) {
|
||||
entity.setId(id);
|
||||
save(entity);
|
||||
// 处理用户
|
||||
punishmentsApprovalMapper.saveUser(id,dto.getUserDtos());
|
||||
} else {
|
||||
entity.setId(id);
|
||||
updateById(entity);
|
||||
punishmentsApprovalMapper.deleteUserById(id);
|
||||
// 处理用户
|
||||
punishmentsApprovalMapper.saveUser(entity.getId(),dto.getUserDtos());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void submitPunishments(String id, PunishmentsApproval entity, PunishmentsApprovalDto dto) {
|
||||
if (StringUtil.isEmpty(entity.getId())) {
|
||||
entity.setId(id);
|
||||
save(entity);
|
||||
// 处理用户
|
||||
punishmentsApprovalMapper.saveUser(id,dto.getUserDtos());
|
||||
} else {
|
||||
entity.setId(id);
|
||||
updateById(entity);
|
||||
punishmentsApprovalMapper.deleteUserById(id);
|
||||
// 处理用户
|
||||
punishmentsApprovalMapper.saveUser(entity.getId(),dto.getUserDtos());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PunishmentsApprovalVo getPunishments(String id) {
|
||||
PunishmentsApproval punishmentsApproval = this.getById(id);
|
||||
PunishmentsApprovalVo jsonToBean = JsonUtil.getJsonToBean(punishmentsApproval, PunishmentsApprovalVo.class);
|
||||
// 拼接用户
|
||||
if (null != jsonToBean){
|
||||
List<UserSelfDto> userSelfDtos = punishmentsApprovalMapper.getListById(id);
|
||||
jsonToBean.setUserDtos(userSelfDtos);
|
||||
}
|
||||
return jsonToBean;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package jnpf.workflow.service.impl;
|
||||
|
||||
import jnpf.base.service.SuperServiceImpl;
|
||||
import jnpf.entity.workflow.AttendanceLeaveApprove;
|
||||
import jnpf.entity.workflow.RewardApproval;
|
||||
import jnpf.model.workflow.dto.RewardApprovalDto;
|
||||
import jnpf.model.workflow.dto.UserSelfDto;
|
||||
import jnpf.model.workflow.vo.AttendanceLeaveFlowApproveVo;
|
||||
import jnpf.model.workflow.vo.RewardApprovalVo;
|
||||
import jnpf.util.JsonUtil;
|
||||
import jnpf.util.StringUtil;
|
||||
import jnpf.workflow.mapper.AttendanceLeaveMapper;
|
||||
import jnpf.workflow.mapper.RewardApprovalMapper;
|
||||
import jnpf.workflow.service.LeaveApproveService;
|
||||
import jnpf.workflow.service.RewardService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author huanglinpan
|
||||
* @Date 2024/5/21 17:25
|
||||
* @Version 1.0 (版本号)
|
||||
*/
|
||||
@Service
|
||||
public class RewardServiceImpl extends SuperServiceImpl<RewardApprovalMapper, RewardApproval> implements RewardService {
|
||||
|
||||
@Resource
|
||||
private RewardApprovalMapper rewardApprovalMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public void saveReward(String id, RewardApproval entity, RewardApprovalDto dto) {
|
||||
if (StringUtil.isEmpty(entity.getId())) {
|
||||
entity.setId(id);
|
||||
save(entity);
|
||||
// 处理用户
|
||||
rewardApprovalMapper.saveUser(id,dto.getUserDtos());
|
||||
} else {
|
||||
entity.setId(id);
|
||||
updateById(entity);
|
||||
rewardApprovalMapper.deleteUserById(id);
|
||||
// 处理用户
|
||||
rewardApprovalMapper.saveUser(entity.getId(),dto.getUserDtos());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void submitReward(String id, RewardApproval entity, RewardApprovalDto dto) {
|
||||
if (StringUtil.isEmpty(entity.getId())) {
|
||||
entity.setId(id);
|
||||
save(entity);
|
||||
// 处理用户
|
||||
rewardApprovalMapper.saveUser(id,dto.getUserDtos());
|
||||
} else {
|
||||
entity.setId(id);
|
||||
updateById(entity);
|
||||
rewardApprovalMapper.deleteUserById(id);
|
||||
// 处理用户
|
||||
rewardApprovalMapper.saveUser(entity.getId(),dto.getUserDtos());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public RewardApprovalVo getReward(String id) {
|
||||
RewardApproval rewardApproval = this.getById(id);
|
||||
RewardApprovalVo jsonToBean = JsonUtil.getJsonToBean(rewardApproval, RewardApprovalVo.class);
|
||||
// 拼接用户
|
||||
if (null != jsonToBean){
|
||||
List<UserSelfDto> userSelfDtos = rewardApprovalMapper.getListById(id);
|
||||
jsonToBean.setUserDtos(userSelfDtos);
|
||||
}
|
||||
return jsonToBean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rewardApprove(String id, Integer status) {
|
||||
RewardApproval rewardApproval = this.getById(id);
|
||||
rewardApproval.setStatus(status);
|
||||
if (1 == status) {
|
||||
rewardApproval.setEffectiveDate(new Date());
|
||||
}
|
||||
//修改状态
|
||||
updateById(rewardApproval);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
package jnpf.workflow.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import jnpf.attendance.antifreeze.UserAntifreeze;
|
||||
import jnpf.attendance.service.AttendanceDailyRuleService;
|
||||
import jnpf.attendance.service.handle.notice.AttendanceNoticeHandler;
|
||||
import jnpf.base.service.SuperServiceImpl;
|
||||
import jnpf.constants.AttendanceConstant;
|
||||
import jnpf.engine.FlowTaskApi;
|
||||
import jnpf.engine.vo.ApproverByTaskIdAndNodeIdVo;
|
||||
import jnpf.entity.workflow.SelfApprove;
|
||||
import jnpf.enums.attendance.ApprovalSettingTypeEnum;
|
||||
import jnpf.enums.attendance.AttendanceNoticeEnum;
|
||||
import jnpf.model.attendance.dto.WorkflowImQueryDto;
|
||||
import jnpf.model.attendance.vo.AttendanceSelfApproveVo;
|
||||
import jnpf.model.attendance.vo.attendance.ApproveBaseImVo;
|
||||
import jnpf.model.attendance.vo.attendance.ApproveImVo;
|
||||
import jnpf.model.attendance.vo.attendance.AttendanceApproveImVo;
|
||||
import jnpf.model.workflow.dto.SelfApproveDto;
|
||||
import jnpf.model.workflow.dto.UserSelfDto;
|
||||
import jnpf.model.workflow.vo.SelfApproveVo;
|
||||
import jnpf.permission.model.user.PartUserInfoVo;
|
||||
import jnpf.util.*;
|
||||
import jnpf.workflow.mapper.SelfApproveMapper;
|
||||
import jnpf.workflow.mapper.SelfApproveUserMapper;
|
||||
import jnpf.workflow.service.FlowTaskService;
|
||||
import jnpf.workflow.service.SelfApproveService;
|
||||
import org.apache.logging.log4j.util.Base64Util;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* describe
|
||||
* 借调审批实现类
|
||||
* @author HuangLinPan
|
||||
* @date 2023/12/13
|
||||
*/
|
||||
@Service
|
||||
public class SelfApproveServiceImpl extends SuperServiceImpl<SelfApproveMapper, SelfApprove> implements SelfApproveService {
|
||||
|
||||
@Resource
|
||||
private SelfApproveUserMapper selfApproveUserMapper;
|
||||
|
||||
@Autowired
|
||||
private UserAntifreeze userAntifreeze;
|
||||
|
||||
@Resource
|
||||
private FlowTaskService flowTaskService;
|
||||
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
|
||||
@Autowired
|
||||
private AttendanceNoticeHandler attendanceNoticeHandler;
|
||||
@Resource
|
||||
private CustomTenantUtil customTenantUtil;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void save(String id, SelfApprove entity, SelfApproveDto selfApproveDto) {
|
||||
//表单信息
|
||||
if (StringUtil.isEmpty(entity.getId())) {
|
||||
entity.setId(id);
|
||||
save(entity);
|
||||
// 保存对应的用户集合
|
||||
// selfApproveUserMapper.addList(selfApproveDto.getUserIds(),id);
|
||||
selfApproveUserMapper.addUserList(selfApproveDto.getUserSelfDtos(),id);
|
||||
// 发送消息
|
||||
// String tenantId = userProvider.get().getTenantId();
|
||||
// new Thread(()->{
|
||||
// // 睡眠1秒,确保事务提交完成
|
||||
// try {
|
||||
// Thread.sleep(1000);
|
||||
// secondedSendIm(entity,tenantId);
|
||||
// } catch (InterruptedException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }).start();
|
||||
} else {
|
||||
entity.setId(id);
|
||||
updateById(entity);
|
||||
// 删除以前绑定的用户集合
|
||||
selfApproveUserMapper.deleteById(id);
|
||||
// 保存对应的用户集合
|
||||
// selfApproveUserMapper.addList(selfApproveDto.getUserIds(),id);
|
||||
selfApproveUserMapper.addUserList(selfApproveDto.getUserSelfDtos(),id);
|
||||
}
|
||||
}
|
||||
|
||||
private void secondedSendIm(SelfApprove entity,String tenantId) {
|
||||
//张三的【借调】审批
|
||||
//借调开始时间:2024年5月16日 16:23
|
||||
//借调结束时间:2024年5月17日 09:00
|
||||
//借调考勤组:小露测试考勤组
|
||||
//被借调考勤组:小露验收考勤组
|
||||
customTenantUtil.checkOutTenant(tenantId);
|
||||
// 查询第一节点审批人
|
||||
ApproverByTaskIdAndNodeIdVo data = flowTaskService.getApproveInfo(entity.getId(), null, tenantId,null);
|
||||
if (null != data) {
|
||||
AttendanceApproveImVo jsonToBean = JsonUtil.getJsonToBean(data, AttendanceApproveImVo.class);
|
||||
jsonToBean.setId(data.getTaskId());
|
||||
List<PartUserInfoVo> allByIds = userAntifreeze.getAllByIds(CollUtil.newArrayList(entity.getCreatorUserId()), tenantId);
|
||||
PartUserInfoVo partUserInfoVo = allByIds.stream().findFirst().orElse(null);
|
||||
// 组装消息
|
||||
ApproveImVo approveImVo = new ApproveImVo();
|
||||
approveImVo.setTenantId(tenantId);
|
||||
approveImVo.setAttendanceNoticeEnum(AttendanceNoticeEnum.APPROVE);
|
||||
ApproveBaseImVo approveBaseImVo = new ApproveBaseImVo();
|
||||
approveBaseImVo.setType(ApprovalSettingTypeEnum.SECONDED.getCode());
|
||||
approveBaseImVo.setStartTime(entity.getStartTime());
|
||||
approveBaseImVo.setEndTime(entity.getEndTime());
|
||||
approveBaseImVo.setGroupName(entity.getGroupName());
|
||||
approveBaseImVo.setSecondedGroupName(entity.getSelfGroupName());
|
||||
StringBuilder stringBuffer = new StringBuilder();
|
||||
if (!Objects.isNull(partUserInfoVo)) {
|
||||
stringBuffer.append(partUserInfoVo.getRealName());
|
||||
}
|
||||
approveBaseImVo.setTitle(stringBuffer.append("的【借调】审批").toString());
|
||||
data.getUserOperators().forEach(v->{
|
||||
approveImVo.setUserIds(CollUtil.newArrayList(v.getUserId()));
|
||||
jsonToBean.setTaskId(v.getTaskOperatorId());
|
||||
// URL 拼接
|
||||
// String encode = Base64Util.encode(JSONUtil.toJsonStr(jsonToBean));
|
||||
String encode = FtbUtil.encodeJson(jsonToBean);
|
||||
String url = AttendanceConstant.APPROVE_URL + encode;
|
||||
approveBaseImVo.setUrl(url);
|
||||
approveImVo.setApproveBaseImVo(approveBaseImVo);
|
||||
// 发送消息
|
||||
attendanceNoticeHandler.send(approveImVo);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void submit(String id, SelfApprove entity, SelfApproveDto selfApproveDto) {
|
||||
//表单信息
|
||||
if (StringUtil.isEmpty(entity.getId())) {
|
||||
entity.setId(id);
|
||||
save(entity);
|
||||
// 保存对应的用户集合
|
||||
// selfApproveUserMapper.addList(selfApproveDto.getUserIds(),id);
|
||||
selfApproveUserMapper.addUserList(selfApproveDto.getUserSelfDtos(),id);
|
||||
|
||||
// 发送消息
|
||||
// String tenantId = userProvider.get().getTenantId();
|
||||
// new Thread(()->{
|
||||
// // 睡眠1秒,确保事务提交完成
|
||||
// try {
|
||||
// Thread.sleep(1000);
|
||||
// secondedSendIm(entity,tenantId);
|
||||
// } catch (InterruptedException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }).start();
|
||||
} else {
|
||||
entity.setId(id);
|
||||
updateById(entity);
|
||||
// 删除以前绑定的用户集合
|
||||
selfApproveUserMapper.deleteById(id);
|
||||
// 保存对应的用户集合
|
||||
// selfApproveUserMapper.addList(selfApproveDto.getUserIds(),id);
|
||||
selfApproveUserMapper.addUserList(selfApproveDto.getUserSelfDtos(),id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SelfApproveVo getAttendanceLeave(String id) {
|
||||
SelfApprove selfApprove = this.getById(id);
|
||||
SelfApproveVo jsonToBean = JsonUtil.getJsonToBean(selfApprove, SelfApproveVo.class);
|
||||
if (null != jsonToBean) {
|
||||
// 获取对应的用户集合
|
||||
List<UserSelfDto> userSelfDtos = selfApproveUserMapper.getListById(id);
|
||||
jsonToBean.setUserSelfDtos(userSelfDtos);
|
||||
// List<String> userIds = selfApproveUserMapper.getIdListById(id);
|
||||
// jsonToBean.setUserIds(userIds);
|
||||
}
|
||||
return jsonToBean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveForOa(SelfApprove entity,List<String> userIds) {
|
||||
save(entity);
|
||||
selfApproveUserMapper.addUserListForOa(userIds,entity.getId());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
package jnpf.workflow.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import jnpf.attendance.antifreeze.UserAntifreeze;
|
||||
import jnpf.attendance.service.handle.notice.AttendanceNoticeHandler;
|
||||
import jnpf.base.service.SuperServiceImpl;
|
||||
import jnpf.constants.AttendanceConstant;
|
||||
import jnpf.engine.vo.ApproverByTaskIdAndNodeIdVo;
|
||||
import jnpf.entity.workflow.AttendanceWorkOvertimeApprove;
|
||||
import jnpf.enums.attendance.ApprovalSettingTypeEnum;
|
||||
import jnpf.enums.attendance.AttendanceNoticeEnum;
|
||||
import jnpf.model.attendance.vo.attendance.ApproveBaseImVo;
|
||||
import jnpf.model.attendance.vo.attendance.ApproveImVo;
|
||||
import jnpf.model.attendance.vo.attendance.AttendanceApproveImVo;
|
||||
import jnpf.model.workflow.dto.AttendanceWorkOvertimeApproveDto;
|
||||
import jnpf.model.workflow.vo.AttendanceWorkOvertimeApproveVo;
|
||||
import jnpf.permission.model.user.PartUserInfoVo;
|
||||
import jnpf.util.*;
|
||||
import jnpf.workflow.mapper.AttendanceWorkOvertimeApproveMapper;
|
||||
import jnpf.workflow.service.FlowTaskService;
|
||||
import jnpf.workflow.service.WorkOvertimeApproveService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* describe
|
||||
*
|
||||
* @author HuangLinPan
|
||||
* @date 2023/12/12
|
||||
*/
|
||||
@Service
|
||||
public class WorkOvertimeApproveServiceImpl extends SuperServiceImpl<AttendanceWorkOvertimeApproveMapper, AttendanceWorkOvertimeApprove> implements WorkOvertimeApproveService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private UserAntifreeze userAntifreeze;
|
||||
|
||||
@Resource
|
||||
private FlowTaskService flowTaskService;
|
||||
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
|
||||
@Autowired
|
||||
private AttendanceNoticeHandler attendanceNoticeHandler;
|
||||
|
||||
@Resource
|
||||
private CustomTenantUtil customTenantUtil;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void save(String id, AttendanceWorkOvertimeApprove entity, AttendanceWorkOvertimeApproveDto attendanceWorkOvertimeApproveDto) {
|
||||
//表单信息
|
||||
if (StringUtil.isEmpty(entity.getId())) {
|
||||
entity.setId(id);
|
||||
save(entity);
|
||||
// String tenantId = userProvider.get().getTenantId();
|
||||
// new Thread(()->{
|
||||
// // 睡眠1秒,确保事务提交完成
|
||||
// try {
|
||||
// Thread.sleep(1000);
|
||||
// workSendIm(entity,tenantId);
|
||||
// } catch (InterruptedException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }).start();
|
||||
} else {
|
||||
entity.setId(id);
|
||||
updateById(entity);
|
||||
}
|
||||
}
|
||||
|
||||
private void workSendIm(AttendanceWorkOvertimeApprove entity,String tenantId) {
|
||||
//张三的【加班】审批
|
||||
//选择日期:2024年5月16日
|
||||
//开始时间:22:00
|
||||
//结束时间:次日08:00
|
||||
customTenantUtil.checkOutTenant(tenantId);
|
||||
// 查询第一节点审批人
|
||||
ApproverByTaskIdAndNodeIdVo data = flowTaskService.getApproveInfo(entity.getId(), null, tenantId,null);
|
||||
if (null == data) {
|
||||
return;
|
||||
}
|
||||
AttendanceApproveImVo jsonToBean = JsonUtil.getJsonToBean(data, AttendanceApproveImVo.class);
|
||||
jsonToBean.setId(data.getTaskId());
|
||||
List<PartUserInfoVo> allByIds = userAntifreeze.getAllByIds(CollUtil.newArrayList(entity.getUserId()), tenantId);
|
||||
PartUserInfoVo partUserInfoVo = allByIds.stream().findFirst().orElse(null);
|
||||
// 组装消息
|
||||
ApproveImVo approveImVo = new ApproveImVo();
|
||||
approveImVo.setTenantId(tenantId);
|
||||
approveImVo.setAttendanceNoticeEnum(AttendanceNoticeEnum.APPROVE);
|
||||
ApproveBaseImVo approveBaseImVo = new ApproveBaseImVo();
|
||||
approveBaseImVo.setType(ApprovalSettingTypeEnum.OVERTIME.getCode());
|
||||
// approveBaseImVo.setSelectTime(entity.getWorkDay());
|
||||
approveBaseImVo.setStartTime(entity.getStartTime());
|
||||
approveBaseImVo.setEndTime(entity.getEndTime());
|
||||
StringBuilder stringBuffer = new StringBuilder();
|
||||
if (!Objects.isNull(partUserInfoVo)) {
|
||||
stringBuffer.append(partUserInfoVo.getRealName());
|
||||
}
|
||||
approveBaseImVo.setTitle(stringBuffer.append("的【加班】审批").toString());
|
||||
data.getUserOperators().forEach(v->{
|
||||
jsonToBean.setTaskId(v.getTaskOperatorId());
|
||||
approveImVo.setUserIds(CollUtil.newArrayList(v.getUserId()));
|
||||
// URL 拼接
|
||||
// String encode = Base64Util.encode(JSONUtil.toJsonStr(jsonToBean));
|
||||
String encode = FtbUtil.encodeJson(jsonToBean);
|
||||
String url = AttendanceConstant.APPROVE_URL + encode;
|
||||
approveBaseImVo.setUrl(url);
|
||||
approveImVo.setApproveBaseImVo(approveBaseImVo);
|
||||
attendanceNoticeHandler.send(approveImVo);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void submit(String id, AttendanceWorkOvertimeApprove entity, AttendanceWorkOvertimeApproveDto attendanceWorkOvertimeApproveDto) {
|
||||
//表单信息
|
||||
if (StringUtil.isEmpty(entity.getId())) {
|
||||
entity.setId(id);
|
||||
save(entity);
|
||||
// String tenantId = userProvider.get().getTenantId();
|
||||
// new Thread(()->{
|
||||
// // 睡眠1秒,确保事务提交完成
|
||||
// try {
|
||||
// Thread.sleep(1000);
|
||||
// workSendIm(entity,tenantId);
|
||||
// } catch (InterruptedException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }).start();
|
||||
} else {
|
||||
entity.setId(id);
|
||||
updateById(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AttendanceWorkOvertimeApproveVo getAttendanceLeave(String id) {
|
||||
AttendanceWorkOvertimeApprove attendanceWorkOvertimeApprove = this.getById(id);
|
||||
AttendanceWorkOvertimeApproveVo jsonToBean = JsonUtil.getJsonToBean(attendanceWorkOvertimeApprove, AttendanceWorkOvertimeApproveVo.class);
|
||||
// 当审核未通过时动态取值
|
||||
// if (1 != jsonToBean.getStatus()){
|
||||
// 动态获取涉及班次/借调班次
|
||||
// }
|
||||
return jsonToBean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveForOa(AttendanceWorkOvertimeApprove entity) {
|
||||
save(entity);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user