diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/StaffPatrolStatsFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/StaffPatrolStatsFormDTO.java new file mode 100644 index 0000000000..252162a682 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/StaffPatrolStatsFormDTO.java @@ -0,0 +1,22 @@ +package com.epmet.dto.extract.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * desc: 工作人员巡查统计参数 + * + * @author LiuJanJun + * @date 2021/6/29 10:19 上午 + */ +@Data +public class StaffPatrolStatsFormDTO implements Serializable { + + private static final long serialVersionUID = -3639860733213306581L; + private String customerId; + private String dateId; + private String staffId; + private String gridId; + private String roleType; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/CustomerStaffDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/CustomerStaffDTO.java new file mode 100644 index 0000000000..a5458793dd --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/CustomerStaffDTO.java @@ -0,0 +1,137 @@ +/** + * 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.user.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 政府工作人员表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-18 + */ +@Data +public class CustomerStaffDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 关联User表的主键Id + */ + private String userId; + + /** + * 真实姓名 + */ + private String realName; + + /** + * 性别0.未知,1男,2.女 + */ + private Integer gender; + + /** + * 邮箱 + */ + private String email; + + /** + * 手机号-唯一键 + */ + private String mobile; + + /** + * 地址 + */ + private String address; + + /** + * 删除标识 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + /** + * fulltime专职parttime兼职 + */ + private String workType; + + /** + * 头像 + */ + private String headPhoto; + + /** + * inactive未激活,active已激活 + */ + private String activeFlag; + + /** + * 激活时间 + */ + private Date activeTime; + + /** + * 未禁用enable,已禁用diabled + */ + private String enableFlag; + + /** + * 客户id + */ + private String customerId; + + /** + * 角色名称 + */ + private String roleName; + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/StatsStaffPatrolRecordDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/StatsStaffPatrolRecordDailyDTO.java new file mode 100644 index 0000000000..ad8c156e77 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/StatsStaffPatrolRecordDailyDTO.java @@ -0,0 +1,147 @@ +/** + * 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.user.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * [天]工作人员巡查记录统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-29 + */ +@Data +public class StatsStaffPatrolRecordDailyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户Id + */ + private String customerId; + + /** + * 统计日期 关联日期dim表 + */ + private String dateId; + + /** + * 周ID + */ + private String weekId; + + /** + * 月ID + */ + private String monthId; + + /** + * 季ID + */ + private String quarterId; + + /** + * 年ID + */ + private String yearId; + + /** + * 网格id + */ + private String gridId; + + /** + * 工作人员所属组织id=网格所属的组织id + */ + private String agencyId; + + /** + * 网格所有上级id + */ + private String gridPids; + + /** + * 工作人员用户id + */ + private String staffId; + + /** + * 巡查次数 + */ + private Integer patrolTotal; + + /** + * 巡查时长 单位:秒 + */ + private Integer totalTime; + + /** + * 巡查期间直接立项项目数 + */ + private Integer reportProjectCount; + + /** + * 最新的巡查开始时间 + */ + private Date latestPatrolTime; + + /** + * 最新的巡查状态 正在巡查中:patrolling;结束:end + */ + private String latestPatrolStatus; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private Integer 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-server/src/main/java/com/epmet/controller/BizDataStatsController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/BizDataStatsController.java new file mode 100644 index 0000000000..94e30fb994 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/BizDataStatsController.java @@ -0,0 +1,35 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; +import com.epmet.service.evaluationindex.extract.biz.BizDataStatsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @Description 用户统计 + * @ClassName StatsUserController + * @Auth wangc + * @Date 2020-06-23 15:18 + */ +@RestController +@RequestMapping("bizData/stats") +public class BizDataStatsController { + + @Autowired + private BizDataStatsService bizDataStatsService; + + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @description 工作端数据一期,用户分析:参与用户、注册用户分析 + * @Date 2021/3/26 13:27 + **/ + @RequestMapping("patrol") + public Result execute(@RequestBody StaffPatrolStatsFormDTO formDTO) { + bizDataStatsService.initStaffPatrolStats(formDTO); + return new Result(); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerStaffGridDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerStaffGridDao.java new file mode 100644 index 0000000000..171f45db3c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerStaffGridDao.java @@ -0,0 +1,38 @@ +/** + * 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.org; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; +import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; +import com.epmet.entity.org.CustomerStaffGridEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 客户网格人员关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Mapper +public interface CustomerStaffGridDao extends BaseDao { + + List selectGridStaffList(StaffPatrolStatsFormDTO formDTO); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/StatsStaffPatrolRecordDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/StatsStaffPatrolRecordDailyDao.java new file mode 100644 index 0000000000..60176314f3 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/StatsStaffPatrolRecordDailyDao.java @@ -0,0 +1,38 @@ +/** + * 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.user; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; +import com.epmet.entity.user.StatsStaffPatrolRecordDailyEntity; +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-06-29 + */ +@Mapper +public interface StatsStaffPatrolRecordDailyDao extends BaseDao { + + Integer insertBatch(@Param("list") List insertList); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java index dabacfd7da..608fe55e3f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java @@ -1,9 +1,12 @@ package com.epmet.dao.user; import com.epmet.dto.extract.form.GridHeartedFormDTO; +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; import com.epmet.dto.extract.result.UserPartyResultDTO; import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.user.result.CommonTotalAndIncCountResultDTO; +import com.epmet.dto.user.result.CustomerStaffDTO; +import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -159,5 +162,17 @@ public interface UserDao { * @date 2021/6/8 5:21 下午 */ List selectStaffInfo(@Param("list") List staffUserIdList); + + /** + * desc: 根据角色key条件获取所有的人 + * + * @param formDTO + * @return java.util.List + * @author LiuJanJun + * @date 2021/6/29 2:58 下午 + */ + List selectUserByRoleKey(StaffPatrolStatsFormDTO formDTO); + + List selectLastStaffPatrolList(StaffPatrolStatsFormDTO formDTO); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerStaffGridEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerStaffGridEntity.java new file mode 100644 index 0000000000..bb94ef3ff2 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerStaffGridEntity.java @@ -0,0 +1,40 @@ +/** + * 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.org; + +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 2020-03-16 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("customer_staff_grid") +public class CustomerStaffGridEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + private String customerId; + private String gridId; + private String userId; +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/user/StatsStaffPatrolRecordDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/user/StatsStaffPatrolRecordDailyEntity.java new file mode 100644 index 0000000000..9425887126 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/user/StatsStaffPatrolRecordDailyEntity.java @@ -0,0 +1,116 @@ +/** + * 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.user; + +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 2021-06-29 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("stats_staff_patrol_record_daily") +public class StatsStaffPatrolRecordDailyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 统计日期 关联日期dim表 + */ + private String dateId; + + /** + * 周ID + */ + private String weekId; + + /** + * 月ID + */ + private String monthId; + + /** + * 季ID + */ + private String quarterId; + + /** + * 年ID + */ + private String yearId; + + /** + * 网格id + */ + private String gridId; + + /** + * 工作人员所属组织id=网格所属的组织id + */ + private String agencyId; + + /** + * 网格所有上级id + */ + private String gridPids; + + /** + * 工作人员用户id + */ + private String staffId; + + /** + * 巡查次数 + */ + private Integer patrolTotal; + + /** + * 巡查时长 单位:秒 + */ + private Integer totalTime; + + /** + * 巡查期间直接立项项目数 + */ + private Integer reportProjectCount; + + /** + * 最新的巡查开始时间 + */ + private Date latestPatrolTime; + + /** + * 最新的巡查状态 正在巡查中:patrolling;结束:end + */ + private String latestPatrolStatus; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/biz/BizDataStatsService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/biz/BizDataStatsService.java new file mode 100644 index 0000000000..c644f2393e --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/biz/BizDataStatsService.java @@ -0,0 +1,31 @@ +/** + * 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.evaluationindex.extract.biz; + +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; + +/** + * [天]工作人员巡查记录统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-29 + */ +public interface BizDataStatsService { + + void initStaffPatrolStats(StaffPatrolStatsFormDTO formDTO); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/biz/impl/BizDataStatsServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/biz/impl/BizDataStatsServiceImpl.java new file mode 100644 index 0000000000..ad796d528c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/biz/impl/BizDataStatsServiceImpl.java @@ -0,0 +1,87 @@ +package com.epmet.service.evaluationindex.extract.biz.impl; + +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; +import com.epmet.dto.user.result.CustomerStaffDTO; +import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; +import com.epmet.service.evaluationindex.extract.biz.BizDataStatsService; +import com.epmet.service.org.CustomerStaffService; +import com.epmet.service.user.StatsStaffPatrolService; +import com.epmet.service.user.UserService; +import com.epmet.util.DimIdGenerator; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * desc:【天】网格员巡查统计 + * + * @author: LiuJanJun + * @date: 2021/6/29 3:08 下午 + * @version: 1.0 + */ +@Slf4j +@Service +public class BizDataStatsServiceImpl implements BizDataStatsService { + @Autowired + private CustomerStaffService customerStaffService; + @Autowired + private UserService userService; + @Autowired + private StatsStaffPatrolService statsStaffPatrolService; + + @Override + public void initStaffPatrolStats(StaffPatrolStatsFormDTO formDTO) { + //获取所有的网格员 + //1.获取所有网格用户 + List allStaffList = customerStaffService.selectStaffGridList(formDTO); + /* if (CollectionUtils.isEmpty(allStaffList)){ + log.warn("reloadStaffPatrolStats customerId:{} have any staff,param:{}",formDTO.getCustomerId(), JSON.toJSONString(formDTO)); + return + }*/ + //获取所有含有网格员角色的用户 + List gridMemberList = userService.selectUserListByRoleKey(formDTO); + /*if (CollectionUtils.isEmpty(gridMemberList)){ + log.warn("reloadStaffPatrolStats customerId:{} have any gridMembers,param:{}",formDTO.getCustomerId(), JSON.toJSONString(formDTO)); + return + }*/ + + List lastStaffPatrolList = userService.selectLastStaffPatrolList(formDTO); + Map lastPatrolMap = lastStaffPatrolList.stream().collect(Collectors.toMap(o -> o.getGridId() + o.getStaffId(), o -> o, (o1, o2) -> o1)); + //构建数据 插入 + List insertList = new ArrayList<>(); + DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(new Date()); + allStaffList.forEach(gridStaff -> { + gridStaff.setDateId(dimIdBean.getDateId()); + gridStaff.setWeekId(dimIdBean.getWeekId()); + gridStaff.setQuarterId(dimIdBean.getQuarterId()); + gridStaff.setYearId(dimIdBean.getYearId()); + gridStaff.setMonthId(dimIdBean.getMonthId()); + StatsStaffPatrolRecordDailyDTO recordDailyDTO = lastPatrolMap.get(gridStaff.getGridId().concat(gridStaff.getStaffId())); + + gridStaff.setTotalTime(NumConstant.ZERO); + gridStaff.setPatrolTotal(NumConstant.ZERO); + gridStaff.setLatestPatrolStatus("end"); + //最后巡查时间 + gridStaff.setLatestPatrolTime(null); + if (recordDailyDTO != null) { + gridStaff.setLatestPatrolStatus(recordDailyDTO.getLatestPatrolStatus()); + gridStaff.setLatestPatrolTime(recordDailyDTO.getLatestPatrolTime()); + } + + gridMemberList.forEach(gridMember -> { + if (gridStaff.getStaffId().equals(gridMember.getUserId())) { + insertList.add(gridStaff); + } + }); + }); + Integer effectRow = statsStaffPatrolService.insertBatch(insertList); + log.debug("initStaffPatrolStats insert rows:{}", effectRow); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerStaffService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerStaffService.java new file mode 100644 index 0000000000..f498bbfe9c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerStaffService.java @@ -0,0 +1,22 @@ +package com.epmet.service.org; + +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; +import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; + +import java.util.List; + +/** + * @author liujianjun + */ +public interface CustomerStaffService { + + /** + * desc: 条件获取 网格下的所有人 + * + * @param formDTO + * @return java.util.List + * @author LiuJanJun + * @date 2021/6/29 3:13 下午 + */ + List selectStaffGridList(StaffPatrolStatsFormDTO formDTO); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerStaffServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerStaffServiceImpl.java new file mode 100644 index 0000000000..fc11765d10 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerStaffServiceImpl.java @@ -0,0 +1,39 @@ +package com.epmet.service.org.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.org.CustomerStaffGridDao; +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; +import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; +import com.epmet.service.org.CustomerStaffService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * desc: + * + * @author: LiuJanJun + * @date: 2021/6/29 3:14 下午 + * @version: 1.0 + */ +@Service +@DataSource(DataSourceConstant.GOV_ORG) +public class CustomerStaffServiceImpl implements CustomerStaffService { + @Autowired + private CustomerStaffGridDao customerStaffGridDao; + + /** + * desc: 条件获取 网格下的所有人 + * + * @param formDTO + * @return java.util.List + * @author LiuJanJun + * @date 2021/6/29 3:13 下午 + */ + @Override + public List selectStaffGridList(StaffPatrolStatsFormDTO formDTO) { + return customerStaffGridDao.selectGridStaffList(formDTO); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/StatsStaffPatrolService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/StatsStaffPatrolService.java new file mode 100644 index 0000000000..430a46defd --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/StatsStaffPatrolService.java @@ -0,0 +1,13 @@ +package com.epmet.service.user; + +import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; + +import java.util.List; + +/** + * @author liujianjun + */ +public interface StatsStaffPatrolService { + + Integer insertBatch(List insertList); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java index ebc01ebdb3..aecbe35158 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java @@ -2,9 +2,12 @@ package com.epmet.service.user; import com.epmet.dto.AgencySubTreeDto; import com.epmet.dto.extract.form.GridHeartedFormDTO; +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; import com.epmet.dto.org.result.OrgStaffDTO; import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.stats.user.result.UserStatisticalData; +import com.epmet.dto.user.result.CustomerStaffDTO; +import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity; import com.epmet.util.DimIdGenerator; @@ -94,4 +97,16 @@ public interface UserService { * @return com.epmet.dto.user.OrgGridManagerTotalDTO */ Map queryOrgGridManager(String customerId,List orgStaffDTOList); + + /** + * desc: 请描述类的业务用途 + * + * @param formDTO + * @return + * @author LiuJanJun + * @date 2021/6/29 10:15 上午 + */ + List selectUserListByRoleKey(StaffPatrolStatsFormDTO formDTO); + + List selectLastStaffPatrolList(StaffPatrolStatsFormDTO formDTO); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/StatsStaffPatrolServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/StatsStaffPatrolServiceImpl.java new file mode 100644 index 0000000000..a4004de4d0 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/StatsStaffPatrolServiceImpl.java @@ -0,0 +1,32 @@ +package com.epmet.service.user.impl; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.user.StatsStaffPatrolRecordDailyDao; +import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; +import com.epmet.service.user.StatsStaffPatrolService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * desc: + * + * @author: LiuJanJun + * @date: 2021/6/30 8:33 上午 + * @version: 1.0 + */ +@DataSource(DataSourceConstant.EPMET_USER) +@Service +public class StatsStaffPatrolServiceImpl implements StatsStaffPatrolService { + @Autowired + private StatsStaffPatrolRecordDailyDao statsStaffPatrolRecordDailyDao; + + @Override + public Integer insertBatch(List insertList) { + System.out.println("=====:"+JSON.toJSONString(insertList)); + return statsStaffPatrolRecordDailyDao.insertBatch(insertList); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java index 59897628e3..27ee9b6eb8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java @@ -6,15 +6,19 @@ import com.epmet.commons.tools.constant.NumConstant; import com.epmet.constant.DataSourceConstant; import com.epmet.constant.ExtractConstant; import com.epmet.constant.ProjectConstant; +import com.epmet.constant.RoleKeyConstants; import com.epmet.dao.user.UserDao; import com.epmet.dto.AgencySubTreeDto; import com.epmet.dto.extract.form.GridHeartedFormDTO; +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; import com.epmet.dto.extract.result.UserPartyResultDTO; import com.epmet.dto.org.result.OrgStaffDTO; import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.stats.user.*; import com.epmet.dto.stats.user.result.UserStatisticalData; import com.epmet.dto.user.result.CommonTotalAndIncCountResultDTO; +import com.epmet.dto.user.result.CustomerStaffDTO; +import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity; import com.epmet.service.user.UserService; import com.epmet.util.DimIdGenerator; @@ -797,4 +801,15 @@ public class UserServiceImpl implements UserService { return resultMap; } + @Override + public List selectUserListByRoleKey(StaffPatrolStatsFormDTO formDTO) { + formDTO.setRoleType(RoleKeyConstants.ROLE_KEY_GRID_MEMBER); + return userDao.selectUserByRoleKey(formDTO); + } + + @Override + public List selectLastStaffPatrolList(StaffPatrolStatsFormDTO formDTO) { + return userDao.selectLastStaffPatrolList(formDTO); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerStaffGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerStaffGridDao.xml new file mode 100644 index 0000000000..5e41b9e84d --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerStaffGridDao.xml @@ -0,0 +1,29 @@ + + + + + + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/StatsStaffPatrolRecordDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/StatsStaffPatrolRecordDailyDao.xml new file mode 100644 index 0000000000..cba48614f3 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/StatsStaffPatrolRecordDailyDao.xml @@ -0,0 +1,58 @@ + + + + + + insert into stats_staff_patrol_record_daily + ( + ID, + CUSTOMER_ID, + DATE_ID, + WEEK_ID, + MONTH_ID, + YEAR_ID, + QUARTER_ID, + GRID_ID, + AGENCY_ID, + GRID_PIDS, + STAFF_ID, + PATROL_TOTAL, + TOTAL_TIME, + REPORT_PROJECT_COUNT, + LATEST_PATROL_TIME, + LATEST_PATROL_STATUS, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.dateId}, + #{item.weekId}, + #{item.monthId}, + #{item.yearId}, + #{item.quarterId}, + #{item.gridId}, + #{item.agencyId}, + #{item.gridPids}, + #{item.staffId}, + #{item.patrolTotal}, + #{item.totalTime}, + #{item.reportProjectCount}, + #{item.latestPatrolTime}, + #{item.latestPatrolStatus}, + '0', + 0, + 'APP_USER', + now(), + 'APP_USER', + now() + ) + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml index acb6c9feb3..578d20590a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml @@ -570,4 +570,34 @@ user_id = #{userId} + +