Commit 340b3168 authored by 单奇雲's avatar 单奇雲

bug

parents 427d3c0c b0822c9c
...@@ -7,13 +7,13 @@ import java.net.URLConnection; ...@@ -7,13 +7,13 @@ import java.net.URLConnection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.itextpdf.text.pdf.PdfStructTreeController.returnType;
import com.yeejoin.amos.fas.core.util.CommonResponse; import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil; import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
...@@ -25,6 +25,10 @@ import io.swagger.annotations.ApiOperation; ...@@ -25,6 +25,10 @@ import io.swagger.annotations.ApiOperation;
@Api(tags="天气api") @Api(tags="天气api")
public class WeatherController extends BaseController { public class WeatherController extends BaseController {
@Value("${param.weather.url}")
private String weatherUrl;
@ApiOperation(httpMethod = "GET",value = "天气查询", notes = "天气查询") @ApiOperation(httpMethod = "GET",value = "天气查询", notes = "天气查询")
@GetMapping("/{address}") @GetMapping("/{address}")
public CommonResponse getWeather(@PathVariable("address") String address) { public CommonResponse getWeather(@PathVariable("address") String address) {
...@@ -32,7 +36,7 @@ public class WeatherController extends BaseController { ...@@ -32,7 +36,7 @@ public class WeatherController extends BaseController {
String result = ""; String result = "";
BufferedReader in = null; BufferedReader in = null;
try { try {
String urlNameString = "http://t.weather.sojson.com/api/weather/city/" + address; String urlNameString = weatherUrl + address;
URL realUrl = new URL(urlNameString); URL realUrl = new URL(urlNameString);
// 打开和URL之间的连接 // 打开和URL之间的连接
......
...@@ -3,6 +3,8 @@ package com.yeejoin.amos.fas.business.dao.repository; ...@@ -3,6 +3,8 @@ package com.yeejoin.amos.fas.business.dao.repository;
import com.yeejoin.amos.fas.dao.entity.EquipmentFireEquipment; import com.yeejoin.amos.fas.dao.entity.EquipmentFireEquipment;
import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Modifying;
import java.util.List;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -19,6 +21,8 @@ public interface IEquipmentFireEquipmentDao extends BaseDao<EquipmentFireEquipme ...@@ -19,6 +21,8 @@ public interface IEquipmentFireEquipmentDao extends BaseDao<EquipmentFireEquipme
*/ */
@Query(value = "select count(1) from f_equipment_fire_equipment WHERE equipment_id = ?1 and fire_equipment_id = ?2", nativeQuery = true) @Query(value = "select count(1) from f_equipment_fire_equipment WHERE equipment_id = ?1 and fire_equipment_id = ?2", nativeQuery = true)
int findByEqmtIdAndFireEqmtId(Long equipmentId, Long fireEquipmentId); int findByEqmtIdAndFireEqmtId(Long equipmentId, Long fireEquipmentId);
List<EquipmentFireEquipment> findAllByEquipmentId(Long equipmentId);
@Query(value = "SELECT count(1) FROM `f_equipment_fire_equipment` WHERE fire_equipment_id in ?1", nativeQuery = true) @Query(value = "SELECT count(1) FROM `f_equipment_fire_equipment` WHERE fire_equipment_id in ?1", nativeQuery = true)
int countImpEquipByIds(String[] ids); int countImpEquipByIds(String[] ids);
......
...@@ -133,6 +133,11 @@ public class EquipmentServiceImpl implements IEquipmentService { ...@@ -133,6 +133,11 @@ public class EquipmentServiceImpl implements IEquipmentService {
equipment=equipment1.get(); equipment=equipment1.get();
} }
if (equipment != null) { if (equipment != null) {
List<EquipmentFireEquipment> eqFireEqs = equipmentFireEquipmentDao.findAllByEquipmentId(equipment.getId());
if(!eqFireEqs.isEmpty()){
equipmentFireEquipmentDao.deleteAll(eqFireEqs);
}
this.iEquipmentDao.deleteById(Long.parseLong(id)); this.iEquipmentDao.deleteById(Long.parseLong(id));
} else { } else {
throw new Exception("找不到指定的对象:" + id); throw new Exception("找不到指定的对象:" + id);
......
spring.application.name = Amos-autosys-sqy spring.application.name = Amos-autosys
server.port = 8083 server.port = 8083
...@@ -52,3 +52,4 @@ windows.img.path = F:\\ ...@@ -52,3 +52,4 @@ windows.img.path = F:\\
linux.img.path = / linux.img.path = /
param.safetyIndexChange.cron = 0 0 2 * * ? param.safetyIndexChange.cron = 0 0 2 * * ?
param.weather.url = http://t.weather.sojson.com/api/weather/city/
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