Browse Source

新增服务

XMTT 7 years ago
parent
commit
daf9b2e6ee

+ 75 - 0
src/main/java/com/ekexiu/console/system/dao/WareDao.java

@ -0,0 +1,75 @@
1
package com.ekexiu.console.system.dao;
2
3
import com.ekexiu.console.system.po.Ware;
4
import com.ekexiu.console.system.pojo.WareInfo;
5
import org.jfw.apt.annotation.Nullable;
6
import org.jfw.apt.orm.annotation.dao.Batch;
7
import org.jfw.apt.orm.annotation.dao.DAO;
8
import org.jfw.apt.orm.annotation.dao.method.Exclude;
9
import org.jfw.apt.orm.annotation.dao.method.From;
10
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
11
import org.jfw.apt.orm.annotation.dao.method.SetSentence;
12
import org.jfw.apt.orm.annotation.dao.method.Where;
13
import org.jfw.apt.orm.annotation.dao.method.operator.PageQuery;
14
import org.jfw.apt.orm.annotation.dao.method.operator.QueryOne;
15
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
16
import org.jfw.apt.orm.annotation.dao.method.operator.Update;
17
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
18
import org.jfw.apt.orm.annotation.dao.param.Alias;
19
import org.jfw.apt.orm.annotation.dao.param.GtEq;
20
import org.jfw.apt.orm.annotation.dao.param.Like;
21
import org.jfw.apt.orm.annotation.dao.param.LtEq;
22
import org.jfw.apt.orm.annotation.dao.param.Set;
23
import org.jfw.apt.orm.annotation.dao.param.SqlColumn;
24
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
25
import org.jfw.util.PageQueryResult;
26
27
import java.sql.Connection;
28
import java.sql.SQLException;
29
30
/**
31
 * Created by TT on 2018/3/20.
32
 */
