| | |
| | | import com.se.nsl.service.RealTimeSimulationService; |
| | | import com.se.nsl.service.ResolveService; |
| | | import com.se.nsl.service.SimuService; |
| | | import com.se.nsl.utils.SimulateType; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.gdal.ogr.Geometry; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.IOException; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | @Api(tags = "03-推演模拟") |
| | |
| | | |
| | | int rows = simuService.insert(simu); |
| | | System.out.println(String.format("id:%s", simu.getId())); |
| | | |
| | | if (rows > 0 && (null == data.getRainfalls() || data.getRainfalls().size() < 2)) { |
| | | resolveService.createRainfall(simu); |
| | | simuService.updateById(simu); |
| | | Integer type = data.getType(); |
| | | SimulateType simulateType = SimulateType.of(type); |
| | | if (simulateType == SimulateType.HISTORY) { |
| | | if (rows > 0 && (null == data.getRainfalls() || data.getRainfalls().size() < 2)) { |
| | | resolveService.createRainfall(simu); |
| | | simuService.updateById(simu); |
| | | } |
| | | } |
| | | JSONObject json = new JSONObject(); |
| | | json.put("id", simu.getId()); |
| | |
| | | //if (simu.getStatus() != 0) return fail("方案正在运行或已完成"); |
| | | if (StringUtils.isEmpty(simu.getGeom())) return fail("方案的图形为空"); |
| | | |
| | | int rows = resolveService.start(simu); |
| | | |
| | | return success("ok"); |
| | | Short type = simu.getType(); |
| | | SimulateType simulateType = SimulateType.of(type); |
| | | if (simulateType == SimulateType.HISTORY) { |
| | | int rows = resolveService.start(simu); |
| | | return success("ok"); |
| | | } else if (simulateType == SimulateType.REAL_TIME) { |
| | | String s = rts.realTimeSimulate(simu); |
| | | return success(s); |
| | | } |
| | | return fail("模拟类型暂不支持"); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |