XMTT 6 年 前
コミット
1d4ad6830b

+ 0 - 1
src/main/java/com/ekexiu/project/platform/article/Article.java

@ -170,7 +170,6 @@ public class Article implements ManagedBaseTable {
170 170
    }
171 171

172 172
    @Column(descp = "关键词", value = DE.Text_de)
173

174 173
    public String getKeyWords() {
175 174
        return keyWords;
176 175
    }

+ 28 - 0
src/main/java/com/ekexiu/project/platform/views/dao/DayDao.java

@ -1,15 +1,22 @@
1 1
package com.ekexiu.project.platform.views.dao;
2 2
3 3
import com.ekexiu.project.platform.views.pojo.ArticleSum;
4
import com.ekexiu.project.platform.views.pojo.CompanySum;
4 5
import com.ekexiu.project.platform.views.pojo.DayData;
6
import com.ekexiu.project.platform.views.pojo.OrgSum;
7
import com.ekexiu.project.platform.views.pojo.ProductSum;
8
import com.ekexiu.project.platform.views.pojo.ProfessorSum;
5 9
import org.jfw.apt.annotation.Nullable;
6 10
import org.jfw.apt.orm.annotation.dao.DAO;
7 11
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
8 12
import org.jfw.apt.orm.annotation.dao.method.operator.PageQuery;
13
import org.jfw.apt.orm.annotation.dao.method.operator.QueryList;
9 14
import org.jfw.apt.orm.annotation.dao.param.Alias;
15
import org.jfw.apt.orm.annotation.dao.param.GroupSqlColumn;
10 16
import org.jfw.apt.orm.annotation.dao.param.GtEq;
11 17
import org.jfw.apt.orm.annotation.dao.param.Like;
12 18
import org.jfw.apt.orm.annotation.dao.param.LtEq;
19
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
13 20
import org.jfw.util.PageQueryResult;
14 21
15 22
import java.sql.Connection;
@ -164,5 +171,26 @@ public abstract class DayDao {
164 171
	@OrderBy("ORDER BY ads.sum DESC")
165 172
	public abstract PageQueryResult<ArticleSum> queryByViews(Connection con, @Nullable String catalog, @Nullable @Like String title, @Nullable @Like String source, @Nullable String creator, @Nullable Boolean published, @Nullable @GtEq @Alias("modifyTime") String bt, @Nullable @Alias("modifyTime") @LtEq String et, int pageSize, int pageNo)throws SQLException;
166 173
174
	@PageQuery
175
	@OrderBy("ORDER BY c.CREATE_TIME DESC")
176
	public abstract PageQueryResult<CompanySum> queryByTime(Connection con, @Nullable @Like String name, @Nullable @GroupSqlColumn(handlerClass = StringHandler.class,value = " ID IN (SELECT ID FROM COMP_KEY WHERE VALUE LIKE ? AND TYPE = 1)",isAnd = false) String industry, @Nullable Boolean actived, @Nullable @GtEq @Alias("modifyTime") String bt, @Nullable @Alias("modifyTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
177
178
	@PageQuery
179
	@OrderBy("ORDER BY cds.sum DESC")
180
	public abstract PageQueryResult<CompanySum> queryByViews(Connection con, @Nullable @Like String name, @Nullable @GroupSqlColumn(handlerClass = StringHandler.class,value = " ID IN (SELECT ID FROM COMP_KEY WHERE VALUE LIKE ? AND TYPE = 1)",isAnd = false) String industry, @Nullable Boolean actived, @Nullable @GtEq @Alias("createTime") String bt, @Nullable @Alias("createTime") @LtEq String et, int pageSize, int pageNo)throws SQLException;
181
182
	@PageQuery
183
	@OrderBy("ORDER BY c.CREATE_TIME DESC")
184
	public abstract PageQueryResult<ProductSum> queryByTime(Connection con, @Nullable @Like String name, @Nullable String companyId, @Nullable @GtEq @Alias("modifyTime") String bt, @Nullable @Alias("modifyTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
185
186
	@PageQuery
187
	@OrderBy("ORDER BY cds.sum DESC")
188
	public abstract PageQueryResult<ProductSum> queryByViews(Connection con, @Nullable @Like String name, @Nullable String companyId, @Nullable @GtEq @Alias("createTime") String bt, @Nullable @Alias("createTime") @LtEq String et, int pageSize, int pageNo)throws SQLException;
189
190
	@QueryList
191
	public abstract List<ProfessorSum> queryProSum(Connection con) throws SQLException;
192
193
	@QueryList
194
	public abstract List<OrgSum> queryOrgSum(Connection con) throws SQLException;
167 195
168 196
}

+ 24 - 0
src/main/java/com/ekexiu/project/platform/views/pojo/CompanySum.java

@ -0,0 +1,24 @@
1
package com.ekexiu.project.platform.views.pojo;
2
3
import com.ekexiu.project.platform.company.Company;
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.IntHandler;
7
8
/**
9
 * Created by TT on 2019/3/13.
10
 */
11
@ExtendView(fromSentence = "company c INNER JOIN company_day_sum cds on c.id = cds.id",tableAlias = "c")
12
public class CompanySum extends Company {
13
    private int sum;
14
15
    @CalcColumn(handlerClass = IntHandler.class, column = "cds.sum")
16
    public int getSum() {
17
        return sum;
18
    }
19
20
    public void setSum(int sum) {
21
        this.sum = sum;
22
    }
23
}
24

+ 23 - 0
src/main/java/com/ekexiu/project/platform/views/pojo/OrgSum.java

@ -0,0 +1,23 @@
1
package com.ekexiu.project.platform.views.pojo;
2
3
import com.ekexiu.project.platform.organization.Organization;
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.IntHandler;
7
8
/**
9
 * Created by TT on 2019/3/13.
10
 */
11
@ExtendView(fromSentence = "organization c INNER JOIN organization_day_sum cds on c.id = cds.id",tableAlias = "c")
12
public class OrgSum extends Organization {
13
    private int sum;
14
15
    @CalcColumn(handlerClass = IntHandler.class, column = "cds.sum")
16
    public int getSum() {
17
        return sum;
18
    }
19
20
    public void setSum(int sum) {
21
        this.sum = sum;
22
    }
23
}

+ 23 - 0
src/main/java/com/ekexiu/project/platform/views/pojo/ProductSum.java

@ -0,0 +1,23 @@
1
package com.ekexiu.project.platform.views.pojo;
2
3
import com.ekexiu.project.platform.product.Product;
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.IntHandler;
7
8
/**
9
 * Created by TT on 2019/3/13.
10
 */
11
@ExtendView(fromSentence = "product c INNER JOIN product_day_sum cds on c.id = cds.id",tableAlias = "c")
12
public class ProductSum extends Product {
13
    private int sum;
14
15
    @CalcColumn(handlerClass = IntHandler.class, column = "cds.sum")
16
    public int getSum() {
17
        return sum;
18
    }
19
20
    public void setSum(int sum) {
21
        this.sum = sum;
22
    }
23
}

+ 23 - 0
src/main/java/com/ekexiu/project/platform/views/pojo/ProfessorSum.java

@ -0,0 +1,23 @@
1
package com.ekexiu.project.platform.views.pojo;
2
3
import com.ekexiu.project.platform.professor.Professor;
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.IntHandler;
7
8
/**
9
 * Created by TT on 2019/3/13.
10
 */
11
@ExtendView(fromSentence = "professor c INNER JOIN professor_day_sum cds on c.id = cds.id",tableAlias = "c")
12
public class ProfessorSum extends Professor {
13
    private int sum;
14
15
    @CalcColumn(handlerClass = IntHandler.class, column = "cds.sum")
16
    public int getSum() {
17
        return sum;
18
    }
19
20
    public void setSum(int sum) {
21
        this.sum = sum;
22
    }
23
}

+ 38 - 0
src/main/java/com/ekexiu/project/platform/views/service/Main.java

@ -3,7 +3,11 @@ package com.ekexiu.project.platform.views.service;
3 3
import com.ekexiu.project.platform.views.dao.DayDao;
4 4
import com.ekexiu.project.platform.views.handler.LogHandler;
5 5
import com.ekexiu.project.platform.views.pojo.ArticleSum;
6
import com.ekexiu.project.platform.views.pojo.CompanySum;
6 7
import com.ekexiu.project.platform.views.pojo.DayData;
8
import com.ekexiu.project.platform.views.pojo.OrgSum;
9
import com.ekexiu.project.platform.views.pojo.ProductSum;
10
import com.ekexiu.project.platform.views.pojo.ProfessorSum;
7 11
import org.jfw.apt.annotation.Autowrie;
8 12
import org.jfw.apt.annotation.DefaultValue;
9 13
import org.jfw.apt.annotation.Nullable;
@ -121,6 +125,40 @@ public class Main {
121 125
        return null;
122 126
    }
123 127
128
    @Get
129
    @Path("/company/pq")
130
    public PageQueryResult<CompanySum> query(@JdbcConn Connection con, @Nullable String name, @Nullable String industry, @Nullable Boolean actived, @Nullable String bt, @Nullable String et, String orderBy, int pageSize, int pageNo) throws SQLException {
131
        if (orderBy.equals("1")) {
132
            return dayDao.queryByTime(con, name == null ? null : "%" + name + "%", industry == null ? null : "%" + industry + "%", actived, bt, et, pageSize, pageNo);
133
        } else if (orderBy.equals("2")) {
134
            return dayDao.queryByViews(con, name == null ? null : "%" + name + "%", industry == null ? null : "%" + industry + "%", actived, bt, et, pageSize, pageNo);
135
        }
136
        return null;
137
    }
138
139
    @Get
140
    @Path("/product/pq")
141
    public PageQueryResult<ProductSum> query(@JdbcConn Connection con, @Nullable String title, @Nullable String companyId, @Nullable String bt, @Nullable String et, String orderBy, int pageSize, int pageNo) throws SQLException {
142
        if (orderBy.equals("1")) {
143
            return dayDao.queryByTime(con, title == null ? null : "%" + title + "%", companyId, bt, et, pageSize, pageNo);
144
        } else if (orderBy.equals("2")) {
145
            return dayDao.queryByViews(con, title == null ? null : "%" + title + "%", companyId, bt, et, pageSize, pageNo);
146
        }
147
        return null;
148
    }
149
150
    @Get
151
    @Path("/professor/pq")
152
    public List<ProfessorSum> queryProSum(@JdbcConn Connection con) throws SQLException {
153
        return dayDao.queryProSum(con);
154
    }
155
156
    @Get
157
    @Path("/org/pq")
158
    public List<OrgSum> queryOrgSum(@JdbcConn Connection con) throws SQLException {
159
        return dayDao.queryOrgSum(con);
160
    }
161
124 162
    @Get
125 163
    @Path("/total")
126 164
    public List<Map<String, Object>> total(@JdbcConn Connection con,String tn, @DefaultValue("com.ekexiu.project.platform.views.service.Main.MIN_DAY") final String bt) throws SQLException, JfwBaseException {

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

@ -446,3 +446,105 @@ INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('com_eke
446 446
ALTER TABLE public.article ADD key_words text NULL;
447 447
COMMENT ON COLUMN public.article.key_words IS '关键词';
448 448
449
450
CREATE TABLE COMPANY_DAY
451
(
452
        ID TEXT    NOT NULL,
453
        PV INTEGER NOT NULL,
454
        DAY TEXT    NOT NULL,
455
        SOURCE TEXT    NOT NULL
456
);
457
458
CREATE TABLE COMPANY_DAY_SUM(
459
        ID TEXT NOT NULL,
460
        SUM INTEGER NOT NULL
461
);
462
ALTER TABLE COMPANY_DAY_SUM ADD PRIMARY KEY (ID);
463
464
CREATE TABLE PRODUCT_DAY
465
(
466
        ID TEXT    NOT NULL,
467
        PV INTEGER NOT NULL,
468
        DAY TEXT    NOT NULL,
469
        SOURCE TEXT    NOT NULL
470
);
471
472
CREATE TABLE PRODUCT_DAY_SUM(
473
        ID TEXT NOT NULL,
474
        SUM INTEGER NOT NULL
475
);
476
ALTER TABLE PRODUCT_DAY_SUM ADD PRIMARY KEY (ID);
477
478
CREATE TABLE PROFESSOR_DAY
479
(
480
        ID TEXT    NOT NULL,
481
        PV INTEGER NOT NULL,
482
        DAY TEXT    NOT NULL,
483
        SOURCE TEXT    NOT NULL
484
);
485
486
CREATE TABLE PROFESSOR_DAY_SUM(
487
        ID TEXT NOT NULL,
488
        SUM INTEGER NOT NULL
489
);
490
ALTER TABLE PROFESSOR_DAY_SUM ADD PRIMARY KEY (ID);
491
492
CREATE TABLE ORGANIZATION_DAY
493
(
494
        ID TEXT    NOT NULL,
495
        PV INTEGER NOT NULL,
496
        DAY TEXT    NOT NULL,
497
        SOURCE TEXT    NOT NULL
498
);
499
500
CREATE TABLE ORGANIZATION_DAY_SUM(
501
        ID TEXT NOT NULL,
502
        SUM INTEGER NOT NULL
503
);
504
ALTER TABLE ORGANIZATION_DAY_SUM ADD PRIMARY KEY (ID);
505
506
507
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('company_log_handler','com.ekexiu.project.platform.views.handler.db.TimeLogHandler');
508
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('company_log_handler.initialDelay::long','5000');
509
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('company_log_handler.period::long','5000');
510
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('company_log_handler.logType','2');
511
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('company_log_handler.logTypeAlias','company');
512
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('company_log_handler.tableName','COMPANY_DAY');
513
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('company_log_handler.dataSource-ref','dataSource');
514
515
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('main_log_handlers.collection-eleRef-1','company_log_handler');
516
517
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('product_log_handler','com.ekexiu.project.platform.views.handler.db.TimeLogHandler');
518
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('product_log_handler.initialDelay::long','5000');
519
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('product_log_handler.period::long','5000');
520
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('product_log_handler.logType','3');
521
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('product_log_handler.logTypeAlias','product');
522
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('product_log_handler.tableName','PRODUCT_DAY');
523
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('product_log_handler.dataSource-ref','dataSource');
524
525
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('main_log_handlers.collection-eleRef-2','product_log_handler');
526
527
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('professor_log_handler','com.ekexiu.project.platform.views.handler.db.TimeLogHandler');
528
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('professor_log_handler.initialDelay::long','5000');
529
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('professor_log_handler.period::long','5000');
530
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('professor_log_handler.logType','4');
531
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('professor_log_handler.logTypeAlias','professor');
532
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('professor_log_handler.tableName','PROFESSOR_DAY');
533
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('professor_log_handler.dataSource-ref','dataSource');
534
535
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('main_log_handlers.collection-eleRef-3','professor_log_handler');
536
537
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('organization_log_handler','com.ekexiu.project.platform.views.handler.db.TimeLogHandler');
538
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('organization_log_handler.initialDelay::long','5000');
539
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('organization_log_handler.period::long','5000');
540
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('organization_log_handler.logType','5');
541
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('organization_log_handler.logTypeAlias','organization');
542
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('organization_log_handler.tableName','ORGANIZATION_DAY');
543
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('organization_log_handler.dataSource-ref','dataSource');
544
545
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('main_log_handlers.collection-eleRef-4','organization_log_handler');
546
547
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('tns_list.collection-ele-1','company');
548
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('tns_list.collection-ele-2','product');
549
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('tns_list.collection-ele-3','professor');
550
INSERT INTO "public"."console_config" ("cfg_name", "cfg_value") VALUES ('tns_list.collection-ele-4','organization');