Commit aebf449a9d4e9605a36a98fae5b06280961463d5

Authored by 徐烜
1 parent d4bc0d48

1、修改VehicleDataSyncController,添加refreshBuffer方法,用于动态刷新车辆同步ktr文件

2、修改车辆同步相关页面,添加刷新功能界面逻辑
3、修改车辆同步ktr,添加同步车牌号的逻辑
src/main/java/com/bsth/controller/schedule/datasync/VehicleDataSyncController.java
@@ -6,7 +6,12 @@ import com.bsth.controller.schedule.datasync.request.VehicleDataSyncTaskRequest; @@ -6,7 +6,12 @@ import com.bsth.controller.schedule.datasync.request.VehicleDataSyncTaskRequest;
6 import com.bsth.entity.schedule.datasync.VehicleDataSyncTask; 6 import com.bsth.entity.schedule.datasync.VehicleDataSyncTask;
7 import com.bsth.entity.schedule.datasync.VehicleDataSyncTaskTypeEnum; 7 import com.bsth.entity.schedule.datasync.VehicleDataSyncTaskTypeEnum;
8 import com.bsth.service.schedule.datasync.VehicleDataSyncTaskService; 8 import com.bsth.service.schedule.datasync.VehicleDataSyncTaskService;
  9 +import com.bsth.service.schedule.utils.DataToolsProperties;
9 import com.bsth.service.schedule.utils.MyHttpUtils; 10 import com.bsth.service.schedule.utils.MyHttpUtils;
  11 +import org.apache.commons.vfs2.FileObject;
  12 +import org.apache.commons.vfs2.FileSystem;
  13 +import org.apache.commons.vfs2.FilesCache;
  14 +import org.pentaho.di.core.vfs.KettleVFS;
10 import org.springframework.beans.factory.annotation.Autowired; 15 import org.springframework.beans.factory.annotation.Autowired;
11 import org.springframework.web.bind.annotation.*; 16 import org.springframework.web.bind.annotation.*;
12 17
@@ -48,6 +53,37 @@ public class VehicleDataSyncController extends BController<VehicleDataSyncTask, @@ -48,6 +53,37 @@ public class VehicleDataSyncController extends BController<VehicleDataSyncTask,
48 } 53 }
49 //------------------ 外部系统调用的api(如上)-----------------------// 54 //------------------ 外部系统调用的api(如上)-----------------------//
50 55
  56 + @Autowired
  57 + private DataToolsProperties dataToolsProperties;
  58 + /**
  59 + * 刷新缓存。
  60 + * @return
  61 + */
  62 + @GetMapping(value = "/refreshBuffer")
  63 + public ApiResult refreshBuffer() {
  64 + try {
  65 + // 1、刷新车辆同步ETL文件
  66 + // 注意:使用Kettle内部的相关类清除指定ktr的缓存
  67 + File ktrFile = new File(this.getClass().getResource(
  68 + dataToolsProperties.getVehicleDatasyncktr()).toURI());
  69 + FileObject fileObject = KettleVFS.getFileObject(ktrFile.getAbsolutePath());
  70 + FileSystem fileSystem = fileObject.getFileSystem();
  71 + FilesCache filesCache = KettleVFS.getInstance().getFileSystemManager().getFilesCache();
  72 +// System.out.println(filesCache.getFile(fileSystem, fileObject.getName()));
  73 + filesCache.removeFile(fileSystem, fileObject.getName());
  74 +
  75 + return ApiResult.success(
  76 + "200",
  77 + "刷新成功",
  78 + "刷新成功");
  79 + } catch (Exception exp) {
  80 + exp.printStackTrace();
  81 + return ApiResult.failure(
  82 + "500",
  83 + "刷新失败,内部错误:" + exp.getMessage());
  84 + }
  85 + }
  86 +
