update with line nav record
This commit is contained in:
parent
70ea95ea98
commit
80925cb252
Binary file not shown.
|
|
@ -1,9 +1,5 @@
|
|||
package cn.tsy.data.idsse.dsds.mapper.sample;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import cn.hme.framework.jdbc.annotation.HmeMapper;
|
||||
import cn.hme.framework.jdbc.mapper.IHmeMapper;
|
||||
import cn.tsy.data.idsse.dsds.model.sample.SampleLineTrack;
|
||||
|
|
@ -11,5 +7,5 @@ import cn.tsy.data.idsse.dsds.model.sample.SampleLineTrack;
|
|||
@HmeMapper
|
||||
public interface SampleLineTrackMapper extends IHmeMapper<SampleLineTrack> {
|
||||
|
||||
public Map<String,Object> totalTrack(@Param("line_id") int line_id);
|
||||
//public Map<String,Object> totalTrack(@Param("line_id") int line_id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,10 +14,14 @@ import java.time.LocalDateTime;
|
|||
*/
|
||||
@HmeTable(name = "SAMPLE_LINE_TRACK", key="TSY_ID")
|
||||
public class SampleLineTrack extends HmeBean{
|
||||
private static final long serialVersionUID = -8131899118331192635L;
|
||||
private static final long serialVersionUID = -6328971140367373295L;
|
||||
private Integer tsy_id;
|
||||
//数据集内部编号
|
||||
private Integer dataset_id;
|
||||
//测线作业内部编号
|
||||
private Integer line_id;
|
||||
//步骤
|
||||
private String track_index;
|
||||
//轨迹经度
|
||||
private String track_lon;
|
||||
//轨迹纬度
|
||||
|
|
@ -33,6 +37,20 @@ public class SampleLineTrack extends HmeBean{
|
|||
this.tsy_id = tsy_id;
|
||||
}
|
||||
|
||||
/****
|
||||
* 数据集内部编号
|
||||
*/
|
||||
public Integer getDataset_id() {
|
||||
return this.dataset_id;
|
||||
}
|
||||
|
||||
/****
|
||||
* 数据集内部编号
|
||||
*/
|
||||
public void setDataset_id(Integer dataset_id) {
|
||||
this.dataset_id = dataset_id;
|
||||
}
|
||||
|
||||
/****
|
||||
* 测线作业内部编号
|
||||
*/
|
||||
|
|
@ -47,6 +65,20 @@ public class SampleLineTrack extends HmeBean{
|
|||
this.line_id = line_id;
|
||||
}
|
||||
|
||||
/****
|
||||
* 步骤
|
||||
*/
|
||||
public String getTrack_index() {
|
||||
return this.track_index;
|
||||
}
|
||||
|
||||
/****
|
||||
* 步骤
|
||||
*/
|
||||
public void setTrack_index(String track_index) {
|
||||
this.track_index = track_index;
|
||||
}
|
||||
|
||||
/****
|
||||
* 轨迹经度
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ import cn.hme.framework.web.control.Ajax;
|
|||
import cn.hme.framework.web.control.AjaxControl;
|
||||
import cn.hme.framework.web.exception.BusinessException;
|
||||
import cn.tsy.data.idsse.dsds.model.sample.SampleLineTrack;
|
||||
import cn.tsy.idsse.dsds.helper.DSDSWebHelper;
|
||||
import cn.tsy.idsse.dsds.service.sample.SampleLineTrackService;
|
||||
|
||||
@RestController
|
||||
|
|
@ -30,12 +29,12 @@ public class SampleLineTrackControl extends AjaxControl {
|
|||
|
||||
@CrossOrigin
|
||||
@RequestMapping("upload.htm")
|
||||
public Ajax upload(int line_id, MultipartFile file) {
|
||||
DSDSWebHelper.getFrameOptr(true);
|
||||
public Ajax upload(int dataset_id, MultipartFile file) {
|
||||
// DSDSWebHelper.getFrameOptr(true);
|
||||
File f = FileHelper.fromUpload(file);
|
||||
List<String> array = FileHelper.readFileAsArray(f);
|
||||
f.delete();
|
||||
List<SampleLineTrack> list = this.sTrack.uploadTrack(line_id, array,file.getOriginalFilename(), DSDSWebHelper.getFrameOptr(true));
|
||||
List<SampleLineTrack> list = this.sTrack.uploadTrack(dataset_id, array,file.getOriginalFilename());
|
||||
if (list.size() == 0)
|
||||
throw new BusinessException("未找到有效的轨迹文件(已忽略相同的记录)!");
|
||||
return new Ajax(file.getOriginalFilename());
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public class DSDSSearchControl extends AjaxControl {
|
|||
@RequestMapping("page.htm")
|
||||
public Ajax page(Integer group, Integer limit, Integer start, String search_type, String order, String type, String return_type, String search_value, Integer[] ids) {
|
||||
// String where += "select t.tsy_id from sample_dataset t,voyage y where y.tsy_id=t.voyage_id";
|
||||
String where += "";
|
||||
String where = "";
|
||||
if ("航次名称".equals(search_type)) {
|
||||
if (ids == null || ids.length < 1) {
|
||||
where += " and t.voyage_name like concat('%','" + search_value + "','%') ";
|
||||
|
|
|
|||
|
|
@ -7,15 +7,16 @@ import java.util.List;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import cn.hme.data.model.frame.optr.FrameOptr;
|
||||
import cn.hme.framework.helper.date.LocalDateHelper;
|
||||
import cn.hme.framework.helper.lang.StringHelper;
|
||||
import cn.hme.framework.jdbc.provider.builder.SqlBuilder;
|
||||
import cn.hme.framework.jdbc.provider.builder.SqlCondition;
|
||||
import cn.hme.framework.web.exception.BusinessException;
|
||||
import cn.hme.framework.web.helper.FrameAssertHelper;
|
||||
import cn.tsy.data.idsse.dsds.mapper.sample.SampleDatasetMapper;
|
||||
import cn.tsy.data.idsse.dsds.mapper.sample.SampleLineMapper;
|
||||
import cn.tsy.data.idsse.dsds.mapper.sample.SampleLineTrackMapper;
|
||||
import cn.tsy.data.idsse.dsds.model.sample.SampleDataset;
|
||||
import cn.tsy.data.idsse.dsds.model.sample.SampleLine;
|
||||
import cn.tsy.data.idsse.dsds.model.sample.SampleLineTrack;
|
||||
|
||||
|
|
@ -25,21 +26,34 @@ public class SampleLineTrackService {
|
|||
private SampleLineTrackMapper mTrack;
|
||||
@Autowired
|
||||
private SampleLineMapper mLine;
|
||||
@Autowired
|
||||
private SampleDatasetMapper mDataset;
|
||||
|
||||
public List<SampleLineTrack> uploadTrack(int line_id, List<String> array, String file_name, FrameOptr optr) {
|
||||
public List<SampleLineTrack> uploadTrack(int dataset_id, List<String> array, String file_name) {
|
||||
FrameAssertHelper.hasValue(array, "测线轨迹文件为空,请检查!");
|
||||
SampleDataset ds = this.mDataset.find(dataset_id);
|
||||
FrameAssertHelper.isNotNull(ds, "未找到指定数据集,请检查!");
|
||||
this.mTrack.deleteByColumn("dataset_id", dataset_id);
|
||||
int index = 1;
|
||||
|
||||
List<SampleLineTrack> navArray = new ArrayList<>();
|
||||
SampleLine line = this.mLine.find(line_id);
|
||||
FrameAssertHelper.isNotNull(line, "未找到指定数据集,请检查!");
|
||||
this.mTrack.deleteByColumn("line_id", line_id);
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
if (array.get(i).trim().length() == 0)
|
||||
if (array.get(i).trim().length() == 0) {
|
||||
this.update(file_name,ds, index, navArray);
|
||||
break;
|
||||
}
|
||||
String[] values = StringHelper.splitWithSpace(array.get(i));
|
||||
if (values[0].equals(">>")) {
|
||||
this.update(file_name, ds, index, navArray);
|
||||
navArray = new ArrayList<>();
|
||||
index++;
|
||||
continue;
|
||||
}
|
||||
if (values.length < 3) {
|
||||
throwError(i, "列不足,至少需要3列");
|
||||
}
|
||||
|
||||
// 110.565232 17.370000 2023-05-20-13:55:27
|
||||
String lon = values[0];
|
||||
String lat = values[1];
|
||||
String time = values[2];
|
||||
|
|
@ -71,26 +85,41 @@ public class SampleLineTrackService {
|
|||
if (curTime == null)
|
||||
throwError(i, "时间[" + time + "]格式错误,样例 2023-09-18-21:58:35");
|
||||
// 判断通过
|
||||
|
||||
// 判断时间是否重复了
|
||||
// List<SampleLineTrack> vArray = this.mTrack.selectList(SqlBuilder.create().addSqlCondition(SqlCondition.of("line_id", line_id)).addSqlCondition(SqlCondition.of("track_time", curTime)));
|
||||
// if (vArray.size() == 0) {
|
||||
SampleLineTrack nav = new SampleLineTrack();
|
||||
nav.setTrack_lat(lat);
|
||||
nav.setTrack_lon(lon);
|
||||
nav.setTrack_time(curTime);
|
||||
nav.setLine_id(line_id);
|
||||
// 判断时间是否重复了
|
||||
// List<SampleLineTrack> vArray = this.mTrack.selectList(SqlBuilder.create().addSqlCondition(SqlCondition.of("line_id", line_id)).addSqlCondition(SqlCondition.of("track_time", curTime)));
|
||||
// if (vArray.size() == 0) {
|
||||
this.mTrack.insert(nav);
|
||||
navArray.add(nav);
|
||||
navArray.add(nav);
|
||||
// }
|
||||
}
|
||||
if (navArray.size() > 0) {
|
||||
SampleLine ds = new SampleLine();
|
||||
ds.setTsy_id(line_id);
|
||||
ds.setTrack_file_name(file_name);
|
||||
this.mLine.update(ds);
|
||||
|
||||
return navArray;
|
||||
}
|
||||
|
||||
public void update(String file_name, SampleDataset ds, int index, List<SampleLineTrack> navArray) {
|
||||
if (navArray.size() == 0)
|
||||
return;
|
||||
// 查找是否有对应的测线
|
||||
String sn = StringHelper.leftPadding(index + "", 2, '0');
|
||||
List<SampleLine> lineArray = this.mLine.selectList(SqlBuilder.create().addSqlCondition(SqlCondition.of("dataset_id", ds.getTsy_id())).addSqlCondition(SqlCondition.of("sample_seq", sn)));
|
||||
if (lineArray.size() > 0) {
|
||||
for (SampleLineTrack nav : navArray) {
|
||||
nav.setDataset_id(ds.getTsy_id());
|
||||
nav.setTrack_index(sn);
|
||||
nav.setLine_id(lineArray.get(0).getTsy_id());
|
||||
this.mTrack.insert(nav);
|
||||
}
|
||||
SampleLine line = new SampleLine();
|
||||
line.setTsy_id(lineArray.get(0).getTsy_id());
|
||||
line.setTrack_file_name(file_name);
|
||||
this.mLine.update(line);
|
||||
|
||||
}
|
||||
return navArray;
|
||||
navArray = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void throwError(int row, String msg) {
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue