ipo所有功能及配置

master
yz 8 months ago
parent 3bce761671
commit ceb1613f62

@ -25,10 +25,7 @@ import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Date;
import java.util.Map;
import java.util.Scanner;
import java.util.UUID;
import java.util.*;
@RestController
@ -318,4 +315,6 @@ public class IlabController {
}

@ -0,0 +1,444 @@
package com.sztzjy.fund_investment.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.sztzjy.fund_investment.annotation.AnonymousAccess;
import com.sztzjy.fund_investment.entity.User;
import com.sztzjy.fund_investment.entity.UserExample;
import com.sztzjy.fund_investment.mapper.UserMapper;
import com.sztzjy.fund_investment.service.IIlabService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.DigestUtils;
import org.springframework.web.bind.annotation.*;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.*;
@RestController
@RequestMapping("/stu/ilabControllerTest")
@Api(tags = "学生端--国家虚拟仿真test接口")
public class IlabControllerTest {
@Autowired
IIlabService iIlabService;
@Autowired
UserMapper userMapper;
@Value("${file.path}")
private String filePath;
String appid = "107223";
String secret = "5F2pfvRDXq5ybF4imPA02TJZfaYA1hPXTTvPjtwk+OE=";
//刷数据接口
@GetMapping("shuashuju")
@AnonymousAccess
@ApiOperation("数据上传")
public String shuashuju(@RequestParam String username,
@RequestParam String ticket){
UserExample example = new UserExample();
example.createCriteria().andNameEqualTo(username);
List<User> users = userMapper.selectByExample(example);
if(users.isEmpty() || users==null){
return "用户名不存在";
}else {
String un = users.get(0).getUsername();
int startIndex = ticket.indexOf("ticket=") + "ticket=".length();
int endIndex = ticket.indexOf("&token");
String ticket1 = ticket.substring(startIndex, endIndex);
for (int i = 0; i < 10; i++) {
Map<String, String> accessToken = getAccessToken2(ticket1);
try {
// dataUpload(accessToken.get("access_token"),"mj_5696581","db524a12cf604980977d0ea4340d8e95");
dataUpload(accessToken.get("access_token"),un, String.valueOf(UUID.randomUUID()).replaceAll("-",""));
} catch (IOException e) {
return e.toString();
}
}
return "成功";
}
}
//获取AccessToken
@GetMapping("getAccessToken")
@AnonymousAccess
public void getAccessToken(@ApiParam("ticket") @RequestParam String ticket) {
Map<String,String> map=iIlabService.getAccessToken(ticket);
}
@PostMapping("dataUpload")
@AnonymousAccess
@ApiOperation("数据上传+实验报告上传")
public void dataUpload(@ApiParam("access_token") @RequestParam String accessToken,
@ApiParam("un") @RequestParam String un,
@ApiParam("userId") @RequestParam String userId) throws IOException {
accessToken = URLEncoder.encode(accessToken, "UTF-8");
String accessTokenRepalce = accessToken.replaceAll("\\+", "%2B");
// long nowTime = System.currentTimeMillis();
long endTime = System.currentTimeMillis()-1000;
long startTime = endTime- 1000 * 600;
//定义发送数据
String requestBody = "{\n" +
" \"username\": \""+un+"\",\n" +
" \"title\": \"股权基金投资虚拟仿真实验\",\n" +
" \"status\": 1,\n" +
" \"score\": 90,\n" +
" \"startTime\": "+startTime+",\n" +
" \"endTime\": "+endTime+",\n" +
" \"timeUsed\": 600,\n" +
" \"appid\": \"107223\",\n" +
" \"originId\": \""+userId+"\",\n" +
" \"steps\": [\n" +
" {\n" +
" \"seq\": 1,\n" +
" \"title\": \"实验步骤1\",\n" +
" \"startTime\": "+startTime+",\n" +
" \"endTime\": "+endTime+",\n" +
" \"timeUsed\": 600,\n" +
" \"expectTime\": 2,\n" +
" \"maxScore\": 10,\n" +
" \"score\": 8,\n" +
" \"repeatCount\": 1,\n" +
" \"evaluation\": \"优\",\n" +
" \"scoringModel\": \"赋分模型\",\n" +
" \"remarks\": \"备注\"\n" +
" },\n" +
" {\n" +
" \"seq\": 2,\n" +
" \"title\": \"实验步骤2\",\n" +
" \"startTime\": "+startTime+",\n" +
" \"endTime\": "+endTime+",\n" +
" \"timeUsed\": 600,\n" +
" \"expectTime\": 2,\n" +
" \"maxScore\": 10,\n" +
" \"score\": 8,\n" +
" \"repeatCount\": 1,\n" +
" \"evaluation\": \"优\",\n" +
" \"scoringModel\": \"赋分模型\",\n" +
" \"remarks\": \"备注\"\n" +
" },\n" +
" {\n" +
" \"seq\": 3,\n" +
" \"title\": \"实验步骤3\",\n" +
" \"startTime\": "+startTime+",\n" +
" \"endTime\": "+endTime+",\n" +
" \"timeUsed\": 600,\n" +
" \"expectTime\": 2,\n" +
" \"maxScore\": 10,\n" +
" \"score\": 8,\n" +
" \"repeatCount\": 1,\n" +
" \"evaluation\": \"优\",\n" +
" \"scoringModel\": \"赋分模型\",\n" +
" \"remarks\": \"备注\"\n" +
" },\n" +
" {\n" +
" \"seq\": 4,\n" +
" \"title\": \"实验步骤4\",\n" +
" \"startTime\": "+startTime+",\n" +
" \"endTime\": "+endTime+",\n" +
" \"timeUsed\": 600,\n" +
" \"expectTime\": 2,\n" +
" \"maxScore\": 10,\n" +
" \"score\": 8,\n" +
" \"repeatCount\": 1,\n" +
" \"evaluation\": \"优\",\n" +
" \"scoringModel\": \"赋分模型\",\n" +
" \"remarks\": \"备注\"\n" +
" },\n" +
" {\n" +
" \"seq\": 5,\n" +
" \"title\": \"实验步骤5\",\n" +
" \"startTime\": "+startTime+",\n" +
" \"endTime\": "+endTime+",\n" +
" \"timeUsed\": 600,\n" +
" \"expectTime\": 2,\n" +
" \"maxScore\": 10,\n" +
" \"score\": 8,\n" +
" \"repeatCount\": 1,\n" +
" \"evaluation\": \"优\",\n" +
" \"scoringModel\": \"赋分模型\",\n" +
" \"remarks\": \"备注\"\n" +
" },\n" +
" {\n" +
" \"seq\": 6,\n" +
" \"title\": \"实验步骤6\",\n" +
" \"startTime\": "+startTime+",\n" +
" \"endTime\": "+endTime+",\n" +
" \"timeUsed\": 600,\n" +
" \"expectTime\": 2,\n" +
" \"maxScore\": 10,\n" +
" \"score\": 8,\n" +
" \"repeatCount\": 1,\n" +
" \"evaluation\": \"优\",\n" +
" \"scoringModel\": \"赋分模型\",\n" +
" \"remarks\": \"备注\"\n" +
" },\n" +
" {\n" +
" \"seq\": 7,\n" +
" \"title\": \"实验步骤7\",\n" +
" \"startTime\": "+startTime+",\n" +
" \"endTime\": "+endTime+",\n" +
" \"timeUsed\": 600,\n" +
" \"expectTime\": 2,\n" +
" \"maxScore\": 10,\n" +
" \"score\": 8,\n" +
" \"repeatCount\": 1,\n" +
" \"evaluation\": \"优\",\n" +
" \"scoringModel\": \"赋分模型\",\n" +
" \"remarks\": \"备注\"\n" +
" },\n" +
" {\n" +
" \"seq\": 8,\n" +
" \"title\": \"实验步骤8\",\n" +
" \"startTime\": "+startTime+",\n" +
" \"endTime\": "+endTime+",\n" +
" \"timeUsed\": 600,\n" +
" \"expectTime\": 2,\n" +
" \"maxScore\": 10,\n" +
" \"score\": 8,\n" +
" \"repeatCount\": 1,\n" +
" \"evaluation\": \"优\",\n" +
" \"scoringModel\": \"赋分模型\",\n" +
" \"remarks\": \"备注\"\n" +
" },\n" +
" {\n" +
" \"seq\": 9,\n" +
" \"title\": \"实验步骤9\",\n" +
" \"startTime\": "+startTime+",\n" +
" \"endTime\": "+endTime+",\n" +
" \"timeUsed\": 600,\n" +
" \"expectTime\": 2,\n" +
" \"maxScore\": 10,\n" +
" \"score\": 8,\n" +
" \"repeatCount\": 1,\n" +
" \"evaluation\": \"优\",\n" +
" \"scoringModel\": \"赋分模型\",\n" +
" \"remarks\": \"备注\"\n" +
" },\n" +
" {\n" +
" \"seq\": 10,\n" +
" \"title\": \"实验步骤10\",\n" +
" \"startTime\": "+startTime+",\n" +
" \"endTime\": "+endTime+",\n" +
" \"timeUsed\": 600,\n" +
" \"expectTime\": 2,\n" +
" \"maxScore\": 10,\n" +
" \"score\": 8,\n" +
" \"repeatCount\": 1,\n" +
" \"evaluation\": \"优\",\n" +
" \"scoringModel\": \"赋分模型\",\n" +
" \"remarks\": \"备注\"\n" +
" }\n" +
" ]\n" +
"}\n" +
"\n";
//定义接收数据
JSONObject result = new JSONObject();
String url = "https://www.ilab-x.com/open/api/v2/data_upload?access_token="+accessTokenRepalce;
HttpPost httpPost = new HttpPost(url);
CloseableHttpClient client = HttpClients.createDefault();
//请求参数转JOSN字符串
StringEntity entity = new StringEntity(requestBody, "UTF-8");
entity.setContentEncoding("UTF-8");
entity.setContentType("application/json");
httpPost.setEntity(entity);
try {
HttpResponse response = client.execute(httpPost);
if (response.getStatusLine().getStatusCode() == 200) {
result = JSON.parseObject(EntityUtils.toString(response.getEntity(), "UTF-8"));
System.out.println(result.toString());
}
} catch (IOException e) {
e.printStackTrace();
result.put("error", "连接错误!");
}
//关闭连接
try {
client.close();
} catch (Exception e) {
System.out.println(e.getMessage());
}
try {
Thread.sleep(5);
} catch (InterruptedException e) {
e.printStackTrace();
}
attachmentUpload(accessTokenRepalce,userId);
}
//实验报告上传
@PostMapping("attachmentUpload")
@AnonymousAccess
public void attachmentUpload(@ApiParam("access_token") @RequestParam String accessToken,
@ApiParam("userId")@RequestParam String userId) throws IOException {
String appid = "107223";
String secret = "5F2pfvRDXq5ybF4imPA02TJZfaYA1hPXTTvPjtwk+OE=";
// String filePath = "C:\\Users\\86132\\Desktop\\fsdownload";
// String filePath = filePath;
// accessToken = URLEncoder.encode(accessToken, "UTF-8");
// String accessTokenRepalce = accessToken.replaceAll("\\+", "%2B");
String url = "https://www.ilab-x.com/open/api/v2/attachment_upload" +
"?access_token=" + accessToken +
"&appid=" + appid +
"&originId=" + userId+
"&filename=abc.pdf&title=%E6%B5%8B%E8%AF%95%E5%AE%9E%E9%AA%8C%E6%8A%A5%E5%91%8A";
// String pdfFilePath = filePath +"/abc.pdf";
String pdfFilePath = "C:\\Users\\86132\\Desktop\\abc.pdf";
File file = new File(pdfFilePath);
URL apiUrl = new URL(url);
HttpURLConnection connection = (HttpURLConnection) apiUrl.openConnection();
connection.setRequestMethod("POST");
connection.setDoOutput(true);
String boundary = Long.toHexString(System.currentTimeMillis());
connection.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary);
try (
DataOutputStream request = new DataOutputStream(connection.getOutputStream());
FileInputStream fileInput = new FileInputStream(file)
) {
request.writeBytes("--" + boundary + "\r\n");
request.writeBytes("Content-Disposition: form-data; name=\"file\"; filename=\"" + file.getName() + "\"\r\n");
request.writeBytes("Content-Type: application/pdf\r\n\r\n");
byte[] buffer = new byte[4096];
int bytesRead;
while ((bytesRead = fileInput.read(buffer)) != -1) {
request.write(buffer, 0, bytesRead);
}
request.writeBytes("\r\n--" + boundary + "--\r\n");
}
int responseCode = connection.getResponseCode();
System.out.println("Response Code : " + responseCode);
InputStream responseStream;
if (responseCode == HttpURLConnection.HTTP_OK) {
responseStream = connection.getInputStream();
} else {
responseStream = connection.getErrorStream();
}
if (responseStream != null) {
try (Scanner scanner = new Scanner(responseStream)) {
String responseBody = scanner.useDelimiter("\\A").hasNext() ? scanner.next() : "";
System.out.println("Response : " + responseBody); // Entire response from the server
}
}
}
public static Map<String, String> getAccessToken2(String ticket) {
String appid = "107223";
String secret = "5F2pfvRDXq5ybF4imPA02TJZfaYA1hPXTTvPjtwk+OE=";
Map<String, String> returnMap=new HashMap<>();
try {
String ticketEncode = URLEncoder.encode(ticket, "UTF-8");
String signature = ticket + appid + secret;
String signatureMD5 = DigestUtils.md5DigestAsHex(signature.getBytes("UTF-8")).toUpperCase();
String url = "https://www.ilab-x.com/open/api/v2/token" +
"?ticket=" + ticketEncode +
"&appid=" + appid +
"&signature=" + signatureMD5;
URL apiUrl = new URL(url);
HttpURLConnection connection = (HttpURLConnection) apiUrl.openConnection();
// 设置请求类型为GET
connection.setRequestMethod("GET");
// 获取响应
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line;
StringBuffer response = new StringBuffer();
while ((line = reader.readLine()) != null) {
response.append(line);
}
reader.close();
// 打印响应内容
com.alibaba.fastjson.JSONObject jsonObject = JSONObject.parseObject(response.toString());
System.out.println(jsonObject.getString("access_token"));
System.out.println(jsonObject.getString("un"));
System.out.println(jsonObject.getString("dis"));
System.out.println(jsonObject.getInteger("code"));
returnMap.put("access_token",jsonObject.getString("access_token"));
returnMap.put("un",jsonObject.getString("un"));
returnMap.put("dis",jsonObject.getString("dis"));
returnMap.put("code",jsonObject.getString("code"));
// 关闭连接
connection.disconnect();
} catch (Exception e) {
e.printStackTrace();
}
return returnMap;
}
//获取AccessToken
@PostMapping("shuashuju")
@AnonymousAccess
public String shuashuju(@RequestBody String aaa) {
String token=aaa;
int startIndex = token.indexOf("ticket=") + "ticket=".length();
int endIndex = token.indexOf("&token");
String ticket = token.substring(startIndex, endIndex);
for (int i = 0; i < 10; i++) {
Map<String, String> accessToken = getAccessToken2(ticket);
try {
// dataUpload(accessToken.get("access_token"),"mj_5696581","db524a12cf604980977d0ea4340d8e95");
dataUpload(accessToken.get("access_token"),"mj_5686301", String.valueOf(UUID.randomUUID()).replaceAll("-",""));
} catch (IOException e) {
e.printStackTrace();
}
}
return "ok";
}
// public static void main(String[] args) {
// String token=
//""
//
//
//
//
//
// ;
// int startIndex = token.indexOf("ticket=") + "ticket=".length();
// int endIndex = token.indexOf("&token");
// String ticket = token.substring(startIndex, endIndex);
// for (int i = 0; i < 10; i++) {
// Map<String, String> accessToken = getAccessToken2(ticket);
// try {
//// dataUpload(accessToken.get("access_token"),"mj_5696581","db524a12cf604980977d0ea4340d8e95");
// dataUpload(accessToken.get("access_token"),"mj_5686301", String.valueOf(UUID.randomUUID()).replaceAll("-",""));
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
//
// }
}

