Required request body is missing: public com.frtech.frog.common.core.util.R com.frtech.frog.pro.controller.CkSoDdController.save(com.frtech.frog.pro.entity.CkSoDdEntity,java.util.List<com.frtech.frog.pro.entity.CkSoDdSubEntity>)报错含义
时间: 2023-09-16 15:09:06 浏览: 129
这个报错的含义是请求体缺失。在调用 com.frtech.frog.pro.controller.CkSoDdController.save 方法时,需要传入一个 CkSoDdEntity 类型的对象和一个 CkSoDdSubEntity 类型的列表,但是请求中没有包含这些数据。可能原因是在发送请求时未正确设置请求体或者请求体中缺少必要的数据。您需要检查请求的代码和数据,确保请求体中包含所需的数据。
相关问题
补全JAVA代码class Animal { } interface Action { } public class Frog extends Animal implements Action{ public static void main(String[] args) { Animal cat = new Animal("cat","female",3);//名字,性别,年龄 cat.getName(); cat.getAge(); cat.getSex(); cat.growUp(); Animal.getInfo(); Frog frog1 = new Frog("frog","male","tadpole",5);//名字,性别,形态,年龄 frog1.growUp(); frog1.getInfo(); frog1.move(); frog1.breed(); Frog frog2 = new Frog("male","tadpole",9);//性别,形态,年龄 frog2.growUp(); frog2.getInfo(); frog2.move(); frog2.breed(); } }
class Animal {
private String name;
private String sex;
private int age;
public Animal(String name, String sex, int age) {
this.name = name;
this.sex = sex;
this.age = age;
}
public String getName() {
return name;
}
public String getSex() {
return sex;
}
public int getAge() {
return age;
}
public void growUp() {
age++;
}
public static void getInfo() {
System.out.println("This is an animal.");
}
}
interface Action {
void move();
void breed();
}
public class Frog extends Animal implements Action {
private String form;
public Frog(String name, String sex, String form, int age) {
super(name, sex, age);
this.form = form;
}
public Frog(String sex, String form, int age) {
super("frog", sex, age);
this.form = form;
}
@Override
public void move() {
System.out.println("The frog is jumping.");
}
@Override
public void breed() {
System.out.println("The frog is laying eggs.");
}
public void getInfo() {
System.out.println("This is a frog.");
}
public void growUp() {
super.growUp();
if (age > 5) {
form = "adult";
}
}
public static void main(String[] args) {
Animal cat = new Animal("cat", "female", 3);
cat.getName();
cat.getAge();
cat.getSex();
cat.growUp();
Animal.getInfo();
Frog frog1 = new Frog("frog", "male", "tadpole", 5);
frog1.growUp();
frog1.getInfo();
frog1.move();
frog1.breed();
Frog frog2 = new Frog("male", "tadpole", 9);
frog2.growUp();
frog2.getInfo();
frog2.move();
frog2.breed();
}
}
修改下面代码,另画一张可视化图展示出t_sne里面的数据每15行数据个用一种颜色画出。 import pandas as pd from sklearn import cluster from sklearn import metrics import matplotlib.pyplot as plt from sklearn.manifold import TSNE from sklearn.decomposition import PCA def k_means(data_set, output_file, png_file, t_labels, score_file, set_name): model = cluster.KMeans(n_clusters=7, max_iter=1000, init="k-means++") model.fit(data_set) # print(list(model.labels_)) p_labels = list(model.labels_) r = pd.concat([data_set, pd.Series(model.labels_, index=data_set.index)], axis=1) r.columns = list(data_set.columns) + [u'聚类类别'] print(r) # r.to_excel(output_file) with open(score_file, "a") as sf: sf.write("By k-means, the f-m_score of " + set_name + " is: " + str(metrics.fowlkes_mallows_score(t_labels, p_labels))+"\n") sf.write("By k-means, the rand_score of " + set_name + " is: " + str(metrics.adjusted_rand_score(t_labels, p_labels))+"\n") '''pca = PCA(n_components=2) pca.fit(data_set) pca_result = pca.transform(data_set) t_sne = pd.DataFrame(pca_result, index=data_set.index)''' t_sne = TSNE() t_sne.fit(data_set) t_sne = pd.DataFrame(t_sne.embedding_, index=data_set.index) plt.rcParams['font.sans-serif'] = ['SimHei'] plt.rcParams['axes.unicode_minus'] = False dd = t_sne[r[u'聚类类别'] == 0] plt.plot(dd[0], dd[1], 'r.') dd = t_sne[r[u'聚类类别'] == 1] plt.plot(dd[0], dd[1], 'go') dd = t_sne[r[u'聚类类别'] == 2] plt.plot(dd[0], dd[1], 'b*') dd = t_sne[r[u'聚类类别'] == 3] plt.plot(dd[0], dd[1], 'o') dd = t_sne[r[u'聚类类别'] == 4] plt.plot(dd[0], dd[1], 'm.') dd = t_sne[r[u'聚类类别'] == 5] plt.plot(dd[0], dd[1], 'co') dd = t_sne[r[u'聚类类别'] == 6] plt.plot(dd[0], dd[1], 'y*') plt.savefig(png_file) plt.clf() '''plt.scatter(data_set.iloc[:, 0], data_set.iloc[:, 1], c=model.labels_) plt.savefig(png_file) plt.clf()''' frog_data = pd.read_csv("D:/PyCharmPython/pythonProject/mfcc3.csv") tLabel = [] for family in frog_data['name']: if family == "A": tLabel.append(0) elif family == "B": tLabel.append(1) elif family == "C": tLabel.append(2) elif family == "D": tLabel.append(3) elif family == "E": tLabel.append(4) elif family == "F": tLabel.append(5) elif family == "G": tLabel.append(6) scoreFile = "D:/PyCharmPython/pythonProject/scoreOfClustering.txt" first_set = frog_data.iloc[:, 1:1327] k_means(first_set, "D:/PyCharmPython/pythonProject/kMeansSet_1.xlsx", "D:/PyCharmPython/pythonProject/kMeansSet_2.png", tLabel, scoreFile, "Set_1")
修改后的代码如下所示:
```python
import pandas as pd
from sklearn import cluster
from sklearn import metrics
import matplotlib.pyplot as plt
from sklearn.manifold import TSNE
from sklearn.decomposition import PCA
def k_means(data_set, output_file, png_file, t_labels, score_file, set_name):
model = cluster.KMeans(n_clusters=7, max_iter=1000, init="k-means++")
model.fit(data_set)
p_labels = list(model.labels_)
r = pd.concat([data_set, pd.Series(model.labels_, index=data_set.index)], axis=1)
r.columns = list(data_set.columns) + [u'聚类类别']
print(r)
with open(score_file, "a") as sf:
sf.write("By k-means, the f-m_score of " + set_name + " is: " + str(metrics.fowlkes_mallows_score(t_labels, p_labels))+"\n")
sf.write("By k-means, the rand_score of " + set_name + " is: " + str(metrics.adjusted_rand_score(t_labels, p_labels))+"\n")
t_sne = TSNE()
t_sne.fit(data_set)
t_sne = pd.DataFrame(t_sne.embedding_, index=data_set.index)
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False
colors = ['r', 'g', 'b', 'o', 'm', 'c', 'y']
for i in range(0, len(t_sne), 15):
dd = t_sne[r[u'聚类类别'] == i]
plt.plot(dd[0], dd[1], colors[i % len(colors)]+'.')
plt.savefig(png_file)
plt.clf()
frog_data = pd.read_csv("D:/PyCharmPython/pythonProject/mfcc3.csv")
tLabel = []
for family in frog_data['name']:
if family == "A":
tLabel.append(0)
elif family == "B":
tLabel.append(1)
elif family == "C":
tLabel.append(2)
elif family == "D":
tLabel.append(3)
elif family == "E":
tLabel.append(4)
elif family == "F":
tLabel.append(5)
elif family == "G":
tLabel.append(6)
scoreFile = "D:/PyCharmPython/pythonProject/scoreOfClustering.txt"
first_set = frog_data.iloc[:, 1:1327]
k_means(first_set, "D:/PyCharmPython/pythonProject/kMeansSet_1.xlsx", "D:/PyCharmPython/pythonProject/kMeansSet_2.png", tLabel, scoreFile, "Set_1")
```
这段代码对原始代码进行了修改,使用了循环来绘制 t_sne 中每15行数据的散点图,并且使用不同的颜色来表示每个类别。修改后的代码会生成一个名为 "kMeansSet_2.png" 的可视化图。请确保已经安装了相关的依赖库,并将相关路径替换为正确的文件路径。
阅读全文