Browse Source

工作端-个人中心-网格员巡查记录汇总数据

dev_shibei_match
sunyuchao 4 years ago
parent
commit
a6b49b471f
  1. 20
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PersonalPatrolListResultDTO.java
  2. 10
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java
  3. 7
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffPatrolRecordDao.java
  4. 10
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java
  5. 38
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java
  6. 12
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml

20
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PersonalPatrolListResultDTO.java

@ -0,0 +1,20 @@
package com.epmet.dataaggre.dto.epmetuser.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 个人中心-网格员巡查记录-接口入参
* @Auth sun
*/
@Data
public class PersonalPatrolListResultDTO implements Serializable {
private static final long serialVersionUID = 7129564173128153335L;
//巡查总次数;巡查总时长;立项事件数
private String key;
//key对应值
private String value;
}

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

@ -12,6 +12,7 @@ import com.epmet.dataaggre.dto.epmetuser.form.PatrolRecordListFormDTO;
import com.epmet.dataaggre.dto.epmetuser.form.StaffListFormDTO;
import com.epmet.dataaggre.dto.epmetuser.result.PatrolDateListResultDTO;
import com.epmet.dataaggre.dto.epmetuser.result.PatrolRecordListResultDTO;
import com.epmet.dataaggre.dto.epmetuser.result.PersonalPatrolListResultDTO;
import com.epmet.dataaggre.dto.epmetuser.result.StaffListResultDTO;
import com.epmet.dataaggre.service.epmetuser.EpmetUserService;
import org.springframework.beans.factory.annotation.Autowired;
@ -99,4 +100,13 @@ public class EpmetUserController {
return new Result<List<StaffListResultDTO>>().ok(epmetUserService.staffPatrolList(formDTO));
}
/**
* @Description 个人中心-网格员巡查记录
* @author sun
*/
@PostMapping("personalpatrollist")
public Result<List<PersonalPatrolListResultDTO>> personalPatrolList(@LoginUser TokenDto tokenDto) {
return new Result<List<PersonalPatrolListResultDTO>>().ok(epmetUserService.personalPatrolList(tokenDto.getUserId()));
}
}

7
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffPatrolRecordDao.java

@ -23,6 +23,7 @@ import com.epmet.dataaggre.dto.epmetuser.form.StaffListFormDTO;
import com.epmet.dataaggre.dto.epmetuser.result.StaffListResultDTO;
import com.epmet.dataaggre.entity.epmetuser.StaffPatrolRecordEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -46,4 +47,10 @@ public interface StaffPatrolRecordDao extends BaseDao<StaffPatrolRecordEntity> {
* @author sun
*/
List<StaffListResultDTO> selectStaffPatrolList(StaffListFormDTO formDTO);
/**
* @Description 汇总查询当前工作人员所有巡查记录数据
* @author sun
*/
StaffListResultDTO selectPersonalPatrolList(@Param("staffId") String staffId);
}

10
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java

@ -3,10 +3,7 @@ package com.epmet.dataaggre.service.epmetuser;
import com.epmet.dataaggre.dto.epmetuser.form.PatrolDateListFormDTO;
import com.epmet.dataaggre.dto.epmetuser.form.PatrolRecordListFormDTO;
import com.epmet.dataaggre.dto.epmetuser.form.StaffListFormDTO;
import com.epmet.dataaggre.dto.epmetuser.result.PatrolDateListResultDTO;
import com.epmet.dataaggre.dto.epmetuser.result.PatrolRecordListResultDTO;
import com.epmet.dataaggre.dto.epmetuser.result.StaffListResultDTO;
import com.epmet.dataaggre.dto.epmetuser.result.UserInfosResultDTO;
import com.epmet.dataaggre.dto.epmetuser.result.*;
import com.epmet.dataaggre.dto.govorg.result.GridStaffResultDTO;
import java.util.List;
@ -71,4 +68,9 @@ public interface EpmetUserService {
*/
List<StaffListResultDTO> staffPatrolList(StaffListFormDTO formDTO);
/**
* @Description 个人中心-网格员巡查记录
* @author sun
*/
List<PersonalPatrolListResultDTO> personalPatrolList(String staffId);
}

38
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java

@ -272,8 +272,8 @@ public class EpmetUserServiceImpl implements EpmetUserService {
//3.封装数据并返回
resultList.forEach(re -> list.stream().filter(l -> re.getGridId().equals(l.getId())).forEach(s -> re.setGridName(s.getGridName())));
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMaximumFractionDigits(NumConstant.ONE);
//NumberFormat numberFormat = NumberFormat.getInstance();
//numberFormat.setMaximumFractionDigits(NumConstant.ZERO);
resultList.forEach(re -> {
/*String totalTime = "0分钟";
if (re.getTimeNum() > NumConstant.ZERO) {
@ -282,11 +282,43 @@ public class EpmetUserServiceImpl implements EpmetUserService {
totalTime = (hour < 1 ? "" : hour + "小时") + (minute < 1 ? "" : minute + "分钟");
}
re.setTotalTime(totalTime == "" ? "0分钟" : totalTime);*/
re.setTotalTime(re.getTimeNum() < 1 ? BigDecimal.ZERO + "h" : new BigDecimal(numberFormat.format((float) re.getTimeNum() / (float) 3600)) + "h");
//re.setTotalTime(re.getTimeNum() < 1 ? BigDecimal.ZERO + "h" : new BigDecimal(numberFormat.format((float) re.getTimeNum() / (float) 3600)) + "h");
re.setTotalTime(re.getTimeNum() / 60 + "分钟");
list.stream().filter(l -> re.getGridId().equals(l.getId())).forEach(s -> re.setGridName(s.getGridName()));
});
return resultList;
}
/**
* @Description 个人中心-网格员巡查记录
* @author sun
*/
@Override
public List<PersonalPatrolListResultDTO> personalPatrolList(String staffId) {
LinkedList<PersonalPatrolListResultDTO> resultList = new LinkedList<>();
//1.汇总查询当前工作人员所有巡查记录数据
StaffListResultDTO resultDTO = staffPatrolRecordDao.selectPersonalPatrolList(staffId);
if (null == resultDTO) {
return resultList;
}
//2.封装数据并返回
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMaximumFractionDigits(NumConstant.ZERO);
PersonalPatrolListResultDTO personal1 = new PersonalPatrolListResultDTO();
personal1.setKey("总次数");
personal1.setValue(resultDTO.getPatrolTotal().toString());
resultList.add(personal1);
PersonalPatrolListResultDTO personal2 = new PersonalPatrolListResultDTO();
personal2.setKey("总时长");
personal2.setValue(resultDTO.getTimeNum() / 60 + "分钟");
resultList.add(personal2);
PersonalPatrolListResultDTO personal3 = new PersonalPatrolListResultDTO();
personal3.setKey("事件数");
personal3.setValue(resultDTO.getReportProjectCount().toString());
resultList.add(personal3);
return resultList;
}
}

12
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml

@ -97,4 +97,16 @@
#{pageNo}, #{pageSize}
</select>
<select id="selectPersonalPatrolList" resultType="com.epmet.dataaggre.dto.epmetuser.result.StaffListResultDTO">
SELECT
IFNULL(SUM(ssp.patrol_total), 0) AS patrolTotal,
IFNULL(SUM(ssp.total_time), 0) AS timeNum,
IFNULL(SUM(ssp.report_project_count), 0) AS reportProjectCount
FROM
stats_staff_patrol_record_daily ssp
WHERE
ssp.del_flag = '0'
AND ssp.staff_id = #{staffId}
</select>
</mapper>

Loading…
Cancel
Save