2025-11-12 功能测试优化

This commit is contained in:
2025-11-12 14:46:00 +08:00
parent 73a29518b6
commit fca9e0152c
17 changed files with 5884 additions and 5 deletions

View File

@@ -79,7 +79,7 @@ public class ItemIssusController extends BaseController {
detail = new ArrayList<HashMap<String, Object>>();
}
for (JeeLowCodeUser dbuser : userPage.getRecords()) {
HashMap<String, Object> user = CollectionUtil.isEmpty(detail) ? null : detail.stream().filter(t -> t.containsKey("userId") && t.get("userId").toString().equals(dbuser.getUserId())).findFirst().orElse(null);
HashMap<String, Object> user = CollectionUtil.isEmpty(detail) ? null : detail.stream().filter(t -> t.containsKey("chargeId") && t.get("chargeId").toString().equals(dbuser.getUserId())).findFirst().orElse(null);
if (Objects.isNull(user)) {
HashMap<String, Object> newUser = new HashMap<>();
newUser.put("chargeId", dbuser.getUserId());
@@ -101,12 +101,11 @@ public class ItemIssusController extends BaseController {
newRecord.put("deptId", dbuser.getDeptId());
newRecord.put("eDate", examPlan.get("edate"));
newRecord.put("resultStatus", 1);
newRecord.put("resultStatus", 2);
newRecord.put("sDate", examPlan.get("sdate"));
newRecord.put("itemName", examPlan.get("itemname"));
newRecord.put("itemContext", examPlan.get("itemcontext"));
newRecord.put("workItemId", examPlan.get("id"));
newRecord.put("examRecordStatus", 1);
newRecord.put("billNo", "SXJG" + System.currentTimeMillis());
tasks.add(JSONUtil.parseObj(newRecord));

View File

@@ -0,0 +1,29 @@
package com.jeelowcode.module.biz.service;
import java.util.HashMap;
/**
* 推送代办消息信息
* 用于判断 单据推送代办消息的场景是否推送消息成功
* 如果推送消息成功,这个单据的这个场景不再推送消息
*
* @author lify
*/
public interface ITodoRequestService {
/**
* 判断是否存在 id 场景下 代办消息是否推送成功
*
* @param id 流程id
* @return boolean 推送结果
*/
boolean isExistTodoRequest(long billId, String todoType);
/**
* 新增代办消息详情
* @param dbformId
* @param newRecord
*/
void addTodoRequest(HashMap<String, Object> newRecord);
}

View File

@@ -4,10 +4,12 @@ import cn.hutool.core.codec.Base64;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import com.jeelowcode.framework.plus.core.toolkit.StringUtils;
import com.jeelowcode.framework.utils.tool.spring.SpringUtils;
import com.jeelowcode.module.biz.service.IPortalTodoService;
import com.jeelowcode.module.biz.service.IRiskService;
import com.jeelowcode.module.biz.service.ITodoRequestService;
import com.jeelowcode.service.bpm.config.framework.portal.core.PortalRequest;
import com.jeelowcode.service.bpm.config.framework.portal.core.dto.DeleteRequestInfoDTO;
import com.jeelowcode.service.bpm.config.framework.portal.core.dto.ReceiveRequestInfoDTO;
@@ -43,6 +45,7 @@ public class PortalTodoServiceImpl implements IPortalTodoService {
private static final String WORK_STATUS_COMPLETE = "4";
private static final String VIEW_TYPE_UNREAD = "0";
private static final String VIEW_TYPE_READ = "1";
private static final String Bill_Table_Name = "lc_risk_hazard_manage";
@Resource
private IRiskService riskService;
@@ -52,6 +55,9 @@ public class PortalTodoServiceImpl implements IPortalTodoService {
@Resource
private IDictDataService dictDataService;
@Resource
private ITodoRequestService todoRequestService;
@Override
public boolean pushDoneRiskHazardWorkflow(Long id, String todoType) {
// 0.1.查找风险隐患数据,如果查不到则放弃推送
@@ -61,6 +67,13 @@ public class PortalTodoServiceImpl implements IPortalTodoService {
PortalRequest portalRequest = SpringUtils.getBean(PortalRequest.class);
if (!Objects.requireNonNull(portalRequest).available()) return false;
// 0.3.判断是否存在 场景下发送的消息,已经发送过消息的不重复发送
boolean isExist = todoRequestService.isExistTodoRequest(id, todoType);
if(isExist)
{
return true;
}
// 1.构建请求参数,准备推送待办信息
String creator = "";
String receiver = "";
@@ -159,14 +172,26 @@ public class PortalTodoServiceImpl implements IPortalTodoService {
ReceiveRequestInfoDTO completeRequestDTO = BeanUtils.toBean(todoRequestDTO, ReceiveRequestInfoDTO.class);
completeRequestDTO.setIsRemark(WORK_STATUS_COMPLETE);
// 1.3.构建发送消息详情
HashMap<String, Object> newRecord = new HashMap<>();
newRecord.put("bill_id", id);
newRecord.put("bill_table_name", Bill_Table_Name);
newRecord.put("bill_action", todoType);
newRecord.put("todo_request", JSONUtil.toJsonStr(todoRequestDTO));
// 2.推送待办信息使用try-catch避免影响上层调用方法的事务回滚
try {
portalRequest.receiveRequestInfo(todoRequestDTO);
newRecord.put("is_success", 1);
todoRequestService.addTodoRequest(newRecord);
if (todoType.equals("CONFIRM_DONE")) {
portalRequest.receiveRequestInfo(completeRequestDTO);
}
} catch (Exception e) {
log.error("推送待办信息失败", e);
newRecord.put("is_success", 0);
todoRequestService.addTodoRequest(newRecord);
return false;
}
return true;

View File

@@ -0,0 +1,57 @@
package com.jeelowcode.module.biz.service.impl;
import cn.hutool.json.JSONUtil;
import com.jeelowcode.core.framework.controller.BaseController;
import com.jeelowcode.core.framework.mapper.JeeLowCodeSqlMapper;
import com.jeelowcode.core.framework.service.IFormService;
import com.jeelowcode.core.framework.service.IFrameSqlService;
import com.jeelowcode.framework.global.JeeLowCodeBaseConstant;
import com.jeelowcode.framework.plus.SqlHelper;
import com.jeelowcode.framework.plus.build.buildmodel.wrapper.SqlInfoQueryWrapper;
import com.jeelowcode.framework.plus.core.model.SqlFormatModel;
import com.jeelowcode.framework.utils.model.ResultDataModel;
import com.jeelowcode.module.biz.service.IPlanIssusService;
import com.jeelowcode.module.biz.service.ITodoRequestService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
* demo
*/
@Slf4j
@Service
public class TodoRequestServiceImpl extends BaseController implements ITodoRequestService {
@Autowired
private IFrameSqlService sqlService;
@Autowired
private IFormService dbFormService;
@Override
public boolean isExistTodoRequest(long billId, String todoType) {
SqlInfoQueryWrapper.Wrapper wrapper = SqlHelper.getQueryWrapper();
wrapper.setTableName("lc_todo_request_info");
wrapper.setWhere(where->{
where.eq("bill_id",billId);
where.eq("bill_action",todoType);
where.eq("is_success",1);
});
Map<String, Object> dataMap = sqlService.getDataOneByPlus(wrapper);
return !dataMap.isEmpty();
}
@Override
public void addTodoRequest(HashMap<String, Object> newRecord) {
String tableName="lc_todo_request_info";
Long formId = dbFormService.getDbFormIdByTableName(tableName);
super.addJsonData(formId, JSONUtil.parseObj(newRecord));
}
}

View File

@@ -5,12 +5,14 @@ import cn.hutool.core.codec.Base64;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import com.jeelowcode.core.framework.service.IFrameSqlService;
import com.jeelowcode.framework.plus.SqlHelper;
import com.jeelowcode.framework.plus.build.buildmodel.wrapper.SqlInfoQueryWrapper;
import com.jeelowcode.framework.plus.core.toolkit.StringUtils;
import com.jeelowcode.framework.utils.tool.spring.SpringUtils;
import com.jeelowcode.module.biz.service.IExamPlanService;
import com.jeelowcode.module.biz.service.ITodoRequestService;
import com.jeelowcode.module.biz.service.IWorkItemService;
import com.jeelowcode.service.bpm.config.framework.portal.core.PortalRequest;
import com.jeelowcode.service.bpm.config.framework.portal.core.dto.DeleteRequestInfoDTO;
@@ -38,12 +40,13 @@ public class WorkItemServiceImpl implements IWorkItemService {
private static final String WORK_NODE_NAME = "下发工作事项";
private static final String WORK_FLOW_NAME = "工作事项信息";
// TODO 待办跳转链接,这个以后需要优化,通过配置去取这个链接,不能写死在这里
private static final String RISK_PC_URL = "/fx/table/view/1983351353033953281";
private static final String RISK_PC_URL = "/gzxt/table/view/1983351353033953281";
private static final String WORK_STATUS_TODO = "0";
private static final String WORK_STATUS_DONE = "2";
private static final String WORK_STATUS_COMPLETE = "4";
private static final String VIEW_TYPE_UNREAD = "0";
private static final String VIEW_TYPE_READ = "1";
private static final String Bill_Table_Name = "lc_item_result";
@Autowired
private IFrameSqlService sqlService;
@@ -51,6 +54,9 @@ public class WorkItemServiceImpl implements IWorkItemService {
@Resource
private IApiAdminUserApi apiAdminUserApi;
@Resource
private ITodoRequestService todoRequestService;
@Override
public Map<String, Object> getWorkItemById(long id) {
SqlInfoQueryWrapper.Wrapper wrapper = SqlHelper.getQueryWrapper();
@@ -96,6 +102,13 @@ public class WorkItemServiceImpl implements IWorkItemService {
PortalRequest portalRequest = SpringUtils.getBean(PortalRequest.class);
if (ObjectUtil.isNull(portalRequest)) return false;
// 0.3.判断是否存在 场景下发送的消息,已经发送过消息的不重复发送
boolean isExist = todoRequestService.isExistTodoRequest(itemResultId, todoType);
if(isExist)
{
return true;
}
// 1.构建请求参数,准备推送待办信息
String creator="";
String receiver="";
@@ -161,15 +174,26 @@ public class WorkItemServiceImpl implements IWorkItemService {
ReceiveRequestInfoDTO completeRequestDTO = BeanUtils.toBean(todoRequestDTO, ReceiveRequestInfoDTO.class);
completeRequestDTO.setIsRemark(WORK_STATUS_COMPLETE);
// 1.3.构建发送消息详情
HashMap<String, Object> newRecord = new HashMap<>();
newRecord.put("bill_id", itemResultId);
newRecord.put("bill_table_name", Bill_Table_Name);
newRecord.put("bill_action", todoType);
newRecord.put("todo_request", JSONUtil.toJsonStr(todoRequestDTO));
// 2.推送待办信息使用try-catch避免影响上层调用方法的事务回滚
try {
portalRequest.receiveRequestInfo(todoRequestDTO);
newRecord.put("is_success", 1);
todoRequestService.addTodoRequest(newRecord);
if(todoType.equals("WORK_ITEM_DONE"))
{
portalRequest.receiveRequestInfo(completeRequestDTO);
}
} catch (Exception e) {
log.error("推送待办信息失败", e);
newRecord.put("is_success", 0);
todoRequestService.addTodoRequest(newRecord);
return false;
}
return true;