Commit 88bdbf51 authored by chenhao's avatar chenhao

Merge branch 'developer' of http://172.16.10.76/moa/amos-boot-biz into developer

parents 5d2c1d2e 8baec012
...@@ -43,15 +43,18 @@ public class RoutePointRespone { ...@@ -43,15 +43,18 @@ public class RoutePointRespone {
private String equipmentName; private String equipmentName;
public String getAddress() { /**
return address; * 具体位置:buildName + address
} */
private String position;
public void setAddress(String address) { public String getPosition() {
this.address = address; return position;
} }
private String address; public void setPosition(String position) {
this.position = position;
}
private int orderNo; private int orderNo;
......
...@@ -23,11 +23,23 @@ public interface AlertCalledMapper extends BaseMapper<AlertCalled> { ...@@ -23,11 +23,23 @@ public interface AlertCalledMapper extends BaseMapper<AlertCalled> {
* @param endDate * @param endDate
* @return * @return
*/ */
List<Map<String, Integer>> queryNearlyCount(@Param("beginDate") String beginDate,
@Param("endDate") String endDate,
@Param("orgCode") String orgCode,
@Param("recUserId") String recUserId
);
/**
* 接警情况统计
*
* @param beginDate
* @param endDate
* @return
*/
Map<String, Integer> queryAlertStatusCount(@Param("beginDate") String beginDate, Map<String, Integer> queryAlertStatusCount(@Param("beginDate") String beginDate,
@Param("endDate") String endDate, @Param("endDate") String endDate,
@Param("orgCode") String orgCode, @Param("orgCode") String orgCode,
@Param("recUserId") String recUserId @Param("recUserId") String recUserId
); );
/** /**
* 根据查询条件返回警情记录 * 根据查询条件返回警情记录
......
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
SELECT SELECT
count( 1 ) calledCount, count( 1 ) calledCount,
sum( CASE WHEN father_alert is null THEN 1 ELSE 0 END ) majorAlertCount, sum( CASE WHEN father_alert is null THEN 1 ELSE 0 END ) majorAlertCount,
sum( CASE WHEN alarm_type_code = 'KRJY' THEN 1 ELSE 0 END ) sleepyIncidentCount, sum( CASE WHEN alarm_type_code = '960' THEN 1 ELSE 0 END ) sleepyIncidentCount,
sum( CASE WHEN alarm_type_code = 'GZWX' THEN 1 ELSE 0 END ) faultRescueCount, sum( CASE WHEN alarm_type_code = '961' THEN 1 ELSE 0 END ) faultRescueCount,
sum( CASE WHEN alarm_type_code = 'TSZX' THEN 1 ELSE 0 END ) suggestionsCount sum( CASE WHEN alarm_type_code = '962' THEN 1 ELSE 0 END ) suggestionsCount
FROM FROM
tz_alert_called tz_alert_called
WHERE 1 = 1 WHERE 1 = 1
...@@ -24,6 +24,127 @@ ...@@ -24,6 +24,127 @@
</if> </if>
</select> </select>
<select id="queryNearlyCount" resultType="java.util.Map">
SELECT
DATE_ADD(#{beginDate},INTERVAL -1 DAY) dateTime,
sum( CASE WHEN father_alert is null THEN 1 ELSE 0 END ) majorAlertCount
FROM
tz_alert_called
WHERE 1 = 1
<if test="beginDate != null and beginDate != ''">
and call_time >= DATE_ADD(#{beginDate},INTERVAL -1 DAY)
</if>
<if test="endDate != null and endDate != ''">
and call_time <![CDATA[ <= ]]> DATE_ADD(#{endDate},INTERVAL -1 DAY)
</if>
<if test="orgCode != null and orgCode != '' and recUserId != null and recUserId != ''" >
and org_code= #{orgCode}
or rec_user_id = #{recUserId}
</if>
UNION ALL
SELECT
DATE_ADD(#{beginDate},INTERVAL -2 DAY) dateTime,
sum( CASE WHEN father_alert is null THEN 1 ELSE 0 END ) majorAlertCount
FROM
tz_alert_called
WHERE 1 = 1
<if test="beginDate != null and beginDate != ''">
and call_time >= DATE_ADD(#{beginDate},INTERVAL -2 DAY)
</if>
<if test="endDate != null and endDate != ''">
and call_time <![CDATA[ <= ]]> DATE_ADD(#{endDate},INTERVAL -2 DAY)
</if>
<if test="orgCode != null and orgCode != '' and recUserId != null and recUserId != ''" >
and org_code= #{orgCode}
or rec_user_id = #{recUserId}
</if>
UNION ALL
SELECT
DATE_ADD(#{beginDate},INTERVAL -3 DAY) dateTime,
sum( CASE WHEN father_alert is null THEN 1 ELSE 0 END ) majorAlertCount
FROM
tz_alert_called
WHERE 1 = 1
<if test="beginDate != null and beginDate != ''">
and call_time >= DATE_ADD(#{beginDate},INTERVAL -3 DAY)
</if>
<if test="endDate != null and endDate != ''">
and call_time <![CDATA[ <= ]]> DATE_ADD(#{endDate},INTERVAL -3 DAY)
</if>
<if test="orgCode != null and orgCode != '' and recUserId != null and recUserId != ''" >
and org_code= #{orgCode}
or rec_user_id = #{recUserId}
</if>
UNION ALL
SELECT
DATE_ADD(#{beginDate},INTERVAL -4 DAY) dateTime,
sum( CASE WHEN father_alert is null THEN 1 ELSE 0 END ) majorAlertCount
FROM
tz_alert_called
WHERE 1 = 1
<if test="beginDate != null and beginDate != ''">
and call_time >= DATE_ADD(#{beginDate},INTERVAL -4 DAY)
</if>
<if test="endDate != null and endDate != ''">
and call_time <![CDATA[ <= ]]> DATE_ADD(#{endDate},INTERVAL -4 DAY)
</if>
<if test="orgCode != null and orgCode != '' and recUserId != null and recUserId != ''" >
and org_code= #{orgCode}
or rec_user_id = #{recUserId}
</if>
UNION ALL
SELECT
DATE_ADD(#{beginDate},INTERVAL -5 DAY) dateTime,
sum( CASE WHEN father_alert is null THEN 1 ELSE 0 END ) majorAlertCount
FROM
tz_alert_called
WHERE 1 = 1
<if test="beginDate != null and beginDate != ''">
and call_time >= DATE_ADD(#{beginDate},INTERVAL -5 DAY)
</if>
<if test="endDate != null and endDate != ''">
and call_time <![CDATA[ <= ]]> DATE_ADD(#{endDate},INTERVAL -5 DAY)
</if>
<if test="orgCode != null and orgCode != '' and recUserId != null and recUserId != ''" >
and org_code= #{orgCode}
or rec_user_id = #{recUserId}
</if>
UNION ALL
SELECT
DATE_ADD(#{beginDate},INTERVAL -6 DAY) dateTime,
sum( CASE WHEN father_alert is null THEN 1 ELSE 0 END ) majorAlertCount
FROM
tz_alert_called
WHERE 1 = 1
<if test="beginDate != null and beginDate != ''">
and call_time >= DATE_ADD(#{beginDate},INTERVAL -6 DAY)
</if>
<if test="endDate != null and endDate != ''">
and call_time <![CDATA[ <= ]]> DATE_ADD(#{endDate},INTERVAL -6 DAY)
</if>
<if test="orgCode != null and orgCode != '' and recUserId != null and recUserId != ''" >
and org_code= #{orgCode}
or rec_user_id = #{recUserId}
</if>
UNION ALL
SELECT
DATE_ADD(#{beginDate},INTERVAL -7 DAY) dateTime,
sum( CASE WHEN father_alert is null THEN 1 ELSE 0 END ) majorAlertCount
FROM
tz_alert_called
WHERE 1 = 1
<if test="beginDate != null and beginDate != ''">
and call_time >= DATE_ADD(#{beginDate},INTERVAL -7 DAY)
</if>
<if test="endDate != null and endDate != ''">
and call_time <![CDATA[ <= ]]> DATE_ADD(#{endDate},INTERVAL -7 DAY)
</if>
<if test="orgCode != null and orgCode != '' and recUserId != null and recUserId != ''" >
and org_code= #{orgCode}
or rec_user_id = #{recUserId}
</if>
</select>
<select id="queryAlertListByQueryDto" resultType="com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto"> <select id="queryAlertListByQueryDto" resultType="com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto">
SELECT SELECT
a.work_order_number AS workOrderNumber, a.work_order_number AS workOrderNumber,
......
package com.yeejoin.amos.maintenance.business.controller; package com.yeejoin.amos.maintenance.business.controller;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.http.MediaType;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.maintenance.business.dto.PointDto; import com.yeejoin.amos.maintenance.business.dto.PointDto;
import com.yeejoin.amos.maintenance.business.param.MovePointParam;
import com.yeejoin.amos.maintenance.business.param.PointImportParam; import com.yeejoin.amos.maintenance.business.param.PointImportParam;
import com.yeejoin.amos.maintenance.business.param.PointImportQueryParam; import com.yeejoin.amos.maintenance.business.param.PointImportQueryParam;
import com.yeejoin.amos.maintenance.business.param.PointParam; import com.yeejoin.amos.maintenance.business.param.PointParam;
import com.yeejoin.amos.maintenance.business.service.intfc.ICatalogTreeService; import com.yeejoin.amos.maintenance.business.service.intfc.ICatalogTreeService;
import com.yeejoin.amos.maintenance.business.service.intfc.IPointService; import com.yeejoin.amos.maintenance.business.service.intfc.IPointService;
import com.yeejoin.amos.maintenance.business.util.CommonResponse; import com.yeejoin.amos.maintenance.business.util.*;
import com.yeejoin.amos.maintenance.business.util.CommonResponseUtil;
import com.yeejoin.amos.maintenance.business.util.DaoCriteria;
import com.yeejoin.amos.maintenance.business.util.FileHelper;
import com.yeejoin.amos.maintenance.business.util.PointParamUtils;
import com.yeejoin.amos.maintenance.business.vo.MaintenanceResourceData; import com.yeejoin.amos.maintenance.business.vo.MaintenanceResourceData;
import com.yeejoin.amos.maintenance.business.vo.PointClassifyVo; import com.yeejoin.amos.maintenance.business.vo.PointClassifyVo;
import com.yeejoin.amos.maintenance.business.vo.PointInputItemVo; import com.yeejoin.amos.maintenance.business.vo.PointInputItemVo;
import com.yeejoin.amos.maintenance.business.vo.PointVo; import com.yeejoin.amos.maintenance.business.vo.PointVo;
import com.yeejoin.amos.maintenance.core.common.request.CommonPageable; import com.yeejoin.amos.maintenance.core.common.request.CommonPageable;
import com.yeejoin.amos.maintenance.core.common.request.CommonRequest; import com.yeejoin.amos.maintenance.core.common.request.CommonRequest;
import com.yeejoin.amos.maintenance.core.common.response.PointResponse;
import com.yeejoin.amos.maintenance.dao.entity.Point; import com.yeejoin.amos.maintenance.dao.entity.Point;
import com.yeejoin.amos.maintenance.dao.entity.PointClassify; import com.yeejoin.amos.maintenance.dao.entity.PointClassify;
import com.yeejoin.amos.maintenance.feign.RemoteSecurityService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
@RestController @RestController
@RequestMapping(value = "/api/point") @RequestMapping(value = "/api/point")
...@@ -73,9 +46,6 @@ public class PointController extends AbstractBaseController { ...@@ -73,9 +46,6 @@ public class PointController extends AbstractBaseController {
@Autowired @Autowired
private ICatalogTreeService catalogTreeService; private ICatalogTreeService catalogTreeService;
@Autowired
private RemoteSecurityService remoteSecurityService;
/** /**
* 增加巡检点 * 增加巡检点
* *
...@@ -86,45 +56,14 @@ public class PointController extends AbstractBaseController { ...@@ -86,45 +56,14 @@ public class PointController extends AbstractBaseController {
@ApiOperation(value = "新增巡检点", notes = "新增巡检点") @ApiOperation(value = "新增巡检点", notes = "新增巡检点")
@PostMapping(value = "/addPoint", produces = "application/json;charset=UTF-8") @PostMapping(value = "/addPoint", produces = "application/json;charset=UTF-8")
public CommonResponse addPoint(@ApiParam(value = "巡检点", required = true) @RequestBody PointParam pointParam) { public CommonResponse addPoint(@ApiParam(value = "巡检点", required = true) @RequestBody PointParam pointParam) {
AgencyUserModel user = getUserInfo(); ReginParams reginParams = getSelectedOrgInfo();
if (ObjectUtils.isEmpty(user)) { String loginOrgCode = getOrgCode(reginParams);
return CommonResponseUtil.failure("用户session过期"); //点归属于公司
} pointParam.getPoint().setOrgCode(loginOrgCode);
try { pointParam.getPoint().setCreatorId(getUserId());
ReginParams reginParams = getSelectedOrgInfo(); Point point = iPointService.addPoint(pointParam);
String loginOrgCode = getOrgCode(reginParams); return CommonResponseUtil.success(point);
//点归属于公司
pointParam.getPoint().setOrgCode(loginOrgCode);
pointParam.getPoint().setCreatorId(user.getUserId());
Point point = iPointService.addPoint(pointParam);
return CommonResponseUtil.success(point);
} catch (Exception e) {
e.printStackTrace();
log.error(e.getMessage(), e);
return CommonResponseUtil.failure("巡检点新增失败");
}
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "新增移动巡检点(<font color='blue'>手机app</font>)", notes = "新增移动巡检点(<font color='blue'>手机app</font>)")
@PostMapping(value = "/addMovePoint", produces = "application/json;charset=UTF-8")
public CommonResponse addMovePoint(@RequestBody MovePointParam param) {
AgencyUserModel user = getUserInfo();
if (ObjectUtils.isEmpty(user)) {
return CommonResponseUtil.failure("用户session过期");
}
try {
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
//点归属于公司
param.setOrgCode(loginOrgCode);
param.setCreatorId(user.getUserId());
iPointService.addMovePoint(param);
return CommonResponseUtil.success();
} catch (Exception e) {
log.error(e.getMessage(), e);
return CommonResponseUtil.failure("巡检点新增失败");
}
} }
/** /**
...@@ -593,83 +532,6 @@ public class PointController extends AbstractBaseController { ...@@ -593,83 +532,6 @@ public class PointController extends AbstractBaseController {
} }
/** /**
* 设置巡检点巡检模式
*
* @param pointId
* @param isOffine
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "设置巡检点巡检模式", notes = "设置巡检点巡检模式")
@PostMapping(value = "/setPatrolMode", produces = "application/json;charset=UTF-8")
public CommonResponse setPatrolMode(@ApiParam(value = "巡检点id", required = true) @RequestParam Long pointId,
@ApiParam(value = "是否开启离线模式", required = true) @RequestParam Boolean isOffine) {
try {
Point point = iPointService.setPatrolMode(pointId, isOffine);
if (ObjectUtils.isEmpty(point)) {
return CommonResponseUtil.failure("该巡检点不存在");
}
return CommonResponseUtil.success(point);
} catch (Exception e) {
log.error(e.getMessage(), e);
return CommonResponseUtil.failure("绑卡失败");
}
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "查询用户权限点信息饼图(<font color='blue'>手机app</font>)", notes = "查询用户权限点信息饼图(<font color='blue'>手机app</font>)")
@GetMapping(value = "/queryPointPie", produces = "application/json;charset=UTF-8")
public CommonResponse queryPointPie() {
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
HashMap<String, Object> params = new HashMap<String, Object>();
params.put("orgCode", loginOrgCode);
HashMap<String, Object> response = iPointService.queryPointPie(params);
return CommonResponseUtil.success(response);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "查询用户权限点信息柱状图(<font color='blue'>手机app</font>)", notes = "查查询用户权限点信息柱状图(<font color='blue'>手机app</font>)")
@GetMapping(value = "/queryPointHistogram", produces = "application/json;charset=UTF-8")
public CommonResponse queryPointHistogram() {
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
HashMap<String, Object> params = new HashMap<String, Object>();
params.put("orgCode", loginOrgCode);
List<HashMap<String, Object>> response = iPointService.queryPointHistogram(params);
//安全处里
if (response != null && response.size() > 0) {
//获取部门名称
String userIds = "";
Set<String> set = new HashSet<>();
response.forEach(s -> {
if (!"其他".equals(s.get("departmentName") + "")) {
set.add(s.get("departmentName").toString());
}
});
List<String> list1 = new ArrayList<>(set);
userIds = String.join(",", list1);
List<LinkedHashMap> listd = remoteSecurityService.listDepartmentByDeptIds(getToken(), getProduct(), getAppKey(), userIds);
Map<String, String> deptMap = new HashMap<String, String>();
if (listd != null && listd.size() > 0) {
for (int i = 0; i < listd.size(); i++) {
deptMap.put(listd.get(i).get("sequenceNbr").toString(), listd.get(i).get("departmentName").toString());
}
}
//新安全
response.forEach(s -> {
if (!"其他".equals(s.get("departmentName") + "")) {
s.put("departmentName", deptMap.get(s.get("departmentName") + ""));
}
});
}
return CommonResponseUtil.success(response);
}
/**
* 查询巡检点信息 * 查询巡检点信息
* *
* @param point * @param point
...@@ -703,55 +565,6 @@ public class PointController extends AbstractBaseController { ...@@ -703,55 +565,6 @@ public class PointController extends AbstractBaseController {
} }
} }
/**
* 离线点信息同步
*
* @param startTime
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "查询离线点信息", notes = "查询离线点信息")
@GetMapping(value = "/queryLeavelPoint", produces = "application/json;charset=UTF-8")
public CommonResponse queryLeavelPoint(@ApiParam(value = "数据同步开始时间(不传为全部同步)", required = false) @RequestParam(required = false) String startTime) {
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
if (ObjectUtils.isEmpty(reginParams)) {
return CommonResponseUtil.failure("用户session过期");
}
return CommonResponseUtil.success(iPointService.queryLeavelPoint(getToken(), getProduct(), getAppKey(), loginOrgCode, startTime));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "查询点信息json", notes = "查询点信息json")
@GetMapping(value = "/getPointConfigJson", produces = "application/json;charset=UTF-8")
public CommonResponse getPointConfigJson() {
return CommonResponseUtil.success(iPointService.getPointConfigDom());
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "查询点信息xml", notes = "查询点信息xml")
@GetMapping(value = "/getPointConfigDom", produces = MediaType.APPLICATION_XML_VALUE)
public List<PointResponse> getPointConfigDom() {
return iPointService.getPointConfigDom();
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "导出IEC104点位表", notes = "导出IEC104点位表")
@PostMapping(value = "/exportPoint/iec", produces = "application/json;charset=UTF-8")
public CommonResponse exportIecPoint(HttpServletResponse response) {
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
String fileName = "巡检点点位"; //模板名称
List<Map<String, Object>> list = iPointService.queryAllPointConfig(loginOrgCode);
try {
FileHelper.exportExcel(list, fileName, response);
} catch (Exception e) {
CommonResponseUtil.failure(e.getMessage());
}
return CommonResponseUtil.success();
}
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "新*巡检点筛选分页列表", notes = "新*巡检点筛选分页列表") @ApiOperation(value = "新*巡检点筛选分页列表", notes = "新*巡检点筛选分页列表")
......
...@@ -26,9 +26,9 @@ public class PointDto { ...@@ -26,9 +26,9 @@ public class PointDto {
private String equipmentName; private String equipmentName;
/** /**
* 位置 * 具体位置:buildName + address
*/ */
private String address; private String position;
/** /**
......
...@@ -353,6 +353,9 @@ public class PointServiceImpl implements IPointService { ...@@ -353,6 +353,9 @@ public class PointServiceImpl implements IPointService {
PointVo pointVo = new PointVo(); PointVo pointVo = new PointVo();
BeanUtils.copyProperties(point, pointVo); BeanUtils.copyProperties(point, pointVo);
pointVo.setInputItemNum(pointInputItems.stream().filter(i -> i.getPointId() == point.getId()).count()); pointVo.setInputItemNum(pointInputItems.stream().filter(i -> i.getPointId() == point.getId()).count());
String buildingName = StringUtil.isNotEmpty(point.getBuildingName()) ? point.getBuildingName() : "";
String address = StringUtil.isNotEmpty(point.getAddress()) ? point.getAddress() : "";
pointVo.setPosition(buildingName + address);
pointVoList.add(pointVo); pointVoList.add(pointVo);
} }
Pageable pageable = new CommonPageable(pointPage.getNumber(), pointPage.getSize(), pointPage.getSort()); Pageable pageable = new CommonPageable(pointPage.getNumber(), pointPage.getSize(), pointPage.getSort());
...@@ -1157,6 +1160,9 @@ public class PointServiceImpl implements IPointService { ...@@ -1157,6 +1160,9 @@ public class PointServiceImpl implements IPointService {
PointDto pointDto = new PointDto(); PointDto pointDto = new PointDto();
BeanUtils.copyProperties(point, pointDto); BeanUtils.copyProperties(point, pointDto);
pointDto.setPointInputItems(pointInputItems.stream().filter(i -> i.getPointId() == point.getId()).collect(Collectors.toList())); pointDto.setPointInputItems(pointInputItems.stream().filter(i -> i.getPointId() == point.getId()).collect(Collectors.toList()));
String buildingName = StringUtil.isNotEmpty(point.getBuildingName()) ? point.getBuildingName() : "";
String address = StringUtil.isNotEmpty(point.getAddress()) ? point.getAddress() : "";
pointDto.setPosition(buildingName + address);
pointDtos.add(pointDto); pointDtos.add(pointDto);
} }
Pageable pageable = new CommonPageable(pointPage.getNumber(), pointPage.getSize(), pointPage.getSort()); Pageable pageable = new CommonPageable(pointPage.getNumber(), pointPage.getSize(), pointPage.getSort());
......
...@@ -22,7 +22,17 @@ public class PointVo { ...@@ -22,7 +22,17 @@ public class PointVo {
private Date createDate; private Date createDate;
public Date getCreateDate() { private String originalId;
public String getOriginalId() {
return originalId;
}
public void setOriginalId(String originalId) {
this.originalId = originalId;
}
public Date getCreateDate() {
return createDate; return createDate;
} }
...@@ -48,10 +58,36 @@ public class PointVo { ...@@ -48,10 +58,36 @@ public class PointVo {
private String equipmentName; private String equipmentName;
/** /**
* 建筑名称
*/
private String buildingName;
public String getBuildingName() {
return buildingName;
}
public void setBuildingName(String buildingName) {
this.buildingName = buildingName;
}
public String getPosition() {
return position;
}
public void setPosition(String position) {
this.position = position;
}
/**
* 位置 * 位置
*/ */
private String address; private String address;
/**
* 具体位置:buildName + address
*/
private String position;
public String getAddress() { public String getAddress() {
return address; return address;
} }
......
package com.yeejoin.amos.boot.module.tzs.biz.controller; package com.yeejoin.amos.boot.module.tzs.biz.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.SystemClock; import com.baomidou.mybatisplus.core.toolkit.SystemClock;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Maps;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
...@@ -20,12 +20,16 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto; ...@@ -20,12 +20,16 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ESAlertCalledDto; import com.yeejoin.amos.boot.module.tzs.api.dto.ESAlertCalledDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ESAlertCalledRequestDto; import com.yeejoin.amos.boot.module.tzs.api.dto.ESAlertCalledRequestDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled; import com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.tzs.api.entity.DispatchPaper;
import com.yeejoin.amos.boot.module.tzs.api.enums.DispatchPaperEnums;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.AlertCalledServiceImpl; import com.yeejoin.amos.boot.module.tzs.biz.service.impl.AlertCalledServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.AlertFormValueServiceImpl; import com.yeejoin.amos.boot.module.tzs.biz.service.impl.AlertFormValueServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.DispatchPaperServiceImpl; import com.yeejoin.amos.boot.module.tzs.biz.service.impl.DispatchPaperServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.ESAlertCalledService; import com.yeejoin.amos.boot.module.tzs.biz.service.impl.ESAlertCalledService;
import com.yeejoin.amos.boot.module.tzs.biz.utils.AlertBeanDtoVoUtils; import com.yeejoin.amos.boot.module.tzs.biz.utils.AlertBeanDtoVoUtils;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils; import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
...@@ -50,6 +54,8 @@ import java.lang.reflect.Field; ...@@ -50,6 +54,8 @@ import java.lang.reflect.Field;
import java.text.ParseException; import java.text.ParseException;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Stream; import java.util.stream.Stream;
...@@ -147,7 +153,7 @@ public class AlertCalledController extends BaseController { ...@@ -147,7 +153,7 @@ public class AlertCalledController extends BaseController {
alertCallInfoDto.setCallTime(DateUtils.stampToDate(System.currentTimeMillis(),"yyyy-MM-dd HH:mm:ss ")); alertCallInfoDto.setCallTime(DateUtils.stampToDate(System.currentTimeMillis(),"yyyy-MM-dd HH:mm:ss "));
alertCallInfoDto.setWorkOrderNumber(workOrderNumber); alertCallInfoDto.setWorkOrderNumber(workOrderNumber);
alertCallInfoDto.setRecUserId(getUserInfo().getUserId()); alertCallInfoDto.setRecUserId(getUserInfo().getUserId());
alertCallInfoDto.setRecUserName(getUserInfo().getUserName()); alertCallInfoDto.setRecUserName(getUserInfo().getRealName());
return ResponseHelper.buildResponse(alertCallInfoDto); return ResponseHelper.buildResponse(alertCallInfoDto);
} }
...@@ -162,12 +168,13 @@ public class AlertCalledController extends BaseController { ...@@ -162,12 +168,13 @@ public class AlertCalledController extends BaseController {
String number = DateUtils.stampToDate(SystemClock.now(),"yyyy-MM-dd HH:mm:ss SSS"); String number = DateUtils.stampToDate(SystemClock.now(),"yyyy-MM-dd HH:mm:ss SSS");
String newNumber = number.replace("-","").replace(" ","").replace(":",""); String newNumber = number.replace("-","").replace(" ","").replace(":","");
ReginParams reginParams =getSelectedOrgInfo(); ReginParams reginParams =getSelectedOrgInfo();
// Map<String, Object> map = iAlertCalledService.getAlertInfoList(DateUtils.dateFormat(new Date(),"")+" 00:00:00", AgencyUserModel user = reginParams.getUserModel();
// DateUtils.dateFormat(new Date(),"")+" 23:59:59",reginParams.getCompany().getOrgCode(), String orgCode = ValidationUtil.isEmpty(user.getCompanys()) ? null : user.getCompanys().get(0).getOrgCode();
// reginParams.getUserModel().getUserId());
Map<String, Object> map = iAlertCalledService.getAlertInfoList(DateUtils.stampToDate(System.currentTimeMillis(),"yyyy-MM-dd")+" 00:00:00", Map<String, Object> map = iAlertCalledService.getAlertInfoList(DateUtils.stampToDate(System.currentTimeMillis(),DateUtils.DATE_TIME_PATTERN),
DateUtils.stampToDate(System.currentTimeMillis(),"yyyy-MM-dd")+" 23:59:59",null, DateUtils.stampToDate(System.currentTimeMillis(),DateUtils.DATE_TIME_PATTERN),orgCode,
null); user.getUserId());
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(newNumber); stringBuilder.append(newNumber);
String workOrderNumber = stringBuilder.append(map.get("calledCount") == null ? "1" : String.valueOf(Integer.parseInt(map.get("calledCount").toString()) + 1)).toString() ; String workOrderNumber = stringBuilder.append(map.get("calledCount") == null ? "1" : String.valueOf(Integer.parseInt(map.get("calledCount").toString()) + 1)).toString() ;
...@@ -182,7 +189,7 @@ public class AlertCalledController extends BaseController { ...@@ -182,7 +189,7 @@ public class AlertCalledController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/alertStatistics") @GetMapping(value = "/alertStatistics")
@ApiOperation(httpMethod = "GET",value = "警情统计", notes = "警情统计") @ApiOperation(httpMethod = "GET",value = "警情统计", notes = "警情统计")
public ResponseModel<AlarmStatisticsDto> alertStatistics() throws ParseException { public ResponseModel<AlarmStatisticsDto> alertStatistics() {
ReginParams reginParams =getSelectedOrgInfo(); ReginParams reginParams =getSelectedOrgInfo();
//我的待办数量 //我的待办数量
...@@ -202,8 +209,8 @@ public class AlertCalledController extends BaseController { ...@@ -202,8 +209,8 @@ public class AlertCalledController extends BaseController {
alarmStatisticsDto.setAllNum(iAlertCalledService.list(allNumQueryWrapper).size()); alarmStatisticsDto.setAllNum(iAlertCalledService.list(allNumQueryWrapper).size());
Map<String, Object> map = iAlertCalledService.getAlertInfoList(DateUtils.stampToDate(System.currentTimeMillis(),"yyyy-MM-dd")+" 00:00:00", Map<String, Object> map = iAlertCalledService.getAlertInfoList(DateUtils.stampToDate(System.currentTimeMillis(),DateUtils.DATE_PATTERN),
DateUtils.stampToDate(System.currentTimeMillis(),"yyyy-MM-dd")+" 23:59:59",null, DateUtils.stampToDate(DateUtils.dateAddDays(new Date(),1).getTime(),DateUtils.DATE_PATTERN),null,
getUserInfo().getUserId()); getUserInfo().getUserId());
// 当天接警 // 当天接警
...@@ -217,15 +224,16 @@ public class AlertCalledController extends BaseController { ...@@ -217,15 +224,16 @@ public class AlertCalledController extends BaseController {
//困人救援数量 //困人救援数量
alarmStatisticsDto.setSleepyIncident(map.get("sleepyIncidentCount") == null ? 0 : Integer.valueOf(map.get("sleepyIncidentCount").toString())) ; alarmStatisticsDto.setSleepyIncident(map.get("sleepyIncidentCount") == null ? 0 : Integer.valueOf(map.get("sleepyIncidentCount").toString())) ;
Map<String,Integer> recordMap = Maps.newHashMap(); LinkedHashMap<String,Integer> recordMap = new LinkedHashMap<>();
// 近七天办理数量 // 近七天办理数量
for(int i = 1 ; i < 8; i++) { Map<String, Object> nearlySevenDaysMap = iAlertCalledService.getNearlyInfo(DateUtils.stampToDate(System.currentTimeMillis(),DateUtils.DATE_PATTERN),
Map<String, Object> nearlySevenDaysMap = iAlertCalledService.getAlertInfoList(DateUtils.stampToDate(DateUtils.dateAddDays(new Date(), -i).getTime(),"yyyy-MM-dd")+" 00:00:00", DateUtils.stampToDate(DateUtils.dateAddDays(new Date(),1).getTime(),DateUtils.DATE_PATTERN),null,
DateUtils.stampToDate(DateUtils.dateAddDays(new Date(), -i).getTime(),"yyyy-MM-dd")+" 23:59:59",null, getUserInfo().getUserId());
getUserInfo().getUserId());
recordMap.put(DateUtils.stampToDate(DateUtils.dateAddDays(new Date(), -i).getTime(),"yyyy-MM-dd"),nearlySevenDaysMap.get("calledCount") == null ? 0 : Integer.valueOf(nearlySevenDaysMap.get("calledCount").toString())); for(int i = 0; i<nearlySevenDaysMap.size()/2;i++) {
} recordMap.put(DateUtils.dateToString(nearlySevenDaysMap.get("dateTime"+i).toString()), Integer.parseInt(nearlySevenDaysMap.get("majorAlertCount"+i).toString()));
alarmStatisticsDto.setNearlySevenDaysNum(recordMap); }
alarmStatisticsDto.setNearlySevenDaysNum(recordMap);
} }
return ResponseHelper.buildResponse(alarmStatisticsDto); return ResponseHelper.buildResponse(alarmStatisticsDto);
} }
...@@ -256,7 +264,7 @@ public class AlertCalledController extends BaseController { ...@@ -256,7 +264,7 @@ public class AlertCalledController extends BaseController {
page = iAlertCalledService.page(pageBean, alertCalledQueryWrapper); page = iAlertCalledService.page(pageBean, alertCalledQueryWrapper);
IPage<AlertCalledDto> calledVoIPage = AlertBeanDtoVoUtils.alertCalledIPageDto(page); IPage<AlertCalledDto> calledVoIPage = AlertBeanDtoVoUtils.alertCalledIPageDto(page);
calledVoIPage.getRecords().stream().forEach(e->{ calledVoIPage.getRecords().stream().forEach(e->{
e.setAlertAddress(e.getCity()+e.getDistrict()); getResponseLevel(e.getSequenceNbr(), e,null);
}); });
return ResponseHelper.buildResponse(calledVoIPage); return ResponseHelper.buildResponse(calledVoIPage);
} }
...@@ -316,6 +324,28 @@ public class AlertCalledController extends BaseController { ...@@ -316,6 +324,28 @@ public class AlertCalledController extends BaseController {
return queryWrapper; return queryWrapper;
} }
void getResponseLevel(Long alertId, AlertCalledDto alertCalledDto, ESAlertCalledDto esAlertCalledDto) {
LambdaQueryWrapper<DispatchPaper> dispatchPaperQueryWrapper = new LambdaQueryWrapper<>();
dispatchPaperQueryWrapper.eq(DispatchPaper::getAlertId,alertId);
DispatchPaper dispatchPaper = dispatchPaperServiceImpl.getOne(dispatchPaperQueryWrapper);
if(null != dispatchPaper) {
LambdaQueryWrapper<AlertFormValue> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AlertFormValue::getAlertCalledId, dispatchPaper.getSequenceNbr()).eq(AlertFormValue::getAlertTypeCode, DispatchPaperEnums.getEnumById(dispatchPaper.getAlertCode()).getDynamicCode());
// 派遣单动态表单数据
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
// map 存取数据
Map<String,String> dynamicParms = new HashMap<String,String>();
list.stream().forEach(paperFormValue -> {
dynamicParms.put(paperFormValue.getFieldCode(),paperFormValue.getFieldValue());
});
String responseLevel = dynamicParms.get("response_level");
if(null != alertCalledDto) {
alertCalledDto.setResponseLevel(responseLevel);
} else {
esAlertCalledDto.setResponseLevel(responseLevel);
}
}
}
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
......
package com.yeejoin.amos.boot.module.tzs.biz.service.impl; package com.yeejoin.amos.boot.module.tzs.biz.service.impl;
import java.util.ArrayList; import com.alibaba.fastjson.JSON;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
...@@ -34,6 +20,17 @@ import com.yeejoin.amos.boot.module.tzs.api.mapper.AlertCalledMapper; ...@@ -34,6 +20,17 @@ import com.yeejoin.amos.boot.module.tzs.api.mapper.AlertCalledMapper;
import com.yeejoin.amos.boot.module.tzs.api.service.IAlertCalledService; import com.yeejoin.amos.boot.module.tzs.api.service.IAlertCalledService;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils; import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/** /**
* 警情接警填报记录服务实现类 * 警情接警填报记录服务实现类
...@@ -263,4 +260,20 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall ...@@ -263,4 +260,20 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
return result; return result;
} }
public Map<String, Object> getNearlyInfo(String beginDate, String endDate,String orgCode, String recUserId) {
Map<String, Object> result = Maps.newHashMap();
List<Map<String, Integer>> statusCountMap = alertCalledMapper.queryNearlyCount(beginDate, endDate,orgCode,recUserId);
for(int i = 0; i<statusCountMap.size();i++) {
if(statusCountMap.get(i).size() > 1) {
result.put("dateTime"+i,statusCountMap.get(i).get("dateTime"));
result.put("majorAlertCount"+i,statusCountMap.get(i).get("majorAlertCount"));
} else {
result.put("dateTime"+i,statusCountMap.get(i).get("dateTime"));
result.put("majorAlertCount"+i,0);
}
}
return result;
}
} }
\ No newline at end of file
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
(SELECT GROUP_CONCAT(name SEPARATOR ';') FROM p_point_classify WHERE point_id = p.id GROUP BY point_id) classifyName, (SELECT GROUP_CONCAT(name SEPARATOR ';') FROM p_point_classify WHERE point_id = p.id GROUP BY point_id) classifyName,
p.belong_system_name, p.belong_system_name,
p.equipment_name, p.equipment_name,
p.address, concat_ws('',ifnull(p.building_name,''),ifnull(p.address,'')) as position,
(select count(1) from p_route_point_item rpi where rpi.route_point_id = rp.id) as routePointItemNum (select count(1) from p_route_point_item rpi where rpi.route_point_id = rp.id) as routePointItemNum
FROM FROM
p_route_point rp p_route_point rp
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment