Ver Código Fonte

Merge branch 'Next'

XMTT 7 anos atrás
pai
commit
facfc776f2
22 arquivos alterados com 903 adições e 31 exclusões
  1. 20 1
      src/main/java/com/ekexiu/console/system/dao/HonorDao.java
  2. 25 0
      src/main/java/com/ekexiu/console/system/dao/OrgKeyWordDao.java
  3. 20 1
      src/main/java/com/ekexiu/console/system/dao/PartTimeJobDao.java
  4. 27 0
      src/main/java/com/ekexiu/console/system/dao/ProKeyWordDao.java
  5. 5 1
      src/main/java/com/ekexiu/console/system/dao/ProfessorDao.java
  6. 20 1
      src/main/java/com/ekexiu/console/system/dao/ProfessorEduBgDao.java
  7. 21 2
      src/main/java/com/ekexiu/console/system/dao/ProjectDao.java
  8. 23 0
      src/main/java/com/ekexiu/console/system/dao/ResearchAreaDao.java
  9. 25 0
      src/main/java/com/ekexiu/console/system/dao/ResearchAreaLogDao.java
  10. 33 0
      src/main/java/com/ekexiu/console/system/po/OrgKeyWord.java
  11. 34 0
      src/main/java/com/ekexiu/console/system/po/ProKeyWord.java
  12. 23 3
      src/main/java/com/ekexiu/console/system/po/Professor.java
  13. 55 0
      src/main/java/com/ekexiu/console/system/po/ResearchAreaLog.java
  14. 68 0
      src/main/java/com/ekexiu/console/system/service/HonorService.java
  15. 90 0
      src/main/java/com/ekexiu/console/system/service/KeyWordService.java
  16. 23 0
      src/main/java/com/ekexiu/console/system/service/OrgService.java
  17. 67 0
      src/main/java/com/ekexiu/console/system/service/PartTimeJobService.java
  18. 67 0
      src/main/java/com/ekexiu/console/system/service/ProfessorEduBgService.java
  19. 87 22
      src/main/java/com/ekexiu/console/system/service/ProfessorService.java
  20. 69 0
      src/main/java/com/ekexiu/console/system/service/ProjectService.java
  21. 88 0
      src/main/java/com/ekexiu/console/system/service/ResearchAreaService.java
  22. 13 0
      src/main/java/com/ekexiu/console/system/service/UserInfoService.java

+ 20 - 1
src/main/java/com/ekexiu/console/system/dao/HonorDao.java

@ -1,11 +1,15 @@
1 1
package com.ekexiu.console.system.dao;
2 2
3 3
import com.ekexiu.console.system.po.Honor;
4
import org.jfw.apt.annotation.Nullable;
4 5
import org.jfw.apt.orm.annotation.dao.DAO;
5
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
6
import org.jfw.apt.orm.annotation.dao.method.From;
7
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
8
import org.jfw.apt.orm.annotation.dao.method.operator.*;
6 9
7 10
import java.sql.Connection;
8 11
import java.sql.SQLException;
12
import java.util.List;
9 13
10 14
/**
11 15
 * Created by TT on 2017/7/14.
@ -14,4 +18,19 @@ import java.sql.SQLException;
14 18
public interface HonorDao {
15 19
    @Insert
16 20
    int insert(Connection con, Honor honor) throws SQLException;
21
22
    @Update
23
    int update(Connection con, Honor honor) throws SQLException;
24
25
    @SelectList
26
    @OrderBy(" ORDER BY YEAR DESC ")
27
    List<Honor> query(Connection con, String professorId) throws SQLException;
28
29
    @Nullable
30
    @SelectOne
31
    Honor queryOne(Connection con, String id) throws SQLException;
32
33
    @DeleteWith
34
    @From(Honor.class)
35
    int delete(Connection con, String id) throws SQLException;
17 36
}

+ 25 - 0
src/main/java/com/ekexiu/console/system/dao/OrgKeyWordDao.java

@ -0,0 +1,25 @@
1
package com.ekexiu.console.system.dao;
2
3
import com.ekexiu.console.system.po.OrgKeyWord;
4
import org.jfw.apt.orm.annotation.dao.Batch;
5
import org.jfw.apt.orm.annotation.dao.DAO;
6
import org.jfw.apt.orm.annotation.dao.method.From;
7
import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
8
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
9
10
import java.sql.Connection;
11
import java.sql.SQLException;
12
13
/**
14
 * Created by TT on 2017/8/10.
15
 */
16
@DAO
17
public interface OrgKeyWordDao {
18
    @Insert
19
    @Batch
20
    int[] insert(Connection con, OrgKeyWord[] okws)throws SQLException;
21
22
    @DeleteWith
23
    @From(OrgKeyWord.class)
24
    int delete(Connection con,String id)throws SQLException;
25
}

+ 20 - 1
src/main/java/com/ekexiu/console/system/dao/PartTimeJobDao.java

@ -1,11 +1,15 @@
1 1
package com.ekexiu.console.system.dao;
2 2
3 3
import com.ekexiu.console.system.po.PartTimeJob;
4
import org.jfw.apt.annotation.Nullable;
4 5
import org.jfw.apt.orm.annotation.dao.DAO;
5
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
6
import org.jfw.apt.orm.annotation.dao.method.From;
7
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
8
import org.jfw.apt.orm.annotation.dao.method.operator.*;
6 9
7 10
import java.sql.Connection;
8 11
import java.sql.SQLException;
12
import java.util.List;
9 13
10 14
/**
11 15
 * Created by TT on 2017/7/14.
@ -14,4 +18,19 @@ import java.sql.SQLException;
14 18
public interface PartTimeJobDao {
15 19
    @Insert
16 20
    int insert(Connection con, PartTimeJob job) throws SQLException;
21
22
    @Update
23
    int update(Connection con, PartTimeJob job) throws SQLException;
24
25
    @SelectList
26
    @OrderBy(" ORDER BY STOP_MONTH DESC ")
27
    List<PartTimeJob> query(Connection con, String professorId) throws SQLException;
28
29
    @Nullable
30
    @SelectOne
31
    PartTimeJob queryOne(Connection con, String id) throws SQLException;
32
33
    @DeleteWith
34
    @From(PartTimeJob.class)
35
    int delete(Connection con, String id) throws SQLException;
17 36
}

+ 27 - 0
src/main/java/com/ekexiu/console/system/dao/ProKeyWordDao.java

@ -0,0 +1,27 @@
1
package com.ekexiu.console.system.dao;
2
3
import com.ekexiu.console.system.po.ProKeyWord;
4
import org.jfw.apt.orm.annotation.dao.Batch;
5
import org.jfw.apt.orm.annotation.dao.DAO;
6
import org.jfw.apt.orm.annotation.dao.method.From;
7
import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
8
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
9
10
import java.sql.Connection;
11
import java.sql.SQLException;
12
13
/**
14
 * Created by TT on 2017/8/10.
15
 */
