添加利元亨集成代码,添加任务置信度和难度系数统计接口
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
package com.sdm.common.feign.impl.project;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.feign.inter.project.ISimulationTaskFeignClient;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class SimulationTaskFeignClientImpl implements ISimulationTaskFeignClient {
|
||||
@@ -13,10 +17,10 @@ public class SimulationTaskFeignClientImpl implements ISimulationTaskFeignClient
|
||||
ISimulationTaskFeignClient simulationTaskFeignClient;
|
||||
|
||||
@Override
|
||||
public SdmResponse getTaskConfidenceStatistics() {
|
||||
public SdmResponse<List<JSONObject>> getTaskConfidenceStatistics() {
|
||||
try {
|
||||
simulationTaskFeignClient.getTaskConfidenceStatistics();
|
||||
return SdmResponse.success();
|
||||
return SdmResponse.success(new ArrayList<>());
|
||||
} catch (Exception e) {
|
||||
log.error("内部调用仿真任务置信度统计失败", e);
|
||||
return SdmResponse.failed("内部调用仿真任务置信度统计失败");
|
||||
@@ -24,10 +28,10 @@ public class SimulationTaskFeignClientImpl implements ISimulationTaskFeignClient
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse getTaskDifficultStatistics() {
|
||||
public SdmResponse<List<JSONObject>> getTaskDifficultStatistics() {
|
||||
try {
|
||||
simulationTaskFeignClient.getTaskDifficultStatistics();
|
||||
return SdmResponse.success();
|
||||
return SdmResponse.success(new ArrayList<>());
|
||||
} catch (Exception e) {
|
||||
log.error("内部调用仿真任务难度系数统计统计失败", e);
|
||||
return SdmResponse.failed("内部调用仿真任务难度系数统计统计失败");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.sdm.common.feign.inter.project;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.project.SpdmReportReq;
|
||||
import com.sdm.common.entity.req.system.LaunchApproveReq;
|
||||
@@ -19,13 +20,13 @@ public interface ISimulationTaskFeignClient {
|
||||
* @return SdmResponse
|
||||
*/
|
||||
@GetMapping("/task/getTaskConfidenceStatistics")
|
||||
SdmResponse getTaskConfidenceStatistics();
|
||||
SdmResponse<List<JSONObject>> getTaskConfidenceStatistics();
|
||||
|
||||
/**
|
||||
* 仿真任务难度系数统计
|
||||
* @return SdmResponse
|
||||
*/
|
||||
@GetMapping(value = "/task/getTaskDifficultStatistics")
|
||||
SdmResponse getTaskDifficultStatistics();
|
||||
SdmResponse<List<JSONObject>> getTaskDifficultStatistics();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.sdm.common.service.lyric;
|
||||
|
||||
public class LyricAttachmentInfo {
|
||||
|
||||
public int id;
|
||||
|
||||
public String name;
|
||||
|
||||
public String filePath;
|
||||
|
||||
public String thumbnailPath;
|
||||
|
||||
public int fileId;
|
||||
|
||||
public long fileSize;
|
||||
|
||||
public String fileType;
|
||||
|
||||
public String createBy;
|
||||
|
||||
public String modifyBy;
|
||||
|
||||
public String createTime;
|
||||
|
||||
public String modifyTime;
|
||||
|
||||
public String source;
|
||||
|
||||
public String copyId;
|
||||
|
||||
public String haiKuiFileKey;
|
||||
|
||||
public String oaProcessId;
|
||||
|
||||
public String copyCurrentApprovalNode;
|
||||
|
||||
public String copyCurrentApproveBy;
|
||||
|
||||
public String copyApproveTime;
|
||||
}
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.sdm.common.service.lyric;
|
||||
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.alibaba.fastjson2.JSONWriter;
|
||||
import com.fasterxml.jackson.databind.ser.SerializerFactory;
|
||||
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;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
@@ -16,7 +18,6 @@ import org.apache.http.entity.mime.MultipartEntityBuilder;
|
||||
import org.apache.http.entity.mime.content.FileBody;
|
||||
import org.apache.http.entity.mime.content.StringBody;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
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;
|
||||
@@ -67,7 +68,7 @@ public class LyricIntegrateService {
|
||||
private String EP_URL;
|
||||
//推送代办状态url后缀
|
||||
@Value("${QUERY_TODO_STATUS_SUFFIX}")
|
||||
private String QUERY_TODO_STATUS_SUFFIX;
|
||||
private String PUSH_TODO_STATUS_SUFFIX;
|
||||
//查询待办结果url后缀
|
||||
@Value("${QUERY_TODO_RESULT_SUFFIX}")
|
||||
private String QUERY_TODO_RESULT_SUFFIX;
|
||||
@@ -95,20 +96,31 @@ public class LyricIntegrateService {
|
||||
/**
|
||||
* 生成海葵云token签名
|
||||
*
|
||||
* @param appKey
|
||||
* @param object
|
||||
* @param appSecret
|
||||
* @param appSecret
|
||||
* @param jobNo
|
||||
* @return
|
||||
*/
|
||||
private String calculateSignHkcloud(String appKey, String appSecret, String jobNo) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("appKey", appKey);
|
||||
jsonObject.put("appSecret", appSecret);
|
||||
jsonObject.put("jobNo", jobNo);
|
||||
String addSalStr = JSONObject.toJSONString(jsonObject);
|
||||
private String calculateSignHkcloud(Object object, String appSecret) {
|
||||
JSONObject fastjson = JSONObject.parseObject(JSONObject.toJSONString(object));
|
||||
fastjson.remove("sign");
|
||||
fastjson.put("appSecret", appSecret);
|
||||
String addSalStr = JSONObject.toJSONString(fastjson, JSONWriter.Feature.MapSortField);
|
||||
return DigestUtils.md5DigestAsHex(addSalStr.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验签名
|
||||
* @param object
|
||||
* @param sign
|
||||
* @param appSecret
|
||||
* @return
|
||||
*/
|
||||
private boolean verificationSign(Object object, String sign,String appSecret) {
|
||||
String calcSign = calculateSignHkcloud(object, appSecret);
|
||||
return calcSign.equals(sign);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取根据工号获取用户token
|
||||
*
|
||||
@@ -119,12 +131,16 @@ public class LyricIntegrateService {
|
||||
* @return
|
||||
*/
|
||||
public String getHKCloudToken(String appKey, String appSecret, String jobNo, String tokenUrl) {
|
||||
String sign = calculateSignHkcloud(appKey, appSecret, jobNo);
|
||||
String token = null;
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("jobNo", jobNo);
|
||||
jsonObject.put("appKey", appKey);
|
||||
jsonObject.put("sign", sign);
|
||||
jsonObject.put("jobNo", jobNo);
|
||||
String sign = calculateSignHkcloud(jsonObject, appSecret);
|
||||
boolean verify = verificationSign(jsonObject, sign, appSecret);
|
||||
String token = null;
|
||||
JSONObject paramObject = new JSONObject();
|
||||
paramObject.put("jobNo", jobNo);
|
||||
paramObject.put("appKey", appKey);
|
||||
paramObject.put("sign", sign);
|
||||
try {
|
||||
String result = HttpUtil.httpPost(tokenUrl, null, jsonObject.toJSONString());
|
||||
JSONObject resultJson = JSONObject.parseObject(result);
|
||||
@@ -302,12 +318,69 @@ public class LyricIntegrateService {
|
||||
*/
|
||||
public SdmResponse pushTodoStatus(int todoId,String reason,int progress,String progressDescription,String userNo,String statusType)
|
||||
{
|
||||
return null;
|
||||
SdmResponse response = SdmResponse.failed("推送代办状态失败");
|
||||
String url = EP_URL+PUSH_TODO_STATUS_SUFFIX;
|
||||
Map<String,String> header = new HashMap<>();
|
||||
header.put("Content-Type","application/x-www-form-urlencoded,application/json");
|
||||
JSONObject paramObj = new JSONObject();
|
||||
paramObj.put("todoId",todoId);
|
||||
paramObj.put("reason",reason);
|
||||
paramObj.put("progress",progress);
|
||||
paramObj.put("progressDescription",progressDescription);
|
||||
paramObj.put("userNo",userNo);
|
||||
paramObj.put("statusType",statusType);
|
||||
try {
|
||||
String result = HttpUtil.httpPost(url, header, paramObj.toJSONString());
|
||||
if(result != null && !result.isEmpty())
|
||||
{
|
||||
JSONObject responseJson = JSONObject.parseObject(result);
|
||||
if(responseJson != null && responseJson.containsKey("success"))
|
||||
{
|
||||
if(responseJson.getBoolean("success"))
|
||||
{
|
||||
response = SdmResponse.success();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
public SdmResponse getTodoAttachments()
|
||||
/**
|
||||
* 查询待办附件
|
||||
* @param todoId
|
||||
* @return
|
||||
*/
|
||||
public SdmResponse queryTodoAttachments(int todoId)
|
||||
{
|
||||
return null;
|
||||
SdmResponse response = SdmResponse.failed("获取待办附件失败");
|
||||
String url = EP_URL+QUERY_TOD_ATTACHMENT_SUFFIX+"?todoId="+todoId;
|
||||
Map<String,String> header = new HashMap<>();
|
||||
header.put("Content-Type","application/x-www-form-urlencoded");
|
||||
try
|
||||
{
|
||||
String result = HttpUtil.httpPost(url, header, "");
|
||||
if(result != null && !result.isEmpty())
|
||||
{
|
||||
JSONObject responseJson = JSONObject.parseObject(result);
|
||||
if(responseJson != null && responseJson.containsKey("data"))
|
||||
{
|
||||
JSONArray data = responseJson.getJSONArray("data");
|
||||
response = SdmResponse.success();
|
||||
response.setData(data);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.sdm.common.service.lyric;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
public class LyricMainPlanInfo {
|
||||
|
||||
@Schema(description = "计划完成时间")
|
||||
public String requirements_time;
|
||||
|
||||
@Schema(description = "计划工期")
|
||||
public String plan_duration;
|
||||
|
||||
@Schema(description = "计划工时")
|
||||
public String work_hour_plan;
|
||||
|
||||
@Schema(description = "标准工时")
|
||||
public String offer_duration;
|
||||
|
||||
@Schema(description = "进度")
|
||||
public String progress;
|
||||
|
||||
@Schema(description = "状态")
|
||||
public String status;
|
||||
|
||||
@Schema(description = "开始时间")
|
||||
public String start_time;
|
||||
|
||||
@Schema(description = "完成时间")
|
||||
public String finish_time;
|
||||
|
||||
@Schema(description = "实际工期")
|
||||
public String standard_duration;
|
||||
|
||||
@Schema(description = "实际工时")
|
||||
public String real_work_hour;
|
||||
|
||||
@Schema(description = "风险等级")
|
||||
public String risk_classify;
|
||||
|
||||
@Schema(description = "项目表ID")
|
||||
public String project_id;
|
||||
|
||||
@Schema(description = "批次表ID")
|
||||
public String batch_id;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.sdm.common.service.lyric;
|
||||
|
||||
public class LyricProjectBaseInfo {
|
||||
public String project_num;
|
||||
|
||||
public String project_name;
|
||||
|
||||
public String stage;
|
||||
|
||||
public String domain;
|
||||
|
||||
public String client_name;
|
||||
|
||||
public String difficultyType;
|
||||
|
||||
public String abnormal_rate;
|
||||
|
||||
public String produceLine;
|
||||
|
||||
public String process_section;
|
||||
|
||||
public String program_manager;
|
||||
|
||||
public String program_team;
|
||||
|
||||
public String reference_item;
|
||||
|
||||
public String schemes_finishorclose_time;
|
||||
|
||||
public String schemes_close_reasons;
|
||||
|
||||
public String drawings;
|
||||
|
||||
public String reuse_drawings;
|
||||
|
||||
public String plan_io;
|
||||
|
||||
public String part;
|
||||
|
||||
public String material_quality;
|
||||
|
||||
public String put_mode;
|
||||
|
||||
public String screw_material;
|
||||
|
||||
public String machine_type;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.sdm.common.service.lyric;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
public class LyricProjectBatchInfo {
|
||||
@Schema(description = "项目ID")
|
||||
public String project_id;
|
||||
|
||||
@Schema(description = "批次名称")
|
||||
public String batch;
|
||||
|
||||
@Schema(description = "工厂")
|
||||
public String works;
|
||||
|
||||
@Schema(description = "订单数量")
|
||||
public int order_quantity;
|
||||
|
||||
@Schema(description = "项目状态")
|
||||
public int status;
|
||||
|
||||
@Schema(description = "批次进度")
|
||||
public int project_progress_status;
|
||||
|
||||
@Schema(description = "项目出机条件")
|
||||
public String minted_condition;
|
||||
|
||||
@Schema(description = "设备出机地址(市)")
|
||||
public String client_city;
|
||||
|
||||
@Schema(description = "设备出机地址(区)")
|
||||
public String client_region;
|
||||
|
||||
@Schema(description = "军令状时间")
|
||||
public String sat_time;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.sdm.common.service.lyric;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
public class LyricProjectPdt {
|
||||
|
||||
@Schema(description = "项目ID")
|
||||
public String project_id;
|
||||
|
||||
@Schema(description = "项目号")
|
||||
public String project_num;
|
||||
|
||||
@Schema(description = "项目角色")
|
||||
public String project_role;
|
||||
|
||||
@Schema(description = "角色类型")
|
||||
public String type;
|
||||
|
||||
@Schema(description = "角色类型")
|
||||
public String user;
|
||||
|
||||
@Schema(description = "人员姓名")
|
||||
public String name;
|
||||
|
||||
@Schema(description = "机台号")
|
||||
public String machine_number;
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
package com.sdm.common.service.lyric;
|
||||
|
||||
import io.netty.channel.ChannelHandler;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
public class LyricTodoEntity {
|
||||
|
||||
public int id;
|
||||
|
||||
@Schema(description = "待办ID")
|
||||
public int todo_id;
|
||||
|
||||
@Schema(description = "3D负责人")
|
||||
public String three_dimensional_performer;
|
||||
|
||||
@Schema(description = "仿真负责人")
|
||||
public String emulation_performer;
|
||||
|
||||
@Schema(description = "仿真登记人")
|
||||
public String emulation_registrant;
|
||||
|
||||
@Schema(description = "仿真执行人")
|
||||
public String emulation_executor;
|
||||
|
||||
@Schema(description = "仿真类型")
|
||||
public String emulation_type;
|
||||
|
||||
@Schema(description = "仿真结果")
|
||||
public String emulation_result;
|
||||
|
||||
@Schema(description = "仿真需求")
|
||||
public String emulation_demand;
|
||||
|
||||
@Schema(description = "机器人品牌")
|
||||
public String robot_brand;
|
||||
|
||||
@Schema(description = "四轴,六轴")
|
||||
public String axis;
|
||||
|
||||
@Schema(description = "节拍要求")
|
||||
public String beat_requirements;
|
||||
|
||||
@Schema(description = "3D存放路径")
|
||||
public String three_dimensional_repository_path;
|
||||
|
||||
@Schema(description = "报告路径")
|
||||
public String result_path;
|
||||
|
||||
@Schema(description = "结果描述")
|
||||
public String result_describe;
|
||||
|
||||
@Schema(description = "分析类型")
|
||||
public String analysis_type;
|
||||
|
||||
@Schema(description = "分析数量")
|
||||
public int analysis_num;
|
||||
|
||||
@Schema(description = "仿真耗时")
|
||||
public float emulation_time;
|
||||
|
||||
@Schema(description = "使用软件")
|
||||
public String software;
|
||||
|
||||
@Schema(description = "完成时间")
|
||||
public String result_finish_time;
|
||||
|
||||
@Schema(description = "类型(仿真结果,仿真信息)")
|
||||
public String type;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
public String create_by;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
public String create_time;
|
||||
|
||||
@Schema(description = "修改人")
|
||||
public String modify_by;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
public String modify_time;
|
||||
|
||||
@Schema(description = "仿真结果附加")
|
||||
public String result_file_id;
|
||||
|
||||
@Schema(description = "难度等级(1-5)")
|
||||
public String difficulty;
|
||||
|
||||
@Schema(description = "需求时间")
|
||||
public String required_time;
|
||||
|
||||
@Schema(description = "是否长期待办")
|
||||
public byte is_long_term;
|
||||
|
||||
@Schema(description = "动画用途")
|
||||
public String animation_use;
|
||||
|
||||
@Schema(description = "有限元仿真用途")
|
||||
public String limited_use;
|
||||
|
||||
@Schema(description = "紧急情况说明")
|
||||
public String emergency_statement;
|
||||
|
||||
@Schema(description = "状态")
|
||||
public String status;
|
||||
|
||||
@Schema(description = "主题")
|
||||
public String subject;
|
||||
|
||||
@Schema(description = "描述")
|
||||
public String describes;
|
||||
|
||||
@Schema(description = "项目")
|
||||
public String project;
|
||||
|
||||
@Schema(description = "责任人(多个用逗号隔开)")
|
||||
public String performer;
|
||||
|
||||
@Schema(description = "计划开始时间")
|
||||
public String plan_start_time;
|
||||
|
||||
@Schema(description = "要求完成时间")
|
||||
public String requirements_time;
|
||||
|
||||
@Schema(description = "开始时间")
|
||||
public String start_time;
|
||||
|
||||
@Schema(description = "完成时间")
|
||||
public String finish_time;
|
||||
|
||||
@Schema(description = "暂停时间")
|
||||
public String paused_time;
|
||||
|
||||
@Schema(description = "提出人")
|
||||
public String introduce_by;
|
||||
|
||||
@Schema(description = "关闭人")
|
||||
public String close_by;
|
||||
|
||||
@Schema(description = "关闭时间")
|
||||
public String close_time;
|
||||
|
||||
@Schema(description = "关注人(多个用逗号隔开)")
|
||||
public String follow_by;
|
||||
|
||||
@Schema(description = "工位")
|
||||
public String station_num;
|
||||
|
||||
@Schema(description = "项目名称")
|
||||
public String project_name;
|
||||
|
||||
@Schema(description = "项目机型")
|
||||
public String project_model;
|
||||
|
||||
@Schema(description = "项目阶段")
|
||||
public String project_stage;
|
||||
|
||||
@Schema(description = "确认人工号")
|
||||
public String verifier_no;
|
||||
|
||||
@Schema(description = "进度")
|
||||
public String progress;
|
||||
|
||||
@Schema(description = "任务单号")
|
||||
public String todo_num;
|
||||
|
||||
@Schema(description = "进度说明")
|
||||
public String progress_description;
|
||||
|
||||
@Schema(description = "实际工时")
|
||||
public String real_work_hour;
|
||||
|
||||
@Schema(description = "确认人")
|
||||
public String verifier;
|
||||
|
||||
@Schema(description = "关注人")
|
||||
public String follow_by_name;
|
||||
|
||||
@Schema(description = "责任人姓名")
|
||||
public String performer_name;
|
||||
|
||||
@Schema(description = "计划工时")
|
||||
public String work_hour_plan;
|
||||
|
||||
@Schema(description = "提出人姓名")
|
||||
public String introduce_by_name;
|
||||
|
||||
@Schema(description = "驳回原因")
|
||||
public String turn_down_reason;
|
||||
|
||||
@Schema(description = "项目类型")
|
||||
public String project_type;
|
||||
|
||||
@Schema(description = "项目组")
|
||||
public String project_group;
|
||||
|
||||
@Schema(description = "完成人")
|
||||
public String finished_by;
|
||||
|
||||
@Schema(description = "标准工时")
|
||||
public String standard_work_hour;
|
||||
|
||||
}
|
||||
@@ -206,6 +206,7 @@ public class SystemOperate {
|
||||
.withIssuer(jwtToken.getUserName()+":"+jwtToken.getIssuer()+":1") //用户名:用户ID:租户
|
||||
.withSubject(jwtToken.getSubject()) //appName
|
||||
.withExpiresAt(expiresAt)
|
||||
.withAudience(key)
|
||||
.withIssuedAt(issuedAt)
|
||||
.withJWTId(jwtToken.getJwtId()) //随机UUID
|
||||
.withClaim("claimsMap", jwtToken.getClaimMap()) //保持默认值
|
||||
@@ -233,6 +234,26 @@ public class SystemOperate {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析JWT内容
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
public static DecodedJWT decodeJwt(String token)
|
||||
{
|
||||
return JWT.decode(token);
|
||||
/*String header = decodedJwt.getHeader();
|
||||
String issuer = decodedJwt.getIssuer();
|
||||
Date expiresAt = decodedJwt.getExpiresAt();
|
||||
Date now = new Date();
|
||||
if(expiresAt.before(now))
|
||||
{
|
||||
log.error("login expired");
|
||||
}
|
||||
return decodedJwt;
|
||||
*/
|
||||
}
|
||||
|
||||
public static boolean verify( String pubKey, String token) {
|
||||
// 从公钥缓存中获取对应的密钥编号的公钥
|
||||
PublicKey publicKey =getPublicKey(pubKey);
|
||||
@@ -245,10 +266,10 @@ public class SystemOperate {
|
||||
return false;
|
||||
}
|
||||
// 验证自己是否为接收方
|
||||
List<String> audience = decodedJwt.getAudience();
|
||||
/*List<String> audience = decodedJwt.getAudience();
|
||||
if (audience != null && !audience.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
}*/
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
return false;
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
# 测试开发环境
|
||||
appKey : e9eb516aa02a43a29e227a0d901ec5f1
|
||||
appSecret : 9fac43db08634aaf8a9fe5fb9468de9d
|
||||
#appKey : 380ad3deb578424c9ca5178383f732c1
|
||||
#appSecret : 805c316f35024b8b9566ca67b4991c42
|
||||
#appKey : d39820947556421aa329b070e669dfa2
|
||||
#corpKey : e906d13947944947921bb32c8fcffc6e
|
||||
#appSecret : 13cff5f8fb1c479297370a7d41853158
|
||||
appKey : e9eb516aa02a43a29e227a0d901ec5f1
|
||||
appSecret : 9fac43db08634aaf8a9fe5fb9468de9d
|
||||
# 海葵云url
|
||||
HK_CLOUD_URL : https:#v15.lyh.haikuicloud.com
|
||||
HK_CLOUD_URL : https:#url.lyhhaikuicloud.com
|
||||
# 海葵云获取用户token url后缀
|
||||
HK_USER_TOKEN_URL_SUFFIX : /merchant/openapi/user/login/jobNo
|
||||
# 海葵云获取单个用户信息url后缀
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.sdm.project.controller;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.task.TaskExportExcelFormat;
|
||||
import com.sdm.common.feign.inter.project.ISimulationTaskFeignClient;
|
||||
@@ -221,7 +222,7 @@ public class SimulationTaskController implements ISimulationTaskFeignClient {
|
||||
@SysLog("仿真任务置信度统计")
|
||||
@GetMapping("/getTaskConfidenceStatistics")
|
||||
@Operation(summary = "仿真任务置信度统计", description = "仿真任务置信度统计")
|
||||
public SdmResponse getTaskConfidenceStatistics() {
|
||||
public SdmResponse<List<JSONObject>> getTaskConfidenceStatistics() {
|
||||
return taskService.getTaskConfidenceStatistics();
|
||||
}
|
||||
|
||||
@@ -231,7 +232,7 @@ public class SimulationTaskController implements ISimulationTaskFeignClient {
|
||||
@SysLog("仿真任务难度系数统计")
|
||||
@GetMapping("/getTaskDifficultStatistics")
|
||||
@Operation(summary = "仿真任务难度系数统计", description = "仿真任务难度系数统计")
|
||||
public SdmResponse getTaskDifficultStatistics() {
|
||||
public SdmResponse<List<JSONObject>> getTaskDifficultStatistics() {
|
||||
return taskService.getTaskDifficultStatistics();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.sdm.project.controller;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.auth0.jwt.interfaces.DecodedJWT;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.bo.JwtToken;
|
||||
import com.sdm.common.entity.enums.NodeTypeEnum;
|
||||
import com.sdm.common.entity.req.data.GetSimulationTaskFileReq;
|
||||
import com.sdm.common.entity.req.data.UploadFilesReq;
|
||||
@@ -12,6 +14,8 @@ import com.sdm.common.entity.resp.data.FileMetadataInfoResp;
|
||||
import com.sdm.common.feign.impl.data.DataAnalysisFeignClientImpl;
|
||||
|
||||
import com.sdm.common.feign.inter.data.IDataFeignClient;
|
||||
import com.sdm.common.service.lyric.LyricIntegrateService;
|
||||
import com.sdm.common.utils.SystemOperate;
|
||||
import com.sdm.project.common.KeyResultTypeEnum;
|
||||
import com.sdm.project.model.entity.SimulationRunKeyResult;
|
||||
import com.sdm.project.model.req.KeyResultReq;
|
||||
@@ -58,7 +62,16 @@ public class YAModelController {
|
||||
@Resource
|
||||
ISimulationRunService runService;
|
||||
|
||||
@Autowired
|
||||
private LyricIntegrateService lyricIntegrateService;
|
||||
|
||||
private final String PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAo4hmt4m5CpMIE5DL8G60" +
|
||||
"cg63X6nEiNPt1yWB+kXDXQA0RaiqXhT4O78HT9BldrQVpyj6g4Z2mwPMfLBP6LjR" +
|
||||
"8QyLlwfMBJ2uUV5B4PlEWiF9pUK9tU0lPlByS+p0oIxX8XlvzbbGbkyWQaOQ6Sfl" +
|
||||
"FxB7eHu3r/hDOYtsMDcNe4hsuz1BnrAuRY6Yj+Hq2d4zPDetDgXeXs066z3qO6bL" +
|
||||
"N9r/2UkHZc4tdkpMJgxucwTuvAvmgRgdDfnd6sAVDHYPaIVuJHqWnEnEcQzq6zWb" +
|
||||
"1YPItc2FgDbXWpi8noz7wSjXDfBiTHU11nU5vv//xLVF83h5mbhk8dWHKq7bLUGp" +
|
||||
"9QIDAQAB";
|
||||
/**
|
||||
* 保存仿真模型数据
|
||||
*
|
||||
@@ -336,4 +349,41 @@ public class YAModelController {
|
||||
return taskService.syncCidTask(req);
|
||||
}
|
||||
|
||||
@GetMapping("verityCidWebToken")
|
||||
public SdmResponse verityCidWebToken(@RequestParam("token") String token)
|
||||
{
|
||||
//SystemOperate.decodeJwt(token);
|
||||
SdmResponse response = SdmResponse.success();
|
||||
JwtToken jwtToken = new JwtToken("keyId","","qinwei","spdm");
|
||||
String privateKey = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCjz2pItCtM2Itf3knLhA1ZWzTVtKKY692Eptk3ZUy4qjlv+2e6u78/cBYZsVa/1nOyHPtb2j9xZAsHYGKZGoh64UWSewUhRdUO15xBRr5DyGEdTWHjwc1GHf7c99rKCjKDO2Xdp7cpqYABOAxgkSA2vP5zqhSCq0FCqwleEPLG1aAa/kh/oUzCZLUoSjZIdqQOgHJTZojqNeQCOC6U8Q+kUcHdKbptewu1A6XK8DHV0WqiJJEG3kyaoAZ1kGtr6ETtGy++aRvJT9gZN4M4bIgucKtAu2dcqQHj9jZ1i2xwhY3nmLjqaz3y313/IEYpMTG8pnPb8eP5usHDaDmH8RqJAgMBAAECggEAAzz05WYGWxkGvEjpHYhJOUR3yWeuNSaodNhVf+ZVO2tGAmQuWz8d2zOshCqAw/8Jv3IaN+kbCvNG0okBufQP0ZoFZY1f/xXhzc7OTG4JEc7yuIEQl897btDl+lk97nOAJx7z9ws7MCwlFyEUAY6s29glkYTBrgmTmy1FXKIqImsLfVV3LgfL2Mkixn0YSSsbUh2b+dki1zxjct3hTGZVh29bKOpbflOaG0LqEO0UwSX92Y/ir+fKmC8zEFbi5HZANYODivm8DiwF7khpraayf78kG3liccOTMMLVxIHwNiS9wcLG8WPuVEphlXMT4Ev4lq5VFM3mVxtd9g21ESbuvwKBgQDmsgE8u66qKVBsndp2K9FV9VWYDA4fYfRswDAWnZDCzIdanT0NFPp8s3nZCVU4FfX4m958yOrJ/MVp6d58z6fgkYQh2qL2Wy6zRPaIxCc6JG3FheFSxfWyULU/mBBK02ntUZCXEs8XKjAfDvmxaVVeonv0nCSgVwxJ4ypB5BZ+owKBgQC1x0GDnWtMbNGUMx6tYtFGWQIgop4hVQe6ZNgkKaQX7gtMa5egEda6ga6wCTV3+ZvQ9tBa1DxUFb5N/TrtQdFm39gOSXyhWSrntUKqaSFo03GvXXvvze2D3+uXpk7S8yzWuuD3OYyYj9S3nFVZffymabfukuY7oY3AN0E0PALw4wKBgQDQiyGrMU6X7HkTdy9BnCLEvd7+cAdkPzyiAqp2B0IRlqrVM0c5SDmX+PaxSEqNROzyLJVX4Ji+t44OTKgf0+hCjckQgYDHi24QCMuEny2G1d+Vq40hMmsFIwh10JUJz0v2iMFYkFw86JpPuU3nHv1ZazD60xwZBhfJw10z62iaWQKBgH+EVgsUJS8pryO9cKnFBnXI/tsR+Mf9NDynfZBwvbIjxT1IxMb/fJi9XGQVMbMGIS5H1gXBmMiLsEJZgDrrzw/Ru2jaWFl/ib+dwjR1J4C3w6p3c/fXh+TY8hYiDm2hNTU1R5dmgaCMVXawbpcm8FN1Ghh8aJIwVJYgrNcNuiptAoGAO14DHGqUXZZ//erIYWVfL0CAMXqy38dqNmfbzSAXYyLDl6cn49CCHF0GXOfCOesQN9ToQbqpLrntFgcFe0hil5dIWYafk9fHjjR8N8g74ijErQmCEAQy22b06V0q7rLzEsU/HDVL+RZg2aY4hDN+ODHRdpdFkOxsCYV73gevVeo=";
|
||||
String pubKeyToken = SystemOperate.generateToken(jwtToken,privateKey,false);
|
||||
String pubKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAo89qSLQrTNiLX95Jy4QNWVs01bSimOvdhKbZN2VMuKo5b/tnuru/P3AWGbFWv9Zzshz7W9o/cWQLB2BimRqIeuFFknsFIUXVDtecQUa+Q8hhHU1h48HNRh3+3Pfaygoygztl3ae3KamAATgMYJEgNrz+c6oUgqtBQqsJXhDyxtWgGv5If6FMwmS1KEo2SHakDoByU2aI6jXkAjgulPEPpFHB3Sm6bXsLtQOlyvAx1dFqoiSRBt5MmqAGdZBra+hE7RsvvmkbyU/YGTeDOGyILnCrQLtnXKkB4/Y2dYtscIWN55i46ms98t9d/yBGKTExvKZz2/Hj+brBw2g5h/EaiQIDAQAB";
|
||||
if(!SystemOperate.verify(pubKey,token))
|
||||
{
|
||||
response = SdmResponse.failed("登录验证失败");
|
||||
}
|
||||
else
|
||||
{
|
||||
DecodedJWT decodedJWT = SystemOperate.decodeJwt(token);
|
||||
String issure = decodedJWT.getIssuer();
|
||||
if(issure != null)
|
||||
{
|
||||
response.setData(issure);
|
||||
}
|
||||
}
|
||||
lyricIntegrateService.getHKCloudSimpleUserInfo("05687");
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 接口调用token验证
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
private boolean verifyCidJwt(String token)
|
||||
{
|
||||
return SystemOperate.verify(PUBLIC_KEY, token);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.sdm.project.service;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.ExportExcelFormat;
|
||||
import com.sdm.common.entity.req.task.TaskExportExcelFormat;
|
||||
@@ -73,8 +74,8 @@ public interface ITaskService {
|
||||
|
||||
SdmResponse getTaskAchieveStatistics(TaskCompleteStatisticsReq req);
|
||||
|
||||
SdmResponse getTaskConfidenceStatistics();
|
||||
SdmResponse<List<JSONObject>> getTaskConfidenceStatistics();
|
||||
|
||||
SdmResponse getTaskDifficultStatistics();
|
||||
SdmResponse<List<JSONObject>> getTaskDifficultStatistics();
|
||||
|
||||
}
|
||||
|
||||
@@ -2394,8 +2394,27 @@ public class TaskServiceImpl implements ITaskService {
|
||||
return SdmResponse.success(resultResponse);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将自定义对象List转换为List<JSONObject>
|
||||
* @param objList 自定义对象列表
|
||||
* @param <T> 泛型(自定义对象类型)
|
||||
* @return List<JSONObject>
|
||||
*/
|
||||
public static <T> List<JSONObject> convertToJSONObjectList(List<T> objList) {
|
||||
if (objList == null || objList.isEmpty()) {
|
||||
return new ArrayList<>(); // 空列表返回空,避免NPE
|
||||
}
|
||||
List<JSONObject> jsonList = new ArrayList<>();
|
||||
for (T obj : objList) {
|
||||
JSONObject jsonObj = JSONObject.from(obj);
|
||||
jsonList.add(jsonObj);
|
||||
}
|
||||
return jsonList;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse getTaskConfidenceStatistics() {
|
||||
public SdmResponse<List<JSONObject>> getTaskConfidenceStatistics() {
|
||||
// 查询所有任务,再通过tag6去过滤,兼容多层级学科的情况
|
||||
// .eq(SimulationTask::getExeStatus,TaskExeStatusEnum.COMPLETED.getCode()) 暂时去掉筛选条件,方便调试
|
||||
List<SimulationTask> allTaskList= simulationTaskService.lambdaQuery()
|
||||
@@ -2450,11 +2469,11 @@ public class TaskServiceImpl implements ITaskService {
|
||||
taskConfidenceStatisticsRespList.add(taskConfidenceStatisticsResp);
|
||||
}
|
||||
}
|
||||
return SdmResponse.success(taskConfidenceStatisticsRespList);
|
||||
return SdmResponse.success(convertToJSONObjectList(taskConfidenceStatisticsRespList));
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse getTaskDifficultStatistics() {
|
||||
public SdmResponse<List<JSONObject>> getTaskDifficultStatistics() {
|
||||
// 查询所有任务,再通过tag6去过滤,兼容多层级学科的情况
|
||||
// .eq(SimulationTask::getExeStatus,TaskExeStatusEnum.COMPLETED.getCode()) 暂时去掉筛选条件,方便调试
|
||||
List<SimulationTask> allTaskList= simulationTaskService.lambdaQuery()
|
||||
@@ -2509,7 +2528,7 @@ public class TaskServiceImpl implements ITaskService {
|
||||
taskDifficultStatisticsRespList.add(taskDifficultStatisticsResp);
|
||||
}
|
||||
}
|
||||
return SdmResponse.success(taskDifficultStatisticsRespList);
|
||||
return SdmResponse.success(convertToJSONObjectList(taskDifficultStatisticsRespList));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -136,5 +136,25 @@ public class SimuluationTaskPoolController implements ISimuluationTaskPoolFeignC
|
||||
{
|
||||
return service.getTaskAndFlowTemplateRelateByFlowCode(flowCode);
|
||||
}
|
||||
|
||||
@GetMapping(value = "statisticDisciplineConfidence")
|
||||
public SdmResponse statisticDisciplineConfidence(@RequestParam("poolName") String poolName)
|
||||
{
|
||||
return service.statisicDisciplineConfidence(poolName);
|
||||
}
|
||||
|
||||
@GetMapping(value = "statisticDisciplineConfidenceTrend")
|
||||
public SdmResponse statisticDisciplineConfidenceTrend(@RequestParam("poolName") String poolName,@RequestParam("timeRange")String timeRange)
|
||||
{
|
||||
return service.staticDisciplineConfidenceTrend(poolName,timeRange);
|
||||
}
|
||||
|
||||
@GetMapping(value = "statisticDisciplineDifficulty")
|
||||
public SdmResponse statisticDisciplineDifficulty(@RequestParam("poolName") String poolName)
|
||||
{
|
||||
return service.statisicDisciplineDifficulty(poolName);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -155,6 +155,9 @@ public interface SimulationPoolMapper {
|
||||
@Delete("DELETE FROM simulation_pool_node WHERE uuid = #{nodeId}")
|
||||
int deleteTaskPoolNode(@Param("nodeId")String nodeId);
|
||||
|
||||
@Select("SELECT DISTINCT(nodeName) FROM simulation_pool_node WHERE nodeType='discipline' AND poolName=#{poolName}")
|
||||
List<String> queryTaskPoolAllDiscipline(@Param("poolName") String poolName);
|
||||
|
||||
|
||||
@Delete("DELETE FROM simulation_pool_node_extra WHERE nodeId=#{nodeId}")
|
||||
int deleteTaskPoolNodeExtra(@Param("nodeId")String nodeId);
|
||||
@@ -251,4 +254,23 @@ public interface SimulationPoolMapper {
|
||||
@Select("SELECT * FROM simulation_taskpool_flowtemplate_relate WHERE poolName=#{poolName} AND version=#{version}")
|
||||
List<SimulatePoolTaskFlowTemplateRelate> queryTaskFlowRelateByPoolVersion(@Param("poolName")String poolName,@Param("version")String version);
|
||||
|
||||
@Select("SELECT discipline,AVG(confidence) confidence FROM simulation_task_confidence_difficulty_month_record WHERE month=#{month} AND confidence > 0 GROUP BY discipline")
|
||||
List<DisciplineConfidenceInfo> statisticDisciplineLastConfidence(@Param("month")String month);
|
||||
|
||||
@Select("SELECT discipline,AVG(difficulty) difficulty FROM simulation_task_confidence_difficulty_month_record WHERE month=#{month} AND difficulty > 0 GROUP BY discipline")
|
||||
List<DisciplineDifficultyInfo> statisticDisciplineLastDifficulty(@Param("month")String month);
|
||||
|
||||
@Insert("INSERT INTO simulation_task_confidence_difficulty_month_record(discipline,taskName,taskCode,confidence,difficulty,month) VALUES (#{entity.discipline},#{entity.taskName},#{entity.taskCode},#{entity.confidence},#{entity.difficulty},#{entity.month})")
|
||||
int addDisciplineTaskMonthRecord(@Param("entity")DisciplineTaskConfidenceDifficultyRecord entity);
|
||||
|
||||
@Select("SELECT * FROM simulation_task_confidence_difficulty_month_record WHERE discipline=#{discipline} AND taskCode=#{taskCode} AND month=#{month}")
|
||||
List<DisciplineTaskConfidenceDifficultyRecord> queryDisciplineTaskMonthRecord(@Param("discipline")String discipline,@Param("taskCode")String taskCode,@Param("month")String month);
|
||||
|
||||
@Update("UPDATE simulation_task_confidence_difficulty_month_record SET confidence=#{entity.confidence},difficulty=#{entity.difficulty} WHERE discipline=#{entity.discipline} AND taskCode=#{entity.taskCode} AND month=#{entity.month}")
|
||||
int updateDisciplineTaskMonthRecord(@Param("entity")DisciplineTaskConfidenceDifficultyRecord entity);
|
||||
|
||||
@Select("SELECT month,AVG(confidence) FROM simulation_task_confidence_difficulty_month_record WHERE discipline=#{discipline} AND ${timeCondition} GROUP BY month ORDER BY month")
|
||||
List<DisciplineConfidenceInfo> statisticDisciplineConfidenceTrend(@Param("discipline")String discipline,@Param("timeCondition")String timeCondition);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.sdm.task.model.entity;
|
||||
|
||||
public class DisciplineConfidenceInfo {
|
||||
|
||||
public String discipline;
|
||||
|
||||
public String month;
|
||||
|
||||
public float confidence;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.sdm.task.model.entity;
|
||||
|
||||
public class DisciplineDifficultyInfo {
|
||||
|
||||
public String discipline;
|
||||
|
||||
public float difficulty;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.sdm.task.model.entity;
|
||||
|
||||
public class DisciplineTaskConfidenceDifficultyRecord {
|
||||
|
||||
public int id;
|
||||
|
||||
public String taskName;
|
||||
|
||||
public String taskCode;
|
||||
|
||||
public String discipline;
|
||||
|
||||
public float confidence;
|
||||
|
||||
public float difficulty;
|
||||
|
||||
public String month;
|
||||
|
||||
public int day;
|
||||
|
||||
public String updateTime;
|
||||
|
||||
public String createTime;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.sdm.task.model.entity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DiscplineConfidenceTrendInfo {
|
||||
|
||||
public String discipline;
|
||||
|
||||
public List<DisciplineConfidenceInfo> disciplineConfidenceInfoList ;
|
||||
}
|
||||
@@ -57,4 +57,10 @@ public interface ISimulationTaskPoolService {
|
||||
|
||||
SdmResponse updateFlowTaskRelate(BindTaskAndFlowTemplateReq req);
|
||||
|
||||
SdmResponse statisicDisciplineConfidence(String poolName);
|
||||
|
||||
SdmResponse staticDisciplineConfidenceTrend(String poolName,String timeRange);
|
||||
|
||||
SdmResponse statisicDisciplineDifficulty(String poolName);
|
||||
|
||||
}
|
||||
|
||||
@@ -17,8 +17,10 @@ import com.sdm.common.entity.req.data.SaveFileSimulationMappingReq;
|
||||
import com.sdm.common.entity.req.system.LaunchApproveReq;
|
||||
import com.sdm.common.entity.req.task.BindTaskAndFlowTemplateReq;
|
||||
import com.sdm.common.entity.resp.data.FileMetadataInfoResp;
|
||||
import com.sdm.common.feign.impl.project.SimulationTaskFeignClientImpl;
|
||||
import com.sdm.common.feign.impl.system.ApproveFeignClientImpl;
|
||||
import com.sdm.common.feign.inter.data.IFileSimulationMappingFeignClient;
|
||||
import com.sdm.common.feign.inter.project.ISimulationTaskFeignClient;
|
||||
import com.sdm.common.service.BaseService;
|
||||
import com.sdm.common.utils.SystemOperate;
|
||||
import com.sdm.common.utils.excel.ExcelUtil;
|
||||
@@ -36,6 +38,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -54,6 +57,9 @@ public class SimulationTaskPoolServiceImpl extends BaseService implements ISimul
|
||||
@Autowired
|
||||
private IFileSimulationMappingFeignClient simulationMappingFeignClient;
|
||||
|
||||
@Autowired
|
||||
private ISimulationTaskFeignClient simulationTaskFeignClient;
|
||||
|
||||
@Value("${approve.replyUrl}")
|
||||
private String approveReplyUrl;
|
||||
|
||||
@@ -2108,6 +2114,229 @@ public class SimulationTaskPoolServiceImpl extends BaseService implements ISimul
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计学科置信度
|
||||
* @param poolName
|
||||
* @return
|
||||
*/
|
||||
public SdmResponse statisicDisciplineConfidence(String poolName)
|
||||
{
|
||||
SdmResponse response = SdmResponse.success();
|
||||
List<String> disciplineNames = mapper.queryTaskPoolAllDiscipline(poolName);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
||||
String month = sdf.format(new Date());
|
||||
List<DisciplineConfidenceInfo> confidenceInfos = mapper.statisticDisciplineLastConfidence(month);
|
||||
Map<String,DisciplineConfidenceInfo> disciplineConfidenceInfoMap = new HashMap<>();
|
||||
for(DisciplineConfidenceInfo confidenceInfo : confidenceInfos)
|
||||
{
|
||||
disciplineConfidenceInfoMap.put(confidenceInfo.discipline,confidenceInfo);
|
||||
}
|
||||
List<DisciplineConfidenceInfo> disciplineConfidenceInfoList = new ArrayList<>();
|
||||
for(String discipline : disciplineNames)
|
||||
{
|
||||
DisciplineConfidenceInfo confidenceInfo = disciplineConfidenceInfoMap.get(discipline);
|
||||
if(confidenceInfo != null)
|
||||
{
|
||||
disciplineConfidenceInfoList.add(confidenceInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
DisciplineConfidenceInfo info = new DisciplineConfidenceInfo();
|
||||
info.discipline = discipline;
|
||||
info.confidence = 0;
|
||||
disciplineConfidenceInfoList.add(info);
|
||||
}
|
||||
}
|
||||
response.setData(disciplineConfidenceInfoList);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计学科置信度趋势
|
||||
* @param poolName
|
||||
* @param timeRange
|
||||
* @return
|
||||
*/
|
||||
public SdmResponse staticDisciplineConfidenceTrend(String poolName,String timeRange)
|
||||
{
|
||||
SdmResponse response = SdmResponse.success();
|
||||
if(timeRange == null || timeRange.isEmpty())
|
||||
{
|
||||
response = SdmResponse.failed("时间范围为空");
|
||||
}
|
||||
else
|
||||
{
|
||||
List<String> disciplineNames = mapper.queryTaskPoolAllDiscipline(poolName);
|
||||
String[] yearMonths = timeRange.split(",");
|
||||
String timeCondition = " 1 ";
|
||||
if(yearMonths.length == 1)
|
||||
{
|
||||
timeCondition += " AND month>='"+yearMonths[0]+"'";
|
||||
}
|
||||
else if(yearMonths.length == 2)
|
||||
{
|
||||
timeCondition += " AND month BETWEEN '"+yearMonths[0]+"' AND '"+yearMonths[1]+"'";
|
||||
}
|
||||
List<DiscplineConfidenceTrendInfo> discplineConfidenceTrendInfos = new ArrayList<>();
|
||||
for(String discipline : disciplineNames)
|
||||
{
|
||||
List<DisciplineConfidenceInfo> disciplineConfidenceInfoList = mapper.statisticDisciplineConfidenceTrend(discipline,timeCondition);
|
||||
DiscplineConfidenceTrendInfo trendInfo = new DiscplineConfidenceTrendInfo();
|
||||
trendInfo.discipline = discipline;
|
||||
trendInfo.disciplineConfidenceInfoList = disciplineConfidenceInfoList;
|
||||
discplineConfidenceTrendInfos.add(trendInfo);
|
||||
}
|
||||
response.setData(discplineConfidenceTrendInfos);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计学科难度系数
|
||||
* @param poolName
|
||||
* @return
|
||||
*/
|
||||
public SdmResponse statisicDisciplineDifficulty(String poolName)
|
||||
{
|
||||
SdmResponse response = SdmResponse.success();
|
||||
List<String> disciplineNames = mapper.queryTaskPoolAllDiscipline(poolName);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
||||
String month = sdf.format(new Date());
|
||||
List<DisciplineDifficultyInfo> confidenceInfos = mapper.statisticDisciplineLastDifficulty(month);
|
||||
Map<String,DisciplineDifficultyInfo> disciplineDifficultyInfoMap = new HashMap<>();
|
||||
for(DisciplineDifficultyInfo confidenceInfo : confidenceInfos)
|
||||
{
|
||||
disciplineDifficultyInfoMap.put(confidenceInfo.discipline,confidenceInfo);
|
||||
}
|
||||
List<DisciplineDifficultyInfo> disciplineDifficultyInfos = new ArrayList<>();
|
||||
for(String discipline : disciplineNames)
|
||||
{
|
||||
DisciplineDifficultyInfo difficultyInfo = disciplineDifficultyInfoMap.get(discipline);
|
||||
if(difficultyInfo != null)
|
||||
{
|
||||
disciplineDifficultyInfos.add(difficultyInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
DisciplineDifficultyInfo info = new DisciplineDifficultyInfo();
|
||||
info.discipline = discipline;
|
||||
info.difficulty = 0;
|
||||
disciplineDifficultyInfos.add(info);
|
||||
}
|
||||
}
|
||||
syncProjectTaskConfidence();
|
||||
syncProjectTaskDifficulty();
|
||||
response.setData(disciplineDifficultyInfos);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理同步任务置信度与难度系数记录
|
||||
* @param statisticArray
|
||||
* @param type
|
||||
*/
|
||||
private void handleSyncProjectTaskRecord(List<JSONObject> statisticArray,int type)
|
||||
{
|
||||
|
||||
Map<String,List<Float>> taskConfidencesMap = new HashMap<>();
|
||||
Map<String,String> taskCodeAndNameMap = new HashMap<>();
|
||||
for(int index=0; index<statisticArray.size(); index++)
|
||||
{
|
||||
JSONObject taskConfidence = (JSONObject)statisticArray.get(index);
|
||||
String discipline = taskConfidence.getString("discipline");
|
||||
String taskCode = taskConfidence.getString("taskCode");
|
||||
String taskName = taskConfidence.getString("taskName");
|
||||
float floatVal = 0;
|
||||
if(type == 0)
|
||||
floatVal = taskConfidence.getFloat("confidence");
|
||||
else
|
||||
floatVal = taskConfidence.getFloat("difficult");
|
||||
String key = discipline + "_" + taskCode;
|
||||
taskConfidencesMap.computeIfAbsent(key, k -> new ArrayList<>()).add(floatVal);
|
||||
taskCodeAndNameMap.put(taskCode, taskName);
|
||||
}
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
||||
String month = sdf.format(new Date());
|
||||
for(String key : taskConfidencesMap.keySet())
|
||||
{
|
||||
String[] keyHeader = key.split("_");
|
||||
String discipline = keyHeader[0];
|
||||
String taskCode = keyHeader[1];
|
||||
List<Float> confidenceList = taskConfidencesMap.get(key);
|
||||
float confidence = 0;
|
||||
for(Float f : confidenceList)
|
||||
{
|
||||
confidence += f;
|
||||
}
|
||||
confidence = confidence / taskConfidencesMap.size();
|
||||
List<DisciplineTaskConfidenceDifficultyRecord> records = mapper.queryDisciplineTaskMonthRecord(discipline,taskCode,month);
|
||||
if(records == null || records.isEmpty())
|
||||
{
|
||||
DisciplineTaskConfidenceDifficultyRecord record = new DisciplineTaskConfidenceDifficultyRecord();
|
||||
record.discipline = discipline;
|
||||
record.taskCode = taskCode;
|
||||
record.confidence = 0;
|
||||
record.difficulty = 0;
|
||||
if(type == 0)
|
||||
record.confidence = confidence;
|
||||
else
|
||||
record.difficulty = confidence;
|
||||
String taskName = taskCodeAndNameMap.get(taskCode);
|
||||
if(taskName == null)
|
||||
{
|
||||
taskName = "";
|
||||
}
|
||||
record.taskName = taskName;
|
||||
record.difficulty = 0;
|
||||
record.month = month;
|
||||
mapper.addDisciplineTaskMonthRecord(record);
|
||||
}
|
||||
else
|
||||
{
|
||||
DisciplineTaskConfidenceDifficultyRecord record = records.get(0);
|
||||
if(type == 0)
|
||||
record.confidence = confidence;
|
||||
else
|
||||
record.difficulty = confidence;
|
||||
mapper.updateDisciplineTaskMonthRecord(record);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步更新系统仿真任务置信度
|
||||
* @return
|
||||
*/
|
||||
private SdmResponse syncProjectTaskConfidence()
|
||||
{
|
||||
SdmResponse response = simulationTaskFeignClient.getTaskConfidenceStatistics();
|
||||
if(response.isSuccess())
|
||||
{
|
||||
List<JSONObject> taskConfidences = (List<JSONObject>)response.getData();
|
||||
handleSyncProjectTaskRecord(taskConfidences,0);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步更新系统仿真任务难度系数
|
||||
* @return
|
||||
*/
|
||||
private SdmResponse syncProjectTaskDifficulty()
|
||||
{
|
||||
SdmResponse response = simulationTaskFeignClient.getTaskDifficultStatistics();
|
||||
if(response.isSuccess())
|
||||
{
|
||||
List<JSONObject> taskConfidences = (List<JSONObject>)response.getData();
|
||||
handleSyncProjectTaskRecord(taskConfidences,1);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user