Browse Source

fix:bug

release-sy-v1.0.0
“lyd” 2 weeks ago
parent
commit
b2ae0eedba
  1. 1
      shuili-system/src/main/java/com/kms/yg/cz/service/MonitorService.java
  2. 31
      shuili-system/src/main/java/com/kms/yg/df/service/BsSgcDfSpPlayService.java
  3. 3
      shuili-system/src/main/java/com/kms/yxgh/sz/mapper/SzCheckingProblemV2Mapper.java
  4. 2
      shuili-system/src/main/java/com/kms/yxgh/sz/mapper/SzCheckingRecordV2Mapper.java
  5. 2
      shuili-system/src/main/java/com/kms/yxgh/sz/mapper/SzCheckingV2Mapper.java
  6. 2
      shuili-system/src/main/java/com/kms/yxgh/sz/mapper/SzYhV2Mapper.java

1
shuili-system/src/main/java/com/kms/yg/cz/service/MonitorService.java

@ -401,6 +401,7 @@ public class MonitorService {
attResTaskViewDto.setLastYearToday(msHdmRsvrLast.getRz()); attResTaskViewDto.setLastYearToday(msHdmRsvrLast.getRz());
} }
} }
attResTaskViewDto.setStcd(skRelStRes.getStcd());
getYqInfo(attResTaskViewDto); getYqInfo(attResTaskViewDto);
return attResTaskViewDto; return attResTaskViewDto;
} }

31
shuili-system/src/main/java/com/kms/yg/df/service/BsSgcDfSpPlayService.java