16
@DAO
17
public interface ProKeyWordDao {
18
19
    @Insert
20
    @Batch
21
    int[] insert(Connection con, ProKeyWord[] pkw) throws SQLException;
22
23
    @DeleteWith
24
    @From(ProKeyWord.class)
25
    int delete(Connection con, String id) throws SQLException;
26
27
}

+ 5 - 1
src/main/java/com/ekexiu/console/system/dao/ProfessorDao.java

@ -83,9 +83,13 @@ public interface ProfessorDao {
83 83
84 84
    @PageQuery
85 85
    @OrderBy("ORDER BY create_time DESC NULLS LAST")
86
    PageQueryResult<UserDetail> pageQueryUserDetail(Connection con, @Nullable @Like String name,@Nullable @Alias("createTime") @GtEq String bt, @Nullable @Alias("createTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
86
    PageQueryResult<UserDetail> pageQueryUserDetail(Connection con, @Nullable @Like String name,@Nullable String activeStatus,@Nullable Integer sendMailStatus,@Nullable @Alias("createTime") @GtEq String bt, @Nullable @Alias("createTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
87 87
88 88
    @UpdateWith
89 89
    @From(Professor.class)
90 90
    int updateBusinessData(Connection con,String id,@Set int authentication,@Set int authStatus,@Set int authStatusExpert ,@Set int sortFirst)throws SQLException;
91
92
    @Nullable
93
    @QueryOne
94
    UserDetail queryDetail(Connection con, String id)throws SQLException;
91 95
}

+ 20 - 1
src/main/java/com/ekexiu/console/system/dao/ProfessorEduBgDao.java

@ -1,11 +1,15 @@
1 1
package com.ekexiu.console.system.dao;
2 2
3 3
import com.ekexiu.console.system.po.ProfessorEduBg;
4
import org.jfw.apt.annotation.Nullable;
4 5
import org.jfw.apt.orm.annotation.dao.DAO;
5
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
6
import org.jfw.apt.orm.annotation.dao.method.From;
7
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
8
import org.jfw.apt.orm.annotation.dao.method.operator.*;
6 9
7 10
import java.sql.Connection;
8 11
import java.sql.SQLException;
12
import java.util.List;
9 13
10 14
/**
11 15
 * Created by TT on 2017/7/14.
@ -14,4 +18,19 @@ import java.sql.SQLException;
14 18
public interface ProfessorEduBgDao {
15 19
    @Insert
16 20
    int insert(Connection con, ProfessorEduBg edu) throws SQLException;
21
22
    @Update
23
    int update(Connection con, ProfessorEduBg edu) throws SQLException;
24
25
    @SelectList
26
    @OrderBy(" ORDER BY YEAR DESC ")
27
    List<ProfessorEduBg> query(Connection con, String professorId) throws SQLException;
28
29
    @Nullable
30
    @SelectOne
31
    ProfessorEduBg queryOne(Connection con, String id) throws SQLException;
32
33
    @DeleteWith
34
    @From(ProfessorEduBg.class)
35
    int delete(Connection con, String id) throws SQLException;
17 36
}

+ 21 - 2
src/main/java/com/ekexiu/console/system/dao/ProjectDao.java

@ -1,11 +1,15 @@
1 1
package com.ekexiu.console.system.dao;
2 2
3 3
import com.ekexiu.console.system.po.Project;
4
import org.jfw.apt.annotation.Nullable;
4 5
import org.jfw.apt.orm.annotation.dao.DAO;
5
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
6
import org.jfw.apt.orm.annotation.dao.method.From;
7
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
8
import org.jfw.apt.orm.annotation.dao.method.operator.*;
6 9
7 10
import java.sql.Connection;
8 11
import java.sql.SQLException;
12
import java.util.List;
9 13
10 14
/**
11 15
 * Created by TT on 2017/7/13.
@ -13,5 +17,20 @@ import java.sql.SQLException;
13 17
@DAO
14 18
public interface ProjectDao {
15 19
    @Insert
16
    int insert(Connection con, Project project)throws SQLException;
20
    int insert(Connection con, Project project) throws SQLException;
21
22
    @Update
23
    int update(Connection con, Project project) throws SQLException;
24
25
    @SelectList
26
    @OrderBy(" ORDER BY STOP_MONTH DESC ")
27
    List<Project> query(Connection con, String professorId) throws SQLException;
28
29
    @Nullable
30
    @SelectOne
31
    Project queryOne(Connection con, String id) throws SQLException;
32
33
    @DeleteWith
34
    @From(Project.class)
35
    int delete(Connection con, String id) throws SQLException;
17 36
}

+ 23 - 0
src/main/java/com/ekexiu/console/system/dao/ResearchAreaDao.java

@ -2,10 +2,17 @@ package com.ekexiu.console.system.dao;
2 2
3 3
import com.ekexiu.console.system.po.ResearchArea;
4 4
import org.jfw.apt.orm.annotation.dao.DAO;
5
import org.jfw.apt.orm.annotation.dao.method.From;
6
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
7
import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
5 8
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
9
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
10
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
11
import org.jfw.apt.orm.annotation.dao.param.Set;
6 12
7 13
import java.sql.Connection;
8 14
import java.sql.SQLException;
15
import java.util.List;
9 16
10 17
/**
11 18
 * Created by TT on 2017/7/13.
@ -14,4 +21,20 @@ import java.sql.SQLException;
14 21
public interface ResearchAreaDao {
15 22
    @Insert
16 23
    int insert(Connection con, ResearchArea area) throws SQLException;
24
25
    @OrderBy("ORDER BY COUNT DESC,SORT_NUM ASC")
26
    @SelectList
27
    List<ResearchArea> query(Connection con, String professorId) throws SQLException;
28
29
    @DeleteWith
30
    @From(ResearchArea.class)
31
    int delete(Connection con, String professorId) throws SQLException;
32
33
    @DeleteWith
34
    @From(ResearchArea.class)
35
    int delete(Connection con, String professorId, String caption) throws SQLException;
36
37
    @UpdateWith
38
    @From(ResearchArea.class)
39
    int updateDescp(Connection con, String professorId, String caption, @Set String descp, @Set int sortNum) throws SQLException;
17 40
}

+ 25 - 0
src/main/java/com/ekexiu/console/system/dao/ResearchAreaLogDao.java

@ -0,0 +1,25 @@
1
package com.ekexiu.console.system.dao;
2
3
import com.ekexiu.console.system.po.ResearchAreaLog;
4
import org.jfw.apt.orm.annotation.dao.DAO;
5
import org.jfw.apt.orm.annotation.dao.method.From;
6
import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
7
8
import java.sql.Connection;
9
import java.sql.SQLException;
10
11
/**
12
 * Created by TT on 2017/8/17.
13
 */
14
@DAO
15
public abstract class ResearchAreaLogDao {
16
17
    @DeleteWith
18
    @From(ResearchAreaLog.class)
19
    public abstract int delete(Connection con, String professorId) throws SQLException;
20
21
    @DeleteWith
22
    @From(ResearchAreaLog.class)
23
    public abstract int delete(Connection con, String professorId, String caption) throws SQLException;
24
25
}

+ 33 - 0
src/main/java/com/ekexiu/console/system/po/OrgKeyWord.java

@ -0,0 +1,33 @@
1
package com.ekexiu.console.system.po;
2
3
import org.jfw.apt.orm.annotation.entry.Column;
4
import org.jfw.apt.orm.annotation.entry.Table;
5
import org.jfw.apt.orm.core.enums.DE;
6
7
/**
8
 * Created by TT on 2017/8/10.
9
 */
10
@Table
11
public class OrgKeyWord {
12
13
    private String id;
14
    private String kw;
15
16
    @Column(DE.id_32)
17
    public String getId() {
18
        return id;
19
    }
20
21
    public void setId(String id) {
22
        this.id = id;
23
    }
24
25
    @Column(DE.text_de)
26
    public String getKw() {
27
        return kw;
28
    }
29
30
    public void setKw(String kw) {
31
        this.kw = kw;
32
    }
33
}

+ 34 - 0
src/main/java/com/ekexiu/console/system/po/ProKeyWord.java

@ -0,0 +1,34 @@
1
package com.ekexiu.console.system.po;
2
3
import org.jfw.apt.orm.annotation.entry.Column;
4
import org.jfw.apt.orm.annotation.entry.Table;
5
import org.jfw.apt.orm.core.enums.DE;
6
7
/**
8
 * Created by TT on 2017/8/10.
9
 */
10
@Table
11
public class ProKeyWord {
12
13
    private String id;
14
    private String kw;
15
16
    @Column(DE.id_32)
17
    public String getId() {
18
        return id;
19
    }
20
21
    public void setId(String id) {
22
        this.id = id;
23
    }
24
25
    @Column(DE.text_de)
26
    public String getKw() {
27
        return kw;
28
    }
29
30
    public void setKw(String kw) {
31
        this.kw = kw;
32
    }
33
34
}

+ 23 - 3
src/main/java/com/ekexiu/console/system/po/Professor.java

@ -12,6 +12,7 @@ import org.jfw.apt.orm.core.defaultImpl.WIntHandler;
12 12
import org.jfw.apt.orm.core.enums.DE;
13 13
14 14
import java.math.BigDecimal;
15
import java.util.List;
15 16
16 17
/**
17 18
 * Created by TT on 2017/4/6.
@ -55,6 +56,9 @@ public class Professor implements CreateTimeSupported,ModifyTimeSupported {
55 56
    private String cuserId;
56 57
    private Integer professorState;
57 58
    private Integer sortFirst;
59
    private long pageViews;
60
61
    private List<ResearchArea> researchAreas;
58 62
    
59 63
    @Column(handlerClass=FixLenStringHandler.class,dbType="CHAR(1)",renewable=false)
60 64
@ -102,7 +106,7 @@ public class Professor implements CreateTimeSupported,ModifyTimeSupported {
102 106
        this.office = office;
103 107
    }
104 108
105
    @Column(handlerClass=StringHandler.class,dbType="TEXT",insertable=true,nullable=true,renewable=false,queryable=true)
109
    @Column(handlerClass=StringHandler.class,dbType="TEXT",insertable=true,nullable=true,renewable=true,queryable=true)
106 110
    public String getSubject() {
107 111
        return subject;
108 112
    }
@ -110,7 +114,7 @@ public class Professor implements CreateTimeSupported,ModifyTimeSupported {
110 114
    public void setSubject(String subject) {
111 115
        this.subject = subject;
112 116
    }
113
    @Column(handlerClass=StringHandler.class,dbType="TEXT",insertable=true,nullable=true,renewable=false,queryable=true)
117
    @Column(handlerClass=StringHandler.class,dbType="TEXT",insertable=true,nullable=true,renewable=true,queryable=true)
114 118
    public String getIndustry() {
115 119
        return industry;
116 120
    }
@ -201,7 +205,7 @@ public class Professor implements CreateTimeSupported,ModifyTimeSupported {
201 205
    public void setName(String name) {
202 206
        this.name = name;
203 207
    }
204
    @Column(handlerClass=StringHandler.class,dbType="TEXT",insertable=true,nullable=true,renewable=false,queryable=true)
208
    @Column(handlerClass=StringHandler.class,dbType="TEXT",insertable=true,nullable=true,renewable=true,queryable=true)
205 209
    public String getDescp() {
206 210
        return descp;
207 211
    }
@ -316,5 +320,21 @@ public class Professor implements CreateTimeSupported,ModifyTimeSupported {
316 320
        this.sortFirst = sortFirst;
317 321
    }
318 322
323
    @Column(DE.bigSerial)
324
    public long getPageViews() {
325
        return pageViews;
326
    }
327
328
    public void setPageViews(long pageViews) {
329
        this.pageViews = pageViews;
330
    }
331
332
    public List<ResearchArea> getResearchAreas() {
333
        return researchAreas;
334
    }
335
336
    public void setResearchAreas(List<ResearchArea> researchAreas) {
337
        this.researchAreas = researchAreas;
338
    }
319 339
}
320 340

+ 55 - 0
src/main/java/com/ekexiu/console/system/po/ResearchAreaLog.java

@ -0,0 +1,55 @@
1
package com.ekexiu.console.system.po;
2
3
import org.jfw.apt.orm.annotation.entry.Column;
4
import org.jfw.apt.orm.annotation.entry.Table;
5
import org.jfw.apt.orm.core.defaultImpl.FixLenStringHandler;
6
import org.jfw.apt.orm.core.enums.DE;
7
8
/**
9
 * Created by TT on 2017/8/17.
10
 */
11
@Table
12
public class ResearchAreaLog {
13
    private String professorId;
14
    private String caption;
15
    private String opreteProfessorId;
16
    private String createTime;
17
18
    @Column(DE.id_32)
19
    public String getOpreteProfessorId() {
20
        return opreteProfessorId;
21
    }
22
23
    public void setOpreteProfessorId(String opreteProfessorId) {
24
        this.opreteProfessorId = opreteProfessorId;
25
    }
26
27
    @Column(handlerClass = FixLenStringHandler.class, dbType = "CHAR(14)", fixSqlValueWithInsert = "TO_CHAR(NOW(),'YYYYMMDDHH24MISS')", insertable = true, nullable = false, queryable = true, renewable = false)
28
    public String getCreateTime() {
29
        return createTime;
30
    }
31
32
    public void setCreateTime(String createTime) {
33
        this.createTime = createTime;
34
    }
35
36
    @Column(DE.id_32)
37
    public String getProfessorId() {
38
        return professorId;
39
    }
40
41
    public void setProfessorId(String orgId) {
42
        this.professorId = orgId;
43
    }
44
45
    @Column(DE.string_de)
46
    public String getCaption() {
47
        return caption;
48
    }
49
50
    public void setCaption(String catpion) {
51
        this.caption = catpion;
52
    }
53
54
55
}

+ 68 - 0
src/main/java/com/ekexiu/console/system/service/HonorService.java

@ -0,0 +1,68 @@
1
package com.ekexiu.console.system.service;
2
3
import com.ekexiu.console.system.dao.HonorDao;
4
import com.ekexiu.console.system.po.Honor;
5
import org.jfw.apt.annotation.Autowrie;
6
import org.jfw.apt.web.annotation.Path;
7
import org.jfw.apt.web.annotation.operate.Delete;
8
import org.jfw.apt.web.annotation.operate.Get;
9
import org.jfw.apt.web.annotation.operate.Post;
10
import org.jfw.apt.web.annotation.operate.Put;
11
import org.jfw.apt.web.annotation.param.JdbcConn;
12
import org.jfw.apt.web.annotation.param.PathVar;
13
import org.jfw.apt.web.annotation.param.RequestBody;
14
import org.jfw.util.StringUtil;
15
16
import java.sql.Connection;
17
import java.sql.SQLException;
18
import java.util.List;
19
20
/**
21
 * Created by TT on 2017/8/14.
22
 */
23
@Path("/honor")
24
public class HonorService {
25
    @Autowrie
26
    private HonorDao honorDao;
27
28
    public HonorDao getHonorDao() {
29
        return honorDao;
30
    }
31
32
    public void setHonorDao(HonorDao honorDao) {
33
        this.honorDao = honorDao;
34
    }
35
36
    @Get
37
    @Path("/{id}")
38
    public Honor query(@JdbcConn Connection con, @PathVar String id) throws SQLException
39
    {
40
        return this.honorDao.queryOne(con, id);
41
    }
42
    @Post
43
    @Path
44
    public void insert(@JdbcConn(true) Connection con, Honor honor) throws SQLException {
45
        String id = StringUtil.buildUUID();
46
        honor.setId(id);
47
        this.honorDao.insert(con, honor);
48
    }
49
50
    @Put
51
    @Path
52
    public void update(@JdbcConn(true) Connection con, @RequestBody Honor honor) throws SQLException {
53
        this.honorDao.update(con, honor);
54
    }
55
56
    @Get
57
    @Path("/professor")
58
    public List<Honor> queryByProfessor(@JdbcConn Connection con, String professorId) throws SQLException {
59
        return this.honorDao.query(con, professorId);
60
    }
61
62
    @Delete
63
    @Path("/{id}")
64
    public void delete(@JdbcConn(true) Connection con, @PathVar String id) throws SQLException {
65
        this.honorDao.delete(con, id);
66
    }
67
68
}

+ 90 - 0
src/main/java/com/ekexiu/console/system/service/KeyWordService.java

@ -0,0 +1,90 @@
1
package com.ekexiu.console.system.service;
2
3
import com.ekexiu.console.system.dao.OrgKeyWordDao;
4
import com.ekexiu.console.system.dao.ProKeyWordDao;
5
import com.ekexiu.console.system.po.OrgKeyWord;
6
import com.ekexiu.console.system.po.ProKeyWord;
7
import org.jfw.apt.annotation.Autowrie;
8
import org.jfw.apt.annotation.Bean;
9
10
import java.sql.Connection;
11
import java.sql.SQLException;
12
import java.util.Collections;
13
import java.util.HashSet;
14
15
/**
16
 * Created by TT on 2017/8/10.
17
 */
18
@Bean
19
public class KeyWordService {
20
21
    @Autowrie
22
    private ProKeyWordDao proKeyWordDao;
23
    @Autowrie
24
    private OrgKeyWordDao orgKeyWordDao;
25
26
    public ProKeyWordDao getProKeyWordDao() {
27
        return proKeyWordDao;
28
    }
29
30
    public void setProKeyWordDao(ProKeyWordDao proKeyWordDao) {
31
        this.proKeyWordDao = proKeyWordDao;
32
    }
33
34
    public OrgKeyWordDao getOrgKeyWordDao() {
35
        return orgKeyWordDao;
36
    }
37
38
    public void setOrgKeyWordDao(OrgKeyWordDao orgKeyWordDao) {
39
        this.orgKeyWordDao = orgKeyWordDao;
40
    }
41
42
    public void refreshProfessor(Connection con, String id, String[] kws) throws SQLException {
43
        proKeyWordDao.delete(con, id);
44
        if (kws != null && kws.length > 0) {
45
            ProKeyWord[] okws = new ProKeyWord[kws.length];
46
            for (int i = 0; i < kws.length; ++i) {
47
                ProKeyWord okw = new ProKeyWord();
48
                okw.setId(id);
49
                okw.setKw(kws[i]);
50
                okws[i] = okw;
51
            }
52
            proKeyWordDao.insert(con, okws);
53
        }
54
    }
55
56
    public void refreshOrg(Connection con, String id, String[] kws) throws SQLException {
57
        orgKeyWordDao.delete(con, id);
58
        if (kws != null && kws.length > 0) {
59
            OrgKeyWord[] okws = new OrgKeyWord[kws.length];
60
            for (int i = 0; i < kws.length; ++i) {
61
                OrgKeyWord okw = new OrgKeyWord();
62
                okw.setId(id);
63
                okw.setKw(kws[i]);
64
                okws[i] = okw;
65
            }
66
            orgKeyWordDao.insert(con, okws);
67
        }
68
    }
69
70
    public static String[] splitKeyWord(String kws) {
71
        if (kws == null || kws.trim().length() == 0) return null;
72
        kws = kws.trim();
73
        String[] s = kws.split(",");
74
        HashSet<String> result = new HashSet<String>();
75
        Collections.addAll(result, s);
76
        result.remove("");
77
78
        return result.isEmpty() ? null : result.toArray(new String[result.size()]);
79
80
    }
81
82
    public static void main(String[] args) {
83
        String s = ",asd,asd,dsa,dsa,we,we,xmtt,ttmx ,ttmx,";
84
        String[] s1 = splitKeyWord(s);
85
        for (String aS1 : s1) {
86
            System.out.println(aS1);
87
        }
88
    }
89
90
}

+ 23 - 0
src/main/java/com/ekexiu/console/system/service/OrgService.java

@ -67,6 +67,8 @@ public class OrgService extends com.ekexiu.console.service.Upload {
67 67
    private OrgUserDao orgUserDao;
68 68
    @Autowrie
69 69
    private OrgRecordDao orgRecordDao;
70
    @Autowrie
71
    private KeyWordService keyWordService;
70 72

71 73
    public OrgRecordDao getOrgRecordDao() {
72 74
        return orgRecordDao;
@ -157,6 +159,14 @@ public class OrgService extends com.ekexiu.console.service.Upload {
157 159
        this.orgDao = orgDao;
158 160
    }
159 161

162
    public KeyWordService getKeyWordService() {
163
        return keyWordService;
164
    }
165

166
    public void setKeyWordService(KeyWordService keyWordService) {
167
        this.keyWordService = keyWordService;
168
    }
169

160 170
    public int getLargeHeadPhotoWidth() {
161 171
        return largeHeadPhotoWidth;
162 172
    }
@ -408,6 +418,19 @@ public class OrgService extends com.ekexiu.console.service.Upload {
408 418
        }else {
409 419
            this.orgRecordDao.updateModifier(con, orgn.getId(), user.getId(),DateUtil.formatDateTime(System.currentTimeMillis()));
410 420
        }
421

422
        Organization no = this.orgDao.query(con, orgn.getId());
423
        if(no!=null && "1".equals(no.getIsJoin())){
424
            String s = no.getSubject();
425
            String in = no.getIndustry();
426
            String kw = s==null?"":s.trim();
427
            kw = kw + (in==null?"":(","+in.trim()));
428
            this.keyWordService.refreshOrg(con,orgn.getId(),KeyWordService.splitKeyWord(kw));
429
        }else{
430
            this.keyWordService.refreshOrg(con,orgn.getId(),null);
431
        }
432

433

411 434
    }
412 435

413 436
    @Post

+ 67 - 0
src/main/java/com/ekexiu/console/system/service/PartTimeJobService.java

@ -0,0 +1,67 @@
1
package com.ekexiu.console.system.service;
2
3
import com.ekexiu.console.system.dao.PartTimeJobDao;
4
import com.ekexiu.console.system.po.PartTimeJob;
5
import org.jfw.apt.annotation.Autowrie;
6
import org.jfw.apt.web.annotation.Path;
7
import org.jfw.apt.web.annotation.operate.Delete;
8
import org.jfw.apt.web.annotation.operate.Get;
9
import org.jfw.apt.web.annotation.operate.Post;
10
import org.jfw.apt.web.annotation.operate.Put;
11
import org.jfw.apt.web.annotation.param.JdbcConn;
12
import org.jfw.apt.web.annotation.param.PathVar;
13
import org.jfw.apt.web.annotation.param.RequestBody;
14
import org.jfw.util.StringUtil;
15
16
import java.sql.Connection;
17
import java.sql.SQLException;
18
import java.util.List;
19
20
/**
21
 * Created by TT on 2017/8/14.
22
 */
23
@Path("/job")
24
public class PartTimeJobService {
25
    @Autowrie
26
    private PartTimeJobDao partTimeJobDao;
27
28
    public PartTimeJobDao getPartTimeJobDao() {
29
        return partTimeJobDao;
30
    }
31
32
    public void setPartTimeJobDao(PartTimeJobDao jobDao) {
33
        this.partTimeJobDao = jobDao;
34
    }
35
36
    @Get
37
    @Path("/{id}")
38
    public PartTimeJob query(@JdbcConn Connection con, @PathVar String id) throws SQLException
39
    {
40
        return this.partTimeJobDao.queryOne(con, id);
41
    }
42
    @Post
43
    @Path
44
    public void insert(@JdbcConn(true) Connection con, PartTimeJob honor) throws SQLException {
45
        String id = StringUtil.buildUUID();
46
        honor.setId(id);
47
        this.partTimeJobDao.insert(con, honor);
48
    }
49
50
    @Put
51
    @Path
52
    public void update(@JdbcConn(true) Connection con, @RequestBody PartTimeJob honor) throws SQLException {
53
        this.partTimeJobDao.update(con, honor);
54
    }
55
56
    @Get
57
    @Path("/professor")
58
    public List<PartTimeJob> queryByProfessor(@JdbcConn Connection con, String professorId) throws SQLException {
59
        return this.partTimeJobDao.query(con, professorId);
60
    }
61
62
    @Delete
63
    @Path("/{id}")
64
    public void delete(@JdbcConn(true) Connection con, @PathVar String id) throws SQLException {
65
        this.partTimeJobDao.delete(con, id);
66
    }
67
}

+ 67 - 0
src/main/java/com/ekexiu/console/system/service/ProfessorEduBgService.java

@ -0,0 +1,67 @@
1
package com.ekexiu.console.system.service;
2
3
import com.ekexiu.console.system.dao.ProfessorEduBgDao;
4
import com.ekexiu.console.system.po.ProfessorEduBg;
5
import org.jfw.apt.annotation.Autowrie;
6
import org.jfw.apt.web.annotation.Path;
7
import org.jfw.apt.web.annotation.operate.Delete;
8
import org.jfw.apt.web.annotation.operate.Get;
9
import org.jfw.apt.web.annotation.operate.Post;
10
import org.jfw.apt.web.annotation.operate.Put;
11
import org.jfw.apt.web.annotation.param.JdbcConn;
12
import org.jfw.apt.web.annotation.param.PathVar;
13
import org.jfw.apt.web.annotation.param.RequestBody;
14
import org.jfw.util.StringUtil;
15
16
import java.sql.Connection;
17
import java.sql.SQLException;
18
import java.util.List;
19
20
/**
21
 * Created by TT on 2017/8/14.
22
 */
23
@Path("/edu")
24
public class ProfessorEduBgService {
25
    @Autowrie
26
    private ProfessorEduBgDao professorEduBgDao;
27
28
    public ProfessorEduBgDao getProfessorEduBgDao() {
29
        return professorEduBgDao;
30
    }
31
32
    public void setProfessorEduBgDao(ProfessorEduBgDao professorEduBgDao) {
33
        this.professorEduBgDao = professorEduBgDao;
34
    }
35
36
    @Get
37
    @Path("/{id}")
38
    public ProfessorEduBg query(@JdbcConn Connection con, @PathVar String id) throws SQLException
39
    {
40
        return this.professorEduBgDao.queryOne(con, id);
41
    }
42
    @Post
43
    @Path
44
    public void insert(@JdbcConn(true) Connection con, ProfessorEduBg honor) throws SQLException {
45
        String id = StringUtil.buildUUID();
46
        honor.setId(id);
47
        this.professorEduBgDao.insert(con, honor);
48
    }
49
50
    @Put
51
    @Path
52
    public void update(@JdbcConn(true) Connection con, @RequestBody ProfessorEduBg honor) throws SQLException {
53
        this.professorEduBgDao.update(con, honor);
54
    }
55
56
    @Get
57
    @Path("/professor")
58
    public List<ProfessorEduBg> queryByProfessor(@JdbcConn Connection con, String professorId) throws SQLException {
59
        return this.professorEduBgDao.query(con, professorId);
60
    }
61
62
    @Delete
63
    @Path("/{id}")
64
    public void delete(@JdbcConn(true) Connection con, @PathVar String id) throws SQLException {
65
        this.professorEduBgDao.delete(con, id);
66
    }
67
}

+ 87 - 22
src/main/java/com/ekexiu/console/system/service/ProfessorService.java

@ -3,6 +3,7 @@ package com.ekexiu.console.system.service;
3 3
import com.ekexiu.console.system.dao.LuserDao;
4 4
import com.ekexiu.console.system.dao.OrgDao;
5 5
import com.ekexiu.console.system.dao.ProfessorDao;
6
import com.ekexiu.console.system.dao.ResearchAreaDao;
6 7
import com.ekexiu.console.system.po.Luser;
7 8
import com.ekexiu.console.system.po.Professor;
8 9
import com.ekexiu.console.system.pojo.ProfessorInfo;
@ -46,6 +47,12 @@ public class ProfessorService {
46 47
    private OrgService orgService;
47 48
    @Autowrie
48 49
    private LuserDao luserDao;
50
    @Autowrie
51
    private KeyWordService keyWordService;
52
    @Autowrie
53
    private ResearchAreaDao researchAreaDao;
54
    @Autowrie
55
    private ResearchAreaService researchAreaService;
49 56
50 57
    public OrgService getOrgService() {
51 58
        return orgService;
@ -79,6 +86,30 @@ public class ProfessorService {
79 86
        this.luserDao = luserDao;
80 87
    }
81 88
89
    public KeyWordService getKeyWordService() {
90
        return keyWordService;
91
    }
92
93
    public void setKeyWordService(KeyWordService keyWordService) {
94
        this.keyWordService = keyWordService;
95
    }
96
97
    public ResearchAreaDao getResearchAreaDao() {
98
        return researchAreaDao;
99
    }
100
101
    public void setResearchAreaDao(ResearchAreaDao researchAreaDao) {
102
        this.researchAreaDao = researchAreaDao;
103
    }
104
105
    public ResearchAreaService getResearchAreaService() {
106
        return researchAreaService;
107
    }
108
109
    public void setResearchAreaService(ResearchAreaService researchAreaService) {
110
        this.researchAreaService = researchAreaService;
111
    }
112
82 113
    @Post
83 114
    @Path
84 115
    public String insert(@JdbcConn(true) Connection con, Professor professor, @Nullable String orgName)
@ -102,13 +133,39 @@ public class ProfessorService {
102 133
103 134
    @Put
104 135
    @Path
105
    public void update(@JdbcConn(true) Connection con, @RequestBody Professor professor) throws SQLException, IOException {
106
        this.professorDao.update(con, professor);
136
    public void update(@JdbcConn(true) Connection con, @RequestBody ProfessorInfo professor) throws SQLException, JfwBaseException, IOException {
137
        UserDetail userDetail = this.professorDao.queryDetail(con, professor.getId());
138
        if (!Objects.equals(userDetail.getActiveStatus(), "1")) {
139
            if (professor.getOrgName() != null) {
140
                if (null != this.orgDao.queryByName(con, professor.getOrgName())) {
141
                    professor.setOrgId(this.orgDao.queryByName(con, professor.getOrgName()));
142
                } else {
143
                    professor.setOrgId(this.orgService.createOrganization(con, professor.getOrgName()));
144
                }
145
            }
146
            this.professorDao.update(con, professor);
147
            if (professor.getResearchAreas() != null && !professor.getResearchAreas().isEmpty()) {
148
                this.researchAreaService.saveResearchArea(con, professor.getResearchAreas());
149
            } else {
150
                this.researchAreaService.delete(con, professor.getId());
151
            }
152
            Professor p = this.professorDao.query(con, professor.getId());
153
            String subject = p.getSubject();
154
            if (subject == null) {
155
                subject = "";
156
            }
157
            String industry = p.getIndustry();
158
            if (industry == null)
159
                industry = "";
160
            this.keyWordService.refreshProfessor(con, professor.getId(), KeyWordService.splitKeyWord(subject + "," + industry));
161
        } else {
162
            throw new JfwBaseException(50000, "只能修改未激活用户信息");
163
        }
107 164
    }
108 165
109 166
    @Get
110 167
    @Path("/pq")
111
    public PageQueryResult<ProfessorInfo> pageQuery(@JdbcConn Connection con, @Nullable String enter,@Nullable String orgName, @Nullable String name, @Nullable Integer professorState, @Nullable String bt, @Nullable String et, @DefaultValue("10") int pageSize, @DefaultValue("1") int pageNo) throws SQLException {
168
    public PageQueryResult<ProfessorInfo> pageQuery(@JdbcConn Connection con, @Nullable String enter, @Nullable String orgName, @Nullable String name, @Nullable Integer professorState, @Nullable String bt, @Nullable String et, @DefaultValue("10") int pageSize, @DefaultValue("1") int pageNo) throws SQLException {
112 169
        String oName = null;
113 170
        if (orgName != null) {
114 171
            oName = "%" + orgName + "%";
@ -117,27 +174,27 @@ public class ProfessorService {
117 174
        if (name != null) {
118 175
            pname = "%" + name + "%";
119 176
        }
120
        if (et!=null) {
177
        if (et != null) {
121 178
            et = et + "235959";
122 179
        }
123
        return this.professorDao.pageQuery(con,enter, oName, pname, professorState, bt, et, pageSize, pageNo);
180
        return this.professorDao.pageQuery(con, enter, oName, pname, professorState, bt, et, pageSize, pageNo);
124 181
    }
125 182
126 183
    @Get
127 184
    @Path("/id/{id}")
128
    public ProfessorInfo query(@JdbcConn Connection con,@PathVar String id) throws SQLException {
185
    public ProfessorInfo query(@JdbcConn Connection con, @PathVar String id) throws SQLException {
129 186
        return this.professorDao.query(con, id);
130 187
    }
131 188
132 189
    @Post
133 190
    @Path("/sortFirst")
134
    public void updateSortFirst(@JdbcConn(true) Connection con,String id,Integer sortFirst)throws SQLException {
191
    public void updateSortFirst(@JdbcConn(true) Connection con, String id, Integer sortFirst) throws SQLException {
135 192
        this.professorDao.updateSortFirst(con, id, sortFirst);
136 193
    }
137 194
138 195
    @Get
139 196
    @Path("/pqperson")
140
    public PageQueryResult<ProfessorInfo> pageQueryPerson(@JdbcConn Connection con, @LoginUser ConsoleAuthUser cau,@Nullable String orgName, @Nullable String name, @Nullable Integer professorState,@Nullable String bt, @Nullable String et, @DefaultValue("10") int pageSize, @DefaultValue("1") int pageNo) throws SQLException {
197
    public PageQueryResult<ProfessorInfo> pageQueryPerson(@JdbcConn Connection con, @LoginUser ConsoleAuthUser cau, @Nullable String orgName, @Nullable String name, @Nullable Integer professorState, @Nullable String bt, @Nullable String et, @DefaultValue("10") int pageSize, @DefaultValue("1") int pageNo) throws SQLException {
141 198
        String oName = null;
142 199
        if (orgName != null) {
143 200
            oName = "%" + orgName + "%";
@ -150,12 +207,12 @@ public class ProfessorService {
150 207
            bt = bt + "000000";
151 208
        if (et != null)
152 209
            et = et + "235959";
153
        return this.professorDao.pageQueryPerson(con,cau.getId(),oName, pname, professorState, bt, et, pageSize, pageNo);
210
        return this.professorDao.pageQueryPerson(con, cau.getId(), oName, pname, professorState, bt, et, pageSize, pageNo);
154 211
    }
155 212
156 213
    @Post
157 214
    @Path("/check")
158
    public void check(@JdbcConn(true) Connection con, String[] ids, Integer professorState, Integer authType, Integer authStatusExpert)throws SQLException {
215
    public void check(@JdbcConn(true) Connection con, String[] ids, Integer professorState, Integer authType, Integer authStatusExpert) throws SQLException {
159 216
        this.professorDao.updateProfessorState(con, ids, professorState);
160 217
        this.professorDao.updateAuthType(con, ids, authType);
161 218
        this.professorDao.updateAuthStatusExpert(con, ids, authStatusExpert);
@ -163,23 +220,23 @@ public class ProfessorService {
163 220
164 221
    @Get
165 222
    @Path("/getName/{id}")
166
    public String getName(@JdbcConn Connection con,@PathVar String id) throws SQLException {
223
    public String getName(@JdbcConn Connection con, @PathVar String id) throws SQLException {
167 224
        return this.professorDao.queryById(con, id);
168 225
    }
169 226
170 227
    @Get
171 228
    @Path("/pqUserDetail")
172
    public PageQueryResult<UserDetail> userDetailPageQueryResult(@JdbcConn Connection con, @Nullable String name, @Nullable String bt, @Nullable String et, @DefaultValue("10") int pageSize, @DefaultValue("1") int pageNo)throws SQLException {
173
        return this.professorDao.pageQueryUserDetail(con, name == null ? null : "%" + name + "%", bt, et, pageSize, pageNo);
229
    public PageQueryResult<UserDetail> userDetailPageQueryResult(@JdbcConn Connection con, @Nullable String name, @Nullable String activeStatus, @Nullable Integer sendMailStatus, @Nullable String bt, @Nullable String et, @DefaultValue("10") int pageSize, @DefaultValue("1") int pageNo) throws SQLException {
230
        return this.professorDao.pageQueryUserDetail(con, name == null ? null : "%" + name + "%", activeStatus, sendMailStatus, bt, et, pageSize, pageNo);
174 231
    }
175 232
176 233
    @Post
177 234
    @Path("/updateBusinessData")
178
    public void updateBusinessData(@JdbcConn(true) Connection con,String id,@Nullable int authentication,@Nullable int authStatus,@Nullable int authStatusExpert,int sortFirst)throws SQLException{
235
    public void updateBusinessData(@JdbcConn(true) Connection con, String id, @Nullable int authentication, @Nullable int authStatus, @Nullable int authStatusExpert, int sortFirst) throws SQLException {
179 236
        this.professorDao.updateBusinessData(con, id, authentication, authStatus, authStatusExpert, sortFirst);
180
        if (authStatusExpert == 3){
237
        if (authStatusExpert == 3) {
181 238
            this.professorDao.updateAuthType(con, id, 1);
182
        }else {
239
        } else {
183 240
            this.professorDao.updateAuthType(con, id, 0);
184 241
        }
185 242
    }
@ -194,9 +251,9 @@ public class ProfessorService {
194 251
195 252
    @Path("/updateCheck")
196 253
    @Get
197
    public int editCheck(@JdbcConn Connection con,@Nullable String mobile, @Nullable String email,String id) throws SQLException {
254
    public int editCheck(@JdbcConn Connection con, @Nullable String mobile, @Nullable String email, String id) throws SQLException {
198 255
        String luserId = this.luserDao.queryByEmail(con, email);
199
        if ((luserId != null)&&(!Objects.equals(luserId, id))) {
256
        if ((luserId != null) && (!Objects.equals(luserId, id))) {
200 257
            return 2;//该邮箱已被注册
201 258
        }
202 259
        String luserId1 = this.luserDao.queryByPhone(con, mobile);
@ -208,7 +265,7 @@ public class ProfessorService {
208 265
209 266
    @Post
210 267
    @Path("/createAccount")
211
    public void insert(@JdbcConn(true) Connection con,String name, @Nullable String mobile,@Nullable String email)throws SQLException,JfwBaseException {
268
    public void insert(@JdbcConn(true) Connection con, String name, @Nullable String mobile, @Nullable String email) throws SQLException, JfwBaseException {
212 269
213 270
        String luserId = this.luserDao.queryByEmail(con, email);
214 271
        if (luserId != null) {
@ -249,9 +306,9 @@ public class ProfessorService {
249 306
250 307
    @Post
251 308
    @Path("/updateAccount")
252
    public void updateAccount(@JdbcConn(true) Connection con,@Nullable String mobile, @Nullable String email,String id) throws SQLException, JfwBaseException {
309
    public void updateAccount(@JdbcConn(true) Connection con, @Nullable String mobile, @Nullable String email, String id) throws SQLException, JfwBaseException {
253 310
        String luserId = this.luserDao.queryByEmail(con, email);
254
        if ((luserId != null)&&(!Objects.equals(luserId, id))) {
311
        if ((luserId != null) && (!Objects.equals(luserId, id))) {
255 312
            throw new JfwBaseException(40001, "该邮箱已被注册");
256 313
        }
257 314
        String luserId1 = this.luserDao.queryByPhone(con, mobile);
@ -263,11 +320,19 @@ public class ProfessorService {
263 320
264 321
    @Get
265 322
    @Path("/luserId/{id}")
266
    public Luser queryAccount(@JdbcConn Connection con, @PathVar String id)throws SQLException {
323
    public Luser queryAccount(@JdbcConn Connection con, @PathVar String id) throws SQLException {
267 324
        Luser luser = this.luserDao.query(con, id);
268 325
        if (luser != null) {
269 326
            luser.setPasswd(null);
270 327
        }
271 328
        return luser;
272 329
    }
330
331
    @Get
332
    @Path("/detail/{id}")
333
    public UserDetail queryDetail(@JdbcConn Connection con, @PathVar String id) throws SQLException {
334
        UserDetail professor = this.professorDao.queryDetail(con, id);
335
        professor.setResearchAreas(this.researchAreaDao.query(con, id));
336
        return professor;
337
    }
273 338
}

+ 69 - 0
src/main/java/com/ekexiu/console/system/service/ProjectService.java

@ -0,0 +1,69 @@
1
package com.ekexiu.console.system.service;
2
3
import com.ekexiu.console.system.dao.ProjectDao;
4
import com.ekexiu.console.system.po.Project;
5
import org.jfw.apt.annotation.Autowrie;
6
import org.jfw.apt.web.annotation.Path;
7
import org.jfw.apt.web.annotation.operate.Delete;
8
import org.jfw.apt.web.annotation.operate.Get;
9
import org.jfw.apt.web.annotation.operate.Post;
10
import org.jfw.apt.web.annotation.operate.Put;
11
import org.jfw.apt.web.annotation.param.JdbcConn;
12
import org.jfw.apt.web.annotation.param.PathVar;
13
import org.jfw.apt.web.annotation.param.RequestBody;
14
import org.jfw.util.StringUtil;
15
16
import java.sql.Connection;
17
import java.sql.SQLException;
18
import java.util.List;
19
20
/**
21
 * Created by TT on 2017/8/14.
22
 */
23
@Path("/project")
24
public class ProjectService {
25
26
    @Autowrie
27
    private ProjectDao projectDao;
28
29
    public ProjectDao getProjectDao() {
30
        return projectDao;
31
    }
32
33
    public void setProjectDao(ProjectDao projectDao) {
34
        this.projectDao = projectDao;
35
    }
36
37
    @Get
38
    @Path("/{id}")
39
    public Project query(@JdbcConn Connection con, @PathVar String id) throws SQLException {
40
        return this.projectDao.queryOne(con, id);
41
    }
42
43
    @Post
44
    @Path
45
    public void insert(@JdbcConn(true) Connection con, Project project) throws SQLException {
46
        String id = StringUtil.buildUUID();
47
        project.setId(id);
48
        this.projectDao.insert(con, project);
49
    }
50
51
    @Put
52
    @Path
53
    public void update(@JdbcConn(true) Connection con, @RequestBody Project project) throws SQLException {
54
        this.projectDao.update(con, project);
55
    }
56
57
    @Get
58
    @Path("/professor")
59
    public List<Project> queryByProfessor(@JdbcConn Connection con, String professorId) throws SQLException {
60
        return this.projectDao.query(con, professorId);
61
    }
62
63
    @Delete
64
    @Path("/{id}")
65
    public void delete(@JdbcConn(true) Connection con, @PathVar String id) throws SQLException {
66
        this.projectDao.delete(con, id);
67
    }
68
}
69

+ 88 - 0
src/main/java/com/ekexiu/console/system/service/ResearchAreaService.java

@ -0,0 +1,88 @@
1
package com.ekexiu.console.system.service;
2
3
import com.ekexiu.console.system.dao.ResearchAreaDao;
4
import com.ekexiu.console.system.dao.ResearchAreaLogDao;
5
import com.ekexiu.console.system.po.ResearchArea;
6
import org.jfw.apt.annotation.Autowrie;
7
import org.jfw.apt.web.annotation.Path;
8
import org.jfw.apt.web.annotation.operate.Delete;
9
import org.jfw.apt.web.annotation.operate.Put;
10
import org.jfw.apt.web.annotation.param.JdbcConn;
11
import org.jfw.apt.web.annotation.param.PathVar;
12
import org.jfw.apt.web.annotation.param.RequestBody;
13
14
import java.sql.Connection;
15
import java.sql.SQLException;
16
import java.util.List;
17
18
/**
19
 * Created by TT on 2017/8/17.
20
 */
21
@Path("/researchArea")
22
public class ResearchAreaService {
23
24
    @Autowrie
25
    private ResearchAreaDao researchAreaDao;
26
    @Autowrie
27
    private ResearchAreaLogDao researchAreaLogDao;
28
29
    public ResearchAreaDao getResearchAreaDao() {
30
        return researchAreaDao;
31
    }
32
33
    public void setResearchAreaDao(ResearchAreaDao researchAreaDao) {
34
        this.researchAreaDao = researchAreaDao;
35
    }
36
37
    public ResearchAreaLogDao getResearchAreaLogDao() {
38
        return researchAreaLogDao;
39
    }
40
41
    public void setResearchAreaLogDao(ResearchAreaLogDao researchAreaLogDao) {
42
        this.researchAreaLogDao = researchAreaLogDao;
43
    }
44
45
    @Delete
46
    @Path("/{professorId}")
47
    public void delete(@JdbcConn(true) Connection con, @PathVar String professorId) throws SQLException {
48
        this.researchAreaDao.delete(con, professorId);
49
        this.researchAreaLogDao.delete(con, professorId);
50
    }
51
52
    @Put
53
    @Path
54
    public void saveResearchArea(@JdbcConn(true) Connection con, @RequestBody List<ResearchArea> areas) throws SQLException {
55
        String professorId = areas.get(0).getProfessorId();
56
        List<ResearchArea> olds = this.researchAreaDao.query(con, professorId);
57
        int sortNum = 1;
58
        for (ResearchArea area : areas) {
59
            area.setSortNum(sortNum++);
60
            boolean found = false;
61
            for (ResearchArea old : olds) {
62
                if (area.getCaption().equals(old.getCaption())) {
63
                    found = true;
64
                    this.researchAreaDao.updateDescp(con, professorId, area.getCaption(), area.getDescp(), area.getSortNum());
65
                    break;
66
                }
67
            }
68
            if (!found) {
69
                area.setProfessorId(professorId);
70
                this.researchAreaDao.insert(con, area);
71
            }
72
        }
73
        for (ResearchArea old : olds) {
74
            boolean found = false;
75
            for (ResearchArea area : areas) {
76
                if (area.getCaption().equals(old.getCaption())) {
77
                    found = true;
78
                    break;
79
                }
80
            }
81
            if (!found) {
82
                this.researchAreaDao.delete(con, professorId, old.getCaption());
83
                this.researchAreaLogDao.delete(con, professorId, old.getCaption());
84
            }
85
        }
86
    }
87
}
88

+ 13 - 0
src/main/java/com/ekexiu/console/system/service/UserInfoService.java

@ -46,6 +46,8 @@ public class UserInfoService {
46 46
    private ProfessorEduBgDao professorEduBgDao;
47 47
    @Autowrie
48 48
    private ProfessorService professorService;
49
    @Autowrie
50
    private KeyWordService keyWordService;
49 51
50 52
    public PartTimeJobDao getPartTimeJobDao() {
51 53
        return partTimeJobDao;
@ -115,6 +117,14 @@ public class UserInfoService {
115 117
        this.userInfoDao = userInfoDao;
116 118
    }
117 119
120
    public KeyWordService getKeyWordService() {
121
        return keyWordService;
122
    }
123
124
    public void setKeyWordService(KeyWordService keyWordService) {
125
        this.keyWordService = keyWordService;
126
    }
127
118 128
    @Path("/insert")
119 129
    @Put
120 130
    public void insert(@JdbcConn(true) Connection con, @RequestBody UserInfo userInfo, @LoginUser ConsoleAuthUser user) throws SQLException {
@ -239,6 +249,8 @@ public class UserInfoService {
239 249
                this.luserDao.insert(con, luser);
240 250
241 251
                Professor professor = new Professor();
252
                String subject = (String) userInfo.get("subject");
253
                String industry = (String) userInfo.get("industry");
242 254
                professor.setId(userInfo.getId());
243 255
                professor.setName(userInfo.getName());
244 256
                professor.setEmail((String) userInfo.get("pEmail"));
@ -276,6 +288,7 @@ public class UserInfoService {
276 288
                }
277 289
                professor.setProfessorState(0);
278 290
                this.professorService.insert(con, professor, userInfo.getOrgName());
291
                this.keyWordService.refreshProfessor(con, id, KeyWordService.splitKeyWord(subject + "," + industry));
279 292
280 293
                ArrayList<String> areas = (ArrayList<String>) userInfo.get("researchArea");
281 294
                if (areas != null) {