33
@DAO
34
public interface WareDao {
35
36
    @SelectOne
37
    @Nullable
38
    Ware queryById(Connection con, String id) throws SQLException;
39
40
    @Update
41
    @Exclude("modifyTime")
42
    int update(Connection con, Ware ware) throws SQLException;
43
44
    @Nullable
45
    @QueryOne
46
    WareInfo query(Connection con, String id) throws SQLException;
47
48
    @PageQuery
49
    @OrderBy(" ORDER BY modify_time DESC NULLS LAST")
50
    @Where("state='1'")
51
    @Exclude("descp")
52
    PageQueryResult<WareInfo> queryByTime(Connection con, @Nullable @Like String name,@Nullable @SqlColumn(value = {"(p.name is null or p.name like ?)", "(o.name is null or o.name like ?)"}, handlerClass = StringHandler.class) String author, @Nullable @GtEq @Alias("modifyTime") String bt, @Nullable @Alias("modifyTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
53
54
    @PageQuery
55
    @OrderBy(" ORDER BY page_views DESC NULLS LAST")
56
    @Where("state='1'")
57
    @Exclude("descp")
58
    PageQueryResult<WareInfo> queryByPV(Connection con, @Nullable @Like String name,@Nullable @SqlColumn(value = {"(p.name is null or p.name like ?)", "(o.name is null or o.name like ?)"}, handlerClass = StringHandler.class) String author, @Nullable @GtEq @Alias("modifyTime") String bt, @Nullable @Alias("modifyTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
59
60
    @Batch
61
    @UpdateWith
62
    @From(Ware.class)
63
    @Where("STATE<>'0'")
64
    @SetSentence("STATE = '0'")
65
    int[] logicDelete(Connection con, @Batch String[] id) throws SQLException;
66
67
    @UpdateWith
68
    @From(Ware.class)
69
    int updateSortFirst(Connection con, String id, @Set long sortFirst) throws SQLException;
70
71
    @UpdateWith
72
    @From(Ware.class)
73
    int updateKw(Connection con, String id, @Set String keywords) throws SQLException;
74
75
}

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

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

+ 20 - 0
src/main/java/com/ekexiu/console/system/po/Professor.java

@ -57,6 +57,8 @@ public class Professor implements CreateTimeSupported,ModifyTimeSupported {
57 57
    private Integer professorState;
58 58
    private Integer sortFirst;
59 59
    private long pageViews;
60
    private String sex;
61
    private String birthday;
60 62
61 63
    private List<ResearchArea> researchAreas;
62 64
    
@ -336,5 +338,23 @@ public class Professor implements CreateTimeSupported,ModifyTimeSupported {
336 338
    public void setResearchAreas(List<ResearchArea> researchAreas) {
337 339
        this.researchAreas = researchAreas;
338 340
    }
341
342
    @Column(DE.Text_de)
343
    public String getSex() {
344
        return sex;
345
    }
346
347
    public void setSex(String sex) {
348
        this.sex = sex;
349
    }
350
351
    @Column(DE.Text_de)
352
    public String getBirthday() {
353
        return birthday;
354
    }
355
356
    public void setBirthday(String birthday) {
357
        this.birthday = birthday;
358
    }
339 359
}
340 360

+ 198 - 0
src/main/java/com/ekexiu/console/system/po/Ware.java

@ -0,0 +1,198 @@
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.defaultImpl.LongHandler;
10
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
11
import org.jfw.apt.orm.core.enums.DE;
12
13
/**
14
 * Created by TT on 2018/3/20.
15
 */
16
@PrimaryKey("id")
17
@Table
18
public class Ware implements CreateTimeSupported, ModifyTimeSupported {
19
    private String id;
20
    private String name;
21
    /**
22
     * 关键字
23
     */
24
    private String keywords;
25
26
    /**
27
     * 服务内容
28
     */
29
    private String cnt;
30
    /**
31
     * 合作备注
32
     */
33
    private String cooperation;
34
    /**
35
     * 详细描述
36
     */
37
    private String descp;
38
    /**
39
     * 类型:1:个人  2:企业
40
     */
41
    private String category;
42
    /**
43
     * 发布人
44
     */
45
    private String owner;
46
47
    private String images;
48
    /**
49
     * 状态  0:删除,1:发布的 ,2:草稿
50
     */
51
    private String state;
52
    /**
53
     * 创建时间
54
     */
55
    private String createTime;
56
    /**
57
     * 最后修改时间
58
     */
59
    private String modifyTime;
60
    private long shareId;
61
    private long pageViews;
62
    private long sortFirst;
63
64
65
    @Column(handlerClass = LongHandler.class, dbType = "INT8", nullable = true, renewable = false, fixSqlValueWithInsert = "0")
66
    public long getPageViews() {
67
        return pageViews;
68
    }
69
70
    public void setPageViews(long pageViews) {
71
        this.pageViews = pageViews;
72
    }
73
74
    @Column(DE.id_32)
75
    public String getId() {
76
        return id;
77
    }
78
79
    public void setId(String id) {
80
        this.id = id;
81
    }
82
83
    @Column(DE.text_de)
84
    public String getName() {
85
        return name;
86
    }
87
88
    public void setName(String name) {
89
        this.name = name;
90
    }
91
92
    @Column(DE.Text_de)
93
    public String getKeywords() {
94
        return keywords;
95
    }
96
97
    public void setKeywords(String keywords) {
98
        this.keywords = keywords;
99
    }
100
101
    @Column(DE.Text_de)
102
    public String getCnt() {
103
        return cnt;
104
    }
105
106
    public void setCnt(String context) {
107
        this.cnt = context;
108
    }
109
110
    @Column(DE.Text_de)
111
    public String getCooperation() {
112
        return cooperation;
113
    }
114
115
    public void setCooperation(String cooperation) {
116
        this.cooperation = cooperation;
117
    }
118
119
    @Column(DE.Text_de)
120
    public String getDescp() {
121
        return descp;
122
    }
123
124
    public void setDescp(String descp) {
125
        this.descp = descp;
126
    }
127
128
    @Column(handlerClass = FixLenStringHandler.class, dbType = "CHAR(1)", insertable = true, nullable = false, queryable = true, renewable = false)
129
    public String getCategory() {
130
        return category;
131
    }
132
133
    public void setCategory(String category) {
134
        this.category = category;
135
    }
136
137
    @Column(handlerClass = StringHandler.class, dbType = "TEXT", insertable = true, nullable = false, queryable = true, renewable = false)
138
    public String getOwner() {
139
        return owner;
140
    }
141
142
    public void setOwner(String owner) {
143
        this.owner = owner;
144
    }
145
146
    @Column(DE.Text_de)
147
    public String getImages() {
148
        return images;
149
    }
150
151
    public void setImages(String images) {
152
        this.images = images;
153
    }
154
155
    @Column(DE.singleChar)
156
    public String getState() {
157
        return state;
158
    }
159
160
    public void setState(String state) {
161
        this.state = state;
162
    }
163
164
    public String getCreateTime() {
165
        return createTime;
166
    }
167
168
    public void setCreateTime(String createTime) {
169
        this.createTime = createTime;
170
    }
171
172
    public String getModifyTime() {
173
        return modifyTime;
174
    }
175
176
    public void setModifyTime(String modifyTime) {
177
        this.modifyTime = modifyTime;
178
    }
179
180
    @Column(DE.bigSerial)
181
    public long getShareId() {
182
        return shareId;
183
    }
184
185
    public void setShareId(long shareId) {
186
        this.shareId = shareId;
187
    }
188
189
    @Column(handlerClass = LongHandler.class, dbType = "INT8", fixSqlValueWithInsert = "0", insertable = true, renewable = false, queryable = true, nullable = false)
190
    public long getSortFirst() {
191
        return sortFirst;
192
    }
193
194
    public void setSortFirst(long sortFirst) {
195
        this.sortFirst = sortFirst;
196
    }
197
198
}

+ 34 - 0
src/main/java/com/ekexiu/console/system/po/WareKeyWord.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 2018/3/22.
9
 */
10
@Table("wre_key_word")
11
public class WareKeyWord {
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
}

+ 33 - 0
src/main/java/com/ekexiu/console/system/pojo/WareInfo.java

@ -0,0 +1,33 @@
1
package com.ekexiu.console.system.pojo;
2
3
import com.ekexiu.console.system.po.Ware;
4
import org.jfw.apt.orm.annotation.entry.CalcColumn;
5
import org.jfw.apt.orm.annotation.entry.ExtendView;
6
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
7
8
/**
9
 * Created by TT on 2018/3/21.
10
 */
11
@ExtendView(fromSentence = "ware w LEFT JOIN professor p on p.id = w.owner LEFT JOIN organization o on o.id = w.owner ",tableAlias = "w")
12
public class WareInfo extends Ware {
13
    private String professorName;
14
    private String orgName;
15
16
    @CalcColumn(handlerClass = StringHandler.class, column = "p.name")
17
    public String getProfessorName() {
18
        return professorName;
19
    }
20
21
    public void setProfessorName(String professorName) {
22
        this.professorName = professorName;
23
    }
24
25
    @CalcColumn(handlerClass = StringHandler.class, column = "o.name")
26
    public String getOrgName() {
27
        return orgName;
28
    }
29
30
    public void setOrgName(String orgName) {
31
        this.orgName = orgName;
32
    }
33
}

+ 12 - 1
src/main/java/com/ekexiu/console/system/service/AuthApplyService.java

@ -6,6 +6,8 @@ import com.ekexiu.console.system.dao.ProfessorDao;
6 6
import com.ekexiu.console.system.po.AuthApply;
7 7
import com.ekexiu.console.system.pojo.AuthApplyInfo;
8 8
import com.ekexiu.console.system.pojo.OrgApplyInfo;
9
import com.ekexiu.console.util.HttpService;
10
import com.ekexiu.console.util.HttpServiceImpl;
9 11
import org.jfw.apt.annotation.Autowrie;
10 12
import org.jfw.apt.annotation.DefaultValue;
11 13
import org.jfw.apt.annotation.Nullable;
@ -18,7 +20,9 @@ import org.jfw.apt.web.annotation.param.JdbcConn;
18 20
import org.jfw.apt.web.annotation.param.PathVar;
19 21
import org.jfw.apt.web.annotation.param.RequestBody;
20 22
import org.jfw.util.PageQueryResult;
23
import org.jfw.util.exception.JfwBaseException;
21 24
25
import java.io.IOException;
22 26
import java.sql.Connection;
23 27
import java.sql.SQLException;
24 28
import java.util.List;
@ -29,6 +33,7 @@ import java.util.List;
29 33
30 34
@Path("/authApply")
31 35
public class AuthApplyService {
36
    private static HttpService http = new HttpServiceImpl();
32 37
33 38
    @Autowrie
34 39
    private AuthApplyDao authApplyDao;
@ -75,14 +80,20 @@ public class AuthApplyService {
75 80
76 81
    @Post
77 82
    @Path("/state")
78
    public void updateState(@JdbcConn(true) Connection con, String authApplyId, Integer solveStatus, Integer applyType, String professorId,@Nullable String idCard) throws SQLException {
83
    public void updateState(@JdbcConn(true) Connection con, String authApplyId, Integer solveStatus, Integer applyType, String professorId,@Nullable String idCard) throws SQLException, IOException, JfwBaseException {
79 84
        this.authApplyDao.updateSolveStatus(con, solveStatus, authApplyId);
80 85
        if (applyType == 1) {
81 86
            this.professorDao.updateAuthStatus(con, professorId, solveStatus,idCard);
87
            //通过实名认证给用户增加积分
88
            if(solveStatus==3){
89
                http.post("http://www.ekexiu.com/ajax/growth/authRealName","professorId=" + professorId,null);
90
            }
82 91
        } else if (applyType == 2) {
83 92
            this.professorDao.updateAuthStatusExpert(con, professorId, solveStatus);
84 93
            if (solveStatus == 3) {
85 94
                this.professorDao.updateAuthType(con, professorId, 1);
95
                //通过专家认证给用户增加积分
96
                http.post("http://www.ekexiu.com/ajax/growth/authExpert","professorId=" + professorId,null);
86 97
            }
87 98
        } else if (applyType == 3) {
88 99
            this.orgDao.updateAuthStatus(con, professorId, String.valueOf(solveStatus));

+ 18 - 0
src/main/java/com/ekexiu/console/system/service/FeedbackService.java

@ -10,10 +10,12 @@ import com.ekexiu.console.system.dao.ProfessorDao;
10 10
import com.ekexiu.console.system.dao.QuestionDao;
11 11
import com.ekexiu.console.system.dao.ResourceDao;
12 12
import com.ekexiu.console.system.dao.UserDao;
13
import com.ekexiu.console.system.dao.WareDao;
13 14
import com.ekexiu.console.system.po.Demand;
14 15
import com.ekexiu.console.system.po.Feedback;
15 16
import com.ekexiu.console.system.po.Professor;
16 17
import com.ekexiu.console.system.po.Question;
18
import com.ekexiu.console.system.po.Ware;
17 19
import com.ekexiu.console.system.pojo.AnswerInfo;
18 20
import com.ekexiu.console.system.vo.ConsoleAuthUser;
19 21
import org.jfw.apt.annotation.Autowrie;
@ -58,6 +60,8 @@ public class FeedbackService {
58 60
    private DemandDao demandDao;
59 61
    @Autowrie
60 62
    private QuestionDao questionDao;
63
    @Autowrie
64
    private WareDao wareDao;
61 65
62 66
63 67
    public FeedbackDao getFeedbackDao() {
@ -140,6 +144,14 @@ public class FeedbackService {
140 144
        this.questionDao = questionDao;
141 145
    }
142 146
147
    public WareDao getWareDao() {
148
        return wareDao;
149
    }
150
151
    public void setWareDao(WareDao wareDao) {
152
        this.wareDao = wareDao;
153
    }
154
143 155
    @Path("/update")
144 156
    @Post
145 157
    public void update(@JdbcConn(true) Connection con,long id,String state,@Nullable String operateDescp,@LoginUser ConsoleAuthUser user) throws SQLException {
@ -218,6 +230,12 @@ public class FeedbackService {
218 230
                    feedback.setAnswerCnt(answer.getCnt());
219 231
                }
220 232
            }
233
            if (feedback.getSchema() == 10) {
234
                Ware ware = this.wareDao.queryById(con, feedback.getParam());
235
                if (ware != null) {
236
                    feedback.setDataName(ware.getName());
237
                }
238
            }
221 239
        }
222 240
        return feedback;
223 241
    }

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

@ -30,6 +30,8 @@ public class KeyWordService {
30 30
    private PapKeyWordDao papKeyWordDao;
31 31
    @Autowrie
32 32
    private ResResultKeyWordDao resResultKeyWordDao;
33
    @Autowrie
34
    private WareKeyWordDao wareKeyWordDao;
33 35
34 36
    public ProKeyWordDao getProKeyWordDao() {
35 37
        return proKeyWordDao;
@ -87,6 +89,14 @@ public class KeyWordService {
87 89
        this.resResultKeyWordDao = resResultKeyWordDao;
88 90
    }
89 91
92
    public WareKeyWordDao getWareKeyWordDao() {
93
        return wareKeyWordDao;
94
    }
95
96
    public void setWareKeyWordDao(WareKeyWordDao wareKeyWordDao) {
97
        this.wareKeyWordDao = wareKeyWordDao;
98
    }
99
90 100
    public void refreshProfessor(Connection con, String id, String kw) throws SQLException {
91 101
        String[] kws = splitKeyWord(kw);
92 102
        proKeyWordDao.delete(con, id);
@ -192,6 +202,24 @@ public class KeyWordService {
192 202
        }
193 203
    }
194 204
205
    public void refreshWare(Connection con,String id,String kw)throws SQLException{
206
        String[] kws = splitKeyWord(kw);
207
        wareKeyWordDao.delete(con, id);
208
        if (kws != null && kws.length > 0) {
209
            WareKeyWord[] okws = new WareKeyWord[kws.length];
210
            for (int i = 0; i < kws.length; ++i) {
211
                WareKeyWord okw = new WareKeyWord();
212
                okw.setId(id);
213
                okw.setKw(kws[i]);
214
                okws[i] = okw;
215
            }
216
            wareKeyWordDao.insert(con, okws);
217
        }
218
    }
219
    public void deleteWare(Connection con,String id)throws SQLException{
220
        wareKeyWordDao.delete(con, id);
221
    }
222
195 223
    public static String[] splitKeyWord(String kws) {
196 224
        if (kws == null || kws.trim().length() == 0) return null;
197 225
        kws = kws.trim();

+ 159 - 0
src/main/java/com/ekexiu/console/system/service/WareService.java

@ -0,0 +1,159 @@
1
package com.ekexiu.console.system.service;
2
3
import com.ekexiu.console.system.dao.WareDao;
4
import com.ekexiu.console.system.pojo.WareInfo;
5
import org.jfw.apt.annotation.Autowrie;
6
import org.jfw.apt.annotation.DefaultValue;
7
import org.jfw.apt.annotation.Nullable;
8
import org.jfw.apt.web.annotation.Path;
9
import org.jfw.apt.web.annotation.operate.Get;
10
import org.jfw.apt.web.annotation.operate.Post;
11
import org.jfw.apt.web.annotation.param.JdbcConn;
12
import org.jfw.apt.web.annotation.param.PathVar;
13
import org.jfw.util.PageQueryResult;
14
15
import java.io.File;
16
import java.sql.Connection;
17
import java.sql.SQLException;
18
19
/**
20
 * Created by TT on 2018/3/21.
21
 */
22
@Path("/ware")
23
public class WareService {
24
    private File imgPath;
25
26
    @Autowrie
27
    private WareDao wareDao;
28
    @Autowrie
29
    private KeyWordService keyWordService;
30
31
    public File getImgPath() {
32
        return imgPath;
33
    }
34
35
    public void setImgPath(File imgPath) {
36
        this.imgPath = imgPath;
37
    }
38
39
    public WareDao getWareDao() {
40
        return wareDao;
41
    }
42
43
    public void setWareDao(WareDao wareDao) {
44
        this.wareDao = wareDao;
45
    }
46
47
    public KeyWordService getKeyWordService() {
48
        return keyWordService;
49
    }
50
51
    public void setKeyWordService(KeyWordService keyWordService) {
52
        this.keyWordService = keyWordService;
53
    }
54
55
    //public boolean update(Connection con, Ware ware, String[] professor, String[] resource) throws SQLException, IOException {
56
    //    String id = ware.getId();
57
    //    if (wareDao.update(con, ware) > 0) {
58
    //        this.saveSmallImg(ware.getImages());
59
    //        if (ware.getState().equals("1")) {
60
    //            keyWordService.refreshWare(con, id, ware.getKeywords());
61
    //        } else {
62
    //            keyWordService.deleteWare(con, id);
63
    //        }
64
    //        wareDao.deleteWareRes(con, id);
65
    //        if (resource != null && resource.length > 0) {
66
    //            for (String rid : resource) {
67
    //                WareRes wr = new WareRes();
68
    //                wr.setId(id);
69
    //                wr.setResource(rid);
70
    //                wareDao.insert(con, wr);
71
    //            }
72
    //        }
73
    //        wareDao.deleteWarePro(con, id);
74
    //        if (professor != null && professor.length > 0) {
75
    //            for (String pid : professor) {
76
    //                WarePro wp = new WarePro();
77
    //                wp.setId(id);
78
    //                wp.setProfessor(pid);
79
    //                wareDao.insert(con, wp);
80
    //            }
81
    //        }
82
    //        return true;
83
    //    }
84
    //    return false;
85
    //}
86
    //
87
    //private void saveSmallImg(String imgs) throws IOException {
88
    //    if (imgs != null) {
89
    //        List<String> list = ListUtil.splitTrimExcludeEmpty(imgs, ',');
90
    //        if (list.size() > 0) {
91
    //            String oname = list.get(0);
92
    //            if (oname != null) {
93
    //                if (oname.startsWith("/")) {
94
    //                    oname = oname.substring(1);
95
    //                    int idx = oname.indexOf('.');
96
    //                    if (idx > 0) {
97
    //                        String dname = oname.substring(0, idx) + "_s.jpg";
98
    //                        File dest = new File(this.imgPath, dname);
99
    //                        if (dest.exists())
100
    //                            return;
101
    //                        File src = new File(this.imgPath, oname);
102
    //                        if (src.exists()) {
103
    //                            byte[] obs = IoUtil.readStream(new FileInputStream(src), true);
104
    //                            obs = JpgUtil.read(obs);
105
    //                            FileOutputStream out = new FileOutputStream(dest);
106
    //                            try {
107
    //                                JpgUtil.scalingZoom(new ByteArrayInputStream(obs), out, this.imgMaxWidth);
108
    //                                out.flush();
109
    //                            } finally {
110
    //                                IoUtil.close(out);
111
    //                            }
112
    //                        }
113
    //                    }
114
    //                }
115
    //            }
116
    //        }
117
    //    }
118
    //}
119
120
    @Path("/pq")
121
    @Get
122
    public PageQueryResult<WareInfo> pageQueryResult (@JdbcConn Connection con, @Nullable String name, @Nullable String author, int orderBy, @Nullable String bt, @Nullable String et, @DefaultValue("1")int pageNo,@DefaultValue("10")int pageSize)throws SQLException {
123
        if (orderBy == 1) {
124
            return this.wareDao.queryByTime(con,name==null?null:"%"+name+"%",author==null?null:"%"+author+"%",bt == null?null:bt+"000000", et == null ? null : et + "235959", pageSize, pageNo);
125
        } else if (orderBy == 2) {
126
            return this.wareDao.queryByPV(con, name == null ? null : "%" + name + "%", author == null ? null : "%" + author + "%", bt == null ? null : bt + "000000", et == null ? null : et + "235959", pageSize, pageNo);
127
        }else {
128
            return null;
129
        }
130
    }
131
132
    @Post
133
    @Path(" /deleteWare")
134
    public void deleteWare(@JdbcConn(true)Connection con,String[] ids)throws SQLException {
135
        this.wareDao.logicDelete(con, ids);
136
    }
137
138
    @Post
139
    @Path("/sortFirst")
140
    public void updateSortFirst(@JdbcConn(true)Connection con,String id,long sortFirst)throws SQLException {
141
        this.wareDao.updateSortFirst(con, id, sortFirst);
142
    }
143
144
    @Get
145
    @Path("/id/{id}")
146
    public WareInfo query(@JdbcConn Connection con,@PathVar String id)throws SQLException {
147
        return this.wareDao.query(con, id);
148
    }
149
150
    @Post
151
    @Path("/kw")
152
    public void updateKw(@JdbcConn(true)Connection con,String id,@Nullable String kw)throws SQLException {
153
        this.wareDao.updateKw(con, id, kw);
154
        this.keyWordService.refreshWare(con, id, kw);
155
    }
156
157
158
159
}