Browse Source

Merge remote-tracking branch 'origin/dev_bugfix_ljj' into develop

master
zxc 4 years ago
parent
commit
ddc38b1f77
  1. 17
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java
  2. 45
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/excel/StaffPatrollExcel.java
  3. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolCountFormDTO.java
  4. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolCountResultDTO.java
  5. 27
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/SelectPatrolCountResultDTO.java
  6. 9
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  7. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
  8. 22
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsStaffPatrolRecordDailyController.java
  9. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StatsStaffPatrolRecordDailyDao.java
  10. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsStaffPatrolRecordDailyService.java
  11. 36
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsStaffPatrolRecordDailyServiceImpl.java
  12. 2
      epmet-user/epmet-user-server/src/main/resources/mapper/StaffPatrolRecordDao.xml
  13. 12
      epmet-user/epmet-user-server/src/main/resources/mapper/StatsStaffPatrolRecordDailyDao.xml

17
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java

@ -5,6 +5,7 @@ import com.epmet.commons.tools.annotation.RequirePermission;
import com.epmet.commons.tools.enums.RequirePermissionEnum;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dataaggre.dto.epmetuser.form.OpenStaffDetailFormDTO;
@ -15,14 +16,13 @@ import com.epmet.dataaggre.dto.epmetuser.form.PatrolRecordListFormDTO;
import com.epmet.dataaggre.dto.epmetuser.form.StaffListFormDTO;
import com.epmet.dataaggre.dto.epmetuser.result.*;
import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO;
import com.epmet.dataaggre.excel.StaffPatrollExcel;
import com.epmet.dataaggre.service.datastats.DataStatsService;
import com.epmet.dataaggre.service.epmetuser.EpmetUserService;
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 org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -211,4 +211,13 @@ public class EpmetUserController {
return new Result<UserEventLogoResultDTO>().ok(epmetUserService.mentionMeEvent(tokenDto.getUserId()));
}
@GetMapping("export/staffpatroll")
public void export(@LoginUser TokenDto tokenDto, @RequestBody StaffListFormDTO formDTO, HttpServletResponse response) throws Exception {
ValidatorUtils.validateEntity(formDTO, StaffListFormDTO.Staff.class);
formDTO.setUserId(tokenDto.getUserId());
//formDTO.setUserId("73ae6280e46a6653a5605d51d5462725");
List<StaffListResultDTO> resultDTOS = epmetUserService.staffPatrolList(formDTO);
ExcelUtils.exportExcelToTarget(response, null, resultDTOS, StaffPatrollExcel.class);
}
}

45
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/excel/StaffPatrollExcel.java

@ -0,0 +1,45 @@
/**
* 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.dataaggre.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
/**
* 客户表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-11
*/
@Data
public class StaffPatrollExcel {
@Excel(name = "组织")
private String gridName = "";
@Excel(name = "姓名")
private String staffName = "";
@Excel(name = "巡查总次数")
private Integer patrolTotal = 0;
@Excel(name = "上报项目数")
private Integer reportProjectCount;
@Excel(name = "巡查总时长")
private String totalTime = "";
}

2
epmet-module/data-report/data-report-client/src/main/java/com/epmet/user/form/PatrolCountFormDTO.java → epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolCountFormDTO.java

@ -1,4 +1,4 @@
package com.epmet.user.form;
package com.epmet.dto.form;
import lombok.Data;

2
epmet-module/data-report/data-report-client/src/main/java/com/epmet/user/result/PatrolCountResultDTO.java → epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolCountResultDTO.java

@ -1,4 +1,4 @@
package com.epmet.user.result;
package com.epmet.dto.result;
import com.epmet.commons.tools.constant.NumConstant;
import lombok.Data;

27
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/SelectPatrolCountResultDTO.java

@ -0,0 +1,27 @@
package com.epmet.dto.result;
import com.epmet.commons.tools.constant.NumConstant;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/8/20 9:04 上午
* @DESC
*/
@Data
public class SelectPatrolCountResultDTO implements Serializable {
private static final long serialVersionUID = -4944469520967374496L;
/**
* 巡查状态
*/
private String status;
/**
* 人数
*/
private Integer staffCount = NumConstant.ZERO;
}

9
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java

@ -614,4 +614,13 @@ public interface EpmetUserOpenFeignClient {
*/
@PostMapping("/epmetuser/badge/list-users-by-badge")
Result<List<ListUserByBadgeResultDTO>> listUsersByBadge(ListUserByBadgeFormDTO input);
/**
* @Description 查询巡查人数
* @Param formDTO
* @author zxc
* @date 2021/8/20 10:21 上午
*/
@PostMapping("/epmetuser/statsstaffpatrolrecorddaily/patrolcount")
Result<PatrolCountResultDTO> patrolCount(@RequestBody PatrolCountFormDTO formDTO);
}

5
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java

@ -432,4 +432,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien
public Result<List<ListUserByBadgeResultDTO>> listUsersByBadge(ListUserByBadgeFormDTO input) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "listUsersByBadge", input);
}
@Override
public Result<PatrolCountResultDTO> patrolCount(PatrolCountFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "patrolCount", formDTO);
}
}

22
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsStaffPatrolRecordDailyController.java

