|
|
@@ -311,6 +311,11 @@ public class PosOrderQsOprateController extends BaseController {
|
|
|
posStoreService.listByIds(mdIds).stream().collect(Collectors.toMap(PosStore::getId, s -> s));
|
|
|
JSONArray arr=new JSONArray();
|
|
|
for (PosOrder order : result.getRecords()) {
|
|
|
+ // 自动序列化所有PosOrder字段,新增字段无需手动添加
|
|
|
+ JSONObject org = JSON.parseObject(
|
|
|
+ JSON.toJSONStringWithDateFormat(order, "yyyy-MM-dd HH:mm:ss")
|
|
|
+ );
|
|
|
+ org.put("juli",null);
|
|
|
// 计算距离(km)
|
|
|
if (order.getLongitude() != null && order.getLatitude() != null && longitude != null && latitude != null) {
|
|
|
double lat1 = Math.toRadians(order.getLatitude().doubleValue());
|
|
|
@@ -320,12 +325,11 @@ public class PosOrderQsOprateController extends BaseController {
|
|
|
double a = Math.sin(dlat / 2) * Math.sin(dlat / 2)
|
|
|
+ Math.cos(lat1) * Math.cos(lat2) * Math.sin(dlng / 2) * Math.sin(dlng / 2);
|
|
|
double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
|
|
- order.setJuli(Math.round(6371 * c * 100.0) / 100.0);
|
|
|
+// order.setJuli(Math.round(6371 * c * 100.0) / 100.0);
|
|
|
+ org.put("juli",Math.round(6371 * c * 100.0) / 100.0);
|
|
|
}
|
|
|
- // 自动序列化所有PosOrder字段,新增字段无需手动添加
|
|
|
- JSONObject org = JSON.parseObject(
|
|
|
- JSON.toJSONStringWithDateFormat(order, "yyyy-MM-dd HH:mm:ss")
|
|
|
- );
|
|
|
+
|
|
|
+
|
|
|
// 以下为非PosOrder字段或需要特殊处理的字段
|
|
|
org.put("store", storeMap.get(order.getMdId().intValue()));
|
|
|
|