Quellcode durchsuchen

业务表,对应资源申请、确认、拒绝。

zzy.zhiyuan.foxmail vor 8 Jahren
Ursprung
Commit
76e5631033

+ 64 - 0
src/main/java/com/ekexiu/portal/dao/OperationDao.java

1
package com.ekexiu.portal.dao;
2

3
import java.sql.Connection;
4
import java.sql.SQLException;
5
import java.util.List;
6

7
import org.jfw.apt.annotation.Nullable;
8
import org.jfw.apt.orm.annotation.dao.DAO;
9
import org.jfw.apt.orm.annotation.dao.method.From;
10
import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
11
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
12
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
13
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
14
import org.jfw.apt.orm.annotation.dao.method.operator.Update;
15
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
16

17
import com.ekexiu.portal.po.Operation;
18

19
@DAO
20
public abstract class OperationDao {
21
	@Insert
22
	public abstract int insert(Connection con, Operation operation) throws SQLException;
23
	
24
	@Update
25
	public abstract int update(Connection con, Operation operation) throws SQLException;
26
	
27
	@UpdateWith
28
	@From(Operation.class)
29
	public abstract int updateConsultContent(Connection con, String operationId, String consultContent) throws SQLException;
30
	
31
	@UpdateWith
32
	@From(Operation.class)
33
	public abstract int updateDetailDemand(Connection con, String operationId, String detailDemand) throws SQLException;
34
	
35
	@UpdateWith
36
	@From(Operation.class)
37
	public abstract int updateOperationStatus(Connection con, String operationId, int operationStatus) throws SQLException;
38
	
39
	@UpdateWith
40
	@From(Operation.class)
41
	public abstract int updateDeliverTime(Connection con, String operationId, String deliverTime) throws SQLException;
42
	
43
	@UpdateWith
44
	@From(Operation.class)
45
	public abstract int updatePayMethod(Connection con, String operationId, String payMethod) throws SQLException;
46
	
47
	@Nullable
48
	@SelectOne
49
	public abstract Operation query(Connection con, String operationId) throws SQLException;
50
	
51
	@SelectList
52
	public abstract List<Operation> query(Connection con) throws SQLException;
53
	
54
	@SelectList
55
	public abstract List<Operation> queryPro(Connection con, String demandId) throws SQLException;
56
	
57
	@SelectList
58
	public abstract List<Operation> queryRes(Connection con, String resourceId) throws SQLException;
59
	
60
	@DeleteWith
61
	@From(Operation.class)
62
	public abstract int delete(Connection con, String operationId) throws SQLException;
63
	
64
}

+ 139 - 0
src/main/java/com/ekexiu/portal/po/Operation.java

1
package com.ekexiu.portal.po;
2

3
import java.math.BigDecimal;
4

5
import org.jfw.apt.orm.annotation.entry.Column;
6
import org.jfw.apt.orm.annotation.entry.PrimaryKey;
7
import org.jfw.apt.orm.annotation.entry.Table;
8
import org.jfw.apt.orm.core.defaultImpl.FixLenStringHandler;
9
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
10
import org.jfw.apt.orm.core.enums.DE;
11