@ -1,19 +1,13 @@
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
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 com.epmet.dto.StatsStaffPatrolRecordDailyDTO;
import com.epmet.service.StatsStaffPatrolRecordDailyService;
import com.epmet.dto.form.PatrolCountFormDTO;
import com.epmet.dto.result.PatrolCountResultDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* []工作人员巡查记录统计
@ -28,5 +22,15 @@ public class StatsStaffPatrolRecordDailyController {
@Autowired
private StatsStaffPatrolRecordDailyService statsStaffPatrolRecordDailyService;
/**
* @Description 查询巡查人数
* @Param formDTO
* @author zxc
* @date 2021/8/20 10:21 上午
*/
@PostMapping("patrolcount")
public Result<PatrolCountResultDTO> patrolCount(@RequestBody PatrolCountFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, PatrolCountFormDTO.PatrolCountForm.class);
return new Result<PatrolCountResultDTO>().ok(statsStaffPatrolRecordDailyService.patrolCount(formDTO));
}
}

11
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StatsStaffPatrolRecordDailyDao.java

@ -18,11 +18,13 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.SelectPatrolCountResultDTO;
import com.epmet.entity.StatsStaffPatrolRecordDailyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
* []工作人员巡查记录统计
@ -61,4 +63,13 @@ public interface StatsStaffPatrolRecordDailyDao extends BaseDao<StatsStaffPatrol
void updateStatsRecordEnd(@Param("userId")String userId,@Param("totalTime") Integer totalTime,
@Param("projectCount")Integer projectCount,@Param("dateId")String dateId,@Param("gridId")String gridId);
/**
* @Description 查询巡查人数
* @Param agencyId
* @Param dateId
* @author zxc
* @date 2021/8/20 9:10 上午
*/
List<SelectPatrolCountResultDTO> selectPatrolCount(@Param("agencyId")String agencyId, @Param("dateId")String dateId);
}

9
epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsStaffPatrolRecordDailyService.java

@ -2,6 +2,8 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.StatsStaffPatrolRecordDailyEntity;
import com.epmet.dto.form.PatrolCountFormDTO;
import com.epmet.dto.result.PatrolCountResultDTO;
/**
* []工作人员巡查记录统计
@ -11,5 +13,12 @@ import com.epmet.entity.StatsStaffPatrolRecordDailyEntity;
*/
public interface StatsStaffPatrolRecordDailyService extends BaseService<StatsStaffPatrolRecordDailyEntity> {
/**
* @Description 查询巡查人数
* @Param formDTO
* @author zxc
* @date 2021/8/20 10:21 上午
*/
PatrolCountResultDTO patrolCount(PatrolCountFormDTO formDTO);
}

36
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsStaffPatrolRecordDailyServiceImpl.java

@ -1,23 +1,19 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.PatrolConstant;
import com.epmet.dao.StatsStaffPatrolRecordDailyDao;
import com.epmet.dto.StatsStaffPatrolRecordDailyDTO;
import com.epmet.dto.result.SelectPatrolCountResultDTO;
import com.epmet.entity.StatsStaffPatrolRecordDailyEntity;
import com.epmet.service.StatsStaffPatrolRecordDailyService;
import com.epmet.dto.form.PatrolCountFormDTO;
import com.epmet.dto.result.PatrolCountResultDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* []工作人员巡查记录统计
@ -29,4 +25,24 @@ import java.util.Map;
@Slf4j
public class StatsStaffPatrolRecordDailyServiceImpl extends BaseServiceImpl<StatsStaffPatrolRecordDailyDao, StatsStaffPatrolRecordDailyEntity> implements StatsStaffPatrolRecordDailyService {
/**
* @Description 查询巡查人数
* @Param formDTO
* @author zxc
* @date 2021/8/20 10:21 上午
*/
@Override
public PatrolCountResultDTO patrolCount(PatrolCountFormDTO formDTO) {
PatrolCountResultDTO result = new PatrolCountResultDTO();
List<SelectPatrolCountResultDTO> counts = baseDao.selectPatrolCount(formDTO.getAgencyId(), DateUtils.getBeforeNDay(NumConstant.ZERO));
counts.forEach(c -> {
if (c.getStatus().equals(PatrolConstant.PATROLLING)){
result.setPatrollingCount(c.getStaffCount());
}
if (c.getStatus().equals(PatrolConstant.END)){
result.setElseCount(c.getStaffCount());
}
});
return result;
}
}

2
epmet-user/epmet-user-server/src/main/resources/mapper/StaffPatrolRecordDao.xml

@ -48,7 +48,7 @@
<select id="selectPatrolRecord" resultType="com.epmet.dto.result.GridManagerUserListResultDTO">
SELECT t.* FROM (SELECT
pr.ID AS recordId,
DISTINCT pr.ID AS recordId,
pr.GRID AS gridId,
pr.STAFF_ID,
pr.`STATUS`

12
epmet-user/epmet-user-server/src/main/resources/mapper/StatsStaffPatrolRecordDailyDao.xml

@ -40,4 +40,16 @@
AND GRID_ID = #{gridId}
</select>
<!-- 查询巡查人数 -->
<select id="selectPatrolCount" resultType="com.epmet.dto.result.SelectPatrolCountResultDTO">
SELECT t.STATUS , COUNT(t.STAFF_ID) AS staffCount FROM
(SELECT
STAFF_ID,LATEST_PATROL_STATUS AS STATUS
FROM stats_staff_patrol_record_daily
WHERE DEL_FLAG = 0
AND DATE_ID = #{dateId}
AND GRID_PIDS LIKE CONCAT('%',#{agencyId},'%')
ORDER BY STAFF_ID DESC) t GROUP BY t.STATUS
</select>
</mapper>
Loading…
Cancel
Save