From da96b58174f61b96b9aca9e884d08a46067c2994 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 23 Feb 2021 22:56:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E6=97=A5=E5=BF=97=E9=87=87?= =?UTF-8?q?=E9=9B=86API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ava => ScreenWorkRecordCommonFormDTO.java} | 4 +- .../ScreenWorkRecordGridDailyFormDTO.java | 57 -------- .../ScreenWorkRecordGridMonthlyDTO.java | 122 ------------------ .../plugins/WorkRecordColController.java | 20 +-- .../plugins/ScreenWorkRecordOrgDailyDao.java | 42 ++++++ .../ScreenWorkRecordOrgMonthlyDao.java | 4 +- .../ScreenWorkRecordOrgDailyEntity.java} | 62 ++------- .../ScreenWorkRecordOrgDailyService.java | 34 +++++ .../ScreenWorkRecordOrgMonthlyService.java | 68 +--------- .../ScreenWorkRecordOrgDailyServiceImpl.java | 51 ++++++++ ...ScreenWorkRecordOrgMonthlyServiceImpl.java | 69 +--------- .../plugins/ScreenWorkRecordOrgDailyDao.xml | 52 ++++++++ 12 files changed, 212 insertions(+), 373 deletions(-) rename epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/plugins/{ScreenWorkRecordOrgDailyFormDTO.java => ScreenWorkRecordCommonFormDTO.java} (87%) delete mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/plugins/ScreenWorkRecordGridDailyFormDTO.java delete mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/plugins/ScreenWorkRecordGridMonthlyDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/plugins/ScreenWorkRecordOrgDailyDao.java rename epmet-module/data-statistical/{data-statistical-client/src/main/java/com/epmet/dto/plugins/ScreenWorkRecordOrgMonthlyDTO.java => data-statistical-server/src/main/java/com/epmet/entity/plugins/ScreenWorkRecordOrgDailyEntity.java} (64%) create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/ScreenWorkRecordOrgDailyService.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgDailyDao.xml diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/plugins/ScreenWorkRecordOrgDailyFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/plugins/ScreenWorkRecordCommonFormDTO.java similarity index 87% rename from epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/plugins/ScreenWorkRecordOrgDailyFormDTO.java rename to epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/plugins/ScreenWorkRecordCommonFormDTO.java index 92a13b72ed..2223143cc7 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/plugins/ScreenWorkRecordOrgDailyFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/plugins/ScreenWorkRecordCommonFormDTO.java @@ -5,13 +5,13 @@ import lombok.Data; import java.io.Serializable; /** - * 工作日志-组织按日统计(累计值) + * 工作日志-数据采集通用DTO * * @author yinzuomei@elink-cn.com * @date 2021/2/21 18:49 */ @Data -public class ScreenWorkRecordOrgDailyFormDTO implements Serializable { +public class ScreenWorkRecordCommonFormDTO implements Serializable { private static final long serialVersionUID = 819322082786098071L; /** diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/plugins/ScreenWorkRecordGridDailyFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/plugins/ScreenWorkRecordGridDailyFormDTO.java deleted file mode 100644 index 5d75e69216..0000000000 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/plugins/ScreenWorkRecordGridDailyFormDTO.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.epmet.dto.plugins; - -import lombok.Data; - -import java.io.Serializable; - -/** - * 工作日志-网格按日统计(累计值) - * - * @author yinzuomei@elink-cn.com - * @date 2021/2/21 18:48 - */ -@Data -public class ScreenWorkRecordGridDailyFormDTO implements Serializable { - private static final long serialVersionUID = 5993623581944585517L; - - /** - * 网格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-client/src/main/java/com/epmet/dto/plugins/ScreenWorkRecordGridMonthlyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/plugins/ScreenWorkRecordGridMonthlyDTO.java deleted file mode 100644 index 9fb30a14d7..0000000000 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/plugins/ScreenWorkRecordGridMonthlyDTO.java +++ /dev/null @@ -1,122 +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.dto.plugins; - -import lombok.Data; - -import java.io.Serializable; -import java.util.Date; - - -/** - * 工作日志-网格按月统计 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2021-02-04 - */ -@Data -public class ScreenWorkRecordGridMonthlyDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * ID 主键 - */ - private String id; - - /** - * 客户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; - - /** - * 删除标识 0未删除;1已删除 - */ - private String delFlag; - - /** - * 乐观锁 - */ - private Integer revision; - - /** - * 创建人 - */ - private String createdBy; - - /** - * 创建时间 - */ - private Date createdTime; - - /** - * 更新人 - */ - private String updatedBy; - - /** - * 更新时间 - */ - private Date updatedTime; - -} \ No newline at end of file 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 d6631f2b51..314a814ade 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 @@ -3,10 +3,12 @@ package com.epmet.controller.plugins; import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.exception.ValidateException; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.plugins.*; +import com.epmet.dto.plugins.ScreenCustomerWorkRecordDictDTO; +import com.epmet.dto.plugins.ScreenWorkRecordCommonFormDTO; import com.epmet.dto.screencoll.ScreenCollFormDTO; import com.epmet.service.plugins.ScreenCustomerWorkRecordDictService; -import com.epmet.service.plugins.impl.ScreenWorkRecordOrgMonthlyServiceImpl; +import com.epmet.service.plugins.ScreenWorkRecordOrgDailyService; +import com.epmet.service.plugins.ScreenWorkRecordOrgMonthlyService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -27,8 +29,9 @@ public class WorkRecordColController { @Autowired ScreenCustomerWorkRecordDictService dictService; @Autowired - ScreenWorkRecordOrgMonthlyServiceImpl orgMonthlyService; - + private ScreenWorkRecordOrgMonthlyService screenWorkRecordOrgMonthlyService; + @Autowired + private ScreenWorkRecordOrgDailyService screenWorkRecordOrgDailyService; /** * @Description 【工作日志】客户资源字典信息上传 * @@ -59,13 +62,13 @@ public class WorkRecordColController { * @date 2021.02.04 16:16 */ @PostMapping("org-monthly") - public Result collectOrg(@RequestHeader("CustomerId")String customerId, @RequestBody ScreenCollFormDTO data){ + public Result collectOrg(@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.collectOrg,param:{}", JSON.toJSONString(data)); throw new ValidateException("客户Id、上传数据列表、月份Id不可为空"); } - orgMonthlyService.collect(customerId,data); + screenWorkRecordOrgMonthlyService.collect(customerId,data); return new Result(); } @@ -78,14 +81,13 @@ public class WorkRecordColController { * @date 2021.02.04 16:16 */ @PostMapping("org-daily") - public Result collectOrgDaily(@RequestHeader("CustomerId")String customerId, @RequestBody ScreenCollFormDTO data){ + public Result collectOrgDaily(@RequestHeader("CustomerId")String customerId, @RequestBody ScreenCollFormDTO data){ if(StringUtils.isBlank(customerId) || CollectionUtils.isEmpty(data.getDataList()) || StringUtils.isBlank(data.getDateId())) { log.error("com.epmet.controller.plugins.WorkRecordColController.collectOrgDaily,param:{}", JSON.toJSONString(data)); throw new ValidateException("客户Id、上传数据列表、日期Id不可为空"); } - //todo - // orgMonthlyService.collectOrgDaily(customerId,data); + screenWorkRecordOrgDailyService.collectOrgDaily(customerId,data); return new Result(); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/plugins/ScreenWorkRecordOrgDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/plugins/ScreenWorkRecordOrgDailyDao.java new file mode 100644 index 0000000000..2bf23d6a6b --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/plugins/ScreenWorkRecordOrgDailyDao.java @@ -0,0 +1,42 @@ +/** + * 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.ScreenWorkRecordCommonFormDTO; +import com.epmet.entity.plugins.ScreenWorkRecordOrgDailyEntity; +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-23 + */ +@Mapper +public interface ScreenWorkRecordOrgDailyDao extends BaseDao { + + int deleteBatch(@Param("customerId") String customerId, @Param("dateId") String dateId); + + void insertBatch(@Param("list") List list, + @Param("customerId") String customerId, + @Param("dateId") String dateId); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/plugins/ScreenWorkRecordOrgMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/plugins/ScreenWorkRecordOrgMonthlyDao.java index ccf7baed54..16f4a763e7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/plugins/ScreenWorkRecordOrgMonthlyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/plugins/ScreenWorkRecordOrgMonthlyDao.java @@ -18,7 +18,7 @@ package com.epmet.dao.plugins; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.plugins.ScreenWorkRecordOrgMonthlyDTO; +import com.epmet.dto.plugins.ScreenWorkRecordCommonFormDTO; import com.epmet.entity.plugins.ScreenWorkRecordOrgMonthlyEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -36,7 +36,7 @@ public interface ScreenWorkRecordOrgMonthlyDao extends BaseDao list, @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-client/src/main/java/com/epmet/dto/plugins/ScreenWorkRecordOrgMonthlyDTO.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/plugins/ScreenWorkRecordOrgDailyEntity.java similarity index 64% rename from epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/plugins/ScreenWorkRecordOrgMonthlyDTO.java rename to epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/plugins/ScreenWorkRecordOrgDailyEntity.java index 4848454792..148c742f91 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/plugins/ScreenWorkRecordOrgMonthlyDTO.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/plugins/ScreenWorkRecordOrgDailyEntity.java @@ -15,29 +15,25 @@ * along with this program. If not, see . */ -package com.epmet.dto.plugins; +package com.epmet.entity.plugins; +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; - -import java.io.Serializable; -import java.util.Date; - +import lombok.EqualsAndHashCode; /** - * 工作日志-组织按月统计 + * 工作日志-组织按日统计(累计值) * * @author generator generator@elink-cn.com - * @since v1.0.0 2021-02-04 + * @since v1.0.0 2021-02-23 */ @Data -public class ScreenWorkRecordOrgMonthlyDTO implements Serializable { - - private static final long serialVersionUID = 1L; +@EqualsAndHashCode(callSuper=false) +@TableName("screen_work_record_org_daily") +public class ScreenWorkRecordOrgDailyEntity extends BaseEpmetEntity { - /** - * ID 主键 - */ - private String id; + private static final long serialVersionUID = 1L; /** * 客户Id @@ -45,12 +41,12 @@ public class ScreenWorkRecordOrgMonthlyDTO implements Serializable { private String customerId; /** - * 月份Id:yyyyMM + * 日期Id:yyyyMMdd */ - private String monthId; + private String dateId; /** - * 组织Id + * 组织Idor网格id */ private String orgId; @@ -79,34 +75,4 @@ public class ScreenWorkRecordOrgMonthlyDTO implements Serializable { */ private Integer avgParticipateUserTotal; - /** - * 删除标识 0未删除;1已删除 - */ - private String delFlag; - - /** - * 乐观锁 - */ - private Integer revision; - - /** - * 创建人 - */ - private String createdBy; - - /** - * 创建时间 - */ - private Date createdTime; - - /** - * 更新人 - */ - private String updatedBy; - - /** - * 更新时间 - */ - private Date updatedTime; - -} \ No newline at end of file +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/ScreenWorkRecordOrgDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/ScreenWorkRecordOrgDailyService.java new file mode 100644 index 0000000000..6edbb9ba92 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/ScreenWorkRecordOrgDailyService.java @@ -0,0 +1,34 @@ +/** + * 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.dto.plugins.ScreenWorkRecordCommonFormDTO; +import com.epmet.dto.screencoll.ScreenCollFormDTO; +import com.epmet.entity.plugins.ScreenWorkRecordOrgDailyEntity; + +/** + * 工作日志-组织按日统计(累计值) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-02-23 + */ +public interface ScreenWorkRecordOrgDailyService extends BaseService { + + void collectOrgDaily(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/ScreenWorkRecordOrgMonthlyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/ScreenWorkRecordOrgMonthlyService.java index a9368a66bc..0e16b4b1fe 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/ScreenWorkRecordOrgMonthlyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/ScreenWorkRecordOrgMonthlyService.java @@ -18,14 +18,10 @@ package com.epmet.service.plugins; import com.epmet.commons.mybatis.service.BaseService; -import com.epmet.commons.tools.page.PageData; -import com.epmet.dto.plugins.ScreenWorkRecordOrgMonthlyDTO; +import com.epmet.dto.plugins.ScreenWorkRecordCommonFormDTO; import com.epmet.dto.screencoll.ScreenCollFormDTO; import com.epmet.entity.plugins.ScreenWorkRecordOrgMonthlyEntity; -import java.util.List; -import java.util.Map; - /** * 工作日志-组织按月统计 * @@ -34,66 +30,6 @@ import java.util.Map; */ public interface ScreenWorkRecordOrgMonthlyService 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 ScreenWorkRecordOrgMonthlyDTO - * @author generator - * @date 2021-02-04 - */ - ScreenWorkRecordOrgMonthlyDTO get(String id); - - /** - * 默认保存 - * - * @param dto - * @return void - * @author generator - * @date 2021-02-04 - */ - void save(ScreenWorkRecordOrgMonthlyDTO dto); - - /** - * 默认更新 - * - * @param dto - * @return void - * @author generator - * @date 2021-02-04 - */ - void update(ScreenWorkRecordOrgMonthlyDTO dto); - - /** - * 批量删除 - * - * @param ids - * @return void - * @author generator - * @date 2021-02-04 - */ - void delete(String[] ids); - /** * @Description 数据录入 * @param customerId @@ -102,5 +38,5 @@ public interface ScreenWorkRecordOrgMonthlyService extends BaseService data); + 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/ScreenWorkRecordOrgDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java new file mode 100644 index 0000000000..2185b5306d --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java @@ -0,0 +1,51 @@ +/** + * 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.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.dao.plugins.ScreenWorkRecordOrgDailyDao; +import com.epmet.dto.plugins.ScreenWorkRecordCommonFormDTO; +import com.epmet.dto.screencoll.ScreenCollFormDTO; +import com.epmet.entity.plugins.ScreenWorkRecordOrgDailyEntity; +import com.epmet.service.plugins.ScreenWorkRecordOrgDailyService; +import com.google.common.collect.Lists; +import org.springframework.stereotype.Service; + +/** + * 工作日志-组织按日统计(累计值) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-02-23 + */ +@Service +public class ScreenWorkRecordOrgDailyServiceImpl extends BaseServiceImpl implements ScreenWorkRecordOrgDailyService { + + @Override + public void collectOrgDaily(String customerId, ScreenCollFormDTO data) { + if(data.getIsFirst()){ + int affectedRows = baseDao.deleteBatch(customerId,data.getDateId()); + while(affectedRows > 0){ + affectedRows = baseDao.deleteBatch(customerId,data.getDateId()); + } + } + Lists.partition(data.getDataList(), NumConstant.ONE_HUNDRED).forEach(list -> { + baseDao.insertBatch(list,customerId,data.getDateId()); + }); + } +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgMonthlyServiceImpl.java index a1264c91ae..20a5417105 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgMonthlyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgMonthlyServiceImpl.java @@ -17,30 +17,19 @@ 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.ScreenWorkRecordOrgMonthlyDao; -import com.epmet.dto.plugins.ScreenWorkRecordOrgMonthlyDTO; +import com.epmet.dto.plugins.ScreenWorkRecordCommonFormDTO; import com.epmet.dto.screencoll.ScreenCollFormDTO; import com.epmet.entity.plugins.ScreenWorkRecordOrgMonthlyEntity; import com.epmet.service.plugins.ScreenWorkRecordOrgMonthlyService; 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; - /** * 工作日志-组织按月统计 * @@ -50,60 +39,6 @@ import java.util.Map; @Service public class ScreenWorkRecordOrgMonthlyServiceImpl extends BaseServiceImpl implements ScreenWorkRecordOrgMonthlyService { - - - @Override - public PageData page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, ScreenWorkRecordOrgMonthlyDTO.class); - } - - @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); - - return ConvertUtils.sourceToTarget(entityList, ScreenWorkRecordOrgMonthlyDTO.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 ScreenWorkRecordOrgMonthlyDTO get(String id) { - ScreenWorkRecordOrgMonthlyEntity entity = baseDao.selectById(id); - return ConvertUtils.sourceToTarget(entity, ScreenWorkRecordOrgMonthlyDTO.class); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void save(ScreenWorkRecordOrgMonthlyDTO dto) { - ScreenWorkRecordOrgMonthlyEntity entity = ConvertUtils.sourceToTarget(dto, ScreenWorkRecordOrgMonthlyEntity.class); - insert(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(ScreenWorkRecordOrgMonthlyDTO dto) { - ScreenWorkRecordOrgMonthlyEntity entity = ConvertUtils.sourceToTarget(dto, ScreenWorkRecordOrgMonthlyEntity.class); - updateById(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void delete(String[] ids) { - // 逻辑删除(@TableLogic 注解) - baseDao.deleteBatchIds(Arrays.asList(ids)); - } - /** * @Description 数据录入 * @param customerId @@ -115,7 +50,7 @@ public class ScreenWorkRecordOrgMonthlyServiceImpl extends BaseServiceImpl data) { + public void collect(String customerId, ScreenCollFormDTO data) { if(data.getIsFirst()){ int affectedRows = baseDao.deleteBatch(customerId,data.getMonthId()); while(affectedRows > 0){ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgDailyDao.xml new file mode 100644 index 0000000000..0fd68eddf4 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgDailyDao.xml @@ -0,0 +1,52 @@ + + + + + + + delete from screen_work_record_org_daily + where customer_id = #{customerId} + and DATE_ID = #{dateId} + limit 1000 + + + + INSERT INTO screen_work_record_org_daily + ( + id, + customer_id, + DATE_ID, + org_id, + meeting_code, + type_code, + organize_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}, + #{dateId}, + #{item.orgId}, + #{item.meetingCode}, + #{item.typeCode}, + #{item.organizeTotal}, + #{item.participateUserTotal}, + #{item.avgParticipateUserTotal}, + '0', + 0, + 'APP_USER', + now(), + 'APP_USER', + now() + ) + + + \ No newline at end of file