Merge remote-tracking branch 'origin/master'

This commit is contained in:
yjz
2024-07-29 15:22:26 +08:00
6 changed files with 26 additions and 21 deletions
+1
View File
@@ -9,6 +9,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>laws-module-system</artifactId>
<version>2.5.2</version>
<repositories>
<!-- <repository>-->
@@ -252,9 +252,9 @@ public class FeiShuDockingServiceImpl implements IFeiShuDockingService {
HttpEntity<ApprovalsInstanceVo> entity = new HttpEntity<>(approvalsInstanceVo, headers);
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.POST, entity, String.class);
JSONObject jsonResponse = JSON.parseObject(response.getBody());
logMessage(JSON.toJSONString(instanceDto), jsonResponse, "/feishu/synchronizeApprovalInstance", Constant.FEISHU_PENDING);
logMessage(JSON.toJSONString(instanceDto), instanceDto.getTitle(), jsonResponse, "/feishu/synchronizeApprovalInstance", Constant.FEISHU_PENDING);
}catch (Exception e) {
logError(JSON.toJSONString(instanceDto), e.getMessage(), "/feishu/synchronizeApprovalInstance", Constant.FEISHU_PENDING);
logError(JSON.toJSONString(instanceDto), instanceDto.getTitle(), e.getMessage(), "/feishu/synchronizeApprovalInstance", Constant.FEISHU_PENDING);
log.error("同步三方审批实例异常" + e.getMessage());
}
}
@@ -423,7 +423,7 @@ public class FeiShuDockingServiceImpl implements IFeiShuDockingService {
BotMessageDto botMessageDto1 = new BotMessageDto();
BeanUtils.copyProperties(botMessageDto,botMessageDto1);
botMessageDto1.setReceiveIds(id);
logError(JSON.toJSONString(botMessageDto1), "用户id:" + id +"对应的飞书账用户不存在", "/feishu/sendHrefMessageByBot", Constant.FEISHU_MESSAGE);
logError(JSON.toJSONString(botMessageDto1), botMessageDto.getTitle(),"用户id:" + id +"对应的飞书账用户不存在", "/feishu/sendHrefMessageByBot", Constant.FEISHU_MESSAGE);
}
}
}
@@ -482,30 +482,32 @@ public class FeiShuDockingServiceImpl implements IFeiShuDockingService {
HttpEntity<BotMessageVo> entity = new HttpEntity<>(botMessageVo, headers);
ResponseEntity<String> response = restTemplate.exchange(builder.toUriString(), HttpMethod.POST, entity, String.class);
JSONObject jsonResponse = JSON.parseObject(response.getBody());
logMessage(JSON.toJSONString(botMessageDto), jsonResponse, "/feishu/sendHrefMessageByBot", Constant.FEISHU_MESSAGE);
logMessage(JSON.toJSONString(botMessageDto), botMessageDto.getTitle(), jsonResponse, "/feishu/sendHrefMessageByBot", Constant.FEISHU_MESSAGE);
}
} catch (Exception e) {
logError(JSON.toJSONString(botMessageDto), e.getMessage(), "/feishu/sendHrefMessageByBot", Constant.FEISHU_MESSAGE);
logError(JSON.toJSONString(botMessageDto),botMessageDto.getTitle(), e.getMessage(), "/feishu/sendHrefMessageByBot", Constant.FEISHU_MESSAGE);
}
}
private void logMessage(String dto, JSONObject jsonResponse, String url, Integer messageType) {
private void logMessage(String dto, String title, JSONObject jsonResponse, String url, Integer messageType) {
LawsUnifiedTodoLog logEntry = new LawsUnifiedTodoLog();
logEntry.setJsonStr(dto);
logEntry.setResponseBody(JSON.toJSONString(jsonResponse));
logEntry.setState("0".equals(jsonResponse.getString("code")) ? 1 : 2);
logEntry.setMessageType(messageType);
logEntry.setUrl(url);
logEntry.setTitle(title);
lawsUnifiedTodoLogService.add(logEntry);
}
private void logError(String dto, String errorMessage, String url, Integer messageType) {
private void logError(String dto, String title, String errorMessage, String url, Integer messageType) {
LawsUnifiedTodoLog logEntry = new LawsUnifiedTodoLog();
logEntry.setJsonStr(dto);
logEntry.setResponseBody(errorMessage);
logEntry.setState(2);
logEntry.setMessageType(messageType);
logEntry.setUrl(url);
logEntry.setTitle(title);
lawsUnifiedTodoLogService.add(logEntry);
log.error("飞书发送消息异常: " + errorMessage);
}
@@ -87,4 +87,11 @@ public class LawsUnifiedTodoLog {
@ApiModelProperty(value="更新时间")
private Date updateTime;
/**
* 标题
*/
@TableField(value = "title")
@ApiModelProperty(value="标题")
private String title;
}
@@ -111,13 +111,13 @@ public class UnifiedTodoServiceImpl implements PushWorkflowIntegrationAPI {
String reqJsonString = JSONObject.toJSONString(unifiedTodoVOList);
String jsonString = JSONObject.toJSONString(unifiedTodoList);
log.info("统一待办推送入参" + jsonString);
push(ip + todoUrl,jsonString, reqJsonString);
push(ip + todoUrl,jsonString, reqJsonString, unifiedTodoList.get(0).getRequestname());
}catch (Exception e){
log.error("统一待办推送异常",e);
}
}
private void push(String url, String jsonString, String reqJsonString) {
private void push(String url, String jsonString, String reqJsonString, String title) {
// 设置最大重试次数
int maxRetries = 3;
// 当前重试次数
@@ -151,6 +151,7 @@ public class UnifiedTodoServiceImpl implements PushWorkflowIntegrationAPI {
lawsUnifiedTodoLog.setUrl(url);
lawsUnifiedTodoLog.setJsonStr(reqJsonString);
lawsUnifiedTodoLog.setMessageType(1);
lawsUnifiedTodoLog.setTitle(title);
if (retries == maxRetries){
lawsUnifiedTodoLog.setState(2);
}else {
+1 -1
View File
@@ -23,7 +23,7 @@
<dependency>
<groupId>com.jero.boot</groupId>
<artifactId>laws-module-system</artifactId>
<version>${jero.version}</version>
<version>2.5.2</version>
</dependency>
<dependency>
<groupId>com.jero.boot</groupId>
@@ -59,7 +59,6 @@ import com.jero.modules.system.service.ISysDepartService;
import com.jero.modules.system.service.ISysDictItemService;
import com.jero.modules.system.service.ISysUserService;
import com.jero.modules.system.util.SysWaterMarkUtil;
import com.jero.modules.system.util.UserUtils;
import com.jero.modules.tag.entity.LawsArea;
import com.jero.modules.tag.entity.LawsTag;
import com.jero.modules.tag.enums.FieldShowTypeEnum;
@@ -71,6 +70,8 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFSheet;
@@ -157,8 +158,6 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
@Resource
private ILawsPartNameService partNameService;
@Resource
private ISysUserService sysUserRoleService;
@Resource
private ILawsPartNameStandardService partNameStandardService;
@Resource
private ISysBaseAPI sysBaseAPI;
@@ -1419,8 +1418,8 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
IPage<Map<String, Object>> commonPage = this.getExportData(parameterMap, headers);
List<Map<String, Object>> records = commonPage.getRecords();
XSSFWorkbook workbook = new XSSFWorkbook();
XSSFSheet sheet = workbook.createSheet(sheetName);
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.createSheet(sheetName);
Row headerRow = sheet.createRow(0);
for (int i = 0; i < headers.size(); i++) {
@@ -1445,7 +1444,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
}
// 设置响应头和内容类型
String encodedFileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
String encodedFileName = URLEncoder.encode(fileName + ".xls", "UTF-8");
response.setHeader("Content-Disposition", "attachment; filename=" + encodedFileName);
// 写出到响应流
@@ -2064,12 +2063,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
parameterMap.remove(FieldCommon.AUTH_DEPT);
}
}
// 外标引用标准
// 如果当前登陆人是那几种管理员角色,则不需要授权部门筛选
String userId = UserUtils.getUserId();
SysUser user = sysUserService.getById(userId);
// 管理员有所有外标的权限
List<String> roleList = sysUserRoleService.getRole(user.getUsername());
adminRoleCodeList.addAll(enterpriseDetailRoleCodeList);
// 体系
String standardSystem = (String) parameterMap.get(FieldCommon.STANDARD_SYSTEM);