Commit 8592ce24 by 杨林龙

Merge remote-tracking branch 'origin/master'

2 parents eb109395 f48b055e
......@@ -49,6 +49,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StopWatch;
import java.io.FileNotFoundException;
import java.io.InputStream;
......@@ -146,6 +147,40 @@ public class VehicleService {
return selected;
}
private static String transWeekFrequency(String week, String weekTimer) {
StringBuilder sb = new StringBuilder(weekTimer + "/星期");
for (int i = 0; i < week.length(); i++) {
char c = week.charAt(i);
switch (c) {
case '1':
sb.append("一、");
break;
case '2':
sb.append("二、");
break;
case '3':
sb.append("三、");
break;
case '4':
sb.append("四、");
break;
case '5':
sb.append("五、");
break;
case '6':
sb.append("六、");
break;
case '7':
sb.append("七、");
break;
default:
break;
}
}
String str = sb.toString();
return str.substring(0, str.length() - 1);
}
public PageInfo<TrialDriveVehiclePageDTO> searchTrialDrive(VehicleManageSearch search) {
PageHelper.startPage(search.getPageNumber(), search.getPageSize());
List<TrialDriveVehiclePageDTO> listDriveVehicle = vehicleMapper.searchTrialDrive(search);
......@@ -826,7 +861,7 @@ public class VehicleService {
}
@Cacheable(value = "carbrand", key = "#brandId")
public Carbrand getByBrandId(Integer brandId) {
public Carbrand getByParentBrandId(Integer brandId) {
return carbrandService.getParentBrandByBrandId(brandId);
}
......@@ -836,22 +871,32 @@ public class VehicleService {
}
public void saveVehicleTypes(VehicleTypesBO typesBO, Long userId) {
StopWatch sw = new StopWatch();
Date now = new Date();
List<Carbrand> carBrandList = this.getAllBrandList();
Map<Integer, Carbrand> carBrandMap = carBrandList.stream().collect(Collectors.toMap(Carbrand::getBid, pd -> pd));
List<TenantVehicleType> tvTypeList = Lists.newArrayListWithCapacity(typesBO.getTypeIds().size());
sw.start("task1");
log.info("本次处理 {} 车型{}条", typesBO.getTenantName(), typesBO.getTypeIds().size());
typesBO.getTypeIds().forEach(tId -> {
Cartype carType = this.getByTypeId(tId);
if (carType != null) {
Carbrand carBrand = this.getByBrandId(carType.getCarBrandId());
// Carbrand carBrand = this.getByBrandId(carType.getCarBrandId());
TenantVehicleType tvType = new TenantVehicleType();
tvType.setTenantId(typesBO.getTenantId());
tvType.setTenantName(typesBO.getTenantName());
tvType.setName(typesBO.getName());
tvType.setBrandId(carType.getCarBrandPId());
Carbrand carBrand = carBrandMap.get(carType.getCarBrandPId());
if (carBrand != null) {
tvType.setBrandId(carBrand.getBid());
tvType.setBrandName(carBrand.getBrand());
}
tvType.setSubBrandId(carType.getCarBrandId());
......@@ -866,10 +911,16 @@ public class VehicleService {
tvTypeList.add(tvType);
}
});
sw.stop();
log.info("{} 耗时:{} s", sw.getLastTaskName(), sw.getLastTaskTimeMillis());
//redisUtils.set("TenantVehicleType" + typesBO.getTenantId(), tvTypeList);
sw.start("task2");
syncData2Db(typesBO.getTenantId(), tvTypeList);
sw.stop();
log.info(sw.prettyPrint());
log.info("总耗时:{} s", sw.getTotalTimeSeconds());
}
//@Async
......@@ -1453,40 +1504,6 @@ public class VehicleService {
return list;
}
private static String transWeekFrequency(String week, String weekTimer) {
StringBuilder sb = new StringBuilder(weekTimer + "/星期");
for (int i = 0; i < week.length(); i++) {
char c = week.charAt(i);
switch (c) {
case '1':
sb.append("一、");
break;
case '2':
sb.append("二、");
break;
case '3':
sb.append("三、");
break;
case '4':
sb.append("四、");
break;
case '5':
sb.append("五、");
break;
case '6':
sb.append("六、");
break;
case '7':
sb.append("七、");
break;
default:
break;
}
}
String str = sb.toString();
return str.substring(0, str.length() - 1);
}
/**
* 删除车辆信息
*
......
......@@ -40,6 +40,7 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
......@@ -241,14 +242,1696 @@ public class VehicleServiceTest {
@Test
public void testSaveVehicleTypes() {
VehicleTypesBO typesBO = new VehicleTypesBO();
typesBO.setTenantId(37L);
typesBO.setName("广本车型库");
typesBO.setTenantId(79L);
typesBO.setName("京东车型库");
typesBO.setEnableStatus(1);
List<Integer> typeIdList = Lists.newArrayList();
typeIdList.add(1145);
typeIdList.add(43084);
typesBO.setTypeIds(typeIdList);
vehicleService.saveVehicleTypes(typesBO, 2L);
Integer[] typeIds = new Integer[]{
36622,
36623,
36624,
36625,
36628,
36629,
36630,
36631,
36600,
36601,
36602,
36603,
36606,
36607,
36608,
36609,
36626,
36627,
36632,
36633,
36604,
36605,
36610,
36611,
32044,
32045,
32050,
32051,
32040,
32046,
32041,
32047,
32042,
32043,
32048,
32049,
30088,
30297,
30306,
30307,
30293,
30298,
30294,
30299,
30295,
30296,
30300,
30305,
25901,
25906,
25902,
25907,
25898,
25903,
25899,
25904,
25900,
25905,
27076,
27078,
21567,
21569,
21568,
21570,
18658,
21598,
22883,
22884,
22885,
22886,
22887,
22888,
18637,
20245,
18638,
20246,
18639,
20247,
16571,
20248,
42417,
42418,
42419,
42420,
42423,
42424,
42425,
42426,
42421,
42422,
42427,
42428,
43603,
43604,
43605,
43606,
43596,
43597,
43598,
43599,
43607,
43608,
43600,
43601,
43593,
43594,
35368,
32014,
35367,
35369,
36412,
35370,
36413,
35371,
36414,
32015,
32016,
32017,
35372,
36415,
35373,
36416,
32018,
32019,
27317,
26201,
29978,
29977,
28656,
27436,
29973,
27318,
29974,
27319,
27320,
29976,
29975,
23928,
24833,
23929,
23924,
24830,
23925,
24831,
23839,
23926,
24832,
23927,
23922,
24829,
23923,
19493,
19491,
19492,
22889,
19487,
22890,
19488,
19489,
19490,
19485,
19486,
13527,
16957,
13526,
13515,
13523,
13524,
13525,
13521,
13522,
12675,
10766,
10767,
10762,
10763,
10764,
10765,
10760,
10761,
8585,
8583,
8584,
8578,
8579,
8580,
8581,
8575,
5890,
5864,
5886,
5887,
5888,
5889,
5863,
4639,
4637,
4641,
4642,
4640,
44081,
44082,
44083,
44084,
44085,
44086,
44087,
44088,
44089,
37344,
37345,
37346,
37347,
37348,
37204,
37349,
37350,
36844,
37351,
37352,
37353,
31530,
31527,
31529,
31526,
37391,
31524,
37390,
31525,
31523,
37389,
27960,
27961,
27959,
27957,
27958,
27954,
27955,
27956,
25066,
25067,
25065,
25063,
25064,
27080,
25014,
25062,
24969,
22389,
22632,
22633,
22882,
22881,
18112,
18109,
18110,
18111,
18106,
18107,
18108,
18103,
18104,
18105,
12268,
12415,
12416,
12417,
12203,
12418,
12419,
12412,
12413,
12414,
9314,
9311,
9312,
9313,
9315,
9308,
9309,
9310,
9305,
9306,
9307,
9316,
5776,
5780,
5778,
5777,
5895,
5782,
5783,
5781,
5774,
5775,
5779,
4449,
4447,
4448,
4430,
4444,
4445,
4446,
4441,
4442,
4443,
3674,
3672,
3673,
6765,
3670,
3671,
3667,
3668,
3669,
6767,
3665,
3666,
2643,
2641,
2652,
2653,
2642,
1597,
1723,
1599,
1596,
1720,
1721,
2562,
1397,
1598,
1878,
35951,
34968,
35657,
35658,
35659,
39962,
39963,
39964,
39965,
39966,
43974,
43975,
43976,
43977,
43978,
38819,
38820,
38821,
38822,
38400,
38401,
38823,
38699,
38825,
38826,
38402,
38403,
32898,
32895,
32896,
32897,
32892,
32893,
32894,
29134,
29135,
29129,
29130,
29131,
29132,
29133,
29125,
29126,
29127,
29128,
26244,
26238,
26237,
26234,
26235,
26236,
27079,
24991,
24992,
24993,
26229,
24989,
26232,
24990,
26156,
22896,
19465,
22891,
19460,
22892,
19461,
22893,
19462,
22894,
19463,
22895,
19464,
18971,
18972,
18973,
14411,
14775,
15533,
15534,
14774,
15535,
44786,
44787,
44788,
44789,
44790,
44791,
44792,
44793,
34853,
34851,
34854,
34855,
34856,
34646,
39929,
39930,
39931,
39932,
39933,
39934,
43097,
43098,
43099,
43100,
43101,
43102,
31521,
42454,
39893,
42875,
1145114,
3621,
3622,
3623,
2915,
2916,
2917,
2918,
2919,
1398,
1916,
1917,
1918,
1522,
1523,
1524,
1525,
1526,
145,
146,
147,
325,
326,
327,
3624,
3625,
3626,
2920,
2921,
2922,
3211,
1920,
1922,
1923,
2564,
1527,
1528,
1529,
1530,
1653,
329,
854,
870,
981,
982,
1227,
148,
149,
331,
642,
643,
644,
646,
647,
984,
985,
1071,
1072,
34703,
27901,
27902,
27903,
27904,
27905,
24079,
24080,
24081,
24082,
21117,
21118,
21119,
15734,
15837,
15838,
11446,
11447,
11448,
9017,
9019,
9020,
5302,
7362,
34704,
30961,
30962,
30963,
30964,
30965,
24083,
25450,
25451,
27077,
21120,
21121,
21122,
15839,
15840,
15841,
11449,
11450,
9021,
9022,
7363,
7364,
1149115,
36622,
36623,
36624,
36625,
36628,
36629,
36630,
36631,
36600,
36601,
36602,
36603,
36606,
36607,
36608,
36609,
36626,
36627,
36632,
36633,
36604,
36605,
36610,
36611,
32044,
32045,
32050,
32051,
32040,
32046,
32041,
32047,
32042,
32043,
32048,
32049,
30088,
30297,
30306,
30307,
30293,
30298,
30294,
30299,
30295,
30296,
30300,
30305,
25901,
25906,
25902,
25907,
25898,
25903,
25899,
25904,
25900,
25905,
27076,
27078,
21567,
21569,
21568,
21570,
18658,
21598,
22883,
22884,
22885,
22886,
22887,
22888,
18637,
20245,
18638,
20246,
18639,
20247,
16571,
20248,
42417,
42418,
42419,
42420,
42423,
42424,
42425,
42426,
42421,
42422,
42427,
42428,
43603,
43604,
43605,
43606,
43596,
43597,
43598,
43599,
43607,
43608,
43600,
43601,
43593,
43594,
35368,
32014,
35367,
35369,
36412,
35370,
36413,
35371,
36414,
32015,
32016,
32017,
35372,
36415,
35373,
36416,
32018,
32019,
27317,
26201,
29978,
29977,
28656,
27436,
29973,
27318,
29974,
27319,
27320,
29976,
29975,
23928,
24833,
23929,
23924,
24830,
23925,
24831,
23839,
23926,
24832,
23927,
23922,
24829,
23923,
19493,
19491,
19492,
22889,
19487,
22890,
19488,
19489,
19490,
19485,
19486,
13527,
16957,
13526,
13515,
13523,
13524,
13525,
13521,
13522,
12675,
10766,
10767,
10762,
10763,
10764,
10765,
10760,
10761,
8585,
8583,
8584,
8578,
8579,
8580,
8581,
8575,
5890,
5864,
5886,
5887,
5888,
5889,
5863,
4639,
4637,
4641,
4642,
4640,
44081,
44082,
44083,
44084,
44085,
44086,
44087,
44088,
44089,
37344,
37345,
37346,
37347,
37348,
37204,
37349,
37350,
36844,
37351,
37352,
37353,
31530,
31527,
31529,
31526,
37391,
31524,
37390,
31525,
31523,
37389,
27960,
27961,
27959,
27957,
27958,
27954,
27955,
27956,
25066,
25067,
25065,
25063,
25064,
27080,
25014,
25062,
24969,
22389,
22632,
22633,
22882,
22881,
18112,
18109,
18110,
18111,
18106,
18107,
18108,
18103,
18104,
18105,
12268,
12415,
12416,
12417,
12203,
12418,
12419,
12412,
12413,
12414,
9314,
9311,
9312,
9313,
9315,
9308,
9309,
9310,
9305,
9306,
9307,
9316,
5776,
5780,
5778,
5777,
5895,
5782,
5783,
5781,
5774,
5775,
5779,
4449,
4447,
4448,
4430,
4444,
4445,
4446,
4441,
4442,
4443,
3674,
3672,
3673,
6765,
3670,
3671,
3667,
3668,
3669,
6767,
3665,
3666,
2643,
2641,
2652,
2653,
2642,
1597,
1723,
1599,
1596,
1720,
1721,
2562,
1397,
1598,
1878,
35951,
34968,
35657,
35658,
35659,
39962,
39963,
39964,
39965,
39966,
43974,
43975,
43976,
43977,
43978,
38819,
38820,
38821,
38822,
38400,
38401,
38823,
38699,
38825,
38826,
38402,
38403,
32898,
32895,
32896,
32897,
32892,
32893,
32894,
29134,
29135,
29129,
29130,
29131,
29132,
29133,
29125,
29126,
29127,
29128,
26244,
26238,
26237,
26234,
26235,
26236,
27079,
24991,
24992,
24993,
26229,
24989,
26232,
24990,
26156,
22896,
19465,
22891,
19460,
22892,
19461,
22893,
19462,
22894,
19463,
22895,
19464,
18971,
18972,
18973,
14411,
14775,
15533,
15534,
14774,
15535,
44786,
44787,
44788,
44789,
44790,
44791,
44792,
44793,
34853,
34851,
34854,
34855,
34856,
34646,
39929,
39930,
39931,
39932,
39933,
39934,
43097,
43098,
43099,
43100,
43101,
43102,
31521,
42454,
39893,
42875,
1145114,
3621,
3622,
3623,
2915,
2916,
2917,
2918,
2919,
1398,
1916,
1917,
1918,
1522,
1523,
1524,
1525,
1526,
145,
146,
147,
325,
326,
327,
3624,
3625,
3626,
2920,
2921,
2922,
3211,
1920,
1922,
1923,
2564,
1527,
1528,
1529,
1530,
1653,
329,
854,
870,
981,
982,
1227,
148,
149,
331,
642,
643,
644,
646,
647,
984,
985,
1071,
1072,
34703,
27901,
27902,
27903,
27904,
27905,
24079,
24080,
24081,
24082,
21117,
21118,
21119,
15734,
15837,
15838,
11446,
11447,
11448,
9017,
9019,
9020,
5302,
7362,
34704,
30961,
30962,
30963,
30964,
30965,
24083,
25450,
25451,
27077,
21120,
21121,
21122,
15839,
15840,
15841,
11449,
11450,
9021,
9022,
7363,
7364,
1149115,
38058,
38059,
28945,
28946,
28947,
38061,
38062,
28944,
28943,
28580,
24182,
24183,
24184,
24185,
24186,
24187,
20194,
20240,
20195,
16543,
16542,
16541,
15816,
39307,
39313,
39308,
39314,
39309,
39315,
28541,
28542,
39310,
39316,
39311,
39317,
39258,
39318,
39312,
39319,
39282,
39320,
25891,
25892,
25893,
25894,
24188,
24189,
24458,
19523,
19429,
19508,
19509,
19510,
19511,
15948,
15949,
15950,
10956,
10957,
10952,
10953,
10954,
10955,
4808,
4809,
4810,
4811,
4812,
4813,
4814,
5407,
4151,
4152,
4153,
4154,
4155,
4156,
3457,
2095,
2070,
2096,
2071,
2097,
2072,
611,
24204,
24205,
24206,
24207,
23072,
28091,
28092,
28093,
28094,
27240,
38382,
38383,
38384,
38268,
43089,
43091,
43090,
43092,
36464,
36467,
36465,
36468,
35773,
36466,
36361,
36460,
36362,
36461,
36299,
36462,
35772,
36463,
29140,
29141,
29142,
29143,
29144,
20081,
20871,
20870,
20916,
20917,
40643,
40644,
40645,
40646,
40647,
40648,
40649,
40650,
40651,
40652,
40653,
40654,
40655,
40192,
43914,
43915,
43916,
43917,
43918,
43919,
43920,
36144,
36148,
36145,
36149,
36146,
36150,
36147,
36151,
30975,
30976,
30977,
36238,
36239,
36256,
36240,
36257,
36241,
36258,
36242,
36259,
36243,
36260,
36244,
36261,
35109,
35110,
30947,
30948,
30949,
30950,
30951,
30302,
30303,
30945,
30946,
25647,
25648,
22375,
22376,
22378,
22518,
22270,
22373,
22374,
15963,
20619,
20622,
20623,
15962,
20614,
12031,
12077,
12078,
12076,
12065,
7252,
7253,
7254,
7249,
7250,
7251,
4330,
3764,
3449,
2975,
2976,
3448,
2974,
1825,
1627,
1824,
1626,
1192,
42645,
42646,
42647,
42648,
42649,
29666,
29667,
29665,
29254,
29664,
43204,
43205,
24851,
24852,
24853,
24854,
24680,
21465,
21466,
21467,
13041,
11399,
15608,
13042,
15609,
41795,
41796,
41410,
28950,
28585,
28951,
28952,
28953,
28954,
20143,
20144,
24126,
20041,
20139,
20141,
20142,
19007,
14500,
14501,
14435,
14498,
14499,
5487,
5703,
5705,
5704,
5706,
12652,
38058,
38059,
28945,
28946,
28947,
38061,
38062,
28944,
28943,
28580,
24182,
24183,
24184,
24185,
24186,
24187,
20194,
20240,
20195,
16543,
16542,
16541,
15816,
39307,
39313,
39308,
39314,
39309,
39315,
28541,
28542,
39310,
39316,
39311,
39317,
39258,
39318,
39312,
39319,
39282,
39320,
25891,
25892,
25893,
25894,
24188,
24189,
24458,
19523,
19429,
19508,
19509,
19510,
19511,
15948,
15949,
15950,
10956,
10957,
10952,
10953,
10954,
10955,
4808,
4809,
4810,
4811,
4812,
4813,
4814,
5407,
4151,
4152,
4153,
4154,
4155,
4156,
3457,
2095,
2070,
2096,
2071,
2097,
2072,
611,
24204,
24205,
24206,
24207,
23072,
28091,
28092,
28093,
28094,
27240,
38382,
38383,
38384,
38268,
43089,
43091,
43090,
43092,
36464,
36467,
36465,
36468,
35773,
36466,
36361,
36460,
36362,
36461,
36299,
36462,
35772,
36463,
29140,
29141,
29142,
29143,
29144,
20081,
20871,
20870,
20916,
20917,
40643,
40644,
40645,
40646,
40647,
40648,
40649,
40650,
40651,
40652,
40653,
40654,
40655,
40192,
43914,
43915,
43916,
43917,
43918,
43919,
43920,
36144,
36148,
36145,
36149,
36146,
36150,
36147,
36151,
30975,
30976,
30977,
36238,
36239,
36256,
36240,
36257,
36241,
36258,
36242,
36259,
36243,
36260,
36244,
36261,
35109,
35110,
30947,
30948,
30949,
30950,
30951,
30302,
30303,
30945,
30946,
25647,
25648,
22375,
22376,
22378,
22518,
22270,
22373,
22374,
15963,
20619,
20622,
20623,
15962,
20614,
12031,
12077,
12078,
12076,
12065,
7252,
7253,
7254,
7249,
7250,
7251,
4330,
3764,
3449,
2975,
2976,
3448,
2974,
1825,
1627,
1824,
1626,
1192,
42645,
42646,
42647,
42648,
42649,
29666,
29667,
29665,
29254,
29664,
43204,
43205,
24851,
24852,
24853,
24854,
24680,
21465,
21466,
21467,
13041,
11399,
15608,
13042,
15609,
41795,
41796,
41410,
28950,
28585,
28951,
28952,
28953,
28954,
20143,
20144,
24126,
20041,
20139,
20141,
20142,
19007,
14500,
14501,
14435,
14498,
14499,
5487,
5703,
5705,
5704,
5706,
12652,
38954,
38161,
40568,
40569,
44685,
36977,
37813,
38504,
38505,
36978,
35060,
35061,
36857,
38497,
35062,
36986,
38367,
33086,
35063,
30739,
30740,
29431,
21496,
21495,
21497,
18742,
21498,
40550,
40551,
40552,
40553,
40554,
40555,
40556,
40557,
40558,
41692
};
typesBO.setTypeIds(Arrays.asList(typeIds));
vehicleService.saveVehicleTypes(typesBO, 1L);
}
@Test
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!