@ -886,6 +886,10 @@ public class ProjectDueDiligenceController {
document.add(table84return);
document.close();
PerformanceScore performanceScore = scoreService.getByFlowId(flowId);
performanceScore.setProjectDueDiligenceTime(new Date());
performanceScoreMapper.updateByPrimaryKey(performanceScore);
}
public PdfPTable returnPdfPTable(TreeMap<String, String> treeMap) {

@ -41,80 +41,120 @@ public class SysEduDDMServiceImpl implements ISysEduDDMService {
if (eduDDM.getGlnzzl2023() == null) {
num++;
}
if(eduDDM.getQwgl2021()==null){
if (eduDDM.getQwgl2021() == null) {
num++;
}
if(eduDDM.getGdbybcl2021()==null){
if (eduDDM.getGdbybcl2021() == null) {
num++;
}
if(eduDDM.getGdbybcl2022()==null){
if (eduDDM.getGdbybcl2022() == null) {
num++;
}
if(eduDDM.getGdbybcl2023()==null){
if (eduDDM.getGdbybcl2023() == null) {
num++;
}
if(num>2){
scoreService.calculateScoreByModule2("projectUseValuationAbsoluteScore",0,flowId);
}else {
if(eduDDM.getGsfxgpdnzjz2021()!=null){
if(eduDDM.getGlnzzl2021()==null || eduDDM.getGdbybcl2021()==null || eduDDM.getQwgl2021()==null){
if (num > 2) {
scoreService.calculateScoreByModule2("projectUseValuationAbsoluteScore", 0, flowId);
} else {
if (eduDDM.getGsfxgpdnzjz2021() != null) {
if (eduDDM.getGlnzzl2021() == null || eduDDM.getGdbybcl2021() == null || eduDDM.getQwgl2021() == null) {
num++;
}else {
if(eduDDM.getGsfxgpdnzjz2021().setScale(2, BigDecimal.ROUND_HALF_UP).compareTo(eduDDM.getQwgl2021().divide(eduDDM.getGdbybcl2021().subtract(eduDDM.getGlnzzl2021()),4,BigDecimal.ROUND_HALF_UP).setScale(2,BigDecimal.ROUND_HALF_UP))!=0){
} else {
BigDecimal value1 = eduDDM.getGsfxgpdnzjz2021().setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal value2 = eduDDM.getQwgl2021().divide(eduDDM.getGdbybcl2021().subtract(eduDDM.getGlnzzl2021()), 4, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal diff = value1.subtract(value2).abs();
BigDecimal threshold = new BigDecimal("0.2");
if (diff.compareTo(threshold) > 0) {
num++;
}
// if (eduDDM.getGsfxgpdnzjz2021().setScale(2, BigDecimal.ROUND_HALF_UP).compareTo(eduDDM.getQwgl2021().divide(eduDDM.getGdbybcl2021().subtract(eduDDM.getGlnzzl2021()), 4, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP)) != 0) {
// num++;
// }
}
}else {
} else {
num++;
}
if(eduDDM.getGsfxgpdnzjz2022()!=null){
if(eduDDM.getGlnzzl2022()==null || eduDDM.getGdbybcl2022()==null || eduDDM.getQwgl2022()==null){
if (eduDDM.getGsfxgpdnzjz2022() != null) {
if (eduDDM.getGlnzzl2022() == null || eduDDM.getGdbybcl2022() == null || eduDDM.getQwgl2022() == null) {
num++;
}else {
if(eduDDM.getGsfxgpdnzjz2022().setScale(2, BigDecimal.ROUND_HALF_UP).compareTo(eduDDM.getQwgl2022().divide(eduDDM.getGdbybcl2022().subtract(eduDDM.getGlnzzl2022()),4,BigDecimal.ROUND_HALF_UP).setScale(2,BigDecimal.ROUND_HALF_UP))!=0){
} else {
BigDecimal value1 = eduDDM.getGsfxgpdnzjz2022().setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal value2 = eduDDM.getQwgl2022().divide(eduDDM.getGdbybcl2022().subtract(eduDDM.getGlnzzl2022()), 4, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal diff = value1.subtract(value2).abs();
BigDecimal threshold = new BigDecimal("0.2");
if (diff.compareTo(threshold) > 0) {
num++;
}
// if (eduDDM.getGsfxgpdnzjz2022().setScale(2, BigDecimal.ROUND_HALF_UP).compareTo(eduDDM.getQwgl2022().divide(eduDDM.getGdbybcl2022().subtract(eduDDM.getGlnzzl2022()), 4, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP)) != 0) {
// num++;
// }
}
}else {
} else {
num++;
}
if(eduDDM.getGsfxgpdnzjz2023()!=null){
if(eduDDM.getGlnzzl2023()==null || eduDDM.getGdbybcl2023()==null || eduDDM.getQwgl2023()==null){
if (eduDDM.getGsfxgpdnzjz2023() != null) {
if (eduDDM.getGlnzzl2023() == null || eduDDM.getGdbybcl2023() == null || eduDDM.getQwgl2023() == null) {
num++;
}else {
if(eduDDM.getGsfxgpdnzjz2023().setScale(2, BigDecimal.ROUND_HALF_UP).compareTo(eduDDM.getQwgl2023().divide(eduDDM.getGdbybcl2023().subtract(eduDDM.getGlnzzl2023()),4,BigDecimal.ROUND_HALF_UP).setScale(2,BigDecimal.ROUND_HALF_UP))!=0){
} else {
BigDecimal value1 = eduDDM.getGsfxgpdnzjz2023().setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal value2 = eduDDM.getQwgl2023().divide(eduDDM.getGdbybcl2023().subtract(eduDDM.getGlnzzl2023()), 4, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal diff = value1.subtract(value2).abs();
BigDecimal threshold = new BigDecimal("0.2");
if (diff.compareTo(threshold) > 0) {
num++;
}
// if (eduDDM.getGsfxgpdnzjz2023().setScale(2, BigDecimal.ROUND_HALF_UP).compareTo(eduDDM.getQwgl2023().divide(eduDDM.getGdbybcl2023().subtract(eduDDM.getGlnzzl2023()), 4, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP)) != 0) {
// num++;
// }
}
}else {
} else {
num++;
}
if(eduDDM.getQwgl2022()!=null){
if(eduDDM.getQwgl2021()==null || eduDDM.getGlnzzl2022()==null){
if (eduDDM.getQwgl2022() != null) {
if (eduDDM.getQwgl2021() == null || eduDDM.getGlnzzl2022() == null) {
num++;
}else {
if(eduDDM.getQwgl2022().setScale(2,BigDecimal.ROUND_HALF_UP).compareTo(eduDDM.getQwgl2021().multiply(BigDecimal.ONE.add(eduDDM.getGlnzzl2022())).setScale(2,BigDecimal.ROUND_HALF_UP))!=0){
} else {
BigDecimal value1 = eduDDM.getQwgl2022().setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal value2 = eduDDM.getQwgl2021().multiply(BigDecimal.ONE.add(eduDDM.getGlnzzl2022())).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal diff = value1.subtract(value2).abs();
BigDecimal threshold = new BigDecimal("0.2");
if (diff.compareTo(threshold) > 0) {
num++;
}
// if (eduDDM.getQwgl2022().setScale(2, BigDecimal.ROUND_HALF_UP).compareTo(eduDDM.getQwgl2021().multiply(BigDecimal.ONE.add(eduDDM.getGlnzzl2022())).setScale(2, BigDecimal.ROUND_HALF_UP)) != 0) {
// num++;
// }
}
}else {
} else {
num++;
}
if(eduDDM.getQwgl2023()!=null){
if(eduDDM.getQwgl2022()==null || eduDDM.getGlnzzl2023()==null){
if (eduDDM.getQwgl2023() != null) {
if (eduDDM.getQwgl2022() == null || eduDDM.getGlnzzl2023() == null) {
num++;
}else {
if(eduDDM.getQwgl2023().setScale(2,BigDecimal.ROUND_HALF_UP).compareTo(eduDDM.getQwgl2022().multiply(BigDecimal.ONE.add(eduDDM.getGlnzzl2023())).setScale(2,BigDecimal.ROUND_HALF_UP))!=0){
} else {
BigDecimal value1 = eduDDM.getQwgl2023().setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal value2 = eduDDM.getQwgl2022().multiply(BigDecimal.ONE.add(eduDDM.getGlnzzl2023())).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal diff = value1.subtract(value2).abs();
BigDecimal threshold = new BigDecimal("0.2");
if (diff.compareTo(threshold) > 0) {
num++;
}
// if (eduDDM.getQwgl2023().setScale(2, BigDecimal.ROUND_HALF_UP).compareTo(eduDDM.getQwgl2022().multiply(BigDecimal.ONE.add(eduDDM.getGlnzzl2023())).setScale(2, BigDecimal.ROUND_HALF_UP)) != 0) {
// num++;
// }
}
}else {
} else {
num++;
}
if(num>=4){
scoreService.calculateScoreByModule2("projectUseValuationAbsoluteScore",0,flowId);
}else {
scoreService.calculateScoreByModule2("projectUseValuationAbsoluteScore",4-num,flowId);
if (num >= 4) {
scoreService.calculateScoreByModule2("projectUseValuationAbsoluteScore", 0, flowId);
} else {
scoreService.calculateScoreByModule2("projectUseValuationAbsoluteScore", 4 - num, flowId);
}
}
@ -128,4 +168,145 @@ public class SysEduDDMServiceImpl implements ISysEduDDMService {
return new ResultEntity(HttpStatus.OK, "保存成功");
}
public static void main(String[] args) {
EduDDM eduDDM = new EduDDM();
eduDDM.setFlowId("342e0ea0eba747a396e0b769e97ee4e2");
eduDDM.setQwgl2021(BigDecimal.valueOf(1.00));
eduDDM.setQwgl2022(BigDecimal.valueOf(1.05));
eduDDM.setQwgl2023(BigDecimal.valueOf(1.10));
eduDDM.setGdbybcl2021(BigDecimal.valueOf(0.12));
eduDDM.setGdbybcl2022(BigDecimal.valueOf(0.12));
eduDDM.setGdbybcl2023(BigDecimal.valueOf(0.12));
eduDDM.setGlnzzl2021(BigDecimal.valueOf(0.05));
eduDDM.setGlnzzl2022(BigDecimal.valueOf(0.05));
eduDDM.setGlnzzl2023(BigDecimal.valueOf(0.05));
eduDDM.setGsfxgpdnzjz2021(BigDecimal.valueOf(14.29));
eduDDM.setGsfxgpdnzjz2022(BigDecimal.valueOf(15.00));
eduDDM.setGsfxgpdnzjz2023(BigDecimal.valueOf(16.69));
int num = 0; //记录错误数量
if (eduDDM.getGlnzzl2021() == null) {
num++;
}
if (eduDDM.getGlnzzl2022() == null) {
num++;
}
if (eduDDM.getGlnzzl2023() == null) {
num++;
}
if (eduDDM.getQwgl2021() == null) {
num++;
}
if (eduDDM.getGdbybcl2021() == null) {
num++;
}
if (eduDDM.getGdbybcl2022() == null) {
num++;
}
if (eduDDM.getGdbybcl2023() == null) {
num++;
}
if (num > 2) {
} else {
if (eduDDM.getGsfxgpdnzjz2021() != null) {
if (eduDDM.getGlnzzl2021() == null || eduDDM.getGdbybcl2021() == null || eduDDM.getQwgl2021() == null) {
num++;
} else {
BigDecimal value1 = eduDDM.getGsfxgpdnzjz2021().setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal value2 = eduDDM.getQwgl2021().divide(eduDDM.getGdbybcl2021().subtract(eduDDM.getGlnzzl2021()), 4, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal diff = value1.subtract(value2).abs();
BigDecimal threshold = new BigDecimal("0.2");
if (diff.compareTo(threshold) > 0) {
num++;
}
// if (eduDDM.getGsfxgpdnzjz2021().setScale(2, BigDecimal.ROUND_HALF_UP).compareTo(eduDDM.getQwgl2021().divide(eduDDM.getGdbybcl2021().subtract(eduDDM.getGlnzzl2021()), 4, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP)) != 0) {
// num++;
// }
}
} else {
num++;
}
if (eduDDM.getGsfxgpdnzjz2022() != null) {
if (eduDDM.getGlnzzl2022() == null || eduDDM.getGdbybcl2022() == null || eduDDM.getQwgl2022() == null) {
num++;
} else {
BigDecimal value1 = eduDDM.getGsfxgpdnzjz2022().setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal value2 = eduDDM.getQwgl2022().divide(eduDDM.getGdbybcl2022().subtract(eduDDM.getGlnzzl2022()), 4, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal diff = value1.subtract(value2).abs();
BigDecimal threshold = new BigDecimal("0.2");
if (diff.compareTo(threshold) > 0) {
num++;
}
// if (eduDDM.getGsfxgpdnzjz2022().setScale(2, BigDecimal.ROUND_HALF_UP).compareTo(eduDDM.getQwgl2022().divide(eduDDM.getGdbybcl2022().subtract(eduDDM.getGlnzzl2022()), 4, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP)) != 0) {
// num++;
// }
}
} else {
num++;
}
if (eduDDM.getGsfxgpdnzjz2023() != null) {
if (eduDDM.getGlnzzl2023() == null || eduDDM.getGdbybcl2023() == null || eduDDM.getQwgl2023() == null) {
num++;
} else {
BigDecimal value1 = eduDDM.getGsfxgpdnzjz2023().setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal value2 = eduDDM.getQwgl2023().divide(eduDDM.getGdbybcl2023().subtract(eduDDM.getGlnzzl2023()), 4, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal diff = value1.subtract(value2).abs();
BigDecimal threshold = new BigDecimal("0.2");
if (diff.compareTo(threshold) > 0) {
num++;
}
// if (eduDDM.getGsfxgpdnzjz2023().setScale(2, BigDecimal.ROUND_HALF_UP).compareTo(eduDDM.getQwgl2023().divide(eduDDM.getGdbybcl2023().subtract(eduDDM.getGlnzzl2023()), 4, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP)) != 0) {
// num++;
// }
}
} else {
num++;
}
if (eduDDM.getQwgl2022() != null) {
if (eduDDM.getQwgl2021() == null || eduDDM.getGlnzzl2022() == null) {
num++;
} else {
BigDecimal value1 = eduDDM.getQwgl2022().setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal value2 = eduDDM.getQwgl2021().multiply(BigDecimal.ONE.add(eduDDM.getGlnzzl2022())).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal diff = value1.subtract(value2).abs();
BigDecimal threshold = new BigDecimal("0.2");
if (diff.compareTo(threshold) > 0) {
num++;
}
// if (eduDDM.getQwgl2022().setScale(2, BigDecimal.ROUND_HALF_UP).compareTo(eduDDM.getQwgl2021().multiply(BigDecimal.ONE.add(eduDDM.getGlnzzl2022())).setScale(2, BigDecimal.ROUND_HALF_UP)) != 0) {
// num++;
// }
}
} else {
num++;
}
if (eduDDM.getQwgl2023() != null) {
if (eduDDM.getQwgl2022() == null || eduDDM.getGlnzzl2023() == null) {
num++;
} else {
BigDecimal value1 = eduDDM.getQwgl2023().setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal value2 = eduDDM.getQwgl2022().multiply(BigDecimal.ONE.add(eduDDM.getGlnzzl2023())).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal diff = value1.subtract(value2).abs();
BigDecimal threshold = new BigDecimal("0.2");
if (diff.compareTo(threshold) > 0) {
num++;
}
// if (eduDDM.getQwgl2023().setScale(2, BigDecimal.ROUND_HALF_UP).compareTo(eduDDM.getQwgl2022().multiply(BigDecimal.ONE.add(eduDDM.getGlnzzl2023())).setScale(2, BigDecimal.ROUND_HALF_UP)) != 0) {
// num++;
// }
}
} else {
num++;
}
}
System.out.println(num);
}
}

@ -33,7 +33,7 @@ public class Task {
* @Date 2023/11/23
*/
//todo 重新实训需要把performance_score表的数据删掉计算班级平均分时只取最新的数据
// @Scheduled(cron = "0 0 0 * * ?")
@Scheduled(cron = "0 0 0 * * ?")
public void getClassScore() {
// 查到单个班级下所有的已经在投资报告页面提交过的学生的总成绩
// 算平均值,存表

@ -11,7 +11,16 @@ spring:
# 文件存储
file:
type: local
path: D:/home
path: /usr/local/tianzeProject/fundInvestment/uploadFile
timer:
enable: false
enable: false
swagger:
enable: true
tokenHeader: Authorization
title: 天择外汇模拟交易 • 接口文档
description: 天择外汇模拟交易WebAPI接口文档
contactName: 深圳天择教育科技有限公司
contactAddress: www.sztzjy.com
version: @project.version@

@ -3,6 +3,7 @@ spring:
druid:
db-type: mysql
url: jdbc:mysql://${DB_HOST:211.70.163.178}:${DB_PORT:3306}/${DB_NAME:fund_investment}?useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
# url: jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:fund_investment}?useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
username: ${DB_USER:root}
password: ${DB_PWD:WxxyDB@2023}
driver-class-name: com.mysql.cj.jdbc.Driver
@ -14,4 +15,14 @@ file:
path: /usr/local/tianzeProject/fundInvestment/uploadFile
timer:
enable: false
enable: false
swagger:
enable: false
tokenHeader: Authorization
title: 天择外汇模拟交易 • 接口文档
description: 天择外汇模拟交易WebAPI接口文档
contactName: 深圳天择教育科技有限公司
contactAddress: www.sztzjy.com
version: @project.version@

@ -0,0 +1,29 @@
# 120服务器配置文件
spring:
datasource:
druid:
db-type: mysql
url: jdbc:mysql://${DB_HOST:120.78.220.29}:${DB_PORT:3306}/${DB_NAME:fund_investment}?useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true&allowMultiQueries=true
# url: jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:fund_investment}?useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
username: ${DB_USER:root}
password: ${DB_PWD:Biemo123}
driver-class-name: com.mysql.cj.jdbc.Driver
# 文件存储
file:
type: local
path: /usr/local/tianzeProject/fundInvestment/uploadFile
timer:
enable: false
swagger:
enable: true
tokenHeader: Authorization
title: 天择外汇模拟交易 • 接口文档
description: 天择外汇模拟交易WebAPI接口文档
contactName: 深圳天择教育科技有限公司
contactAddress: www.sztzjy.com
version: @project.version@

@ -13,7 +13,7 @@ spring:
application:
name: trading_system
profiles:
active: dev
active: self
mvc:
pathmatch:
matching-strategy: ant_path_matcher
@ -82,11 +82,4 @@ mybatis:
type-aliases-package: com.sztzjy.fund_investment.entity
mapper-locations: classpath*:/mappers/*.xml
swagger:
enable: true
tokenHeader: Authorization
title: 天择外汇模拟交易 • 接口文档
description: 天择外汇模拟交易WebAPI接口文档
contactName: 深圳天择教育科技有限公司
contactAddress: www.sztzjy.com
version: @project.version@

@ -40,23 +40,57 @@
</javaClientGenerator>
<!-- 需要生成的表 -->
<!-- <table tableName="allotment_object" domainObjectName="AllotmentObject" />-->
<!-- <table tableName="flow" domainObjectName="Flow" />-->
<!-- <table tableName="fundraising" domainObjectName="Fundraising" />-->
<!-- <table tableName="inquiry_participation" domainObjectName="InquiryParticipation" />-->
<!-- <table tableName="issuance_info" domainObjectName="IssuanceInfo" />-->
<!-- <table tableName="issuance_parameter_input" domainObjectName="IssuanceParameterInput" />-->
<!-- <table tableName="performance_score" domainObjectName="PerformanceScore" />-->
<!-- <table tableName="tea_class_score" domainObjectName="TeaClassScore" />-->
<!-- <table tableName="profit_distribution" domainObjectName="ProfitDistribution" />-->
<!-- <table tableName="profit_management" domainObjectName="ProfitManagement"/>-->
<!-- <table tableName="exit_time" domainObjectName="ExitTime"/>-->
<!-- <table tableName="question_answer" domainObjectName="QuestionAnswer" />-->
<!-- <table tableName="sys_topics" domainObjectName="Topics" />-->
<!-- <table tableName="topic_record" domainObjectName="TopicRecord" />-->
<!-- <table tableName="found_project" domainObjectName="FoundProject" />-->
<!-- <table tableName="training_report" domainObjectName="TrainingReport" />-->
<table tableName="wx_user" domainObjectName="User" />
<!-- <table tableName="allotment_object" domainObjectName="AllotmentObject" />-->
<!-- <table tableName="flow" domainObjectName="Flow" />-->
<!-- <table tableName="fundraising" domainObjectName="Fundraising" />-->
<!-- <table tableName="inquiry_participation" domainObjectName="InquiryParticipation" />-->
<!-- <table tableName="issuance_info" domainObjectName="IssuanceInfo" />-->
<!-- <table tableName="issuance_parameter_input" domainObjectName="IssuanceParameterInput" />-->
<!-- <table tableName="performance_score" domainObjectName="PerformanceScore" />-->
<!-- <table tableName="tea_class_score" domainObjectName="TeaClassScore" />-->
<!-- <table tableName="profit_distribution" domainObjectName="ProfitDistribution" />-->
<!-- <table tableName="profit_management" domainObjectName="ProfitManagement" />-->
<!-- <table tableName="exit_time" domainObjectName="ExitTime" />-->
<!-- <table tableName="question_answer" domainObjectName="QuestionAnswer" />-->
<!-- <table tableName="sys_topics" domainObjectName="Topics" />-->
<!-- <table tableName="topic_record" domainObjectName="TopicRecord" />-->
<!-- <table tableName="found_project" domainObjectName="FoundProject" />-->
<!-- <table tableName="training_report" domainObjectName="TrainingReport" />-->
<!-- <table tableName="user_table" domainObjectName="UserTable" />-->
<!-- <table tableName="project_pool" domainObjectName="ProjectPool" />-->
<!-- <table tableName="found_project" domainObjectName="FoundProject" />-->
<!-- <table tableName="pro_admini_penalty" domainObjectName="ProAdminiPenalty" />-->
<!-- <table tableName="pro_business_risk" domainObjectName="ProBusinessRisk" />-->
<!-- <table tableName="pro_business_info" domainObjectName="ProBusinessInfo" />-->
<!-- <table tableName="pro_businessInfo_shareholder" domainObjectName="ProBusinessInfoShareholder" />-->
<!-- <table tableName="pro_core_business" domainObjectName="ProCoreBusiness" />-->
<!-- <table tableName="pro_core_comp_pro" domainObjectName="ProCoreCompPro" />-->
<!-- <table tableName="pro_core_team" domainObjectName="ProCoreTeam" />-->
<!-- <table tableName="pro_financial_index" domainObjectName="ProFinancialIndex" />-->
<!-- <table tableName="pro_financial_index_detail" domainObjectName="ProFinancialIndexDetail" />-->
<!-- <table tableName="pro_financial_index_detail_user" domainObjectName="ProFinancialIndexDetailUser" />-->
<!-- <table tableName="pro_financial_statement" domainObjectName="ProFinancialStatement" />-->
<!-- <table tableName="pro_financial_statement_detail" domainObjectName="ProFinancialStatementDetail" />-->
<!-- <table tableName="pro_Intel_property_patentinfo" domainObjectName="ProIntelPropertyPatentinfo" />-->
<!-- <table tableName="pro_intel_property_website_record" domainObjectName="ProIntelPropertyWebsiteRecord" />-->
<!-- <table tableName="pro_judicial_risk" domainObjectName="ProJudicialRisk" />-->
<!-- <table tableName="pro_mana_situ_check" domainObjectName="ProManaSituCheck" />-->
<!-- <table tableName="pro_mana_situ_license" domainObjectName="ProManaSituLicense" />-->
<!-- <table tableName="pro_mana_situ_recruit" domainObjectName="ProManaSituRecruit" />-->
<!-- <table tableName="pro_mana_situ_tendering_bidding" domainObjectName="ProManaSituTenderingBidding" />-->
<!-- <table tableName="pro_mana_situ_license" domainObjectName="ProManaSituLicense" />-->
<!-- <table tableName="pro_mana_situ_license" domainObjectName="ProManaSituLicense" />-->
<!-- <table tableName="pro_mana_situ_license" domainObjectName="ProManaSituLicense" />-->
<!-- <table tableName="edu_company" domainObjectName="EduCompany" />-->
<!-- <table tableName="edu_project_valuation" domainObjectName="EduProjectValuation" />-->
<!-- <table tableName="edu_project_valuation_answer" domainObjectName="EduProjectValuationAnswer" />-->
<!-- <table tableName="wx_user" domainObjectName="User" />-->
<!-- <table tableName="edu_fcff" domainObjectName="EduFCFF" />-->
<!-- <table tableName="edu_ddm" domainObjectName="EduDDM" />-->
<!-- <table tableName="edu_fcfe" domainObjectName="EduFCFE" />-->
<!-- <table tableName="sys_login_log" domainObjectName="SysLoginLog" />-->
<table tableName="ip_log" domainObjectName="IpLog" />
<!-- <table tableName="sys_log_test" domainObjectName="SysLogTest" />-->
</context>

Loading…
Cancel
Save