jiapeng 7 years ago
parent
commit
cbc4cb55b3

+ 21 - 3
src/main/java/com/ekexiu/portal/platform/ButtedOrg.java

7

7

8
import com.ekexiu.portal.basepo.CreateTimeSupported;
8
import com.ekexiu.portal.basepo.CreateTimeSupported;
9

9

10
@PrimaryKey({"pid","oid"})
10
/**
11
 * 对接的合作机构
12
 * 
13
 * @author Saga
14
 *
15
 */
16
@PrimaryKey({ "pid", "oid" })
11
@Table
17
@Table
12
public class ButtedOrg implements CreateTimeSupported {
18
public class ButtedOrg implements CreateTimeSupported {
19
	/**
20
	 * 平台ID
21
	 */
13
	private String pid;
22
	private String pid;
23
	/**
24
	 * 对接的合作机构ID(企业ID)
25
	 */
14
	private String oid;
26
	private String oid;
27

15
	private String createTime;
28
	private String createTime;
16
	
29

17
	@Column(DE.text_de)
30
	@Column(DE.text_de)
18
	public String getPid() {
31
	public String getPid() {
19
		return pid;
32
		return pid;
20
	}
33
	}
34

21
	public void setPid(String pid) {
35
	public void setPid(String pid) {
22
		this.pid = pid;
36
		this.pid = pid;
23
	}
37
	}
38

24
	@Column(DE.text_de)
39
	@Column(DE.text_de)
25
	public String getOid() {
40
	public String getOid() {
26
		return oid;
41
		return oid;
27
	}
42
	}
43

28
	public void setOid(String oid) {
44
	public void setOid(String oid) {
29
		this.oid = oid;
45
		this.oid = oid;
30
	}
46
	}
47

31
	public String getCreateTime() {
48
	public String getCreateTime() {
32
		return createTime;
49
		return createTime;
33
	}
50
	}
51

34
	public void setCreateTime(String createTime) {
52
	public void setCreateTime(String createTime) {
35
		this.createTime = createTime;
53
		this.createTime = createTime;
36
	}
54
	}
37
	
55

38
}
56
}

+ 12 - 1
src/main/java/com/ekexiu/portal/platform/ButtedProfessor.java

6
import org.jfw.apt.orm.core.enums.DE;
6
import org.jfw.apt.orm.core.enums.DE;
7

7

8
import com.ekexiu.portal.basepo.CreateTimeSupported;
8
import com.ekexiu.portal.basepo.CreateTimeSupported;
9

9
/**
10
 * 对接的专家
11
 * 
12
 * @author Saga
13
 *
14
 */
