Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry exported="true" kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry exported="true" kind="lib" path="src/main/webapp/WEB-INF/lib/commons-logging-1.1.1.jar"/>
<classpathentry exported="true" kind="lib" path="src/main/webapp/WEB-INF/lib/jstl-1.2.jar"/>
<classpathentry exported="true" kind="lib" path="src/main/webapp/WEB-INF/lib/spring-aop-3.2.0.RELEASE.jar"/>
<classpathentry exported="true" kind="lib" path="src/main/webapp/WEB-INF/lib/spring-aspects-3.2.0.RELEASE.jar"/>
<classpathentry exported="true" kind="lib" path="src/main/webapp/WEB-INF/lib/spring-beans-3.2.0.RELEASE.jar"/>
<classpathentry exported="true" kind="lib" path="src/main/webapp/WEB-INF/lib/spring-context-3.2.0.RELEASE.jar"/>
<classpathentry exported="true" kind="lib" path="src/main/webapp/WEB-INF/lib/spring-context-support-3.2.0.RELEASE.jar"/>
<classpathentry exported="true" kind="lib" path="src/main/webapp/WEB-INF/lib/spring-core-3.2.0.RELEASE.jar"/>
<classpathentry exported="true" kind="lib" path="src/main/webapp/WEB-INF/lib/spring-expression-3.2.0.RELEASE.jar"/>
<classpathentry exported="true" kind="lib" path="src/main/webapp/WEB-INF/lib/spring-jdbc-3.2.0.RELEASE.jar"/>
<classpathentry exported="true" kind="lib" path="src/main/webapp/WEB-INF/lib/spring-orm-3.2.0.RELEASE.jar"/>
<classpathentry exported="true" kind="lib" path="src/main/webapp/WEB-INF/lib/spring-test-3.2.0.RELEASE.jar"/>
<classpathentry exported="true" kind="lib" path="src/main/webapp/WEB-INF/lib/spring-tx-3.2.0.RELEASE.jar"/>
<classpathentry exported="true" kind="lib" path="src/main/webapp/WEB-INF/lib/spring-web-3.2.0.RELEASE.jar"/>
<classpathentry exported="true" kind="lib" path="src/main/webapp/WEB-INF/lib/spring-webmvc-3.2.0.RELEASE.jar"/>
<classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/jackson-annotations-2.6.7.jar"/>
<classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/jackson-core-2.6.7.jar"/>
<classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/jackson-databind-2.6.7.jar"/>
<classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/jackson-dataformat-xml-2.6.7.jar"/>
<classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/jackson-module-jaxb-annotations-2.6.7.jar"/>
<classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/stax2-api-3.1.4.jar"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
42 changes: 42 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>test</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>
13 changes: 13 additions & 0 deletions .settings/.jsdtscope
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/webapp"/>
<classpathentry excluding="**/*.min.js|**/node_modules/*|**/bower_components/*" kind="src" path="target/m2e-wtp/web-resources"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="output" path=""/>
</classpath>
2 changes: 2 additions & 0 deletions .settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding//src/main/java/com/fuxuan/utils/JsonUtils.java=UTF-8
8 changes: 8 additions & 0 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.5
4 changes: 4 additions & 0 deletions .settings/org.eclipse.m2e.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
10 changes: 10 additions & 0 deletions .settings/org.eclipse.wst.common.component
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="test">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<property name="context-root" value="test"/>
<property name="java-output-path" value="/test/target/classes"/>
</wb-module>
</project-modules>
7 changes: 7 additions & 0 deletions .settings/org.eclipse.wst.common.project.facet.core.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="java" version="1.5"/>
<installed facet="jst.web" version="2.5"/>
<installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>
1 change: 1 addition & 0 deletions .settings/org.eclipse.wst.jsdt.ui.superType.container
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
1 change: 1 addition & 0 deletions .settings/org.eclipse.wst.jsdt.ui.superType.name
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Window
2 changes: 2 additions & 0 deletions .settings/org.eclipse.wst.validation.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
disabled=06target
eclipse.preferences.version=1
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,24 @@
2. 给我们发送一个 Pull request,我们会 Review 您的代码。

