Compare commits
3 Commits
0f43fd147d
...
1708943c9d
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1708943c9d | ||
![]() |
9b0b73cc75 | ||
![]() |
01d45d5fc4 |
@ -36,6 +36,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode OA_WORK_TASK_NOT_EXISTS = new ErrorCode(1_009_001_110, "工作任务不存在");
|
||||
ErrorCode OA_ENTRY_NOT_EXISTS = new ErrorCode(1_009_001_111, "入职申请不存在");
|
||||
ErrorCode OA_GOOut_NOT_EXISTS = new ErrorCode(1_009_001_112, "外出申请不存在");
|
||||
ErrorCode OA_SALARY_NOT_EXISTS = new ErrorCode(1_009_001_113, "薪资付款申请不存在");
|
||||
|
||||
// ========== 流程模型 1-009-002-000 ==========
|
||||
ErrorCode MODEL_KEY_EXISTS = new ErrorCode(1_009_002_000, "已经存在流程标识为【{}】的流程");
|
||||
|
@ -0,0 +1,82 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.salary.BpmOASalaryCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.salary.BpmOASalaryRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.convert.oa.BpmOASalaryConvert;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOASalaryDO;
|
||||
import cn.iocoder.yudao.module.bpm.service.oa.BpmOASalaryService;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
/**
|
||||
* OA 薪资付款申请 Controller
|
||||
*
|
||||
* @author 符溶馨
|
||||
|
||||
*/
|
||||
@Tag(name = "管理后台 - OA 薪资付款申请")
|
||||
@RestController
|
||||
@RequestMapping("/bpm/oa/salary")
|
||||
@Validated
|
||||
public class BpmOASalaryController {
|
||||
|
||||
@Resource
|
||||
private BpmOASalaryService salaryService;
|
||||
|
||||
@Resource
|
||||
private DeptApi deptApi;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建请求申请")
|
||||
public CommonResult<Long> createSalary(@Valid @RequestBody BpmOASalaryCreateReqVO createReqVO) {
|
||||
|
||||
return success(salaryService.createSalary(getLoginUserId(), createReqVO));
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得薪资付款申请")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
public CommonResult<BpmOASalaryRespVO> getSalary(@RequestParam("id") Long id) {
|
||||
|
||||
BpmOASalaryDO salary = salaryService.getSalary(id);
|
||||
|
||||
return success(BpmOASalaryConvert.INSTANCE.convert(salary)
|
||||
.setCompanyName(getDept(salary.getCompanyDeptId()).getName()));
|
||||
}
|
||||
|
||||
@GetMapping("/getByProcessInstanceId")
|
||||
@Operation(summary = "获得薪资付款申请")
|
||||
@Parameter(name = "processInstanceId", description = "流程实例编号", required = true, example = "1024")
|
||||
public CommonResult<BpmOASalaryRespVO> getByProcessInstanceId(@RequestParam("processInstanceId") String processInstanceId) {
|
||||
|
||||
BpmOASalaryDO salary = salaryService.getByProcessInstanceId(processInstanceId);
|
||||
|
||||
return success(BpmOASalaryConvert.INSTANCE.convert(salary)
|
||||
.setCompanyName(getDept(salary.getCompanyDeptId()).getName()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得部门信息
|
||||
* @param deptId 部门id
|
||||
* @return 部门信息
|
||||
*/
|
||||
public DeptRespDTO getDept(Long deptId) {
|
||||
|
||||
if (deptId == null) {
|
||||
return new DeptRespDTO();
|
||||
}
|
||||
return deptApi.getDept(deptId).getCheckedData();
|
||||
}
|
||||
}
|
@ -30,6 +30,9 @@ public class BpmOASalaryRespVO extends BpmOABaseRespVO {
|
||||
@Schema(description = "付款公司")
|
||||
private Long companyDeptId;
|
||||
|
||||
@Schema(description = "付款公司名称")
|
||||
private String companyName;
|
||||
|
||||
@Schema(description = "付款总额")
|
||||
private BigDecimal paymentTotal;
|
||||
|
||||
|
@ -17,6 +17,9 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.OA_SALARY_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* OA 薪资付款申请 Service 实现类
|
||||
*
|
||||
@ -73,16 +76,25 @@ public class BpmOASalaryServiceImpl extends BpmOABaseService implements BpmOASal
|
||||
|
||||
@Override
|
||||
public void updateSalaryResult(Long id, Integer result) {
|
||||
validateLeaveExists(id);
|
||||
salaryMapper.updateById(new BpmOASalaryDO().setId(id).setResult(result));
|
||||
}
|
||||
|
||||
private void validateLeaveExists(Long id) {
|
||||
if (salaryMapper.selectById(id) == null) {
|
||||
throw exception(OA_SALARY_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BpmOASalaryDO getSalary(Long id) {
|
||||
return null;
|
||||
|
||||
return salaryMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BpmOASalaryDO getByProcessInstanceId(String processInstanceId) {
|
||||
return null;
|
||||
|
||||
return salaryMapper.selectOne(BpmOASalaryDO::getProcessInstanceId, processInstanceId);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.module.bpm.service.oa.listener;
|
||||
|
||||
import cn.iocoder.yudao.module.bpm.framework.bpm.core.event.BpmProcessInstanceResultEvent;
|
||||
import cn.iocoder.yudao.module.bpm.framework.bpm.core.event.BpmProcessInstanceResultEventListener;
|
||||
import cn.iocoder.yudao.module.bpm.service.oa.BpmOASalaryService;
|
||||
import cn.iocoder.yudao.module.bpm.service.oa.BpmOASalaryServiceImpl;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* OA 用章单的结果的监听器实现类
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Component
|
||||
public class BpmOASalaryResultListener extends BpmProcessInstanceResultEventListener {
|
||||
|
||||
@Resource
|
||||
private BpmOASalaryService SalaryService;
|
||||
|
||||
@Override
|
||||
protected String getProcessDefinitionKey() {
|
||||
|
||||
return BpmOASalaryServiceImpl.PROCESS_KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEvent(BpmProcessInstanceResultEvent event) {
|
||||
SalaryService.updateSalaryResult(Long.parseLong(event.getBusinessKey()), event.getResult());
|
||||
}
|
||||
}
|
@ -9,8 +9,10 @@ import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.loginstance.Lo
|
||||
import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.loginstance.LogInstanceRespVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.worklog.LogInstanceDO;
|
||||
import cn.iocoder.yudao.module.system.service.worklog.dto.LogReadUserRespDTO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -39,9 +41,15 @@ public interface LogInstanceMapper extends BaseMapperX<LogInstanceDO> {
|
||||
.in(LogInstanceDO::getTime, dateList));
|
||||
}
|
||||
|
||||
List<LogInstanceRespVO> selectPageResult( @Param("reqVO") LogInstancePageReqVO reqVO,
|
||||
// List<LogInstanceRespVO> selectPageResult( @Param("reqVO") LogInstancePageReqVO reqVO,
|
||||
// @Param("userId") Long userId,
|
||||
// @Param("ids") List<Long> ids);
|
||||
|
||||
IPage<LogInstanceRespVO> selectPageResult(@Param("page") IPage<LogInstanceRespVO> page,
|
||||
@Param("reqVO") LogInstancePageReqVO reqVO,
|
||||
@Param("userId") Long userId,
|
||||
@Param("ids") List<Long> ids);
|
||||
@Param("pagingType") Integer pagingType,
|
||||
@Param("userIds") List<Long> userIds);
|
||||
|
||||
default PageResult<LogInstanceDO> selectPage(LogInstancePageReqVO reqVO, Long userId,
|
||||
Integer pagingType, List<Long> userIds) {
|
||||
|
@ -244,8 +244,12 @@ public class LogInstanceServiceImpl implements LogInstanceService {
|
||||
leaderUserIds = adminUserService.getUserByBoss();
|
||||
}
|
||||
|
||||
PageResult<LogInstanceDO> pageList = logInstanceMapper.selectPage(pageReqVO, getLoginUserId(), pagingType, leaderUserIds);
|
||||
List<LogInstanceRespVO> records = logInstanceMapper.selectPageResult(pageReqVO, getLoginUserId(), convertList(pageList.getList(), LogInstanceDO::getId));
|
||||
// PageResult<LogInstanceDO> pageList = logInstanceMapper.selectPage(pageReqVO, getLoginUserId(), pagingType, leaderUserIds);
|
||||
// List<LogInstanceRespVO> records = logInstanceMapper.selectPageResult(pageReqVO, getLoginUserId(), convertList(pageList.getList(), LogInstanceDO::getId));
|
||||
|
||||
Page<LogInstanceRespVO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
||||
IPage<LogInstanceRespVO> pageList = logInstanceMapper.selectPageResult(page, pageReqVO, getLoginUserId(), pagingType, leaderUserIds);
|
||||
List<LogInstanceRespVO> records = pageList.getRecords();
|
||||
if (!records.isEmpty()) {
|
||||
|
||||
//模版ids过滤
|
||||
|
@ -94,52 +94,54 @@
|
||||
or result.data_scope = 1 )
|
||||
</select>
|
||||
|
||||
<select id="selectPageResult" resultType="cn.iocoder.yudao.module.system.controller.admin.worklog.vo.loginstance.LogInstanceRespVO">
|
||||
SELECT
|
||||
a.*,
|
||||
e.read_status as readStatus,
|
||||
COALESCE(c.readCount, 0) as readCount,
|
||||
COALESCE(d.unreadCount, 0) as unReadCount,
|
||||
COALESCE(b.comment, 0) as comment
|
||||
FROM
|
||||
system_user_post userPost,
|
||||
system_dept dept,
|
||||
system_post post,
|
||||
work_log_instance_ext as a
|
||||
LEFT JOIN work_log_read as e ON a.id = e.log_instance_id and e.read_user_id = #{userId}
|
||||
LEFT JOIN (SELECT log_instance_id, COUNT(log_instance_id) AS readCount FROM work_log_read where read_status = 1 AND deleted = 0 GROUP BY log_instance_id ) AS c ON a.id = c.log_instance_id
|
||||
LEFT JOIN (SELECT log_instance_id, COUNT(log_instance_id) AS unReadCount FROM work_log_read where read_status = 0 AND deleted = 0 GROUP BY log_instance_id ) AS d ON a.id = d.log_instance_id
|
||||
LEFT JOIN (SELECT work_log_id, COUNT(work_log_id) AS comment FROM work_log_comment where deleted = 0 GROUP BY work_log_id) AS b ON a.id = b.work_log_id
|
||||
<where>
|
||||
a.deleted = 0
|
||||
<if test="ids != null and ids.size > 0">
|
||||
and a.id in
|
||||
<foreach collection="ids" item="ids" open="(" close=")" separator=",">
|
||||
#{ids}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="ids == null or ids.size == 0">
|
||||
and a.id = null
|
||||
</if>
|
||||
AND a.start_user_id = userPost.user_id
|
||||
AND userPost.post_id = post.id
|
||||
AND a.dept_id = dept.id
|
||||
<if test="reqVO.isProduce == 1">
|
||||
AND dept.flag LIKE '%166%'
|
||||
</if>
|
||||
<if test="reqVO.isProduce == 2">
|
||||
AND dept.flag NOT LIKE '%166%'
|
||||
</if>
|
||||
<if test="reqVO.readStatus != null">
|
||||
and e.read_status = #{reqVO.readStatus}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY a.id
|
||||
ORDER BY
|
||||
a.time DESC,
|
||||
post.sort,
|
||||
a.start_user_id
|
||||
</select>
|
||||
<!-- <select id="selectPageResult" resultType="cn.iocoder.yudao.module.system.controller.admin.worklog.vo.loginstance.LogInstanceRespVO">-->
|
||||
<!-- SELECT-->
|
||||
<!-- a.*,-->
|
||||
<!-- e.read_status as readStatus,-->
|
||||
<!-- COALESCE(c.readCount, 0) as readCount,-->
|
||||
<!-- COALESCE(d.unreadCount, 0) as unReadCount,-->
|
||||
<!-- COALESCE(b.comment, 0) as comment-->
|
||||
<!-- FROM-->
|
||||
<!-- system_user_post userPost,-->
|
||||
<!-- system_dept dept,-->
|
||||
<!-- system_post post,-->
|
||||
<!-- work_log_instance_ext as a-->
|
||||
<!-- LEFT JOIN work_log_read as e ON a.id = e.log_instance_id and e.read_user_id = #{userId}-->
|
||||
<!-- LEFT JOIN (SELECT log_instance_id, COUNT(log_instance_id) AS readCount FROM work_log_read where read_status = 1 AND deleted = 0 GROUP BY log_instance_id ) AS c ON a.id = c.log_instance_id-->
|
||||
<!-- LEFT JOIN (SELECT log_instance_id, COUNT(log_instance_id) AS unReadCount FROM work_log_read where read_status = 0 AND deleted = 0 GROUP BY log_instance_id ) AS d ON a.id = d.log_instance_id-->
|
||||
<!-- LEFT JOIN (SELECT work_log_id, COUNT(work_log_id) AS comment FROM work_log_comment where deleted = 0 GROUP BY work_log_id) AS b ON a.id = b.work_log_id-->
|
||||
<!-- <where>-->
|
||||
<!-- a.deleted = 0-->
|
||||
<!-- <if test="ids != null and ids.size > 0">-->
|
||||
<!-- and a.id in-->
|
||||
<!-- <foreach collection="ids" item="ids" open="(" close=")" separator=",">-->
|
||||
<!-- #{ids}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="ids == null or ids.size == 0">-->
|
||||
<!-- and a.id = null-->
|
||||
<!-- </if>-->
|
||||
<!-- AND a.start_user_id = userPost.user_id-->
|
||||
<!-- AND userPost.post_id = post.id-->
|
||||
<!-- AND a.dept_id = dept.id-->
|
||||
<!-- <if test="reqVO.isProduce == 1">-->
|
||||
<!-- AND dept.flag LIKE '%166%'-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="reqVO.isProduce == 2">-->
|
||||
<!-- AND dept.flag NOT LIKE '%166%'-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="reqVO.readStatus != null">-->
|
||||
<!-- and e.read_status = #{reqVO.readStatus}-->
|
||||
<!-- </if>-->
|
||||
<!-- </where>-->
|
||||
<!-- GROUP BY a.id-->
|
||||
<!-- ORDER BY-->
|
||||
<!-- a.time DESC,-->
|
||||
<!-- post.sort,-->
|
||||
<!-- a.start_user_id-->
|
||||
<!-- </select>-->
|
||||
|
||||
|
||||
<select id="getNextOrUp"
|
||||
resultType="cn.iocoder.yudao.module.system.controller.admin.worklog.vo.loginstance.LogInstanceRespVO">
|
||||
SELECT
|
||||
@ -198,4 +200,71 @@
|
||||
</if>
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectPageResult" resultType="cn.iocoder.yudao.module.system.controller.admin.worklog.vo.loginstance.LogInstanceRespVO">
|
||||
SELECT
|
||||
a.*,
|
||||
e.read_status as readStatus,
|
||||
COALESCE(c.readCount, 0) as readCount,
|
||||
COALESCE(d.unreadCount, 0) as unReadCount,
|
||||
COALESCE(b.comment, 0) as comment
|
||||
FROM
|
||||
system_user_post userPost,
|
||||
system_dept dept,
|
||||
system_post post,
|
||||
work_log_instance_ext as a
|
||||
LEFT JOIN work_log_read as e ON a.id = e.log_instance_id and e.read_user_id = #{userId}
|
||||
LEFT JOIN (SELECT log_instance_id, COUNT(log_instance_id) AS readCount FROM work_log_read where read_status = 1 AND deleted = 0 GROUP BY log_instance_id ) AS c ON a.id = c.log_instance_id
|
||||
LEFT JOIN (SELECT log_instance_id, COUNT(log_instance_id) AS unReadCount FROM work_log_read where read_status = 0 AND deleted = 0 GROUP BY log_instance_id ) AS d ON a.id = d.log_instance_id
|
||||
LEFT JOIN (SELECT work_log_id, COUNT(work_log_id) AS comment FROM work_log_comment where deleted = 0 GROUP BY work_log_id) AS b ON a.id = b.work_log_id
|
||||
<where>
|
||||
a.deleted = 0
|
||||
AND a.start_user_id = userPost.user_id
|
||||
AND userPost.post_id = post.id
|
||||
AND a.dept_id = dept.id
|
||||
<if test="reqVO.isProduce == 1">
|
||||
AND dept.flag LIKE '%166%'
|
||||
</if>
|
||||
<if test="reqVO.isProduce == 2">
|
||||
AND dept.flag NOT LIKE '%166%'
|
||||
</if>
|
||||
<if test="reqVO.formId != null">
|
||||
and a.form_id = #{reqVO.formId}
|
||||
</if>
|
||||
<if test="reqVO.deptId != null">
|
||||
and a.dept_id = #{reqVO.deptId}
|
||||
</if>
|
||||
<if test="reqVO.startUserId != null">
|
||||
and a.start_user_id = #{reqVO.startUserId}
|
||||
</if>
|
||||
<if test="reqVO.createTime != null and reqVO.createTime.length > 0">
|
||||
<if test="reqVO.createTime[0] != null">
|
||||
and a.time >= #{reqVO.createTime[0]}
|
||||
</if>
|
||||
<if test="reqVO.createTime[1] != null">
|
||||
and a.time <= #{reqVO.createTime[1]}
|
||||
</if>
|
||||
</if>
|
||||
<if test="reqVO.readStatus != null">
|
||||
and e.read_status = #{reqVO.readStatus}
|
||||
</if>
|
||||
<if test="pagingType == 0">
|
||||
and a.start_user_id != #{userId}
|
||||
</if>
|
||||
<if test="pagingType == 1">
|
||||
and a.start_user_id = #{userId}
|
||||
</if>
|
||||
<if test="reqVO.isBoss != null and reqVO.isProduce == null">
|
||||
and a.start_user_id in
|
||||
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY a.id
|
||||
ORDER BY
|
||||
a.time DESC,
|
||||
post.sort,
|
||||
a.create_time DESC
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user