10
@PrimaryKey({"pid","uid"})
15
@PrimaryKey({"pid","uid"})
11
@Table
16
@Table
12
public class ButtedProfessor implements CreateTimeSupported {
17
public class ButtedProfessor implements CreateTimeSupported {
18
	/**
19
	 * 平台ID
20
	 */
13
	private String pid;
21
	private String pid;
22
	/**
23
	 * 对接的专家ID
24
	 */
14
	private String uid;
25
	private String uid;
15
	private String createTime;
26
	private String createTime;
16
	
27
	

+ 92 - 22
src/main/java/com/ekexiu/portal/platform/PlatformDao.java

8
import org.jfw.apt.orm.annotation.dao.DAO;
8
import org.jfw.apt.orm.annotation.dao.DAO;
9
import org.jfw.apt.orm.annotation.dao.method.From;
9
import org.jfw.apt.orm.annotation.dao.method.From;
10
import org.jfw.apt.orm.annotation.dao.method.Where;
10
import org.jfw.apt.orm.annotation.dao.method.Where;
11
import org.jfw.apt.orm.annotation.dao.method.operator.Delete;
12
import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
11
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
13
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
12
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
14
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
13
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
15
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
20
@DAO
22
@DAO
21
public interface PlatformDao {
23
public interface PlatformDao {
22

24

23
	
24
	@SelectOne
25
	@SelectOne
25
	@Nullable
26
	@Nullable
26
	@Where("STATE='1'")
27
	@Where("STATE='1'")
27
	PlatformUser login(Connection con,String email,String passwd)throws SQLException;
28
	PlatformUser login(Connection con, String email, String passwd) throws SQLException;
29

28
	@Nullable
30
	@Nullable
29
	@SelectOne
31
	@SelectOne
30
	PlatformInfo  queryInfo(Connection con,String id)throws SQLException;
31
	
32
	PlatformInfo queryInfo(Connection con, String id) throws SQLException;
33

32
	@SelectOne
34
	@SelectOne
33
	@Nullable 
34
	PlatformUser queryUser(Connection con,String email)throws SQLException;
35
	
35
	@Nullable
36
	PlatformUser queryUser(Connection con, String email) throws SQLException;
37

36
	@SelectOne
38
	@SelectOne
37
	@Nullable 
38
	PlatformUser queryUserById(Connection con,String id)throws SQLException;
39
	
39
	@Nullable
40
	PlatformUser queryUserById(Connection con, String id) throws SQLException;
41

40
	@SelectList
42
	@SelectList
41
	List<PlatformInfo> queryInfos(Connection con,@In String[] id)throws SQLException;
42
	
43
	List<PlatformInfo> queryInfos(Connection con, @In String[] id) throws SQLException;
44

43
	@UpdateWith
45
	@UpdateWith
44
	@From(PlatformUser.class)
46
	@From(PlatformUser.class)
45
	int updatePasswd(Connection con,String id ,@Alias("passwd") String oldpw ,@Set String passwd)throws SQLException;
46
	
47
	int updatePasswd(Connection con, String id, @Alias("passwd") String oldpw, @Set String passwd) throws SQLException;
48

47
	@UpdateWith
49
	@UpdateWith
48
	@From(PlatformUser.class)
50
	@From(PlatformUser.class)
49
	int updatePasswd(Connection con,String id,String email ,@Alias("passwd") String oldpw ,@Set String passwd)throws SQLException;
50
	
51
	int updatePasswd(Connection con, String id, String email, @Alias("passwd") String oldpw, @Set String passwd) throws SQLException;
52

51
	@UpdateWith
53
	@UpdateWith
52
	@From(PlatformUser.class)
54
	@From(PlatformUser.class)
53
	int updateMail(Connection con,String id,@Alias("email") String oldemail ,String passwd ,@Set String email)throws SQLException;
54
	
55
	
55
	int updateMail(Connection con, String id, @Alias("email") String oldemail, String passwd, @Set String email) throws SQLException;
56

56
	@Update
57
	@Update
57
	int update(Connection con,PlatformInfo pi)throws SQLException;
58
	
58
	int update(Connection con, PlatformInfo pi) throws SQLException;
59

60
	@Insert
61
	int insert(Connection con, PlatformOrg org) throws SQLException;
62

59
	@Insert
63
	@Insert
60
	int insert(Connection con,PlatformOrg org) throws SQLException;
64
	int insert(Connection con, ResidentOrg org) throws SQLException;
65

66
	@Insert
67
	int insert(Connection con, ButtedOrg org) throws SQLException;
68

69
	@Insert
70
	int insert(Connection con, ButtedProfessor professor) throws SQLException;
71

72
	@Insert
73
	int insert(Connection con, ReferencedArticle article) throws SQLException;
74

75
	@Delete
76
	int delete(Connection con, ResidentOrg org) throws SQLException;
77

78
	@Delete
79
	int delete(Connection con, ButtedOrg org) throws SQLException;
80

81
	@Delete
82
	int delete(Connection con, ButtedProfessor professor) throws SQLException;
83

84
	@Delete
85
	int delete(Connection con, ReferencedArticle article) throws SQLException;
86

87
	@SelectList
88
	List<ResidentOrg> queryResidentOrgs(Connection con, String pid) throws SQLException;
89

90
	@SelectList
91
	List<ButtedOrg> queryButtedOrgs(Connection con, String pid) throws SQLException;
92

93
	@SelectList
94
	List<ButtedProfessor> queryButtedProfessors(Connection con, String pid) throws SQLException;
95

96
	@SelectList
97
	List<ReferencedArticle> queryReferencedArticles(Connection con, String pid) throws SQLException;
98

99
	@SelectOne
100
	@Nullable
101
	ResidentOrg queryResidentOrg(Connection con, String pid, String oid) throws SQLException;
102

103
	@SelectOne
104
	@Nullable
105
	ButtedOrg queryButtedOrg(Connection con, String pid, String oid) throws SQLException;
106

107
	@SelectOne
108
	@Nullable
109
	ButtedProfessor queryButtedProfessor(Connection con, String pid, String uid) throws SQLException;
110

111
	@SelectOne
112
	@Nullable
113
	ReferencedArticle queryReferencedArticle(Connection con, String pid, String aid) throws SQLException;
114

115
	@DeleteWith
116
	@From(ResidentOrg.class)
117
	int deleteResidentOrg(Connection con, String pid, String oid) throws SQLException;
118

119
	@SelectOne
120
	@From(ButtedOrg.class)
121
	int deleteButtedOrg(Connection con, String pid, String oid) throws SQLException;
122

123
	@SelectOne
124
	@From(ButtedProfessor.class)
125
	int deleteButtedProfessor(Connection con, String pid, String uid) throws SQLException;
126

127
	@SelectOne
128
	@From(ReferencedArticle.class)
129
	int deleteReferencedArticle(Connection con, String pid, String aid) throws SQLException;
130

61
}
131
}

+ 39 - 0
src/main/java/com/ekexiu/portal/platform/PlatformInfo.java

5
import org.jfw.apt.orm.annotation.entry.Table;
5
import org.jfw.apt.orm.annotation.entry.Table;
6
import org.jfw.apt.orm.core.defaultImpl.FixLenStringHandler;
6
import org.jfw.apt.orm.core.defaultImpl.FixLenStringHandler;
7
import org.jfw.apt.orm.core.enums.DE;
7
import org.jfw.apt.orm.core.enums.DE;
8

9
/**
10
 * 平台信息表
11
 * @author Saga
12
 *
13
 */
8
@PrimaryKey("id")
14
@PrimaryKey("id")
9
@Table
15
@Table
10
public class PlatformInfo {
16
public class PlatformInfo {
11
	private String id;
17
	private String id;
18
	/**
19
	 * 平台名称
20
	 */
12
	private String name;
21
	private String name;
22
	/**
23
	 * 平台LOGO
24
	 */
13
	private String logo;
25
	private String logo;
26
	/**
27
	 * 联系人
28
	 */
14
	private String linkman;
29
	private String linkman;
30
	/**
31
	 *联系电话
32
	 */
15
	private String linkphone;
33
	private String linkphone;
34
	/**
35
	 * 联系邮箱
36
	 */
16
	private String linkeamil;
37
	private String linkeamil;
38
	/**
39
	 * 省
40
	 */
17
	private String province;
41
	private String province;
42
	/**
43
	 * 市
44
	 */
18
	private String city;
45
	private String city;
46
	/**
47
	 * 地址
48
	 */
19
	private String addr;
49
	private String addr;
50
	/**
51
	 * 主页
52
	 */
20
	private String url;
53
	private String url;
54
	/**
55
	 * 面向行业
56
	 */
21
	private String industry;
57
	private String industry;
58
	/**
59
	 * 平台介绍
60
	 */
22
	private String descp;
61
	private String descp;
23
	private String createTime;
62
	private String createTime;
24
	private String modifyTime;
63
	private String modifyTime;

+ 12 - 1
src/main/java/com/ekexiu/portal/platform/PlatformOrg.java

6
import org.jfw.apt.orm.core.enums.DE;
6
import org.jfw.apt.orm.core.enums.DE;
7

7

8
import com.ekexiu.portal.basepo.CreateTimeSupported;
8
import com.ekexiu.portal.basepo.CreateTimeSupported;
9

9
/**
10
 * 平台
11
 * @author Saga
12
 *
13
 */
10
@PrimaryKey("id")
14
@PrimaryKey("id")
11
@Table
15
@Table
12
public class PlatformOrg implements CreateTimeSupported {
16
public class PlatformOrg implements CreateTimeSupported {
17
	/**
18
	 * id
19
	 */
13
	private String id;
20
	private String id;
21
	/**
22
	 * 平台ID
23
	 */
14
	private String pid;
24
	private String pid;
25
	
15
	private String name;
26
	private String name;
16
	private String email;
27
	private String email;
17
	private String addr;
28
	private String addr;

+ 72 - 19
src/main/java/com/ekexiu/portal/platform/PlatformService.java

21
import org.jfw.apt.web.annotation.Path;
21
import org.jfw.apt.web.annotation.Path;
22
import org.jfw.apt.web.annotation.operate.Get;
22
import org.jfw.apt.web.annotation.operate.Get;
23
import org.jfw.apt.web.annotation.operate.Post;
23
import org.jfw.apt.web.annotation.operate.Post;
24
import org.jfw.apt.web.annotation.param.FieldParam;
24
import org.jfw.apt.web.annotation.param.JdbcConn;
25
import org.jfw.apt.web.annotation.param.JdbcConn;
25
import org.jfw.apt.web.annotation.param.RequestParam;
26
import org.jfw.apt.web.annotation.param.RequestParam;
26
import org.jfw.apt.web.annotation.param.Upload;
27
import org.jfw.apt.web.annotation.param.Upload;
45
	private String stateCodeWithRestPasswordWithEmail = "MAIL_REST_SC";
46
	private String stateCodeWithRestPasswordWithEmail = "MAIL_REST_SC";
46
	private String templateWithRestPasswordWithEmail = "";
47
	private String templateWithRestPasswordWithEmail = "";
47
	private String subjectWithRestPasswordWithEmail = "「科袖」平台账户密码找回";
48
	private String subjectWithRestPasswordWithEmail = "「科袖」平台账户密码找回";
48
	
49
	
49

50
	private long bindEmailTimeout = 60 * 10;
50
	private long bindEmailTimeout = 60 * 10;
51

51

52
	private String urlWithBindEmail = "MAIL_REST_URL";
52
	private String urlWithBindEmail = "MAIL_REST_URL";
153
			throw new JfwBaseException(-600002, "mail service error");
153
			throw new JfwBaseException(-600002, "mail service error");
154
		}
154
		}
155
	}
155
	}
156
	
157
	
158
	
159

156

160
	@Post
157
	@Post
161
	@Path("/restpw")
158
	@Path("/restpw")
171
			throw new JfwBaseException(-600002, "user too fresh");
168
			throw new JfwBaseException(-600002, "user too fresh");
172
		}
169
		}
