Sfoglia il codice sorgente

2.1 研究成果管理

XMTT 7 anni fa
parent
commit
feb82c6f92

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

@ -0,0 +1,25 @@
1
package com.ekexiu.console.system.dao;
2
3
import com.ekexiu.console.system.po.ResResultKeyWord;
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/10/19.
15
 */
16
@DAO
17
public interface ResResultKeyWordDao {
18
    @Insert
19
    @Batch
20
    int[] insert(Connection con, ResResultKeyWord[] rrkws) throws SQLException;
21
22
    @DeleteWith
23
    @From(ResResultKeyWord.class)
24
    int delete(Connection con, String id) throws SQLException;
25
}

+ 42 - 0
src/main/java/com/ekexiu/console/system/dao/ResearchResultDao.java

@ -0,0 +1,42 @@
1
package com.ekexiu.console.system.dao;
2
3
import com.ekexiu.console.system.po.ResearchResult;
4
import org.jfw.apt.annotation.Nullable;
5
import org.jfw.apt.orm.annotation.dao.DAO;
6
import org.jfw.apt.orm.annotation.dao.method.Exclude;
7
import org.jfw.apt.orm.annotation.dao.method.From;
8
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
9
import org.jfw.apt.orm.annotation.dao.method.Where;
10
import org.jfw.apt.orm.annotation.dao.method.operator.*;
11
import org.jfw.apt.orm.annotation.dao.param.*;
12
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
13
import org.jfw.util.PageQueryResult;
14
15
import java.sql.Connection;
16
import java.sql.SQLException;
17
18
/**
19
 * Created by TT on 2017/10/19.
20
 */
