提交 09b392e2 authored 作者: liuhaiquan's avatar liuhaiquan

Merge remote-tracking branch 'origin/v7.0_small_version_fix_20231120' into…

Merge remote-tracking branch 'origin/v7.0_small_version_fix_20231120' into v7.0_small_version_fix_20231120
package com.clx.performance.controller.pc;
import cn.hutool.json.JSONUtil;
import com.clx.performance.service.LargeScreenService;
import com.clx.performance.service.OrderChildService;
import com.clx.user.feign.DriverFeign;
import io.swagger.annotations.Api;
......@@ -10,6 +11,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
......@@ -22,19 +24,25 @@ import java.util.List;
@Api(tags = "PC-大屏")
public class LargeScreenController {
private final OrderChildService orderChildService;
private final LargeScreenService largeScreenService;
@ApiOperation(value = "空车列表", notes = "<br>By:胡宇帆")
@GetMapping("/emptyCarList")
public String emptyCarList() {
return JSONUtil.toJsonStr(orderChildService.emptyCarList());
return JSONUtil.toJsonStr(largeScreenService.emptyCarList());
}
@ApiOperation(value = "重车列表", notes = "<br>By:胡宇帆")
@GetMapping("/weightCarList")
public String weightCarList() {
return JSONUtil.toJsonStr(orderChildService.weightCarList());
return JSONUtil.toJsonStr(largeScreenService.weightCarList());
}
@ApiOperation(value = "收货地址", notes = "<br>By:胡宇帆")
@GetMapping("/receiveAddress")
public String receiveAddress(@RequestParam(value = "addressId") Integer addressId) {
return largeScreenService.receiveAddress(addressId);
}
}
\ No newline at end of file
package com.clx.performance.service;
import cn.hutool.json.JSONObject;
import java.util.List;
public interface LargeScreenService {
List<JSONObject> weightCarList();
List<JSONObject> emptyCarList();
String receiveAddress(Integer addressId);
}
......@@ -81,7 +81,4 @@ public interface OrderChildService {
DriverCancelOrderChildInfo driverCancelOrderChildInfo(String orderChildNo);
List<JSONObject> weightCarList();
List<JSONObject> emptyCarList();
}
package com.clx.performance.service.impl;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import com.clx.order.feign.AddressFeign;
import com.clx.order.vo.feign.FeignAddressVO;
import com.clx.order.vo.feign.SystemAddressVO;
import com.clx.performance.dao.OrderChildDao;
import com.clx.performance.dto.zjxl.TruckTraceDTO;
import com.clx.performance.enums.PerformanceResultEnum;
import com.clx.performance.model.OrderChild;
import com.clx.performance.service.LargeScreenService;
import com.clx.performance.utils.zjxl.ZjxlGpsService;
import com.clx.user.feign.DriverFeign;
import com.msl.common.base.Optional;
import com.msl.common.enums.ResultEnum;
import com.msl.common.result.Result;
import com.msl.common.utils.DateUtils;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;
@Service
@Slf4j
@AllArgsConstructor
public class LargeScreenServiceImpl implements LargeScreenService {
private final ZjxlGpsService zjxlGpsService;
private final DriverFeign driverFeign;
private final AddressFeign addressFeign;
private final OrderChildDao orderChildDao;
@Override
public List<JSONObject> emptyCarList() {
List<String> data = driverFeign.driverTruckList().getData();
String now = DateUtils.formatDateTime(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss").get();
List<OrderChild> orderChildList = orderChildDao.selectListWithEmptyCarList();
if (CollectionUtils.isEmpty(orderChildList)) {
return null;
}
List<String> list = orderChildList.stream().map(OrderChild::getTruckNo).collect(Collectors.toList());
List<JSONObject> result = new LinkedList<>();
int index = 0;
for (String truckNo : data) {
if (list.contains(truckNo)) {
continue;
}
List<TruckTraceDTO> truckTrace = zjxlGpsService.getTruckTrace(truckNo, now,
now);
if (CollectionUtils.isNotEmpty(truckTrace)) {
JSONObject jsonObject = new JSONObject();
BigDecimal[] location = truckTrace.get(truckTrace.size() - 1).getLocation();
BigDecimal longitude = location[0].setScale(4, BigDecimal.ROUND_DOWN);
BigDecimal latitude = location[1].setScale(4, BigDecimal.ROUND_DOWN);
jsonObject.set("id", ++index);
jsonObject.set("lng", longitude);
jsonObject.set("lat", latitude);
jsonObject.set("info", "");
jsonObject.set("value", "");
jsonObject.set("iconField", "ok");
result.add(jsonObject);
}
}
return result;
}
@Override
public List<JSONObject> weightCarList() {
List<String> data = driverFeign.driverTruckList().getData();
String now = DateUtils.formatDateTime(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss").get();
List<OrderChild> orderChildList = orderChildDao.selectListWithEmptyCarList();
if (CollectionUtils.isEmpty(orderChildList)) {
return null;
}
List<String> list = orderChildList.stream().map(OrderChild::getTruckNo).collect(Collectors.toList());
List<JSONObject> result = new LinkedList<>();
int index = 0;
for (String truckNo : data) {
if (!list.contains(truckNo)) {
continue;
}
List<TruckTraceDTO> truckTrace = zjxlGpsService.getTruckTrace(truckNo, now,
now);
if (CollectionUtils.isNotEmpty(truckTrace)) {
JSONObject jsonObject = new JSONObject();
BigDecimal[] location = truckTrace.get(truckTrace.size() - 1).getLocation();
BigDecimal longitude = location[0].setScale(4, BigDecimal.ROUND_DOWN);
BigDecimal latitude = location[1].setScale(4, BigDecimal.ROUND_DOWN);
jsonObject.set("id", ++index);
jsonObject.set("lng", longitude);
jsonObject.set("lat", latitude);
jsonObject.set("info", "");
jsonObject.set("value", "");
jsonObject.set("iconField", "ok");
result.add(jsonObject);
}
}
return result;
}
@Override
public String receiveAddress(Integer addressId) {
SystemAddressVO vo = Optional.of(addressFeign.getSystemReceiveAddress(addressId)).filter(Result::succeed)
.map(Result::getData).orElseThrow(PerformanceResultEnum.HTTP_ERROR);
JSONArray jsonArray = new JSONArray();
String name = vo.getAddressShorter();
BigDecimal longitude = vo.getLongitude().setScale(4, RoundingMode.DOWN);
BigDecimal latitude = vo.getLatitude().setScale(4, RoundingMode.DOWN);
JSONObject jsonObject = new JSONObject();
jsonObject.set("id", addressId);
jsonObject.set("lng", longitude);
jsonObject.set("lat", latitude);
jsonObject.set("name", name);
jsonObject.set("value", "");
jsonObject.set("iconField", "ok");
jsonArray.add(jsonObject);
return jsonArray.toString();
}
}
......@@ -155,11 +155,6 @@ public class OrderChildServiceImpl implements OrderChildService {
@Autowired
private FeignPaymentService feignPaymentService;
@Autowired
private ZjxlGpsService zjxlGpsService;
@Autowired
private DriverFeign driverFeign;
@Override
public SaveOrderChildVO saveOrderChild(OrderChildSaveParam param) {
......@@ -2109,80 +2104,4 @@ public class OrderChildServiceImpl implements OrderChildService {
}
@Override
public List<JSONObject> emptyCarList() {
List<String> data = driverFeign.driverTruckList().getData();
String now = DateUtils.formatDateTime(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss").get();
List<OrderChild> orderChildList = orderChildDao.selectListWithEmptyCarList();
if (CollectionUtils.isEmpty(orderChildList)) {
return null;
}
List<String> list = orderChildList.stream().map(OrderChild::getTruckNo).collect(Collectors.toList());
List<JSONObject> result = new LinkedList<>();
int index = 0;
for (String truckNo : data) {
if (list.contains(truckNo)) {
continue;
}
List<TruckTraceDTO> truckTrace = zjxlGpsService.getTruckTrace(truckNo, now,
now);
if(CollectionUtils.isNotEmpty(truckTrace)){
JSONObject jsonObject = new JSONObject();
BigDecimal[] location = truckTrace.get(truckTrace.size() - 1).getLocation();
BigDecimal longitude = location[0].setScale(4, BigDecimal.ROUND_DOWN);
BigDecimal latitude = location[1].setScale(4, BigDecimal.ROUND_DOWN);
jsonObject.set("id", ++index);
jsonObject.set("lng", longitude);
jsonObject.set("lat", latitude);
jsonObject.set("info", "");
jsonObject.set("value", "");
jsonObject.set("iconField", "ok");
result.add(jsonObject);
}
}
return result;
}
@Override
public List<JSONObject> weightCarList() {
List<String> data = driverFeign.driverTruckList().getData();
String now = DateUtils.formatDateTime(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss").get();
List<OrderChild> orderChildList = orderChildDao.selectListWithEmptyCarList();
if (CollectionUtils.isEmpty(orderChildList)) {
return null;
}
List<String> list = orderChildList.stream().map(OrderChild::getTruckNo).collect(Collectors.toList());
List<JSONObject> result = new LinkedList<>();
int index = 0;
for (String truckNo : data) {
if (!list.contains(truckNo)) {
continue;
}
List<TruckTraceDTO> truckTrace = zjxlGpsService.getTruckTrace(truckNo, now,
now);
if(CollectionUtils.isNotEmpty(truckTrace)){
JSONObject jsonObject = new JSONObject();
BigDecimal[] location = truckTrace.get(truckTrace.size() - 1).getLocation();
BigDecimal longitude = location[0].setScale(4, BigDecimal.ROUND_DOWN);
BigDecimal latitude = location[1].setScale(4, BigDecimal.ROUND_DOWN);
jsonObject.set("id", ++index);
jsonObject.set("lng", longitude);
jsonObject.set("lat", latitude);
jsonObject.set("info", "");
jsonObject.set("value", "");
jsonObject.set("iconField", "ok");
result.add(jsonObject);
}
}
return result;
}
}
#server:
# port: 80
# servlet:
# context-path: /${spring.application.name}
#
#spring:
# profiles:
# active: dev
# application:
# name: clx-performance
# main:
# allow-bean-definition-overriding: true
#
# cloud:
# nacos:
# discovery:
# server-addr: nacos.devclx.cn:8848
# username: nacos
# password: nacos
# register-enabled: true
# namespace: new-clx-dev
#
# # namespace: ${spring.profiles.active}
# config:
# file-extension: yml
# server-addr: nacos.devclx.cn:8848
# username: nacos
# password: nacos
# shared-configs:
# # - common-redis-${spring.profiles.active}.yml
# # - common-mq-${spring.profiles.active}.yml
# # - common-druid-${spring.profiles.active}.yml
# # - common-satoken-${spring.profiles.active}.yml
# # - common-esign-${spring.profiles.active}.yml
# namespace: new-clx-dev
\ No newline at end of file
server:
port: 80
servlet:
context-path: /${spring.application.name}
spring:
profiles:
active: dev
application:
name: clx-performance
main:
allow-bean-definition-overriding: true
cloud:
nacos:
discovery:
server-addr: nacos.devclx.cn:8848
username: nacos
password: nacos
register-enabled: true
namespace: new-clx-dev
# namespace: ${spring.profiles.active}
config:
file-extension: yml
server-addr: nacos.devclx.cn:8848
username: nacos
password: nacos
shared-configs:
# - common-redis-${spring.profiles.active}.yml
# - common-mq-${spring.profiles.active}.yml
# - common-druid-${spring.profiles.active}.yml
# - common-satoken-${spring.profiles.active}.yml
# - common-esign-${spring.profiles.active}.yml
namespace: new-clx-dev
\ No newline at end of file
package com.clx.performance;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.clx.order.feign.OrderFeign;
import com.clx.order.vo.feign.OrderOwnTruckVo;
......@@ -8,6 +9,7 @@ import com.clx.performance.component.OrderGoodsStatusLazyComponent;
import com.clx.performance.constant.RabbitKeyConstants;
import com.clx.performance.dao.OrderGoodsDao;
import com.clx.performance.param.mq.OrderCancelMqParam;
import com.clx.performance.service.LargeScreenService;
import com.clx.performance.service.OrderCancelService;
import org.junit.Test;
import org.junit.runner.RunWith;
......@@ -49,9 +51,13 @@ public class JobTest {
@Autowired
private OrderCancelService orderCancelService;
@Autowired
private LargeScreenService largeScreenService;
@Test
public void test1() {
JSONObject jsonObject = largeScreenService.receiveAddress(27);
System.out.println(jsonObject);
// OrderCancelMqParam mqParam = new OrderCancelMqParam();
// mqParam.setType("2");
// mqParam.setOrderNo("123");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论