173
	}
170
	}
174
	
171

175
	@Path("reqBindMail")
172
	@Path("reqBindMail")
176
	@Post
173
	@Post
177
	public void requestBindMail(@JdbcConn Connection con, String mail, String id,@Nullable String url) throws SQLException, JfwBaseException {
174
	public void requestBindMail(@JdbcConn Connection con, String mail, String id, @Nullable String url) throws SQLException, JfwBaseException {
178
		PlatformUser pu = this.platformDao.queryUser(con, mail);
175
		PlatformUser pu = this.platformDao.queryUser(con, mail);
179
		if (pu != null)
176
		if (pu != null)
180
			throw new JfwBaseException(-600001, "already bind");
177
			throw new JfwBaseException(-600001, "already bind");
181
		pu = this.platformDao.queryUserById(con, id);
178
		pu = this.platformDao.queryUserById(con, id);
182
		if (pu == null)
179
		if (pu == null)
183
			throw new JfwBaseException(-600002, "not exists user["+id+"]");
184
		
180
			throw new JfwBaseException(-600002, "not exists user[" + id + "]");
181

185
		StateCode<String, String> sc = new StateCode<String, String>();
182
		StateCode<String, String> sc = new StateCode<String, String>();
186
		sc.setCode(pu.getId());
183
		sc.setCode(pu.getId());
187
		sc.setKey(pu.getEmail());
184
		sc.setKey(pu.getEmail());
207
			throw new JfwBaseException(-600003, "mail service error");
204
			throw new JfwBaseException(-600003, "mail service error");
208
		}
205
		}
