@ -21,9 +21,11 @@ import com.hisense.hiatmp.server_api.service.ThtApproveService;
import com.hisense.hiatmp.server_api.service.ThtAttachsService ;
import com.hisense.hiatmp.server_api.utils.CoordinateConverter ;
import com.hisense.hiatmp.server_api.utils.CoordinateUtils ;
import io.swagger.annotations.ApiOperation ;
import lombok.extern.slf4j.Slf4j ;
import org.apache.commons.collections4.CollectionUtils ;
import org.apache.commons.lang3.StringUtils ;
import org.apache.poi.ss.formula.functions.T ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.beans.factory.annotation.Qualifier ;
import org.springframework.beans.factory.annotation.Value ;
@ -84,6 +86,7 @@ public class HighDangerController {
* /
@Transactional
@PostMapping ( "/insertHiddenDanger" )
@ApiOperation ( "新建排查(测试用)" )
public ServerResponse < ? > insertDanger ( @RequestBody HiddenDangerVO hiddenDangerVO ) {
HighDangerBase highDangerBase = new HighDangerBase ( ) ;
@ -119,6 +122,7 @@ public class HighDangerController {
查询各个状态的数据情况
* /
@GetMapping ( "/getHighDangerStatusNum" )
@ApiOperation ( "查询各个状态的数据情况" )
public ServerResponse < ? > getHighStatusNum ( @RequestParam String nuserid , HttpServletRequest request ) {
log . info ( "/getHighDangerStatusNum(查询各个状态的数据情况)接口被调用,调用ip: {}, 入参:{}" , request . getRemoteAddr ( ) , nuserid ) ;
String cdepartmentid = null ;
@ -171,9 +175,13 @@ public class HighDangerController {
@RequestParam ( value = "endTime" , required = false ) String endTime ,
HttpServletRequest request
) {
log . info ( "/getHigDangerDealt(查询首页各个状态的数据列表)接口被调用,调用ip: {}, 入参:{},{},{},{}" , request . getRemoteAddr ( ) , highDangerBaseVO , pageNum , pageSize , search ) ;
log . info ( "/getHigDangerDealt(查询首页各个状态的数据列表)接口被调用,调用ip: {}, 入参:{},{},{},{},{} " , request . getRemoteAddr ( ) , highDangerBaseVO , pageNum , pageSize , search , classification ) ;
String cdepartmentid = null ;
String departmentid = null ;
// 去掉两侧的空格
search = search . trim ( ) ;
// search = search.replaceAll(" ","");
// 获取当前操作的对象,用于查找对应的部
Operator operatorById = operatorMapper . getOperatorById ( highDangerBaseVO . getNuserid ( ) ) ;
if ( operatorById ! = null ) {
@ -189,13 +197,13 @@ public class HighDangerController {
// int termTime = Integer.parseInt(configureMapper.getTermTime());
//Page<HighDangerBase> page = new Page<>(pageNum, pageSize);
if ( ! ( "1" . equals ( approve ) & & "3" . equals ( classification ) ) ) {
PageHelper . startPage ( pageNum , pageSize ) ;
}
// 将要查询的状态和部门id查询数据库,获得隐患排查表
List < HighDangerBase > statusCounts = highDangerMapper . getHigDangerDealt ( highDangerBaseVO . getStatus ( ) , departmentid , search , highDangerBaseVO . getNuserid ( ) , classification , approve , startTime , endTime ) ;
SimpleDateFormat dateFormat = new SimpleDateFormat ( "yyyy-MM-dd" ) ;
Integer flag = 0 ;
// 待办
/ * if ( "20" . equals ( highDangerBaseVO . getStatus ( ) ) ) {
List < HighDangerBase > statusCount = highDangerMapper . getHigDangerDealt ( "99" , cdepartmentid , page , "%" + search + "%" ) ;
@ -204,11 +212,16 @@ public class HighDangerController {
// 遍历排查数据
for ( HighDangerBase base : statusCounts ) {
int delayHour = base . getDelayHour ( ) ;
SimpleDateFormat sdf = new SimpleDateFormat ( "yyyy-MM-dd HH:mm:ss" ) ;
if ( base . getPcStartTime ( ) ! = null ) {
base . setPcStartTimeStr ( sdf . format ( base . getPcStartTime ( ) ) ) ;
}
int delayHour = base . getDelayHour ( ) - 1 ;
int delayDay = base . getDelayDay ( ) ;
int nearDay = base . getNearDay ( ) ;
int nearHour = base . getNearHour ( ) ;
int nearHour = base . getNearHour ( ) - 1 ;
// 获取审批流程列表
List < ThtApprove > processRecord = highDangerService . getProcessRecord ( base . getBusinessId ( ) ) ;
@ -234,19 +247,6 @@ public class HighDangerController {
approveTime = "二次审批" ;
base . setEnumname ( base . getEnumname ( ) + "(" + approveTime + ") " + approveStatus + " " + format ) ;
}
// // 第二次审批完成
// else if(Objects.equals(thtApprove.getOperateContent(), "2") && "1".equals(thtApprove.getApproveResult()) ){
// if("20".equals(base.getStatus())){
// approveTime = "已办结";
// }
// if("0".equals(thtApprove.getOperateContent()) && base.getApproveStatus().equals("1")){
// // 审批状态添加
// base.setEnumname(base.getEnumname() + "(审批中) " + format);
// }else{
// 审批状态添加
// base.setEnumname(base.getEnumname() + "(" + approveTime + ") " + approveStatus + " " + format);
}
}
} else { // 已完成
@ -307,6 +307,9 @@ public class HighDangerController {
if ( delayDay = = 0 ) {
base . setDeadlineStatus ( "超期" + delayHour + "小时" ) ;
if ( delayHour = = 0 ) {
base . setDeadlineStatus ( "超期不足一小时" ) ;
}
} else if ( delayHour = = 0 ) {
base . setDeadlineStatus ( "超期" + delayDay + "天" ) ;
} else {
@ -326,6 +329,9 @@ public class HighDangerController {
if ( nearDay = = 0 ) {
base . setDeadlineStatus ( "临期" + nearHour + "小时" ) ;
if ( delayHour = = 0 ) {
base . setDeadlineStatus ( "临期不足一小时" ) ;
}
} else if ( nearHour = = 0 ) {
base . setDeadlineStatus ( "临期" + nearDay + "天" ) ;
} else {
@ -348,9 +354,18 @@ public class HighDangerController {
sectionDTO = highDangerMapper . getSectionByCode ( base . getSectionCode ( ) ) ;
}
if ( sectionDTO . getPosition ( ) = = null ) {
if ( sectionDTO = = null ) {
sectionDTO = new SectionDTO ( ) ;
HighDangerRoad highDangerRoadByBusinessId = highDangerMapper . getHighDangerRoadByBusinessId ( base . getBusinessId ( ) ) ;
if ( highDangerRoadByBusinessId ! = null ) {
String coordinate = highDangerRoadByBusinessId . getCoordinate ( ) ;
int lastCommaIndex = coordinate . lastIndexOf ( "," ) ;
String result = coordinate . substring ( 0 , lastCommaIndex ) ;
sectionDTO . setPosition ( result ) ;
} else {
continue ;
}
}
// 将单条路段的坐标点依次取出进行对比
String [ ] split = sectionDTO . getPosition ( ) . split ( "," ) ;
Point Dpoint = new Point ( ) ;
@ -360,21 +375,29 @@ public class HighDangerController {
point . setX ( longitude ) ;
point . setY ( latitude ) ;
if ( split . length % 2 = = 1 ) {
log . info ( "---------------------【列表查询】排查的路段坐标有误:{}" , base ) ;
}
/ *
遍历坐标字符串
字符串格式 : 【 119 . 996321 , 36 . 800453 , 119 . 996309 , 36 . 800294 , 119 . 996205 , 36 . 798752 】
* /
for ( int i = 0 ; i < split . length ; i + = 2 ) {
float xPoint = Float . parseFloat ( split [ i ] ) ;
float yPoint = Float . parseFloat ( split [ i + 1 ] ) ;
double xPoint = Double . parseDouble ( split [ i ] ) ;
double yPoint = Double . parseDouble ( split [ i + 1 ] ) ;
Map < String , Double > pointMap = new LinkedHashMap < > ( ) ;
CoordinateConverter . AMap aMap = CoordinateConverter . transform ( longitude , latitude ) ;
pointMap . put ( "longitude" , aMap . getLongitude ( ) ) ;
pointMap . put ( "latitude" , aMap . getLatitude ( ) ) ;
pointList . add ( pointMap ) ;
CoordinateConverter . AMap aMap = CoordinateConverter . transform ( xPoint , yPoint ) ;
// pointMap.put("longitude", aMap.getLongitude());
// pointMap.put("latitude", aMap.getLatitude());
//
// pointList.add(pointMap);
Dpoint . setX ( xPoint ) ;
Dpoint . setY ( yPoint ) ;
Dpoint . setX ( aMap . getLongitude ( ) ) ;
Dpoint . setY ( aMap . getLatitude ( ) ) ;
// 计算两点间的距离
Double pointDistance = highDangerService . getPointDistance ( Dpoint , point ) ;
if ( minDistance = = null | | minDistance = = 0 ) {
@ -400,6 +423,7 @@ public class HighDangerController {
} ) ;
}
// 分页
PageInfo < HighDangerBase > pageInfo = new PageInfo < > ( statusCounts ) ;
log . info ( "/getHigDangerDealt(查询各个状态的数据列表)接口数据返回,调用ip: {}, 出参:{}" , request . getRemoteAddr ( ) , statusCounts ) ;
@ -461,17 +485,27 @@ public class HighDangerController {
return ServerResponse . ok ( allSection ) ;
} * /
// 获取最近道路
// 根据坐标 获取最近道路
@PostMapping ( "/getNearRoadInfo" )
public ServerResponse < ? > getNearRoad ( @RequestBody Point point ,
@RequestParam ( defaultValue = "0" ) Integer type ,
@RequestParam ( defaultValue = "1" ) Integer pageNum ,
@RequestParam ( defaultValue = "10" ) Integer pageSize ,
HttpServletRequest request
) {
log . info ( "/getNearRoadInfo(获取最近道路)接口被调用,调用ip: {}, 入参:{},{},{}" , request . getRemoteAddr ( ) , point , pageNum , pageSize ) ;
//获取三公里内的坐标
//获取三公里内的坐标(四个横纵坐标)
double [ ] rectangle = CoordinateUtils . getRectangleCoordinates ( point . getY ( ) , point . getX ( ) , 3 ) ;
List < HashMap < String , Object > > combinedMap = new LinkedList < > ( ) ;
HashMap < String , Object > hashMap = new HashMap < > ( ) ;
Point Dpoint = new Point ( ) ;
// CoordinateConverter.AMap aMap1 = CoordinateConverter.transform(point.getX(), point.getY());
// Point point1 = new Point();
// point1.setX(aMap1.getLongitude());
// point1.setY(aMap1.getLatitude());
// 获取路段
if ( type = = 0 | | type = = 2 ) {
// DecimalFormat df = new DecimalFormat("#.##");
// 获取全部路段数据
BigDecimal d = new BigDecimal ( point . getX ( ) ) . setScale ( 1 , BigDecimal . ROUND_DOWN ) ;
@ -480,50 +514,48 @@ public class HighDangerController {
sectionDTO . setSearch ( point . getSearch ( ) ) ;
List < SectionDTO > allRoadInfo = highDangerMapper . getAllSection ( sectionDTO ) ;
// List<SectionVO> allRoadInfo = highDangerMapper.getAllSection(sectionVO);
List < HashMap < String , Object > > combinedMap = new LinkedList < > ( ) ;
HashMap < String , Object > hashMap = new HashMap < > ( ) ;
Point Dpoint = new Point ( ) ;
// 遍历所有路段
// 遍历所有路段,用户获取全部的道路距离信息
for ( SectionDTO dto : allRoadInfo ) {
HashMap < String , Object > pointMapSection = new HashMap < > ( ) ;
// Map<String,Object> map = new HashMap<>();
LinkedList < Map < String , Double > > pointList = new LinkedList < > ( ) ;
// 临时存储最短距离
//Double minDistance = null;
//// Double minDistan/ ce = null;
if ( dto . getPosition ( ) = = null ) {
continue ;
}
// 将单条路段的坐标点依次取出进行对比
String [ ] split = dto . getPosition ( ) . split ( "," ) ;
// 临时存储最短距离
Double minDistance = null ;
for ( int i = 0 ; i < split . length ; i + = 2 ) {
for ( int i = 0 ; i < split . length ; i + = 2 ) {
float x = Float . parseFloat ( split [ i ] ) ;
float y = Float . parseFloat ( split [ i + 1 ] ) ;
double x = Double . parseDouble ( split [ i ] ) ;
double y = Double . parseDouble ( split [ i + 1 ] ) ;
Map < String , Double > pointMap = new LinkedHashMap < > ( ) ;
// WGS84 转换 高德坐标
CoordinateConverter . AMap aMap = CoordinateConverter . transform ( x , y ) ;
// 获取转换后的高德坐标
pointMap . put ( "longitude" , aMap . getLongitude ( ) ) ;
pointMap . put ( "latitude" , aMap . getLatitude ( ) ) ;
pointList . add ( pointMap ) ;
if ( ! ( x > = rectangle [ 0 ] & & x < = rectangle [ 2 ] & & y > = rectangle [ 1 ] & & y < = rectangle [ 3 ] ) ) {
if ( ! ( aMap . getLongitude ( ) > = rectangle [ 0 ] & & aMap . getLongitude ( ) < = rectangle [ 2 ] & & aMap . getLatitude ( ) > = rectangle [ 1 ] & & aMap . getLatitude ( ) < = rectangle [ 3 ] ) ) {
continue ;
}
Dpoint . setX ( x ) ;
Dpoint . setY ( y ) ;
Dpoint . setX ( aMap . getLongitude ( ) ) ;
Dpoint . setY ( aMap . getLatitude ( ) ) ;
// 计算两点间的距离
Double pointDistance = highDangerService . getPointDistance ( Dpoint , point ) ;
if ( minDistance = = null ) {
minDistance = pointDistance ;
continue ;
} else {
if ( pointDistance < minDistance ) {
minDistance = pointDistance ;
@ -575,6 +607,9 @@ public class HighDangerController {
//minDistance = null;
}
}
if ( type = = 0 | | type = = 1 ) {
// log.info("接口被调用,接口传入参数:"+point+","+pageNum+","+pageSize);
// 获取所有路口信息
CrossingDTO crossingDTO = new CrossingDTO ( ) ;
@ -592,16 +627,18 @@ public class HighDangerController {
Map < String , Double > pointMap = new HashMap < > ( ) ;
LinkedList < Map < String , Double > > pointList = new LinkedList < > ( ) ;
float x = cross . getLongitude ( ) ;
float y = cross . getLatitude ( ) ;
/ * if ( ! ( x > = rectangle [ 0 ] & & x < = rectangle [ 2 ] & & y > = rectangle [ 1 ] & & y < = rectangle [ 3 ] ) ) {
double x = cross . getLongitude ( ) ;
double y = cross . getLatitude ( ) ;
CoordinateConverter . AMap aMap = CoordinateConverter . transform ( x , y ) ;
if ( ! ( aMap . getLongitude ( ) > = rectangle [ 0 ] & & aMap . getLongitude ( ) < = rectangle [ 2 ] & & aMap . getLatitude ( ) > = rectangle [ 1 ] & & aMap . getLatitude ( ) < = rectangle [ 3 ] ) ) {
continue ;
} * /
Dpoint . setX ( x ) ;
Dpoint . setY ( y ) ;
}
Dpoint . setX ( aMap . getLongitude ( ) ) ;
Dpoint . setY ( aMap . getLatitude ( ) ) ;
// 计算两点间的距离
Double pointDistance = highDangerService . getPointDistance ( Dpoint , point ) ;
CoordinateConverter . AMap aMap = CoordinateConverter . transform ( x , y ) ;
pointMap . put ( "longitude" , aMap . getLongitude ( ) ) ;
pointMap . put ( "latitude" , aMap . getLatitude ( ) ) ;
pointList . add ( pointMap ) ;
@ -611,9 +648,9 @@ public class HighDangerController {
pointMapCrossing . put ( "type" , "1" ) ;
// map.put(pointDistance, cross.getLongitude() + "," + cross.getLatitude());
pointMapCrossing . put ( "name" , cross . getCrossingName ( ) ) ;
combinedMap . add ( pointMapCrossing ) ;
}
}
// log.info("接口被调用,接口传入参数:"+point+","+pageNum+","+pageSize);
combinedMap . sort ( new Comparator < HashMap < String , Object > > ( ) {
@ -662,9 +699,11 @@ public class HighDangerController {
@RequestParam String ifCross ,
HttpServletRequest request ) {
Boolean flag = false ;
SectionDTO sectionByCode = new SectionDTO ( ) ;
log . info ( "/getDangerRoad(查询当前排查所在路段)接口被调用,调用ip: {}, 入参:{}" , request . getRemoteAddr ( ) , businessId ) ;
// 获取tht_hidden_danger_base表中的数据
HighDangerRoad roadInfo = highDangerMapper . getRoadInfo ( businessId , ifCross ) ;
roadInfo . setDeptId ( operatorMapper . getOperatorById ( roadInfo . getOperator ( ) ) . getCdepartmentid ( ) ) ;
@ -679,52 +718,82 @@ public class HighDangerController {
return ServerResponse . error ( "无路口和路段信息" ) ;
}
// 自定义新增路口
if ( Objects . equals ( roadInfo . getSectionCode ( ) , "" ) & & ! Objects . equals ( roadInfo . getCoordinate ( ) , "" ) ) {
// 代表是自定义路口
flag = true ;
sectionByCode = new SectionDTO ( ) ;
sectionByCode . setPosition ( roadInfo . getCoordinate ( ) ) ;
if ( Objects . equals ( roadInfo . getCoordinateType ( ) , "1" ) ) {
// 路口去掉最后的半径元素
int lastIndex = roadInfo . getCoordinate ( ) . lastIndexOf ( "," ) ;
String result = roadInfo . getCoordinate ( ) . substring ( 0 , lastIndex ) ;
String [ ] split = result . split ( "," ) ;
sectionByCode . setPosition ( result ) ;
}
// 自定义路段路段名
ThtSectionInfoDTO newRoadInfo = highDangerService . getNewRoadInfo ( businessId ) ;
sectionByCode . setSectionName ( newRoadInfo . getRoadName ( ) ) ;
}
if ( sectionByCode . getPosition ( ) = = null ) {
return ServerResponse . ok ( "路段点位为空" , null ) ;
}
LinkedList < Map < String , Double > > coordinateMapTemporary = new LinkedList < > ( ) ;
/ *
遍历String坐标点位
坐标格式 : 【 119 . 996321 , 36 . 800453 , 119 . 996309 , 36 . 800294 , 119 . 996205 , 36 . 798752 】
* /
String [ ] split = sectionByCode . getPosition ( ) . split ( "," ) ;
for ( int i = 0 ; i < split . length ; i + = 2 ) {
//CoordinateConverter coordinateConverter = new CoordinateConverter();
Map < String , Double > pointMap = new LinkedHashMap < > ( ) ;
float lon = Float . parseFloat ( split [ i ] ) ;
float lat = Float . parseFloat ( split [ i + 1 ] ) ;
double lon = Double . parseDouble ( split [ i ] ) ;
double lat = Double . parseDouble ( split [ i + 1 ] ) ;
CoordinateConverter . AMap aMap = CoordinateConverter . transform ( lon , lat ) ;
if ( ! flag ) {
// 非自定义坐标,是84坐标系,点位转换(转为高德地图坐标)
CoordinateConverter . AMap aMap = CoordinateConverter . transform ( lon , lat ) ;
pointMap . put ( "longitude" , aMap . getLongitude ( ) ) ;
pointMap . put ( "latitude" , aMap . getLatitude ( ) ) ;
} else {
// 判断是否是自定义字段(自定义路口存储的是高德坐标,无需转换)
pointMap . put ( "longitude" , lon ) ;
pointMap . put ( "latitude" , lat ) ;
}
// 将坐标存入map集合,用于最后整合坐标集合返回给前端
coordinateMapTemporary . add ( pointMap ) ;
}
roadInfo . setAddress ( sectionByCode . getSectionName ( ) ) ;
// 保存坐标信息
roadInfo . setSectionName ( sectionByCode . getSectionName ( ) ) ;
roadInfo . setCoordinateList ( coordinateMapTemporary ) ;
log . info ( "/getDangerRoad(查询当前排查所在路段)接口返回, 客户端ip: {}, 返回数据:{}" , request . getRemoteAddr ( ) , roadInfo ) ;
if ( roadInfo ! = null ) {
return ServerResponse . ok ( roadInfo ) ;
} else {
return ServerResponse . error ( "无对应路口信息" ) ;
}
}
// 查询重点排查选项
@GetMapping ( "/getImportDangers" )
public ServerResponse < ? > getImportDangers ( HttpServletRequest request ) {
log . info ( "/getImportDangers(查询重点排查选项)接口被调用,调用ip: {}, 入参:{}" , request . getRemoteAddr ( ) , "无" ) ;
List < ImportDangerDTO > importDanger = highDangerMapper . getImportDanger ( ) ;
for ( ImportDangerDTO importDangerDTO : importDanger ) {
List < ThtDangerItems > importDangerItems = highDangerMapper . getImportDangerItems ( importDangerDTO . getNid ( ) ) ;
importDangerDTO . setDangerItems ( importDangerItems ) ;
importDangerDTO . getDangerItems ( ) . removeIf ( Objects : : isNull ) ;
// Set<ThtDangerItems> set = new HashSet<>(importDangerDTO.getDangerItems());
importDangerDTO . setDangerItems ( importDangerDTO . getDangerItems ( ) ) ;
}
log . info ( "/getImportDangers(查询重点排查选项)接口返回, 客户端ip: {}, 返回数据:{}" , request . getRemoteAddr ( ) , importDanger ) ;
if ( importDanger ! = null ) {
return ServerResponse . ok ( importDanger ) ;
} else {
return ServerResponse . error ( "无对应路口信息" ) ;
return ServerResponse . ok ( "无对应路口信息" ) ;
}
}
@ -812,7 +881,7 @@ public class HighDangerController {
if ( importDangerInfo ! = null ) {
return ServerResponse . ok ( importDangerInfo ) ;
} else {
return ServerResponse . error ( "获取二级页面信息失败 ") ;
return ServerResponse . ok ( "获取二级页面信息为空 ") ;
}
}
@ -844,33 +913,70 @@ public class HighDangerController {
// thtSectionInfoDTO = section.get(0);
// } else {
// if(!sectionInfo.isEmpty()){
for ( int i = 0 ; i < sectionInfo . size ( ) ; i + + ) {
if ( Objects . equals ( sectionInfo . get ( i ) . getIfCross ( ) , "2" ) ) {
SectionDTO sectionByCode = highDangerMapper . getSectionByCode ( sectionInfo . get ( i ) . getSectionCode ( ) ) ;
sectionInfo . get ( i ) . setSectionName ( sectionByCode . getSectionName ( ) ) ;
for ( ThtSectionInfoDTO sectionInfoDTO : sectionInfo ) {
// 路侧防护
List < EnumRoadType > roadTypes = highDangerService . getRoadTypes ( 303 ) ;
for ( EnumRoadType enumType : roadTypes ) {
if ( Objects . equals ( enumType . getEnumvalue ( ) , sectionInfoDTO . getRoadType ( ) ) ) {
sectionInfoDTO . setRoadTypeStrValue ( enumType . getEnumName ( ) ) ;
}
}
List < EnumRoadType > roadStructure = highDangerService . getEnumValues ( 3119 ) ;
for ( EnumRoadType enumType : roadStructure ) {
if ( Objects . equals ( enumType . getEnumvalue ( ) , sectionInfoDTO . getRoadStructure ( ) ) ) {
sectionInfoDTO . setRoadStructureStrValue ( enumType . getEnumName ( ) ) ;
}
}
List < EnumRoadType > sideProtec = highDangerService . getEnumValues ( 3127 ) ;
for ( EnumRoadType enumType : sideProtec ) {
if ( Objects . equals ( enumType . getEnumvalue ( ) , sectionInfoDTO . getSideProtec ( ) ) ) {
sectionInfoDTO . setSideProtecStrValue ( enumType . getEnumName ( ) ) ;
}
}
List < EnumRoadType > centerSeparate = highDangerService . getEnumValues ( 3134 ) ;
for ( EnumRoadType enumType : centerSeparate ) {
if ( Objects . equals ( enumType . getEnumvalue ( ) , sectionInfoDTO . getCenterSeparate ( ) ) ) {
sectionInfoDTO . setCenterSeparateStrValue ( enumType . getEnumName ( ) ) ;
}
}
// sectionInfoDTO.getRoadType();
// 没有路段名称 且 路段编号为空 -> 自定义的路段,将roadName赋值给SectionName作为道路名称展示
if ( sectionInfoDTO . getSectionName ( ) = = null & & sectionInfoDTO . getRoadName ( ) ! = null ) {
sectionInfoDTO . setSectionName ( sectionInfoDTO . getRoadName ( ) ) ;
} else {
if ( Objects . equals ( sectionInfoDTO . getIfCross ( ) , "2" ) ) {
SectionDTO sectionByCode = highDangerMapper . getSectionByCode ( sectionInfoDTO . getSectionCode ( ) ) ;
sectionInfoDTO . setSectionName ( sectionByCode . getSectionName ( ) ) ;
}
if ( Objects . equals ( sectionInfoDTO . getIfCross ( ) , "1" ) ) {
List < BisRoadDTO > bisRoad = highDangerService . getBisRoadByCode ( sectionInfoDTO . getRoadCode ( ) ) ;
// List<SectionVO> sectionByCrossing = highDangerMapper.getSectionByCrossing();
sectionInfoDTO . setSectionName ( bisRoad . get ( 0 ) . getRoadName ( ) ) ;
}
if ( Objects . equals ( sectionInfo . get ( i ) . getIfCross ( ) , "1" ) ) {
sectionInfo . get ( i ) . setSectionCode ( sectionInfo . get ( i ) . getRoadCode ( ) ) ;
}
// 是否该排查有绑定的辖区街道信息,有则展示
List < StreetCommunity > communityByRoad = highDangerMapper . getCommunityByRoad ( businessId ) ;
if ( communityByRoad ! = null & & ! communityByRoad . isEmpty ( ) ) {
StreetCommunity streetCommunity = communityByRoad . get ( 0 ) ;
sectionInfo . get ( i ) . setXqcode ( streetCommunity . getXqcode ( ) ) ;
sectionInfo . get ( i ) . setXqname ( streetCommunity . getXqname ( ) ) ;
sectionInfo . get ( i ) . setJdcode ( streetCommunity . getJdcode ( ) ) ;
sectionInfo . get ( i ) . setJdname ( streetCommunity . getJdname ( ) ) ;
sectionInfoDTO . setXqcode ( streetCommunity . getXqcode ( ) ) ;
sectionInfoDTO . setXqname ( streetCommunity . getXqname ( ) ) ;
sectionInfoDTO . setJdcode ( streetCommunity . getJdcode ( ) ) ;
sectionInfoDTO . setJdname ( streetCommunity . getJdname ( ) ) ;
// log.info("/getSectionInfo(获取基础数据(第一页))接口返回, 客户端ip: {}, 返回数据:{}", request.getRemoteAddr(), sectionInfo);
// return ServerResponse.ok(sectionInfoDTO);
}
}
// }
log . info ( "/getSectionInfo(获取基础数据(第一页))接口返回, 客户端ip: {}, 返回数据:{}" , request . getRemoteAddr ( ) , sectionInfo ) ;
if ( sectionInfo ! = null ) {
if ( ! sectionInfo . isEmpty ( ) ) {
return ServerResponse . ok ( sectionInfo ) ;
} else {
return ServerResponse . ok ( "无基本信息内容" , null ) ;
return ServerResponse . ok ( "无基本信息内容" , new LinkedList < > ( ) ) ;
}
}
@ -901,7 +1007,7 @@ public class HighDangerController {
if ( thtDangerItems ! = null ) {
return ServerResponse . ok ( thtDangerItems ) ;
} else {
return ServerResponse . error ( "无存在问题数据" ) ;
return ServerResponse . ok ( "无存在问题数据" ) ;
}
}
@ -912,18 +1018,26 @@ public class HighDangerController {
public ServerResponse < ? > getImportDangerDisplay ( @RequestParam String businessId , HttpServletRequest request ) {
log . info ( "/getImportDangerDisplay(排查第三页--重点排查项标签)接口被调用,调用ip: {}, 入参:{}" , request . getRemoteAddr ( ) , businessId ) ;
LinkedList < String > checkedList = new LinkedList < > ( ) ;
HashMap < String , String > checkedMap = new HashMap < > ( ) ;
// 获取绑定场景信息
List < ImportDangerDTO > item = highDangerMapper . getImportDangerDisplayItem ( businessId ) ;
List < ThtHiddenDataCollectConfigExtra > importDangerList = highDangerMapper . getImportDangerDisplay ( businessId , null ) ;
for ( ThtHiddenDataCollectConfigExtra importDanger : importDangerList ) {
checkedList . add ( importDanger . getDangerId ( ) ) ;
}
List < ThtHiddenDangerRoadInfo > thtHiddenDangerRoadInfoByBusinessId = highDangerMapper . getThtHiddenDangerRoadInfoByBusinessId ( businessId ) ;
for ( ThtHiddenDangerRoadInfo roadInfo : thtHiddenDangerRoadInfoByBusinessId ) {
checkedList . add ( roadInfo . getScenesId ( ) + "-" + roadInfo . getHdTerm ( ) ) ;
}
// 查询所有标签绑定详情页数据
// List<ThtHiddenDataCollectConfigExtra> importDangerList = highDangerMapper.getImportDangerDisplay(businessId, null,null);
// for (ThtHiddenDataCollectConfigExtra importDanger : importDangerList) {
// checkedList.add(importDanger.getScenesId() + "-" + importDanger.getDangerId());
// }
for ( ImportDangerDTO importDangerDTO : item ) {
List < ThtDangerItems > importDangerItemsValue = new LinkedList < > ( ) ;
// 根据nid查询绑定的隐患项
List < ThtDangerItems > importDangerItems = highDangerMapper . getImportDangerItems ( importDangerDTO . getNid ( ) ) ;
for ( ThtDangerItems items : importDangerItems ) {
if ( checkedList . contains ( items . getId ( ) ) ) {
if ( checkedList . contains ( importDangerDTO . getNid ( ) + "-" + i tems . getId ( ) ) ) {
items . setChecked ( "1" ) ;
}
// assert importDangerItemsValue != null;
@ -933,10 +1047,10 @@ public class HighDangerController {
}
log . info ( "/getImportDangerDisplay(排查第三页--重点排查项标签)接口返回, 客户端ip: {}, 返回数据:{}" , request . getRemoteAddr ( ) , item ) ;
if ( item ! = null ) {
if ( ! item . isEmpty ( ) ) {
return ServerResponse . ok ( item ) ;
} else {
return ServerResponse . error ( "无存在问题数据" ) ;
return ServerResponse . ok ( "无存在问题数据" ) ;
}
}
@ -947,13 +1061,19 @@ public class HighDangerController {
public ServerResponse < ? > getImportDangerDisplayDetail ( @RequestParam String businessId ,
@RequestParam String dangerId ,
HttpServletRequest request ) {
log . info ( "/getImportDangerDisplayDetail(排查第三页--重点排查新增标签详情数据)接口被调用,调用ip: {}, 入参:{}" , request . getRemoteAddr ( ) , businessId ) ;
List < ThtHiddenDataCollectConfigExtra > importDangerList = highDangerMapper . getImportDangerDisplay ( businessId , dangerId ) ;
log . info ( "/getImportDangerDisplayDetail(排查第三页--重点排查新增标签详情数据)接口被调用,调用ip: {}, 入参:{},{}" , request . getRemoteAddr ( ) , businessId , dangerId ) ;
String [ ] split = dangerId . split ( "-" ) ;
List < ThtHiddenDataCollectConfigExtra > importDangerList = highDangerMapper . getImportDangerDisplay ( businessId , split [ 0 ] , split [ 1 ] ) ;
for ( ThtHiddenDataCollectConfigExtra extra : importDangerList ) {
extra . setId ( extra . getDangerId ( ) ) ;
extra . setNid ( extra . getScenesId ( ) ) ;
}
log . info ( "/getImportDangerDisplayDetail(排查第三页--重点排查新增标签详情数据)接口返回, 客户端ip: {}, 返回数据:{}" , request . getRemoteAddr ( ) , importDangerList ) ;
if ( importDangerList ! = null ) {
return ServerResponse . ok ( importDangerList ) ;
} else {
return ServerResponse . error ( "无存在问题数据" ) ;
return ServerResponse . ok ( "无存在问题数据" ) ;
}
}
@ -970,26 +1090,26 @@ public class HighDangerController {
log . info ( "/getUserHiddenDangerList(排查第三页--存在隐患列表(用户数据回显))接口被调用,调用ip: {}, 入参:{}, pcType: {}" , request . getRemoteAddr ( ) , businessId , pcType ) ;
List < HiddenDangerDTO > userHiddenDangerList = highDangerMapper . getUserHiddenDangerList ( businessId , pcType , hdTerm ) ;
for ( int i = 0 ; i < userHiddenDangerList . size ( ) ; i + + ) {
ThtDangerItems dangerItemsById = highDangerMapper . getDangerItemsById ( userHiddenDangerList . get ( i ) . getHdTerm ( ) ) ;
for ( HiddenDangerDTO hiddenDangerDTO : userHiddenDangerList ) {
if ( "1" . equals ( hiddenDangerDTO . getPcType ( ) ) ) {
hiddenDangerDTO . setNid ( hiddenDangerDTO . getScenesId ( ) ) ;
hiddenDangerDTO . setId ( hiddenDangerDTO . getHdTerm ( ) ) ;
}
ThtDangerItems dangerItemsById = highDangerMapper . getDangerItemsById ( hiddenDangerDTO . getHdTerm ( ) ) ;
userHiddenDangerList . get ( i ) . setSmallCategory ( dangerItemsById . getParentid ( ) ) ;
hiddenDangerDTO . setSmallCategory ( dangerItemsById . getParentid ( ) ) ;
ThtDangerItems dangerItemsById_f = highDangerMapper . getDangerItemsById ( dangerItemsById . getParentid ( ) ) ;
userHiddenDangerList . get ( i ) . setBigCategory ( dangerItemsById_f . getParentid ( ) ) ;
hiddenDangerDTO . setBigCategory ( dangerItemsById_f . getParentid ( ) ) ;
String dangerItems = highDangerMapper . getDangerProblem ( userHiddenDangerList . get ( i ) . getBigCategory ( ) ) + "/" +
highDangerMapper . getDangerProblem ( userHiddenDangerList . get ( i ) . getSmallCategory ( ) ) + "/" +
highDangerMapper . getDangerProblem ( userHiddenDangerList . get ( i ) . getHdTerm ( ) ) ;
userHiddenDangerList . get ( i ) . setDangerProblem ( dangerItems ) ;
String dangerItems = highDangerMapper . getDangerProblem ( hiddenDangerDTO . getBigCategory ( ) ) + "/" +
highDangerMapper . getDangerProblem ( hiddenDangerDTO . getSmallCategory ( ) ) + "/" +
highDangerMapper . getDangerProblem ( hiddenDangerDTO . getHdTerm ( ) ) ;
hiddenDangerDTO . setDangerProblem ( dangerItems ) ;
}
log . info ( "/getUserHiddenDangerList(排查第三页--存在隐患列表(用户数据回显))接口返回, 客户端ip: {}, 返回数据:{}" , request . getRemoteAddr ( ) , userHiddenDangerList ) ;
if ( userHiddenDangerList ! = null ) {
return ServerResponse . ok ( userHiddenDangerList ) ;
} else {
return ServerResponse . error ( "当前隐患排查中无存在隐患信息" ) ;
}
}
/ *
@ -1007,6 +1127,7 @@ public class HighDangerController {
String ftpUrl = "ftp://" + userName + ":" + passWord + "@" + ip + ":" + port + CURRENT_DIR ;
log . info ( "/saveManualInvestigation(保存 & 暂存人工排查)接口被调用,调用ip: {}, 入参:{}" , request . getRemoteAddr ( ) , manualInvestigation ) ;
Date lastModDate = new Date ( ) ;
manualInvestigation . setLastModeDate ( lastModDate ) ;
@ -1018,7 +1139,7 @@ public class HighDangerController {
if ( operatorById ! = null ) {
cdepartmentid = operatorById . getCdepartmentid ( ) ;
} else {
return ServerResponse . error ( "未找到当前用户" ) ;
return ServerResponse . ok ( "未找到当前用户" ) ;
}
// 新增排查
@ -1046,6 +1167,9 @@ public class HighDangerController {
highDangerBase . setApproveStatus ( "1" ) ;
highDangerBase . setInsertTime ( date ) ;
highDangerBase . setLastModDate ( new Date ( ) ) ;
highDangerBase . setArea ( manualInvestigation . getXqcode ( ) ) ;
highDangerBase . setReportDept ( cdepartmentid ) ;
highDangerBase . setHandleDept ( cdepartmentid ) ;
// 道路NID
highDangerRoad . setNid ( nid ) ;
@ -1055,9 +1179,20 @@ public class HighDangerController {
highDangerRoad . setSectionCode ( manualInvestigation . getSectionCode ( ) ) ;
if ( Objects . equals ( manualInvestigation . getIfCross ( ) , "1" ) ) {
highDangerRoad . setCrossCode ( manualInvestigation . getSectionCode ( ) ) ;
// 新增路口坐标
if ( manualInvestigation . getPosition ( ) ! = null ) {
highDangerRoad . setRadius ( "0.008218" ) ;
// 路口
highDangerRoad . setCoordinateType ( "1" ) ;
highDangerRoad . setCoordinate ( manualInvestigation . getPosition ( ) + ",0.008218" ) ;
}
} else {
// 路段
highDangerRoad . setCoordinateType ( "2" ) ;
highDangerRoad . setCoordinate ( manualInvestigation . getPosition ( ) ) ;
}
highDangerRoad . setIfCross ( manualInvestigation . getIfCross ( ) ) ;
highDangerRoad . setBelongXq ( cdepartmentid ) ;
highDangerRoad . setPcCount ( "0" ) ;
highDangerRoad . setLastModDate ( new Date ( ) ) ;
@ -1073,7 +1208,9 @@ public class HighDangerController {
thtTimeLineDTO . setOperator ( manualInvestigation . getOperator ( ) ) ;
// 分别插入两张表
// base表
highDangerService . insertDanger ( highDangerBase ) ;
// road表
highDangerService . insertDangerRoad ( highDangerRoad ) ;
highDangerService . insertTimeLine ( thtTimeLineDTO ) ;
@ -1085,17 +1222,20 @@ public class HighDangerController {
highDangerMapper . updateSectionCommunity ( hidden_businessId , manualInvestigation . getXqcode ( ) , manualInvestigation . getJdcode ( ) ) ;
// 第一页:基础数据
List < ThtSectionInfoDTO > sectionInfos = highDangerMapper . getSectionInfo ( hidden_businessId ) ;
if ( ! sectionInfos . isEmpty ( ) ) {
// 更新基础数据(步骤1)
for ( BasicInfoVO basicInfoVO : manualInvestigation . getBasicInfo ( ) ) {
basicInfoVO . setBusinessId ( hidden_businessId ) ;
highDangerMapper . updateSectionInfo ( basicInfoVO ) ;
}
} else {
// 先删除,后添加
highDangerMapper . delSectionInfo ( hidden_businessId ) ;
int flag = 0 ;
// 保存基础数据(步骤1)
for ( BasicInfoVO basicInfoVO : manualInvestigation . getBasicInfo ( ) ) {
basicInfoVO . setIfCross ( manualInvestigation . getIfCross ( ) ) ;
//
// if(flag == 0){
// SectionDTO bisSectionBySectionCode = highDangerService.getBisSectionBySectionCode(basicInfoVO.getSectionCode());
// highDangerService.updateHiddenDangerRoad(bisSectionBySectionCode.getRoadCode(),manualInvestigation.getBusinessId());
// flag++;
// }
// 路口类型,将路口code存入 bis_section_info 表中
if ( manualInvestigation . getIfCross ( ) ! = null & & manualInvestigation . getIfCross ( ) . equals ( "1" ) ) {
basicInfoVO . setRoadCode ( manualInvestigation . getSectionCode ( ) ) ;
@ -1104,7 +1244,16 @@ public class HighDangerController {
// 插入列表
highDangerMapper . insertSectionInfo ( basicInfoVO ) ;
}
}
// if (!sectionInfos.isEmpty()) {
// // 更新基础数据(步骤1)
// for (BasicInfoVO basicInfoVO : manualInvestigation.getBasicInfo()) {
// basicInfoVO.setBusinessId(hidden_businessId);
// highDangerMapper.updateSectionInfo(basicInfoVO);
// }
// } else {
//
// }
// 判断数据库是否存在统计数据
ThtSectionTrafficDTO sectionTraffic = highDangerMapper . getSectionTraffic ( hidden_businessId ) ;
@ -1133,17 +1282,29 @@ public class HighDangerController {
// 隐患排查表--如果存在该记录则更新
highDangerMapper . deleteRoadInfo ( hidden_businessId ) ;
for ( HiddenDangerDTO details : manualInvestigation . getDescribe ( ) ) {
if ( "1" . equals ( details . getPcType ( ) ) ) {
details . setScenesId ( details . getNid ( ) ) ;
details . setHdTerm ( details . getId ( ) ) ;
}
// 随机生成UUID
String uuidString = UUID . randomUUID ( ) . toString ( ) . replace ( "-" , "" ) ;
details . setNid ( uuidString ) ;
details . setBusinessId ( hidden_businessId ) ;
details . setPcCount ( manualInvestigation . getPcCount ( ) ) ;
ThtDangerItems dangerItemsById = highDangerMapper . getDangerItemsById ( details . getHdTerm ( ) ) ;
String dangerId = "" ;
if ( details . getId ( ) ! = null ) {
dangerId = details . getId ( ) ;
details . setHdTerm ( dangerId ) ;
} else {
dangerId = details . getHdTerm ( ) ;
}
ThtDangerItems dangerItemsById = highDangerMapper . getDangerItemsById ( dangerId ) ;
details . setSmallCategory ( dangerItemsById . getParentid ( ) ) ;
ThtDangerItems dangerItemsById_f = highDangerMapper . getDangerItemsById ( dangerItemsById . getParentid ( ) ) ;
details . setBigCategory ( dangerItemsById_f . getParentid ( ) ) ;
// 保存重点排查数据
highDangerMapper . saveDangerExtra ( details ) ;
@ -1151,7 +1312,7 @@ public class HighDangerController {
//提交的时候保存附件
if ( manualInvestigation . getTemporary ( ) = = 1 & & StringUtils . isNotEmpty ( details . getHdPic ( ) )
| | manualInvestigation . getTemporary ( ) = = 2 & & StringUtils . isNotEmpty ( details . getHdPic ( ) ) ) {
String hdPicArr [ ] = details . getHdPic ( ) . split ( "," ) ;
String [ ] hdPicArr = details . getHdPic ( ) . split ( "," ) ;
for ( String s : hdPicArr ) {
nid = UUID . randomUUID ( ) . toString ( ) . replace ( "-" , "" ) ;
// nid = uuid.toString().replace("-", "");
@ -1181,9 +1342,12 @@ public class HighDangerController {
thtTimeLineDTO . setTitle ( "隐患排查" ) ;
thtTimeLineDTO . setLastModDate ( date ) ;
thtTimeLineDTO . setOperator ( manualInvestigation . getOperator ( ) ) ;
//
ThtTimeLineDTO timeLineNid = highDangerService . getTimeLineNid ( manualInvestigation . getBusinessId ( ) , thtTimeLineDTO . getStatus ( ) ) ;
if ( timeLineNid = = null ) {
highDangerService . insertTimeLine ( thtTimeLineDTO ) ;
}
}
/ * if ( ! highDangerMapper . isExtraExistence ( manualInvestigation . getBusinessId ( ) ) . isEmpty ( ) ) {
} else {
} * /
@ -1236,7 +1400,7 @@ public class HighDangerController {
return ServerResponse . ok ( "数据已暂存" , manualInvestigation ) ;
} else if ( manualInvestigation . getTemporary ( ) = = 1 ) {
log . info ( "/saveManualInvestigation(保存 & 暂存人工排查)接口返回, 客户端ip: {}, 返回数据:{},{}" , request . getRemoteAddr ( ) , "数据已保存" , manualInvestigation ) ;
highDangerMapper . updateTemporary ( hidden_businessId ) ;
highDangerMapper . updateTemporary ( hidden_businessId , new Date ( ) , "1" ) ;
//隐患项不为空时,修改tht_hidden_danger_road
String hdFlag = "0" ;
if ( CollectionUtils . isNotEmpty ( manualInvestigation . getDescribe ( ) ) ) {
@ -1248,7 +1412,7 @@ public class HighDangerController {
thtAApprove . setNid ( nid ) ;
thtAApprove . setBusinessId ( hidden_businessId ) ;
thtAApprove . setOperator ( manualInvestigation . getLastModeUser ( ) ) ;
thtAApprove . setStatus ( "1 0" ) ;
thtAApprove . setStatus ( "0" ) ;
thtAApprove . setOperateTime ( date ) ;
thtAApprove . setOperateContent ( "0" ) ;
thtAApprove . setLastModDate ( date ) ;
@ -1270,7 +1434,7 @@ public class HighDangerController {
thtApproveService . save ( thtAApprove ) ;
return ServerResponse . ok ( "数据已新增" , manualInvestigation ) ;
} else {
return ServerResponse . error ( "无保存标识" ) ;
return ServerResponse . ok ( "无保存标识" ) ;
}
}
@ -1314,7 +1478,7 @@ public class HighDangerController {
if ( operatorById ! = null ) {
cdepartmentid = operatorById . getCdepartmentid ( ) ;
} else {
return ServerResponse . error ( "未找到当前用户" ) ;
return ServerResponse . ok ( "未找到当前用户" ) ;
}
List < HighDangerBase > approvalList = highDangerService . getHigDangerApproval ( cdepartmentid , search ) ;
@ -1383,7 +1547,6 @@ public class HighDangerController {
}
}
if ( "20" . equals ( thtApprove . getStatus ( ) ) ) {
if ( "0" . equals ( thtApprove . getOperateContent ( ) ) ) {
thtApprove . setApprovalInfo ( username + "治理提交" ) ;
@ -1669,31 +1832,94 @@ public class HighDangerController {
}
/ *
首页进行中 排查列表
首页排查中 列表数据
* /
@GetMapping ( "/ProcessingDangerList" )
public ServerResponse < ? > ProcessingList ( @RequestParam String nuserId ) throws ParseException {
public ServerResponse < ? > ProcessingList ( @RequestParam String nuserId , HttpServletRequest request ) throws ParseException {
log . info ( "/ProcessingDangerList(首页排查中列表数据)接口被调用,调用ip: {}, 入参:{}" , request . getRemoteAddr ( ) , nuserId ) ;
// 获取待办数据中当前操作人不为空,且时间最近的两条数据
List < HighDangerBase > highDangerBase = highDangerMapper . ProcessingDangerList ( nuserId ) ;
for ( int i = 0 ; i < highDangerBase . size ( ) ; i + + ) {
for ( HighDangerBase dangerBase : highDangerBase ) {
int delayHour = dangerBase . getDelayHour ( ) ;
int delayDay = dangerBase . getDelayDay ( ) ;
int nearDay = dangerBase . getNearDay ( ) ;
int nearHour = dangerBase . getNearHour ( ) ;
// 时间规范
SimpleDateFormat dateFormat = new SimpleDateFormat ( "yyyy-MM-dd HH:mm:ss" ) ;
String format = dateFormat . format ( highDangerBase . get ( i ) . getPcStartTime ( ) ) ;
String lastModDate = dateFormat . format ( dangerBase . getLastModDate ( ) ) ;
String curOperDate = dateFormat . format ( dangerBase . getCurOperDate ( ) ) ;
dangerBase . setLastModDateStr ( lastModDate ) ;
dangerBase . setCurOperDateStr ( curOperDate ) ;
// highDangerBase.get(i).setLastModDate(dateFormat.parse(dateFormat.format(highDangerBase.get(i).getLastModDate())));
// highDangerBase.get(i).setPcStartTime(dateFormat.parse(dateFormat.format(highDangerBase.get(i).getPcStartTime())));
// highDangerBase.get(i).setCurOperDate(dateFormat.parse(dateFormat.format(highDangerBase.get(i).getCurOperDate())));
// 获取单条查询数据的当前操作人id
String nuserId1 = highDangerBase . get ( i ) . getCurOperUser ( ) ;
String nuserId1 = dangerBase . getCurOperUser ( ) ;
// 根据操作人id获取操作人用户名
Operator operatorById = operatorMapper . getOperatorById ( nuserId1 ) ;
highDangerBase . get ( i ) . setCuserName ( operatorById . getCusername ( ) ) ;
dangerBase . setCuserName ( operatorById . getCusername ( ) ) ;
if ( dangerBase . getTimeStatus ( ) = = null | | dangerBase . getTimeStatus ( ) . equals ( "9" ) ) {
dangerBase . setDeadlineStatus ( "正常" ) ;
dangerBase . setDeadlineType ( "3" ) ;
}
// 超期
if ( Objects . equals ( dangerBase . getTimeStatus ( ) , "1" ) ) {
// // 获取相差的时间戳
// double timeDiffSeconds = Double.parseDouble(base.getTimeDiffEnd());
// // 计算天数
// int days = (int)Math.floor(timeDiffSeconds / (24 * 3600));
// // 计算秒数
// double remainingSeconds = timeDiffSeconds % (24 * 3600);
// // 计算小时数
// int hours = (int)Math.ceil(remainingSeconds / 3600);
if ( delayDay = = 0 ) {
dangerBase . setDeadlineStatus ( "超期" + delayHour + "小时" ) ;
if ( delayHour = = 0 ) {
dangerBase . setDeadlineStatus ( "超期不足一小时" ) ;
}
} else if ( delayHour = = 0 ) {
dangerBase . setDeadlineStatus ( "超期" + delayDay + "天" ) ;
} else {
dangerBase . setDeadlineStatus ( "超期" + delayDay + "天" + delayHour + "小时" ) ;
}
dangerBase . setDeadlineType ( "1" ) ;
}
if ( Objects . equals ( dangerBase . getTimeStatus ( ) , "2" ) ) {
// // 获取相差的时间戳
// double timeDiffSeconds = Double.parseDouble(base.getTimeDiffStart());
// // 计算天数
// int days= (int)Math.floor(timeDiffSeconds / (24 * 3600));
// // 计算秒数
// double remainingSeconds = timeDiffSeconds % (24 * 3600);
// // 计算小时数
// int hours = (int)Math.ceil(remainingSeconds / 3600);
if ( nearDay = = 0 ) {
dangerBase . setDeadlineStatus ( "临期" + nearHour + "小时" ) ;
if ( delayHour = = 0 ) {
dangerBase . setDeadlineStatus ( "临期不足一小时" ) ;
}
} else if ( nearHour = = 0 ) {
dangerBase . setDeadlineStatus ( "临期" + nearDay + "天" ) ;
} else {
dangerBase . setDeadlineStatus ( "临期" + nearDay + "天" + nearHour + "小时" ) ;
}
dangerBase . setDeadlineType ( "2" ) ;
}
// 展示条件
highDangerBase . get ( i ) . setEnumname ( "排查中 " + format ) ;
highDangerBase . get ( i ) . setDeadlineStatus ( "正常" ) ;
dangerBase . setEnumname ( dangerBase . getEnumname ( ) ) ;
// dangerBase.setDeadlineStatus("正常");
}
log . info ( "/ProcessingDangerList(首页排查中列表数据)接口返回,调用ip: {}, 出参:{}" , request . getRemoteAddr ( ) , highDangerBase ) ;
return ServerResponse . ok ( highDangerBase ) ;
}
@ -1726,4 +1952,17 @@ public class HighDangerController {
return ServerResponse . ok ( highDangerBase ) ;
}
/ *
* @Description : 获取用户当前是否存在进行中的排查
* @param String
* @return :
* @Author : 云曦
* @date : 2024 / 10 / 9 15 : 06
* /
@GetMapping ( "/getInHandDanger" )
@ApiOperation ( "取用户最新一条的排查数据" )
public ServerResponse < ? > getInHandDanger ( @RequestParam String nuserId ) {
HighDangerBase inHandDanger = highDangerService . getInHandDanger ( nuserId ) ;
return ServerResponse . ok ( inHandDanger ) ;
}
}