51 /** 87 /**
52 * 手动添加同步任务。 88 * 手动添加同步任务。
53 * @param vehicleDataSyncTaskRequest 89 * @param vehicleDataSyncTaskRequest
src/main/resources/datatools/config-dev.properties
@@ -83,7 +83,7 @@ datatools.guideboards_dataoutputktr=/datatools/ktrs/guideboardDataOutput.ktr @@ -83,7 +83,7 @@ datatools.guideboards_dataoutputktr=/datatools/ktrs/guideboardDataOutput.ktr
83 datatools.vehicle_datasyncktr=/datatools/ktrs/vehicleDataSync.ktr 83 datatools.vehicle_datasyncktr=/datatools/ktrs/vehicleDataSync.ktr
84 84
85 # 车辆库访问url 85 # 车辆库访问url
86 -datatools.cars_interface=http://180.166.5.82:8076/cars/getCarsInterface 86 +datatools.cars_interface=http://58.247.254.118:8076/cars/getCarsInterface
87 #datatools.cars_interface=http://192.170.101.132:8076/cars/getCarsInterface 87 #datatools.cars_interface=http://192.170.101.132:8076/cars/getCarsInterface
88 88
89 # TODO: 89 # TODO:
src/main/resources/datatools/ktrs/vehicleDataSync.ktr
@@ -56,7 +56,7 @@ @@ -56,7 +56,7 @@
56 </parameter> 56 </parameter>
57 <parameter> 57 <parameter>
58 <name>url</name> 58 <name>url</name>
59 - <default_value>http&#x3a;&#x2f;&#x2f;180.166.5.82&#x3a;8076&#x2f;cars&#x2f;getCarsInterface</default_value> 59 + <default_value>http&#x3a;&#x2f;&#x2f;58.247.254.118&#x3a;8076&#x2f;cars&#x2f;getCarsInterface</default_value>
60 <description>&#x8f66;&#x8f86;&#x5e93;&#x7cfb;&#x7edf;&#x7684;&#x76f8;&#x5173;url&#x5730;&#x5740;</description> 60 <description>&#x8f66;&#x8f86;&#x5e93;&#x7cfb;&#x7edf;&#x7684;&#x76f8;&#x5173;url&#x5730;&#x5740;</description>
61 </parameter> 61 </parameter>
62 </parameters> 62 </parameters>
@@ -978,7 +978,7 @@ @@ -978,7 +978,7 @@
978 <displayHeader>Y</displayHeader> 978 <displayHeader>Y</displayHeader>
979 <limitRows>N</limitRows> 979 <limitRows>N</limitRows>
980 <limitRowsNumber>0</limitRowsNumber> 980 <limitRowsNumber>0</limitRowsNumber>
981 - <logmessage>&#x5f00;&#x59cb;&#x83b7;&#x53d6; &#x24;&#x7b;ssgs&#x7d; &#x8fdc;&#x7aef;&#x6570;&#x636e;&#xff0c;&#x5e76;&#x5904;&#x7406;&#x8f93;&#x51fa;&#xa;&#x83b7;&#x53d6;&#x6570;&#x636e; api url&#x3d;&#x24;&#x7b;url&#x7d;&#xa;url&#x53c2;&#x6570;&#xff08;&#x5bc6;&#x94a5;&#xff09;password&#x3d;&#x24;&#x7b;password&#x7d;&#xa;&#x6570;&#x636e;&#x6e90;&#x8fc7;&#x6ee4;&#x53c2;&#x6570;&#xff1a;&#xa;1&#x3001;&#x8f66;&#x8f86;&#x81ea;&#x7f16;&#x53f7; &#x24;&#x7b;paramClzbh&#x7d;&#xa;2&#x3001;&#x5f00;&#x59cb;&#x65f6;&#x95f4; &#x24;&#x7b;paramFrom&#x7d;&#xa;3&#x3001;&#x7ed3;&#x675f;&#x65f6;&#x95f4; &#x24;&#x7b;paramTo&#x7d;&#xa;4&#x3001;&#x6570;&#x636e;&#x68c0;&#x9a8c;&#x9519;&#x8bef;&#x6587;&#x4ef6; &#x24;&#x7b;file_validate_error&#x7d;&#xa;5&#x3001;&#x5f85;&#x5904;&#x7406;&#x6570;&#x636e;&#x6587;&#x4ef6; &#x24;&#x7b;file_prepare&#x7d;&#xa;6&#x3001;&#x65b0;&#x589e;&#x9519;&#x8bef;&#x6570;&#x636e;&#x6587;&#x4ef6; &#x24;&#x7b;file_add_error&#x7d;&#xa;7&#x3001;&#x66f4;&#x65b0;&#x9519;&#x8bef;&#x6570;&#x636e;&#x6587;&#x4ef6; &#x24;&#x7b;file_update_error&#x7d;&#xa;8&#x3001;&#x6dfb;&#x52a0;&#x8f66;&#x8f86;&#x8bbe;&#x5907;&#x9519;&#x8bef;&#x6570;&#x636e;&#x6587;&#x4ef6; &#x24;&#x7b;file_deivce_add_error&#x7d;</logmessage> 981 + <logmessage>&#x5f00;&#x59cb;&#x83b7;&#x53d6;&#x8fdc;&#x7aef;&#x6570;&#x636e;&#xff0c;&#x5e76;&#x5904;&#x7406;&#x8f93;&#x51fa;&#xa;&#x83b7;&#x53d6;&#x6570;&#x636e; api url&#x3d;&#x24;&#x7b;url&#x7d;&#xa;url&#x53c2;&#x6570;&#xff08;&#x5bc6;&#x94a5;&#xff09;password&#x3d;&#x24;&#x7b;password&#x7d;&#xa;&#x6570;&#x636e;&#x6e90;&#x8fc7;&#x6ee4;&#x53c2;&#x6570;&#xff1a;&#xa;1&#x3001;&#x8f66;&#x8f86;&#x81ea;&#x7f16;&#x53f7; &#x24;&#x7b;paramClzbh&#x7d;&#xa;2&#x3001;&#x5f00;&#x59cb;&#x65f6;&#x95f4; &#x24;&#x7b;paramFrom&#x7d;&#xa;3&#x3001;&#x7ed3;&#x675f;&#x65f6;&#x95f4; &#x24;&#x7b;paramTo&#x7d;&#xa;4&#x3001;&#x6570;&#x636e;&#x68c0;&#x9a8c;&#x9519;&#x8bef;&#x6587;&#x4ef6; &#x24;&#x7b;file_validate_error&#x7d;&#xa;5&#x3001;&#x5f85;&#x5904;&#x7406;&#x6570;&#x636e;&#x6587;&#x4ef6; &#x24;&#x7b;file_prepare&#x7d;&#xa;6&#x3001;&#x65b0;&#x589e;&#x9519;&#x8bef;&#x6570;&#x636e;&#x6587;&#x4ef6; &#x24;&#x7b;file_add_error&#x7d;&#xa;7&#x3001;&#x66f4;&#x65b0;&#x9519;&#x8bef;&#x6570;&#x636e;&#x6587;&#x4ef6; &#x24;&#x7b;file_update_error&#x7d;&#xa;8&#x3001;&#x6dfb;&#x52a0;&#x8f66;&#x8f86;&#x8bbe;&#x5907;&#x9519;&#x8bef;&#x6570;&#x636e;&#x6587;&#x4ef6; &#x24;&#x7b;file_deivce_add_error&#x7d;</logmessage>
982 <fields> 982 <fields>
983 </fields> 983 </fields>
984 <cluster_schema/> 984 <cluster_schema/>
@@ -1055,6 +1055,13 @@ @@ -1055,6 +1055,13 @@
1055 <function>&#x3d;</function> 1055 <function>&#x3d;</function>
1056 <rightvalue/> 1056 <rightvalue/>
1057 <value><name>constant</name><type>Boolean</type><text>Y</text><length>-1</length><precision>-1</precision><isnull>N</isnull><mask/></value> </condition> 1057 <value><name>constant</name><type>Boolean</type><text>Y</text><length>-1</length><precision>-1</precision><isnull>N</isnull><mask/></value> </condition>
  1058 + <condition>
  1059 + <negated>N</negated>
  1060 + <operator>OR</operator>
  1061 + <leftvalue>isChpUpdate</leftvalue>
  1062 + <function>&#x3d;</function>
  1063 + <rightvalue/>
  1064 + <value><name>constant</name><type>Boolean</type><text>Y</text><length>-1</length><precision>-1</precision><isnull>N</isnull><mask/></value> </condition>
1058 </conditions> 1065 </conditions>
1059 </condition> 1066 </condition>
1060 </compare> 1067 </compare>
@@ -1196,6 +1203,10 @@ @@ -1196,6 +1203,10 @@
1196 <rename>&#x672c;&#x5730;_&#x662f;&#x5426;&#x7535;&#x8f66;</rename> 1203 <rename>&#x672c;&#x5730;_&#x662f;&#x5426;&#x7535;&#x8f66;</rename>
1197 <length>-2</length> 1204 <length>-2</length>
1198 <precision>-2</precision> 1205 <precision>-2</precision>
  1206 + </field> <field> <name>car_plate</name>
  1207 + <rename>&#x672c;&#x5730;_&#x8f66;&#x724c;&#x53f7;</rename>
  1208 + <length>-2</length>
  1209 + <precision>-2</precision>
1199 </field> <select_unspecified>N</select_unspecified> 1210 </field> <select_unspecified>N</select_unspecified>
1200 </fields> <cluster_schema/> 1211 </fields> <cluster_schema/>
1201 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> 1212 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
@@ -1370,6 +1381,11 @@ @@ -1370,6 +1381,11 @@
1370 <type>Boolean</type> 1381 <type>Boolean</type>
1371 <format/> 1382 <format/>
1372 </field> 1383 </field>
  1384 + <field>
  1385 + <name>&#x672c;&#x5730;_&#x8f66;&#x724c;&#x53f7;</name>
  1386 + <type>String</type>
  1387 + <format/>
  1388 + </field>
1373 </fields> 1389 </fields>
1374 <custom> 1390 <custom>
1375 <header_font_name>arial</header_font_name> 1391 <header_font_name>arial</header_font_name>
@@ -2292,7 +2308,7 @@ @@ -2292,7 +2308,7 @@
2292 <optimizationLevel>9</optimizationLevel> 2308 <optimizationLevel>9</optimizationLevel>
2293 <jsScripts> <jsScript> <jsScript_type>0</jsScript_type> 2309 <jsScripts> <jsScript> <jsScript_type>0</jsScript_type>
2294 <jsScript_name>Script 1</jsScript_name> 2310 <jsScript_name>Script 1</jsScript_name>
2295 - <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;&#x2f;&#x2f;---------------- &#x66f4;&#x65b0;&#x7528;&#x7684;&#x5b57;&#x6bb5;&#x91cd;&#x65b0;&#x547d;&#x540d;&#xff08;&#x65b9;&#x4fbf;&#x540e;&#x7eed;&#x64cd;&#x4f5c;&#xff09;-----------&#x2f;&#x2f;&#xa;&#x2f;&#x2f; TODO&#xff1a;&#x540e;&#x9762;&#x8fd8;&#x6709;&#x66f4;&#x591a;&#x7684;&#x66f4;&#x65b0;&#x5b57;&#x6bb5;&#xa;&#xa;var update_date &#x3d; new Date&#x28;&#x29;&#x3b;&#xa;&#xa;&#x2f;&#x2f;------------ 1&#x3001;&#x516c;&#x53f8;&#x5206;&#x516c;&#x53f8;&#x76f8;&#x5173;&#x5b57;&#x6bb5; -----------&#x2f;&#x2f;&#xa;var company_update &#x3d; gsmc&#x3b; &#x2f;&#x2f; &#x516c;&#x53f8;&#x540d;&#x79f0;&#xa;var branche_company_update &#x3d; fgsmc&#x3b; &#x2f;&#x2f; &#x5206;&#x516c;&#x53f8;&#x540d;&#x79f0;&#xa;var business_code_update &#x3d; gsdm&#x3b; &#x2f;&#x2f; &#x516c;&#x53f8;&#x4ee3;&#x7801;&#xa;var branch_company_code_update &#x3d; fgsdm&#x3b; &#x2f;&#x2f; &#x5206;&#x516c;&#x53f8;&#x4ee3;&#x7801;&#xa;var isGsUpdate &#x3d; false&#x3b; &#x2f;&#x2f; &#x662f;&#x5426;&#x66f4;&#x65b0;&#xa;if &#x28;&#x21;company_update.equals&#x28;company&#x29;&#x29; &#x7b;&#xa; isGsUpdate &#x3d; true&#x3b;&#xa;&#x7d;&#xa;if &#x28;&#x21;branche_company_update.equals&#x28;branche_company&#x29;&#x29; &#x7b;&#xa; isGsUpdate &#x3d; true&#x3b;&#xa;&#x7d;&#xa;&#xa;&#x2f;&#x2f;------------- 2&#x3001;&#x62a5;&#x5e9f;&#x76f8;&#x5173;&#x5b57;&#x6bb5; ------------&#x2f;&#x2f;&#xa;var equipmentCode_update &#x3d; equipment_code&#x3b; &#x2f;&#x2f; &#x8bbe;&#x5907;&#x7f16;&#x53f7;&#xa;var scrapCode_update &#x3d; scrap_code&#x3b; &#x2f;&#x2f; &#x62a5;&#x5e9f;&#x53f7;&#xa;var scrapState_update &#x3d; &#x28;scrap_state &#x3d;&#x3d; true &#x3f; 1 &#x3a; 0&#x29;&#x3b; &#x2f;&#x2f; &#x62a5;&#x5e9f;&#x72b6;&#x6001;&#xa;var scrapState_update_b &#x3d; scrap_state&#x3b; &#x2f;&#x2f; &#x62a5;&#x5e9f;&#x72b6;&#x6001;&#xa;var scrapDate_update &#x3d; scrap_date&#x3b; &#x2f;&#x2f; &#x62a5;&#x5e9f;&#x65e5;&#x671f;&#xa;var isScrapUpdate &#x3d; false&#x3b; &#x2f;&#x2f; &#x662f;&#x5426;&#x66f4;&#x65b0;&#xa;if &#x28;carState &#x3d;&#x3d; &#x27;3&#x27; &#x7c;&#x7c; scrapType &#x3d;&#x3d; &#x27;1&#x27;&#x29; &#x7b;&#xa; scrapState_update_b &#x3d; true&#x3b;&#xa; scrapState_update &#x3d; 1&#x3b;&#xa; &#x2f;&#x2f; &#x4f7f;&#x7528;&#x8f66;&#x8f86;&#x5e93;&#x7684;&#x62a5;&#x5e9f;&#x65f6;&#x95f4;&#xa; scrapDate_update &#x3d; scrapDate &#x3d;&#x3d; null &#x3f; null &#x3a; str2date&#x28;scrapDate, &#x27;yyyy-MM-dd&#x27;&#x29;&#x3b;&#xa; &#x2f;&#x2f; &#x8f66;&#x8f86;&#x5e93;&#x62a5;&#x5e9f;&#x65f6;&#x95f4;&#x4e3a;&#x7a7a;&#xff0c;&#x518d;&#x4f7f;&#x7528;&#x5f53;&#x524d;&#x65f6;&#x95f4;&#xa; if &#x28;scrapDate_update &#x3d;&#x3d; null&#x29; &#x7b;&#xa; scrapDate_update &#x3d; new Date&#x28;&#x29;&#x3b; &#x2f;&#x2f; &#x62a5;&#x5e9f;&#x65e5;&#x671f;&#x8bbe;&#x5b9a;&#x4f4d;&#x5f53;&#x524d;&#x65e5;&#x671f;&#xa; &#x7d;&#xa; equipmentCode_update &#x3d; &#x27;BF-&#x27; &#x2b; equipmentCode_update&#x3b;&#xa; scrapCode_update &#x3d; &#x27;BF-&#x27; &#x2b; equipmentCode_update&#x3b;&#xa;&#x7d;&#xa;if &#x28;scrapState_update_b &#x21;&#x3d; scrap_state&#x29; &#x7b;&#xa; isScrapUpdate &#x3d; true&#x3b;&#xa;&#x7d;&#xa;&#x2f;&#x2f;-------------- 3&#x3001;&#x662f;&#x5426;&#x7535;&#x8f66;&#x76f8;&#x5173;&#x5b57;&#x6bb5; ------------&#x2f;&#x2f;&#xa;var sfdc_update &#x3d; &#x28;carEnergyType &#x3d;&#x3d; &#x27;&#x5e38;&#x89c4;&#x67f4;&#x6cb9;&#x27; &#x3f; 0 &#x3a; 1&#x29;&#x3b; &#x2f;&#x2f; &#x662f;&#x5426;&#x7535;&#x8f66;&#xa;var sfdc_update_b &#x3d; &#x28;sfdc &#x3d;&#x3d; true &#x3f; true &#x3a; false&#x29;&#x3b; &#x2f;&#x2f; &#x662f;&#x5426;&#x7535;&#x8f66;&#xa;var isSfdcUpdate &#x3d; false&#x3b; &#x2f;&#x2f; &#x662f;&#x5426;&#x66f4;&#x65b0;&#xa;if &#x28;sfdc_update_b &#x21;&#x3d; sfdc&#x29; &#x7b; &#xa; isSfdcUpdate &#x3d; true&#x3b;&#xa;&#x7d;</jsScript_script> 2311 + <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;&#x2f;&#x2f;---------------- &#x66f4;&#x65b0;&#x7528;&#x7684;&#x5b57;&#x6bb5;&#x91cd;&#x65b0;&#x547d;&#x540d;&#xff08;&#x65b9;&#x4fbf;&#x540e;&#x7eed;&#x64cd;&#x4f5c;&#xff09;-----------&#x2f;&#x2f;&#xa;&#x2f;&#x2f; TODO&#xff1a;&#x540e;&#x9762;&#x8fd8;&#x6709;&#x66f4;&#x591a;&#x7684;&#x66f4;&#x65b0;&#x5b57;&#x6bb5;&#xa;&#xa;var update_date &#x3d; new Date&#x28;&#x29;&#x3b;&#xa;&#xa;&#x2f;&#x2f;------------ 1&#x3001;&#x516c;&#x53f8;&#x5206;&#x516c;&#x53f8;&#x76f8;&#x5173;&#x5b57;&#x6bb5; -----------&#x2f;&#x2f;&#xa;var company_update &#x3d; gsmc&#x3b; &#x2f;&#x2f; &#x516c;&#x53f8;&#x540d;&#x79f0;&#xa;var branche_company_update &#x3d; fgsmc&#x3b; &#x2f;&#x2f; &#x5206;&#x516c;&#x53f8;&#x540d;&#x79f0;&#xa;var business_code_update &#x3d; gsdm&#x3b; &#x2f;&#x2f; &#x516c;&#x53f8;&#x4ee3;&#x7801;&#xa;var branch_company_code_update &#x3d; fgsdm&#x3b; &#x2f;&#x2f; &#x5206;&#x516c;&#x53f8;&#x4ee3;&#x7801;&#xa;var isGsUpdate &#x3d; false&#x3b; &#x2f;&#x2f; &#x662f;&#x5426;&#x66f4;&#x65b0;&#xa;if &#x28;&#x21;company_update.equals&#x28;company&#x29;&#x29; &#x7b;&#xa; isGsUpdate &#x3d; true&#x3b;&#xa;&#x7d;&#xa;if &#x28;&#x21;branche_company_update.equals&#x28;branche_company&#x29;&#x29; &#x7b;&#xa; isGsUpdate &#x3d; true&#x3b;&#xa;&#x7d;&#xa;&#xa;&#x2f;&#x2f;------------- 2&#x3001;&#x62a5;&#x5e9f;&#x76f8;&#x5173;&#x5b57;&#x6bb5; ------------&#x2f;&#x2f;&#xa;var equipmentCode_update &#x3d; equipment_code&#x3b; &#x2f;&#x2f; &#x8bbe;&#x5907;&#x7f16;&#x53f7;&#xa;var scrapCode_update &#x3d; scrap_code&#x3b; &#x2f;&#x2f; &#x62a5;&#x5e9f;&#x53f7;&#xa;var scrapState_update &#x3d; &#x28;scrap_state &#x3d;&#x3d; true &#x3f; 1 &#x3a; 0&#x29;&#x3b; &#x2f;&#x2f; &#x62a5;&#x5e9f;&#x72b6;&#x6001;&#xa;var scrapState_update_b &#x3d; scrap_state&#x3b; &#x2f;&#x2f; &#x62a5;&#x5e9f;&#x72b6;&#x6001;&#xa;var scrapDate_update &#x3d; scrap_date&#x3b; &#x2f;&#x2f; &#x62a5;&#x5e9f;&#x65e5;&#x671f;&#xa;var isScrapUpdate &#x3d; false&#x3b; &#x2f;&#x2f; &#x662f;&#x5426;&#x66f4;&#x65b0;&#xa;if &#x28;carState &#x3d;&#x3d; &#x27;3&#x27; &#x7c;&#x7c; scrapType &#x3d;&#x3d; &#x27;1&#x27;&#x29; &#x7b;&#xa; scrapState_update_b &#x3d; true&#x3b;&#xa; scrapState_update &#x3d; 1&#x3b;&#xa; &#x2f;&#x2f; &#x4f7f;&#x7528;&#x8f66;&#x8f86;&#x5e93;&#x7684;&#x62a5;&#x5e9f;&#x65f6;&#x95f4;&#xa; scrapDate_update &#x3d; scrapDate &#x3d;&#x3d; null &#x3f; null &#x3a; str2date&#x28;scrapDate, &#x27;yyyy-MM-dd&#x27;&#x29;&#x3b;&#xa; &#x2f;&#x2f; &#x8f66;&#x8f86;&#x5e93;&#x62a5;&#x5e9f;&#x65f6;&#x95f4;&#x4e3a;&#x7a7a;&#xff0c;&#x518d;&#x4f7f;&#x7528;&#x5f53;&#x524d;&#x65f6;&#x95f4;&#xa; if &#x28;scrapDate_update &#x3d;&#x3d; null&#x29; &#x7b;&#xa; scrapDate_update &#x3d; new Date&#x28;&#x29;&#x3b; &#x2f;&#x2f; &#x62a5;&#x5e9f;&#x65e5;&#x671f;&#x8bbe;&#x5b9a;&#x4f4d;&#x5f53;&#x524d;&#x65e5;&#x671f;&#xa; &#x7d;&#xa; equipmentCode_update &#x3d; &#x27;BF-&#x27; &#x2b; equipmentCode_update&#x3b;&#xa; scrapCode_update &#x3d; &#x27;BF-&#x27; &#x2b; equipmentCode_update&#x3b;&#xa;&#x7d;&#xa;if &#x28;scrapState_update_b &#x21;&#x3d; scrap_state&#x29; &#x7b;&#xa; isScrapUpdate &#x3d; true&#x3b;&#xa;&#x7d;&#xa;&#x2f;&#x2f;-------------- 3&#x3001;&#x662f;&#x5426;&#x7535;&#x8f66;&#x76f8;&#x5173;&#x5b57;&#x6bb5; ------------&#x2f;&#x2f;&#xa;var sfdc_update &#x3d; &#x28;carEnergyType &#x3d;&#x3d; &#x27;&#x5e38;&#x89c4;&#x67f4;&#x6cb9;&#x27; &#x3f; 0 &#x3a; 1&#x29;&#x3b; &#x2f;&#x2f; &#x662f;&#x5426;&#x7535;&#x8f66;&#xa;var sfdc_update_b &#x3d; &#x28;sfdc &#x3d;&#x3d; true &#x3f; true &#x3a; false&#x29;&#x3b; &#x2f;&#x2f; &#x662f;&#x5426;&#x7535;&#x8f66;&#xa;var isSfdcUpdate &#x3d; false&#x3b; &#x2f;&#x2f; &#x662f;&#x5426;&#x66f4;&#x65b0;&#xa;if &#x28;sfdc_update_b &#x21;&#x3d; sfdc&#x29; &#x7b; &#xa; isSfdcUpdate &#x3d; true&#x3b;&#xa;&#x7d;&#xa;&#x2f;&#x2f;--------------- 4&#x3001;&#x8f66;&#x724c;&#x53f7;&#x76f8;&#x5173;&#x5b57;&#x6bb5; ---------------&#x2f;&#x2f;&#xa;var cph_update &#x3d; cph&#x3b; &#x2f;&#x2f; &#x5f85;&#x66f4;&#x65b0;&#x8f66;&#x724c;&#x53f7;&#xa;var isChpUpdate &#x3d; false&#x3b; &#x2f;&#x2f; &#x662f;&#x5426;&#x66f4;&#x65b0;&#xa;if &#x28;&#x21;cph_update.equals&#x28;car_plate&#x29;&#x29; &#x7b;&#xa; isChpUpdate &#x3d; true&#x3b;&#xa;&#x7d;&#xa;</jsScript_script>
2296 </jsScript> </jsScripts> <fields> <field> <name>update_date</name> 2312 </jsScript> </jsScripts> <fields> <field> <name>update_date</name>
2297 <rename>update_date</rename> 2313 <rename>update_date</rename>
2298 <type>Date</type> 2314 <type>Date</type>
@@ -2383,6 +2399,18 @@ @@ -2383,6 +2399,18 @@
2383 <length>-1</length> 2399 <length>-1</length>
2384 <precision>-1</precision> 2400 <precision>-1</precision>
2385 <replace>N</replace> 2401 <replace>N</replace>
  2402 + </field> <field> <name>cph_update</name>
  2403 + <rename>cph_update</rename>
  2404 + <type>String</type>
  2405 + <length>-1</length>
  2406 + <precision>-1</precision>
  2407 + <replace>N</replace>
  2408 + </field> <field> <name>isChpUpdate</name>
  2409 + <rename>isChpUpdate</rename>
  2410 + <type>Boolean</type>
  2411 + <length>-1</length>
  2412 + <precision>-1</precision>
  2413 + <replace>N</replace>
2386 </field> </fields> <cluster_schema/> 2414 </field> </fields> <cluster_schema/>
2387 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> 2415 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
2388 <xloc>670</xloc> 2416 <xloc>670</xloc>
@@ -2454,6 +2482,10 @@ @@ -2454,6 +2482,10 @@
2454 <rename>sfdc_update</rename> 2482 <rename>sfdc_update</rename>
2455 </value> 2483 </value>
2456 <value> 2484 <value>
  2485 + <name>car_plate</name>
  2486 + <rename>cph_update</rename>
  2487 + </value>
  2488 + <value>
2457 <name>update_date</name> 2489 <name>update_date</name>
2458 <rename>update_date</rename> 2490 <rename>update_date</rename>
2459 </value> 2491 </value>
@@ -2563,6 +2595,11 @@ @@ -2563,6 +2595,11 @@
2563 <format/> 2595 <format/>
2564 </field> 2596 </field>
2565 <field> 2597 <field>
  2598 + <name>cph_update</name>
  2599 + <type>String</type>
  2600 + <format/>
  2601 + </field>
  2602 + <field>
2566 <name>NrErrors</name> 2603 <name>NrErrors</name>
2567 <type>Integer</type> 2604 <type>Integer</type>
2568 <format/> 2605 <format/>
@@ -2731,6 +2768,12 @@ @@ -2731,6 +2768,12 @@
2731 <default/> 2768 <default/>
2732 <type>Integer</type> 2769 <type>Integer</type>
2733 </value> 2770 </value>
  2771 + <value>
  2772 + <name>car_plate</name>
  2773 + <rename>car_plate</rename>
  2774 + <default/>
  2775 + <type>String</type>
  2776 + </value>
2734 </lookup> 2777 </lookup>
2735 <cluster_schema/> 2778 <cluster_schema/>
2736 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> 2779 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
src/main/resources/static/pages/scheduleApp/module/basicInfo/vehicleDataSyncManage/index.html
@@ -40,6 +40,10 @@ @@ -40,6 +40,10 @@
40 <i class="fa fa-plus"></i> 40 <i class="fa fa-plus"></i>
41 添加同步任务 41 添加同步任务
42 </a> 42 </a>
  43 + <a href="javascript:" class="btn blue" ng-click="ctrl.refreshBuffer()">
  44 + <i class="fa fa-refresh" aria-hidden="true"></i>
  45 + 刷新缓存
  46 + </a>
43 </div> 47 </div>
44 </div> 48 </div>
45 49
src/main/resources/static/pages/scheduleApp/module/basicInfo/vehicleDataSyncManage/module.js
@@ -73,6 +73,10 @@ angular.module(&#39;ScheduleApp&#39;).factory( @@ -73,6 +73,10 @@ angular.module(&#39;ScheduleApp&#39;).factory(
73 73
74 logFileExportPromise: function(logId, type) { 74 logFileExportPromise: function(logId, type) {
75 return service.logFileExport.getLog({id: logId, type: type}).$promise; 75 return service.logFileExport.getLog({id: logId, type: type}).$promise;
  76 + },
  77 +
  78 + refreshBufferPromise: function() {
  79 + return service.refreshBuffer.refresh().$promise;
76 } 80 }
77 81
78 }; 82 };
@@ -86,7 +90,8 @@ angular.module(&#39;ScheduleApp&#39;).controller( @@ -86,7 +90,8 @@ angular.module(&#39;ScheduleApp&#39;).controller(
86 'VehicleDataSyncManageCtrl', 90 'VehicleDataSyncManageCtrl',
87 [ 91 [
88 '$state', 92 '$state',
89 - function($state) { 93 + 'VehicleDataSyncManageService',
  94 + function($state, service) {
90 var self = this; 95 var self = this;
91 96
92 // 切换到form状态 97 // 切换到form状态
@@ -95,6 +100,21 @@ angular.module(&#39;ScheduleApp&#39;).controller( @@ -95,6 +100,21 @@ angular.module(&#39;ScheduleApp&#39;).controller(
95 $state.go("vehicleDataSyncManage_form"); 100 $state.go("vehicleDataSyncManage_form");
96 }; 101 };
97 102
  103 + // 刷新缓存
  104 + self.refreshBuffer = function() {
  105 + var promise = service.refreshBufferPromise();
  106 + promise.then(
  107 + function(result) {
  108 + // console.log(result);
  109 + // console.log(result.msg);
  110 + alert(result.msg);
  111 + },
  112 + function(result) {
  113 + console.log("获取日志文件失败:" + result);
  114 + }
  115 + )
  116 + };
  117 +
98 } 118 }
99 ] 119 ]
100 ); 120 );
src/main/resources/static/pages/scheduleApp/module/basicInfo/vehicleDataSyncManage/service.js
@@ -69,6 +69,19 @@ angular.module(&#39;ScheduleApp&#39;).factory( @@ -69,6 +69,19 @@ angular.module(&#39;ScheduleApp&#39;).factory(
69 method: 'POST' 69 method: 'POST'
70 } 70 }
71 } 71 }
  72 + ),
  73 + refreshBuffer: $resource(
  74 + '/dataSync/vehicle/refreshBuffer',
  75 + {},
  76 + {
  77 + refresh: {
  78 + method: 'GET',
  79 + transformResponse: function(rs) {
  80 + var dst = angular.fromJson(rs);
  81 + return dst;
  82 + }
  83 + }
  84 + }
72 ) 85 )
73 }; 86 };
74 } 87 }
src/main/resources/static/pages/scheduleApp/module/common/main.js
@@ -277,7 +277,6 @@ ScheduleApp.factory( @@ -277,7 +277,6 @@ ScheduleApp.factory(
277 277
278 // 处理错误,springboot会包装返回的错误数据 278 // 处理错误,springboot会包装返回的错误数据
279 // 如:{"timestamp":1478674739246,"status":500,"error":"Internal Server Error","exception":"java.lang.ClassCastException","message":"java.lang.String cannot be cast to java.lang.Long","path":"/tidc/importfile"} 279 // 如:{"timestamp":1478674739246,"status":500,"error":"Internal Server Error","exception":"java.lang.ClassCastException","message":"java.lang.String cannot be cast to java.lang.Long","path":"/tidc/importfile"}
280 -  
281 var output = []; 280 var output = [];
282 if (!rejection.status) { 281 if (!rejection.status) {
283 // alert("我擦,后台返回连个状态码都没返回,见鬼了,服务器可能重启了"); 282 // alert("我擦,后台返回连个状态码都没返回,见鬼了,服务器可能重启了");
@@ -287,7 +286,13 @@ ScheduleApp.factory( @@ -287,7 +286,13 @@ ScheduleApp.factory(
287 console.log("貌似服务端连接不上"); 286 console.log("貌似服务端连接不上");
288 } else { 287 } else {
289 output.push("状态编码:" + rejection.status); 288 output.push("状态编码:" + rejection.status);
290 - output.push("错误内容:" + angular.toJson(rejection.data)); 289 + // output.push("错误内容:" + angular.toJson(rejection.data));
  290 + if (rejection.data) {
  291 + output.push("错误内容:" + rejection.data.message);
  292 + } else {
  293 + output.push("错误内容:" + rejection.message);
  294 + }
  295 +
291 if (rejection.status == 500) { 296 if (rejection.status == 500) {
292 alert("服务端错误:" + "\n" + output.join("\n")); 297 alert("服务端错误:" + "\n" + output.join("\n"));
293 } else if (rejection.status == 407) { 298 } else if (rejection.status == 407) {
@@ -388,4 +393,4 @@ $.ajaxTransport(&quot;+binary&quot;, function(options, originalOptions, jqXHR){ @@ -388,4 +393,4 @@ $.ajaxTransport(&quot;+binary&quot;, function(options, originalOptions, jqXHR){
388 } 393 }
389 }; 394 };
390 } 395 }
391 -});  
392 \ No newline at end of file 396 \ No newline at end of file
  397 +});
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice.js
@@ -255,6 +255,19 @@ angular.module(&#39;ScheduleApp&#39;).factory( @@ -255,6 +255,19 @@ angular.module(&#39;ScheduleApp&#39;).factory(
255 method: 'POST' 255 method: 'POST'
256 } 256 }
257 } 257 }
  258 + ),
  259 + refreshBuffer: $resource(
  260 + '/dataSync/vehicle/refreshBuffer',
  261 + {},
  262 + {
  263 + refresh: {
  264 + method: 'GET',
  265 + transformResponse: function(rs) {
  266 + var dst = angular.fromJson(rs);
  267 + return dst;
  268 + }
  269 + }
  270 + }
258 ) 271 )
259 }; 272 };
260 } 273 }