Skip to content

Commit

Permalink
update by Mason.
Browse files Browse the repository at this point in the history
  • Loading branch information
lhhroots committed Dec 25, 2018
1 parent 73066da commit dc10568
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 89 deletions.
Empty file removed .metadata/.lock
Empty file.
Empty file.
Empty file.
Empty file.
Binary file removed WebRoot/WEB-INF/lib/lpsolve55.dll
Binary file not shown.
Binary file removed WebRoot/WEB-INF/lib/lpsolve55j.dll
Binary file not shown.
1 change: 0 additions & 1 deletion WebRoot/predict/kytr.html
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ <h3 class="panel-title">选择预测模型</h3>
</div>

<div class="col-md-6">
#(ctx_path)
<!-- <div class="page-header">
<small style="font-size:15px">科研投入推荐建议</small>
</div> -->
Expand Down
Binary file modified datasets/fxpg/2014.xls
Binary file not shown.
3 changes: 2 additions & 1 deletion src/com/ccip/bank/config/MyJfinalConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@

public class MyJfinalConfig extends JFinalConfig {
public void configConstant(Constants me) {
String paths = System.getProperty("user.dir"); //获取项目路径
PropKit.use("a_little_config");
me.setDevMode(PropKit.getBoolean("devMode", false));
me.setBaseUploadPath("/upload"); // 上传文件接收路径:项目所在文件盘upload下,也可自行修改
me.setBaseUploadPath(paths+"/upload"); // 上传文件接收路径:项目所在文件盘upload下,也可自行修改
}

@Override
Expand Down
8 changes: 6 additions & 2 deletions src/com/ccip/bank/model/EnterpriseInfoRdf.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,22 @@
* @params company_name
*/
public class EnterpriseInfoRdf extends Controller{


static // get WEB Root path
String paths = System.getProperty("user.dir");
static String dataSetPrex = paths + "/datasets/rdfData/";
String prefix="PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>"+
"PREFIX xsd:<http://www.w3.org/2001/XMLSchema#>"+
"PREFIX owl:<http://www.w3.org/2002/07/owl#>"+
"PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>"+
"PREFIX base:<http://ccip.ucas.ac.cn/resource#>"+
"PREFIX enterprise:<http://ccip.ucas.ac.cn/ontology/company#>";
static String filePath = "A://SysRdfDataSources/"; //data resource
static String filePath = dataSetPrex; //data resource
static OntModel ontModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM);

//basicInfo dataInterface
public Map<String,Object> basicInfo(String company){
System.out.println(dataSetPrex);
ontModel.read(filePath + company + ".rdf");
String queryString = "SELECT ?property ?value"
+" WHERE " +
Expand Down
2 changes: 1 addition & 1 deletion src/com/ccip/bank/user/CompanyController.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import com.jfinal.core.Controller;

public class CompanyController extends Controller {

private static final int PAGE_SIZE = 3;
static CompanyService comInfoservice = new CompanyService();
static EnterpriseInfoRdf test = new EnterpriseInfoRdf(); //实例化RDF查询Model
Expand Down
128 changes: 44 additions & 84 deletions src/com/ccip/bank/user/PredictController.java
Original file line number Diff line number Diff line change
Expand Up @@ -1327,10 +1327,8 @@ public void creditQuality() throws MWException, IOException {
test_data.set(new int[] { 1, 4 }, paraBean.getFlowDebt());
test_data.set(new int[] { 1, 5 }, paraBean.getCost());
test_data.set(new int[] { 1, 6 }, paraBean.getOwnerEquity());

// 使用人工神经网络得到等级概率
Object[] test = grade.guid(2, input_ANN, test_data);

result = CQ.trainClassifier_Tree(3, input, test_data);
// 得到公司信用评级
MWNumericArray cqNum = (MWNumericArray) result[2];
Expand Down Expand Up @@ -1380,7 +1378,7 @@ public void fxpg() {
}

// 财务风险0503 update 0507
public void financial_risk_model() {
public void financial_risk_model() throws MWException {
financialRiskBean paraBean = getBean(financialRiskBean.class);
// paraBean.getFlowAssertRate(),paraBean.getCheckRate(),
// paraBean.getCreditGrade(),paraBean.getFinancialCostRate(),paraBean.getEquityRatio(),
Expand All @@ -1403,48 +1401,36 @@ public void financial_risk_model() {

in.set(new int[] { 10, 1 }, paraBean.getGrowthRateOperateIncome());
in.set(new int[] { 11, 1 }, paraBean.getAllAsserrtIncrease());
// System.out.print(in);
try {
String input = dataSetPrex + "fxpg/2014.xls";
String input_text = dataSetPrex + "fxpg/financial_index.txt";
testRisk testRisk = new testRisk();
Object[] financialRes = null;
financialRes = testRisk.financial(2, input, input_text, in);
// get Result
setAttr("firstlyIndex", financialRes[1].toString());
setAttr("secondaryIndex", financialRes[0].toString());
renderJson(new String[] { "secondaryIndex", "firstlyIndex" });
} catch (MWException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
String input = dataSetPrex + "fxpg/2014.csv";
String input_text = dataSetPrex + "fxpg/financial_index.txt";
testRisk testRisk = new testRisk();
Object[] financialRes = null;
financialRes = testRisk.financial(2, input, input_text, in);
// get Result
setAttr("firstlyIndex", financialRes[1].toString());
setAttr("secondaryIndex", financialRes[0].toString());
renderJson(new String[] { "secondaryIndex", "firstlyIndex" });

}

// 0417风险等级评估模型 竞争风险算法
public void fxpg_competition_model() {
public void fxpg_competition_model() throws MWException {
int num1 = getParaToInt("num1"); // 竞品
int num2 = getParaToInt("num2");// 对外投资
MWNumericArray in = MWNumericArray.newInstance(new int[] { 2, 1 },
MWClassID.DOUBLE, MWComplexity.REAL);
in.set(new int[] { 1, 1 }, num1);
in.set(new int[] { 2, 1 }, num2);
// System.out.print(in);
try {
String input = dataSetPrex + "fxpg/2014.xls";
String input_text = dataSetPrex + "fxpg/financial_index.txt";
testRisk testRisk = new testRisk();
Object[] Res = null;
Res = testRisk.competion(1, input, input_text, in);
renderJson("firstlyIndex", Res[0].toString());
} catch (MWException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String input = dataSetPrex + "fxpg/2014.csv";
String input_text = dataSetPrex + "fxpg/financial_index.txt";
testRisk testRisk = new testRisk();
Object[] Res = null;
Res = testRisk.competion(1, input, input_text, in);
renderJson("firstlyIndex", Res[0].toString());
}

// 0417风险等级评估模型算法--技术风险评估 update at 20180504
public void jszl_model() {
public void jszl_model() throws MWException {
int num1 = getParaToInt("num1");
int num2 = getParaToInt("num2");
int num3 = getParaToInt("num3");
Expand All @@ -1454,23 +1440,18 @@ public void jszl_model() {
in.set(new int[] { 1, 1 }, num1);
in.set(new int[] { 2, 1 }, num2);
in.set(new int[] { 3, 1 }, num3);
// System.out.print(in);
try {
String input = dataSetPrex + "fxpg/2014.xls";
String input_text = dataSetPrex + "fxpg/financial_index.txt";
testRisk testRisk = new testRisk();
Object[] Res = null;
Res = testRisk.tec(1, input, input_text, in);
renderJson("firstlyIndex", Res[0].toString());
String input = dataSetPrex + "fxpg/2014.csv";
String input_text = dataSetPrex + "fxpg/financial_index.txt";
testRisk testRisk = new testRisk();
Object[] Res = null;
Res = testRisk.tec(1, input, input_text, in);
renderJson("firstlyIndex", Res[0].toString());


} catch (MWException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

// 0417风险等级评估模型算法--经营风险评估 update param at 20180502 1-11
public void org_risk_model() {
public void org_risk_model() throws MWException {
businessBean paraBean = getBean(businessBean.class);
// 初始化矩阵
MWNumericArray in = MWNumericArray.newInstance(new int[] { 14, 1 },
Expand All @@ -1494,27 +1475,19 @@ public void org_risk_model() {
in.set(new int[] { 12, 1 }, paraBean.getPeripheralRiskNum());
in.set(new int[] { 13, 1 }, paraBean.getShareholdNum());
in.set(new int[] { 14, 1 }, paraBean.getFirstMaxShare());

// System.out.println(in);
try {
String input = dataSetPrex + "fxpg/2014.xls";
String input_text = dataSetPrex + "fxpg/financial_index.txt";
testRisk testRisk = new testRisk();
Object[] Res = null;
Res = testRisk.business(2, input, input_text, in);
System.out.println(Res[0].toString() + "==" + Res[1].toString());
setAttr("firstlyIndex", Res[1].toString());
setAttr("secondaryIndex", Res[0].toString());
renderJson(new String[] { "secondaryIndex", "firstlyIndex" });
} catch (MWException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String input = dataSetPrex + "fxpg/2014.csv";
String input_text = dataSetPrex + "fxpg/financial_index.txt";
testRisk testRisk = new testRisk();
Object[] Res = null;
Res = testRisk.business(2, input, input_text, in);
System.out.println(Res[0].toString() + "==" + Res[1].toString());
setAttr("firstlyIndex", Res[1].toString());
setAttr("secondaryIndex", Res[0].toString());
renderJson(new String[] { "secondaryIndex", "firstlyIndex" });
}

// 企业风险评估综合指标0504
public void ajaxIntegrateIndex() {
try {
public void ajaxIntegrateIndex() throws MWException {
testRisk testRisk = new testRisk();
Object[] result = testRisk.Result(5);// 得到所有一级二级指标
System.out.println(result[1]);
Expand All @@ -1530,22 +1503,18 @@ public void ajaxIntegrateIndex() {
setAttr("firstlyIndex", result[0].toString());
renderJson(new String[] { "secondaryIndex", "firstlyIndex" });
}

} catch (MWException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

// 科研投入页面
@Before(com.ccip.bank.interceptor.UserAuthInterceptor.class)
public void kytr() {

System.out.println(System.getProperty("java.library.path"));
render("kytr.html");
}

// 0405 实现 0425update java dea
public void kytr_model() throws MWException {
public void kytr_model() throws MWException, LpSolveException {

// 接受测试参数
ScienceInvest paraBean = getBean(ScienceInvest.class);
Expand All @@ -1570,12 +1539,7 @@ public void kytr_model() throws MWException {
records.put("new", new DeaRecord(output, input));
DataEnvelopmentAnalysis dea = new DataEnvelopmentAnalysis();
Map<String, Double> results = null;
try {
results = dea.estimateEfficiency(records);
} catch (LpSolveException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
results = dea.estimateEfficiency(records);
renderJson("ret", (new TreeMap<>(results)).get("new"));
// research test = new research();
// //new int[]{11,2}代表矩阵为11行2列的矩阵
Expand Down Expand Up @@ -1820,16 +1784,17 @@ public static void contentToTxt(String filePath, String content) {
}

// 基于Jfinal的文件上传并调用CNN模型实现信用等级评估
public void upload() throws JSONException {
try {
public void upload() throws JSONException, IllegalArgumentException, IOException {

// 网页端接收上传.csv文件
UploadFile uploadFile = getFile();
float predValue = 0;
// 获取上传文件
String fileName = uploadFile.getOriginalFileName();
// 获取文件上传的路径
File delfile = new File(uploadFile.getUploadPath() + "\\"
File delfile = new File(uploadFile.getUploadPath() + "/"
+ uploadFile.getFileName());
System.out.println(delfile);
String filePath = delfile.getPath();
// 调用模型处理函数
TFModelPred tm = new TFModelPred();
Expand All @@ -1838,11 +1803,6 @@ public void upload() throws JSONException {
predValue = tm.CreditGrade(modelPath, filePath);
renderJson(predValue);
// System.out.println(predValue);
} catch (NumberFormatException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}

/**
Expand Down

0 comments on commit dc10568

Please sign in to comment.