| | |
| | | |
| | | -- insert into nsl.simu (name, service_name, type, area_type, area_name, status, geom) values ('颿µæ¨¡æ-0416', '20250416100000', 1, 1, '大å
´åº', 0, ST_GeomFromText('MULTIPOLYGON(((116.666748 39.639859,116.659403 39.626287,116.665956 39.654698,116.666748 39.639859)))')); |
| | | |
| | | select *, st_astext(geom) geom from nsl.simu; |
| | | select id, name, service_name, type, area_type, area_name, status, result, create_time, create_user, update_time, update_user, bak, data, st_astext(geom) geom from nsl.simu order by id desc; |
| | | -- update nsl.simu set status = 0, area_name = 'æ¿å±±åº' where id = 24; |
| | | ---------------------------------------------- 2.æ¨æ¼åºå |
| | | -- drop table if exists nsl.region; |
| | | create table nsl.region ( |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.nsl.service; |
| | | |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.se.nsl.config.PropertiesConfig; |
| | | import com.se.nsl.domain.po.DataPo; |
| | | import com.se.nsl.domain.po.Simu; |
| | | import com.se.nsl.domain.po.SimuData; |
| | | import com.se.nsl.helper.StringHelper; |
| | | import com.se.nsl.helper.WebHelper; |
| | | import lombok.SneakyThrows; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.sql.Timestamp; |
| | | import java.util.Date; |
| | | import java.util.concurrent.ExecutorService; |
| | | import java.util.concurrent.Executors; |
| | | |
| | | @Slf4j |
| | | @Service |
| | | @SuppressWarnings("ALL") |
| | | public class ResolveService { |
| | | @Resource |
| | | SimuService simuService; |
| | | |
| | | @Resource |
| | | PropertiesConfig config; |
| | | |
| | | public int start(Simu simu) { |
| | | Date now = new Date(); |
| | | String date = StringHelper.YMDHMS2_FORMAT.format(now); |
| | | |
| | | SimuData data = JSON.parseObject(simu.getData(), SimuData.class); |
| | | data.setInPath(date); |
| | | data.setOutPath(date); |
| | | data.setEpsg(4548); |
| | | |
| | | simu.setServiceName(date); |
| | | simu.setStatus(1); // 0-å建仿çï¼1-é¢å¤çï¼2-åæä¸ï¼10-宿ï¼20-åºé |
| | | simu.setUpdateTime(new Timestamp(now.getTime())); |
| | | |
| | | int rows = simuService.updateById(simu); |
| | | if (rows > 0) { |
| | | asyncCall(simu); |
| | | } |
| | | |
| | | return rows; |
| | | } |
| | | |
| | | private void asyncCall(Simu simu) { |
| | | ExecutorService executor = Executors.newSingleThreadExecutor(); |
| | | executor.execute(new Runnable() { |
| | | @Override |
| | | @SneakyThrows |
| | | public void run() { |
| | | cope(simu); |
| | | } |
| | | }); |
| | | executor.shutdown(); |
| | | } |
| | | |
| | | private void cope(Simu simu) { |
| | | try { |
| | | DataPo data = JSONUtil.toBean(simu.getData(), DataPo.class); |
| | | |
| | | //update(simu, 2, null); |
| | | //gedbService.copeVectors(token, data, db); |
| | | |
| | | //update(simu, 3, null); |
| | | //gedbService.copeDem(token, data); |
| | | |
| | | //update(simu, 4, null); |
| | | //uwService.createRainFile(data); |
| | | |
| | | update(simu, 10, "宿"); |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage(), ex); |
| | | update(simu, 20, ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | | private void update(Simu simu, int status, String rs) { |
| | | simu.setStatus(status); |
| | | if (null != rs) simu.setResult(rs); |
| | | simu.setUpdateTime(WebHelper.getCurrentTimestamp()); |
| | | |
| | | simuService.updateById(simu); |
| | | } |
| | | } |