209
	}
206
	}
210
	
211
	
212
	
213

207

214
	@Post
208
	@Post
215
	@Path("/bindMail")
209
	@Path("/bindMail")
226
		}
220
		}
227
	}
221
	}
228

222

229
	
230
	@Post
223
	@Post
231
	@Path("/modifypw")
224
	@Path("/modifypw")
232
	public int modifypw(@JdbcConn(true) Connection con,String id,String opw,String npw) throws SQLException{
233
		return this.platformDao.updatePasswd(con, id,StringUtil.md5(opw),StringUtil.md5(npw));
225
	public int modifypw(@JdbcConn(true) Connection con, String id, String opw, String npw) throws SQLException {
226
		return this.platformDao.updatePasswd(con, id, StringUtil.md5(opw), StringUtil.md5(npw));
234
	}
227
	}
235
	
228

236
	@Post
229
	@Post
237
	@Path("/info")
230
	@Path("/info")
238
	public int updateInfo(@JdbcConn(true) Connection con, @RequestParam(excludeFields = { "createTime", "modifyTime" }) PlatformInfo pi) throws SQLException {
231
	public int updateInfo(@JdbcConn(true) Connection con, @RequestParam(excludeFields = { "createTime", "modifyTime" }) PlatformInfo pi) throws SQLException {
239
		return this.platformDao.update(con, pi);
232
		return this.platformDao.update(con, pi);
240
	}
233
	}
241
	
234

242
	@Get
235
	@Get
243
	@Path("/info")
236
	@Path("/info")
244
	public PlatformInfo info(@JdbcConn Connection con,String id) throws SQLException{
237
	public PlatformInfo info(@JdbcConn Connection con, String id) throws SQLException {
245
		return this.platformDao.queryInfo(con, id);
238
		return this.platformDao.queryInfo(con, id);
246
	}
239
	}
240

247
	@Post