@ -17,11 +17,12 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod; import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.client.RestClientException; import org.springframework.web.client.ResourceAccessException;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -120,10 +121,10 @@ public class BsSgcDfSpPlayService {
DfSpPlayQueDto dfSpPlayQueDto = new DfSpPlayQueDto(); DfSpPlayQueDto dfSpPlayQueDto = new DfSpPlayQueDto();
dfSpPlayQueDto.setCameraId(cameraId); dfSpPlayQueDto.setCameraId(cameraId);
DfSpPlayDto play = play(dfSpPlayQueDto); DfSpPlayDto play = play(dfSpPlayQueDto);
if (!Objects.isNull(play)) { if (null != play) {
dfSpPlayGridDto.getUrlsMapList().add(play.getUrlsMap()); dfSpPlayGridDto.getUrlsMapList().add(play.getUrlsMap());
} }
} catch (RestClientException e) { } catch (Exception e) {
log.error("请求失败: {}", e.getMessage()); log.error("请求失败: {}", e.getMessage());
} }
}, executor); }, executor);
@ -135,25 +136,28 @@ public class BsSgcDfSpPlayService {
} }
public DfSpPlayDto play(DfSpPlayQueDto dto) { public DfSpPlayDto play(DfSpPlayQueDto dto) {
DfSpPlayDto rest = new DfSpPlayDto();
try { try {
// 2. 获取令牌 // 2. 获取令牌
String spOauthTokenUrlJson = getToken(dto); String spOauthTokenUrlJson = getToken(dto);
JSONObject tokenJson = parseJson(spOauthTokenUrlJson); JSONObject tokenJson = parseJson(spOauthTokenUrlJson);
if (!isSuccess(tokenJson)) { if (!isSuccess(tokenJson)) {
log.error("获取令牌失败,{}", tokenJson); log.error("获取令牌失败,{}", tokenJson);
return rest; return null;
} }
JSONObject tokenData = tokenJson.getJSONObject("data"); JSONObject tokenData = tokenJson.getJSONObject("data");
if (tokenData == null) { if (tokenData == null) {
log.error("令牌数据为空"); log.error("令牌数据为空");
return rest; return null;
} }
String token = String.valueOf(tokenData.get("token")); String token = String.valueOf(tokenData.get("token"));
dto.setToken(token); dto.setToken(token);
// 3. 调用第三方接口获取播放地址 // 3. 调用第三方接口获取播放地址
String playOauthTokenUrlJson = getSpPlayUrls(dto); String playOauthTokenUrlJson = getSpPlayUrls(dto);
if (null == playOauthTokenUrlJson) {
return null;
}
VideoInfo videoInfo = JSON.parseObject(playOauthTokenUrlJson, VideoInfo.class); VideoInfo videoInfo = JSON.parseObject(playOauthTokenUrlJson, VideoInfo.class);
DfSpPlayDto rest = new DfSpPlayDto();
if (videoInfo.isSuccess()) { if (videoInfo.isSuccess()) {
videoInfo.getData().getUrls().setCameraId(dto.getCameraId()); videoInfo.getData().getUrls().setCameraId(dto.getCameraId());
rest.setUrlsMap(videoInfo.getData().getUrls()); rest.setUrlsMap(videoInfo.getData().getUrls());
@ -162,7 +166,7 @@ public class BsSgcDfSpPlayService {
} catch (Exception e) { } catch (Exception e) {
log.error("playError: {}", e.getMessage(), e); log.error("playError: {}", e.getMessage(), e);
} }
return rest; return null;
} }
@Data @Data
@ -216,9 +220,20 @@ public class BsSgcDfSpPlayService {
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.addAll(headValues); headers.addAll(headValues);
HttpEntity<?> requestEntity = new HttpEntity(paramMap, headers); HttpEntity<?> requestEntity = new HttpEntity(paramMap, headers);
// 创建带超时的RequestFactory
HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory();
// 3.5秒
factory.setConnectTimeout(3500);
// 3.5秒
factory.setReadTimeout(3500);
// 创建临时RestTemplate
RestTemplate tempTemplate = new RestTemplate(factory);
try { try {
seqResult2 = restTemplate.postForObject(videoUrl + SP_PLAY_URL, requestEntity, String.class, uriVariables); seqResult2 = tempTemplate.postForObject(videoUrl + SP_PLAY_URL, requestEntity, String.class, uriVariables);
log.info("获取播放地址响应SP_PLAY_URL: {}", JSONObject.toJSONString(seqResult2)); log.info("获取播放地址响应SP_PLAY_URL: {}", JSONObject.toJSONString(seqResult2));
} catch (ResourceAccessException e) {
log.error("获取播放地址超时(3.5秒):{}", e.getMessage());
return null;
} catch (Exception e) { } catch (Exception e) {
log.error("请求接口SP_PLAY_URL返回异常: {}", e.getMessage()); log.error("请求接口SP_PLAY_URL返回异常: {}", e.getMessage());
} }

3
shuili-system/src/main/java/com/kms/yxgh/sz/mapper/SzCheckingProblemV2Mapper.java

@ -10,7 +10,6 @@ import com.kms.yxgh.common.enums.PatrolMaintenanceCategory;
import com.kms.yxgh.sz.domain.SzCheckingProblemV2; import com.kms.yxgh.sz.domain.SzCheckingProblemV2;
import com.kms.yxgh.sz.dto.v2.SzProblemV2Dto; import com.kms.yxgh.sz.dto.v2.SzProblemV2Dto;
import com.kms.yxgh.sz.dto.v2.SzRecordSearchV2Dto; import com.kms.yxgh.sz.dto.v2.SzRecordSearchV2Dto;
import com.shuili.common.core.domain.SearchParam;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@ -33,7 +32,7 @@ public interface SzCheckingProblemV2Mapper extends BaseMapper<SzCheckingProblemV
@Select("<script> " + @Select("<script> " +
"select base.adcd code ,count(1) sum " + "select base.adcd code ,count(1) sum " +
"from bs_sgc_sz_xcqx xm " + "from bs_sgc_sz_xcqx xm " +
"left join att_dike_base base on base.dike_code=xm.waga_code " + "left join att_waga_base base on base.waga_code=xm.waga_code " +
"where 1=1 " + "where 1=1 " +
"<if test='data.startTime != null'> and xm.create_time &gt;= #{data.startTime} </if> " + "<if test='data.startTime != null'> and xm.create_time &gt;= #{data.startTime} </if> " +
"<if test='data.endTime != null'> and xm.create_time &lt;= #{data.endTime} </if> " + "<if test='data.endTime != null'> and xm.create_time &lt;= #{data.endTime} </if> " +

2
shuili-system/src/main/java/com/kms/yxgh/sz/mapper/SzCheckingRecordV2Mapper.java

@ -31,7 +31,7 @@ public interface SzCheckingRecordV2Mapper extends BaseMapper<SzCheckingRecord> {
@Select("<script> " + @Select("<script> " +
"select base.adcd code ,count(1) sum " + "select base.adcd code ,count(1) sum " +
"from bs_sgc_sz_xsxcjl xm " + "from bs_sgc_sz_xsxcjl xm " +
"left join att_dike_base base on base.dike_code=xm.waga_code " + "left join att_waga_base base on base.waga_code=xm.waga_code " +
"where 1=1 " + "where 1=1 " +
"<if test='data.startTime != null'> and xm.create_time &gt;= #{data.startTime} </if> " + "<if test='data.startTime != null'> and xm.create_time &gt;= #{data.startTime} </if> " +
"<if test='data.endTime != null'> and xm.create_time &lt;= #{data.endTime} </if> " + "<if test='data.endTime != null'> and xm.create_time &lt;= #{data.endTime} </if> " +

2
shuili-system/src/main/java/com/kms/yxgh/sz/mapper/SzCheckingV2Mapper.java

@ -29,7 +29,7 @@ public interface SzCheckingV2Mapper extends BaseMapper<SzCheckingV2ProjectManage
@Select("<script> " + @Select("<script> " +
"select base.adcd code ,count(1) sum " + "select base.adcd code ,count(1) sum " +
"from bs_sgc_sz_xmgl xm " + "from bs_sgc_sz_xmgl xm " +
"left join att_dike_base base on base.dike_code=xm.waga_code " + "left join att_waga_base base on base.waga_code = xm.waga_code " +
"where 1=1 " + "where 1=1 " +
"<if test='data.adcdQx != null and data.adcdQx != \"\"'>" + "<if test='data.adcdQx != null and data.adcdQx != \"\"'>" +
"and base.adcd like concat(#{data.adcdQx}, '%') " + "and base.adcd like concat(#{data.adcdQx}, '%') " +

2
shuili-system/src/main/java/com/kms/yxgh/sz/mapper/SzYhV2Mapper.java

@ -35,7 +35,7 @@ public interface SzYhV2Mapper extends BaseMapper<SzYhV2> {
@Select("<script> " + @Select("<script> " +
"select base.adcd code ,count(1) sum " + "select base.adcd code ,count(1) sum " +
"from bs_sgc_sz_xcyj xm " + "from bs_sgc_sz_xcyj xm " +
"left join att_dike_base base on base.dike_code=xm.waga_code " + "left join att_waga_base base on base.waga_code=xm.waga_code " +
"where 1=1 " + "where 1=1 " +
"<if test='data.startTime != null'> and xm.create_time &gt;= #{data.startTime} </if> " + "<if test='data.startTime != null'> and xm.create_time &gt;= #{data.startTime} </if> " +
"<if test='data.endTime != null'> and xm.create_time &lt;= #{data.endTime} </if> " + "<if test='data.endTime != null'> and xm.create_time &lt;= #{data.endTime} </if> " +

Loading…
Cancel
Save