时区问题、审批字段、部门(大队)数据查询、数据加入最后修改时间

master
Zangzhipeng 2 years ago
parent 1a2caf9857
commit dd085d936d
  1. 4
      hiatmp-hidden-danger-server/src/main/java/com/hisense/hiatmp/server_api/controller/ConfigController.java
  2. 141
      hiatmp-hidden-danger-server/src/main/java/com/hisense/hiatmp/server_api/controller/HighDangerController.java
  3. 4
      hiatmp-hidden-danger-server/src/main/java/com/hisense/hiatmp/server_api/mapper/HighDangerMapper.java
  4. 2
      hiatmp-hidden-danger-server/src/main/java/com/hisense/hiatmp/server_api/service/impl/HighDangerBaseServiceImpl.java
  5. 163
      hiatmp-hidden-danger-server/src/main/resources/sql-mapper/HighDangerMapper.xml
  6. 9
      hiatmp-hidden-danger-server/src/main/resources/sql-mapper/OperatorMapper.xml
  7. 15
      hiatmp-model/src/main/java/com/hisense/hiatmp/model/common/HighDangerBase.java
  8. 4
      hiatmp-model/src/main/java/com/hisense/hiatmp/model/common/Operator.java
  9. BIN
      hiatmp-model/target/classes/com/hisense/hiatmp/model/common/Operator.class

