Browse Source

初始化数据代码暂存

dev
jianjun 4 years ago
parent
commit
cae7da256e
  1. 22
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/StaffPatrolStatsFormDTO.java
  2. 137
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/CustomerStaffDTO.java
  3. 147
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/StatsStaffPatrolRecordDailyDTO.java
  4. 35
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/BizDataStatsController.java
  5. 38
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerStaffGridDao.java
  6. 38
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/StatsStaffPatrolRecordDailyDao.java
  7. 15
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java
  8. 40
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerStaffGridEntity.java
  9. 116
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/user/StatsStaffPatrolRecordDailyEntity.java
  10. 31
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/biz/BizDataStatsService.java
  11. 87
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/biz/impl/BizDataStatsServiceImpl.java
  12. 22
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerStaffService.java
  13. 39
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerStaffServiceImpl.java
  14. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/StatsStaffPatrolService.java
  15. 15
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java
  16. 32
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/StatsStaffPatrolServiceImpl.java
  17. 15
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java
  18. 29
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerStaffGridDao.xml
  19. 58
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/StatsStaffPatrolRecordDailyDao.xml
  20. 30
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml

22
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;
}

137
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
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.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;
}

147
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
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.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;
}

35
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();
}
}

38
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
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao.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<CustomerStaffGridEntity> {
List<StatsStaffPatrolRecordDailyDTO> selectGridStaffList(StaffPatrolStatsFormDTO formDTO);
}

38
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
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao.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<StatsStaffPatrolRecordDailyEntity> {
Integer insertBatch(@Param("list") List<StatsStaffPatrolRecordDailyDTO> insertList);
}

15
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<ScreenProjectDataDTO> selectStaffInfo(@Param("list") List<String> staffUserIdList);
/**
* desc: 根据角色key条件获取所有的人
*
* @param formDTO
* @return java.util.List<com.epmet.dto.user.result.StatsStaffPatrolRecordDalilyDTO>
* @author LiuJanJun
* @date 2021/6/29 2:58 下午
*/
List<CustomerStaffDTO> selectUserByRoleKey(StaffPatrolStatsFormDTO formDTO);
List<StatsStaffPatrolRecordDailyDTO> selectLastStaffPatrolList(StaffPatrolStatsFormDTO formDTO);
}

40
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
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity.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;
}

116
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
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity.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;
}

31
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
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.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);
}

87
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<StatsStaffPatrolRecordDailyDTO> allStaffList = customerStaffService.selectStaffGridList(formDTO);
/* if (CollectionUtils.isEmpty(allStaffList)){
log.warn("reloadStaffPatrolStats customerId:{} have any staff,param:{}",formDTO.getCustomerId(), JSON.toJSONString(formDTO));
return
}*/
//获取所有含有网格员角色的用户
List<CustomerStaffDTO> gridMemberList = userService.selectUserListByRoleKey(formDTO);
/*if (CollectionUtils.isEmpty(gridMemberList)){
log.warn("reloadStaffPatrolStats customerId:{} have any gridMembers,param:{}",formDTO.getCustomerId(), JSON.toJSONString(formDTO));
return
}*/
List<StatsStaffPatrolRecordDailyDTO> lastStaffPatrolList = userService.selectLastStaffPatrolList(formDTO);
Map<String, StatsStaffPatrolRecordDailyDTO> lastPatrolMap = lastStaffPatrolList.stream().collect(Collectors.toMap(o -> o.getGridId() + o.getStaffId(), o -> o, (o1, o2) -> o1));
//构建数据 插入
List<StatsStaffPatrolRecordDailyDTO> 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);
}
}

22
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<com.epmet.dto.org.GridInfoDTO>
* @author LiuJanJun
* @date 2021/6/29 3:13 下午
*/
List<StatsStaffPatrolRecordDailyDTO> selectStaffGridList(StaffPatrolStatsFormDTO formDTO);
}

