|
|
@ -24,7 +24,6 @@ import com.iflytop.profilometer.service.RailProfileDrawerService; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.UUID; |
|
|
|
|
|
|
|
import cn.hutool.json.JSONArray; |
|
|
@ -77,28 +76,28 @@ public class MeasureApi { |
|
|
|
/** |
|
|
|
* 保存测量 |
|
|
|
*/ |
|
|
|
public String save(Map<String, String> params) { |
|
|
|
public String save(JSONObject params) { |
|
|
|
ProfileRecordDao profileRecordDao = new ProfileRecordDao(context); |
|
|
|
ProfileRecordPointSetDao profileRecordPointSetDao = new ProfileRecordPointSetDao(context); |
|
|
|
ProfileRecordDescription profileRecordDescription = new ProfileRecordDescription(); |
|
|
|
profileRecordDescription.setUuid(UUID.randomUUID().toString()); |
|
|
|
profileRecordDescription.setOperator(params.get("operator")); |
|
|
|
profileRecordDescription.setName(params.get("name")); |
|
|
|
profileRecordDescription.setTljCode(params.get("tljCode")); |
|
|
|
profileRecordDescription.setGwdCode(params.get("gwdCode")); |
|
|
|
profileRecordDescription.setXmCode(params.get("xmCode")); |
|
|
|
profileRecordDescription.setStationCode(params.get("stationCode")); |
|
|
|
profileRecordDescription.setDataType(params.get("dataType")); |
|
|
|
profileRecordDescription.setDataSource(params.get("dataSource")); |
|
|
|
profileRecordDescription.setRailSize(params.get("railSize")); |
|
|
|
profileRecordDescription.setLineClassify(params.get("lineClassify")); |
|
|
|
profileRecordDescription.setBatch(params.get("batch")); |
|
|
|
profileRecordDescription.setXbCode(params.get("xbCode")); |
|
|
|
profileRecordDescription.setMileage(params.get("mileage")); |
|
|
|
profileRecordDescription.setUnitType(params.get("unitType")); |
|
|
|
profileRecordDescription.setExtraDesc(params.get("extraDesc")); |
|
|
|
profileRecordDescription.setTurnoutNum(params.get("turnoutNum")); |
|
|
|
profileRecordDescription.setSleeperNum(params.get("sleeperNum")); |
|
|
|
profileRecordDescription.setOperator(params.getStr("operator")); |
|
|
|
profileRecordDescription.setName(params.getStr("name")); |
|
|
|
profileRecordDescription.setTljCode(params.getStr("tljCode")); |
|
|
|
profileRecordDescription.setGwdCode(params.getStr("gwdCode")); |
|
|
|
profileRecordDescription.setXmCode(params.getStr("xmCode")); |
|
|
|
profileRecordDescription.setStationCode(params.getStr("stationCode")); |
|
|
|
profileRecordDescription.setDataType(params.getStr("dataType")); |
|
|
|
profileRecordDescription.setDataSource(params.getStr("dataSource")); |
|
|
|
profileRecordDescription.setRailSize(params.getStr("railSize")); |
|
|
|
profileRecordDescription.setLineClassify(params.getStr("lineClassify")); |
|
|
|
profileRecordDescription.setBatch(params.getStr("batch")); |
|
|
|
profileRecordDescription.setXbCode(params.getStr("xbCode")); |
|
|
|
profileRecordDescription.setMileage(params.getStr("mileage")); |
|
|
|
profileRecordDescription.setUnitType(params.getStr("unitType")); |
|
|
|
profileRecordDescription.setExtraDesc(params.getStr("extraDesc")); |
|
|
|
profileRecordDescription.setTurnoutNum(params.getStr("turnoutNum")); |
|
|
|
profileRecordDescription.setSleeperNum(params.getStr("sleeperNum")); |
|
|
|
profileRecordDescription.setSyncStatus(SyncStatus.wait); |
|
|
|
profileRecordDao.insertProfileRecord(profileRecordDescription); |
|
|
|
|
|
|
@ -109,19 +108,21 @@ public class MeasureApi { |
|
|
|
profileRecordPointSet.setProfileRecordUuid(profileRecordDescription.getUuid()); |
|
|
|
profileRecordPointSet.setLeftPoints(JSONUtil.toJsonStr(leftPoint)); |
|
|
|
profileRecordPointSet.setRightPoints(JSONUtil.toJsonStr(rightPoint)); |
|
|
|
List<XYPoint> alignPoints = JSONUtil.toList(params.get("alignPoints"), XYPoint.class); |
|
|
|
if (alignPoints == null || alignPoints.isEmpty()) { |
|
|
|
alignPoints = taskState.getAlignPointSetList(); |
|
|
|
} |
|
|
|
if (alignPoints.isEmpty()) { |
|
|
|
List<XYPoint> leftPointsRevers = new ArrayList<>(leftPoint); |
|
|
|
Collections.reverse(leftPointsRevers); |
|
|
|
alignPoints.addAll(leftPointsRevers); |
|
|
|
alignPoints.addAll(rightPoint); |
|
|
|
JSONArray alignPointsJsonArray = params.getJSONArray("alignPoints"); |
|
|
|
|
|
|
|
if (alignPointsJsonArray != null && !alignPointsJsonArray.isEmpty()) { |
|
|
|
profileRecordPointSet.setAlignPoints(alignPointsJsonArray.toString()); |
|
|
|
} else { |
|
|
|
List<XYPoint> alignPoints = taskState.getAlignPointSetList(); |
|
|
|
if (alignPoints.isEmpty()) { |
|
|
|
List<XYPoint> leftPointsRevers = new ArrayList<>(leftPoint); |
|
|
|
Collections.reverse(leftPointsRevers); |
|
|
|
alignPoints.addAll(leftPointsRevers); |
|
|
|
alignPoints.addAll(rightPoint); |
|
|
|
profileRecordPointSet.setAlignPoints(JSONUtil.toJsonStr(alignPoints)); |
|
|
|
} |
|
|
|
} |
|
|
|
profileRecordPointSet.setAlignPoints(JSONUtil.toJsonStr(alignPoints)); |
|
|
|
profileRecordPointSetDao.insertProfileRecordPointSet(profileRecordPointSet); |
|
|
|
|
|
|
|
return Result.success(); |
|
|
|
} |
|
|
|
|
|
|
|