## 其他
* 如果您的构建和运行过程比较难以理解的话,建议您修改 Readme 的这个地方添加一些说明文字。
* 如果您的构建和运行过程比较难以理解的话,建议您修改 Readme 的这个地方添加一些说明文字。

启动工程时,会自动添加5条交易记录,也可以查出新添加的记录

/**
* 插入数据
* @param status 交易状态
* @param type 交易类型
* @param money 金额
* @param currency 币种
* @param userId 用户ID
*/
@RequestMapping("/newTrade/{status}/{type}/{count}/{currency}/{userId}")

/**
*
* @param status 0 查询所有记录 ,1 支付等待,2成功支付,3失败支付
* @return
*/
@RequestMapping("/getTradeList/{status}")

7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.fuxuan</groupId>
<artifactId>test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
</project>
77 changes: 77 additions & 0 deletions src/main/java/com/fuxuan/controller/TradeController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package com.fuxuan.controller;

import java.math.BigDecimal;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.fuxuan.entity.TradeRecord;
import com.fuxuan.entity.User;
import com.fuxuan.service.TradeService;
import com.fuxuan.utils.JsonResult;

/**
*
* @author Fuxuan
*
*/
@Controller
public class TradeController extends JsonResult {

@Autowired
private TradeService tradeService;//���׼�¼���

/**
*
* @param status ����״̬
* @param type ��������
* @param money ���
* @param currency ����
* @param userId �û�ID
*/
@RequestMapping("/newTrade/{status}/{type}/{count}/{currency}/{userId}")
@ResponseBody
public String newTrade(@PathVariable("status") Integer status,@PathVariable("type") Integer type,@PathVariable("count") BigDecimal count,@PathVariable("currency") Integer currency,@PathVariable("userId") Integer userId){
try {
TradeRecord tr = new TradeRecord();
tr.setStatus(status);
tr.setType(type);
tr.setCount(count);
tr.setCurrency(currency);
User user = new User();
user.setId(userId);
tr.setUser(user);
TradeRecord result = tradeService.newTrade(tr);
return this.setJson(true, result);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return this.setJson(false, null);
}
}


/**
*
* @param status 0 ��ѯ���м�¼ ,1 ֧���ȴ�,2�ɹ�֧��,3ʧ��֧��
* @return
*/
@RequestMapping("/getTradeList/{status}")
@ResponseBody
public String getTradeList(@PathVariable("status") Integer status){
try {
List<TradeRecord> tradeRecordList = tradeService.getTradeList(status);
return this.setJson(true, tradeRecordList);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return this.setJson(false, null);
}
}


}
107 changes: 107 additions & 0 deletions src/main/java/com/fuxuan/entity/TradeRecord.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
package com.fuxuan.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
*
* @author Fuxuan
*
*/
public class TradeRecord implements Serializable {

private static final long serialVersionUID = -6933004002818669361L;

private Integer id;//����

private Date addTime;//����ʱ��

private Integer status;//����״̬(1���ȴ�֧����2֧���ɹ���3֧��ʧ��)

private Integer type;//��������(1.֧����2.�˿�)

private BigDecimal count;//���

private Integer currency;//����(1.�����,2����Ԫ)

private User user;

public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}

public Date getAddTime() {
return addTime;
}

public void setAddTime(Date addTime) {
this.addTime = addTime;
}

public Integer getStatus() {
return status;
}

public void setStatus(Integer status) {
this.status = status;
}

public Integer getType() {
return type;
}

public void setType(Integer type) {
this.type = type;
}

public BigDecimal getCount() {
return count;
}

public void setCount(BigDecimal count) {
this.count = count;
}

public Integer getCurrency() {
return currency;
}

public void setCurrency(Integer currency) {
this.currency = currency;
}

public User getUser() {
return user;
}

public void setUser(User user) {
this.user = user;
}

public static long getSerialversionuid() {
return serialVersionUID;
}

public TradeRecord() {
super();
// TODO Auto-generated constructor stub
}

public TradeRecord(Integer id, Date addTime, Integer status, Integer type, BigDecimal count, Integer currency,
User user) {
super();
this.id = id;
this.addTime = addTime;
this.status = status;
this.type = type;
this.count = count;
this.currency = currency;
this.user = user;
}


}
Loading