From a0d7671bf1e1cf88f4bd51990e35574db691ef95 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 23 Feb 2021 10:37:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E6=97=A5=E5=BF=97=E5=88=A0?= =?UTF-8?q?=E9=99=A4/data/stats/plugins/workrecord/grid-monthly=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugins/WorkRecordColController.java | 22 --- .../ScreenWorkRecordGridMonthlyDao.java | 41 ------ .../ScreenWorkRecordGridMonthlyEntity.java | 88 ------------ .../ScreenWorkRecordGridMonthlyService.java | 106 -------------- ...creenWorkRecordGridMonthlyServiceImpl.java | 130 ------------------ .../migration/V0.0.8__add_plugins_table.sql | 43 ------ .../ScreenWorkRecordGridMonthlyDao.xml | 94 ------------- 7 files changed, 524 deletions(-) delete mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/plugins/ScreenWorkRecordGridMonthlyDao.java delete mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/plugins/ScreenWorkRecordGridMonthlyEntity.java delete mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/ScreenWorkRecordGridMonthlyService.java delete mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordGridMonthlyServiceImpl.java delete mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/plugins/ScreenWorkRecordGridMonthlyDao.xml diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/plugins/WorkRecordColController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/plugins/WorkRecordColController.java index cf6a10d8a9..d6631f2b51 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/plugins/WorkRecordColController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/plugins/WorkRecordColController.java @@ -6,7 +6,6 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.plugins.*; import com.epmet.dto.screencoll.ScreenCollFormDTO; import com.epmet.service.plugins.ScreenCustomerWorkRecordDictService; -import com.epmet.service.plugins.ScreenWorkRecordGridMonthlyService; import com.epmet.service.plugins.impl.ScreenWorkRecordOrgMonthlyServiceImpl; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -28,8 +27,6 @@ public class WorkRecordColController { @Autowired ScreenCustomerWorkRecordDictService dictService; @Autowired - ScreenWorkRecordGridMonthlyService gridMonthlyService; - @Autowired ScreenWorkRecordOrgMonthlyServiceImpl orgMonthlyService; /** @@ -53,25 +50,6 @@ public class WorkRecordColController { return new Result(); } - /** - * @Description 【工作日志】网格按月统计 - * @param customerId - * @param data - * @return com.epmet.commons.tools.utils.Result - * @author wangc - * @date 2021.02.04 16:16 - */ - @PostMapping("grid-monthly") - public Result collectGrid(@RequestHeader("CustomerId")String customerId, @RequestBody ScreenCollFormDTO data){ - if(StringUtils.isBlank(customerId) || CollectionUtils.isEmpty(data.getDataList()) || - StringUtils.isBlank(data.getMonthId())) { - log.error("com.epmet.controller.plugins.WorkRecordColController.collectGrid,param:{}", JSON.toJSONString(data)); - throw new ValidateException("客户Id、上传数据列表、月份Id不可为空"); - } - gridMonthlyService.collect(customerId,data); - return new Result(); - } - /** * @Description 【工作日志】组织按月统计 * @param customerId diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/plugins/ScreenWorkRecordGridMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/plugins/ScreenWorkRecordGridMonthlyDao.java deleted file mode 100644 index febf60d61a..0000000000 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/plugins/ScreenWorkRecordGridMonthlyDao.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright 2018 人人开源 https://www.renren.io - *

- * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - *

- * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - *

- * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.epmet.dao.plugins; - -import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.plugins.ScreenWorkRecordGridMonthlyDTO; -import com.epmet.entity.plugins.ScreenWorkRecordGridMonthlyEntity; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 工作日志-网格按月统计 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2021-02-04 - */ -@Mapper -public interface ScreenWorkRecordGridMonthlyDao extends BaseDao { - - int deleteBatch(@Param("customerId") String customerId,@Param("monthId") String monthId); - - void insertBatch(@Param("list") List list, @Param("customerId") String customerId, @Param("monthId") String monthId); - -} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/plugins/ScreenWorkRecordGridMonthlyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/plugins/ScreenWorkRecordGridMonthlyEntity.java deleted file mode 100644 index 664880ba11..0000000000 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/plugins/ScreenWorkRecordGridMonthlyEntity.java +++ /dev/null @@ -1,88 +0,0 @@ -/** - * Copyright 2018 人人开源 https://www.renren.io - *

- * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - *

- * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - *

- * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.epmet.entity.plugins; - -import com.baomidou.mybatisplus.annotation.TableName; -import com.epmet.commons.mybatis.entity.BaseEpmetEntity; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 工作日志-网格按月统计 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2021-02-04 - */ -@Data -@EqualsAndHashCode(callSuper=false) -@TableName("screen_work_record_grid_monthly") -public class ScreenWorkRecordGridMonthlyEntity extends BaseEpmetEntity { - - private static final long serialVersionUID = 1L; - - /** - * 客户Id - */ - private String customerId; - - /** - * 月份Id:yyyyMM - */ - private String monthId; - - /** - * 网格id - */ - private String gridId; - - /** - * 网格所属的组织id - */ - private String agencyId; - - /** - * 会议类型编码;对应screen_customer_work_record_dict的资源编码 - */ - private String meetingCode; - - /** - * 随手记类型编码;对应screen_customer_work_record_dict的资源编码 - */ - private String typeCode; - - /** - * 组织次数 - */ - private Integer organizeTotal; - - /** - * 当前组织参与的总次数 - */ - private Integer participateTotal; - - /** - * 参与人数 - */ - private Integer participateUserTotal; - - /** - * 平均参与人数 - */ - private Integer avgParticipateUserTotal; - -} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/ScreenWorkRecordGridMonthlyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/ScreenWorkRecordGridMonthlyService.java deleted file mode 100644 index 45622e29fd..0000000000 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/ScreenWorkRecordGridMonthlyService.java +++ /dev/null @@ -1,106 +0,0 @@ -/** - * Copyright 2018 人人开源 https://www.renren.io - *

- * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - *

- * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - *

- * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.epmet.service.plugins; - -import com.epmet.commons.mybatis.service.BaseService; -import com.epmet.commons.tools.page.PageData; -import com.epmet.dto.plugins.ScreenWorkRecordGridMonthlyDTO; -import com.epmet.dto.screencoll.ScreenCollFormDTO; -import com.epmet.entity.plugins.ScreenWorkRecordGridMonthlyEntity; - -import java.util.List; -import java.util.Map; - -/** - * 工作日志-网格按月统计 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2021-02-04 - */ -public interface ScreenWorkRecordGridMonthlyService extends BaseService { - - /** - * 默认分页 - * - * @param params - * @return PageData - * @author generator - * @date 2021-02-04 - */ - PageData page(Map params); - - /** - * 默认查询 - * - * @param params - * @return java.util.List - * @author generator - * @date 2021-02-04 - */ - List list(Map params); - - /** - * 单条查询 - * - * @param id - * @return ScreenWorkRecordGridMonthlyDTO - * @author generator - * @date 2021-02-04 - */ - ScreenWorkRecordGridMonthlyDTO get(String id); - - /** - * 默认保存 - * - * @param dto - * @return void - * @author generator - * @date 2021-02-04 - */ - void save(ScreenWorkRecordGridMonthlyDTO dto); - - /** - * 默认更新 - * - * @param dto - * @return void - * @author generator - * @date 2021-02-04 - */ - void update(ScreenWorkRecordGridMonthlyDTO dto); - - /** - * 批量删除 - * - * @param ids - * @return void - * @author generator - * @date 2021-02-04 - */ - void delete(String[] ids); - - /** - * @Description 数据录入 - * @param customerId - * @param data - * @return void - * @author wangc - * @date 2021.02.04 15:27 - */ - void collect(String customerId, ScreenCollFormDTO data); -} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordGridMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordGridMonthlyServiceImpl.java deleted file mode 100644 index fa69352aa3..0000000000 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordGridMonthlyServiceImpl.java +++ /dev/null @@ -1,130 +0,0 @@ -/** - * Copyright 2018 人人开源 https://www.renren.io - *

- * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - *

- * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - *

- * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.epmet.service.plugins.impl; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.epmet.commons.dynamic.datasource.annotation.DataSource; -import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; -import com.epmet.commons.tools.constant.NumConstant; -import com.epmet.commons.tools.page.PageData; -import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; -import com.epmet.constant.DataSourceConstant; -import com.epmet.dao.plugins.ScreenWorkRecordGridMonthlyDao; -import com.epmet.dto.plugins.ScreenWorkRecordGridMonthlyDTO; -import com.epmet.dto.screencoll.ScreenCollFormDTO; -import com.epmet.entity.plugins.ScreenWorkRecordGridMonthlyEntity; -import com.epmet.service.plugins.ScreenWorkRecordGridMonthlyService; -import com.google.common.collect.Lists; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -/** - * 工作日志-网格按月统计 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2021-02-04 - */ -@Service -public class ScreenWorkRecordGridMonthlyServiceImpl extends BaseServiceImpl implements ScreenWorkRecordGridMonthlyService { - - - - @Override - public PageData page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, ScreenWorkRecordGridMonthlyDTO.class); - } - - @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); - - return ConvertUtils.sourceToTarget(entityList, ScreenWorkRecordGridMonthlyDTO.class); - } - - private QueryWrapper getWrapper(Map params){ - String id = (String)params.get(FieldConstant.ID_HUMP); - - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); - - return wrapper; - } - - @Override - public ScreenWorkRecordGridMonthlyDTO get(String id) { - ScreenWorkRecordGridMonthlyEntity entity = baseDao.selectById(id); - return ConvertUtils.sourceToTarget(entity, ScreenWorkRecordGridMonthlyDTO.class); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void save(ScreenWorkRecordGridMonthlyDTO dto) { - ScreenWorkRecordGridMonthlyEntity entity = ConvertUtils.sourceToTarget(dto, ScreenWorkRecordGridMonthlyEntity.class); - insert(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(ScreenWorkRecordGridMonthlyDTO dto) { - ScreenWorkRecordGridMonthlyEntity entity = ConvertUtils.sourceToTarget(dto, ScreenWorkRecordGridMonthlyEntity.class); - updateById(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void delete(String[] ids) { - // 逻辑删除(@TableLogic 注解) - baseDao.deleteBatchIds(Arrays.asList(ids)); - } - - /** - * @Description 数据录入 - * @param customerId - * @param data - * @return void - * @author wangc - * @date 2021.02.04 15:27 - */ - @Transactional(rollbackFor = Exception.class) - @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) - @Override - public void collect(String customerId, ScreenCollFormDTO data) { - if(data.getIsFirst()){ - int affectedRows = baseDao.deleteBatch(customerId,data.getMonthId()); - while(affectedRows > 0){ - affectedRows = baseDao.deleteBatch(customerId,data.getMonthId()); - } - } - Lists.partition(data.getDataList(), NumConstant.ONE_HUNDRED).forEach(list -> { - baseDao.insertBatch(list,customerId,data.getMonthId()); - }); - } - -} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.8__add_plugins_table.sql b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.8__add_plugins_table.sql index 5be4de5dea..87365d4ab7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.8__add_plugins_table.sql +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.8__add_plugins_table.sql @@ -88,28 +88,6 @@ CREATE TABLE `screen_customer_work_record_dict` ( PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='工作日志资源字典表'; -drop table if EXISTS screen_work_record_grid_monthly; -CREATE TABLE `screen_work_record_grid_monthly` ( - `ID` varchar(64) NOT NULL COMMENT 'ID 主键', - `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id', - `MONTH_ID` varchar(32) NOT NULL COMMENT '月份Id:yyyyMM', - `GRID_ID` varchar(64) NOT NULL COMMENT '网格id', - `AGENCY_ID` varchar(64) NOT NULL COMMENT '网格所属的组织id', - `MEETING_CODE` varchar(255) NOT NULL COMMENT '会议类型编码;对应screen_customer_work_record_dict的资源编码', - `TYPE_CODE` varchar(255) NOT NULL COMMENT '随手记类型编码;对应screen_customer_work_record_dict的资源编码', - `ORGANIZE_TOTAL` int(11) NOT NULL COMMENT '组织次数', - `PARTICIPATE_TOTAL` int(11) NOT NULL COMMENT '当前组织参与的总次数', - `PARTICIPATE_USER_TOTAL` int(11) NOT NULL COMMENT '参与人数', - `AVG_PARTICIPATE_USER_TOTAL` int(11) NOT NULL COMMENT '平均参与人数', - `DEL_FLAG` char(1) NOT NULL DEFAULT '0' COMMENT '删除标识 0未删除;1已删除', - `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', - `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', - `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', - `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', - `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', - PRIMARY KEY (`ID`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='工作日志-网格按月统计(增量)'; - drop table if EXISTS screen_work_record_org_monthly; CREATE TABLE `screen_work_record_org_monthly` ( `ID` varchar(64) NOT NULL COMMENT 'ID 主键', @@ -131,27 +109,6 @@ CREATE TABLE `screen_work_record_org_monthly` ( PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='工作日志-组织按月统计(增量)'; -drop table if EXISTS screen_work_record_grid_daily; -CREATE TABLE `screen_work_record_grid_daily` ( - `ID` varchar(64) NOT NULL COMMENT 'ID 主键', - `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id', - `DATE_ID` varchar(8) NOT NULL COMMENT '日期Id:yyyyMMdd', - `GRID_ID` varchar(64) NOT NULL COMMENT '网格id', - `AGENCY_ID` varchar(64) NOT NULL COMMENT '网格所属的组织id', - `MEETING_CODE` varchar(255) NOT NULL COMMENT '会议类型编码;对应screen_customer_work_record_dict的资源编码', - `TYPE_CODE` varchar(255) NOT NULL COMMENT '随手记类型编码;对应screen_customer_work_record_dict的资源编码', - `ORGANIZE_TOTAL` int(11) NOT NULL COMMENT '组织次数', - `PARTICIPATE_TOTAL` int(11) NOT NULL COMMENT '当前组织参与的总次数', - `PARTICIPATE_USER_TOTAL` int(11) NOT NULL COMMENT '参与人数', - `AVG_PARTICIPATE_USER_TOTAL` int(11) NOT NULL COMMENT '平均参与人数', - `DEL_FLAG` char(1) NOT NULL DEFAULT '0' COMMENT '删除标识 0未删除;1已删除', - `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', - `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', - `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', - `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', - `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', - PRIMARY KEY (`ID`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='工作日志-网格按日统计(累计值)'; drop table if EXISTS screen_work_record_org_daily; CREATE TABLE `screen_work_record_org_daily` ( diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/plugins/ScreenWorkRecordGridMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/plugins/ScreenWorkRecordGridMonthlyDao.xml deleted file mode 100644 index 02ecd54811..0000000000 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/plugins/ScreenWorkRecordGridMonthlyDao.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - INSERT INTO screen_work_record_grid_monthly - ( - id, - customer_id, - month_id, - grid_id, - agency_id, - meeting_code, - type_code, - organize_total, - participate_total, - participate_user_total, - avg_participate_user_total, - del_flag, - revision, - created_by, - created_time, - updated_by, - updated_time - ) values - - ( - (SELECT REPLACE(UUID(), '-', '') AS id), - - #{customerId}, - - #{monthId}, - - #{item.gridId}, - - #{item.agencyId}, - - #{item.meetingCode}, - - #{item.typeCode}, - - #{item.organizeTotal}, - - #{item.participateTotal}, - - #{item.participateUserTotal}, - - #{item.avgParticipateUserTotal}, - - '0', - - 0, - - 'APP_USER', - - now(), - - 'APP_USER', - - now() - ) - - - - - delete from screen_work_record_grid_monthly - where customer_id = #{customerId} - and month_id = #{monthId} - limit 1000 - - - \ No newline at end of file