12
@Table
13
@PrimaryKey("operationId")
14
public class Operation {
15
	private String operationId;
16
	private int operationStatus;
17
	private String demandId;
18
	private String demandType;
19
	/**
20
	 * 咨询主题
21
	 */
22
	private String consultTitle;
23
	/**
24
	 * 咨询内容
25
	 */
26
	private String consultContent;
27
	/**
28
	 * 具体需求
29
	 */
30
	private String detailDemand;
31
	/**
32
	 * 交付时间
33
	 */
34
	private String deliverTime;
35
	private String resourceId;
36
	/**
37
	 * 成交金额
38
	 */
39
	private BigDecimal dealPrice;
40
	private String dealTime;
41
	private String payMethod;
42
	
43
	@Column(DE.id_32)
44
	public String getOperationId() {
45
		return operationId;
46
	}
47
	public void setOperationId(String operationId) {
48
		this.operationId = operationId;
49
	}
50
	
51
	@Column(DE.int_de)
52
	public int getOperationStatus() {
53
		return operationStatus;
54
	}
55
	public void setOperationStatus(int operationStatus) {
56
		this.operationStatus = operationStatus;
57
	}
58
	
59
	@Column(DE.id_32)
60
	public String getDemandId() {
61
		return demandId;
62
	}
63
	public void setDemandId(String demandId) {
64
		this.demandId = demandId;
65
	}
66
	
67
	@Column(DE.string_de)
68
	public String getDemandType() {
69
		return demandType;
70
	}
71
	public void setDemandType(String demandType) {
72
		this.demandType = demandType;
73
	}
74
	
75
	@Column(DE.string_de)
76
	public String getConsultTitle() {
77
		return consultTitle;
78
	}
79
	public void setConsultTitle(String consultTitle) {
80
		this.consultTitle = consultTitle;
81
	}
82
	
83
	@Column(handlerClass=StringHandler.class,dbType="TEXT",insertable=false,nullable=false,renewable=false,queryable=true)
84
	public String getConsultContent() {
85
		return consultContent;
86
	}
87
	public void setConsultContent(String consultContent) {
88
		this.consultContent = consultContent;
89
	}
90
	
91
	@Column(handlerClass=StringHandler.class,dbType="TEXT",insertable=false,nullable=false,renewable=false,queryable=true)
92
	public String getDetailDemand() {
93
		return detailDemand;
94
	}
95
	public void setDetailDemand(String detailDemand) {
96
		this.detailDemand = detailDemand;
97
	}
98
	
99
	@Column(handlerClass = FixLenStringHandler.class, dbType = "CHAR(8)", fixSqlValueWithInsert = "TO_CHAR(NOW(),'YYYYMMDD')", fixSqlValueWithUpdate = "TO_CHAR(NOW(),'YYYYMMDD')", insertable = true, nullable = false, queryable = true, renewable = true)
100
	public String getDeliverTime() {
101
		return deliverTime;
102
	}
103
	public void setDeliverTime(String deliverTime) {
104
		this.deliverTime = deliverTime;
105
	}
106
	
107
	@Column(DE.id_32)
108
	public String getResourceId() {
109
		return resourceId;
110
	}
111
	public void setResourceId(String resourceId) {
112
		this.resourceId = resourceId;
113
	}
114
	
115
	@Column(DE.bigDecmimal_de)
116
	public BigDecimal getDealPrice() {
117
		return dealPrice;
118
	}
119
	public void setDealPrice(BigDecimal dealPrice) {
120
		this.dealPrice = dealPrice;
121
	}
122
	
123
	@Column(handlerClass = FixLenStringHandler.class, dbType = "CHAR(14)", fixSqlValueWithInsert = "TO_CHAR(NOW(),'YYYYMMDDHH24MISS')", insertable = true, nullable = false, queryable = true, renewable = false)
124
	public String getDealTime() {
125
		return dealTime;
126
	}
127
	public void setDealTime(String dealTime) {
128
		this.dealTime = dealTime;
129
	}
130
	
131
	@Column(DE.string_de)
132
	public String getPayMethod() {
133
		return payMethod;
134
	}
135
	public void setPayMethod(String payMethod) {
136
		this.payMethod = payMethod;
137
	}
138
	
139
}

+ 111 - 0
src/main/java/com/ekexiu/portal/service/OperationService.java

1
package com.ekexiu.portal.service;
2

3
import java.sql.Connection;
4
import java.sql.SQLException;
5
import java.util.List;
6