21
@DAO
22
public interface ResearchResultDao {
23
    @Insert
24
    int insert(Connection con, ResearchResult researchResult) throws SQLException;
25
26
    @Update
27
    @Exclude("modifyTime")
28
    int update(Connection con, ResearchResult researchResult) throws SQLException;
29
30
    @Nullable
31
    @SelectOne
32
    ResearchResult query(Connection con, String id) throws SQLException;
33
34
    @PageQuery
35
    @Where("status='1'")
36
    @OrderBy("ORDER BY CREATE_TIME DESC")
37
    PageQueryResult<ResearchResult> pageQuery(Connection con, @GroupSqlColumn(isAnd = false, handlerClass = StringHandler.class, value = {"id IN (SELECT ID FROM RESEARCHER WHERE NAME LIKE ?)"}) @Nullable String key, @Nullable @Like String name, @Nullable @Like String orgName, @Nullable @Like String department, @Nullable @Like String subject, @Nullable @Like String industry ,@Nullable @GtEq @Alias("createTime") String bt, @Nullable @Alias("createTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
38
39
    @UpdateWith
40
    @From(ResearchResult.class)
41
    int updateStatus(Connection con, String id, @Set String status) throws SQLException;
42
}

+ 37 - 0
src/main/java/com/ekexiu/console/system/dao/ResearcherDao.java

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

+ 32 - 0
src/main/java/com/ekexiu/console/system/po/ResResultKeyWord.java

@ -0,0 +1,32 @@
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/10/19.
9
 */
10
@Table
11
public class ResResultKeyWord {
12
    private String id;
13
    private String kw;
14
15
    @Column(DE.id_32)
16
    public String getId() {
17
        return id;
18
    }
19
20
    public void setId(String id) {
21
        this.id = id;
22
    }
23
24
    @Column(DE.text_de)
25
    public String getKw() {
26
        return kw;
27
    }
28
29
    public void setKw(String kw) {
30
        this.kw = kw;
31
    }
32
}

+ 259 - 0
src/main/java/com/ekexiu/console/system/po/ResearchResult.java

@ -0,0 +1,259 @@
1
package com.ekexiu.console.system.po;
2
3
import com.ekexiu.console.basepo.CreateTimeSupported;
4
import com.ekexiu.console.basepo.ModifyTimeSupported;
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.enums.DE;
10
11
/**
12
 * Created by TT on 2017/10/19.
13
 */
14
@Table
15
@PrimaryKey("id")
16
public class ResearchResult implements CreateTimeSupported, ModifyTimeSupported {
17
    private String id;
18
    private String name;
19
    private String level;
20
    private String orgName;
21
    private String department;
22
    private String subject;
23
    private String industry;
24
    private String descp;
25
    private String applyDescp;
26
    private String prospect;
27
    private String indicator;
28
    private String advantage;
29
    private String benefit;
30
    private String cooperation;
31
    private String linkman;
32
    private String addr;
33
    private String zipCode;
34
    private String tel;
35
    private String mobile;
36
    private String email;
37
    private String pic;
38
    private String createTime;
39
    private String modifyTime;
40
    private String status;
41
42
    @Column(DE.id_32)
43
    public String getId() {
44
        return id;
45
    }
46
47
    public void setId(String id) {
48
        this.id = id;
49
    }
50
51
    @Column(DE.text_de)
52
    public String getName() {
53
        return name;
54
    }
55
56
    public void setName(String name) {
57
        this.name = name;
58
    }
59
60
    @Column(DE.Text_de)
61
    public String getLevel() {
62
        return level;
63
    }
64
65
    public void setLevel(String level) {
66
        this.level = level;
67
    }
68
69
    @Column(DE.Text_de)
70
    public String getOrgName() {
71
        return orgName;
72
    }
73
74
    public void setOrgName(String orgName) {
75
        this.orgName = orgName;
76
    }
77
78
    @Column(DE.Text_de)
79
    public String getDepartment() {
80
        return department;
81
    }
82
83
    public void setDepartment(String department) {
84
        this.department = department;
85
    }
86
87
    @Column(DE.Text_de)
88
    public String getSubject() {
89
        return subject;
90
    }
91
92
    public void setSubject(String subject) {
93
        this.subject = subject;
94
    }
95
96
    @Column(DE.Text_de)
97
    public String getIndustry() {
98
        return industry;
99
    }
100
101
    public void setIndustry(String industry) {
102
        this.industry = industry;
103
    }
104
105
    @Column(DE.Text_de)
106
    public String getDescp() {
107
        return descp;
108
    }
109
110
    public void setDescp(String descp) {
111
        this.descp = descp;
112
    }
113
114
    @Column(DE.Text_de)
115
    public String getApplyDescp() {
116
        return applyDescp;
117
    }
118
119
    public void setApplyDescp(String applyDescp) {
120
        this.applyDescp = applyDescp;
121
    }
122
123
    @Column(DE.Text_de)
124
    public String getProspect() {
125
        return prospect;
126
    }
127
128
    public void setProspect(String prospect) {
129
        this.prospect = prospect;
130
    }
131
132
    @Column(DE.Text_de)
133
    public String getIndicator() {
134
        return indicator;
135
    }
136
137
    public void setIndicator(String indicator) {
138
        this.indicator = indicator;
139
    }
140
141
    @Column(DE.Text_de)
142
    public String getAdvantage() {
143
        return advantage;
144
    }
145
146
    public void setAdvantage(String advantage) {
147
        this.advantage = advantage;
148
    }
149
150
    @Column(DE.Text_de)
151
    public String getBenefit() {
152
        return benefit;
153
    }
154
155
    public void setBenefit(String benefit) {
156
        this.benefit = benefit;
157
    }
158
159
    @Column(DE.Text_de)
160
    public String getCooperation() {
161
        return cooperation;
162
    }
163
164
    public void setCooperation(String cooperation) {
165
        this.cooperation = cooperation;
166
    }
167
168
    @Column(DE.Text_de)
169
    public String getLinkman() {
170
        return linkman;
171
    }
172
173
    public void setLinkman(String linkman) {
174
        this.linkman = linkman;
175
    }
176
177
    @Column(DE.Text_de)
178
    public String getAddr() {
179
        return addr;
180
    }
181
182
    public void setAddr(String addr) {
183
        this.addr = addr;
184
    }
185
186
    @Column(DE.Text_de)
187
    public String getZipCode() {
188
        return zipCode;
189
    }
190
191
    public void setZipCode(String zipCode) {
192
        this.zipCode = zipCode;
193
    }
194
195
    @Column(DE.Text_de)
196
    public String getTel() {
197
        return tel;
198
    }
199
200
    public void setTel(String tel) {
201
        this.tel = tel;
202
    }
203
204
    @Column(DE.Text_de)
205
    public String getMobile() {
206
        return mobile;
207
    }
208
209
    public void setMobile(String mobile) {
210
        this.mobile = mobile;
211
    }
212
213
    @Column(DE.Text_de)
214
    public String getEmail() {
215
        return email;
216
    }
217
218
    public void setEmail(String email) {
219
        this.email = email;
220
    }
221
222
    @Column(DE.Text_de)
223
    public String getPic() {
224
        return pic;
225
    }
226
227
    public void setPic(String pic) {
228
        this.pic = pic;
229
    }
230
231
    @Override
232
    public String getCreateTime() {
233
        return createTime;
234
    }
235
236
    @Override
237
    public void setCreateTime(String createTime) {
238
        this.createTime = createTime;
239
    }
240
241
    @Override
242
    public String getModifyTime() {
243
        return modifyTime;
244
    }
245
246
    @Override
247
    public void setModifyTime(String modifyTime) {
248
        this.modifyTime = modifyTime;
249
    }
250
251
    @Column(handlerClass=FixLenStringHandler.class,dbType="CHAR(1)",nullable=true,renewable=false)
252
    public String getStatus() {
253
        return status;
254
    }
255
256
    public void setStatus(String status) {
257
        this.status = status;
258
    }
259
}

+ 44 - 0
src/main/java/com/ekexiu/console/system/po/Researcher.java

@ -0,0 +1,44 @@
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.PrimaryKey;
5
import org.jfw.apt.orm.annotation.entry.Table;
6
import org.jfw.apt.orm.core.enums.DE;
7
8
/**
9
 * Created by TT on 2017/10/19.
10
 */
11
@Table
12
@PrimaryKey({"id", "name"})
13
public class Researcher {
14
    private String id;
15
    private String professorId;
16
    private String name;
17
18
    @Column(DE.id_32)
19
    public String getId() {
20
        return id;
21
    }
22
23
    public void setId(String id) {
24
        this.id = id;
25
    }
26
27
    @Column(DE.id_32)
28
    public String getProfessorId() {
29
        return professorId;
30
    }
31
32
    public void setProfessorId(String professorId) {
33
        this.professorId = professorId;
34
    }
35
36
    @Column(DE.text_de)
37
    public String getName() {
38
        return name;
39
    }
40
41
    public void setName(String name) {
42
        this.name = name;
43
    }
44
}

+ 16 - 1
src/main/java/com/ekexiu/console/system/service/ArticleService.java

@ -263,11 +263,26 @@ public class ArticleService {
263 263
    @Get
264 264
    @Path("/qaHotKey")
265 265
    public List<DataDictCode> queryHotKey(String key) throws JfwBaseException, IOException {
266
        List<DataDictCode> dataDictCodes = http.get("http://192.168.3.233:81/ajax/dataDict/qaHotKey?key="+ URLEncoder.encode(key,"UTF-8"), new TypeReference<List<DataDictCode>>() {
266
        List<DataDictCode> dataDictCodes = http.get("http://www.ekexiu.com/ajax/dataDict/qaHotKey?key="+ URLEncoder.encode(key,"UTF-8"), new TypeReference<List<DataDictCode>>() {
267 267
        }.getType());
268 268
        return dataDictCodes;
269 269
    }
270 270
271
    @Get
272
    @Path("/typeHotKey")
273
    public List<TestService.TypeaheadItem> get(String q, @DefaultValue("10") int s) throws JfwBaseException,IOException {
274
        List<TestService.TypeaheadItem> ret = new ArrayList<>(s);
275
        List<DataDictCode> dataDictCodes = http.get("http://www.ekexiu.com/ajax/dataDict/qaHotKey?key="+ URLEncoder.encode( q,"UTF-8"), new TypeReference<List<DataDictCode>>() {
276
        }.getType());
277
        for (DataDictCode dictCode : dataDictCodes) {
278
            TestService.TypeaheadItem thi = new TestService.TypeaheadItem();
279
            thi.setCode(dictCode.getCaption());
280
            thi.setCaption(dictCode.getCaption());
281
            ret.add(thi);
282
        }
283
        return ret;
284
    }
285
271 286
    @Post
272 287
    @Path("/save")
273 288
    public String saveArticle(@JdbcConn(true) Connection con, Article article)throws SQLException,IOException,JfwBaseException {

+ 40 - 0
src/main/java/com/ekexiu/console/system/service/ImageService.java

@ -2,10 +2,14 @@ package com.ekexiu.console.system.service;
2 2
3 3
import com.ekexiu.console.service.Upload;
4 4
import org.jfw.apt.web.annotation.Path;
5
import org.jfw.apt.web.annotation.operate.Post;
5 6
import org.jfw.util.JpgUtil;
7
import org.jfw.util.StringUtil;
6 8
import org.jfw.util.io.IoUtil;
7 9
8 10
import java.io.*;
11
import java.text.SimpleDateFormat;
12
import java.util.Date;
9 13
10 14
/**
11 15
 * Created by TT on 2017/8/24.
@ -16,6 +20,9 @@ public class ImageService extends Upload {
16 20
    private File tmpPath;
17 21
    private File orgPath;
18 22
    private File bannerPath;
23
    private File researchResultPath;
24
    private String dateFormat = "yyyyMMdd";
25
    private static final String JPG = "jpg";
19 26
    private int largeHeadPhotoWidth = 200;
20 27
    private int largeHeadPhotoHeight = 200;
21 28
    private int middleHeadPhotoWidth = 200;
@ -83,6 +90,14 @@ public class ImageService extends Upload {
83 90
        this.orgPath = orgPath;
84 91
    }
85 92
93
    public File getResearchResultPath() {
94
        return researchResultPath;
95
    }
96
97
    public void setResearchResultPath(File researchResultPath) {
98
        this.researchResultPath = researchResultPath;
99
    }
100
86 101
    public void saveOrgLogo(String id, String fn) throws IOException {
87 102
        InputStream in = new FileInputStream(new File(this.tmpPath, fn));
88 103
        try {
@ -148,4 +163,29 @@ public class ImageService extends Upload {
148 163
        }
149 164
    }
150 165
166
    private String createDate() {
167
        SimpleDateFormat df = new SimpleDateFormat(this.dateFormat);
168
        String date = df.format(new Date());
169
        return date;
170
    }
171
172
    @Path("/researchResult")
173
    @Post
174
    public String researchResult(String fn)throws IOException {
175
        InputStream in = new FileInputStream(new File(this.tmpPath, fn));
176
        String savePath = this.researchResultPath + "/" + this.createDate();
177
        File dateFile = new File(savePath);
178
        if (!dateFile.exists()) {
179
            // 创建日期目录
180
            dateFile.mkdirs();
181
        }
182
        String id = StringUtil.buildUUID();
183
        try {
184
            IoUtil.copy(in, new FileOutputStream(new File(dateFile, id+ ".jpg")), false, true);
185
        } finally {
186
            in.close();
187
        }
188
        return this.createDate() + "/" + id + "." + JPG;
189
    }
190
151 191
}

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

@ -28,6 +28,8 @@ public class KeyWordService {
28 28
    private PatKeyWordDao patKeyWordDao;
29 29
    @Autowrie
30 30
    private PapKeyWordDao papKeyWordDao;
31
    @Autowrie
32
    private ResResultKeyWordDao resResultKeyWordDao;
31 33
32 34
    public ProKeyWordDao getProKeyWordDao() {
33 35
        return proKeyWordDao;
@ -77,6 +79,14 @@ public class KeyWordService {
77 79
        this.papKeyWordDao = papKeyWordDao;
78 80
    }
79 81
82
    public ResResultKeyWordDao getResResultKeyWordDao() {
83
        return resResultKeyWordDao;
84
    }
85
86
    public void setResResultKeyWordDao(ResResultKeyWordDao resResultKeyWordDao) {
87
        this.resResultKeyWordDao = resResultKeyWordDao;
88
    }
89
80 90
    public void refreshProfessor(Connection con, String id, String kw) throws SQLException {
81 91
        String[] kws = splitKeyWord(kw);
82 92
        proKeyWordDao.delete(con, id);
@ -167,6 +177,21 @@ public class KeyWordService {
167 177
        }
168 178
    }
169 179
180
    public void refreshResearchResult(Connection con, String id, String kw)throws SQLException {
181
        String [] kws = splitKeyWord(kw);
182
        resResultKeyWordDao.delete(con, id);
183
        if (kws != null && kws.length > 0) {
184
            ResResultKeyWord[] resResultKeyWords = new ResResultKeyWord[kws.length];
185
            for (int i = 0;i<kws.length;++i) {
186
                ResResultKeyWord resResultKeyWord = new ResResultKeyWord();
187
                resResultKeyWord.setId(id);
188
                resResultKeyWord.setKw(kws[i]);
189
                resResultKeyWords[i] = resResultKeyWord;
190
            }
191
            resResultKeyWordDao.insert(con, resResultKeyWords);
192
        }
193
    }
194
170 195
    public static String[] splitKeyWord(String kws) {
171 196
        if (kws == null || kws.trim().length() == 0) return null;
172 197
        kws = kws.trim();

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

@ -23,10 +23,17 @@ import org.jfw.util.DateUtil;
23 23
import org.jfw.util.PageQueryResult;
24 24
import org.jfw.util.StringUtil;
25 25
import org.jfw.util.exception.JfwBaseException;
26
import org.jfw.util.jdbc.JdbcUtil;
27
import org.jfw.util.jdbc.PreparedStatementConfig;
28
import org.jfw.util.jdbc.ResultSetExtractor;
26 29

27 30
import java.io.IOException;
28 31
import java.sql.Connection;
32
import java.sql.PreparedStatement;
33
import java.sql.ResultSet;
29 34
import java.sql.SQLException;
35
import java.util.ArrayList;
36
import java.util.List;
30 37
import java.util.Objects;
31 38

32 39
@Path("/sys/org")
@ -307,6 +314,36 @@ public class OrgService {
307 314
        this.orgDao.delete(con, ids);
308 315
    }
309 316

317
    @Get
318
    @Path("/orgName")
319
    public List<TestService.TypeaheadItem> get(@JdbcConn Connection con, String q , @DefaultValue("10")int s)throws SQLException {
320
        if (q != null) {
321
            q = "%" + q + "%";
322
        }
323
        List<TestService.TypeaheadItem> ret = new ArrayList<>(s);
324
        final String finalKey = q;
325
        List<String> typeahead = JdbcUtil.queryList(con, "SELECT name FROM organization WHERE name LIKE ?", new ResultSetExtractor<String>() {
326
            @Override
327
            public String extractData(ResultSet resultSet) throws SQLException {
328

329
                return resultSet.getString("name");
330
            }
331
        }, new PreparedStatementConfig() {
332
            @Override
333
            public void config(PreparedStatement preparedStatement) throws SQLException {
334
                preparedStatement.setString(1, finalKey);
335
            }
336
        });
337

338
        for (String s1 : typeahead) {
339
            TestService.TypeaheadItem thi = new TestService.TypeaheadItem();
340
            thi.setCode(s1);
341
            thi.setCaption(s1);
342
            ret.add(thi);
343
        }
344
        return ret;
345
    }
346

310 347
    public String createOrganization(Connection con, String orgName) throws SQLException, IOException {
311 348
        String id = StringUtil.buildUUID();
312 349
        Organization org = new Organization();

+ 39 - 0
src/main/java/com/ekexiu/console/system/service/ProfessorService.java

@ -21,10 +21,17 @@ import org.jfw.util.DateUtil;
21 21
import org.jfw.util.PageQueryResult;
22 22
import org.jfw.util.StringUtil;
23 23
import org.jfw.util.exception.JfwBaseException;
24
import org.jfw.util.jdbc.JdbcUtil;
25
import org.jfw.util.jdbc.PreparedStatementConfig;
26
import org.jfw.util.jdbc.ResultSetExtractor;
24 27
25 28
import java.io.IOException;
26 29
import java.sql.Connection;
30
import java.sql.PreparedStatement;
31
import java.sql.ResultSet;
27 32
import java.sql.SQLException;
33
import java.util.ArrayList;
34
import java.util.List;
28 35
import java.util.Objects;
29 36
import java.util.Random;
30 37
@ -398,6 +405,38 @@ public class ProfessorService {
398 405
        this.professorDao.updateOrgId(con, id, orgId);
399 406
    }
400 407
408
    @Get
409
    @Path("/name")
410
    public List<TestService.TypeaheadItem> get(@JdbcConn Connection con, String q , @DefaultValue("10")int s)throws SQLException {
411
        if (q != null) {
412
            q = "%" + q + "%";
413
        }
414
        List<TestService.TypeaheadItem> ret = new ArrayList<>(s);
415
        final String finalKey = q;
416
        List<List<String>> typeahead = JdbcUtil.queryList(con, "SELECT p.name as name,o.name as org_name ,p.id as id FROM professor p LEFT JOIN organization o on o.id = p.org_id WHERE p.name LIKE ?", new ResultSetExtractor<List<String>>() {
417
            @Override
418
            public List<String> extractData(ResultSet resultSet) throws SQLException {
419
                List<String> strings = new ArrayList<>();
420
                strings.add(resultSet.getString("name"));
421
                strings.add(resultSet.getString("org_name"));
422
                strings.add(resultSet.getString("id"));
423
                return strings;
424
            }
425
        }, new PreparedStatementConfig() {
426
            @Override
427
            public void config(PreparedStatement preparedStatement) throws SQLException {
428
                preparedStatement.setString(1, finalKey);
429
            }
430
        });
431
432
        for (List<String> s1 : typeahead) {
433
            TestService.TypeaheadItem thi = new TestService.TypeaheadItem();
434
            thi.setCode(s1.get(2));
435
            thi.setCaption(s1.get(0)+","+s1.get(1));
436
            ret.add(thi);
437
        }
438
        return ret;
439
    }
401 440
402 441
    private void updateOrgName(Connection con, String id) throws SQLException {
403 442
        this.professorDao.updateOrgAuth(con, id, "0");

+ 173 - 0
src/main/java/com/ekexiu/console/system/service/ResearchResultService.java

@ -0,0 +1,173 @@
1
package com.ekexiu.console.system.service;
2
3
import com.ekexiu.console.system.dao.ProfessorDao;
4
import com.ekexiu.console.system.dao.ResResultKeyWordDao;
5
import com.ekexiu.console.system.dao.ResearchResultDao;
6
import com.ekexiu.console.system.dao.ResearcherDao;
7
import com.ekexiu.console.system.po.ResearchResult;
8
import com.ekexiu.console.system.po.Researcher;
9
import org.jfw.apt.annotation.Autowrie;
10
import org.jfw.apt.annotation.DefaultValue;
11
import org.jfw.apt.annotation.Nullable;
12
import org.jfw.apt.web.annotation.Path;
13
import org.jfw.apt.web.annotation.operate.Get;
14
import org.jfw.apt.web.annotation.operate.Post;
15
import org.jfw.apt.web.annotation.param.JdbcConn;
16
import org.jfw.apt.web.annotation.param.PathVar;
17
import org.jfw.util.PageQueryResult;
18
import org.jfw.util.StringUtil;
19
20
import java.sql.Connection;
21
import java.sql.SQLException;
22
import java.util.List;
23
24
/**
25
 * Created by TT on 2017/10/19.
26
 */
27
@Path("/resResult")
28
public class ResearchResultService {
29
    @Autowrie
30
    private ResearcherDao researcherDao;
31
    @Autowrie
32
    private ResearchResultDao researchResultDao;
33
    @Autowrie
34
    private ResResultKeyWordDao resResultKeyWordDao;
35
    @Autowrie
36
    private ProfessorDao professorDao;
37
    @Autowrie
38
    private KeyWordService keyWordService;
39
40
    public ResearcherDao getResearcherDao() {
41
        return researcherDao;
42
    }
43
44
    public void setResearcherDao(ResearcherDao researcherDao) {
45
        this.researcherDao = researcherDao;
46
    }
47
48
    public ResearchResultDao getResearchResultDao() {
49
        return researchResultDao;
50
    }
51
52
    public void setResearchResultDao(ResearchResultDao researchResultDao) {
53
        this.researchResultDao = researchResultDao;
54
    }
55
56
    public ResResultKeyWordDao getResResultKeyWordDao() {
57
        return resResultKeyWordDao;
58
    }
59
60
    public void setResResultKeyWordDao(ResResultKeyWordDao resResultKeyWordDao) {
61
        this.resResultKeyWordDao = resResultKeyWordDao;
62
    }
63
64
    public ProfessorDao getProfessorDao() {
65
        return professorDao;
66
    }
67
68
    public void setProfessorDao(ProfessorDao professorDao) {
69
        this.professorDao = professorDao;
70
    }
71
72
    public KeyWordService getKeyWordService() {
73
        return keyWordService;
74
    }
75
76
    public void setKeyWordService(KeyWordService keyWordService) {
77
        this.keyWordService = keyWordService;
78
    }
79
80
    @Path
81
    @Post
82
    public void insert(@JdbcConn(true)Connection con, ResearchResult researchResult, @Nullable String[] researchers)throws SQLException{
83
        String id = StringUtil.buildUUID();
84
        researchResult.setId(id);
85
        researchResult.setStatus("1");
86
        refreshSearchers(con,id,researchers);
87
        String subject = researchResult.getSubject();
88
        if (subject == null) {
89
            subject = "";
90
        }
91
        String industry = researchResult.getIndustry();
92
        if (industry == null)
93
            industry = "";
94
        this.keyWordService.refreshResearchResult(con,id,subject+","+industry);
95
        this.researchResultDao.insert(con, researchResult);
96
    }
97
98
    @Post
99
    @Path("/update")
100
    public void update(@JdbcConn(true)Connection con,ResearchResult researchResult,@Nullable String[] researchers)throws SQLException {
101
        this.researchResultDao.update(con, researchResult);
102
        ResearchResult result = this.researchResultDao.query(con, researchResult.getId());
103
        refreshSearchers(con, result.getId(), researchers);
104
        String subject = result.getSubject();
105
        if (subject == null) {
106
            subject = "";
107
        }
108
        String industry = result.getIndustry();
109
        if (industry == null)
110
            industry = "";
111
        this.keyWordService.refreshResearchResult(con,result.getId(),subject+","+industry);
112
    }
113
114
    @Get
115
    @Path("/pq")
116
    public PageQueryResult<ResearchResult> pageQuery(@JdbcConn Connection con,@Nullable String key,@Nullable String name,@Nullable String orgName,@Nullable String department,@Nullable String subject,@Nullable String industry, @Nullable String bt, @Nullable String et,@DefaultValue("10") int pageSize,
117
                                                     @DefaultValue("1") int pageNo)throws SQLException{
118
        if (key != null) {
119
            key = "%" + key + "%";
120
        }
121
        if (name != null) {
122
            name = "%" + name + "%";
123
        }
124
        if (orgName != null) {
125
            orgName = "%" + orgName + "%";
126
        }
127
        if (department != null) {
128
            department = "%" + department + "%";
129
        }
130
        if (subject != null) {
131
            subject = "%" + subject + "%";
132
        }
133
        if (industry != null) {
134
            industry = "%" + industry + "%";
135
        }
136
        return this.researchResultDao.pageQuery(con, key, name, orgName, department, subject, industry, bt == null ? null : bt + "000000", et == null ? null : et + "235959", pageSize, pageNo);
137
    }
138
139
    @Get
140
    @Path("/queryResearcher")
141
    public List<Researcher> queryResearchers(@JdbcConn Connection con, String id)throws SQLException {
142
        return this.researcherDao.query(con, id);
143
    }
144
145
    @Get
146
    @Path("/id/{id}")
147
    public ResearchResult query(@JdbcConn Connection con, @PathVar String id)throws SQLException {
148
        return this.researchResultDao.query(con, id);
149
    }
150
151
    @Post
152
    @Path("/delete")
153
    public void delete(@JdbcConn(true)Connection con, String id )throws SQLException{
154
        this.researchResultDao.updateStatus(con, id,"0");
155
    }
156
157
158
    public void refreshSearchers(Connection con, String id, String[] researchers)throws SQLException {
159
        this.researcherDao.delete(con, id);
160
        if (researchers != null && researchers.length > 0) {
161
            Researcher[] res = new Researcher[researchers.length];
162
            for (int i = 0;i<researchers.length;++i) {
163
                Researcher re = new Researcher();
164
165
                re.setId(id);
166
                re.setProfessorId(researchers[i].substring(0,32));
167
                re.setName(researchers[i].substring(33));
168
                res[i] = re;
169
            }
170
            this.researcherDao.insert(con, res);
171
        }
172
    }
173
}

+ 82 - 0
src/main/resources/database.sql

@ -93,3 +93,85 @@ COMMENT ON COLUMN discover_banner.modifier IS '最后修改人ID';
93 93
COMMENT ON COLUMN discover_banner.create_time IS '创建时间';
94 94
COMMENT ON COLUMN discover_banner.creator IS '创建人ID';
95 95
96
97
-----begin version 2.1.0------------------------
98
99
-- ------------------------------------
100
-- Table structure for research_result
101
-- ------------------------------------
102
CREATE TABLE public.research_result (
103
  id CHARACTER(32) PRIMARY KEY NOT NULL,
104
  name TEXT NOT NULL, -- 成果名称
105
  level TEXT, -- 技术水平
106
  org_name TEXT, -- 所属机构
107
  department TEXT, -- 所属部门
108
  subject TEXT, -- 行业领域
109
  industry TEXT, -- 应用领域
110
  descp TEXT, -- 成果简介
111
  apply_descp TEXT, -- 应用介绍
112
  prospect TEXT, -- 产业化前景
113
  indicator TEXT, -- 技术指标
114
  advantage TEXT, -- 技术优势
115
  benefit TEXT, -- 经济和社会效益
116
  cooperation TEXT, -- 合作备注
117
  linkman TEXT, -- 联系人
118
  addr TEXT, -- 地址
119
  zip_code TEXT, -- 邮编
120
  tel TEXT, -- 办公电话
121
  mobile TEXT, -- 手机
122
  email TEXT, -- 邮箱
123
  pic TEXT, -- 图片
124
  create_time CHARACTER(14) NOT NULL, -- 创建时间
125
  modify_time CHARACTER(14) NOT NULL, -- 修改时间
126
  status CHARACTER(1) -- 科研成果状态(0-删除,1-发布)
127
);
128
CREATE UNIQUE INDEX research_result_id_uindex ON research_result USING BTREE (id);
129
COMMENT ON TABLE public.research_result IS '科研成果';
130
COMMENT ON COLUMN public.research_result.name IS '成果名称';
131
COMMENT ON COLUMN public.research_result.level IS '技术水平';
132
COMMENT ON COLUMN public.research_result.org_name IS '所属机构';
133
COMMENT ON COLUMN public.research_result.department IS '所属部门';
134
COMMENT ON COLUMN public.research_result.subject IS '行业领域';
135
COMMENT ON COLUMN public.research_result.industry IS '应用领域';
136
COMMENT ON COLUMN public.research_result.descp IS '成果简介';
137
COMMENT ON COLUMN public.research_result.apply_descp IS '应用介绍';
138
COMMENT ON COLUMN public.research_result.prospect IS '产业化前景';
139
COMMENT ON COLUMN public.research_result.indicator IS '技术指标';
140
COMMENT ON COLUMN public.research_result.advantage IS '技术优势';
141
COMMENT ON COLUMN public.research_result.benefit IS '经济和社会效益';
142
COMMENT ON COLUMN public.research_result.cooperation IS '合作备注';
143
COMMENT ON COLUMN public.research_result.linkman IS '联系人';
144
COMMENT ON COLUMN public.research_result.addr IS '地址';
145
COMMENT ON COLUMN public.research_result.zip_code IS '邮编';
146
COMMENT ON COLUMN public.research_result.tel IS '办公电话';
147
COMMENT ON COLUMN public.research_result.mobile IS '手机';
148
COMMENT ON COLUMN public.research_result.email IS '邮箱';
149
COMMENT ON COLUMN public.research_result.pic IS '图片';
150
COMMENT ON COLUMN public.research_result.create_time IS '创建时间';
151
COMMENT ON COLUMN public.research_result.modify_time IS '修改时间';
152
COMMENT ON COLUMN public.research_result.status IS '科研成果状态(0-删除,1-发布)';
153
154
-- ------------------------------------
155
-- Table structure for public.researcher
156
-- ------------------------------------
157
CREATE TABLE public.researcher (
158
  id CHARACTER(32) NOT NULL, -- 研究成果ID
159
  professor_id CHARACTER(32) NOT NULL DEFAULT '################################'::bpchar, -- 研究者ID
160
  name TEXT NOT NULL, -- 研究者姓名
161
  PRIMARY KEY (id, name)
162
);
163
CREATE UNIQUE INDEX researchers_key ON researcher USING BTREE (id, name);
164
COMMENT ON COLUMN public.researcher.id IS '研究成果ID';
165
COMMENT ON COLUMN public.researcher.professor_id IS '研究者ID';
166
COMMENT ON COLUMN public.researcher.name IS '研究者姓名';
167
168
-- ------------------------------------
169
-- Table structure for res_result_key_word
170
-- ------------------------------------
171
CREATE TABLE public.res_result_key_word (
172
  id CHARACTER(32) NOT NULL, -- 科研成果ID
173
  kw TEXT NOT NULL -- 关键词
174
);
175
COMMENT ON TABLE public.res_result_key_word IS '科研成果关键词';
176
COMMENT ON COLUMN public.res_result_key_word.id IS '科研成果ID';
177
COMMENT ON COLUMN public.res_result_key_word.kw IS '关键词';

+ 4 - 1
src/main/resources/project-dev.properties

@ -102,4 +102,7 @@ com_ekexiu_console_system_service_DiscoverBannerService.generatePath::java.io.Fi
102 102
com_ekexiu_console_system_service_ArticleService.tmpPath::java.io.File=/kexiu/www/html/images/tmp
103 103

104 104
#com_ekexiu_console_system_service_ArticleService.articlePath::java.io.File=D:/tmp/data/article
105
com_ekexiu_console_system_service_ArticleService.articlePath::java.io.File=/kexiu/webdata/data/article
105
com_ekexiu_console_system_service_ArticleService.articlePath::java.io.File=/kexiu/webdata/data/article
106

107
#com_ekexiu_console_system_service_ImageService.researchResultPath::java.io.File=D:/tmp/data/images/researchResult
108
com_ekexiu_console_system_service_ImageService.researchResultPath::java.io.File=/kexiu/webdata/data/researchResult

+ 3 - 1
src/main/resources/project-test-dev.properties

@ -81,4 +81,6 @@ com_ekexiu_console_system_service_DiscoverBannerService.generatePath::java.io.Fi
81 81
82 82
com_ekexiu_console_system_service_ArticleService.tmpPath::java.io.File=/kexiu/www/html/images/tmp
83 83
84
com_ekexiu_console_system_service_ArticleService.articlePath::java.io.File=/kexiu/webdata/data/article
84
com_ekexiu_console_system_service_ArticleService.articlePath::java.io.File=/kexiu/webdata/data/article
85
86
com_ekexiu_console_system_service_ImageService.researchResultPath::java.io.File=/kexiu/webdata/data/researchResult

+ 3 - 1
src/main/resources/project-test.properties

@ -81,4 +81,6 @@ com_ekexiu_console_system_service_DiscoverBannerService.generatePath::java.io.Fi
81 81
82 82
com_ekexiu_console_system_service_ArticleService.tmpPath::java.io.File=/kexiu/www/html/images/tmp
83 83
84
com_ekexiu_console_system_service_ArticleService.articlePath::java.io.File=/kexiu/webdata/data/article
84
com_ekexiu_console_system_service_ArticleService.articlePath::java.io.File=/kexiu/webdata/data/article
85
86
com_ekexiu_console_system_service_ImageService.researchResultPath::java.io.File=/kexiu/webdata/data/researchResult

+ 3 - 1
src/main/resources/project.properties

@ -83,4 +83,6 @@ com_ekexiu_console_system_service_DiscoverBannerService.generatePath::java.io.Fi
83 83
84 84
com_ekexiu_console_system_service_ArticleService.tmpPath::java.io.File=/kexiu/www/html/images/tmp
85 85
86
com_ekexiu_console_system_service_ArticleService.articlePath::java.io.File=/kexiu/webdata/data/article
86
com_ekexiu_console_system_service_ArticleService.articlePath::java.io.File=/kexiu/webdata/data/article
87
88
com_ekexiu_console_system_service_ImageService.researchResultPath::java.io.File=/kexiu/webdata/data/researchResult