1、bug fix

2、利元亨——仿真待办接口
This commit is contained in:
2025-12-16 09:10:45 +08:00
parent fafdd02c9b
commit 7acd39f0fe
13 changed files with 344 additions and 79 deletions

View File

@@ -0,0 +1,32 @@
// common模块com.xxx.common.config.CommonConfig
package com.sdm.common.config;
import org.springframework.boot.env.YamlPropertySourceLoader;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.io.support.DefaultPropertySourceFactory;
import org.springframework.core.io.support.EncodedResource;
import java.io.IOException;
import java.util.List;
/**
* 加载common模块的自定义配置文件
* encoding解决中文乱码
*/
@Configuration
@PropertySource(value = "classpath:common.yml", factory = CommonConfig.YamlPropertySourceFactory.class)
public class CommonConfig {
// 自定义YamlPropertySourceFactory解决@PropertySource不支持yml的问题
public static class YamlPropertySourceFactory extends DefaultPropertySourceFactory {
@Override
public org.springframework.core.env.PropertySource<?> createPropertySource(String name, EncodedResource resource) throws IOException {
if (resource == null) {
return super.createPropertySource(name, resource);
}
List<org.springframework.core.env.PropertySource<?>> sources = new YamlPropertySourceLoader()
.load(resource.getResource().getFilename(), resource.getResource());
return sources.get(0);
}
}
}

View File

@@ -0,0 +1,17 @@
package com.sdm.common.entity.enums;
public enum ValueTypeEnum {
DEFAULT("default")
;
String value;
ValueTypeEnum(String i) {
value = i;
}
public String getValue() {
return value;
}
}

View File

@@ -0,0 +1,74 @@
package com.sdm.common.entity.pojo.lyric;
import lombok.Data;
import java.util.Date;
@Data
public class TodoEmulationInfo {
private Integer id;
private Integer todoId;
private String threeDimensionalPerformer;
private String emulationPerformer;
private String emulationRegistrant;
private String emulationExecutor;
private String emulationType;
private String emulationResult;
private String emulationDemand;
private String robotBrand;
private String axis;
private String beatRequirements;
private String threeDimensionalRepositoryPath;
private String resultPath;
private String resultDescribe;
private String analysisType;
private String analysisNum;
private String emulationTime;
private String software;
private String resultFinishTime;
private String type;
private String createBy;
private String createTime;
private String modify_by;
private String modify_time;
private String result_file_id;
private String difficulty;
private String required_time;
private String isLongTerm;
private String animationUse;
private String limitedUse;
private String emergencyStatement;
private String status;
private String subject;
private String describes;
private String project;
private String performer;
private Date planStartTime;
private Date requirementsTime;
private Date startTime;
private Date finishTime;
private Date pausedTime;
private Date introduceBy;
private Date closedBy;
private Date closedTime;
private String followBy;
private String stationNum;
private String projectName;
private String projectModel;
private String projectStage;
private String verifierNo;
private String progress;
private String todoNum;
private String progressDescription;
private String realWorkHour;
private String verifier;
private String followByName;
private String performerName;
private String workHouPlan;
private String introduceByName;
private String turnDownReason;
private String projectType;
private String projectGroup;
private String finishedBy;
private String standardWorkHour;
}

View File