7
import org.jfw.apt.annotation.Autowrie;
8
import org.jfw.apt.annotation.Nullable;
9
import org.jfw.apt.orm.annotation.dao.method.operator.Delete;
10
import org.jfw.apt.web.annotation.Path;
11
import org.jfw.apt.web.annotation.operate.Get;
12
import org.jfw.apt.web.annotation.operate.Post;
13
import org.jfw.apt.web.annotation.operate.Put;
14
import org.jfw.apt.web.annotation.param.JdbcConn;
15
import org.jfw.apt.web.annotation.param.PathVar;
16
import org.jfw.util.StringUtil;
17

18
import com.ekexiu.portal.dao.OperationDao;
19
import com.ekexiu.portal.po.Operation;
20

21
@Path("/operation")
22
public class OperationService {
23
	@Autowrie
24
	private OperationDao operationDao;
25
	
26
	public OperationDao getOperationDao() {
27
		return operationDao;
28
	}
29
	public void setOperationDao(OperationDao operationDao) {
30
		this.operationDao = operationDao;
31
	}
32
	
33
	@Post
34
	@Path
35
	public String insert(@JdbcConn(true) Connection con, Operation operation, String demandId, @Nullable String resourceId) throws SQLException{
36
		String operationId = StringUtil.buildUUID();
37
		operation.setOperationId(operationId);
38
		operation.setDemandId(demandId);
39
		if(operation.getResourceId() == null){
40
			operation.setResourceId(resourceId);
41
		}
42
		this.operationDao.insert(con, operation);
43
		return operationId;
44
	}
45
	
46
	@Put
47
	@Path
48
	public void update(@JdbcConn(true) Connection con, Operation operation) throws SQLException{
49
		this.operationDao.update(con, operation);
50
	}
51
	
52
	@Get
53
	@Path("/{operationId}")
54
	public Operation query(@JdbcConn Connection con, @PathVar String operationId) throws SQLException{
55
		return this.operationDao.query(con, operationId);
56
	}
57
	
58
	@Get
59
	@Path("/qa")
60
	public List<Operation> queryAll(@JdbcConn Connection con) throws SQLException{
61
		return this.operationDao.query(con);
62
	}
63
	
64
	@Get
65
	@Path("/qapro")
66
	public List<Operation> queryPro(@JdbcConn Connection con, String demandId) throws SQLException{
67
		return this.operationDao.queryPro(con, demandId);
68
	}
69
	
70
	@Get
71
	@Path("/qares")
72
	public List<Operation> queryRes(@JdbcConn Connection con, String resourceId) throws SQLException{
73
		return this.operationDao.queryRes(con, resourceId);
74
	}
75
	
76
	@Post
77
	@Path("/consultContent")
78
	public void updateConsultContent(@JdbcConn(true) Connection con, String operationId, String consultContent) throws SQLException{
79
		this.operationDao.updateConsultContent(con, operationId, consultContent);
80
	}
81
	
82
	@Post
83
	@Path("/detailDemand")
84
	public void updateDetailDemand(@JdbcConn(true) Connection con, String operationId, String detailDemand) throws SQLException{
85
		this.operationDao.updateDetailDemand(con, operationId, detailDemand);
86
	}
87
	
88
	@Post
89
	@Path("/operationStatus")
90
	public void updateOperationStatus(@JdbcConn(true) Connection con, String operationId, int operationStatus) throws SQLException{
91
		this.operationDao.updateOperationStatus(con, operationId, operationStatus);
92
	}
93
	
94
	@Post
95
	@Path("/deliverTime")
96
	public void updateDeliverTime(@JdbcConn(true) Connection con, String operationId, String deliverTime) throws SQLException{
97
		this.operationDao.updateDeliverTime(con, operationId, deliverTime);
98
	}
99
	
100
	@Post
101
	@Path("/payMethod")
102
	public void updatePayMethod(@JdbcConn(true) Connection con, String operationId, String payMethod) throws SQLException{
103
		this.operationDao.updatePayMethod(con, operationId, payMethod);
104
	}
105
	
106
	@Delete
107
	@Path("/{operationId}")
108
	public void delete(@JdbcConn(true) Connection con, String operationId) throws SQLException{
109
		this.operationDao.delete(con, operationId);
110
	}
111
}