241
	@Post
248
	@Path("/add/org")
242
	@Path("/add/org")
249
	public int addOrg(@JdbcConn(true) Connection con, @RequestParam(excludeFields = { "createTime", "id" }) PlatformOrg po)throws SQLException{
243
	public int addOrg(@JdbcConn(true) Connection con, @RequestParam(excludeFields = { "createTime", "id" }) PlatformOrg po) throws SQLException {
250
		po.setId(StringUtil.buildUUID());
244
		po.setId(StringUtil.buildUUID());
251
		return this.platformDao.insert(con, po);
245
		return this.platformDao.insert(con, po);
252
	}
246
	}
253

247

248
	@Post
249
	@Path("/resident")
250
	public int resident(@JdbcConn(true) Connection con, @RequestParam(fields = { @FieldParam(value = "pid", valueClass = String.class),
251
			@FieldParam(value = "oid", valueClass = String.class) }) ResidentOrg po) throws SQLException {
252
		return this.platformDao.insert(con, po);
253
	}
254
	@Post
255
	@Path("/buttedOrg")
256
	public int buttedOrg(@JdbcConn(true) Connection con, @RequestParam(fields = { @FieldParam(value = "pid", valueClass = String.class),
257
			@FieldParam(value = "oid", valueClass = String.class) }) ButtedOrg po) throws SQLException {
258
		return this.platformDao.insert(con, po);
259
	}
260
	@Post
261
	@Path("/buttedProfessor")
262
	public int buttedProfessor(@JdbcConn(true) Connection con, @RequestParam(fields = { @FieldParam(value = "pid", valueClass = String.class),
263
			@FieldParam(value = "uid", valueClass = String.class) }) ButtedProfessor po) throws SQLException {
264
		return this.platformDao.insert(con, po);
265
	}
266
	
267
	@Post
268
	@Path("/referencedArticle")
269
	public int referencedArticle(@JdbcConn(true) Connection con, @RequestParam(fields = { @FieldParam(value = "pid", valueClass = String.class),
270
			@FieldParam(value = "aid", valueClass = String.class) }) ReferencedArticle po) throws SQLException {
271
		return this.platformDao.insert(con, po);
272
	}
273
	
274
	
275
	
276
	
277
	
278
	
279
	
280
	
281
	@Post
282
	@Path("/resident/delete")
283
	public int residentDelete(@JdbcConn(true) Connection con, @RequestParam(fields = { @FieldParam(value = "pid", valueClass = String.class),
284
			@FieldParam(value = "oid", valueClass = String.class) }) ResidentOrg po) throws SQLException {
285
		return this.platformDao.delete(con, po);
286
	}
287
	@Post
288
	@Path("/buttedOrg/delete")
289
	public int buttedOrgDelete(@JdbcConn(true) Connection con, @RequestParam(fields = { @FieldParam(value = "pid", valueClass = String.class),
290
			@FieldParam(value = "oid", valueClass = String.class) }) ButtedOrg po) throws SQLException {
291
		return this.platformDao.delete(con, po);
292
	}
293
	@Post
294
	@Path("/buttedProfessor/delete")
295
	public int buttedProfessorDelete(@JdbcConn(true) Connection con, @RequestParam(fields = { @FieldParam(value = "pid", valueClass = String.class),
296
			@FieldParam(value = "uid", valueClass = String.class) }) ButtedProfessor po) throws SQLException {
297
		return this.platformDao.delete(con, po);
298
	}
299
	
300
	@Post
301
	@Path("/referencedArticle/delete")
302
	public int referencedArticleDelete(@JdbcConn(true) Connection con, @RequestParam(fields = { @FieldParam(value = "pid", valueClass = String.class),
303
			@FieldParam(value = "aid", valueClass = String.class) }) ReferencedArticle po) throws SQLException {
304
		return this.platformDao.delete(con, po);
305
	}
306

254
	@Post
307
	@Post
255
	@Path("/upload")
308
	@Path("/upload")
256
	public List<UploadFile> upload(@Upload UploadItemIterator it) throws Exception {
309
	public List<UploadFile> upload(@Upload UploadItemIterator it) throws Exception {

+ 1 - 1
src/main/java/com/ekexiu/portal/platform/ReferencedArticle.java

24
		return aid;
24
		return aid;
25
	}
25
	}
26
	public void setAid(String aid) {
26
	public void setAid(String aid) {
27
		this.aid = oid;
27
		this.aid = aid;
28
	}
28
	}
29
	public String getCreateTime() {
29
	public String getCreateTime() {
30
		return createTime;
30
		return createTime;