From 4d90a611b2e6cddbd8050abce7c2be7f0bc72f19 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Thu, 15 Dec 2022 12:55:28 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BD=91=E6=A0=BC=E5=91=98=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../indexcollect/ScreenPyGridStaffDTO.java | 117 ++++++++++++++++++ .../feign/DataStatisticalOpenFeignClient.java | 4 + ...ataStatisticalOpenFeignClientFallBack.java | 6 + .../ScreenPyGridStaffController.java | 36 ++++++ .../indexcoll/ScreenPyGridStaffDao.java | 36 ++++++ .../indexcoll/ScreenPyGridStaffEntity.java | 84 +++++++++++++ .../indexcoll/ScreenPyGridStaffService.java | 15 +++ .../impl/ScreenPyGridStaffServiceImpl.java | 53 ++++++++ .../indexcoll/ScreenPyGridStaffDao.xml | 18 +++ .../impl/GridstaffInfoPingyinServiceImpl.java | 19 +++ 10 files changed, 388 insertions(+) create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/ScreenPyGridStaffDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenPyGridStaffController.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/ScreenPyGridStaffDao.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcoll/ScreenPyGridStaffEntity.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/ScreenPyGridStaffService.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/ScreenPyGridStaffServiceImpl.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyGridStaffDao.xml diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/ScreenPyGridStaffDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/ScreenPyGridStaffDTO.java new file mode 100644 index 0000000000..89e5acb5a1 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/ScreenPyGridStaffDTO.java @@ -0,0 +1,117 @@ +/** + * 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.indexcollect; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 平阴区网格员基础信息 + * + * @author generator generator@elink-cn.com + */ +@Data +public class ScreenPyGridStaffDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID 主键 + */ + private String id; + + /** + * 客户Id + */ + private String customerId; + + /** + * 网格Id + */ + private String gridId; + + /** + * 网格编码 + */ + private String gridCode; + + /** + * 网格名称 + */ + private String gridName; + + /** + * 网格名称 + */ + private String pids; + + /** + * 工作人员Id + */ + private String staffId; + + /** + * 网格员姓名 + */ + private String staffName; + + /** + * 手机号 + */ + private String mobile; + + /** + * 是否离职,格式为Y:是、N:否 + */ + private String isLeave; + + + /** + * 删除标识 0未删除;1已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + +} 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 e6cff07c10..0f90ba3d7f 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 @@ -8,6 +8,7 @@ import com.epmet.dto.basereport.result.EventInfoResultDTO; import com.epmet.dto.extract.form.*; import com.epmet.dto.group.form.GroupStatsFormDTO; import com.epmet.dto.group.form.GroupTotalFormDTO; +import com.epmet.dto.indexcollect.ScreenPyGridStaffDTO; import com.epmet.dto.org.form.GridBaseInfoFormDTO; import com.epmet.dto.org.result.CustomerAgencyDTO; import com.epmet.dto.org.result.CustomerGridDTO; @@ -383,4 +384,7 @@ public interface DataStatisticalOpenFeignClient { @PostMapping("/data/stats/datareporting/saveData") Result saveData(@RequestBody SavePyEventDataFormDTO formDTO); + + @PostMapping("/data/stats/screenPyStaffData/savelist") + Result saveList(@RequestBody List dtoList); } 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 7eb0e45316..39be018129 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 @@ -9,6 +9,7 @@ import com.epmet.dto.basereport.result.EventInfoResultDTO; import com.epmet.dto.extract.form.*; import com.epmet.dto.group.form.GroupStatsFormDTO; import com.epmet.dto.group.form.GroupTotalFormDTO; +import com.epmet.dto.indexcollect.ScreenPyGridStaffDTO; import com.epmet.dto.org.form.GridBaseInfoFormDTO; import com.epmet.dto.org.result.CustomerAgencyDTO; import com.epmet.dto.org.result.CustomerGridDTO; @@ -378,4 +379,9 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp public Result saveData(SavePyEventDataFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "SavePyEventDataFormDTO", formDTO); } + + @Override + public Result saveList(List dtoList) { + return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "saveList", dtoList); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenPyGridStaffController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenPyGridStaffController.java new file mode 100644 index 0000000000..d622b70bab --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenPyGridStaffController.java @@ -0,0 +1,36 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.indexcollect.ScreenPyGridStaffDTO; +import com.epmet.service.evaluationindex.indexcoll.ScreenPyGridStaffService; +import lombok.extern.slf4j.Slf4j; +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 java.util.List; + +/** + * 平阴区网格员基础信息 + * + * @author generator generator@elink-cn.com + */ +@Slf4j +@RestController +@RequestMapping("screenPyGridStaff") +public class ScreenPyGridStaffController { + + @Autowired + private ScreenPyGridStaffService screenPyStaffDataService; + + + @PostMapping("savelist") + public Result saveList(@RequestBody List dtoList) { + screenPyStaffDataService.saveList(dtoList); + return new Result(); + } + + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/ScreenPyGridStaffDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/ScreenPyGridStaffDao.java new file mode 100644 index 0000000000..396f2d6b8c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/ScreenPyGridStaffDao.java @@ -0,0 +1,36 @@ +package com.epmet.dao.evaluationindex.indexcoll; /** + * 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 . + */ + + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.evaluationindex.indexcoll.ScreenPyGridStaffEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 平阴区网格员基础信息 + * + * @author generator generator@elink-cn.com + */ +@Mapper +public interface ScreenPyGridStaffDao extends BaseDao { + + ScreenPyGridStaffEntity selectStaff(@Param("gridId") String gridId, @Param("staffId") String staffId); + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcoll/ScreenPyGridStaffEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcoll/ScreenPyGridStaffEntity.java new file mode 100644 index 0000000000..1c59536017 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcoll/ScreenPyGridStaffEntity.java @@ -0,0 +1,84 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.evaluationindex.indexcoll; + +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 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("screen_py_grid_staff") +public class ScreenPyGridStaffEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 网格Id + */ + private String gridId; + + /** + * 网格编码 + */ + private String gridCode; + + /** + * 网格名称 + */ + private String gridName; + + /** + * 网格名称 + */ + private String pids; + + /** + * 工作人员Id + */ + private String staffId; + + /** + * 网格员姓名 + */ + private String staffName; + + /** + * 手机号 + */ + private String mobile; + + /** + * 是否离职,格式为Y:是、N:否 + */ + private String isLeave; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/ScreenPyGridStaffService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/ScreenPyGridStaffService.java new file mode 100644 index 0000000000..057a9aa6af --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/ScreenPyGridStaffService.java @@ -0,0 +1,15 @@ +package com.epmet.service.evaluationindex.indexcoll; + +import com.epmet.dto.indexcollect.ScreenPyGridStaffDTO; + +import java.util.List; + +/** + * 平阴区网格员基础信息 + * + * @author generator generator@elink-cn.com + */ +public interface ScreenPyGridStaffService { + + void saveList(List dtoList); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/ScreenPyGridStaffServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/ScreenPyGridStaffServiceImpl.java new file mode 100644 index 0000000000..35fc1058a7 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/ScreenPyGridStaffServiceImpl.java @@ -0,0 +1,53 @@ +package com.epmet.service.evaluationindex.indexcoll.impl; + +import com.baomidou.mybatisplus.core.toolkit.IdWorker; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.StrConstant; +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.utils.ConvertUtils; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.evaluationindex.indexcoll.ScreenPyGridStaffDao; +import com.epmet.dto.indexcollect.ScreenPyGridStaffDTO; +import com.epmet.entity.evaluationindex.indexcoll.ScreenPyGridStaffEntity; +import com.epmet.service.evaluationindex.indexcoll.ScreenPyGridStaffService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 平阴区网格员基础信息 + * + * @author generator generator@elink-cn.com + */ +@Slf4j +@Service +@DataSource(DataSourceConstant.EVALUATION_INDEX) +public class ScreenPyGridStaffServiceImpl extends BaseServiceImpl implements ScreenPyGridStaffService { + + @Override + public void saveList(List dtoList) { + dtoList.forEach(d -> { + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(StrConstant.PY_CUSTOMER, d.getStaffId()); + if (null == staffInfo) { + throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", d.getStaffId())); + } + ScreenPyGridStaffEntity entity = baseDao.selectStaff(d.getGridId(), d.getStaffId()); + //存在就更新 不存在就新增 + if (null != entity) { + ScreenPyGridStaffEntity entity1 = ConvertUtils.sourceToTarget(d, ScreenPyGridStaffEntity.class); + entity1.setId(entity.getId()); + entity1.setPids(("".equals(staffInfo.getAgencyPIds()) ? staffInfo.getAgencyId() : staffInfo.getAgencyPIds() + ":") + staffInfo.getAgencyId()); + baseDao.updateById(entity1); + } else { + ScreenPyGridStaffEntity saveEntity = ConvertUtils.sourceToTarget(d, ScreenPyGridStaffEntity.class); + saveEntity.setId(IdWorker.getIdStr()); + saveEntity.setPids(("".equals(staffInfo.getAgencyPIds()) ? staffInfo.getAgencyId() : staffInfo.getAgencyPIds() + ":") + staffInfo.getAgencyId()); + insert(saveEntity); + } + }); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyGridStaffDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyGridStaffDao.xml new file mode 100644 index 0000000000..207b413c14 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyGridStaffDao.xml @@ -0,0 +1,18 @@ + + + + + + + + diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffInfoPingyinServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffInfoPingyinServiceImpl.java index 34ea9c0da5..732df55207 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffInfoPingyinServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffInfoPingyinServiceImpl.java @@ -7,6 +7,7 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.CustomerGridStaffListFormDTO; import com.epmet.dto.form.GridStaffUploadtFormDTO; +import com.epmet.dto.indexcollect.ScreenPyGridStaffDTO; import com.epmet.dto.result.CustomerGridStaffListResultDTO; import com.epmet.dto.result.GridStaffUploadResultDTO; import com.epmet.dto.user.result.GridUserInfoDTO; @@ -119,6 +120,7 @@ public class GridstaffInfoPingyinServiceImpl extends BaseServiceImpl staffList = new ArrayList<>(); result.getData().forEach(r -> { GridstaffInfoPingyinEntity entity = ConvertUtils.sourceToTarget(r, GridstaffInfoPingyinEntity.class); entity.setQxBm("370124"); @@ -142,7 +144,24 @@ public class GridstaffInfoPingyinServiceImpl extends BaseServiceImpl