39
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<com.epmet.dto.org.GridInfoDTO>
* @author LiuJanJun
* @date 2021/6/29 3:13 下午
*/
@Override
public List<StatsStaffPatrolRecordDailyDTO> selectStaffGridList(StaffPatrolStatsFormDTO formDTO) {
return customerStaffGridDao.selectGridStaffList(formDTO);
}
}

13
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<StatsStaffPatrolRecordDailyDTO> insertList);
}

15
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<String,Integer> queryOrgGridManager(String customerId,List<OrgStaffDTO> orgStaffDTOList);
/**
* desc: 请描述类的业务用途
*
* @param formDTO
* @return
* @author LiuJanJun
* @date 2021/6/29 10:15 上午
*/
List<CustomerStaffDTO> selectUserListByRoleKey(StaffPatrolStatsFormDTO formDTO);
List<StatsStaffPatrolRecordDailyDTO> selectLastStaffPatrolList(StaffPatrolStatsFormDTO formDTO);
}

32
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<StatsStaffPatrolRecordDailyDTO> insertList) {
System.out.println("=====:"+JSON.toJSONString(insertList));
return statsStaffPatrolRecordDailyDao.insertBatch(insertList);
}
}

15
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<CustomerStaffDTO> selectUserListByRoleKey(StaffPatrolStatsFormDTO formDTO) {
formDTO.setRoleType(RoleKeyConstants.ROLE_KEY_GRID_MEMBER);
return userDao.selectUserByRoleKey(formDTO);
}
@Override
public List<StatsStaffPatrolRecordDailyDTO> selectLastStaffPatrolList(StaffPatrolStatsFormDTO formDTO) {
return userDao.selectLastStaffPatrolList(formDTO);
}
}

29
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerStaffGridDao.xml

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.org.CustomerStaffGridDao">
<select id="selectGridStaffList" resultType="com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO">
SELECT
sg.customer_id,
sg.user_id AS staffId,
sg.grid_id,
grid.grid_name,
grid.PID agencyId,
grid.PIDS gridPids
FROM
customer_staff_grid sg
LEFT JOIN customer_grid grid ON grid.id = sg.grid_id
WHERE
sg.del_flag = '0'
<if test="customerId != null and customerId != ''">
AND sg.customer_id = #{customerId}
</if>
<if test="gridId != null and gridId != ''">
AND sg.GRID_ID = #{gridId}
</if>
</select>
</mapper>

58
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/StatsStaffPatrolRecordDailyDao.xml

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.user.StatsStaffPatrolRecordDailyDao">
<insert id="insertBatch">
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
<foreach collection="list" item="item" separator=",">
(
(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()
)
</foreach>
</insert>
</mapper>

30
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml

@ -570,4 +570,34 @@
user_id = #{userId}
</foreach>
</select>
<select id="selectUserByRoleKey" resultType="com.epmet.dto.user.result.CustomerStaffDTO">
SELECT DISTINCT
s.USER_ID,
s.*,
gsr.ROLE_NAME
FROM
customer_staff s
LEFT JOIN staff_role sr ON sr.STAFF_ID = s.USER_ID
AND sr.CUSTOMER_ID = s.CUSTOMER_ID
LEFT JOIN gov_staff_role gsr ON gsr.ID = sr.ROLE_ID
WHERE
s.del_flag = '0'
AND gsr.ROLE_KEY = 'grid_member'
</select>
<select id="selectLastStaffPatrolList" resultType="com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO">
SELECT
t.STAFF_ID,
t.GRID gridId,
t.PATROL_START_TIME latestPatrolTime,
t.STATUS latestPatrolStatus
FROM
( SELECT GRID, STAFF_ID, max( CREATED_TIME ) AS CREATED_TIME FROM staff_patrol_record GROUP BY GRID, STAFF_ID ) a
LEFT JOIN staff_patrol_record t ON t.GRID = a.GRID
AND t.STAFF_ID = a.STAFF_ID
AND t.CREATED_TIME = a.CREATED_TIME
WHERE
a.del_flag = '0'
AND a.CUSTOMER_ID = #{customerId}
</select>
</mapper>

Loading…
Cancel
Save