xiangjincheng_branch
向金成 2 years ago
parent f6dc51c287
commit 7dd91c9310

@ -7,7 +7,6 @@
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="test_model" />
<module name="springboot" />
</profile>
</annotationProcessing>

@ -4,7 +4,6 @@
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/springboot/pom.xml" />
<option value="$PROJECT_DIR$/test_model/pom.xml" />
</list>
</option>
</component>

@ -4,7 +4,6 @@
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/medicine.iml" filepath="$PROJECT_DIR$/.idea/medicine.iml" />
<module fileurl="file://$PROJECT_DIR$/springboot/springboot.iml" filepath="$PROJECT_DIR$/springboot/springboot.iml" />
<module fileurl="file://$PROJECT_DIR$/test_model/test_model.iml" filepath="$PROJECT_DIR$/test_model/test_model.iml" />
</modules>
</component>
</project>

@ -1,10 +0,0 @@
{ java:S120"ZRename this package name to match the regular expression '^[a-z_]+(\.[a-z_][a-z0-9_]*)*$'.(­œ¡ üÿÿÿÿ8ô¡… §1
l
java:S4488"JReplace "@RequestMapping(method = RequestMethod.POST)" with "@PostMapping"(À´£­ûÿÿÿÿ8û¡… §1
g
java:S4488"JReplace "@RequestMapping(method = RequestMethod.POST)" with "@PostMapping"(<28>ÚÞ•8ý¡… §1
l
java:S4488+"JReplace "@RequestMapping(method = RequestMethod.POST)" with "@PostMapping"(ÃŽèïûÿÿÿÿ8þ¡… §1
g
java:S44881"JReplace "@RequestMapping(method = RequestMethod.POST)" with "@PostMapping"(ó½Õ 8Ä¿‡ §1

@ -1,21 +0,0 @@
Q
java:S3740"/Provide the parametrized type for this generic.(£ü‰üÿÿÿÿÿ8àüɸ¬1
{ java:S120"ZRename this package name to match the regular expression '^[a-z_]+(\.[a-z_][a-z0-9_]*)*$'.(<28>Ž×Úýÿÿÿÿ8áüɸ¬1
Z java:S106,"9Replace this use of System.out or System.err by a logger.(»œ¯µÿÿÿÿÿ8ðüɸ¬1
Z java:S106-"9Replace this use of System.out or System.err by a logger.(˼ü™ûÿÿÿÿ8ðüɸ¬1
U java:S106="9Replace this use of System.out or System.err by a logger.(ÁÞˆ<C39E>8ñüɸ¬1
U java:S106K"9Replace this use of System.out or System.err by a logger.(ÁÉã™8òüɸ¬1
Z java:S106b"9Replace this use of System.out or System.err by a logger.(‹žˆ¢úÿÿÿÿ8òüɸ¬1
T java:S106c"9Replace this use of System.out or System.err by a logger.(ÇÆ´78òüɸ¬1
Z java:S106r"9Replace this use of System.out or System.err by a logger.(㘘¨þÿÿÿÿ8óüɸ¬1
U java:S106"9Replace this use of System.out or System.err by a logger.(¼‘œ8ôüɸ¬1
U java:S106<18>"9Replace this use of System.out or System.err by a logger.(Ü<>Å8ôüɸ¬1
[ java:S106<18>"9Replace this use of System.out or System.err by a logger.(£äЯùÿÿÿÿ8ôüɸ¬1
V java:S106Ÿ"9Replace this use of System.out or System.err by a logger.(žðíÔ8õüɸ¬1
V java:S106¬"9Replace this use of System.out or System.err by a logger.(³¦É‚8õüɸ¬1
n
java:S1128 "LRemove this unused import 'org.springframework.cache.annotation.CacheEvict'.(½Á¨ˆøÿÿÿÿ8öüɸ¬1
l
java:S1128
"JRemove this unused import 'org.springframework.cache.annotation.CachePut'.(ý≠þÿÿÿÿ8öüɸ¬1

@ -1,2 +0,0 @@
{ java:S120"ZRename this package name to match the regular expression '^[a-z_]+(\.[a-z_][a-z0-9_]*)*$'.(<28>Ž×Úýÿÿÿÿ˜«¦1

@ -1,20 +0,0 @@
` java:S112$"FDefine and throw a dedicated exception instead of using a generic one.(Ò‚Òéüÿÿÿÿ
k java:S117"QRename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(£ç¡¾øÿÿÿÿ
f java:S117"QRename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(¸Îų
k java:S117"QRename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(¡Ìâƒùÿÿÿÿ
t
java:S2142#"^Either re-interrupt this method or rethrow the "InterruptedException" that can be caught here.(ä ¹€
N java:S106"9Replace this use of System.out or System.err by a logger.(ËÙ̓
R
java:S1128"7Remove this unused import 'org.python.core.PyFunction'.(È忎üÿÿÿÿ
P
java:S1128"5Remove this unused import 'org.python.core.PyObject'.(ÿ¯½Öûÿÿÿÿ
P
java:S1128"5Remove this unused import 'org.python.core.PyString'.(Ü”®<E2809D>ûÿÿÿÿ
T
java:S1128">Remove this unused import 'org.python.util.PythonInterpreter'.(ü‡â©
M
java:S1128"7Remove this unused import 'javax.imageio.IIOException'.(´ÂÏ’
F
java:S1128 "0Remove this unused import 'java.util.ArrayList'.(÷‰îƒ

@ -1,8 +0,0 @@
{ java:S120"ZRename this package name to match the regular expression '^[a-z_]+(\.[a-z_][a-z0-9_]*)*$'.(­œ¡ üÿÿÿÿ×Ò¸¬1
l
java:S1128"ORemove this unused import 'org.springframework.beans.factory.annotation.Value'.(ìø<C3B8>×Ò¸¬1
r
java:S1128 "PRemove this unused import 'org.springframework.web.bind.annotation.RequestBody'.(â­½Àýÿÿÿÿ×Ò¸¬1
F
java:S1128")Remove this unused import 'java.io.File'.(†Ð¥Å×Ò¸¬1

@ -1,2 +0,0 @@
t java:S120"ZRename this package name to match the regular expression '^[a-z_]+(\.[a-z_][a-z0-9_]*)*$'.(­œ¡ üÿÿÿÿ

@ -1,7 +0,0 @@
{ java:S120"ZRename this package name to match the regular expression '^[a-z_]+(\.[a-z_][a-z0-9_]*)*$'.(­œ¡ üÿÿÿÿš·¬1
h
java:S1128 "KRemove this unused import 'org.springframework.cache.annotation.Cacheable'.(ݺؓ8Šëฬ1
p
java:S1128
"NRemove this unused import 'org.springframework.data.redis.core.RedisTemplate'.(–ª¡Çøÿÿÿÿ8Œëฬ1

@ -17,43 +17,23 @@ X
0train_cancer/train_model/data_gen/data_output.py,6\9\69a341fae4073fedbb8b01a3b078c3012c70ce5f
}
Mspringboot/src/main/java/com/xht/springboot/Control/GetSpiderInformation.java,6\a\6ae8bd6e0b13a9d9272e5cd44460d2d0a72091d9
^
.test_model/src/main/java/org/example/Main.java,7\f\7f8771ebddaacf6a70143dc43243816aa7f7e066
r
Bspringboot/src/main/java/com/xht/springboot/Tip/RequestResult.java,8\a\8ac776bbbb6e77f29694ccc4476b533f9f4573da
|
Lspringboot/src/main/java/com/xht/springboot/Service/CancerDetectService.java,5\a\5aa79857db1807fe40f0941af9e17d8a19d8bc97
C
springboot/mvnw.cmd,a\0\a027316d6320e979eb2d643acc8d7431b5899762
B
test_model/pom.xml,c\5\c5247f1a7a8da981f49c6fe2b5fc0ba5e9b426bb
p
@springboot/src/main/java/com/xht/springboot/Entity/UserHome.java,0\b\0bf6f777ae20a7657065bc4a2b2a9f1f3b4876b1
q
Aspringboot/src/main/java/com/xht/springboot/Entity/UserLogin.java,1\3\139a0da36daad8c438a5607ee212d1f38a505779
B
springboot/pom.xml,e\4\e46aee6c7c512a7b48980a296fca0acf004a1907
r
Bspringboot/src/main/java/com/xht/springboot/Dao/WebHomeMapper.java,2\a\2ad2a1260dac6c01c8b352bb0e2ca62f513676a9
s
Cspringboot/src/main/java/com/xht/springboot/Config/RedisConfig.java,0\3\03febb48c6f14848416295ea77d17704b452f798
p
@springboot/src/main/java/com/xht/springboot/Entity/UserText.java,4\0\40a2343a36c9747fa26c52f19f82c0a493b5c2e0
s
Cspringboot/src/main/java/com/xht/springboot/Entity/UserComment.java,9\3\932ae6b8f9f42f924c25e69e48dc30fddd63ec28
q
Aspringboot/src/main/java/com/xht/springboot/Entity/UserReply.java,0\5\051eaf551b928a8ccf651611c070ebb2b8155264
w
Gspringboot/src/main/java/com/xht/springboot/Service/WebHomeService.java,5\f\5feb9f75e1bc678660918562fd0ce2745899be29

Ospringboot/src/main/java/com/xht/springboot/Control/CancerDetectController.java,b\7\b7cd5493e06e5fd9d49343a72ed251284cff7045
z
Jspringboot/src/main/java/com/xht/springboot/Control/WebHomeController.java,e\d\edeacc9d294f3b307d4238fb3f381c6838218bb6

Ospringboot/src/main/java/com/xht/springboot/Control/PersonalHomeController.java,b\e\be5bf7d32cedc052850e2cc0c99f2cf7357cac12
|
Lspringboot/src/main/java/com/xht/springboot/Service/PersonalHomeService.java,7\6\762bc359bc75ba7b3073e784c826f31f6c989305
v
Fspringboot/src/main/java/com/xht/springboot/SpringbootApplication.java,4\0\40324953a2003c0d6c6b3ceece38a620d48a0df7
<EFBFBD>
Sspringboot/src/main/java/com/xht/springboot/Control/LoginAndRegisterController.java,4\2\42d62ad23989879b1e669e84287f32b9ec3b7df5
l
<test_model/src/main/java/org/example/python/output_result.py,c\f\cf2b6f7a1e504e3a80407b7fb223ab50a8c9f4bf

@ -17,43 +17,23 @@ X
0train_cancer/train_model/data_gen/data_output.py,6\9\69a341fae4073fedbb8b01a3b078c3012c70ce5f
}
Mspringboot/src/main/java/com/xht/springboot/Control/GetSpiderInformation.java,6\a\6ae8bd6e0b13a9d9272e5cd44460d2d0a72091d9
^
.test_model/src/main/java/org/example/Main.java,7\f\7f8771ebddaacf6a70143dc43243816aa7f7e066
r
Bspringboot/src/main/java/com/xht/springboot/Tip/RequestResult.java,8\a\8ac776bbbb6e77f29694ccc4476b533f9f4573da
|
Lspringboot/src/main/java/com/xht/springboot/Service/CancerDetectService.java,5\a\5aa79857db1807fe40f0941af9e17d8a19d8bc97
C
springboot/mvnw.cmd,a\0\a027316d6320e979eb2d643acc8d7431b5899762
B
test_model/pom.xml,c\5\c5247f1a7a8da981f49c6fe2b5fc0ba5e9b426bb
v
Fspringboot/src/main/java/com/xht/springboot/SpringbootApplication.java,4\0\40324953a2003c0d6c6b3ceece38a620d48a0df7
p
@springboot/src/main/java/com/xht/springboot/Entity/UserHome.java,0\b\0bf6f777ae20a7657065bc4a2b2a9f1f3b4876b1
q
Aspringboot/src/main/java/com/xht/springboot/Entity/UserLogin.java,1\3\139a0da36daad8c438a5607ee212d1f38a505779
B
springboot/pom.xml,e\4\e46aee6c7c512a7b48980a296fca0acf004a1907
r
Bspringboot/src/main/java/com/xht/springboot/Dao/WebHomeMapper.java,2\a\2ad2a1260dac6c01c8b352bb0e2ca62f513676a9
s
Cspringboot/src/main/java/com/xht/springboot/Config/RedisConfig.java,0\3\03febb48c6f14848416295ea77d17704b452f798
p
@springboot/src/main/java/com/xht/springboot/Entity/UserText.java,4\0\40a2343a36c9747fa26c52f19f82c0a493b5c2e0
s
Cspringboot/src/main/java/com/xht/springboot/Entity/UserComment.java,9\3\932ae6b8f9f42f924c25e69e48dc30fddd63ec28
q
Aspringboot/src/main/java/com/xht/springboot/Entity/UserReply.java,0\5\051eaf551b928a8ccf651611c070ebb2b8155264
w
Gspringboot/src/main/java/com/xht/springboot/Service/WebHomeService.java,5\f\5feb9f75e1bc678660918562fd0ce2745899be29

Ospringboot/src/main/java/com/xht/springboot/Control/CancerDetectController.java,b\7\b7cd5493e06e5fd9d49343a72ed251284cff7045
|
Lspringboot/src/main/java/com/xht/springboot/Service/PersonalHomeService.java,7\6\762bc359bc75ba7b3073e784c826f31f6c989305
z
Jspringboot/src/main/java/com/xht/springboot/Control/WebHomeController.java,e\d\edeacc9d294f3b307d4238fb3f381c6838218bb6

Ospringboot/src/main/java/com/xht/springboot/Control/PersonalHomeController.java,b\e\be5bf7d32cedc052850e2cc0c99f2cf7357cac12
<EFBFBD>
Sspringboot/src/main/java/com/xht/springboot/Control/LoginAndRegisterController.java,4\2\42d62ad23989879b1e669e84287f32b9ec3b7df5
l
<test_model/src/main/java/org/example/python/output_result.py,c\f\cf2b6f7a1e504e3a80407b7fb223ab50a8c9f4bf

@ -4,8 +4,11 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
@Service
public class CancerDetectService {

@ -6,6 +6,7 @@ import com.xht.springboot.Entity.UserHome;
import com.xht.springboot.Entity.UserText;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
@ -14,16 +15,48 @@ import java.util.List;
public class PersonalHomeService {
@Autowired
PersonalHomeMapper personalHomeMapper;
@Autowired
RedisTemplate redisTemplate;
String userHomeDataCacheName = "userData::";
String userTxtByUidCacheName = "userTxtByUid::";
//获得用户主页数据
@Cacheable(cacheNames = "userData",key = "#p0")
public UserHome getUserHomeData(int uid){
return personalHomeMapper.findById(uid);
UserHome userHome = (UserHome) redisTemplate.opsForValue().get(userHomeDataCacheName + uid);
if(userHome!=null)
return userHome;
else{
synchronized (PersonalHomeService.class){
userHome = (UserHome) redisTemplate.opsForValue().get(userHomeDataCacheName + uid);
if(userHome!=null)
return userHome;
else{
userHome = personalHomeMapper.findById(uid);
if(userHome!=null)
redisTemplate.opsForValue().set(userHomeDataCacheName+uid,userHome);
return userHome;
}
}
}
}
@Cacheable(cacheNames = "userTxtByUid",key = "#p0")
public List<UserText> getUserTexts(int uid){
return personalHomeMapper.findTexts(uid);
List<UserText> userTexts = (List<UserText>) redisTemplate.opsForValue().get(userTxtByUidCacheName + uid);
if(userTexts!=null)
return userTexts;
else{
synchronized (PersonalHomeService.class){
userTexts = (List<UserText>) redisTemplate.opsForValue().get(userTxtByUidCacheName + uid);
if(userTexts!=null)
return userTexts;
else{
userTexts = personalHomeMapper.findTexts(uid);
if(userTexts!=null)
redisTemplate.opsForValue().set(userTxtByUidCacheName+uid,userTexts);
return userTexts;
}
}
}
}
}

@ -21,19 +21,53 @@ public class WebHomeService {
WebHomeMapper webHomeMapper;
@Autowired
RedisTemplate redisTemplate;
String webHomeDataCacheName = "userTxt&Cmt::";
String webHomeDataKey = "all";
String userRepliesCacheName = "userRepliesOfCmt::";
String userTxtCacheName = "userTxt::";
String userCmtCacheName = "userCmt::";
String userReplyCacheName = "userReply::";
String userFindTxtCacheName = "userFindTxt::";
//获得所有文章除了评论的回复
@Cacheable(cacheNames = "userTxt&Cmt")
public List<UserText> getWebHomeData(){
return webHomeMapper.findAllTextAndComments();
List<UserText> userTexts = (List<UserText>) redisTemplate.opsForValue().get(webHomeDataCacheName+webHomeDataKey);
if(userTexts!=null)
return userTexts;
else{
synchronized (WebHomeService.class){
userTexts = (List<UserText>) redisTemplate.opsForValue().get(webHomeDataCacheName+webHomeDataKey);
if(userTexts!=null)
return userTexts;
else {
userTexts = webHomeMapper.findAllTextAndComments();
if(userTexts!=null)
redisTemplate.opsForValue().set(webHomeDataCacheName+webHomeDataKey,userTexts);
return userTexts;
}
}
}
}
@Cacheable(cacheNames = "userRepliesOfCmt",key = "#p0")
public List<UserReply> getUserReplies(int commentid){
return webHomeMapper.findRepliesByCommentId(commentid);
List<UserReply> userReplies = (List<UserReply>) redisTemplate.opsForValue().get(userRepliesCacheName+commentid);
if(userReplies!=null)
return userReplies;
else{
synchronized (WebHomeService.class){
userReplies = (List<UserReply>) redisTemplate.opsForValue().get(userRepliesCacheName+commentid);
if(userReplies!=null)
return userReplies;
else {
userReplies = webHomeMapper.findRepliesByCommentId(commentid);
if(userReplies!=null)
redisTemplate.opsForValue().set(userRepliesCacheName+commentid,userReplies);
return userReplies;
}
}
}
}
@ -53,12 +87,12 @@ public class WebHomeService {
public boolean deleteUserText(UserText userText){
redisTemplate.opsForValue().getAndDelete(userTxtCacheName+userText.getTextid());//先删除缓存中数据
int rows=0;
rows = webHomeMapper.deleteUserText(userText);
if(rows >= 1){
System.out.println("delete text OK "+rows);
redisTemplate.opsForValue().getAndDelete(userTxtCacheName+userText.getTextid());//删除缓存中数据
return true;
}else{
return false;
@ -67,12 +101,12 @@ public class WebHomeService {
public boolean updateUserText(UserText userText){
redisTemplate.opsForValue().getAndDelete(userTxtCacheName+userText.getTextid());//先删除缓存中数据
int rows=0;
rows = webHomeMapper.updateUserText(userText);
if(rows >= 1){
System.out.println("update text OK "+rows);
redisTemplate.opsForValue().getAndDelete(userTxtCacheName+userText.getTextid());//先删除缓存中数据
return true;
}else{
return false;
@ -80,12 +114,24 @@ public class WebHomeService {
}
@Transactional
@Cacheable(cacheNames = "userFindTxt",key = "#p0")
public List<UserText> findUserText(String token){
List<UserText> results = null;
results = webHomeMapper.findOfTextContains(token);//查询文本中是否包含
results.addAll(webHomeMapper.findOfTitleContains(token));//查询标题中是否包含
return results;
List<UserText> userTexts = (List<UserText>) redisTemplate.opsForValue().get(userFindTxtCacheName+token);
if(userTexts!=null)
return userTexts;
else{
synchronized (WebHomeService.class){
userTexts = (List<UserText>) redisTemplate.opsForValue().get(userFindTxtCacheName+token);
if(userTexts!=null)
return userTexts;
else{
userTexts = webHomeMapper.findOfTextContains(token);//查询文本中是否包含
userTexts.addAll(webHomeMapper.findOfTitleContains(token));//查询标题中是否包含
if(userTexts!=null)
redisTemplate.opsForValue().set(userFindTxtCacheName+token,userTexts);
return userTexts;
}
}
}
}

@ -0,0 +1,24 @@
package org.example;
import org.python.core.PyFunction;
import org.python.core.PyObject;
import org.python.core.PyString;
import org.python.util.PythonInterpreter;
import javax.imageio.IIOException;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import org.example.runmodel.*;
public class Main {
public static void main(String[] args) throws IOException {
String dir_pic = "E:\\Git project\\medicine\\src\\medicine\\springboot\\src\\main\\resources\\upload\\cancerpictures";
String res = runmodel.get_percent(dir_pic);
System.out.println(res);
}
}

@ -0,0 +1,32 @@
import numpy as np
import cv2
from PIL import Image
import tensorflow as tf
import sys
def load_single(dir , size):
read = lambda i: np.asarray(Image.open(i).convert("RGB"))
path = dir
img = read(path)
return np.array(cv2.resize(img, (size, size)))
def check(dir_pic , dir_model):
pic_test = dir_pic
# 转换为numpy格式
img_test = load_single(pic_test , 224)
# 需要12242243这种格式输入
img_test = np.expand_dims(img_test , axis=0)
# 载入模型
x = tf.keras.models.load_model(dir_model)
res = x.predict(img_test)
np.set_printoptions(suppress=True)
return f'{res[0][0] * 100 : .4f}%,{res[0][1] * 100 : .4f}%'
if __name__ == '__main__':
a = []
for i in range(1, len(sys.argv)):
a.append(sys.argv[i])
print(check(a[0] , a[1]))

@ -0,0 +1,30 @@
package org.example;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class runmodel {
public static String get_percent(String dir_pic) throws IOException {
// 自行设置相对路径即可
String dir_model = "test_model/src/main/java/org/example/model";
String py_dir = "test_model/src/main/java/org/example/python/output_result.py";
/**
* py_dir output_result
* dir_pic
* dir_model
*/
String[] path = new String[]{"python " , py_dir , dir_pic , dir_model};
Process proc = Runtime.getRuntime().exec(path);
BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String line = null;
String temp = null;
while ((line = in.readLine()) != null) temp = line;
assert temp != null;
String[] t = temp.split(",");
return "良性:" + t[0] + " 恶性:" + t[1];
}
}
Loading…
Cancel
Save