jiapeng 8 years ago
parent
commit
4df298a5d3

+ 2 - 1
src/main/java/com/ekexiu/console/service/Upload.java

@ -128,6 +128,7 @@ public class Upload {
128 128
								}
129 129
							}
130 130
						}
131
						os.flush();
131 132
						ui.setSize(size);
132 133
						ui.setUri(uri);
133 134
						return ui;
@ -157,7 +158,7 @@ public class Upload {
157 158
			}
158 159
			lastPathWithCreate.set(p);
159 160
		}
160
		sb.append("/").append(Long.toBinaryString(System.nanoTime()));
161
		sb.append("/").append(Long.toHexString(System.nanoTime()));
161 162
		if (ext != null)
162 163
			sb.append(".").append(ext);
163 164
		return sb.toString();

+ 7 - 0
src/main/java/com/ekexiu/console/system/dao/UserDao.java

@ -5,6 +5,7 @@ import java.sql.SQLException;
5 5

6 6
import org.jfw.apt.annotation.Nullable;
7 7
import org.jfw.apt.orm.annotation.dao.DAO;
8
import org.jfw.apt.orm.annotation.dao.Dynamic;
8 9
import org.jfw.apt.orm.annotation.dao.method.From;
9 10
import org.jfw.apt.orm.annotation.dao.method.IncludeFixSet;
10 11
import org.jfw.apt.orm.annotation.dao.method.Or;
@ -40,8 +41,14 @@ public interface UserDao {
40 41
	User queryByLoginKey(Connection con, @Alias({ "mobile", "email" }) String key) throws SQLException;
41 42

42 43
	@Update
44
	@Dynamic
43 45
	int update(Connection con, User user) throws SQLException;
44 46

47
	@IncludeFixSet("modifyTime")
48
	@UpdateWith
49
	@From(User.class)
50
	int resetPassword(Connection con, String id, @Set String loginPassword) throws SQLException;
51

45 52
	@IncludeFixSet("modifyTime")
46 53
	@UpdateWith
47 54
	@From(User.class)

+ 16 - 9
src/main/java/com/ekexiu/console/system/service/UserService.java

@ -1,6 +1,5 @@
1 1
package com.ekexiu.console.system.service;
2 2

3
import java.io.File;
4 3
import java.io.IOException;
5 4
import java.sql.Connection;
6 5
import java.sql.SQLException;
@ -9,13 +8,16 @@ import java.util.ArrayList;
9 8
import org.jfw.apt.annotation.Autowrie;
10 9
import org.jfw.apt.annotation.DefaultValue;
11 10
import org.jfw.apt.annotation.Nullable;
11
import org.jfw.apt.web.annotation.LoginUser;
12 12
import org.jfw.apt.web.annotation.Path;
13 13
import org.jfw.apt.web.annotation.method.InvalidSession;
14 14
import org.jfw.apt.web.annotation.method.SetSession;
15 15
import org.jfw.apt.web.annotation.operate.Get;
16 16
import org.jfw.apt.web.annotation.operate.Post;
17
import org.jfw.apt.web.annotation.operate.Put;
17 18
import org.jfw.apt.web.annotation.param.FieldParam;
18 19
import org.jfw.apt.web.annotation.param.JdbcConn;
20
import org.jfw.apt.web.annotation.param.RequestBody;
19 21
import org.jfw.apt.web.annotation.param.RequestParam;
20 22
import org.jfw.util.PageQueryResult;
21 23
import org.jfw.util.StringUtil;
@ -34,20 +36,12 @@ import com.ekexiu.console.system.vo.ConsoleAuthUser;
34 36
public class UserService extends Upload {
35 37
	public static final String DEFAULT_AUTH_STR=AuthUtil.serialAuth(new int[]{0});
36 38
	public static final String DEFAULT_PW_STR=StringUtil.md5("12345678");
37
	private File headPath;
38 39

39 40
	@Autowrie
40 41
	private UserDao userDao;
41 42
	@Autowrie
42 43
	RoleDao roleDao;
43 44

44
	public File getHeadPath() {
45
		return headPath;
46
	}
47

48
	public void setHeadPath(File headPath) {
49
		this.headPath = headPath;
50
	}
51 45

52 46
	public RoleDao getRoleDao() {
53 47
		return roleDao;
@ -75,6 +69,8 @@ public class UserService extends Upload {
75 69
			cau.setHead(user.getHead());
76 70
			cau.setId(user.getId());
77 71
			cau.setName(user.getName());
72
			cau.setMobile(user.getMobile());
73
			cau.setEmail(user.getEmail());
78 74
			ArrayList<int[]> list = new ArrayList<int[]>(1);
79 75
			list.add(AuthUtil.deSerialAuth(user.getAuthinfo()));
80 76
			for (Role role : this.roleDao.queryByUser(con, user.getId())) {
@ -85,6 +81,11 @@ public class UserService extends Upload {
85 81
		}
86 82
		return null;
87 83
	}
84
	@Get
85
	@Path
86
	public ConsoleAuthUser get(@LoginUser ConsoleAuthUser user){
87
		return user;
88
	}
88 89

89 90
	@Get
90 91
	@Path("/logout")
@ -129,6 +130,12 @@ public class UserService extends Upload {
129 130
		user.setLoginPassword(DEFAULT_PW_STR);
130 131
		this.userDao.insert(con, user);
131 132
	}
133
	@Put
134
	@Path
135
	public void update(@JdbcConn(true) Connection con,@RequestBody User user)throws SQLException{
136
		this.userDao.update(con, user);
137
	}
138

132 139

133 140
	@Post
134 141
	@Path("/head")

+ 21 - 0
src/main/java/com/ekexiu/console/system/vo/ConsoleAuthUser.java

@ -10,6 +10,8 @@ public class ConsoleAuthUser implements AuthUser {
10 10
	private String id;
11 11
	private String name;
12 12
	private String head;
13
	private String mobile;
14
	private String email;
13 15
	
14 16
	private transient int[] auths;
15 17

@ -20,9 +22,28 @@ public class ConsoleAuthUser implements AuthUser {
20 22
		this.id = user.getId();
21 23
		this.name = user.getName();
22 24
		this.head = user.getHead();
25
		this.email = user.getEmail();
26
		this.mobile =user.getMobile();
23 27
		//this.auths = AuthUtil.deSerialAuth(user.getAuthinfo());
24 28
	}
25 29

30
	
31
	public String getMobile() {
32
		return mobile;
33
	}
34

35
	public void setMobile(String mobile) {
36
		this.mobile = mobile;
37
	}
38

39
	public String getEmail() {
40
		return email;
41
	}
42

43
	public void setEmail(String email) {
44
		this.email = email;
45
	}
46

26 47
	public String getId() {
27 48
		return id;
28 49
	}