diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/DataSourceConstant.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/DataSourceConstant.java index ae05f1af6e..91e0645faf 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/DataSourceConstant.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/DataSourceConstant.java @@ -30,6 +30,7 @@ public interface DataSourceConstant { String DATA_STATISTICAL="datastatistical"; String EVALUATION_INDEX = "evaluationIndex"; + String EVALUATION_INDEX_READ = "evaluationIndexRead"; String OPERCUSTOMIZE="opercustomize"; diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/EventCategoryResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/EventCategoryResultDTO.java new file mode 100644 index 0000000000..0d16f1d598 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/EventCategoryResultDTO.java @@ -0,0 +1,69 @@ +package com.epmet.dataaggre.dto.evaluationindex; + +import com.epmet.commons.tools.constant.NumConstant; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2021/11/4 3:13 下午 + * @DESC + */ +@Data +public class EventCategoryResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 类型,project:事件, work:例行工作 + */ + private String eventType; + + /** + * 分类CODE + */ + private String categoryCode; + + /** + * 分类code父级 + */ + private String parentCategoryCode; + + /** + * 分类名字 + */ + private String categoryName; + + /** + * 分类名字父级 + */ + private String parentCategoryName; + + /** + * 项目数 + */ + private Integer eventTotal; + + /** + * 分值 + */ + private Integer score; + + private Integer totalScore; + + private List children; + @JsonIgnore + private Integer index; + + public EventCategoryResultDTO() { + this.categoryCode = ""; + this.categoryName = ""; + this.eventTotal = NumConstant.ZERO; + this.totalScore = NumConstant.ZERO; + this.children = new ArrayList<>(); + } +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/form/EventCategoryFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/form/EventCategoryFormDTO.java new file mode 100644 index 0000000000..5d848e185e --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/form/EventCategoryFormDTO.java @@ -0,0 +1,47 @@ +package com.epmet.dataaggre.dto.evaluationindex.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @author Administrator + */ +@Data +public class EventCategoryFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + public interface EventCategoryForm{} + public interface CategoryEventExportForm {} + + /** + * 组织ID + */ + private String customerId; + + /** + * 组织ID + */ + private String orgId; + + /** + * 组织类型 组织:agency,网格:grid + */ + private String orgType; + + @NotBlank(message = "结束时间不能为空",groups = {EventCategoryForm.class,CategoryEventExportForm.class}) + private String endTime; + + /** + * 开始时间 + */ + private String startTime; + + /** + * 组织名称 + */ + @NotBlank(message = "组织名称不能为空",groups = CategoryEventExportForm.class) + private String orgName; +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/pom.xml b/epmet-module/data-aggregator/data-aggregator-server/pom.xml index 30999f1c99..56f4b3ffe9 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/pom.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/pom.xml @@ -384,6 +384,12 @@ epmet_evaluation_index_user EpmEt-db-UsEr + + + + root + root + @@ -522,6 +528,12 @@ epmet elink@833066 + + + + epmet + elink@833066 + @@ -661,6 +673,12 @@ epmet_evaluation_index_user EpmEt-db-UsEr + + + + epmet_cloud_viewer + EpmEtclOUdvIEwEr@w + diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/PingYinEventController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/PingYinEventController.java new file mode 100644 index 0000000000..50531e28b1 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/PingYinEventController.java @@ -0,0 +1,45 @@ +package com.epmet.dataaggre.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dataaggre.dto.evaluationindex.EventCategoryResultDTO; +import com.epmet.dataaggre.dto.evaluationindex.form.EventCategoryFormDTO; +import com.epmet.dataaggre.service.evaluationindex.PingYinEventService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.List; + + +/** + * @author Administrator + */ +@RestController +@RequestMapping("pyevent") +@Slf4j +public class PingYinEventController { + @Resource + private PingYinEventService pingYinEventService; + + /** + * 事件赋值得分 + * + * @Param tokenDto + * @Return {@link Result>} + * @Author zhaoqifeng + * @Date 2022/12/9 9:42 + */ + @PostMapping("getEventCategorySore") + public Result> getEventCategorySore(@LoginUser TokenDto tokenDto, @RequestBody EventCategoryFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, EventCategoryFormDTO.EventCategoryForm.class); + return new Result>().ok(pingYinEventService.getEventCategorySore(tokenDto, formDTO)); + } + + +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/PingYinEventDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/PingYinEventDao.java new file mode 100644 index 0000000000..86ddcb8590 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/PingYinEventDao.java @@ -0,0 +1,70 @@ +/** + * 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.dataaggre.dao.evaluationindex; + +import com.epmet.dataaggre.dto.evaluationindex.EventCategoryResultDTO; +import com.epmet.dataaggre.dto.evaluationindex.form.EventCategoryFormDTO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @Author sun + * @Description 指标统计服务 + */ +@Mapper +public interface PingYinEventDao { + /** + * 获取项目分类 + * + * @Param customerId + * @Return {@link List< EventCategoryResultDTO>} + * @Author zhaoqifeng + * @Date 2022/12/9 13:40 + */ + List selectProjectCategory(@Param("customerId")String customerId); + + /** + * 获取例行工作分类 + * + * @Param + * @Return {@link List< EventCategoryResultDTO>} + * @Author zhaoqifeng + * @Date 2022/12/9 13:41 + */ + List selectWorkCategory(); + + /** + * 项目赋值得分 + * @Param formDTO + * @Return {@link List< EventCategoryResultDTO>} + * @Author zhaoqifeng + * @Date 2022/12/9 11:00 + */ + List selectProjectCategoryScoreList(EventCategoryFormDTO formDTO); + + /** + * 例行工作赋值得分 + * @Param formDTO + * @Return {@link List< EventCategoryResultDTO>} + * @Author zhaoqifeng + * @Date 2022/12/9 11:00 + */ + List selectWorkCategoryScoreList(EventCategoryFormDTO formDTO); +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/PingYinEventService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/PingYinEventService.java new file mode 100644 index 0000000000..9e93890ad2 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/PingYinEventService.java @@ -0,0 +1,24 @@ +package com.epmet.dataaggre.service.evaluationindex; + +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.dataaggre.dto.evaluationindex.EventCategoryResultDTO; +import com.epmet.dataaggre.dto.evaluationindex.form.EventCategoryFormDTO; + +import java.util.List; + +/** + * @author Administrator + */ +public interface PingYinEventService { + + /** + * 事件赋值得分 + * + * @Param tokenDto + * @Param formDTO + * @Return {@link List} + * @Author zhaoqifeng + * @Date 2022/12/9 9:55 + */ + List getEventCategorySore (TokenDto tokenDto, EventCategoryFormDTO formDTO); +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/PingYinEventServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/PingYinEventServiceImpl.java new file mode 100644 index 0000000000..d2b3180459 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/PingYinEventServiceImpl.java @@ -0,0 +1,98 @@ +package com.epmet.dataaggre.service.evaluationindex.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.dataaggre.constant.DataSourceConstant; +import com.epmet.dataaggre.dao.evaluationindex.PingYinEventDao; +import com.epmet.dataaggre.dto.evaluationindex.EventCategoryResultDTO; +import com.epmet.dataaggre.dto.evaluationindex.form.EventCategoryFormDTO; +import com.epmet.dataaggre.service.evaluationindex.PingYinEventService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; + +/** + * @Author sun + * @Description 指标统计服务 + */ +@Service +@DataSource(DataSourceConstant.EVALUATION_INDEX_READ) +@Slf4j +public class PingYinEventServiceImpl implements PingYinEventService { + + @Resource + private PingYinEventDao pingYinEventDao; + + /** + * 事件赋值得分 + * + * @param tokenDto + * @param formDTO + * @Param tokenDto + * @Param formDTO + * @Return {@link List < EventCategoryResultDTO >} + * @Author zhaoqifeng + * @Date 2022/12/9 9:55 + */ + @Override + public List getEventCategorySore(TokenDto tokenDto, EventCategoryFormDTO formDTO) { + List result = new ArrayList<>(); + if (StringUtils.isNotBlank(formDTO.getStartTime())){ + formDTO.setStartTime(DateUtils.getBeforeNDay(formDTO.getStartTime(), NumConstant.ONE)); + } + if (StringUtils.isBlank(formDTO.getOrgId())){ + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); + if (null == staffInfo){ + throw new EpmetException("未查询到此工作人员的所属组织信息..."); + } + formDTO.setOrgId(staffInfo.getAgencyId()); + formDTO.setOrgType("agency"); + } + formDTO.setCustomerId(tokenDto.getCustomerId()); + //获取项目分类 + List projectCategoryList = pingYinEventDao.selectProjectCategory(formDTO.getCustomerId()); + //获取项目赋值得分统计 + List projectScoreList = pingYinEventDao.selectProjectCategoryScoreList(formDTO); + if (CollectionUtils.isNotEmpty(projectScoreList)) { + projectCategoryList.forEach(item -> { + projectScoreList.stream().filter(e -> item.getCategoryCode().equals(e.getParentCategoryCode())).forEach(e -> { + item.setEventTotal(item.getEventTotal() + e.getEventTotal()); + item.setTotalScore(item.getTotalScore() + e.getTotalScore()); + }); + item.getChildren().forEach(son -> projectScoreList.stream().filter(e -> son.getCategoryCode().equals(e.getCategoryCode())).forEach(e -> { + son.setEventTotal(e.getEventTotal()); + son.setTotalScore(e.getTotalScore()); + })); + }); + } + result.addAll(projectCategoryList); + //获取例行工作分类 + List workCategoryList = pingYinEventDao.selectWorkCategory(); + //获取例行工作赋值得分统计 + List workScoreList = pingYinEventDao.selectWorkCategoryScoreList(formDTO); + if (CollectionUtils.isNotEmpty(workScoreList)) { + workCategoryList.forEach(item -> { + workScoreList.stream().filter(e -> item.getCategoryCode().equals(e.getParentCategoryCode())).forEach(e -> { + item.setEventTotal(item.getEventTotal() + e.getEventTotal()); + item.setTotalScore(item.getTotalScore() + e.getTotalScore()); + }); + item.getChildren().forEach(son -> workScoreList.stream().filter(e -> son.getCategoryCode().equals(e.getCategoryCode())).forEach(e -> { + son.setEventTotal(e.getEventTotal()); + son.setTotalScore(e.getTotalScore()); + })); + }); + } + result.addAll(workCategoryList); + return result; + } +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml index 0237f7f5d7..e800647308 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml @@ -166,6 +166,11 @@ dynamic: url: @datasource.druid.partymember.url@ username: @datasource.druid.partymember.username@ password: @datasource.druid.partymember.password@ + evaluationIndexRead: + driver-class-name: com.mysql.cj.jdbc.Driver + url: @datasource.druid.evaluationIndex1.url@ + username: @datasource.druid.evaluationIndex1.username@ + password: @datasource.druid.evaluationIndex1.password@ feign: hystrix: enabled: true diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/PingYinEventDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/PingYinEventDao.xml new file mode 100644 index 0000000000..db627975ae --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/PingYinEventDao.xml @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/EventInfoFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/EventInfoFormDTO.java index c54642b6f1..88eede71e8 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/EventInfoFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/EventInfoFormDTO.java @@ -4,6 +4,7 @@ import com.epmet.commons.tools.dto.form.PageFormDTO; import lombok.Data; import java.io.Serializable; +import java.util.Date; import java.util.List; /** @@ -27,4 +28,7 @@ public class EventInfoFormDTO extends PageFormDTO implements Serializable { * 2在完全初始化之后,由于eventreport_pingyin表没有客户ID,初始化其他客户的数据时候可以设2,直接新增 */ private String initFlag = "0"; + + private Date startTime; + private Date endTime; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/EventreportPingyinDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/EventreportPingyinDTO.java new file mode 100644 index 0000000000..05682f55a0 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/EventreportPingyinDTO.java @@ -0,0 +1,179 @@ +package com.epmet.dto.screen; + +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 平阴区事件上报中间表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-07-22 + */ +@Data +public class EventreportPingyinDTO { + + private static final long serialVersionUID = 1L; + + /** + * 上报区县代码,参照6位行政区划代码 + */ + private String qxBm; + + /** + * 上报区县名称 + */ + private String qxMc; + + /** + * 网格编码,参照《山东省社会治理网格化智能工作平台数据标准》 + */ + private String gridCode; + + /** + * 网格名称 + */ + private String gridName; + + /** + * 事件编号,可以使用区县系统中的事件唯一识别码 + */ + private String eventCode; + + /** + * 事件名称 + */ + private String eventName; + + /** + * 事件类别,参照《山东省社会治理网格化智能工作平台数据标准》10.19 + */ + private String eventCategory; + + /** + * 上报网格员姓名 + */ + private String gridUserName; + + /** + * 上报网格员的身份证号码 + */ + private String gridUserCardid; + + /** + * 事件上报时间 + */ + private Date reportTime; + + /** + * 事件发生时间 + */ + private Date happenTime; + + /** + * 事件发生地点描述 + */ + private String happenPlace; + + /** + * 事件简述,详细一些,文字数量不少于10字 + */ + private String eventDescription; + + /** + * 事件办结方式,符合《标准》10.20 + */ + private String waysOfResolving; + + /** + * 必填 是否化解,填写Y、N(Y 是 N 否) + */ + private String successfulOrNo; + + /** + * 必填 是否办结,填写Y、N(Y 是 N 否) + */ + private String successfulDefuse; + + /** + * 办结层级,符合《标准》10.21 + */ + private String completeLevel; + + /** + * 办结时间,办结后填写 + */ + private Date completeTime; + + /** + * 事件发生位置经度,wgs84坐标系,请勿用火星坐标系,不得跑出辖区 + */ + private BigDecimal lng; + + /** + * 事件发生位置纬度,wgs84坐标系,请勿用火星坐标系,不得跑出辖区 + */ + private BigDecimal lat; + + /** + * 事件主要当事人姓名 + */ + private String name; + + /** + * 事件涉及人数 + */ + private Integer numberInvolved; + + /** + * 事件涉及单位名称 + */ + private String relatedUnites; + + /** + * 重点场所类别,符合《标准》10.25 + */ + private String keyAreaType; + + /** + * 宗教活动规模,符合《标准》10.26 + */ + private String religionScale; + + /** + * 宗教类别,符合《标准》10.27 + */ + private String religionType; + + /** + * 重点场所是否变动,填写Y、N(Y 是 N 否) + */ + private String isKeyareaState; + + /** + * 重点人员是否在当地,填写Y、N(Y 是 N 否) + */ + private String isKeypeopleLocate; + + /** + * 重点人员现状描述 + */ + private String keypeopleStatus; + + /** + * 例行工作编辑插入、更新时间,县市区填写 + */ + private Date updateTime; + + /** + * 事件是否删除,Y:是、N:否 + */ + private String isDel; + + /** + * 入库时间,自动生成,请勿设置 + */ + private Date recoredInsertTime; + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/GridstaffWorkInfoPingyinDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/GridstaffWorkInfoPingyinDTO.java new file mode 100644 index 0000000000..161a63e263 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/GridstaffWorkInfoPingyinDTO.java @@ -0,0 +1,87 @@ +package com.epmet.dto.screen; + +import lombok.Data; + +import java.util.Date; + +/** + * 平阴区网格员例行工作信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-07-22 + */ +@Data +public class GridstaffWorkInfoPingyinDTO { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 上报区县代码,参照6位行政区划代码 + */ + private String qxBm; + + /** + * 上报区县名称 + */ + private String qxMc; + + /** + * 网格编码 + */ + private String gridCode; + + /** + * 网格名称 + */ + private String gridName; + + private String gridId; + + /** + * 例行工作类型,应符合10.27中的例行工作类型 + */ + private String workType; + + /** + * 发生日期,格式为“YYYY-MM-DD” + */ + private Date happenTime; + + /** + * 基础信息主键,出租房巡查、重点场所巡查、刑满释放人员、社区矫正、吸毒人员、信访人员重点青少年和精神障碍者必填 + */ + private Integer baseInfoId; + + /** + * 有无变动(异常),Y:是、N:否 + */ + private String workResult; + + /** + * 说明 + */ + private String workContent; + + /** + * 例行工作编辑插入、更新时间,,县市区填写 + */ + private Date updateTime; + + /** + * 例行工作是否删除,Y:是、N:否 + */ + private String isDel; + + /** + * 入库时间,自动生成,请勿设置 + */ + private Date recoredInsertTime; + + private String happenTimeString; + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/SavePyEventDataFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/SavePyEventDataFormDTO.java new file mode 100644 index 0000000000..e415027135 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/SavePyEventDataFormDTO.java @@ -0,0 +1,30 @@ +package com.epmet.dto.screen.form;/** + * @author ZhaoQiFeng + * @date 2022/12/8 + * @apiNote + */ + +import com.epmet.dto.screen.EventreportPingyinDTO; +import com.epmet.dto.screen.GridstaffWorkInfoPingyinDTO; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2022/12/8 13:47 + */ +@Data +public class SavePyEventDataFormDTO implements Serializable { + private static final long serialVersionUID = 526763788231934112L; + /** + * 项目列表 + */ + private List projectList; + /** + * 例行工作列表 + */ + private List workList; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java index ffd9da0f11..e6cff07c10 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java @@ -12,6 +12,7 @@ import com.epmet.dto.org.form.GridBaseInfoFormDTO; import com.epmet.dto.org.result.CustomerAgencyDTO; import com.epmet.dto.org.result.CustomerGridDTO; import com.epmet.dto.screen.form.InitCustomerIndexForm; +import com.epmet.dto.screen.form.SavePyEventDataFormDTO; import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO; import com.epmet.dto.stats.form.FactUserHouseFormDTO; import com.epmet.dto.user.form.StaffBaseInfoFormDTO; @@ -379,4 +380,7 @@ public interface DataStatisticalOpenFeignClient { @PostMapping("/data/stats/factAgencyUserHouseDaily/userHouseStatNeighborhood") Result userHouseStatNeighborhood(@RequestBody FactUserHouseFormDTO formDTO); + + @PostMapping("/data/stats/datareporting/saveData") + Result saveData(@RequestBody SavePyEventDataFormDTO formDTO); } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java index a46ceb0635..7eb0e45316 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java @@ -13,6 +13,7 @@ import com.epmet.dto.org.form.GridBaseInfoFormDTO; import com.epmet.dto.org.result.CustomerAgencyDTO; import com.epmet.dto.org.result.CustomerGridDTO; import com.epmet.dto.screen.form.InitCustomerIndexForm; +import com.epmet.dto.screen.form.SavePyEventDataFormDTO; import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO; import com.epmet.dto.stats.form.FactUserHouseFormDTO; import com.epmet.dto.user.form.StaffBaseInfoFormDTO; @@ -372,4 +373,9 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp public Result userHouseStatNeighborhood(FactUserHouseFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "userHouseStatNeighborhood", formDTO); } + + @Override + public Result saveData(SavePyEventDataFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "SavePyEventDataFormDTO", formDTO); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DataReportingController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DataReportingController.java index a61a208f34..54f5b02b41 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DataReportingController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DataReportingController.java @@ -7,6 +7,7 @@ import com.epmet.dto.basereport.result.EventInfoResultDTO; import com.epmet.dto.org.form.GridBaseInfoFormDTO; import com.epmet.dto.org.result.CustomerAgencyDTO; import com.epmet.dto.org.result.CustomerGridDTO; +import com.epmet.dto.screen.form.SavePyEventDataFormDTO; import com.epmet.dto.user.form.StaffBaseInfoFormDTO; import com.epmet.dto.user.param.MidPatrolFormDTO; import com.epmet.dto.user.result.GridUserInfoDTO; @@ -14,12 +15,14 @@ import com.epmet.dto.user.result.MidPatrolDetailResult; import com.epmet.dto.user.result.MidPatrolRecordResult; import com.epmet.opendata.dto.BaseDisputeProcessDTO; import com.epmet.service.DataReportingService; +import com.epmet.service.evaluationindex.screen.ScreenPyEventDataService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import javax.annotation.Resource; import java.util.List; /** @@ -31,6 +34,8 @@ import java.util.List; public class DataReportingController { @Autowired private DataReportingService dataReportingService; + @Resource + private ScreenPyEventDataService screenPyEventDataService; /** * @Author sun @@ -106,4 +111,18 @@ public class DataReportingController { public Result> getEventInfoV2(@RequestBody(required = false) EventInfoFormDTO formDTO) { return new Result>().ok(dataReportingService.getEventInfoV2(formDTO)); } + + /** + * 保存同步到中间库的数据 + * + * @Param formDTO + * @Return {@link Result} + * @Author zhaoqifeng + * @Date 2022/12/8 16:03 + */ + @PostMapping("saveData") + public Result getEventInfoV2(@RequestBody(required = false) SavePyEventDataFormDTO formDTO) { + screenPyEventDataService.saveData(formDTO); + return new Result(); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPyEventDataDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPyEventDataDao.java new file mode 100644 index 0000000000..ed3f74ccc9 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPyEventDataDao.java @@ -0,0 +1,16 @@ +package com.epmet.dao.evaluationindex.screen; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.evaluationindex.screen.ScreenPyEventDataEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 上报到市平台中间库的事件 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-12-08 + */ +@Mapper +public interface ScreenPyEventDataDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenPyEventDataEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenPyEventDataEntity.java new file mode 100644 index 0000000000..8039234f00 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenPyEventDataEntity.java @@ -0,0 +1,64 @@ +package com.epmet.entity.evaluationindex.screen; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 上报到市平台中间库的事件 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-12-08 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("screen_py_event_data") +public class ScreenPyEventDataEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + ///** + // * 客户Id + // */ + //private String customerId; + // + ///** + // * 上级组织Id + // */ + //private String parentId; + // + ///** + // * 所有上级ID,用英文逗号分开 + // */ + //private String allParentIds; + + /** + * 事件Id + */ + private String eventId; + + /** + * 事件类别 上报事件:project;例行工作:work + */ + private String eventType; + + /** + * 事件时间 + */ + private Date eventCreateTime; + + /** + * 事件分类编码 + */ + private String categoryCode; + + ///** + // * 父类事件分类编码 + // */ + //private String parentCategoryCode; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPyEventDataService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPyEventDataService.java new file mode 100644 index 0000000000..3c060d2ad6 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPyEventDataService.java @@ -0,0 +1,24 @@ +package com.epmet.service.evaluationindex.screen; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.screen.form.SavePyEventDataFormDTO; +import com.epmet.entity.evaluationindex.screen.ScreenPyEventDataEntity; + +/** + * 上报到市平台中间库的事件 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-12-08 + */ +public interface ScreenPyEventDataService extends BaseService { + /** + * 保存同步到中间库的数据 + * + * @Param formDTO + * @Return + * @Author zhaoqifeng + * @Date 2022/12/8 11:14 + */ + void saveData(SavePyEventDataFormDTO formDTO); + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPyEventDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPyEventDataServiceImpl.java new file mode 100644 index 0000000000..01e9dbda03 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPyEventDataServiceImpl.java @@ -0,0 +1,76 @@ +package com.epmet.service.evaluationindex.screen.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.evaluationindex.screen.ScreenPyEventDataDao; +import com.epmet.dto.screen.form.SavePyEventDataFormDTO; +import com.epmet.entity.evaluationindex.screen.ScreenPyEventDataEntity; +import com.epmet.service.evaluationindex.screen.ScreenPyEventDataService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Service; + +/** + * 上报到市平台中间库的事件 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-12-08 + */ +@Slf4j +@Service +@DataSource(DataSourceConstant.EVALUATION_INDEX) +public class ScreenPyEventDataServiceImpl extends BaseServiceImpl implements ScreenPyEventDataService { + + /** + * 保存同步到中间库的数据 + * + * @param formDTO + * @Param formDTO + * @Return + * @Author zhaoqifeng + * @Date 2022/12/8 11:14 + */ + @Override + public void saveData(SavePyEventDataFormDTO formDTO) { + if (CollectionUtils.isNotEmpty(formDTO.getProjectList())) { + formDTO.getProjectList().forEach(item -> { + ScreenPyEventDataEntity entity = new ScreenPyEventDataEntity(); + entity.setEventId(item.getEventCode().replace("py_", "")); + entity.setEventType("project"); + entity.setEventCreateTime(item.getReportTime()); + entity.setCategoryCode(item.getEventCategory()); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ScreenPyEventDataEntity::getEventId, entity.getEventId()); + wrapper.eq(ScreenPyEventDataEntity::getEventType, entity.getEventType()); + ScreenPyEventDataEntity event = baseDao.selectOne(wrapper); + if (null == event) { + baseDao.insert(entity); + } else { + entity.setId(event.getId()); + baseDao.updateById(entity); + } + }); + } + if (CollectionUtils.isNotEmpty(formDTO.getWorkList())) { + formDTO.getWorkList().forEach(item -> { + ScreenPyEventDataEntity entity = new ScreenPyEventDataEntity(); + entity.setEventId(item.getId()); + entity.setEventType("work"); + entity.setEventCreateTime(item.getHappenTime()); + entity.setCategoryCode(item.getWorkType()); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ScreenPyEventDataEntity::getEventId, entity.getEventId()); + wrapper.eq(ScreenPyEventDataEntity::getEventType, entity.getEventType()); + ScreenPyEventDataEntity event = baseDao.selectOne(wrapper); + if (null == event) { + baseDao.insert(entity); + } else { + entity.setId(event.getId()); + baseDao.updateById(entity); + } + }); + } + } +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPyEventDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPyEventDataDao.xml new file mode 100644 index 0000000000..9f07fd4b0b --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPyEventDataDao.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/EventreportPingyinController.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/EventreportPingyinController.java index cc44f4c5b8..5969fcc7cb 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/EventreportPingyinController.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/EventreportPingyinController.java @@ -36,4 +36,17 @@ public class EventreportPingyinController { return new Result(); } + /** + * 将数据同步到平阴库 + * @Param formDTO + * @Return {@link Result} + * @Author zhaoqifeng + * @Date 2022/12/9 14:15 + */ + @PostMapping("saveData") + public Result saveData(@RequestBody(required = false) EventInfoFormDTO formDTO) { + eventreportPingyinService.saveData(formDTO); + return new Result(); + } + } diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/GridstaffWorkInfoPingyinController.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/GridstaffWorkInfoPingyinController.java index 3dd7d54d03..f209818c61 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/GridstaffWorkInfoPingyinController.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/GridstaffWorkInfoPingyinController.java @@ -1,20 +1,14 @@ package com.epmet.opendata.controller; -import com.epmet.commons.tools.aop.NoRepeatSubmit; -import com.epmet.commons.tools.page.PageData; -import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; -import com.epmet.commons.tools.validator.AssertUtils; -import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.commons.tools.validator.group.AddGroup; -import com.epmet.commons.tools.validator.group.UpdateGroup; -import com.epmet.commons.tools.validator.group.DefaultGroup; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; +import com.epmet.dto.basereport.form.EventInfoFormDTO; +import com.epmet.opendata.service.GridstaffWorkInfoPingyinService; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; -import javax.servlet.http.HttpServletResponse; -import java.util.List; -import java.util.Map; +import javax.annotation.Resource; /** @@ -27,6 +21,20 @@ import java.util.Map; @RequestMapping("gridstaffWorkInfoPingyin") public class GridstaffWorkInfoPingyinController { + @Resource + private GridstaffWorkInfoPingyinService gridstaffWorkInfoPingyinService; + /** + * 将数据同步到平阴库 + * @Param formDTO + * @Return {@link Result} + * @Author zhaoqifeng + * @Date 2022/12/9 14:15 + */ + @PostMapping("saveData") + public Result saveData(@RequestBody(required = false) EventInfoFormDTO formDTO) { + gridstaffWorkInfoPingyinService.saveData(formDTO); + return new Result(); + } } diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/EventreportPingyinService.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/EventreportPingyinService.java index d2fe6c88f2..9091b7876e 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/EventreportPingyinService.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/EventreportPingyinService.java @@ -20,4 +20,13 @@ public interface EventreportPingyinService extends BaseService list = result.getData(); saveEvent(list, formDTO.getInitFlag()); + //将同步的数据保存 + SavePyEventDataFormDTO savePyEventData = new SavePyEventDataFormDTO(); + savePyEventData.setProjectList(ConvertUtils.sourceToTarget(list, EventreportPingyinDTO.class)); + dataStatisticalOpenFeignClient.saveData(savePyEventData); //分批次循环 while (CollectionUtils.isNotEmpty(list) && list.size() == formDTO.getPageSize()) { formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE); result = dataStatisticalOpenFeignClient.getEventInfoV2(formDTO); list = result.getData(); saveEvent(list, formDTO.getInitFlag()); + //将同步的数据保存 + savePyEventData = new SavePyEventDataFormDTO(); + savePyEventData.setProjectList(ConvertUtils.sourceToTarget(list, EventreportPingyinDTO.class)); + dataStatisticalOpenFeignClient.saveData(savePyEventData); } + + + } + + /** + * 将数据同步到平阴库 + * + * @param formDTO + * @Param formDTO + * @Return + * @Author zhaoqifeng + * @Date 2022/12/9 14:16 + */ + @Override + public void saveData(EventInfoFormDTO formDTO) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.ge(EventreportPingyinEntity::getReportTime, formDTO.getStartTime()); + wrapper.le(EventreportPingyinEntity::getReportTime, formDTO.getEndTime()); + List list = baseDao.selectList(wrapper); + List> partition = ListUtils.partition(list, NumConstant.ONE_THOUSAND); + partition.forEach(part -> { + //将同步的数据保存 + SavePyEventDataFormDTO savePyEventData = new SavePyEventDataFormDTO(); + savePyEventData.setProjectList(ConvertUtils.sourceToTarget(part, EventreportPingyinDTO.class)); + dataStatisticalOpenFeignClient.saveData(savePyEventData); + }); } private void saveEvent(List list, String initFlag) { diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffWorkInfoPingyinServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffWorkInfoPingyinServiceImpl.java index 32511e267a..3577f3311d 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffWorkInfoPingyinServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffWorkInfoPingyinServiceImpl.java @@ -13,24 +13,30 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.StrUtil; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.dto.basereport.form.EventInfoFormDTO; import com.epmet.dto.form.patrol.PatrolQueryFormDTO; import com.epmet.dto.result.PatrolRoutineWorkResult; +import com.epmet.dto.screen.GridstaffWorkInfoPingyinDTO; +import com.epmet.dto.screen.form.SavePyEventDataFormDTO; +import com.epmet.feign.DataStatisticalOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.opendata.dao.GridstaffWorkInfoPingyinDao; import com.epmet.opendata.dto.form.UpsertPatrolRecordForm; import com.epmet.opendata.entity.GridstaffWorkInfoPingyinEntity; import com.epmet.opendata.service.GridstaffWorkInfoPingyinService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.ListUtils; import org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.CollectionUtils; +import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; /** * 平阴区网格员例行工作信息 @@ -44,6 +50,8 @@ public class GridstaffWorkInfoPingyinServiceImpl extends BaseServiceImpl data; + do { + Result> record = epmetUserOpenFeignClient.getPatrolRoutineWorkListV2(midPatrolFormDTO); + if (record == null || !record.success()) { + log.warn("获取例行工作记录V2失败,param:{}", JSON.toJSONString(midPatrolFormDTO)); + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode()); + } + data = record.getData(); + if (CollectionUtils.isNotEmpty(record.getData())) { + List newList = new ArrayList<>(); + data.forEach(item -> { + if (StringUtils.isBlank(item.getGridId())){ + return; + } + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(item.getGridId()); + if (null == gridInfo) { + return; + } + item.setGridCode(gridInfo.getCode()); + if (StringUtils.isNotBlank(item.getGridCode())) { + newList.add(item); + } + }); + List list = newList.stream().map(item -> { + GridstaffWorkInfoPingyinDTO dto = new GridstaffWorkInfoPingyinDTO(); + dto.setId(item.getId()); + dto.setHappenTime(DateUtils.parseDate(item.getHappenTime().concat(" 00:00:00"), DateUtils.DATE_PATTERN)); + dto.setWorkType(item.getWorkTypeSecondCode()); + return dto; + }).collect(Collectors.toList()); + //将同步的数据保存 + SavePyEventDataFormDTO savePyEventData = new SavePyEventDataFormDTO(); + savePyEventData.setWorkList(list); + dataStatisticalOpenFeignClient.saveData(savePyEventData); + } + midPatrolFormDTO.setPageNo(midPatrolFormDTO.getPageNo() + 1); + } while (data.size() == NumConstant.ONE_THOUSAND); + } + /** * Desc: 数据存入 * @@ -112,11 +174,17 @@ public class GridstaffWorkInfoPingyinServiceImpl extends BaseServiceImpl list) { List insertList = new ArrayList<>(); + List newList = new ArrayList<>(); list.forEach(o -> { if (StringUtils.isBlank(o.getGridCode())) { return; } insertList.add(buildNewEntity(o)); + GridstaffWorkInfoPingyinDTO dto = new GridstaffWorkInfoPingyinDTO(); + dto.setId(o.getId()); + dto.setHappenTime(DateUtils.parseDate(o.getHappenTime().concat(" 00:00:00"), DateUtils.DATE_PATTERN)); + dto.setWorkType(o.getWorkTypeSecondCode()); + newList.add(dto); }); //insert if (CollectionUtils.isEmpty(insertList)) { @@ -124,6 +192,10 @@ public class GridstaffWorkInfoPingyinServiceImpl extends BaseServiceImpl