jiapeng vor 7 Jahren
Ursprung
Commit
cbc4cb55b3

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

@ -7,32 +7,50 @@ import org.jfw.apt.orm.core.enums.DE;
7 7

8 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 17
@Table
12 18
public class ButtedOrg implements CreateTimeSupported {
19
	/**
20
	 * 平台ID
21
	 */
13 22
	private String pid;
23
	/**
24
	 * 对接的合作机构ID(企业ID)
25
	 */
14 26
	private String oid;
27

15 28
	private String createTime;
16
	
29

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

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

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

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

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

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

38 56
}

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

@ -6,11 +6,22 @@ import org.jfw.apt.orm.annotation.entry.Table;
6 6
import org.jfw.apt.orm.core.enums.DE;
7 7

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

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

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

@ -8,6 +8,8 @@ import org.jfw.apt.annotation.Nullable;
8 8
import org.jfw.apt.orm.annotation.dao.DAO;
9 9
import org.jfw.apt.orm.annotation.dao.method.From;
10 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 13
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
12 14
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
13 15
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
@ -20,42 +22,110 @@ import org.jfw.apt.orm.annotation.dao.param.Set;
20 22
@DAO
21 23
public interface PlatformDao {
22 24

23
	
24 25
	@SelectOne
25 26
	@Nullable
26 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 30
	@Nullable
29 31
	@SelectOne
30
	PlatformInfo  queryInfo(Connection con,String id)throws SQLException;
31
	
32
	PlatformInfo queryInfo(Connection con, String id) throws SQLException;
33

32 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 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 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 45
	@UpdateWith
44 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 49
	@UpdateWith
48 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 53
	@UpdateWith
52 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 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 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,20 +5,59 @@ import org.jfw.apt.orm.annotation.entry.PrimaryKey;
5 5
import org.jfw.apt.orm.annotation.entry.Table;
6 6
import org.jfw.apt.orm.core.defaultImpl.FixLenStringHandler;
7 7
import org.jfw.apt.orm.core.enums.DE;
8

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

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

@ -6,12 +6,23 @@ import org.jfw.apt.orm.annotation.entry.Table;
6 6
import org.jfw.apt.orm.core.enums.DE;
7 7

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

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

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

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

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

52 52
	private String urlWithBindEmail = "MAIL_REST_URL";
@ -153,9 +153,6 @@ public class PlatformService {
153 153
			throw new JfwBaseException(-600002, "mail service error");
154 154
		}
155 155
	}
156
	
157
	
158
	
159 156

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

175 172
	@Path("reqBindMail")
176 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 175
		PlatformUser pu = this.platformDao.queryUser(con, mail);
179 176
		if (pu != null)
180 177
			throw new JfwBaseException(-600001, "already bind");
181 178
		pu = this.platformDao.queryUserById(con, id);
182 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 182
		StateCode<String, String> sc = new StateCode<String, String>();
186 183
		sc.setCode(pu.getId());
187 184
		sc.setKey(pu.getEmail());
@ -207,9 +204,6 @@ public class PlatformService {
207 204
			throw new JfwBaseException(-600003, "mail service error");
208 205
		}
209 206
	}
210
	
211
	
212
	
213 207

214 208
	@Post
215 209
	@Path("/bindMail")
@ -226,31 +220,90 @@ public class PlatformService {
226 220
		}
227 221
	}
228 222

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

242 235
	@Get
243 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 238
		return this.platformDao.queryInfo(con, id);
246 239
	}
240

247 241
	@Post
248 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 244
		po.setId(StringUtil.buildUUID());
251 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 307
	@Post
255 308
	@Path("/upload")
256 309
	public List<UploadFile> upload(@Upload UploadItemIterator it) throws Exception {

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

@ -24,7 +24,7 @@ public class ReferencedArticle {
24 24
		return aid;
25 25
	}
26 26
	public void setAid(String aid) {
27
		this.aid = oid;
27
		this.aid = aid;
28 28
	}
29 29
	public String getCreateTime() {
30 30
		return createTime;