@@ -2,7 +2,9 @@ package com.sdm.common.service.lyric;
import com.alibaba.fastjson2.JSONObject;
import com.sdm.common.common.SdmResponse;
import com.sdm.common.entity.pojo.lyric.TodoEmulationInfo;
import com.sdm.common.utils.HttpUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
@@ -18,6 +20,8 @@ import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContextBuilder;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils;
@@ -27,32 +31,49 @@ import java.nio.charset.StandardCharsets;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.sql.*;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Service
@Slf4j
@RefreshScope
public class LyricIntegrateService {
//测试开发环境
private final String appKey = "e9eb516aa02a43a29e227a0d901ec5f1";
@Value("${appKey}")
private String appKey;
private final String appSecret = "9fac43db08634aaf8a9fe5fb9468de9d";
@Value("${appSecret}")
private String appSecret;
//海葵云url
private final String HK_CLOUD_URL = "https://v15.lyh.haikuicloud.com";
@Value("${HK_CLOUD_URL}")
private String HK_CLOUD_URL;
//海葵云获取用户token url后缀
private final String HK_USER_TOKEN_URL_SUFFIX = "/merchant/openapi/user/login/jobNo";
@Value("${HK_USER_TOKEN_URL_SUFFIX}")
private String HK_USER_TOKEN_URL_SUFFIX;
//海葵云获取单个用户信息url后缀
private final String HK_SIMPLE_USER_URL_SUFFIX = "/merchant/api/user/getSimpleUserInfo";
@Value("${HK_SIMPLE_USER_URL_SUFFIX}")
private String HK_SIMPLE_USER_URL_SUFFIX;
//海葵云上传文件url后缀
private final String HK_UPLOAD_FILE_URL_SUFFIX = "/haikui-oa/autoCreateFlow/uploadFile";
@Value("${HK_UPLOAD_FILE_URL_SUFFIX}")
private String HK_UPLOAD_FILE_URL_SUFFIX;
//EP系统URL
private final String EP_URL = "https://ep-url.dev.haikuicloud.com";
@Value("${EP_URL}")
private String EP_URL;
//推送代办状态url后缀
private final String QUERY_TODO_STATUS_SUFFIX = "/todoApi/todo/emulation/dm/status";
@Value("${QUERY_TODO_STATUS_SUFFIX}")
private String QUERY_TODO_STATUS_SUFFIX;
//查询待办结果url后缀
private final String QUERY_TODO_RESULT_SUFFIX = "/todoApi/todo/emulation/dm/result";
@Value("${QUERY_TODO_RESULT_SUFFIX}")
private String QUERY_TODO_RESULT_SUFFIX;
//查询待办附加url后缀
private final String QUERY_TOD_ATTACHMENT_SUFFIX = "/todoApi/todo/emulation/dm/attachments";
@Value("${QUERY_TOD_ATTACHMENT_SUFFIX}")
private String QUERY_TOD_ATTACHMENT_SUFFIX;
//生产环境
/**
@@ -61,6 +82,16 @@ public class LyricIntegrateService {
private final String EP_URL = "https://ep-url.lyh.haikuicloud.com;
*/
@Value("${URL}")
private String URL;
@Value("${USER_NAME}")
private String USERNAME; // 你的 MySQL 用户名
@Value("${PASSWORD}")
private String PASSWORD; // 你的 MySQL 密码
/**
* 生成海葵云token签名
*
@@ -279,9 +310,32 @@ public class LyricIntegrateService {
return null;
}
public SdmResponse getTodoList()
{
return null;
/**
* 获取待办列表
* @return
*/
public SdmResponse getTodoList() {
String todayStartTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(LocalDate.now().atStartOfDay().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()));
String sql = "SELECT * FROM V_TODO_EMULATION_INFO WHERE create_time > ? AND status = ?";
// 声明JDBC核心对象try-with-resources 自动关闭资源)
try (Connection conn = DriverManager.getConnection(URL, USERNAME, PASSWORD)) {
PreparedStatement stmt = conn.prepareStatement(sql);
stmt.setString(1,todayStartTime);
stmt.setString(2,"0");
// 执行视图查询
ResultSet rs = stmt.executeQuery();
while (rs.next()) {
String projectName = rs.getString("projectName");
String status = rs.getString("status");
Date createTime = rs.getDate("createTime");
log.info("projectName为{}status{}createTime为{}", projectName, status,createTime);
}
} catch (SQLException e) {
// 异常处理
System.err.println("JDBC 操作异常:" + e.getMessage());
log.info(e.getMessage());
}
return SdmResponse.success();
}

View File

@@ -0,0 +1,23 @@
# 测试开发环境
appKey : e9eb516aa02a43a29e227a0d901ec5f1
appSecret : 9fac43db08634aaf8a9fe5fb9468de9d
# 海葵云url
HK_CLOUD_URL : https:#v15.lyh.haikuicloud.com
#海葵云获取用户token url后缀
HK_USER_TOKEN_URL_SUFFIX : /merchant/openapi/user/login/jobNo
#海葵云获取单个用户信息url后缀
HK_SIMPLE_USER_URL_SUFFIX : /merchant/api/user/getSimpleUserInfo
#海葵云上传文件url后缀
HK_UPLOAD_FILE_URL_SUFFIX : /haikui-oa/autoCreateFlow/uploadFile
#EP系统URL
EP_URL : https:#ep-url.dev.haikuicloud.com
#推送代办状态url后缀
QUERY_TODO_STATUS_SUFFIX : /todoApi/todo/emulation/dm/status
#查询待办结果url后缀
QUERY_TODO_RESULT_SUFFIX : /todoApi/todo/emulation/dm/result
#查询待办附加url后缀
QUERY_TOD_ATTACHMENT_SUFFIX : /todoApi/todo/emulation/dm/attachments
URL : jdbc:mysql://127.0.0.1:3306/spdm_baseline?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
USER_NAME : root
PASSWORD : ldy123456