瀏覽代碼

添加付款人字段,查询接口增加显示付款人信息。

zzy.zhiyuan.foxmail 8 年之前
父節點
當前提交
a374c03e8b

+ 53 - 12
src/main/java/com/ekexiu/portal/dao/PayHistoryDao.java

@ -1,18 +1,22 @@
1 1
package com.ekexiu.portal.dao;
2 2

3 3
import java.sql.Connection;
4
import java.sql.PreparedStatement;
5
import java.sql.ResultSet;
4 6
import java.sql.SQLException;
7
import java.util.ArrayList;
8
import java.util.List;
5 9

6 10
import org.jfw.apt.orm.annotation.dao.DAO;
7 11
import org.jfw.apt.orm.annotation.dao.method.From;
8 12
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
9
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
10 13
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
11 14
import org.jfw.apt.orm.annotation.dao.param.Set;
12 15
import org.jfw.util.exception.JfwBaseException;
13 16

14 17
import com.ekexiu.portal.po.Operation;
15 18
import com.ekexiu.portal.po.PayHistory;
19
import com.ekexiu.portal.po.Professor;
16 20

17 21
@DAO
18 22
public abstract class PayHistoryDao {
@ -23,23 +27,56 @@ public abstract class PayHistoryDao {
23 27
	@From(PayHistory.class)
24 28
	public abstract int update(Connection con, String payHistoryId, @Set int payStatus) throws SQLException;
25 29
	
26
	@SelectOne
27
	public abstract PayHistory query(Connection con, String payHistoryId) throws SQLException, JfwBaseException;
28
	
29
//	@SelectList
30
//	public abstract List<PayHistory> queryOper(Connection con, String operationId) throws SQLException;
30
	public PayHistory query(Connection con,String payHistoryId) throws SQLException, JfwBaseException{
31
        int _m_1 = 1;
32
        String sql = "SELECT PAY_HISTORY_ID,OPERATION_ID,PAID_MONEY,RETURN_MONEY,REMARK,ISONLINE,PAY_TYPE,PAY_STATUS,PAY_HISTORY.PROFESSOR_ID,PAY_HISTORY.CREATE_TIME,PROFESSOR.NAME FROM PAY_HISTORY LEFT JOIN PROFESSOR ON PAY_HISTORY.PROFESSOR_ID = PROFESSOR.ID WHERE PAY_HISTORY_ID = ?";
33
        PreparedStatement ps = con.prepareStatement(sql);
34
        try{
35
            ps.setString(_m_1++,payHistoryId);
36
            ResultSet rs = ps.executeQuery();
37
            try{
38
                if(rs.next()){
39
                   PayHistory _result = new PayHistory();
40
                    _result.setPayHistoryId(rs.getString(1));
41
                    _result.setOperationId(rs.getString(2));
42
                    _result.setPaidMoney(rs.getBigDecimal(3));
43
                    _result.setReturnMoney(rs.getBigDecimal(4));
44
                    String _m_2 = rs.getString(5);
45
                    if(rs.wasNull()){
46
                        _m_2 = null;
47
                    }
48
                    _result.setRemark(_m_2);
49
                    _result.setIsonline(rs.getInt(6));
50
                    _result.setPayType(rs.getInt(7));
51
                    _result.setPayStatus(rs.getInt(8));
52
                    Professor professor = new Professor();
53
                    professor.setId(rs.getString(9));
54
                    _result.setCreateTime(rs.getString(10));
55
                    professor.setName(rs.getString(11));
56
                    _result.setProfessor(professor);
57
                    return _result;
58
                }else{
59
                    throw new JfwBaseException(201);
60
                }
61
            }finally{
62
                try{rs.close();}catch(Exception _m_3){}
63
            }
64
        }finally{
65
            try{ps.close();}catch(Exception _m_4){}
66
        }
67
    }
31 68
	
32
	public java.util.List<com.ekexiu.portal.po.PayHistory> queryDetail(java.sql.Connection con,java.lang.String operationId) throws java.sql.SQLException{
69
	public List<PayHistory> queryDetail(Connection con,String operationId) throws SQLException{
33 70
        int _m_1 = 1;
34
        String sql = "SELECT PAY_HISTORY_ID,PAY_HISTORY.OPERATION_ID,PAID_MONEY,RETURN_MONEY,REMARK,ISONLINE,PAY_TYPE,PAY_HISTORY.CREATE_TIME,OPERATION.DEAL_PRICE,OPERATION.CREATE_TIME FROM PAY_HISTORY LEFT JOIN OPERATION ON PAY_HISTORY.OPERATION_ID = OPERATION.OPERATION_ID WHERE PAY_HISTORY.OPERATION_ID = ?";
35
        java.sql.PreparedStatement ps = con.prepareStatement(sql);
71
        String sql = "SELECT PAY_HISTORY_ID,PAY_HISTORY.OPERATION_ID,PAID_MONEY,RETURN_MONEY,REMARK,ISONLINE,PAY_TYPE,PAY_HISTORY.CREATE_TIME,OPERATION.DEAL_PRICE,OPERATION.CREATE_TIME,PAY_HISTORY.PROFESSOR_ID,PROFESSOR.NAME FROM PAY_HISTORY LEFT JOIN OPERATION ON PAY_HISTORY.OPERATION_ID = OPERATION.OPERATION_ID LEFT JOIN PROFESSOR ON PAY_HISTORY.PROFESSOR_ID = PROFESSOR.ID WHERE PAY_HISTORY.OPERATION_ID = ?";
72
        PreparedStatement ps = con.prepareStatement(sql);
36 73
        try{
37 74
            ps.setString(_m_1++,operationId);
38
            java.sql.ResultSet rs = ps.executeQuery();
75
            ResultSet rs = ps.executeQuery();
39 76
            try{
40
                java.util.List<com.ekexiu.portal.po.PayHistory> _result = new java.util.ArrayList<com.ekexiu.portal.po.PayHistory>();
77
                List<PayHistory> _result = new ArrayList<PayHistory>();
41 78
                while(rs.next()){
42
                    com.ekexiu.portal.po.PayHistory _obj =  new com.ekexiu.portal.po.PayHistory();
79
                    PayHistory _obj =  new PayHistory();
43 80
                    _obj.setPayHistoryId(rs.getString(1));
44 81
                    Operation operation = new Operation();
45 82
                    operation.setOperationId(rs.getString(2));
@ -56,6 +93,10 @@ public abstract class PayHistoryDao {
56 93
                    operation.setDealPrice(rs.getBigDecimal(9));
57 94
                    operation.setCreateTime(rs.getString(10));
58 95
                    _obj.setOperation(operation);
96
                    Professor professor = new Professor();
97
                    professor.setId(rs.getString(11));
98
                    professor.setName(rs.getString(12));
99
                    _obj.setProfessor(professor);
59 100
                    _result.add(_obj);
60 101
                }
61 102
                return _result;

+ 17 - 0
src/main/java/com/ekexiu/portal/po/PayHistory.java

@ -22,7 +22,9 @@ public class PayHistory implements CreateTimeSupported {
22 22
	private int isonline;
23 23
	private int payType;
24 24
	private int payStatus;
25
	private String professorId;
25 26
	private Operation operation;
27
	private Professor professor;
26 28
	
27 29
	public Operation getOperation() {
28 30
		return operation;
@ -31,6 +33,13 @@ public class PayHistory implements CreateTimeSupported {
31 33
		this.operation = operation;
32 34
	}
33 35
	
36
	public Professor getProfessor() {
37
		return professor;
38
	}
39
	public void setProfessor(Professor professor) {
40
		this.professor = professor;
41
	}
42
	
34 43
	@Column(DE.id_32)
35 44
	public String getPayHistoryId() {
36 45
		return payHistoryId;
@ -102,4 +111,12 @@ public class PayHistory implements CreateTimeSupported {
102 111
		this.payStatus = payStatus;
103 112
	}
104 113
	
114
	@Column(DE.id_32)
115
	public String getProfessorId() {
116
		return professorId;
117
	}
118
	public void setProfessorId(String professorId) {
119
		this.professorId = professorId;
120
	}
121
	
105 122
}

+ 0 - 22
src/main/java/com/ekexiu/portal/service/PayHistoryService.java

@ -50,32 +50,10 @@ public class PayHistoryService {
50 50
		return this.payHistoryDao.query(con, payHistoryId);
51 51
	}
52 52
	
53
//	@Get
54
//	@Path("/qaoper")
55
//	public List<PayHistory> queryOper(@JdbcConn Connection con, String operationId) throws SQLException {
56
//		return this.payHistoryDao.queryOper(con, operationId);
57
//	}
58
	
59 53
	@Get
60 54
	@Path("/qadetail")
61 55
	public List<PayHistory> queryDetail(@JdbcConn Connection con, String operationId) throws SQLException {
62 56
		return this.payHistoryDao.queryDetail(con, operationId);
63 57
	}
64 58
	
65
//	@Get
66
//	@Path("/qadetail")
67
//	public List<PayHistory> queryDetail(@JdbcConn Connection con, String operationId) throws SQLException {
68
//		List<PayHistory> historiesList = this.payHistoryDao.queryDetail(con, operationId);
69
//		for (PayHistory payHistory : historiesList) {
70
//			double remainMoney = payHistory.getOperation().getDealPrice().doubleValue();
71
//			if(payHistory.getPayType() == 0){
72
//				remainMoney = remainMoney - payHistory.getPaidMoney().doubleValue();
73
//			}
74
//			if(payHistory.getPayType() == 1){
75
//				remainMoney = remainMoney + payHistory.getReturnMoney().doubleValue();
76
//			}
77
//		}
78
//		return this.payHistoryDao.queryDetail(con, operationId);
79
//	}
80
	
81 59
}