Browse Source

工作日志删除/data/stats/plugins/workrecord/grid-monthly接口

dev_shibei_match
yinzuomei 5 years ago
parent
commit
a0d7671bf1
  1. 22
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/plugins/WorkRecordColController.java
  2. 41
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/plugins/ScreenWorkRecordGridMonthlyDao.java
  3. 88
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/plugins/ScreenWorkRecordGridMonthlyEntity.java
  4. 106
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/ScreenWorkRecordGridMonthlyService.java
  5. 130
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordGridMonthlyServiceImpl.java
  6. 43
      epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.8__add_plugins_table.sql
  7. 94
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/plugins/ScreenWorkRecordGridMonthlyDao.xml

22
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.plugins.*;
import com.epmet.dto.screencoll.ScreenCollFormDTO; import com.epmet.dto.screencoll.ScreenCollFormDTO;
import com.epmet.service.plugins.ScreenCustomerWorkRecordDictService; import com.epmet.service.plugins.ScreenCustomerWorkRecordDictService;
import com.epmet.service.plugins.ScreenWorkRecordGridMonthlyService;
import com.epmet.service.plugins.impl.ScreenWorkRecordOrgMonthlyServiceImpl; import com.epmet.service.plugins.impl.ScreenWorkRecordOrgMonthlyServiceImpl;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -28,8 +27,6 @@ public class WorkRecordColController {
@Autowired @Autowired
ScreenCustomerWorkRecordDictService dictService; ScreenCustomerWorkRecordDictService dictService;
@Autowired @Autowired
ScreenWorkRecordGridMonthlyService gridMonthlyService;
@Autowired
ScreenWorkRecordOrgMonthlyServiceImpl orgMonthlyService; ScreenWorkRecordOrgMonthlyServiceImpl orgMonthlyService;
/** /**
@ -53,25 +50,6 @@ public class WorkRecordColController {
return new Result(); 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<ScreenWorkRecordGridMonthlyDTO> 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 工作日志组织按月统计 * @Description 工作日志组织按月统计
* @param customerId * @param customerId

41
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/plugins/ScreenWorkRecordGridMonthlyDao.java

@ -1,41 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<ScreenWorkRecordGridMonthlyEntity> {
int deleteBatch(@Param("customerId") String customerId,@Param("monthId") String monthId);
void insertBatch(@Param("list") List<ScreenWorkRecordGridMonthlyDTO> list, @Param("customerId") String customerId, @Param("monthId") String monthId);
}

88
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/plugins/ScreenWorkRecordGridMonthlyEntity.java

@ -1,88 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
/**
* 月份IdyyyyMM
*/
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;
}

106
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/ScreenWorkRecordGridMonthlyService.java

@ -1,106 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<ScreenWorkRecordGridMonthlyEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<ScreenWorkRecordGridMonthlyDTO>
* @author generator
* @date 2021-02-04
*/
PageData<ScreenWorkRecordGridMonthlyDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<ScreenWorkRecordGridMonthlyDTO>
* @author generator
* @date 2021-02-04
*/
List<ScreenWorkRecordGridMonthlyDTO> list(Map<String, Object> 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<ScreenWorkRecordGridMonthlyDTO> data);
}

130
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordGridMonthlyServiceImpl.java

@ -1,130 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<ScreenWorkRecordGridMonthlyDao, ScreenWorkRecordGridMonthlyEntity> implements ScreenWorkRecordGridMonthlyService {
@Override
public PageData<ScreenWorkRecordGridMonthlyDTO> page(Map<String, Object> params) {
IPage<ScreenWorkRecordGridMonthlyEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, ScreenWorkRecordGridMonthlyDTO.class);
}
@Override
public List<ScreenWorkRecordGridMonthlyDTO> list(Map<String, Object> params) {
List<ScreenWorkRecordGridMonthlyEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, ScreenWorkRecordGridMonthlyDTO.class);
}
private QueryWrapper<ScreenWorkRecordGridMonthlyEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<ScreenWorkRecordGridMonthlyEntity> 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<ScreenWorkRecordGridMonthlyDTO> 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());
});
}
}

43
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`) PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='工作日志资源字典表'; ) 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; drop table if EXISTS screen_work_record_org_monthly;
CREATE TABLE `screen_work_record_org_monthly` ( CREATE TABLE `screen_work_record_org_monthly` (
`ID` varchar(64) NOT NULL COMMENT 'ID 主键', `ID` varchar(64) NOT NULL COMMENT 'ID 主键',
@ -131,27 +109,6 @@ CREATE TABLE `screen_work_record_org_monthly` (
PRIMARY KEY (`ID`) PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='工作日志-组织按月统计(增量)'; ) 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; drop table if EXISTS screen_work_record_org_daily;
CREATE TABLE `screen_work_record_org_daily` ( CREATE TABLE `screen_work_record_org_daily` (

94
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/plugins/ScreenWorkRecordGridMonthlyDao.xml

@ -1,94 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.plugins.ScreenWorkRecordGridMonthlyDao">
<resultMap type="com.epmet.entity.plugins.ScreenWorkRecordGridMonthlyEntity" id="screenWorkRecordGridMonthlyMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="monthId" column="MONTH_ID"/>
<result property="gridId" column="GRID_ID"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="meetingCode" column="MEETING_CODE"/>
<result property="typeCode" column="TYPE_CODE"/>
<result property="organizeTotal" column="ORGANIZE_TOTAL"/>
<result property="participateTotal" column="PARTICIPATE_TOTAL"/>
<result property="participateUserTotal" column="PARTICIPATE_USER_TOTAL"/>
<result property="avgParticipateUserTotal" column="AVG_PARTICIPATE_USER_TOTAL"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<insert id="insertBatch">
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
<foreach collection="list" item="item" index="index" separator=",">
(
(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()
)
</foreach>
</insert>
<delete id="deleteBatch">
delete from screen_work_record_grid_monthly
where customer_id = #{customerId}
and month_id = #{monthId}
limit 1000
</delete>
</mapper>
Loading…
Cancel
Save