|
|
@@ -2,6 +2,7 @@ import cn.com.taiji.common.manager.net.http.ServiceHandleException; |
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import com.alibaba.fastjson2.JSON; |
|
|
|
import com.alibaba.fastjson2.TypeReference; |
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException; |
|
|
|
import com.qtzl.alterSales.UserApplication; |
|
|
|
import com.qtzl.alterSales.dao.entity.primary.AflBindInfo; |
|
|
@@ -60,6 +61,7 @@ import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Comparator; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
/*** |
|
|
|
* <p> |
|
|
@@ -255,61 +257,185 @@ public class SaleTest { |
|
|
|
@Test |
|
|
|
public void test22() throws ServiceHandleException, IOException { |
|
|
|
// testVehicleStatusListChange("沪AC03969",4,1); |
|
|
|
// testVehicleStatusListChange("鲁DA2H11",0,2); |
|
|
|
// testVehicleStatusListChange("粤ABR1180",4,2); |
|
|
|
testVehicleStatusListChange("鲁US515S", 0, 1); |
|
|
|
// testVehicleStatusListChange("蒙KGS076", 0, 1); |
|
|
|
// testVehicleStatusListChange("贵DZM491", 0, 1); |
|
|
|
// testVehicleStatusListChange("鲁EX6567", 0, 1); |
|
|
|
// testVehicleStatusListChange("晋BQJ793", 0, 1); |
|
|
|
// testVehicleStatusListChange("皖GDQ169", 0, 1); |
|
|
|
// testVehicleStatusListChange("豫LA792Z", 0, 1); |
|
|
|
// testVehicleStatusListChange("豫A314DE", 0, 1); |
|
|
|
// testVehicleStatusListChange("苏U669AL", 0, 1); |
|
|
|
// testVehicleStatusListChange("鲁AF98000", 4, 1); |
|
|
|
// testVehicleStatusListChange("苏A1WH01", 0, 2, 4); |
|
|
|
// testVehicleStatusListChange("苏A1WH01", 0, 2, 4); |
|
|
|
|
|
|
|
// testVehicleStatusListChange("鲁JD92397", 4, 2, 4); |
|
|
|
|
|
|
|
|
|
|
|
testVehicleStatusListChange("冀E5ZN83", 0, 1,4); |
|
|
|
testVehicleStatusListChange("鲁R816XU", 0, 1,4); |
|
|
|
testVehicleStatusListChange("冀E324DD", 0, 1,4); |
|
|
|
// testVehicleStatusListChange("桂BF5696", 0, 1,5); |
|
|
|
// testVehicleStatusListChange("赣AU58G7", 0, 1,5); |
|
|
|
testVehicleStatusListChange("皖FF22152", 4, 1,4); |
|
|
|
// testVehicleStatusListChange("渝AAN3887", 4, 1,4); |
|
|
|
} |
|
|
|
|
|
|
|
/* |
|
|
|
* 操作单辆车状态名单 |
|
|
|
*/ |
|
|
|
public void testVehicleStatusListChange(String plateNum, Integer plateColor, Integer type) throws ServiceHandleException { |
|
|
|
public void testVehicleStatusListChange(String plateNum, Integer plateColor, Integer type, Integer reason) throws ServiceHandleException { |
|
|
|
try { |
|
|
|
VehicleStatusListChangeRequest request = new VehicleStatusListChangeRequest(); |
|
|
|
request.setAgentId("52010188930"); |
|
|
|
request.setReason(reason); |
|
|
|
request.setType(type); |
|
|
|
request.setCreateTime(DateUtil.format(LocalDateTime.now(), "yyyy-MM-dd'T'HH:mm:ss")); |
|
|
|
request.setUniqueKey("AFL_YQ_SECOND"); |
|
|
|
request.setOperator("侯燚"); |
|
|
|
String vehicleId = ""; |
|
|
|
List<AflBindInfo> aflBindInfo = aflBindInfoRepo.findByPlateNumAndPlateColor(plateNum, plateColor); |
|
|
|
if (aflBindInfo.size() > 0) { |
|
|
|
vehicleId = aflBindInfo.stream().sorted(Comparator.comparing(AflBindInfo::getInsertTime).reversed()) |
|
|
|
.toList().get(0).getVehicleId(); |
|
|
|
} else { |
|
|
|
List<AflCenterVehicleInfo> aflCenterVehicleInfo = |
|
|
|
aflCenterVehicleInfoRepo.findListByPlateNumAndPlateColor(plateNum |
|
|
|
, plateColor); |
|
|
|
if (aflCenterVehicleInfo == null && aflCenterVehicleInfo.size() == 0) { |
|
|
|
System.out.println("车辆信息不存在,车牌号:" + plateNum); |
|
|
|
return; |
|
|
|
} |
|
|
|
vehicleId = aflCenterVehicleInfo.get(0).getVehicleId(); |
|
|
|
} |
|
|
|
request.setVehicleId(vehicleId); |
|
|
|
if (ObjectUtil.isNotEmpty(vehicleId)) { |
|
|
|
AflCenterObuInfo obuInfo = obuInfoRepo.findByVehicleId(vehicleId); |
|
|
|
if (ObjectUtil.isEmpty(obuInfo)) { |
|
|
|
System.out.println("车辆obu信息不存在,车牌号:" + plateNum); |
|
|
|
return; |
|
|
|
} |
|
|
|
request.setObuId(obuInfo.getObuId()); |
|
|
|
String cardId = cardInfoRepo.findByVehicleId(vehicleId); |
|
|
|
if (ObjectUtil.isEmpty(cardId)) { |
|
|
|
System.out.println("车辆卡信息不存在,车牌号:" + plateNum); |
|
|
|
return; |
|
|
|
} |
|
|
|
request.setCpuId(cardId.replaceFirst("^9901", "")); |
|
|
|
aflVehicleStatusInfoService.VehicleStatusListChange(request); |
|
|
|
System.out.println("操作状态名单成功,车牌号:" + plateNum); |
|
|
|
} |
|
|
|
} catch (ServiceHandleException e) { |
|
|
|
System.out.println("操作状态名单失败,车牌号:" + plateNum); |
|
|
|
System.out.println("操作状态名单失败,异常:" + e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
public void test222() throws ServiceHandleException { |
|
|
|
String jsonString = "[{\"cpuId\":\"0052232700548884\",\"message\":\"成功\",\"obuId\":\"9901000700236134\"," + |
|
|
|
"\"vehicleId\":\"9ccb286e022d4c249ecf40206351532b\",\"returntime\":\"2024-12-19T17:47:57\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700691159\",\"message\":\"成功\",\"obuId\":\"9901002700198087\"," + |
|
|
|
"\"vehicleId\":\"0829c3a4385547d5a7acaa5be0e857e8\",\"returntime\":\"2024-12-19T17:47:57\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700548888\",\"message\":\"成功\",\"obuId\":\"9901000700236138\"," + |
|
|
|
"\"vehicleId\":\"5f5136cfe2224aa2bd0afdf6103494d2\",\"returntime\":\"2024-12-19T17:47:57\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700542947\",\"message\":\"成功\",\"obuId\":\"9901000700230197\"," + |
|
|
|
"\"vehicleId\":\"b85e08f3670d49f196d669a756f51424\",\"returntime\":\"2024-12-19T17:47:58\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700440410\",\"message\":\"成功\",\"obuId\":\"9901002700142934\"," + |
|
|
|
"\"vehicleId\":\"dc87efd08bea43c9b46313f57ce83f2d\",\"returntime\":\"2024-12-19T17:47:58\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232400514373\",\"message\":\"成功\",\"obuId\":\"9901000200757111\"," + |
|
|
|
"\"vehicleId\":\"0ce0ad73739f48dc945e75aab4b427f3\",\"returntime\":\"2024-12-19T17:47:58\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700498251\",\"message\":\"成功\",\"obuId\":\"9901000700215496\"," + |
|
|
|
"\"vehicleId\":\"b301cf0a50db47dbb62991eaed478cb6\",\"returntime\":\"2024-12-19T17:47:59\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700206817\",\"message\":\"成功\",\"obuId\":\"9901002700014336\"," + |
|
|
|
"\"vehicleId\":\"c30d30db425246479f78ebc82c0c0618\",\"returntime\":\"2024-12-19T17:47:59\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700529824\",\"message\":\"成功\",\"obuId\":\"9901000700217074\"," + |
|
|
|
"\"vehicleId\":\"13967266c9da4d4c8b0e8f196c23e919\",\"returntime\":\"2024-12-19T17:47:59\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700271728\",\"message\":\"成功\",\"obuId\":\"9901002700079247\"," + |
|
|
|
"\"vehicleId\":\"bd024207552d4553bc0070f2dbd0852e\",\"returntime\":\"2024-12-19T17:47:59\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700281905\",\"message\":\"成功\",\"obuId\":\"9901002700089424\"," + |
|
|
|
"\"vehicleId\":\"e2a7cd37b0b04c558fc5397b34fcb343\",\"returntime\":\"2024-12-19T17:47:59\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700250573\",\"message\":\"成功\",\"obuId\":\"9901002700058092\"," + |
|
|
|
"\"vehicleId\":\"bc9041db1bc34fb5980d003499976a8f\",\"returntime\":\"2024-12-19T17:48:00\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700539484\",\"message\":\"成功\",\"obuId\":\"9901000700226734\"," + |
|
|
|
"\"vehicleId\":\"48fe56beb0f348589a44f11f40a38b43\",\"returntime\":\"2024-12-19T17:48:00\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700529826\",\"message\":\"成功\",\"obuId\":\"9901000700217076\"," + |
|
|
|
"\"vehicleId\":\"a61ec17547a84e1b997c6719282ff1dd\",\"returntime\":\"2024-12-19T17:48:00\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700542937\",\"message\":\"成功\",\"obuId\":\"9901000700230187\"," + |
|
|
|
"\"vehicleId\":\"c8ea949957a24244b495c31561e6d642\",\"returntime\":\"2024-12-19T17:48:00\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700548886\",\"message\":\"成功\",\"obuId\":\"9901000700236136\"," + |
|
|
|
"\"vehicleId\":\"463dae98e75e4ed6a80a13d582d07fec\",\"returntime\":\"2024-12-19T17:48:00\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700459156\",\"message\":\"成功\",\"obuId\":\"9901002700161680\"," + |
|
|
|
"\"vehicleId\":\"0e8097015f1d4ab4b85740d263ae5a3b\",\"returntime\":\"2024-12-19T17:48:01\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700691191\",\"message\":\"成功\",\"obuId\":\"9901002700198119\"," + |
|
|
|
"\"vehicleId\":\"55ea66eef4894e5bbd724089950ed04f\",\"returntime\":\"2024-12-19T17:48:01\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700295307\",\"message\":\"成功\",\"obuId\":\"9901002700102826\"," + |
|
|
|
"\"vehicleId\":\"c47fe38cedfb44adaeeebc62519e4feb\",\"returntime\":\"2024-12-19T17:48:01\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700286315\",\"message\":\"成功\",\"obuId\":\"9901002700093834\"," + |
|
|
|
"\"vehicleId\":\"c5924dcec60641e6b29e0ff2cf4faa5d\",\"returntime\":\"2024-12-19T17:48:01\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700286398\",\"message\":\"成功\",\"obuId\":\"9901002700093917\"," + |
|
|
|
"\"vehicleId\":\"6e6a0d44bcb84f2991a654083dadfa57\",\"returntime\":\"2024-12-19T17:48:02\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700548706\",\"message\":\"成功\",\"obuId\":\"9901000700235956\"," + |
|
|
|
"\"vehicleId\":\"1564d330b63141d0808783df3da12b8b\",\"returntime\":\"2024-12-19T17:48:02\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700270647\",\"message\":\"成功\",\"obuId\":\"9901002700078166\"," + |
|
|
|
"\"vehicleId\":\"9b45504e3c7846b7ad0ad4889c011895\",\"returntime\":\"2024-12-19T17:48:02\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700274803\",\"message\":\"成功\",\"obuId\":\"9901002700082322\"," + |
|
|
|
"\"vehicleId\":\"8075739c96c945df8ea1c52cf055dc3c\",\"returntime\":\"2024-12-19T17:48:02\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700542978\",\"message\":\"成功\",\"obuId\":\"9901000700230228\"," + |
|
|
|
"\"vehicleId\":\"b7b4e7542c4c446ba23d236e278b97c8\",\"returntime\":\"2024-12-19T17:48:02\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232400519844\",\"message\":\"成功\",\"obuId\":\"9901000200762582\"," + |
|
|
|
"\"vehicleId\":\"15144d4e98da4402b4f1051320f0992e\",\"returntime\":\"2024-12-19T17:48:02\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700545107\",\"message\":\"成功\",\"obuId\":\"9901000700232357\"," + |
|
|
|
"\"vehicleId\":\"2bf8d33473004a819ca31a388afc8353\",\"returntime\":\"2024-12-19T17:48:02\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232400526811\",\"message\":\"成功\",\"obuId\":\"9901000200769549\"," + |
|
|
|
"\"vehicleId\":\"a1894af30d4442a784f4d121bc72e6e2\",\"returntime\":\"2024-12-19T17:48:02\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700487322\",\"message\":\"成功\",\"obuId\":\"9901000700204567\"," + |
|
|
|
"\"vehicleId\":\"01c190cafe0f4e1ebbe3072e20b0e700\",\"returntime\":\"2024-12-19T17:48:03\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700540757\",\"message\":\"成功\",\"obuId\":\"9901000700228007\"," + |
|
|
|
"\"vehicleId\":\"88359b73a5a4470fbe885fd484e23e42\",\"returntime\":\"2024-12-19T17:48:03\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700271108\",\"message\":\"成功\",\"obuId\":\"9901002700078627\"," + |
|
|
|
"\"vehicleId\":\"5cef5f7e6ded4a29841ef62fa433080d\",\"returntime\":\"2024-12-19T17:48:03\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700274687\",\"message\":\"成功\",\"obuId\":\"9901002700082206\"," + |
|
|
|
"\"vehicleId\":\"9d39504dbfb84aa386e660e48bf07416\",\"returntime\":\"2024-12-19T17:48:03\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700544959\",\"message\":\"成功\",\"obuId\":\"9901000700232209\"," + |
|
|
|
"\"vehicleId\":\"3a26015e76f745e495aea8e2a80b2ca3\",\"returntime\":\"2024-12-19T17:48:03\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232400313031\",\"message\":\"成功\",\"obuId\":\"9901000200445053\"," + |
|
|
|
"\"vehicleId\":\"c982f6331a3b4fe4947cdcd23b19977f\",\"returntime\":\"2024-12-19T17:48:04\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700487314\",\"message\":\"成功\",\"obuId\":\"9901000700204559\"," + |
|
|
|
"\"vehicleId\":\"03dc5c17b16e4c4c90131efd5ea0cea5\",\"returntime\":\"2024-12-19T17:48:04\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700251969\",\"message\":\"成功\",\"obuId\":\"9901002700059488\"," + |
|
|
|
"\"vehicleId\":\"3a3584117f6c4955a3b860c8c908e4a4\",\"returntime\":\"2024-12-19T17:48:04\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700286343\",\"message\":\"成功\",\"obuId\":\"9901002700093862\"," + |
|
|
|
"\"vehicleId\":\"8c0e60a860eb4a97aa5385155facce0d\",\"returntime\":\"2024-12-19T17:48:04\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700207104\",\"message\":\"成功\",\"obuId\":\"9901002700014623\"," + |
|
|
|
"\"vehicleId\":\"4df19a8b09ae41efa4dcddf27b1b92f6\",\"returntime\":\"2024-12-19T17:48:04\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700289180\",\"message\":\"成功\",\"obuId\":\"9901002700096699\"," + |
|
|
|
"\"vehicleId\":\"944e51912fd04ecf81ea928bc5c0f121\",\"returntime\":\"2024-12-19T17:48:04\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232400318064\",\"message\":\"成功\",\"obuId\":\"9901000200450086\"," + |
|
|
|
"\"vehicleId\":\"cb172cab85ec47c3b8e0948886eb1c84\",\"returntime\":\"2024-12-19T17:48:04\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700274658\",\"message\":\"成功\",\"obuId\":\"9901002700082177\"," + |
|
|
|
"\"vehicleId\":\"d6d592c945f342edb317264c0c4c6ed4\",\"returntime\":\"2024-12-19T17:48:05\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232400351841\",\"message\":\"成功\",\"obuId\":\"9901000200483863\"," + |
|
|
|
"\"vehicleId\":\"8e75962d3ea449a1a6425a22459c1827\",\"returntime\":\"2024-12-19T17:48:05\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700540778\",\"message\":\"成功\",\"obuId\":\"9901000700228028\"," + |
|
|
|
"\"vehicleId\":\"ee49b1564c104b838a0f571ba4d9cc33\",\"returntime\":\"2024-12-19T17:48:05\"," + |
|
|
|
"\"status\":1},{\"cpuId\":\"0052232700538624\",\"message\":\"成功\",\"obuId\":\"9901000700225874\"," + |
|
|
|
"\"vehicleId\":\"1eb96672fb9c4c478d2c4f3fece011f9\",\"returntime\":\"2024-12-19T17:48:05\"," + |
|
|
|
"\"status\":1}],"; |
|
|
|
// 使用fastjson将JSON字符串转换为List<Map<String, Object>> |
|
|
|
List<Map<String, Object>> list = JSON.parseObject(jsonString, new TypeReference<List<Map<String, Object>>>() { |
|
|
|
}); |
|
|
|
VehicleStatusListChangeRequest request = new VehicleStatusListChangeRequest(); |
|
|
|
request.setAgentId("52010188930"); |
|
|
|
request.setReason(4); |
|
|
|
request.setType(type); |
|
|
|
request.setType(1); |
|
|
|
request.setCreateTime(DateUtil.format(LocalDateTime.now(), "yyyy-MM-dd'T'HH:mm:ss")); |
|
|
|
request.setUniqueKey("AFL_YQ_SECOND"); |
|
|
|
String vehicleId = ""; |
|
|
|
List<AflBindInfo> aflBindInfo = aflBindInfoRepo.findByPlateNumAndPlateColor(plateNum, plateColor); |
|
|
|
if (aflBindInfo.size() > 0) { |
|
|
|
vehicleId = aflBindInfo.stream().sorted(Comparator.comparing(AflBindInfo::getInsertTime).reversed()) |
|
|
|
.toList().get(0).getVehicleId(); |
|
|
|
} else { |
|
|
|
List<AflCenterVehicleInfo> aflCenterVehicleInfo = |
|
|
|
aflCenterVehicleInfoRepo.findListByPlateNumAndPlateColor(plateNum |
|
|
|
, plateColor); |
|
|
|
if (aflCenterVehicleInfo == null && aflCenterVehicleInfo.size() == 0){ |
|
|
|
System.out.println("车辆信息不存在,车牌号:" + plateNum); |
|
|
|
return; |
|
|
|
} |
|
|
|
vehicleId = aflCenterVehicleInfo.get(0).getVehicleId(); |
|
|
|
} |
|
|
|
request.setVehicleId(vehicleId); |
|
|
|
if (ObjectUtil.isNotEmpty(vehicleId)) { |
|
|
|
AflCenterObuInfo obuInfo = obuInfoRepo.findByVehicleId(vehicleId); |
|
|
|
if (ObjectUtil.isEmpty(obuInfo)) { |
|
|
|
System.out.println("车辆obu信息不存在,车牌号:" + plateNum); |
|
|
|
return; |
|
|
|
} |
|
|
|
request.setObuId(obuInfo.getObuId()); |
|
|
|
String cardId = cardInfoRepo.findByVehicleId(vehicleId); |
|
|
|
if (ObjectUtil.isEmpty(cardId)) { |
|
|
|
System.out.println("车辆卡信息不存在,车牌号:" + plateNum); |
|
|
|
return; |
|
|
|
request.setOperator("侯燚"); |
|
|
|
// 打印结果 |
|
|
|
ArrayList<String> objects = new ArrayList<>(); |
|
|
|
for (Map<String, Object> map : list) { |
|
|
|
request.setVehicleId(map.get("vehicleId").toString()); |
|
|
|
request.setCpuId(map.get("cpuId").toString()); |
|
|
|
request.setObuId(map.get("obuId").toString()); |
|
|
|
try { |
|
|
|
aflVehicleStatusInfoService.VehicleStatusListChange(request); |
|
|
|
} catch (ServiceHandleException e) { |
|
|
|
objects.add(map.get("vehicleId").toString()); |
|
|
|
System.out.println("车辆状态变更失败:" + e.getMessage()); |
|
|
|
} |
|
|
|
request.setCpuId(cardId.replaceAll("9901", "")); |
|
|
|
aflVehicleStatusInfoService.VehicleStatusListChange(request); |
|
|
|
System.out.println("操作状态名单成功,车牌号:" + plateNum); |
|
|
|
} |
|
|
|
System.out.println("车辆IDs:" + objects); |
|
|
|
} |
|
|
|
} |