Commit 5e5958e5 authored by zhangjianqian's avatar zhangjianqian

Merge remote-tracking branch 'origin/master'

parents 53d29a02 6ee1e780
......@@ -61,13 +61,6 @@
<artifactId>huaxin-generator</artifactId>
</dependency>
<!--海康-->
<dependency>
<groupId>com.hikvision.ga</groupId>
<artifactId>artemis-http-client</artifactId>
<version>1.1.3</version>
</dependency>
</dependencies>
<build>
......
......@@ -290,4 +290,28 @@ public class TTaskInspectController extends BaseController
public AjaxResult inspectNumStatisticByInspectorForWeiXin(@RequestBody Map<String,String> param){
return AjaxResult.success(tTaskInspectService.inspectNumStatisticByInspectorForWeiXin(param));
}
/**
* 工商业安检量统计
* @param param 入参
* @return
*/
@PostMapping("/inspectNumStatisticByInspectorAndType")
public AjaxResult inspectNumStatisticByInspectorAndType(@RequestBody Map<String,String> param){
return AjaxResult.success(tTaskInspectService.inspectNumStatisticByInspectorAndType(param));
}
/**
* 根据安检人统计安检量导出
* @param param
* @return
*/
@PostMapping("/inspectNumStatisticByInspectorAndTypeExport")
public AjaxResult inspectNumStatisticByInspectorAndTypeExport(@RequestBody Map<String,String> param){
List<InspectNumStatisticByInspectorExportVo> list = tTaskInspectService.inspectNumStatisticByInspectorAndTypeExport(param);
ExcelUtil<InspectNumStatisticByInspectorExportVo> util = new ExcelUtil<>(InspectNumStatisticByInspectorExportVo.class);
return util.exportExcel(list, "安检量统计数据");
}
}
......@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSONObject;
import com.hikvision.artemis.sdk.ArtemisHttpUtil;
import com.hikvision.artemis.sdk.config.ArtemisConfig;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.exception.CustomException;
import com.zehong.common.utils.StringUtils;
import com.zehong.system.domain.vo.EventSubscriptionVo;
import com.zehong.system.domain.vo.EventUnSubscriptionVo;
import org.springframework.web.bind.annotation.*;
......@@ -23,14 +25,14 @@ public class ArtemisController {
* 如果你选择的是和现场环境对接,host要修改为现场环境的ip,https端口默认为443,http端口默认为80.例如10.33.25.22:443 或者10.33.25.22:80
* appKey和appSecret请按照或得到的appKey和appSecret更改.
*/
static {
/*static {
// 代理API网关nginx服务器ip端口
ArtemisConfig.host = "60.3.252.114:10443";
// 秘钥appkey
ArtemisConfig.appKey = "29791064";
// 秘钥appSecret
ArtemisConfig.appSecret = "EArAS02rV0krs1waU5nE";
}
}*/
/**
* 能力开放平台的网站路径
*/
......@@ -90,6 +92,7 @@ public class ArtemisController {
String body = jsonBody.toJSONString();
// post请求application/json类型参数
String result = ArtemisHttpUtil.doPostStringArtemis(path,body,null,null,"application/json",null);
if(StringUtils.isEmpty(result)) throw new CustomException("获取海康平台数据失败");
return AjaxResult.success(JSONObject.parseObject(result));
}
......@@ -117,6 +120,7 @@ public class ArtemisController {
String body = jsonBody.toJSONString();
// post请求application/json类型参数
String result = ArtemisHttpUtil.doPostStringArtemis(path,body,null,null,"application/json",null);
if(StringUtils.isEmpty(result)) throw new CustomException("获取海康平台数据失败");
return AjaxResult.success(JSONObject.parseObject(result));
}
......@@ -144,6 +148,7 @@ public class ArtemisController {
String body = jsonBody.toJSONString();
// post请求application/json类型参数
String result = ArtemisHttpUtil.doPostStringArtemis(path,body,null,null,"application/json",null);
if(StringUtils.isEmpty(result)) throw new CustomException("获取海康平台数据失败");
return AjaxResult.success(JSONObject.parseObject(result));
}
......@@ -171,6 +176,7 @@ public class ArtemisController {
}
String body = jsonBody.toJSONString();
String result = ArtemisHttpUtil.doPostStringArtemis(path,body,null,null,"application/json",null);
if(StringUtils.isEmpty(result)) throw new CustomException("获取海康平台数据失败");
return AjaxResult.success(JSONObject.parseObject(result));
}
......
package com.zehong.web.controller.video;
import com.alibaba.fastjson.JSONObject;
import com.hikvision.artemis.sdk.ArtemisHttpUtil;
import com.hikvision.artemis.sdk.config.ArtemisConfig;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.system.domain.vo.EventSubscriptionVo;
import com.zehong.system.domain.vo.EventUnSubscriptionVo;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.Map;
/**
* 鸿海海康视频接口
*/
@RestController
@RequestMapping("/honghai/artemis")
public class HonghaiArtemisController {
/**
* 请根据自己的appKey和appSecret更换static静态块中的三个参数. [1 host]
* 如果你选择的是和现场环境对接,host要修改为现场环境的ip,https端口默认为443,http端口默认为80.例如10.33.25.22:443 或者10.33.25.22:80
* appKey和appSecret请按照或得到的appKey和appSecret更改.
*/
static {
// 代理API网关nginx服务器ip端口
ArtemisConfig.host = "60.3.252.114:20443";
// 秘钥appkey
ArtemisConfig.appKey = "20289095";
// 秘钥appSecret
ArtemisConfig.appSecret = "2ESpESEYcMNQsnlmsnec";
}
/**
* 能力开放平台的网站路径
*/
private static final String ARTEMIS_PATH = "/artemis";
/**
* 获取监控点预览取流URL
*/
private static final String GET_PREVIEWURLS = ARTEMIS_PATH + "/api/video/v1/cameras/previewURLs";
/**
* 分页获取监控点资源
*/
private static final String GET_CAMERAS = ARTEMIS_PATH + "/api/resource/v1/cameras";
private static final String VEDIO_CONTROLLING = ARTEMIS_PATH + "/api/video/v1/ptzs/controlling";
/**
* 按事件类型订阅事件
*/
private static final String EVENT_SUBSCIRPTION_BY_ENVENTTYPES = ARTEMIS_PATH + "/api/eventService/v1/eventSubscriptionByEventTypes";
/**
* 按事件类型取消订阅事件
*/
private static final String EVENT_UNSUBSCRIPTION_BY_EVENTTYPES = ARTEMIS_PATH + "/api/eventService/v1/eventUnSubscriptionByEventTypes";
/**
* 获取监控点预览取流URL
* @return
*/
@GetMapping("/getPreviewURLs")
public AjaxResult getPreviewURLs(@RequestParam(value = "cameraIndexCode") String cameraIndexCode){
/**
* 根据API文档可以看出来,这是一个POST请求的Rest接口,而且传入的参数值为一个json
* ArtemisHttpUtil工具类提供了doPostStringArtemis这个函数,一共六个参数在文档里写明其中的意思,因为接口是https,
* 所以第一个参数path是一个hashmap类型,请put一个key-value,query为传入的参数,body为传入的json数据
* 传入的contentType为application/json,accept不指定为null
* header没有额外参数可不传,指定为null
*
*/
Map<String, String> path = new HashMap<String, String>(2) {
{
//根据现场环境部署确认是http还是https
put("https://", GET_PREVIEWURLS);
}
};
JSONObject jsonBody = new JSONObject();
//jsonBody.put("cameraIndexCode", "2a9891a194c24747b277f3ea4836d433");
jsonBody.put("cameraIndexCode", cameraIndexCode);
jsonBody.put("streamType", 0);//0主码流,1子码流
jsonBody.put("protocol", "ws");
jsonBody.put("transmode", 1);
String body = jsonBody.toJSONString();
// post请求application/json类型参数
String result = ArtemisHttpUtil.doPostStringArtemis(path,body,null,null,"application/json",null);
return AjaxResult.success(JSONObject.parseObject(result));
}
/**
* 分页获取监控点资源
* @param pageNo 页码
* @param pageSize 每页条数
* @return
*/
@GetMapping("/getCameras")
public AjaxResult getCameras(@RequestParam("pageNo") int pageNo, @RequestParam("pageSize") int pageSize){
Map<String, String> path = new HashMap<String, String>(2) {
{
//根据现场环境部署确认是http还是https
put("https://", GET_CAMERAS);
}
};
JSONObject jsonBody = new JSONObject();
jsonBody.put("pageNo", pageNo);
jsonBody.put("pageSize", pageSize);
jsonBody.put("treeCode", 0);
String body = jsonBody.toJSONString();
// post请求application/json类型参数
String result = ArtemisHttpUtil.doPostStringArtemis(path,body,null,null,"application/json",null);
return AjaxResult.success(JSONObject.parseObject(result));
}
/**
* 云控操作
* @param cameraIndexCode
* @param command
* @param action
* @return
*/
@RequestMapping("/videoControlling")
public AjaxResult videoControlling(@RequestParam("cameraIndexCode") String cameraIndexCode, @RequestParam("command") String command, @RequestParam("action") String action, @RequestParam("speed") String speed){
Map<String, String> path = new HashMap<String, String>(2) {
{
//根据现场环境部署确认是http还是https
put("https://", VEDIO_CONTROLLING);
}
};
JSONObject jsonBody = new JSONObject();
jsonBody.put("cameraIndexCode", cameraIndexCode);
jsonBody.put("action", action);
jsonBody.put("command", command);
jsonBody.put("speed", speed);
String body = jsonBody.toJSONString();
// post请求application/json类型参数
String result = ArtemisHttpUtil.doPostStringArtemis(path,body,null,null,"application/json",null);
return AjaxResult.success(JSONObject.parseObject(result));
}
/**
* 按事件类型订阅事件
* @param eventSubscriptionVo 事件订阅实体
* @return
*/
@PostMapping("/eventSubscriptionByEventTypes")
public AjaxResult eventSubscriptionByEventTypes(@RequestBody EventSubscriptionVo eventSubscriptionVo){
Map<String, String> path = new HashMap<String, String>(2) {
{
//根据现场环境部署确认是http还是https
put("https://", EVENT_SUBSCIRPTION_BY_ENVENTTYPES);
}
};
JSONObject jsonBody = new JSONObject();
jsonBody.put("eventTypes", eventSubscriptionVo.getEventTypes());
jsonBody.put("eventDest", eventSubscriptionVo.getEventDest());
if(eventSubscriptionVo.getSubType() !=0){
jsonBody.put("subType", eventSubscriptionVo.getSubType());
}
if(null !=eventSubscriptionVo.getEventLvl() && eventSubscriptionVo.getEventLvl().size() != 0){
jsonBody.put("eventLvl", eventSubscriptionVo.getEventLvl());
}
String body = jsonBody.toJSONString();
String result = ArtemisHttpUtil.doPostStringArtemis(path,body,null,null,"application/json",null);
return AjaxResult.success(JSONObject.parseObject(result));
}
/**
* 按事件类型取消订阅
* @param eventUnSubscriptionVo 事件类型
* @return
*/
@PostMapping("/eventUnSubscriptionByEventTypes")
public AjaxResult eventUnSubscriptionByEventTypes(@RequestBody EventUnSubscriptionVo eventUnSubscriptionVo){
Map<String, String> path = new HashMap<String, String>(2) {
{
//根据现场环境部署确认是http还是https
put("https://", EVENT_UNSUBSCRIPTION_BY_EVENTTYPES);
}
};
JSONObject jsonBody = new JSONObject();
jsonBody.put("eventTypes", eventUnSubscriptionVo.getEventTypes());
String body = jsonBody.toJSONString();
String result = ArtemisHttpUtil.doPostStringArtemis(path,body,null,null,"application/json",null);
return AjaxResult.success(JSONObject.parseObject(result));
}
}
......@@ -115,4 +115,17 @@ thirdGasUse:
loginUrl: https://manage.cis.jinka.cn/auth/aggregation/app/login
accessKeyId: 001EE4257BA231B2886F13A1316E7395
accessKeySecret: 6D2053243CA99905179E14FBC93B0985075F4A4B0D1B339400EA1DBEF342F880
meterDetailUrl: https://manage.cis.jinka.cn/rest/v1/query/meter-detail
\ No newline at end of file
meterDetailUrl: https://manage.cis.jinka.cn/rest/v1/query/meter-detail
# 海康服务平台
hikvision:
platforms:
huaxin:
host: 60.3.252.114:10443
app-key: 29791064
app-secret: EArAS02rV0krs1waU5nE
honghai:
host: 60.3.252.114:20443
app-key: 20289095
app-secret: 2ESpESEYcMNQsnlmsnec
\ No newline at end of file
......@@ -115,4 +115,17 @@ thirdGasUse:
loginUrl: https://manage.cis-test.jinka.cn/auth/aggregation/app/login
accessKeyId: 001E146809696F2B6FEC38024015808D
accessKeySecret: E0418F33E4F7F480A8F88F6F3D78C0519096759708A2452DEA0D244E6F184E68
meterDetailUrl: https://manage.cis-test.jinka.cn/rest/v1/query/meter-detail
\ No newline at end of file
meterDetailUrl: https://manage.cis-test.jinka.cn/rest/v1/query/meter-detail
# 海康服务平台
hikvision:
platforms:
huaxin:
host: 60.3.252.114:10443
app-key: 29791064
app-secret: EArAS02rV0krs1waU5nE
honghai:
host: 60.3.252.114:20443
app-key: 20289095
app-secret: 2ESpESEYcMNQsnlmsnec
\ No newline at end of file
......@@ -113,4 +113,17 @@ thirdGasUse:
loginUrl: https://manage.cis-test.jinka.cn/auth/aggregation/app/login
accessKeyId: 001E146809696F2B6FEC38024015808D
accessKeySecret: E0418F33E4F7F480A8F88F6F3D78C0519096759708A2452DEA0D244E6F184E68
meterDetailUrl: https://manage.cis-test.jinka.cn/rest/v1/query/meter-detail
\ No newline at end of file
meterDetailUrl: https://manage.cis-test.jinka.cn/rest/v1/query/meter-detail
# 海康服务平台
hikvision:
platforms:
huaxin:
host: 60.3.252.114:10443
app-key: 29791064
app-secret: EArAS02rV0krs1waU5nE
honghai:
host: 60.3.252.114:20443
app-key: 20289095
app-secret: 2ESpESEYcMNQsnlmsnec
\ No newline at end of file
......@@ -59,6 +59,13 @@
<artifactId>huaxin-system</artifactId>
</dependency>
<!--海康-->
<dependency>
<groupId>com.hikvision.ga</groupId>
<artifactId>artemis-http-client</artifactId>
<version>1.1.3</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.zehong.framework.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.util.Map;
@Component
@ConfigurationProperties(prefix = "hikvision")
public class HikvisionProperties {
private Map<String, PlatformConfig> platforms;
public Map<String, PlatformConfig> getPlatforms() {
return platforms;
}
public void setPlatforms(Map<String, PlatformConfig> platforms) {
this.platforms = platforms;
}
/**
* 获取平台配置
* @param platformId 平台
* @return
*/
public HikvisionProperties.PlatformConfig getPlatformConfig(String platformId) {
HikvisionProperties.PlatformConfig config = platforms.get(platformId);
if (config == null) {
throw new IllegalArgumentException("未找到平台: " + platformId);
}
return config;
}
public static class PlatformConfig {
private String host;
private String appKey;
private String appSecret;
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public String getAppKey() {
return appKey;
}
public void setAppKey(String appKey) {
this.appKey = appKey;
}
public String getAppSecret() {
return appSecret;
}
public void setAppSecret(String appSecret) {
this.appSecret = appSecret;
}
}
}
package com.zehong.framework.config;
import com.zehong.framework.interceptor.ArtemisInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
......@@ -24,6 +25,12 @@ public class ResourcesConfig implements WebMvcConfigurer
@Autowired
private RepeatSubmitInterceptor repeatSubmitInterceptor;
private final HikvisionProperties properties;
public ResourcesConfig(HikvisionProperties properties) {
this.properties = properties;
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry)
{
......@@ -41,6 +48,8 @@ public class ResourcesConfig implements WebMvcConfigurer
public void addInterceptors(InterceptorRegistry registry)
{
registry.addInterceptor(repeatSubmitInterceptor).addPathPatterns("/**");
registry.addInterceptor(new ArtemisInterceptor(properties))
.addPathPatterns("/artemis/**"); // 拦截 /artemis 开头的所有请求
}
/**
......
package com.zehong.framework.interceptor;
import com.hikvision.artemis.sdk.config.ArtemisConfig;
import com.zehong.common.utils.StringUtils;
import com.zehong.framework.config.HikvisionProperties;
import org.springframework.web.servlet.HandlerInterceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class ArtemisInterceptor implements HandlerInterceptor {
private final HikvisionProperties properties;
public ArtemisInterceptor(HikvisionProperties properties) {
this.properties = properties;
}
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
String path = request.getRequestURI();
// 只拦截以 /artemis 开头的请求
if (path.contains("/artemis")) {
String platform = request.getParameter("platform");
HikvisionProperties.PlatformConfig config = StringUtils.isNotEmpty(platform) ? properties.getPlatformConfig(platform) : properties.getPlatformConfig("huaxin");
// 设置 ArtemisConfig(需要加锁)
synchronized (ArtemisInterceptor.class) {
// 代理API网关nginx服务器ip端口
ArtemisConfig.host = config.getHost();
// 秘钥appkey
ArtemisConfig.appKey = config.getAppKey();
// 秘钥appSecret
ArtemisConfig.appSecret = config.getAppSecret();
}
}
return true;
}
}
......@@ -29,6 +29,11 @@ public class TVideoManage extends BaseEntity
@Excel(name = "类型",readConverterExp = "1=华鑫,2=鸿海")
private String videoType;
@Excel(name = "分类",dictType = "t_video_kind")
private String kind;
private String sort;
/** 是否删除(0正常,1删除) */
private String isDel;
......@@ -90,6 +95,22 @@ public class TVideoManage extends BaseEntity
this.videoType = videoType;
}
public String getKind() {
return kind;
}
public void setKind(String kind) {
this.kind = kind;
}
public String getSort() {
return sort;
}
public void setSort(String sort) {
this.sort = sort;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
......@@ -129,4 +129,12 @@ public interface TTaskInspectMapper
* @return
*/
Map<String,Object> inspectNumStatisticByTask(Map<String,String> param);
/**
* 工商业安检量统计
* @param param 入参
* @return
*/
List<Map<String,Object>> inspectNumStatisticByInspectorAndType(Map<String,String> param);
}
......@@ -121,4 +121,20 @@ public interface ITTaskInspectService
* @return
*/
Map<String,Object> inspectNumStatisticByInspectorForWeiXin(Map<String,String> param);
/**
* 工商业安检量统计
* @param param 入参
* @return
*/
List<Map<String,Object>> inspectNumStatisticByInspectorAndType(Map<String,String> param);
/**
* 安检量统计导出
* @param param 入参
* @return
*/
List<InspectNumStatisticByInspectorExportVo> inspectNumStatisticByInspectorAndTypeExport(Map<String,String> param);
}
......@@ -356,4 +356,49 @@ public class TTaskInspectServiceImpl implements ITTaskInspectService
result.put("taskStatisticInfo",tTaskInspectMapper.inspectNumStatisticByTask(param));
return result;
}
/**
* 工商业安检量统计
* @param param 入参
* @return
*/
@Override
public List<Map<String,Object>> inspectNumStatisticByInspectorAndType(Map<String,String> param){
return tTaskInspectMapper.inspectNumStatisticByInspectorAndType(param);
}
/**
* 安检量统计导出
* @param param 入参
* @return
*/
@Override
public List<InspectNumStatisticByInspectorExportVo> inspectNumStatisticByInspectorAndTypeExport(Map<String,String> param){
List<InspectNumStatisticByInspectorExportVo> export = new ArrayList<>();
//获取汇总信息
List<Map<String,Object>> result = inspectNumStatisticByInspectorAndType(param);
InspectNumStatisticByInspectorExportVo statisticInfo = new InspectNumStatisticByInspectorExportVo();
statisticInfo.setInspector("汇总");
statisticInfo.setNoInspectNum("-");
export.add(statisticInfo);
for(Map info : result){
ObjectMapper objectMapper = new ObjectMapper();
InspectNumStatisticByInspectorExportVo exportInfo = objectMapper.convertValue(info,InspectNumStatisticByInspectorExportVo.class);
int total = (int)info.get("normalInspectNum") + (int)info.get("refuseInspectNum") + (int)info.get("stopInspectNum") + (int)info.get("missInspectNum");
exportInfo.setTotal(total);
//statisticInfo.setNoInspectNum(statisticInfo.getNoInspectNum() + (int) info.get("noInspectNum"));
statisticInfo.setNormalInspectNum(statisticInfo.getNormalInspectNum() + (int) info.get("normalInspectNum"));
statisticInfo.setRefuseInspectNum(statisticInfo.getRefuseInspectNum() + (int) info.get("refuseInspectNum"));
statisticInfo.setStopInspectNum(statisticInfo.getStopInspectNum() + (int) info.get("stopInspectNum"));
statisticInfo.setMissInspectNum(statisticInfo.getMissInspectNum() + (int) info.get("missInspectNum"));
statisticInfo.setDangerNum(statisticInfo.getDangerNum() + (int) info.get("dangerNum"));
statisticInfo.setNoDangerNum(statisticInfo.getNoDangerNum() + (int) info.get("noDangerNum"));
statisticInfo.setTotal(statisticInfo.getTotal() + total);
export.add(exportInfo);
}
return export;
}
}
......@@ -472,7 +472,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
INNER JOIN (
SELECT receive_id, MAX(id) AS max_id
FROM t_task_inspect
WHERE `status` != -1
WHERE `status` != -1 and `type` = '1'
GROUP BY receive_id
) latest ON i.id = latest.max_id
) inspect
......@@ -556,7 +556,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN t_user u ON u.id = inspect.receive_id
</if>
<where>
task.status = 0
task.status = 0 and task.type = '1'
<if test="village != null"> and u.village = #{village}</if>
<if test="street != null"> and u.street = #{street}</if>
<if test="memberId != null"> and gr.user_id = #{memberId}</if>
......@@ -564,4 +564,58 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP BY task.id
)statistic
</select>
<!-- 工商业安检量统计 -->
<select id="inspectNumStatisticByInspectorAndType" parameterType="Map" resultType="Map">
SELECT
COUNT(inspect.id) AS totalInspectNum,
SUM(IF(inspect. STATUS = 0, 1, 0)) AS missInspectNum,
SUM(IF(inspect. STATUS = 1, 1, 0)) AS refuseInspectNum,
SUM(IF(inspect. STATUS = 2, 1, 0)) AS normalInspectNum,
SUM(IF(inspect. STATUS = 3, 1, 0)) AS stopInspectNum,
SUM(IF(inspect.danger = 1, 1, 0)) AS dangerNum,
SUM(IF(inspect.danger = 1, 0, 1)) AS noDangerNum,
inspect.member_id AS memberId,
inspect.task_id AS taskId,
(
SELECT
nick_name
FROM
sys_user
WHERE
user_id = inspect.member_id
) AS inspector
FROM
(
SELECT
i.id,
i.task_id,
i.member_id,
i. STATUS,
i.danger,
i.create_time,
i.receive_id
FROM
t_task_inspect i
INNER JOIN (
SELECT
receive_id,
MAX(id) AS max_id
FROM
t_task_inspect
WHERE
`status` != - 1 and type = #{type}
GROUP BY
receive_id
) latest ON i.id = latest.max_id
) inspect
LEFT JOIN t_task task ON task.id = inspect.task_id
<where>
task.status = 0
<if test="beginTime != null and endTime != null"> and inspect.create_time between #{beginTime} and #{endTime}</if>
<if test="memberId != null"> and inspect.member_id = #{memberId}</if>
</where>
GROUP BY inspect.member_id,inspect.task_id;
</select>
</mapper>
\ No newline at end of file
......@@ -13,10 +13,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="isDel" column="is_del" />
<result property="remarks" column="remarks" />
<result property="videoType" column="video_type" />
<result property="kind" column="kind" />
<result property="sort" column="sort" />
</resultMap>
<sql id="selectTVideoManageVo">
select video_id, video_name, video_resource, create_by, create_time, is_del, remarks, video_type from t_video_manage
select video_id, video_name, video_resource, create_by, create_time, is_del, remarks, video_type, kind, sort from t_video_manage
</sql>
<select id="selectTVideoManageList" parameterType="TVideoManage" resultMap="TVideoManageResult">
......@@ -27,6 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if>
<if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
<if test="videoType != null and videoType != ''"> and video_type = #{videoType}</if>
<if test="kind != null and kind != ''"> and kind = #{kind}</if>
</where>
</select>
......@@ -45,6 +48,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isDel != null">is_del,</if>
<if test="remarks != null">remarks,</if>
<if test="videoType != null">video_type,</if>
<if test="kind != null">kind,</if>
<if test="sort != null">sort,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="videoName != null">#{videoName},</if>
......@@ -53,7 +58,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">#{createTime},</if>
<if test="isDel != null">#{isDel},</if>
<if test="remarks != null">#{remarks},</if>
<if test="videoType != null">videoType,</if>
<if test="videoType != null">#{videoType},</if>
<if test="kind != null">#{kind},</if>
<if test="sort != null">#{sort},</if>
</trim>
</insert>
......@@ -66,6 +73,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time = #{createTime},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="videoType != null">video_type = #{videoType},</if>
<if test="kind != null">kind = #{kind},</if>
<if test="sort != null">sort = #{sort},</if>
</trim>
where video_id = #{videoId}
</update>
......
......@@ -149,3 +149,23 @@ export function inspectNumStatisticByInspectorExport(data) {
data: data
})
}
//工商业安检人统计安检量
export function inspectNumStatisticByInspectorAndType(data) {
return request({
url: '/checktask/inspect/inspectNumStatisticByInspectorAndType',
method: 'post',
data: data
})
}
//工商业安检人统计安检量导出
export function inspectNumStatisticByInspectorAndTypeExport(data) {
return request({
url: '/checktask/inspect/inspectNumStatisticByInspectorAndTypeExport',
method: 'post',
data: data
})
}
import request from '@/utils/request'
/**
* api根地址
* @type {{"1": "华鑫", "2": "鸿海"}}
*/
const apiBaseConfig = {
'1': "/artemis",
'2': "/honghai/artemis"
};
// 查询视频地址
export function getPreviewURLs(query,type='1') {
export function getPreviewURLs(query) {
return request({
url: apiBaseConfig[type] + '/getPreviewURLs',
url: '/artemis/getPreviewURLs',
method: 'get',
params: query
})
}
// 云台控制
export function videoControlling(query,type='1') {
export function videoControlling(query) {
return request({
url: apiBaseConfig[type] + '/videoControlling',
url: '/artemis/videoControlling',
method: 'get',
params: query
})
......
<template>
<div :class="isChoice ? 'showVideo' : 'closeVideo'">
<div class="videoTitle">
<span style="margin-left: 15px; color: #334d6e">
<span
style="
margin-left: 15px;
color: #334d6e;
display: inline-flex;
align-items: center;
max-width: calc(100% - 120px);
min-width: 0;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis
"
:title="videoName"
>
<img
src="@/assets/images/camera.png"
alt="fold"
style="width: 18px; height: 18px"
style="width: 18px; height: 18px;margin-right: 4px"
/>
{{ videoName }}
</span>
......@@ -13,10 +26,9 @@
v-if="videoName != ''"
type="text"
size="medium"
style="margin-left: 8px"
style="margin-left: 8px;position: absolute"
@click="closeVideo"
>关闭</el-button
>
>关闭</el-button>
<el-dropdown
@command="videoSetting"
trigger="click"
......@@ -126,7 +138,7 @@ export default {
playVideo(data) {
this.videoName = data.videoName;
this.cameraIndexCode = data.videoResource;
getPreviewURLs({ cameraIndexCode: data.videoResource },data.videoType).then((response) => {
getPreviewURLs({ cameraIndexCode: data.videoResource, platform: data.videoType == '2' ? 'honghai' : 'huaxin'}).then((response) => {
if (response.data.code == "0") {
this.videoOpenNum++;
let url = response.data.data.url;
......@@ -138,6 +150,8 @@ export default {
console.error(e);
}
);
}else{
this.$message.error(response.data.msg)
}
});
},
......
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" label-width="130px">
<el-form-item label="起止时间">
<el-date-picker
v-model="time"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
size="small"
@change="timeChange"
value-format="yyyy-MM-dd"
:clearable="false"
>
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
:loading="exportLoading"
@click="handleExport"
>导出</el-button>
</el-col>
</el-row>
<el-table v-loading="loading" :data="inspectStatisticInfoList">
<el-table-column label="姓名" align="center" prop="inspector"/>
<!--<el-table-column label="待安检单数" align="center" prop="noInspectNum"/>-->
<el-table-column label="正常安检" align="center" prop="normalInspectNum"/>
<el-table-column label="拒绝安检" align="center" prop="refuseInspectNum"/>
<el-table-column label="燃气停用" align="center" prop="stopInspectNum"/>
<el-table-column label="到访不遇" align="center" prop="missInspectNum"/>
<el-table-column label="有隐患单数" align="center" prop="dangerNum"/>
<el-table-column label="无隐患单数" align="center" prop="noDangerNum"/>
<el-table-column label="汇总" align="center" prop="total"/>
</el-table>
</div>
</template>
<script>
import {inspectNumStatisticByInspectorAndType, inspectNumStatisticByInspectorAndTypeExport} from "@/api/checktask/inspect";
import moment from 'moment';
export default {
name: "inspect-statistic-index",
data(){
return{
queryParams:{
beginTime: moment(moment().startOf('day').toDate()).format("YYYY-MM-DD HH:mm:ss"),
endTime: moment(moment().endOf('day').toDate()).format("YYYY-MM-DD HH:mm:ss"),
type: '2',
},
loading: true,
inspectStatisticInfoList: [],
time: [moment(moment().startOf('day').toDate()).format("YYYY-MM-DD HH:mm:ss"),moment(moment().endOf('day').toDate()).format("YYYY-MM-DD HH:mm:ss")],
communityData: [],
streetData: [],
exportLoading: false
}
},
created(){
this.getList();
},
methods:{
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.queryParams.beginTime = moment(moment().startOf('day').toDate()).format("YYYY-MM-DD HH:mm:ss");
this.queryParams.endTime = moment(moment().endOf('day').toDate()).format("YYYY-MM-DD HH:mm:ss");
this.time = [moment(moment().startOf('day').toDate()).format("YYYY-MM-DD HH:mm:ss"),moment(moment().endOf('day').toDate()).format("YYYY-MM-DD HH:mm:ss")];
this.handleQuery();
},
getList(){
this.loading = true;
inspectNumStatisticByInspectorAndType(this.queryParams).then(res =>{
this.loading = false;
if(res.code == 200 && res.data){
this.inspectStatisticInfoList = res.data;
let statistic = {inspector: "汇总",noInspectNum: "-",normalInspectNum: 0,refuseInspectNum: 0,stopInspectNum: 0,
missInspectNum: 0,dangerNum: 0,noDangerNum: 0,total: 0};
this.inspectStatisticInfoList.forEach(item =>{
let total = item.normalInspectNum + item.refuseInspectNum + item.stopInspectNum + item.missInspectNum;
//statistic.noInspectNum += item.noInspectNum;
statistic.normalInspectNum += item.normalInspectNum;
statistic.refuseInspectNum += item.refuseInspectNum;
statistic.stopInspectNum += item.stopInspectNum;
statistic.missInspectNum += item.missInspectNum;
statistic.dangerNum += item.dangerNum;
statistic.noDangerNum += item.noDangerNum;
statistic.total += total;
item.total = total;
})
this.inspectStatisticInfoList.unshift(statistic);
}
})
},
timeChange(val){
this.queryParams.beginTime = val[0] + " 00:00:00";
this.queryParams.endTime = val[1] + " 23:59:59";
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有安检量统计数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.exportLoading = true;
return inspectNumStatisticByInspectorAndTypeExport(queryParams);
}).then(response => {
this.download(response.msg);
this.exportLoading = false;
}).catch(() => {});
},
}
}
</script>
<style scoped>
</style>
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" label-width="130px">
<el-form-item label="起止时间">
<el-date-picker
v-model="time"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
size="small"
@change="timeChange"
value-format="yyyy-MM-dd"
:clearable="false"
>
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
:loading="exportLoading"
@click="handleExport"
>导出</el-button>
</el-col>
</el-row>
<el-table v-loading="loading" :data="inspectStatisticInfoList">
<el-table-column label="姓名" align="center" prop="inspector"/>
<!--<el-table-column label="待安检单数" align="center" prop="noInspectNum"/>-->
<el-table-column label="正常安检" align="center" prop="normalInspectNum"/>
<el-table-column label="拒绝安检" align="center" prop="refuseInspectNum"/>
<el-table-column label="燃气停用" align="center" prop="stopInspectNum"/>
<el-table-column label="到访不遇" align="center" prop="missInspectNum"/>
<el-table-column label="有隐患单数" align="center" prop="dangerNum"/>
<el-table-column label="无隐患单数" align="center" prop="noDangerNum"/>
<el-table-column label="汇总" align="center" prop="total"/>
</el-table>
</div>
</template>
<script>
import {inspectNumStatisticByInspectorAndType, inspectNumStatisticByInspectorAndTypeExport} from "@/api/checktask/inspect";
import moment from 'moment';
export default {
name: "inspect-statistic-index",
data(){
return{
queryParams:{
beginTime: moment(moment().startOf('day').toDate()).format("YYYY-MM-DD HH:mm:ss"),
endTime: moment(moment().endOf('day').toDate()).format("YYYY-MM-DD HH:mm:ss"),
type: '3',
},
loading: true,
inspectStatisticInfoList: [],
time: [moment(moment().startOf('day').toDate()).format("YYYY-MM-DD HH:mm:ss"),moment(moment().endOf('day').toDate()).format("YYYY-MM-DD HH:mm:ss")],
communityData: [],
streetData: [],
exportLoading: false
}
},
created(){
this.getList();
},
methods:{
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.queryParams.beginTime = moment(moment().startOf('day').toDate()).format("YYYY-MM-DD HH:mm:ss");
this.queryParams.endTime = moment(moment().endOf('day').toDate()).format("YYYY-MM-DD HH:mm:ss");
this.time = [moment(moment().startOf('day').toDate()).format("YYYY-MM-DD HH:mm:ss"),moment(moment().endOf('day').toDate()).format("YYYY-MM-DD HH:mm:ss")];
this.handleQuery();
},
getList(){
this.loading = true;
inspectNumStatisticByInspectorAndType(this.queryParams).then(res =>{
this.loading = false;
if(res.code == 200 && res.data){
this.inspectStatisticInfoList = res.data;
let statistic = {inspector: "汇总",noInspectNum: "-",normalInspectNum: 0,refuseInspectNum: 0,stopInspectNum: 0,
missInspectNum: 0,dangerNum: 0,noDangerNum: 0,total: 0};
this.inspectStatisticInfoList.forEach(item =>{
let total = item.normalInspectNum + item.refuseInspectNum + item.stopInspectNum + item.missInspectNum;
//statistic.noInspectNum += item.noInspectNum;
statistic.normalInspectNum += item.normalInspectNum;
statistic.refuseInspectNum += item.refuseInspectNum;
statistic.stopInspectNum += item.stopInspectNum;
statistic.missInspectNum += item.missInspectNum;
statistic.dangerNum += item.dangerNum;
statistic.noDangerNum += item.noDangerNum;
statistic.total += total;
item.total = total;
})
this.inspectStatisticInfoList.unshift(statistic);
}
})
},
timeChange(val){
this.queryParams.beginTime = val[0] + " 00:00:00";
this.queryParams.endTime = val[1] + " 23:59:59";
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有安检量统计数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.exportLoading = true;
return inspectNumStatisticByInspectorAndTypeExport(queryParams);
}).then(response => {
this.download(response.msg);
this.exportLoading = false;
}).catch(() => {});
},
}
}
</script>
<style scoped>
</style>
......@@ -94,6 +94,8 @@
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="视频分类" align="center" prop="kind" :formatter="kindFormat" />
<el-table-column label="视频排序" align="center" prop="sort" />
<el-table-column label="备注" align="center" prop="remarks">
<template slot-scope="scope">
<span v-if="scope.row.remarks">{{ scope.row.remarks }}</span>
......@@ -138,11 +140,29 @@
<el-input v-model="form.videoResource" placeholder="请输入视频资源号" />
</el-form-item>
<el-form-item label="视频资类型" prop="videoType">
<el-select v-model="form.videoType" placeholder="请选择视频资类型" style="width: 100%">
<el-select
v-model="form.videoType"
placeholder="请选择视频资类型"
style="width: 100%"
@change="form.kind = null"
>
<el-option label="华鑫" value="1" />
<el-option label="鸿海" value="2" />
</el-select>
</el-form-item>
<el-form-item label="视频分类" prop="kind">
<el-select v-model="form.kind" placeholder="请选择视频分类" style="width: 100%">
<el-option
v-for="dict in form.videoType == '1' ? huaxinKindOptions : honghaiKindOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="视频排序" prop="sort">
<el-input v-model="form.sort" placeholder="请输入视频排序" />
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input type="textarea" v-model="form.remarks" placeholder="请输入备注" />
</el-form-item>
......@@ -191,7 +211,7 @@ export default {
pageSize: 10,
videoName: null,
videoResource: null,
isDel: null,
isDel: '0',
remarks: null,
videoType: null
},
......@@ -208,10 +228,18 @@ export default {
videoType: [
{ required: true, message: "请选择视频类型", trigger: "change" }
]
}
},
huaxinKindOptions: [],
honghaiKindOptions: [],
};
},
created() {
this.getDicts("t_huaxin_video_kind").then(response => {
this.huaxinKindOptions = response.data;
});
this.getDicts("t_honghai_video_kind").then(response => {
this.honghaiKindOptions = response.data;
});
this.getList();
},
methods: {
......@@ -224,6 +252,13 @@ export default {
this.loading = false;
});
},
// 视频分类字典翻译
kindFormat(row, column) {
if(row.videoType == '2'){
return this.selectDictLabel(this.honghaiKindOptions, row.kind);
}
return this.selectDictLabel(this.huaxinKindOptions, row.kind);
},
// 取消按钮
cancel() {
this.open = false;
......@@ -239,7 +274,7 @@ export default {
createTime: null,
isDel: null,
remarks: null,
videoType: null
videoType: '1'
};
this.resetForm("form");
},
......
......@@ -16,9 +16,9 @@
<el-tree class="leftTree" :data="data">
<div slot-scope="{ node, data }" @dblclick="handleNodeClick(data)" style="width:100%">
<div style="width:100%">
<span class="tree_span ">
<i class=" el-icon-video-camera"/>{{data.videoName}}
</span>
<span class="tree_span ">
<i class=" el-icon-video-camera"/>{{data.videoName}}
</span>
</div>
</div>
</el-tree>
......@@ -27,9 +27,9 @@
<el-tree class="leftTree" :data="data">
<div slot-scope="{ node, data }" @dblclick="handleNodeClick(data)" style="width:100%">
<div style="width:100%">
<span class="tree_span ">
<i class=" el-icon-video-camera"/>{{data.videoName}}
</span>
<span class="tree_span ">
<i class=" el-icon-video-camera"/>{{data.videoName}}
</span>
</div>
</div>
</el-tree>
......@@ -48,9 +48,11 @@ export default {
data: [],
videoName: "",
params: {
videoType: "1"
videoType: "1",
isDel: "0"
},
activeName: "1"
activeName: "1",
kindOptions: []
};
},
created(){
......@@ -58,15 +60,31 @@ export default {
},
methods: {
handleNodeClick(data) {
this.$emit('playVideo',data);
if(data.videoResource){
this.$emit('playVideo',data);
}
},
getVideoInfo(){
videoInfoList(this.params).then(res =>{
if(res.code == 200 && res.data){
this.data = res.data;
//this.data = res.data;
this.getKindByType(res.data);
}
})
},
// 获取树数据
getTreeData(data){
let treeData = [];
this.kindOptions.forEach(item =>{
let kindData = {videoName: item.dictLabel,children: []};
let videoInfo = data.filter(video => video.kind == item.dictValue ).sort((a, b) => Number(a.sort) - Number(b.sort));
if(videoInfo){
kindData.children = videoInfo
}
treeData.push(kindData);
})
this.data = treeData;
},
search(){
this.params.videoName = this.videoName;
this.getVideoInfo();
......@@ -74,6 +92,19 @@ export default {
handleClick(tab, event) {
this.params.videoType = tab.name;
this.getVideoInfo();
},
getKindByType(data){
if(this.activeName == '1'){
this.getDicts("t_huaxin_video_kind").then(response => {
this.kindOptions = response.data;
this.getTreeData(data);
});
}else{
this.getDicts("t_honghai_video_kind").then(response => {
this.kindOptions = response.data;
this.getTreeData(data);
});
}
}
}
}
......
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