|
|
|
|
@ -3,16 +3,20 @@ 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.service.HighDangerService; |
|
|
|
|
import com.hisense.hiatmp.model.dmr.Point; |
|
|
|
|
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 lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
@ -35,10 +39,25 @@ public class HighDangerController { |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
HighDangerService highDangerService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
ConfigureMapper configureMapper; |
|
|
|
|
ThtAttachsService thtAttachsService; |
|
|
|
|
@Autowired |
|
|
|
|
ThtApproveService thtApproveService; |
|
|
|
|
|
|
|
|
|
@Value("${spring.ftp.username}") //用户名
|
|
|
|
|
private String userName; |
|
|
|
|
|
|
|
|
|
@Value("${spring.ftp.password}") //密码
|
|
|
|
|
private String passWord; |
|
|
|
|
|
|
|
|
|
@Value("${spring.ftp.host}") //ip地址
|
|
|
|
|
private String ip; |
|
|
|
|
|
|
|
|
|
@Value("${spring.ftp.port}") //端口号
|
|
|
|
|
private int port; |
|
|
|
|
|
|
|
|
|
@Value("${spring.ftp.currentdir}") |
|
|
|
|
private String CURRENT_DIR; // 文件存放的目录
|
|
|
|
|
/* |
|
|
|
|
查询各个状态的数据情况 |
|
|
|
|
*/ |
|
|
|
|
@ -79,8 +98,6 @@ public class HighDangerController { |
|
|
|
|
return ServerResponse.error("未找到当前用户"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int termTime = Integer.parseInt(configureMapper.getTermTime()); |
|
|
|
|
|
|
|
|
|
//Page<HighDangerBase> page = new Page<>(pageNum, pageSize);
|
|
|
|
|
PageHelper.startPage(pageNum, pageSize); |
|
|
|
|
// 将要查询的状态和部门id查询数据库,获得隐患排查表
|
|
|
|
|
@ -94,8 +111,7 @@ public class HighDangerController { |
|
|
|
|
|
|
|
|
|
for (HighDangerBase base : statusCounts) { |
|
|
|
|
Date nowDate = new Date(); |
|
|
|
|
Date pcEndTime = base.getRoadPcEndTime(); |
|
|
|
|
Date pcStartTime = base.getPcStartTime(); |
|
|
|
|
Date pcEndTime = base.getPcEndTime(); |
|
|
|
|
if (pcEndTime != null) { |
|
|
|
|
long diff = nowDate.getTime() - pcEndTime.getTime(); |
|
|
|
|
// 时间差,天数
|
|
|
|
|
@ -129,7 +145,7 @@ public class HighDangerController { |
|
|
|
|
base.setDeadline(diffDays); |
|
|
|
|
base.setDeadlineStatus("超期" + diffDays + "天" + remainingHours + "小时"); |
|
|
|
|
base.setDeadlineType("1"); |
|
|
|
|
} else if (comparison > 0 && diffDays <= termTime) { // 临期
|
|
|
|
|
} else if (comparison > 0 && diffDays <= 3) { // 临期
|
|
|
|
|
if (diffHours < 1) { |
|
|
|
|
base.setDeadlineStatus("临期不足一小时"); |
|
|
|
|
base.setDeadlineType("2"); |
|
|
|
|
@ -152,68 +168,9 @@ public class HighDangerController { |
|
|
|
|
base.setDeadlineStatus("正常"); |
|
|
|
|
base.setDeadlineType("3"); |
|
|
|
|
} |
|
|
|
|
} 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"); |
|
|
|
|
} else { |
|
|
|
|
base.setDeadlineStatus("无排查结束时间"); |
|
|
|
|
base.setDeadlineType("3"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
PageInfo<HighDangerBase> pageInfo = new PageInfo<>(statusCounts); |
|
|
|
|
@ -771,7 +728,7 @@ public class HighDangerController { |
|
|
|
|
@Transactional |
|
|
|
|
@PostMapping("/saveManualInvestigation") |
|
|
|
|
public ServerResponse<?> saveManualInvestigation(@RequestBody ManualInvestigation manualInvestigation, HttpServletRequest request) { |
|
|
|
|
|
|
|
|
|
String ftpUrl = "ftp://"+userName+":"+passWord+"@"+ip+":"+port+CURRENT_DIR; |
|
|
|
|
log.info("/saveManualInvestigation(保存 & 暂存人工排查)接口被调用,调用ip: {}, 入参:{}", request.getRemoteAddr(), manualInvestigation); |
|
|
|
|
Date lastModDate = new Date(); |
|
|
|
|
manualInvestigation.setLastModeDate(lastModDate); |
|
|
|
|
@ -808,7 +765,7 @@ public class HighDangerController { |
|
|
|
|
extra.setBusinessId(manualInvestigation.getBusinessId()); |
|
|
|
|
highDangerMapper.saveThtHiddenDataCollectConfigExtra(extra); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Date date = new Date(); |
|
|
|
|
// 隐患排查表--如果存在该记录则更新
|
|
|
|
|
highDangerMapper.deleteRoadInfo(manualInvestigation.getBusinessId()); |
|
|
|
|
for (HiddenDangerDTO details : manualInvestigation.getDescribe()) { |
|
|
|
|
@ -819,6 +776,28 @@ public class HighDangerController { |
|
|
|
|
details.setBusinessId(manualInvestigation.getBusinessId()); |
|
|
|
|
// 保存重点排查数据
|
|
|
|
|
highDangerMapper.saveDangerExtra(details); |
|
|
|
|
|
|
|
|
|
//提交的时候保存附件
|
|
|
|
|
if (manualInvestigation.getTemporary() == Boolean.TRUE |
|
|
|
|
&& StringUtils.isNotEmpty(details.getHdPic())) { |
|
|
|
|
String hdPicArr[] = details.getHdPic().split(","); |
|
|
|
|
for (String s : hdPicArr) { |
|
|
|
|
uuid = UUID.randomUUID(); |
|
|
|
|
uuidString = uuid.toString().replace("-", ""); |
|
|
|
|
ThtAttachs thtAttachs = new ThtAttachs(); |
|
|
|
|
String accachName = s.substring(s.lastIndexOf("/") + 1); |
|
|
|
|
thtAttachs.setId(uuidString); |
|
|
|
|
thtAttachs.setAttachUrl(ftpUrl + accachName); |
|
|
|
|
thtAttachs.setAttachType("3"); |
|
|
|
|
thtAttachs.setUploadTime(date); |
|
|
|
|
thtAttachs.setInfoId(details.getNid()); |
|
|
|
|
thtAttachs.setAttachName(accachName); |
|
|
|
|
thtAttachs.setBusinessId(manualInvestigation.getBusinessId()); |
|
|
|
|
thtAttachs.setPcCount(pcCount); |
|
|
|
|
thtAttachs.setLastModDate(date); |
|
|
|
|
thtAttachsService.saveAttachs(thtAttachs); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
/*if(!highDangerMapper.isExtraExistence(manualInvestigation.getBusinessId()).isEmpty()){ |
|
|
|
|
}else{ |
|
|
|
|
@ -874,6 +853,23 @@ public class HighDangerController { |
|
|
|
|
} else { |
|
|
|
|
log.info("/saveManualInvestigation(保存 & 暂存人工排查)接口返回, 客户端ip: {}, 返回数据:{},{}", request.getRemoteAddr(), "数据已保存", manualInvestigation); |
|
|
|
|
highDangerMapper.updateTemporary(manualInvestigation.getBusinessId(), "20"); |
|
|
|
|
//隐患项不为空时,修改tht_hidden_danger_road
|
|
|
|
|
String hdFlag = "0"; |
|
|
|
|
if (CollectionUtils.isNotEmpty(manualInvestigation.getDescribe())) { |
|
|
|
|
hdFlag = "1"; |
|
|
|
|
} |
|
|
|
|
highDangerMapper.updateDangerRoad(hdFlag,manualInvestigation.getBusinessId(),pcCount); |
|
|
|
|
ThtApprove thtAApprove = new ThtApprove(); |
|
|
|
|
UUID uuid = UUID.randomUUID(); |
|
|
|
|
String uuidString = uuid.toString().replace("-", ""); |
|
|
|
|
thtAApprove.setNid(uuidString); |
|
|
|
|
thtAApprove.setBusinessId(manualInvestigation.getBusinessId()); |
|
|
|
|
thtAApprove.setOperator(manualInvestigation.getLastModeUser()); |
|
|
|
|
thtAApprove.setStatus("10"); |
|
|
|
|
thtAApprove.setOperateTime(date); |
|
|
|
|
thtAApprove.setOperateContent("0"); |
|
|
|
|
thtAApprove.setLastModDate(date); |
|
|
|
|
thtApproveService.save(thtAApprove); |
|
|
|
|
return ServerResponse.ok("数据已保存", manualInvestigation); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|