diff --git a/jeecg-boot-platform/jeecg-boot-module-bpm-flowable/src/main/java/org/jeecg/modules/extbpm/process/controller/ExtActTaskCcController.java b/jeecg-boot-platform/jeecg-boot-module-bpm-flowable/src/main/java/org/jeecg/modules/extbpm/process/controller/ExtActTaskCcController.java index 9d4bc20..c59cf7a 100644 --- a/jeecg-boot-platform/jeecg-boot-module-bpm-flowable/src/main/java/org/jeecg/modules/extbpm/process/controller/ExtActTaskCcController.java +++ b/jeecg-boot-platform/jeecg-boot-module-bpm-flowable/src/main/java/org/jeecg/modules/extbpm/process/controller/ExtActTaskCcController.java @@ -10,6 +10,7 @@ import org.jeecg.common.system.util.JwtUtil; import org.jeecg.common.util.SqlInjectionUtil; import org.jeecg.common.util.oConvertUtils; import org.jeecg.modules.extbpm.process.entity.ExtActTaskCc; +import org.jeecg.modules.extbpm.process.pojo.CcTaskListDTO; import org.jeecg.modules.extbpm.process.service.IExtActTaskCcService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.DeleteMapping; @@ -40,6 +41,40 @@ import lombok.extern.slf4j.Slf4j; public class ExtActTaskCcController { @Autowired private IExtActTaskCcService extActTaskCcService; + + /** + * 我的抄送轻量列表 + * @param pageNo + * @param pageSize + * @param isReadParam + * @param bpmBizTitle + * @param processDefinitionName + * @param request + * @return + */ + @GetMapping(value = "/myList") + public Result> myList(@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + @RequestParam(name="isRead", required=false) String isReadParam, + @RequestParam(name="bpmBizTitle", required=false) String bpmBizTitle, + @RequestParam(name="processDefinitionName", required=false) String processDefinitionName, + HttpServletRequest request) { + Result> result = new Result>(); + String username = JwtUtil.getUserNameByToken(request); + if (oConvertUtils.isEmpty(username)) { + result.error500("用户未登录"); + return result; + } + Integer isRead = null; + if ("0".equals(isReadParam) || "1".equals(isReadParam)) { + isRead = Integer.valueOf(isReadParam); + } + Page page = new Page(pageNo, pageSize); + IPage pageList = extActTaskCcService.queryMyCcList(page, username, isRead, bpmBizTitle, processDefinitionName); + result.setSuccess(true); + result.setResult(pageList); + return result; + } /** * 分页列表查询 diff --git a/jeecg-boot-platform/jeecg-boot-module-bpm-flowable/src/main/java/org/jeecg/modules/extbpm/process/mapper/ExtActTaskCcMapper.java b/jeecg-boot-platform/jeecg-boot-module-bpm-flowable/src/main/java/org/jeecg/modules/extbpm/process/mapper/ExtActTaskCcMapper.java index 191a6f8..48efb7b 100644 --- a/jeecg-boot-platform/jeecg-boot-module-bpm-flowable/src/main/java/org/jeecg/modules/extbpm/process/mapper/ExtActTaskCcMapper.java +++ b/jeecg-boot-platform/jeecg-boot-module-bpm-flowable/src/main/java/org/jeecg/modules/extbpm/process/mapper/ExtActTaskCcMapper.java @@ -4,7 +4,10 @@ import java.util.List; import org.apache.ibatis.annotations.Param; import org.jeecg.modules.extbpm.process.entity.ExtActTaskCc; +import org.jeecg.modules.extbpm.process.pojo.CcTaskListDTO; + import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; /** * @Description: 任务抄送表 @@ -14,4 +17,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; */ public interface ExtActTaskCcMapper extends BaseMapper { + /** + * 查询当前用户的抄送轻量列表。 + */ + List queryMyCcList(Page page, + @Param("ccUserName") String ccUserName, + @Param("isRead") Integer isRead, + @Param("bpmBizTitle") String bpmBizTitle, + @Param("processDefinitionName") String processDefinitionName); } diff --git a/jeecg-boot-platform/jeecg-boot-module-bpm-flowable/src/main/java/org/jeecg/modules/extbpm/process/mapper/xml/ExtActTaskCcMapper.xml b/jeecg-boot-platform/jeecg-boot-module-bpm-flowable/src/main/java/org/jeecg/modules/extbpm/process/mapper/xml/ExtActTaskCcMapper.xml index 218a35c..043b221 100644 --- a/jeecg-boot-platform/jeecg-boot-module-bpm-flowable/src/main/java/org/jeecg/modules/extbpm/process/mapper/xml/ExtActTaskCcMapper.xml +++ b/jeecg-boot-platform/jeecg-boot-module-bpm-flowable/src/main/java/org/jeecg/modules/extbpm/process/mapper/xml/ExtActTaskCcMapper.xml @@ -2,4 +2,66 @@ - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + diff --git a/jeecg-boot-platform/jeecg-boot-module-bpm-flowable/src/main/java/org/jeecg/modules/extbpm/process/pojo/CcTaskListDTO.java b/jeecg-boot-platform/jeecg-boot-module-bpm-flowable/src/main/java/org/jeecg/modules/extbpm/process/pojo/CcTaskListDTO.java new file mode 100644 index 0000000..c4b47ac --- /dev/null +++ b/jeecg-boot-platform/jeecg-boot-module-bpm-flowable/src/main/java/org/jeecg/modules/extbpm/process/pojo/CcTaskListDTO.java @@ -0,0 +1,52 @@ +package org.jeecg.modules.extbpm.process.pojo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +/** + * 我的抄送轻量列表,只承载待阅/已阅页面需要展示和打开详情的字段。 + */ +@Data +public class CcTaskListDTO implements Serializable { + private static final long serialVersionUID = 1L; + + /** 历史任务ID,用于打开流程历史详情 */ + private String id; + /** 抄送记录ID,用于标记已阅 */ + private String ccId; + /** 节点定义key,用于打开流程历史详情 */ + private String taskId; + /** 流程实例ID,用于打开流程历史详情 */ + private String processInstanceId; + + /** 业务标题 */ + private String bpmBizTitle; + /** 流程名称 */ + private String processDefinitionName; + /** 抄送节点 */ + private String taskName; + + /** 流程发起人用户名 */ + private String processApplyUserId; + /** 流程发起人姓名 */ + private String processApplyUserName; + /** 抄送人用户名 */ + private String ccFromUserId; + /** 抄送人姓名 */ + private String ccFromUserName; + + /** 抄送时间 */ + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date ccCreateTime; + /** 抄送阅读状态:0-待阅,1-已阅 */ + private Integer isRead; + /** 已阅时间 */ + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date readTime; +} diff --git a/jeecg-boot-platform/jeecg-boot-module-bpm-flowable/src/main/java/org/jeecg/modules/extbpm/process/service/IExtActTaskCcService.java b/jeecg-boot-platform/jeecg-boot-module-bpm-flowable/src/main/java/org/jeecg/modules/extbpm/process/service/IExtActTaskCcService.java index 0c8d317..d7e2d83 100644 --- a/jeecg-boot-platform/jeecg-boot-module-bpm-flowable/src/main/java/org/jeecg/modules/extbpm/process/service/IExtActTaskCcService.java +++ b/jeecg-boot-platform/jeecg-boot-module-bpm-flowable/src/main/java/org/jeecg/modules/extbpm/process/service/IExtActTaskCcService.java @@ -1,9 +1,12 @@ package org.jeecg.modules.extbpm.process.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.flowable.bpmn.model.FlowNode; import org.jeecg.common.api.vo.Result; import org.jeecg.modules.extbpm.process.entity.ExtActTaskCc; +import org.jeecg.modules.extbpm.process.pojo.CcTaskListDTO; import javax.servlet.http.HttpServletRequest; import java.util.HashMap; @@ -37,4 +40,13 @@ public interface IExtActTaskCcService extends IService { public List findFlowNodesByActivityId(String processDefId, String activityId); + /** + * 查询我的抄送轻量列表。 + */ + public IPage queryMyCcList(Page page, + String username, + Integer isRead, + String bpmBizTitle, + String processDefinitionName); + } diff --git a/jeecg-boot-platform/jeecg-boot-module-bpm-flowable/src/main/java/org/jeecg/modules/extbpm/process/service/impl/ExtActBpmLogServiceImpl.java b/jeecg-boot-platform/jeecg-boot-module-bpm-flowable/src/main/java/org/jeecg/modules/extbpm/process/service/impl/ExtActBpmLogServiceImpl.java index 88ddbea..b97b7e7 100644 --- a/jeecg-boot-platform/jeecg-boot-module-bpm-flowable/src/main/java/org/jeecg/modules/extbpm/process/service/impl/ExtActBpmLogServiceImpl.java +++ b/jeecg-boot-platform/jeecg-boot-module-bpm-flowable/src/main/java/org/jeecg/modules/extbpm/process/service/impl/ExtActBpmLogServiceImpl.java @@ -511,6 +511,8 @@ public class ExtActBpmLogServiceImpl extends ServiceImpl queryMyCcList(Page page, String username, Integer isRead, String bpmBizTitle, String processDefinitionName) { + List records = extActTaskCcMapper.queryMyCcList(page, username, isRead, bpmBizTitle, processDefinitionName); + return page.setRecords(records); + } + @Override public Result processComplete(HashMap map, HttpServletRequest request) { Result result = new Result(); diff --git a/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/v380/V20260713_1__split_cc_task_read_menu.sql b/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/v380/V20260713_1__split_cc_task_read_menu.sql new file mode 100644 index 0000000..6941dbe --- /dev/null +++ b/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/v380/V20260713_1__split_cc_task_read_menu.sql @@ -0,0 +1,88 @@ +-- 抄送阅读状态字段:兼容已手工加字段的环境,缺失时自动补齐。 +SET @add_cc_is_read_sql = IF( + (SELECT COUNT(1) + FROM information_schema.columns + WHERE table_schema = DATABASE() + AND table_name = 'ext_act_task_cc' + AND column_name = 'is_read') = 0, + 'ALTER TABLE `ext_act_task_cc` ADD COLUMN `is_read` tinyint(1) DEFAULT 0 COMMENT ''是否已阅:0待阅,1已阅'' AFTER `cc_user_name`', + 'SELECT 1' +); +PREPARE add_cc_is_read_stmt FROM @add_cc_is_read_sql; +EXECUTE add_cc_is_read_stmt; +DEALLOCATE PREPARE add_cc_is_read_stmt; + +SET @add_cc_read_time_sql = IF( + (SELECT COUNT(1) + FROM information_schema.columns + WHERE table_schema = DATABASE() + AND table_name = 'ext_act_task_cc' + AND column_name = 'read_time') = 0, + 'ALTER TABLE `ext_act_task_cc` ADD COLUMN `read_time` datetime DEFAULT NULL COMMENT ''已阅时间'' AFTER `is_read`', + 'SELECT 1' +); +PREPARE add_cc_read_time_stmt FROM @add_cc_read_time_sql; +EXECUTE add_cc_read_time_stmt; +DEALLOCATE PREPARE add_cc_read_time_stmt; + +UPDATE `ext_act_task_cc` +SET `is_read` = 0 +WHERE `is_read` IS NULL; + +-- 旧“我的抄送”菜单沿用原 ID 改为“我的待阅”,保留既有角色/部门授权关系。 +UPDATE `sys_permission` +SET `name` = '我的待阅', + `url` = '/task/myUnreadCcTaskList', + `component` = 'super/bpm/process/personalOffice/myCcTask/MyUnreadCcTaskList', + `sort_no` = 3.00, + `update_by` = 'admin', + `update_time` = NOW() +WHERE `id` = '1527569492930560001'; + +-- 新增“我的已阅”菜单。 +INSERT IGNORE INTO `sys_permission`( + `id`, `parent_id`, `name`, `url`, `component`, `is_route`, `component_name`, `redirect`, + `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_leaf`, `keep_alive`, + `hidden`, `hide_tab`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, + `del_flag`, `rule_flag`, `status`, `internal_or_external` +) VALUES ( + '2026071300010000001', '1526860315136425986', '我的已阅', '/task/myReadCcTaskList', + 'super/bpm/process/personalOffice/myCcTask/MyReadCcTaskList', 1, NULL, NULL, + 1, NULL, '0', 4.00, 0, NULL, 1, 0, + 0, 0, NULL, 'admin', NOW(), NULL, NULL, + 0, 0, NULL, 0 +); + +-- 将已拥有“我的待阅”的角色同步授权到“我的已阅”。 +INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `data_rule_ids`, `operate_date`, `operate_ip`) +SELECT + MD5(CONCAT('cc-read-role:', srp.`role_id`)), + srp.`role_id`, + '2026071300010000001', + srp.`data_rule_ids`, + NOW(), + srp.`operate_ip` +FROM `sys_role_permission` srp +WHERE srp.`permission_id` = '1527569492930560001' + AND NOT EXISTS ( + SELECT 1 + FROM `sys_role_permission` target + WHERE target.`role_id` = srp.`role_id` + AND target.`permission_id` = '2026071300010000001' + ); + +-- 将已拥有“我的待阅”的部门同步授权到“我的已阅”。 +INSERT INTO `sys_depart_permission`(`id`, `depart_id`, `permission_id`, `data_rule_ids`) +SELECT + MD5(CONCAT('cc-read-depart:', sdp.`depart_id`)), + sdp.`depart_id`, + '2026071300010000001', + sdp.`data_rule_ids` +FROM `sys_depart_permission` sdp +WHERE sdp.`permission_id` = '1527569492930560001' + AND NOT EXISTS ( + SELECT 1 + FROM `sys_depart_permission` target + WHERE target.`depart_id` = sdp.`depart_id` + AND target.`permission_id` = '2026071300010000001' + ); diff --git a/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/v380/V20260714_1__add_ext_act_task_cc_read_index.sql b/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/v380/V20260714_1__add_ext_act_task_cc_read_index.sql new file mode 100644 index 0000000..b9d055f --- /dev/null +++ b/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/v380/V20260714_1__add_ext_act_task_cc_read_index.sql @@ -0,0 +1,13 @@ +-- 我的待阅/已阅轻量列表按接收人、阅读状态和抄送时间查询。 +SET @add_cc_read_index_sql = IF( + (SELECT COUNT(1) + FROM information_schema.statistics + WHERE table_schema = DATABASE() + AND table_name = 'ext_act_task_cc' + AND index_name = 'idx_ext_act_task_cc_user_read_time') = 0, + 'ALTER TABLE `ext_act_task_cc` ADD INDEX `idx_ext_act_task_cc_user_read_time` (`cc_user_name`, `is_read`, `create_time`)', + 'SELECT 1' +); +PREPARE add_cc_read_index_stmt FROM @add_cc_read_index_sql; +EXECUTE add_cc_read_index_stmt; +DEALLOCATE PREPARE add_cc_read_index_stmt;