超期临期逻辑修改,排查第一页基础数据回显修改

master
Zangzhipeng 1 year ago
parent 41f1be62b5
commit e86fd5eeaa
  1. 84
      hiatmp-hidden-danger-server/src/main/java/com/hisense/hiatmp/server_api/controller/HighDangerController.java
  2. 3
      hiatmp-hidden-danger-server/src/main/java/com/hisense/hiatmp/server_api/mapper/HighDangerMapper.java
  3. 11
      hiatmp-hidden-danger-server/src/main/resources/sql-mapper/HighDangerMapper.xml

@ -3,9 +3,11 @@ package com.hisense.hiatmp.server_api.controller;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hisense.hiatmp.model.common.*;
import com.hisense.hiatmp.server_api.mapper.ConfigureMapper;
import com.hisense.hiatmp.server_api.mapper.HighDangerMapper;
import com.hisense.hiatmp.server_api.mapper.OperatorMapper;
import com.hisense.hiatmp.model.common.DangerProblem;
import com.hisense.hiatmp.server_api.model.StreetCommunity;
import com.hisense.hiatmp.server_api.service.HighDangerService;
import com.hisense.hiatmp.model.dmr.Point;
import com.hisense.hiatmp.server_api.service.ThtApproveService;
@ -44,6 +46,9 @@ public class HighDangerController {
@Autowired
ThtApproveService thtApproveService;
@Autowired
ConfigureMapper configureMapper;
@Value("${spring.ftp.username}") //用户名
private String userName;
@ -131,6 +136,8 @@ public class HighDangerController {
return ServerResponse.error("未找到当前用户");
}
int termTime = Integer.parseInt(configureMapper.getTermTime());
//Page<HighDangerBase> page = new Page<>(pageNum, pageSize);
PageHelper.startPage(pageNum, pageSize);
// 将要查询的状态和部门id查询数据库,获得隐患排查表
@ -145,6 +152,8 @@ public class HighDangerController {
for (HighDangerBase base : statusCounts) {
Date nowDate = new Date();
Date pcEndTime = base.getPcEndTime();
Date pcStartTime = base.getPcStartTime();
if (pcEndTime != null) {
long diff = nowDate.getTime() - pcEndTime.getTime();
// 时间差,天数
@ -201,8 +210,67 @@ public class HighDangerController {
base.setDeadlineStatus("正常");
base.setDeadlineType("3");
}
} else {
base.setDeadlineStatus("无排查结束时间");
} else if(pcStartTime != null){
// 无排查结束时间,根据开始时间判断
long diff = nowDate.getTime() - pcStartTime.getTime();
// 时间差,天数
long diffDays = diff / (24 * 60 * 60 * 1000);
diffDays = Math.abs(diffDays);
// 小时
long remainingHours = (diff % (24 * 60 * 60 * 1000)) / (60 * 60 * 1000);
remainingHours = Math.abs(remainingHours);
// 判断不足一小时
long diffHours = diff / (60 * 60 * 1000);
diffHours = Math.abs(diffHours);
int comparison = nowDate.compareTo(pcStartTime);
if (comparison < 0) { // 超期
if (diffHours < 1) {
base.setDeadlineStatus("超期不足一小时");
base.setDeadlineType("1");
continue;
}
if(diffDays == 0){
base.setDeadlineStatus("超期" + remainingHours + "小时");
base.setDeadlineType("2");
continue;
}else if(remainingHours == 0){
base.setDeadlineStatus("超期" + diffDays + "天");
base.setDeadlineType("2");
continue;
}
base.setDeadline(diffDays);
base.setDeadlineStatus("超期" + diffDays + "天" + remainingHours + "小时");
base.setDeadlineType("1");
} else if (comparison > 0 && diffDays <= termTime) { // 临期
if (diffHours < 1) {
base.setDeadlineStatus("临期不足一小时");
base.setDeadlineType("2");
continue;
}
base.setDeadline(diffDays);
if (diffDays == 0) {
base.setDeadlineStatus("临期" + remainingHours + "小时");
base.setDeadlineType("2");
continue;
} else if (remainingHours == 0) {
base.setDeadlineStatus("临期" + diffDays + "天");
base.setDeadlineType("2");
continue;
}
base.setDeadlineStatus("临期" + diffDays + "天" + remainingHours + "小时");
base.setDeadlineType("2");
}else{
base.setDeadlineStatus("正常");
base.setDeadlineType("3");
}
// base.setDeadlineStatus("无排查结束时间");
// base.setDeadlineType("3");
}else{
base.setDeadlineStatus("无排查结束和开始时间");
base.setDeadlineType("3");
}
}
@ -642,6 +710,18 @@ public class HighDangerController {
List<ThtSectionInfoDTO> sectionInfo = highDangerMapper.getSectionInfo(businessId);
ThtSectionInfoDTO thtSectionInfoDTO = sectionInfo.get(0);
// 是否该排查有绑定的辖区街道信息,有则展示
List<StreetCommunity> communityByRoad = highDangerMapper.getCommunityByRoad(businessId);
if(communityByRoad == null || communityByRoad.isEmpty()){
log.info("/getSectionInfo(获取基础数据(第一页))接口返回, 客户端ip: {}, 返回数据:{}", request.getRemoteAddr(), sectionInfo);
return ServerResponse.ok(thtSectionInfoDTO);
}
StreetCommunity streetCommunity = communityByRoad.get(0);
thtSectionInfoDTO.setXqcode(streetCommunity.getXqcode());
thtSectionInfoDTO.setXqname(streetCommunity.getXqname());
thtSectionInfoDTO.setJdcode(streetCommunity.getJdcode());
thtSectionInfoDTO.setJdname(streetCommunity.getJdname());
log.info("/getSectionInfo(获取基础数据(第一页))接口返回, 客户端ip: {}, 返回数据:{}", request.getRemoteAddr(), sectionInfo);
if (sectionInfo != null) {
return ServerResponse.ok(thtSectionInfoDTO);

@ -3,6 +3,7 @@ package com.hisense.hiatmp.server_api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hisense.hiatmp.model.common.*;
import com.hisense.hiatmp.model.common.DangerProblem;
import com.hisense.hiatmp.server_api.model.StreetCommunity;
import io.lettuce.core.dynamic.annotation.Param;
import org.springframework.stereotype.Repository;
@ -101,4 +102,6 @@ public interface HighDangerMapper{
List<EnumRoadType> getRoadTypes();
SectionVO getSectionByCode(String sectionCode);
List<StreetCommunity> getCommunityByRoad(String businessId);
}

@ -341,17 +341,20 @@
<select id="getSectionInfo" resultType="com.hisense.hiatmp.model.common.ThtSectionInfoDTO">
SELECT
tsi.*,
tsc.*
tsi.*
FROM
tht_section_info tsi
LEFT JOIN tht_hidden_danger_road thdr ON tsi."BUSINESS_ID" = thdr.business_id
-- LEFT JOIN tlv_street_community tsc ON thdr.belong_xq = tsc.xqcode
-- AND thdr.xzjd = tsc.jdcode
WHERE
tsi."BUSINESS_ID" = #{businessId}
</select>
<select id="getCommunityByRoad" resultType="com.hisense.hiatmp.server_api.model.StreetCommunity">
Select tsc.*
from tlv_street_community tsc
left join tht_hidden_danger_road thdr on thdr.belong_xq = tsc.xqcode and thdr.xzjd = tsc.jdcode
where business_id = #{businessId}
</select>
<select id="getSectionTraffic" resultType="com.hisense.hiatmp.model.common.ThtSectionTrafficDTO">
SELECT *

Loading…
Cancel
Save