Parcourir la Source

服务专利资源的平台浏览量统计

XMTT 6 ans auparavant
Parent
commit
562836ded8

+ 18 - 15
src/main/java/com/ekexiu/portal/views/dao/DayDao.java

25
25
26
@DAO
26
@DAO
27
public abstract class DayDao {
27
public abstract class DayDao {
28
    public List<DayData> query(Connection con, String tablePrefix, String[] srcs, String[] ids, String bt, String et, String sortStr) throws SQLException {
28
    public List<DayData> query(Connection con, String tablePrefix,String platform, String[] srcs, String[] ids, String bt, String et, String sortStr) throws SQLException {
29
        StringBuilder sb = new StringBuilder();
29
        StringBuilder sb = new StringBuilder();
30
        boolean hasSource = srcs != null && srcs.length > 0;
30
        boolean hasSource = srcs != null && srcs.length > 0;
31
        boolean hasid = ids != null && ids.length > 0;
31
        boolean hasid = ids != null && ids.length > 0;
32
        sb.append("SELECT ID,DAY,SOURCE,PV FROM ").append(tablePrefix).append("_DAY WHERE DAY>=? AND DAY<=?");
32
        sb.append("SELECT ID,DAY,SOURCE,PV FROM ").append(tablePrefix).append("_DAY WHERE PLATFORM = ? AND DAY>=? AND DAY<=?");
33
        if (hasSource) {
33
        if (hasSource) {
34
            sb.append(" AND SOURCE IN(");
34
            sb.append(" AND SOURCE IN(");
35
            for (int i = 0; i < srcs.length; ++i) {
35
            for (int i = 0; i < srcs.length; ++i) {
50
        int idx = 1;
50
        int idx = 1;
51
        java.sql.PreparedStatement ps = con.prepareStatement(sb.toString());
51
        java.sql.PreparedStatement ps = con.prepareStatement(sb.toString());
52
        try {
52
        try {
53
            ps.setString(idx++,platform);
53
            ps.setString(idx++, bt);
54
            ps.setString(idx++, bt);
54
            ps.setString(idx++, et);
55
            ps.setString(idx++, et);
55
            if (hasSource) {
56
            if (hasSource) {
88
        }
89
        }
89
    }
90
    }
90
91
91
    public List<DayData> query(Connection con, String tablePrefix, String id, String bt, String et) throws SQLException {
92
    public List<DayData> query(Connection con, String tablePrefix,String platform, String id, String bt, String et) throws SQLException {
92
        StringBuilder sb = new StringBuilder();
93
        StringBuilder sb = new StringBuilder();
93
        sb.append("SELECT ID,DAY,SOURCE,PV FROM ").append(tablePrefix).append("_DAY WHERE DAY>=? AND DAY<=? AND ID=? ORDER BY DAY");
94
        sb.append("SELECT ID,DAY,SOURCE,PV FROM ").append(tablePrefix).append("_DAY WHERE PLATFORM = ? AND DAY>=? AND DAY<=? AND ID=? ORDER BY DAY");
94
        java.sql.PreparedStatement ps = con.prepareStatement(sb.toString());
95
        java.sql.PreparedStatement ps = con.prepareStatement(sb.toString());
95
        try {
96
        try {
96
            ps.setString(1, bt);
97
            ps.setString(2, et);
98
            ps.setString(3, id);
97
            ps.setString(1,platform);
98
            ps.setString(2, bt);
99
            ps.setString(3, et);
100
            ps.setString(4, id);
99
            List<DayData> ret = new LinkedList<DayData>();
101
            List<DayData> ret = new LinkedList<DayData>();
100
            java.sql.ResultSet rs = ps.executeQuery();
102
            java.sql.ResultSet rs = ps.executeQuery();
101
            try {
103
            try {
122
        }
124
        }
123
    }
125
    }
124
126
125
    public List<DayData> query(Connection con, String tablePrefix, String bt, String et, @Nullable String[] srcs, int rows) throws SQLException {
127
    public List<DayData> query(Connection con, String tablePrefix,String platform, String bt, String et, @Nullable String[] srcs, int rows) throws SQLException {
126
        boolean hasSource = srcs != null && srcs.length > 0;
128
        boolean hasSource = srcs != null && srcs.length > 0;
127
        StringBuilder sb = new StringBuilder();
129
        StringBuilder sb = new StringBuilder();
128
        sb.append("SELECT ID,SUM(PV) PV FROM ").append(tablePrefix).append("_DAY WHERE DAY>=? AND DAY<=?");
130
        sb.append("SELECT ID,SUM(PV) PV FROM ").append(tablePrefix).append("_DAY WHERE PLATFORM = ? AND DAY>=? AND DAY<=?");
129
        if (hasSource) {
131
        if (hasSource) {
130
            sb.append(" AND SOURCE IN (");
132
            sb.append(" AND SOURCE IN (");
131
            for (int i = 0; i < srcs.length; ++i) {
133
            for (int i = 0; i < srcs.length; ++i) {
137
        java.sql.PreparedStatement ps = con.prepareStatement(sb.toString());
139
        java.sql.PreparedStatement ps = con.prepareStatement(sb.toString());
138
        try {
140
        try {
139
            int idx = 1;
141
            int idx = 1;
142
            ps.setString(idx++,platform);
140
            ps.setString(idx++, bt);
143
            ps.setString(idx++, bt);
141
            ps.setString(idx++, et);
144
            ps.setString(idx++, et);
142
            if (hasSource) {
145
            if (hasSource) {
172
    @PageQuery
175
    @PageQuery
173
    @OrderBy("ORDER BY c.MODIFY_TIME DESC NULLS LAST")
176
    @OrderBy("ORDER BY c.MODIFY_TIME DESC NULLS LAST")
174
    @Exclude("descp")
177
    @Exclude("descp")
175
    public abstract PageQueryResult<WareSum> queryWareTime(Connection con, @Nullable @Like String name, @Nullable @GroupSqlColumn(handlerClass = StringHandler.class, value = {
178
    public abstract PageQueryResult<WareSum> queryWareTime(Connection con, String platform, @Nullable @Like String name, @Nullable @GroupSqlColumn(handlerClass = StringHandler.class, value = {
176
            "CATEGORY='1' AND OWNER IN(SELECT ID FROM PROFESSOR WHERE NAME LIKE ?)",
179
            "CATEGORY='1' AND OWNER IN(SELECT ID FROM PROFESSOR WHERE NAME LIKE ?)",
177
            "CATEGORY ='2' AND OWNER IN(SELECT ID FROM ORGANIZATION WHERE NAME LIKE ? OR FOR_SHORT LIKE ?)"},
180
            "CATEGORY ='2' AND OWNER IN(SELECT ID FROM ORGANIZATION WHERE NAME LIKE ? OR FOR_SHORT LIKE ?)"},
178
            additional = 1, isAnd = false, force = true) String author, @Nullable @GtEq @Alias("modifyTime") String bt, @Nullable @Alias("modifyTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
181
            additional = 1, isAnd = false, force = true) String author, @Nullable @GtEq @Alias("modifyTime") String bt, @Nullable @Alias("modifyTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
180
    @PageQuery
183
    @PageQuery
181
    @OrderBy("ORDER BY cds.SUM DESC")
184
    @OrderBy("ORDER BY cds.SUM DESC")
182
    @Exclude("descp")
185
    @Exclude("descp")
183
    public abstract PageQueryResult<WareSum> queryWareViews(Connection con, @Nullable @Like String name, @Nullable @GroupSqlColumn(handlerClass = StringHandler.class, value = {
186
    public abstract PageQueryResult<WareSum> queryWareViews(Connection con, String platform, @Nullable @Like String name, @Nullable @GroupSqlColumn(handlerClass = StringHandler.class, value = {
184
            "CATEGORY='1' AND OWNER IN(SELECT ID FROM PROFESSOR WHERE NAME LIKE ?)",
187
            "CATEGORY='1' AND OWNER IN(SELECT ID FROM PROFESSOR WHERE NAME LIKE ?)",
185
            "CATEGORY ='2' AND OWNER IN(SELECT ID FROM ORGANIZATION WHERE NAME LIKE ? OR FOR_SHORT LIKE ?)"},
188
            "CATEGORY ='2' AND OWNER IN(SELECT ID FROM ORGANIZATION WHERE NAME LIKE ? OR FOR_SHORT LIKE ?)"},
186
            additional = 1, isAnd = false, force = true) String author, @Nullable @GtEq @Alias("modifyTime") String bt, @Nullable @Alias("modifyTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
189
            additional = 1, isAnd = false, force = true) String author, @Nullable @GtEq @Alias("modifyTime") String bt, @Nullable @Alias("modifyTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
188
    @Exclude("summary")
191
    @Exclude("summary")
189
    @PageQuery
192
    @PageQuery
190
    @OrderBy("ORDER BY c.CREATE_TIME DESC NULLS LAST")
193
    @OrderBy("ORDER BY c.CREATE_TIME DESC NULLS LAST")
191
    public abstract PageQueryResult<PpatentSum> queryPpatentTime(Connection con, @Nullable @Like String name,@Nullable @Like String authors,@Nullable @GtEq @Alias("createTime") String bt, @Nullable @Alias("createTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
194
    public abstract PageQueryResult<PpatentSum> queryPpatentTime(Connection con, String platform, @Nullable @Like String name,@Nullable @Like String authors,@Nullable @GtEq @Alias("createTime") String bt, @Nullable @Alias("createTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
192
195
193
    @Exclude("summary")
196
    @Exclude("summary")
194
    @PageQuery
197
    @PageQuery
195
    @OrderBy("ORDER BY cds.SUM DESC NULLS LAST")
198
    @OrderBy("ORDER BY cds.SUM DESC NULLS LAST")
196
    public abstract PageQueryResult<PpatentSum> queryPpatentViews(Connection con, @Nullable @Like String name,@Nullable @Like String authors,@Nullable @GtEq @Alias("createTime") String bt, @Nullable @Alias("createTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
199
    public abstract PageQueryResult<PpatentSum> queryPpatentViews(Connection con, String platform, @Nullable @Like String name,@Nullable @Like String authors,@Nullable @GtEq @Alias("createTime") String bt, @Nullable @Alias("createTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
197
200
198
201
199
    @PageQuery
202
    @PageQuery
200
    @OrderBy(" ORDER BY c.publish_time DESC NULLS LAST")
203
    @OrderBy(" ORDER BY c.publish_time DESC NULLS LAST")
201
    @Exclude("descp")
204
    @Exclude("descp")
202
    public abstract PageQueryResult<ResourceSum> queryResourceTime(Connection con, @Nullable @Like String resourceName,@Nullable @GroupSqlColumn(handlerClass = StringHandler.class, value = {
205
    public abstract PageQueryResult<ResourceSum> queryResourceTime(Connection con, String platform, @Nullable @Like String resourceName,@Nullable @GroupSqlColumn(handlerClass = StringHandler.class, value = {
203
            "RESOURCE_TYPE='1' AND PROFESSOR_ID IN(SELECT ID FROM PROFESSOR WHERE NAME LIKE ?)",
206
            "RESOURCE_TYPE='1' AND PROFESSOR_ID IN(SELECT ID FROM PROFESSOR WHERE NAME LIKE ?)",
204
            "RESOURCE_TYPE ='2' AND ORGANIZATION_ID IN(SELECT ID FROM ORGANIZATION WHERE NAME LIKE ? OR FOR_SHORT LIKE ?)"},
207
            "RESOURCE_TYPE ='2' AND ORGANIZATION_ID IN(SELECT ID FROM ORGANIZATION WHERE NAME LIKE ? OR FOR_SHORT LIKE ?)"},
205
            additional = 1, isAnd = false, force = true) String author, @Nullable @GtEq @Alias("publishTime") String bt, @Nullable @Alias("publishTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
208
            additional = 1, isAnd = false, force = true) String author, @Nullable @GtEq @Alias("publishTime") String bt, @Nullable @Alias("publishTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
207
    @PageQuery
210
    @PageQuery
208
    @OrderBy(" ORDER BY cds.sum DESC")
211
    @OrderBy(" ORDER BY cds.sum DESC")
209
    @Exclude("descp")
212
    @Exclude("descp")
210
    public abstract PageQueryResult<ResourceSum> queryResourceViews(Connection con, @Nullable @Like String resourceName,@Nullable @GroupSqlColumn(handlerClass = StringHandler.class, value = {
213
    public abstract PageQueryResult<ResourceSum> queryResourceViews(Connection con, String platform, @Nullable @Like String resourceName,@Nullable @GroupSqlColumn(handlerClass = StringHandler.class, value = {
211
            "RESOURCE_TYPE='1' AND PROFESSOR_ID IN(SELECT ID FROM PROFESSOR WHERE NAME LIKE ?)",
214
            "RESOURCE_TYPE='1' AND PROFESSOR_ID IN(SELECT ID FROM PROFESSOR WHERE NAME LIKE ?)",
212
            "RESOURCE_TYPE ='2' AND ORGANIZATION_ID IN(SELECT ID FROM ORGANIZATION WHERE NAME LIKE ? OR FOR_SHORT LIKE ?)"},
215
            "RESOURCE_TYPE ='2' AND ORGANIZATION_ID IN(SELECT ID FROM ORGANIZATION WHERE NAME LIKE ? OR FOR_SHORT LIKE ?)"},
213
            additional = 1, isAnd = false, force = true) String author, @Nullable @GtEq @Alias("publishTime") String bt, @Nullable @Alias("publishTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
216
            additional = 1, isAnd = false, force = true) String author, @Nullable @GtEq @Alias("publishTime") String bt, @Nullable @Alias("publishTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;

+ 12 - 0
src/main/java/com/ekexiu/portal/views/pojo/PpatentSum.java

4
import org.jfw.apt.orm.annotation.entry.CalcColumn;
4
import org.jfw.apt.orm.annotation.entry.CalcColumn;
5
import org.jfw.apt.orm.annotation.entry.ExtendView;
5
import org.jfw.apt.orm.annotation.entry.ExtendView;
6
import org.jfw.apt.orm.core.defaultImpl.IntHandler;
6
import org.jfw.apt.orm.core.defaultImpl.IntHandler;
7
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
7
8
8
/**
9
/**
9
 * Created by TT on 2019/3/14.
10
 * Created by TT on 2019/3/14.
11
@ExtendView(fromSentence = "ppatent c INNER JOIN ppatent_day_sum cds on c.id = cds.id", tableAlias = "c")
12
@ExtendView(fromSentence = "ppatent c INNER JOIN ppatent_day_sum cds on c.id = cds.id", tableAlias = "c")
12
public class PpatentSum extends Ppatent {
13
public class PpatentSum extends Ppatent {
13
    private int sum;
14
    private int sum;
15
    private String platform;
16
17
    @CalcColumn(handlerClass = StringHandler.class, column = "cds.platform")
18
    public String getPlatform() {
19
        return platform;
20
    }
21
22
    public void setPlatform(String platform) {
23
        this.platform = platform;
24
    }
25
14
26
15
    @CalcColumn(handlerClass = IntHandler.class, column = "cds.sum")
27
    @CalcColumn(handlerClass = IntHandler.class, column = "cds.sum")
16
    public int getSum() {
28
    public int getSum() {

+ 12 - 0
src/main/java/com/ekexiu/portal/views/pojo/ResourceSum.java

4
import org.jfw.apt.orm.annotation.entry.CalcColumn;
4
import org.jfw.apt.orm.annotation.entry.CalcColumn;
5
import org.jfw.apt.orm.annotation.entry.ExtendView;
5
import org.jfw.apt.orm.annotation.entry.ExtendView;
6
import org.jfw.apt.orm.core.defaultImpl.IntHandler;
6
import org.jfw.apt.orm.core.defaultImpl.IntHandler;
7
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
7
8
8
/**
9
/**
9
 * Created by TT on 2019/3/14.
10
 * Created by TT on 2019/3/14.
12
public class ResourceSum extends Resource {
13
public class ResourceSum extends Resource {
13
    private int sum;
14
    private int sum;
14
15
16
    private String platform;
17
18
    @CalcColumn(handlerClass = StringHandler.class, column = "cds.platform")
19
    public String getPlatform() {
20
        return platform;
21
    }
22
23
    public void setPlatform(String platform) {
24
        this.platform = platform;
25
    }
26
15
    @CalcColumn(handlerClass = IntHandler.class, column = "cds.sum")
27
    @CalcColumn(handlerClass = IntHandler.class, column = "cds.sum")
16
    public int getSum() {
28
    public int getSum() {
17
        return sum;
29
        return sum;

+ 11 - 0
src/main/java/com/ekexiu/portal/views/pojo/WareSum.java

4
import org.jfw.apt.orm.annotation.entry.CalcColumn;
4
import org.jfw.apt.orm.annotation.entry.CalcColumn;
5
import org.jfw.apt.orm.annotation.entry.ExtendView;
5
import org.jfw.apt.orm.annotation.entry.ExtendView;
6
import org.jfw.apt.orm.core.defaultImpl.IntHandler;
6
import org.jfw.apt.orm.core.defaultImpl.IntHandler;
7
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
7
8
8
/**
9
/**
9
 * Created by TT on 2019/3/14.
10
 * Created by TT on 2019/3/14.
11
@ExtendView(fromSentence = "ware c INNER JOIN ware_day_sum cds on c.id = cds.id", tableAlias = "c")
12
@ExtendView(fromSentence = "ware c INNER JOIN ware_day_sum cds on c.id = cds.id", tableAlias = "c")
12
public class WareSum extends Ware {
13
public class WareSum extends Ware {
13
    private int sum;
14
    private int sum;
15
    private String platform;
16
17
    @CalcColumn(handlerClass = StringHandler.class, column = "cds.platform")
18
    public String getPlatform() {
19
        return platform;
20
    }
21
22
    public void setPlatform(String platform) {
23
        this.platform = platform;
24
    }
14
25
15
    @CalcColumn(handlerClass = IntHandler.class, column = "cds.sum")
26
    @CalcColumn(handlerClass = IntHandler.class, column = "cds.sum")
16
    public int getSum() {
27
    public int getSum() {

+ 23 - 21
src/main/java/com/ekexiu/portal/views/service/Main.java

70
70
71
    @Get
71
    @Get
72
    @Path("/qm")
72
    @Path("/qm")
73
    public List<DayData> query(@JdbcConn Connection con, String tn, @Nullable String[] src, @Nullable String[] id, @DefaultValue("com.ekexiu.portal.views.service.Main.MIN_DAY") String bt,
73
    public List<DayData> query(@JdbcConn Connection con, String tn,String platform, @Nullable String[] src, @Nullable String[] id, @DefaultValue("com.ekexiu.portal.views.service.Main.MIN_DAY") String bt,
74
                               @DefaultValue("com.ekexiu.portal.views.service.Main.MAX_DAY") String et, @Nullable String sort) throws SQLException, JfwBaseException {
74
                               @DefaultValue("com.ekexiu.portal.views.service.Main.MAX_DAY") String et, @Nullable String sort) throws SQLException, JfwBaseException {
75
        if (!this.tns.contains(tn)) {
75
        if (!this.tns.contains(tn)) {
76
            throw new JfwBaseException(-101, "unavailable tn");
76
            throw new JfwBaseException(-101, "unavailable tn");
77
        }
77
        }
78
        return dayDao.query(con, tn, src, id, bt, et, sort);
78
        return dayDao.query(con, tn,platform, src, id, bt, et, sort);
79
    }
79
    }
80
80
81
    @Get
81
    @Get
82
    @Path("/qo")
82
    @Path("/qo")
83
    public List<DayData> query(@JdbcConn Connection con, String tn, String id, @DefaultValue("com.ekexiu.portal.views.service.Main.MIN_DAY") String bt,
83
    public List<DayData> query(@JdbcConn Connection con, String tn,String platform, String id, @DefaultValue("com.ekexiu.portal.views.service.Main.MIN_DAY") String bt,
84
                               @DefaultValue("com.ekexiu.portal.views.service.Main.MAX_DAY") String et) throws SQLException, JfwBaseException {
84
                               @DefaultValue("com.ekexiu.portal.views.service.Main.MAX_DAY") String et) throws SQLException, JfwBaseException {
85
        if (!this.tns.contains(tn)) {
85
        if (!this.tns.contains(tn)) {
86
            throw new JfwBaseException(-101, "unavailable tn");
86
            throw new JfwBaseException(-101, "unavailable tn");
87
        }
87
        }
88
        return dayDao.query(con, tn, id, bt, et);
88
        return dayDao.query(con, tn,platform, id, bt, et);
89
    }
89
    }
90
90
91
    @Get
91
    @Get
92
    @Path("/qo/sum")
92
    @Path("/qo/sum")
93
    public int query(@JdbcConn Connection con, String tn, final String id) throws SQLException,JfwBaseException {
93
    public int query(@JdbcConn Connection con, String tn, final String platform, final String id) throws SQLException,JfwBaseException {
94
        if (!this.tns.contains(tn)) {
94
        if (!this.tns.contains(tn)) {
95
            throw new JfwBaseException(-101, "unavailable tn");
95
            throw new JfwBaseException(-101, "unavailable tn");
96
        }
96
        }
97
        return JdbcUtil.queryInt(con, "SELECT SUM FROM " + tn + "_DAY_SUM WHERE ID = ?", new PreparedStatementConfig() {
97
        return JdbcUtil.queryInt(con, "SELECT SUM FROM " + tn + "_DAY_SUM WHERE PLATFORM = ? AND ID = ?", new PreparedStatementConfig() {
98
            @Override
98
            @Override
99
            public void config(PreparedStatement preparedStatement) throws SQLException {
99
            public void config(PreparedStatement preparedStatement) throws SQLException {
100
                preparedStatement.setString(1, id);
100
                preparedStatement.setString(1,platform);
101
                preparedStatement.setString(2, id);
101
            }
102
            }
102
        }, 0);
103
        }, 0);
103
    }
104
    }
104
105
105
    @Get
106
    @Get
106
    @Path("/qs")
107
    @Path("/qs")
107
    public List<DayData> query(@JdbcConn Connection con, String tn, @Nullable String[] src, @DefaultValue("com.ekexiu.portal.views.service.Main.MIN_DAY") String bt,
108
    public List<DayData> query(@JdbcConn Connection con, String tn,String platform, @Nullable String[] src, @DefaultValue("com.ekexiu.portal.views.service.Main.MIN_DAY") String bt,
108
                               @DefaultValue("com.ekexiu.portal.views.service.Main.MAX_DAY") String et, @DefaultValue("20") int rows) throws SQLException, JfwBaseException {
109
                               @DefaultValue("com.ekexiu.portal.views.service.Main.MAX_DAY") String et, @DefaultValue("20") int rows) throws SQLException, JfwBaseException {
109
        if (!this.tns.contains(tn)) {
110
        if (!this.tns.contains(tn)) {
110
            throw new JfwBaseException(-101, "unavailable tn");
111
            throw new JfwBaseException(-101, "unavailable tn");
111
        }
112
        }
112
        return dayDao.query(con, tn, bt, et, src, rows);
113
        return dayDao.query(con, tn,platform, bt, et, src, rows);
113
    }
114
    }
114
115
115
    @Get
116
    @Get
116
    @Path("/total")
117
    @Path("/total")
117
    public List<Map<String, Object>> total(@JdbcConn Connection con,String tn, @DefaultValue("com.ekexiu.portal.views.service.Main.MIN_DAY") final String bt) throws SQLException, JfwBaseException {
118
    public List<Map<String, Object>> total(@JdbcConn Connection con, String tn, final String platform, @DefaultValue("com.ekexiu.portal.views.service.Main.MIN_DAY") final String bt) throws SQLException, JfwBaseException {
118
        if (!this.tns.contains(tn)) {
119
        if (!this.tns.contains(tn)) {
119
            throw new JfwBaseException(-101, "unavailable tn");
120
            throw new JfwBaseException(-101, "unavailable tn");
120
        }
121
        }
121
        return JdbcUtil.queryMaps(con, "SELECT day,sum(pv)as pv,source FROM "+tn+"_day WHERE day>=? GROUP BY day,source ORDER BY day DESC ", new PreparedStatementConfig() {
122
        return JdbcUtil.queryMaps(con, "SELECT day,sum(pv)as pv,source FROM "+tn+"_day WHERE PLATFORM = ? AND day>=? GROUP BY day,source ORDER BY day DESC ", new PreparedStatementConfig() {
122
            @Override
123
            @Override
123
            public void config(PreparedStatement preparedStatement) throws SQLException {
124
            public void config(PreparedStatement preparedStatement) throws SQLException {
124
                preparedStatement.setString(1, bt);
125
                preparedStatement.setString(1,platform);
126
                preparedStatement.setString(2, bt);
125
            }
127
            }
126
        });
128
        });
127
    }
129
    }
129
131
130
    @Get
132
    @Get
131
    @Path("/ware/pq")
133
    @Path("/ware/pq")
132
    public PageQueryResult<WareSum> queryWare(@JdbcConn Connection con, @Nullable String name,@Nullable String author, @Nullable String bt, @Nullable String et, String orderBy, int pageSize, int pageNo) throws SQLException {
134
    public PageQueryResult<WareSum> queryWare(@JdbcConn Connection con, String platform, @Nullable String name,@Nullable String author, @Nullable String bt, @Nullable String et, String orderBy, int pageSize, int pageNo) throws SQLException {
133
        if (orderBy.equals("1")) {
135
        if (orderBy.equals("1")) {
134
            return dayDao.queryWareTime(con, name == null ? null : "%" + name + "%", author == null ? null : "%" + author + "%", bt, et, pageSize, pageNo);
136
            return dayDao.queryWareTime(con, platform, name == null ? null : "%" + name + "%", author == null ? null : "%" + author + "%", bt, et, pageSize, pageNo);
135
        } else if (orderBy.equals("2")) {
137
        } else if (orderBy.equals("2")) {
136
            return dayDao.queryWareViews(con, name == null ? null : "%" + name + "%", author == null ? null : "%" + author + "%",  bt, et, pageSize, pageNo);
138
            return dayDao.queryWareViews(con, platform, name == null ? null : "%" + name + "%", author == null ? null : "%" + author + "%",  bt, et, pageSize, pageNo);
137
        }
139
        }
138
        return null;
140
        return null;
139
    }
141
    }
140
142
141
    @Get
143
    @Get
142
    @Path("/ppatent/pq")
144
    @Path("/ppatent/pq")
143
    public PageQueryResult<PpatentSum> queryPpatent(@JdbcConn Connection con, @Nullable String name, @Nullable String author, @Nullable String bt, @Nullable String et, String orderBy, int pageSize, int pageNo) throws SQLException {
145
    public PageQueryResult<PpatentSum> queryPpatent(@JdbcConn Connection con, String platform, @Nullable String name, @Nullable String author, @Nullable String bt, @Nullable String et, String orderBy, int pageSize, int pageNo) throws SQLException {
144
        if (orderBy.equals("1")) {
146
        if (orderBy.equals("1")) {
145
            return dayDao.queryPpatentTime(con, name == null ? null : "%" + name + "%", author == null ? null : "%" + author + "%", bt, et, pageSize, pageNo);
147
            return dayDao.queryPpatentTime(con, platform, name == null ? null : "%" + name + "%", author == null ? null : "%" + author + "%", bt, et, pageSize, pageNo);
146
        } else if (orderBy.equals("2")) {
148
        } else if (orderBy.equals("2")) {
147
            return dayDao.queryPpatentViews(con, name == null ? null : "%" + name + "%", author == null ? null : "%" + author + "%",  bt, et, pageSize, pageNo);
149
            return dayDao.queryPpatentViews(con, platform, name == null ? null : "%" + name + "%", author == null ? null : "%" + author + "%",  bt, et, pageSize, pageNo);
148
        }
150
        }
149
        return null;
151
        return null;
150
    }
152
    }
151
153
152
    @Get
154
    @Get
153
    @Path("/resource/pq")
155
    @Path("/resource/pq")
154
    public PageQueryResult<ResourceSum> queryResource(@JdbcConn Connection con, @Nullable String name, @Nullable String author, @Nullable String bt, @Nullable String et, String orderBy, int pageSize, int pageNo) throws SQLException {
156
    public PageQueryResult<ResourceSum> queryResource(@JdbcConn Connection con, String platform, @Nullable String name, @Nullable String author, @Nullable String bt, @Nullable String et, String orderBy, int pageSize, int pageNo) throws SQLException {
155
        if (orderBy.equals("1")) {
157
        if (orderBy.equals("1")) {
156
            return dayDao.queryResourceTime(con, name == null ? null : "%" + name + "%", author == null ? null : "%" + author + "%", bt, et, pageSize, pageNo);
158
            return dayDao.queryResourceTime(con, platform, name == null ? null : "%" + name + "%", author == null ? null : "%" + author + "%", bt, et, pageSize, pageNo);
157
        } else if (orderBy.equals("2")) {
159
        } else if (orderBy.equals("2")) {
158
            return dayDao.queryResourceViews(con, name == null ? null : "%" + name + "%", author == null ? null : "%" + author + "%",  bt, et, pageSize, pageNo);
160
            return dayDao.queryResourceViews(con, platform, name == null ? null : "%" + name + "%", author == null ? null : "%" + author + "%",  bt, et, pageSize, pageNo);
159
        }
161
        }
160
        return null;
162
        return null;
161
    }
163
    }