@ -6,11 +6,13 @@ import com.hisense.hiatmp.server_api.model.StreetCommunity;
import com.hisense.hiatmp.server_api.service.IConfigService;
import com.hisense.hiatmp.common.controller.HiatmpController;
import com.hisense.hiatmp.model.common.ServerResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Slf4j
@RestController
@RequestMapping(value = "/config")
public class ConfigController extends HiatmpController {
@ -57,8 +59,10 @@ public class ConfigController extends HiatmpController {
*/
@GetMapping("/getDangerBaseData")
public ServerResponse<?> getBaseData(@RequestParam String sectionCode){
log.info("/getDangerBaseData(排查第一页默认数据回显)接口被调用,调用ip: {}, 入参:{}", request.getRemoteAddr(),sectionCode);
// 查询默认数据
LineInfo dangerBaseData = configService.getDangerBaseData(sectionCode);
log.info("/getDangerBaseData(排查第一页默认数据回显)接口被调用,调用ip: {}, 入参:{}", request.getRemoteAddr(),sectionCode);
return ServerResponse.ok(dangerBaseData);
}
}

@ -53,16 +53,16 @@ public class HighDangerController {
@Autowired
ConfigureMapper configureMapper;
@Value("${spring.ftp.username}") //用户名
@Value("${spring.ftp.username}") //用户名
private String userName;
@Value("${spring.ftp.password}") //密码
@Value("${spring.ftp.password}") //密码
private String passWord;
@Value("${spring.ftp.host}") //ip地址
@Value("${spring.ftp.host}") //ip地址
private String ip;
@Value("${spring.ftp.port}") //端口号
@Value("${spring.ftp.port}") //端口号
private int port;
@Value("${spring.ftp.currentdir}")
@ -73,7 +73,7 @@ public class HighDangerController {
*/
@Transactional
@GetMapping("/insertDangerTest")
public ServerResponse<?> insertDanger(@RequestParam String name){
public ServerResponse<?> insertDanger(@RequestParam String name) {
HighDangerBase highDangerBase = new HighDangerBase();
HighDangerRoad highDangerRoad = new HighDangerRoad();
@ -118,7 +118,11 @@ public class HighDangerController {
return ServerResponse.error("未找到当前用户");
}
List<HighDangerBaseNum> statusCounts = highDangerMapper.getStatusCounts(cdepartmentid);
// 取部门的前六位
String firstSixChars = cdepartmentid.substring(0, Math.min(cdepartmentid.length(), 6));
log.info("部门前6位为:{}",firstSixChars);
List<HighDangerBaseNum> statusCounts = highDangerMapper.getStatusCounts(firstSixChars, nuserid);
log.info("/getHighDangerStatusNum(查询各个状态的数据情况)接口数据返回,调用ip: {}, 出参:{}", request.getRemoteAddr(), statusCounts);
return ServerResponse.ok(statusCounts);
@ -132,12 +136,12 @@ public class HighDangerController {
@RequestParam(defaultValue = "1") Integer pageNum,
@RequestParam(defaultValue = "10") Integer pageSize,
@RequestParam(defaultValue = "") String search,
@RequestParam(defaultValue = "") String reportDept,
@RequestParam(defaultValue = "") String classification, // 1 已完成 2 个人上报 3 系统下发
HttpServletRequest request
) {
log.info("/getHigDangerDealt(查询首页各个状态的数据列表)接口被调用,调用ip: {}, 入参:{},{},{},{}", request.getRemoteAddr(), highDangerBaseVO, pageNum, pageSize, search);
String cdepartmentid = null;
// 获取当前操作的对象,用于查找对应的部
// 获取当前操作的对象,用于查找对应的部
Operator operatorById = operatorMapper.getOperatorById(highDangerBaseVO.getNuserid());
if (operatorById != null) {
cdepartmentid = operatorById.getCdepartmentid();
@ -145,43 +149,58 @@ public class HighDangerController {
return ServerResponse.error("未找到当前用户");
}
int termTime = Integer.parseInt(configureMapper.getTermTime());
// 取部门的前六位
String firstSixChars = cdepartmentid.substring(0, Math.min(cdepartmentid.length(), 6));
log.info("部门前六位:{}", firstSixChars);
// int termTime = Integer.parseInt(configureMapper.getTermTime());
//Page<HighDangerBase> page = new Page<>(pageNum, pageSize);
PageHelper.startPage(pageNum, pageSize);
// 将要查询的状态和部门id查询数据库,获得隐患排查表
List<HighDangerBase> statusCounts = highDangerMapper.getHigDangerDealt(highDangerBaseVO.getStatus(), cdepartmentid, search,reportDept);
List<HighDangerBase> statusCounts = highDangerMapper.getHigDangerDealt(highDangerBaseVO.getStatus(), firstSixChars, search, highDangerBaseVO.getNuserid(), classification);
// 待办
/*if("20".equals(highDangerBaseVO.getStatus())){
List<HighDangerBase> statusCount = highDangerMapper.getHigDangerDealt("99",cdepartmentid,page,"%" + search + "%");
statusCounts.addAll(statusCount);
}*/
// 遍历排查数据
for (HighDangerBase base : statusCounts) {
int delayHour = base.getDelayHour();
int delayDay = base.getDelayDay();
int nearDay = base.getNearDay();
int nearHour = base.getNearHour();
// 审批状态添加
if(!Objects.equals(base.getApproveStatus(), "0") && !Objects.equals(base.getApproveStatus(), "-1")){
base.setEnumname(base.getEnumname() + "(审批)");
}
for (HighDangerBase base : statusCounts) {
if(base.getTimeStatus() == null || base.getTimeStatus().equals("9")){
if (base.getTimeStatus() == null || base.getTimeStatus().equals("9")) {
base.setDeadlineStatus("正常");
base.setDeadlineType("3");
}
// 超期
if(Objects.equals(base.getTimeStatus(), "1")){
double timeDiffSeconds = Double.parseDouble(base.getTimeDiffEnd());
// 计算天数
int days = (int) (timeDiffSeconds / (24 * 3600));
// 计算剩余的秒数
int remainingSeconds = (int) (timeDiffSeconds % (24 * 3600));
// 计算小时数
int hours = remainingSeconds / 3600;
if(days == 0){
base.setDeadlineStatus("超期" + hours + "小时");
}else if(hours == 0){
base.setDeadlineStatus("超期" + days + "天");
}else if(days == 0 && hours == 0){
base.setDeadlineStatus("超期不足一小时");
}else{
base.setDeadlineStatus("超期" + days + "天" + hours + "小时");
if (Objects.equals(base.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) {
base.setDeadlineStatus("超期" + delayHour + "小时");
} else if (delayHour == 0) {
base.setDeadlineStatus("超期" + delayDay + "天");
} else {
base.setDeadlineStatus("超期" + delayDay + "天" + delayHour + "小时");
}
base.setDeadlineType("1");
// System.out.println("时间差为 " + days + " 天 " + hours + " 小时");
@ -224,29 +243,25 @@ public class HighDangerController {
// base.setDeadlineType("1");
// continue;
}
if(Objects.equals(base.getTimeStatus(), "2")){
double timeDiffSeconds = Math.abs(Double.parseDouble(base.getTimeDiffStart()));
// 计算天数
int days = (int) (timeDiffSeconds / (24 * 3600));
// 计算剩余的秒数
int remainingSeconds = (int) (timeDiffSeconds % (24 * 3600));
// 计算小时数
int hours = remainingSeconds / 3600;
if(days == 0){
base.setDeadlineStatus("临期" + hours + "小时");
}else if(hours == 0){
base.setDeadlineStatus("临期" + days + "天");
}else if(days == 0 && hours == 0){
base.setDeadlineStatus("临期不足一小时");
}else{
base.setDeadlineStatus("临期" + days + "天" + hours + "小时");
if (Objects.equals(base.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) {
base.setDeadlineStatus("临期" + nearHour + "小时");
} else if (nearHour == 0) {
base.setDeadlineStatus("临期" + nearDay + "天");
} else {
base.setDeadlineStatus("临期" + nearDay + "天" + nearHour + "小时");
}
base.setDeadlineType("2");
}
//
// Date pcEndTime = base.getPcEndTime();
// Date pcStartTime = base.getPcStartTime();
//
@ -537,7 +552,7 @@ public class HighDangerController {
pointMapSection.put("distance", (int) Math.ceil(minDistance));
pointMapSection.put("name", dto.getSectionName());
pointMapSection.put("position", pointList);
pointMapSection.put("sectionCode",dto.getSectionCode());
pointMapSection.put("sectionCode", dto.getSectionCode());
pointMapSection.put("type", "1");
combinedMap.add(pointMapSection);
@ -578,7 +593,7 @@ public class HighDangerController {
pointList.add(pointMap);
pointMapCrossing.put("distance", (int) Math.ceil(pointDistance));
pointMapCrossing.put("position", pointList);
pointMapCrossing.put("sectionCode",cross.getCrossingCode());
pointMapCrossing.put("sectionCode", cross.getCrossingCode());
pointMapCrossing.put("type", "2");
// map.put(pointDistance, cross.getLongitude() + "," + cross.getLatitude());
pointMapCrossing.put("name", cross.getCrossingName());
@ -724,7 +739,7 @@ public class HighDangerController {
int i = highDangerMapper.saveSection(sectionOrCrossAdd);
if (i > 0) {
assert roadInfo != null;
return ServerResponse.ok("道路新增成功","2079028191469929");
return ServerResponse.ok("道路新增成功", "2079028191469929");
} else {
return ServerResponse.error("道路新增失败");
}
@ -732,7 +747,7 @@ public class HighDangerController {
int i = highDangerMapper.saveCrossing(sectionOrCrossAdd);
if (i > 0) {
assert roadInfo != null;
return ServerResponse.ok("道路新增成功","2079028191469929");
return ServerResponse.ok("道路新增成功", "2079028191469929");
} else {
return ServerResponse.error("道路新增失败");
}
@ -809,19 +824,19 @@ public class HighDangerController {
// 用户数据查询,如果没有该用户数据则新增
List<ThtSectionInfoDTO> sectionInfo = highDangerMapper.getSectionInfo(businessId);
// 用户数据查询是否为空
if(sectionInfo.isEmpty()) {
if (sectionInfo.isEmpty()) {
ManualInvestigation manualInvestigation = new ManualInvestigation();
manualInvestigation.setBusinessId(businessId);
highDangerMapper.insertSectionInfo(manualInvestigation);
List<ThtSectionInfoDTO> section = highDangerMapper.getSectionInfo(businessId);
thtSectionInfoDTO = section.get(0);
}else{
} else {
thtSectionInfoDTO = sectionInfo.get(0);
}
// 是否该排查有绑定的辖区街道信息,有则展示
List<StreetCommunity> communityByRoad = highDangerMapper.getCommunityByRoad(businessId);
if(communityByRoad == null || communityByRoad.isEmpty()){
if (communityByRoad == null || communityByRoad.isEmpty()) {
log.info("/getSectionInfo(获取基础数据(第一页))接口返回, 客户端ip: {}, 返回数据:{}", request.getRemoteAddr(), sectionInfo);
return ServerResponse.ok(thtSectionInfoDTO);
}
@ -956,16 +971,17 @@ public class HighDangerController {
@Transactional
@PostMapping("/saveManualInvestigation")
public ServerResponse<?> saveManualInvestigation(@RequestBody ManualInvestigation manualInvestigation, HttpServletRequest request) {
String ftpUrl = "ftp://"+userName+":"+passWord+"@"+ip+":"+port+CURRENT_DIR;
String ftpUrl = "ftp://" + userName + ":" + passWord + "@" + ip + ":" + port + CURRENT_DIR;
log.info("/saveManualInvestigation(保存 & 暂存人工排查)接口被调用,调用ip: {}, 入参:{}", request.getRemoteAddr(), manualInvestigation);
Date lastModDate = new Date();
manualInvestigation.setLastModeDate(lastModDate);
// 保存轄區和街道
highDangerMapper.updateSectionCommunity(manualInvestigation.getBusinessId(),manualInvestigation.getXqcode(),manualInvestigation.getJdcode());
highDangerMapper.updateSectionCommunity(manualInvestigation.getBusinessId(), manualInvestigation.getXqcode(), manualInvestigation.getJdcode());
// 第一页:基础数据
List<ThtSectionInfoDTO> sectionInfos = highDangerMapper.getSectionInfo(manualInvestigation.getBusinessId());
ThtSectionInfoDTO sectionInfo = sectionInfos.get(0);
ThtSectionInfoDTO sectionInfo = sectionInfos.get(0);
if (sectionInfo != null) {
// 更新基础数据(步骤1)
highDangerMapper.updateSectionInfo(manualInvestigation);
@ -1090,7 +1106,7 @@ public class HighDangerController {
if (CollectionUtils.isNotEmpty(manualInvestigation.getDescribe())) {
hdFlag = "1";
}
highDangerMapper.updateDangerRoad(hdFlag,manualInvestigation.getBusinessId(),pcCount);
highDangerMapper.updateDangerRoad(hdFlag, manualInvestigation.getBusinessId(), pcCount);
ThtApprove thtAApprove = new ThtApprove();
UUID uuid = UUID.randomUUID();
String uuidString = uuid.toString().replace("-", "");
@ -1124,14 +1140,13 @@ public class HighDangerController {
}
@GetMapping("/getRoadTypes")
public ServerResponse<?> getRoadType(){
public ServerResponse<?> getRoadType() {
List<EnumRoadType> roadTypes = highDangerService.getRoadTypes();
return ServerResponse.ok(roadTypes);
}
// 图片上传接口
/*@PostMapping("/uploadImage")
public ServerResponse<?> uploadImage(@RequestBody MultipartFile multipartFile) throws IOException {

@ -18,10 +18,10 @@ public interface HighDangerMapper{
// String getHighDangerStatusNum(@Param("postId") String postId);
// 主页获取各类型数据
List<HighDangerBaseNum> getStatusCounts(String cdepartmentid);
List<HighDangerBaseNum> getStatusCounts(@Param("cdepartmentid") String cdepartmentid, @Param("nuserid") String nuserid);
//
List<HighDangerBase> getHigDangerDealt(String status, String cdepartmentid, String search,String reportDept);
List<HighDangerBase> getHigDangerDealt(String status, String cdepartmentid, String search,String nuserId, String classification);
List<HighDangerBase> getHigDangerDying(String status, String cdepartmentid);

@ -335,7 +335,7 @@ public class HighDangerBaseServiceImpl implements HighDangerService {
highDangerBase.setReportDept("370200000000");
highDangerBase.setHandleDept("370200000000");
highDangerBase.setDelayCount("0");
highDangerBase.setDelayDay("0");
// highDangerBase.setDelayDay("0");
highDangerBase.setPcCount("0");
highDangerMapper.insertDanger(highDangerBase);

@ -21,7 +21,9 @@
handle_dept,
delay_count,
delay_day,
pc_count)
pc_count,
last_mod_date
)
values (#{nid},
#{businessId},
#{name},
@ -37,7 +39,9 @@
#{handleDept},
#{delayCount},
#{delayDay},
#{pcCount})
#{pcCount},
NOW()
)
</insert>
<insert id="insertDangerRoad">
@ -45,11 +49,15 @@
(nid,
business_id,
section_code,
pc_count)
pc_count,
last_mod_date
)
values (#{nid},
#{businessId},
#{sectionCode},
#{pcCount})
#{pcCount},
NOW()
)
</insert>
<select id="getStatusCounts" resultType="com.hisense.hiatmp.model.common.HighDangerBaseNum">
@ -59,7 +67,7 @@
ON hdb.business_id = hdr.business_id AND hdb.pc_count = hdr.pc_count
LEFT JOIN department dp ON hdb.handle_dept = dp.cdepartmentid
LEFT JOIN enum_type et ON et.ENUMTYPEID = '6601' AND et.enumvalue = hdb.status
WHERE hdb.handle_dept = #{cdepartmentid}
WHERE hdr.belong_xq like concat(concat(#{cdepartmentid},'%'))
UNION ALL
@ -69,7 +77,7 @@
ON hdb.business_id = hdr.business_id AND hdb.pc_count = hdr.pc_count
LEFT JOIN department dp ON hdb.handle_dept = dp.cdepartmentid
LEFT JOIN enum_type et ON et.ENUMTYPEID = '6601' AND et.enumvalue = hdb.status
WHERE hdb.handle_dept = #{cdepartmentid}
WHERE hdr.belong_xq like concat(concat(#{cdepartmentid},'%'))
UNION ALL
@ -79,7 +87,7 @@
ON hdb.business_id = hdr.business_id AND hdb.pc_count = hdr.pc_count
LEFT JOIN department dp ON hdb.handle_dept = dp.cdepartmentid
LEFT JOIN enum_type et ON et.ENUMTYPEID = '6601' AND et.enumvalue = hdb.status
WHERE hdb.handle_dept = #{cdepartmentid}
WHERE hdr.belong_xq like concat(concat(#{cdepartmentid},'%'))
UNION ALL
@ -89,17 +97,19 @@
ON hdb.business_id = hdr.business_id AND hdb.pc_count = hdr.pc_count
LEFT JOIN department dp ON hdb.handle_dept = dp.cdepartmentid
LEFT JOIN enum_type et ON et.ENUMTYPEID = '6601' AND et.enumvalue = hdb.status
WHERE hdb.handle_dept = #{cdepartmentid}
WHERE hdr.belong_xq like concat(concat(#{cdepartmentid},'%'))
UNION ALL
SELECT 'Finished' AS status, SUM(CASE WHEN hdb.status = '40' THEN 1 ELSE 0 END) AS count
SELECT 'Finished' AS status, SUM(CASE WHEN hdb.status = '20' THEN 1 ELSE 0 END) AS count
FROM tht_hidden_danger_base hdb
LEFT JOIN tht_hidden_danger_road hdr
ON hdb.business_id = hdr.business_id AND hdb.pc_count = hdr.pc_count
LEFT JOIN department dp ON hdb.handle_dept = dp.cdepartmentid
LEFT JOIN enum_type et ON et.ENUMTYPEID = '6601' AND et.enumvalue = hdb.status
WHERE hdb.handle_dept = #{cdepartmentid}
LEFT JOIN tht_timeline tt ON tt.business_id = hdb.business_id
WHERE hdr.belong_xq like concat(concat(#{cdepartmentid},'%'))
AND tt.operator = #{nuserid}
UNION ALL
@ -109,55 +119,51 @@
ON hdb.business_id = hdr.business_id AND hdb.pc_count = hdr.pc_count
LEFT JOIN department dp ON hdb.handle_dept = dp.cdepartmentid
LEFT JOIN enum_type et ON et.ENUMTYPEID = '6601' AND et.enumvalue = hdb.status
WHERE hdb.handle_dept = #{cdepartmentid}
WHERE hdr.belong_xq like concat(concat(#{cdepartmentid},'%'))
UNION ALL
SELECT DISTINCT 'MonthReport' AS status,
SUM(CASE
-- WHEN TO_TIMESTAMP(hdb.pc_end_time, 'DD/MM/YYYY HH24:MI:SS') &gt;
WHEN hdb.pc_end_time &gt;
DATE_TRUNC('MONTH', CURRENT_DATE) THEN 1
ELSE 0 END) AS count
SELECT DISTINCT 'MonthReport' AS status, count(*) AS count
FROM tht_hidden_danger_base hdb
LEFT JOIN tht_hidden_danger_road hdr
ON
hdb.business_id = hdr.business_id AND hdb.pc_count = hdr.pc_count
ON hdb.business_id = hdr.business_id AND hdb.pc_count = hdr.pc_count
LEFT JOIN department dp ON hdb.handle_dept = dp.cdepartmentid
LEFT JOIN enum_type et ON et.ENUMTYPEID = '6601' AND et.enumvalue = hdb.status
WHERE hdb.handle_dept = #{cdepartmentid}
-- LEFT JOIN enum_type et ON et.ENUMTYPEID = '6601' AND et.enumvalue = hdb.status
LEFT JOIN tht_timeline tt ON tt.business_id = hdb.business_id
WHERE hdr.belong_xq like concat(concat(#{cdepartmentid},'%'))
AND tt.operator = #{nuserid}
UNION ALL
SELECT DISTINCT 'Dying' AS status,
SUM(CASE
WHEN
hdb.pc_end_time &gt;
CURRENT_TIMESTAMP - INTERVAL '3 days'
and
hdb.pc_end_time &lt;
CURRENT_TIMESTAMP
THEN 1 ELSE 0 END) AS count
SELECT DISTINCT 'Dying' AS status, count(*) AS count
FROM tht_hidden_danger_base hdb
LEFT JOIN tht_param_config tpc ON tpc.param_code = 'THT_PC_ROAD_XT'
LEFT JOIN tht_hidden_danger_road hdr
ON
hdb.business_id = hdr.business_id AND hdb.pc_count = hdr.pc_count
LEFT JOIN department dp ON hdb.handle_dept = dp.cdepartmentid
LEFT JOIN enum_type et ON et.ENUMTYPEID = '6601' AND et.enumvalue = hdb.status
WHERE hdb.handle_dept = #{cdepartmentid} and hdb.status = '10'
WHERE hdr.belong_xq like concat(concat(#{cdepartmentid},'%'))
<![CDATA[
AND NOW() >= COALESCE(hdb.pc_end_time, hdb.pc_start_time + INTERVAL '1 day' * tpc.param_value::INTEGER) - INTERVAL '3 day'
AND NOW() <= COALESCE ( hdb.pc_end_time, hdb.pc_start_time + INTERVAL '1 day' * tpc.param_value :: INTEGER )
-- and hdb.status = '10'
]]>
UNION ALL
SELECT DISTINCT 'Delay' AS status,
SUM(CASE
WHEN
hdb.pc_end_time &gt;
CURRENT_TIMESTAMP
THEN 1
ELSE 0 END) AS count
SELECT DISTINCT 'Delay' AS status, count(*) AS count
FROM tht_hidden_danger_base hdb
LEFT JOIN tht_param_config tpc ON tpc.param_code = 'THT_PC_ROAD_XT'
LEFT JOIN tht_hidden_danger_road hdr
ON
hdb.business_id = hdr.business_id AND hdb.pc_count = hdr.pc_count
LEFT JOIN department dp ON hdb.handle_dept = dp.cdepartmentid
LEFT JOIN enum_type et ON et.ENUMTYPEID = '6601' AND et.enumvalue = hdb.status
WHERE hdb.handle_dept = #{cdepartmentid} and hdb.status = '10'
WHERE hdr.belong_xq like concat(concat(#{cdepartmentid},'%'))
<![CDATA[
AND NOW() >= COALESCE ( hdb.pc_end_time, hdb.pc_start_time + INTERVAL '1 day' * tpc.param_value :: INTEGER )
-- and hdb.status = '10'
]]>
</select>
@ -192,17 +198,22 @@
<select id="getHigDangerDealt" resultType="com.hisense.hiatmp.model.common.HighDangerBase">
<![CDATA[
SELECT CASE
WHEN now() < t1.nearEndTime THEN 9 --
WHEN now() >= t1.nearEndTime AND now() <= t1.planEndTime THEN 2 --临期
WHEN now() >= t1.planEndTime THEN 1 --超期
WHEN now() AT TIME ZONE 'Asia/Shanghai' < t1.nearEndTime THEN 9 --
WHEN now() AT TIME ZONE 'Asia/Shanghai' >= t1.nearEndTime AND now() AT TIME ZONE 'Asia/Shanghai' <= t1.planEndTime THEN 2 --临期
WHEN now() AT TIME ZONE 'Asia/Shanghai' >= t1.planEndTime THEN 1 --超期
END AS time_status
, t1.*
, EXTRACT(EPOCH FROM NOW() - t1.planEndTime) AS timeDiffEnd
, EXTRACT(EPOCH FROM NOW() - t1.nearEndTime) AS timeDiffStart
-- , EXTRACT(EPOCH FROM NOW() - t1.planEndTime) AS timeDiffEnd
-- , EXTRACT(EPOCH FROM t1.planEndTime - NOW() ) AS timeDiffStart
, floor(EXTRACT(EPOCH FROM(now() AT TIME ZONE 'Asia/Shanghai' - planEndTime))/(1440*60)) delayDay
, ceil(mod(ceil(EXTRACT(EPOCH FROM(now() AT TIME ZONE 'Asia/Shanghai' -planEndTime)))::INTEGER , 1440*60)::FLOAT/3600) delayHour
, floor(EXTRACT(EPOCH FROM(planEndTime -now() AT TIME ZONE 'Asia/Shanghai'))/(1440*60)) nearDay
, ceil(mod(ceil(EXTRACT(EPOCH FROM(planEndTime -now() AT TIME ZONE 'Asia/Shanghai')))::INTEGER , 1440*60)::FLOAT/3600) nearHour
-- , now() - t1.planEndTime as timeDiffEnd
-- , now() - t1.nearEndTime as timeDiffStart
]]>
FROM (SELECT hdb.name
FROM (SELECT hdb.nid
, hdb.name
, hdb.pc_start_time
, hdb.pc_end_time
, hdb.business_id
@ -213,6 +224,9 @@
, hdb."status"
, hdr.belong_xq
, hdr.xzjd
, et.enumname
, hdb.approve_status
, hdr.section_code
, COALESCE(hdb.pc_end_time, hdb.pc_start_time + INTERVAL '1 day' * tpc.param_value
::INTEGER) AS planEndTime
, COALESCE(hdb.pc_end_time, hdb.pc_start_time + INTERVAL '1 day' * tpc.param_value
@ -229,11 +243,26 @@
AND et.enumvalue = hdb.status
LEFT JOIN bis_section bs ON hdr.section_code = bs.section_code
LEFT JOIN tht_param_config tpc ON tpc.param_code = 'THT_PC_ROAD_XT'
WHERE hdb.handle_dept = #{cdepartmentid}
<if test="classification != ''">
LEFT JOIN tht_timeline tt ON tt.business_id = hdb.business_id
</if>
WHERE hdr.belong_xq like concat(concat(#{cdepartmentid},'%'))
AND hdb.status = #{status}
<if test="reportDept != ''">
AND hdb.handle_dept != hdb.report_dept
-- AND nvl(hdb.Approve_Status,'0') in ('0','-1')
<if test="search != null and search != ''">
AND hdb.name like concat(concat('%',#{search}),'%')
</if>
<if test="classification == 1">
AND tt.operator = #{nuserId}
</if>
<if test="classification == 2">
AND tt.title = '隐患上报'
AND tt.operator = #{nuserId}
</if>
<if test="classification == 3">
AND tt.title != '隐患上报'
AND tt.operator = #{nuserId}
</if>
) t1
ORDER BY time_status, planEndTime DESC
</select>
@ -315,7 +344,6 @@
<select id="getRoadInfo" resultType="com.hisense.hiatmp.model.common.HighDangerRoad">
SELECT DISTINCT thdb.*, thdr.address, thdr.section_code, thdr.if_cross, thdr.coordinate
from tht_hidden_danger_base thdb
left join tht_hidden_danger_road thdr on thdr.business_id = thdb.business_id
@ -329,8 +357,8 @@
</select>
<insert id="insertRoad">
insert into tht_hidden_danger_road (nid, business_id)
values (#{uuid}, #{businessId})
insert into tht_hidden_danger_road (nid, business_id,last_mod_date)
values (#{uuid}, #{businessId},NOW())
</insert>
<select id="getImportDanger" resultType="com.hisense.hiatmp.model.common.ImportDangerDTO">
@ -350,20 +378,23 @@
<update id="saveSection">
update tht_hidden_danger_road thdr
set address = #{address},
coordinate = #{coordinate}
coordinate = #{coordinate},
last_mod_date = NOW()
where business_id = #{businessId}
</update>
<update id="bindRoad">
update tht_hidden_danger_road
set section_code = #{sectionCode}
set section_code = #{sectionCode},
last_mod_date = NOW()
where business_id = #{businessId};
</update>
<update id="saveCrossing">
update tht_hidden_danger_road thdr
set address = #{address},
coordinate = #{coordinate}
coordinate = #{coordinate},
last_mod_date = NOW()
where business_id = #{businessId}
</update>
@ -383,7 +414,7 @@
<select id="setApproval" resultType="String">
UPDATE tht_hidden_danger_base
SET APPROVE_STATUS = 2
SET APPROVE_STATUS = 2,last_mod_date = NOW()
where business_id = #{businessId} RETURNING business_id;
</select>
@ -459,7 +490,8 @@
#{largeVehicleRate},
#{nonvehicleTraffic},
#{lastModeUser},
#{lastModeDate})
#{lastModeDate}
)
</insert>
<update id="updateSectionTraffic">
@ -472,20 +504,20 @@
"LARGE_VEHICLE_RATE" = #{largeVehicleRate},
"NONVEHICLE_TRAFFIC" = #{nonvehicleTraffic},
"LAST_MOD_USER" = #{lastModeUser},
"LAST_MOD_DATE" = #{lastModeDate}
"LAST_MOD_DATE" = NOW()
where "BUSINESS_ID" = #{businessId}
</update>
<update id="updateTemporary">
update tht_hidden_danger_base
set status = #{temporary}
set status = #{temporary},last_mod_date = NOW()
where business_id = #{businessId}
</update>
<update id="updateDangerRoad">
update tht_hidden_danger_road
set hd_flag = #{hdFlag}
, pc_end_time = CURRENT_TIMESTAMP
, pc_end_time = CURRENT_TIMESTAMP,last_mod_date = NOW()
where business_id = #{businessId}
and pc_count = #{pcCount}
</update>
@ -497,15 +529,15 @@
<insert id="saveDangerExtra">
INSERT INTO tht_hidden_danger_road_info (nid, business_id, big_category, small_category, hd_term, hd_desc,
pc_count, hd_pic, hd_info, pc_type)
pc_count, hd_pic, hd_info, pc_type, last_mod_date)
VALUES (#{nid}, #{businessId}, #{bigCategory}, #{smallCategory}, #{hdTerm},
#{hdDesc}, #{pcCount}, #{hdPic}, #{hdInfo}, #{pcType})
#{hdDesc}, #{pcCount}, #{hdPic}, #{hdInfo}, #{pcType},NOW())
</insert>
<insert id="saveRoad">
insert into bis_road ("road_code", "road_name", "position")
values (#{roadCode}, #{roadName}, #{position})
insert into bis_road ("road_code", "road_name", "position","last_mod_date")
values (#{roadCode}, #{roadName}, #{position},NOW())
</insert>
<delete id="deleteRoadInfo">
@ -573,14 +605,15 @@
<update id="HighDangerSaveStatus">
update tht_hidden_danger_road
set pc_type = #{pcType}
set pc_type = #{pcType},last_mod_date = NOW()
where business_id = #{businessId}
</update>
<update id="updateSectionCommunity">
update tht_hidden_danger_road
set belong_xq = #{xqcode},
xzjd = #{jdcode}
xzjd = #{jdcode},
last_mod_date = NOW()
where business_id = #{businessId}
</update>

@ -10,9 +10,10 @@
</select>
<select id="getOperatorById" resultType="com.hisense.hiatmp.model.common.Operator">
select *
from operator
where nuserid = #{nuserid}
select o.*,d.cdepartmentname
from operator o
LEFT JOIN department d on o.cdepartmentid = d.cdepartmentid
where o.nuserid = #{nuserid}
</select>
<select id="getAllOperator" resultType="com.hisense.hiatmp.model.common.Operator">
@ -22,7 +23,7 @@
<select id="updateByPrimaryKeySelective" resultType="String">
update operator
set cuserpwd = #{cuserpwd}
set cuserpwd = #{cuserpwd},last_mod_date = NOW()
where nuserid = #{nuserid} RETURNING nuserid;
</select>

@ -125,11 +125,6 @@ public class HighDangerBase implements Serializable {
*/
private String delayCount;
/**
* delay_day
*/
private String delayDay;
/**
* pc_count
*/
@ -202,8 +197,14 @@ public class HighDangerBase implements Serializable {
private String timeStatus;
private String timeDiffEnd;
private int delayDay;
private int delayHour;
private int nearDay;
private int nearHour;
private String timeDiffStart;
private String enumname;
}

@ -25,6 +25,8 @@ public class Operator implements Serializable {
// 部门
private String cdepartmentid;
// 警号
String policeid;
private String policeid;
private String cdepartmentname;
}

Loading…
Cancel
Save