Commit aebf449a9d4e9605a36a98fae5b06280961463d5
1 parent
d4bc0d48
1、修改VehicleDataSyncController,添加refreshBuffer方法,用于动态刷新车辆同步ktr文件
2、修改车辆同步相关页面,添加刷新功能界面逻辑 3、修改车辆同步ktr,添加同步车牌号的逻辑
Showing
8 changed files
with
142 additions
and
8 deletions
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://180.166.5.82:8076/cars/getCarsInterface</default_value> | 59 | + <default_value>http://58.247.254.118:8076/cars/getCarsInterface</default_value> |
| 60 | <description>车辆库系统的相关url地址</description> | 60 | <description>车辆库系统的相关url地址</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>开始获取 ${ssgs} 远端数据,并处理输出
获取数据 api url=${url}
url参数(密钥)password=${password}
数据源过滤参数:
1、车辆自编号 ${paramClzbh}
2、开始时间 ${paramFrom}
3、结束时间 ${paramTo}
4、数据检验错误文件 ${file_validate_error}
5、待处理数据文件 ${file_prepare}
6、新增错误数据文件 ${file_add_error}
7、更新错误数据文件 ${file_update_error}
8、添加车辆设备错误数据文件 ${file_deivce_add_error}</logmessage> | 981 | + <logmessage>开始获取远端数据,并处理输出
获取数据 api url=${url}
url参数(密钥)password=${password}
数据源过滤参数:
1、车辆自编号 ${paramClzbh}
2、开始时间 ${paramFrom}
3、结束时间 ${paramTo}
4、数据检验错误文件 ${file_validate_error}
5、待处理数据文件 ${file_prepare}
6、新增错误数据文件 ${file_add_error}
7、更新错误数据文件 ${file_update_error}
8、添加车辆设备错误数据文件 ${file_deivce_add_error}</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>=</function> | 1055 | <function>=</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>=</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>本地_是否电车</rename> | 1203 | <rename>本地_是否电车</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>本地_车牌号</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>本地_车牌号</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>//Script here

//---------------- 更新用的字段重新命名(方便后续操作)-----------//
// TODO:后面还有更多的更新字段

var update_date = new Date();

//------------ 1、公司分公司相关字段 -----------//
var company_update = gsmc; // 公司名称
var branche_company_update = fgsmc; // 分公司名称
var business_code_update = gsdm; // 公司代码
var branch_company_code_update = fgsdm; // 分公司代码
var isGsUpdate = false; // 是否更新
if (!company_update.equals(company)) {
 isGsUpdate = true;
}
if (!branche_company_update.equals(branche_company)) {
 isGsUpdate = true;
}

//------------- 2、报废相关字段 ------------//
var equipmentCode_update = equipment_code; // 设备编号
var scrapCode_update = scrap_code; // 报废号
var scrapState_update = (scrap_state == true ? 1 : 0); // 报废状态
var scrapState_update_b = scrap_state; // 报废状态
var scrapDate_update = scrap_date; // 报废日期
var isScrapUpdate = false; // 是否更新
if (carState == '3' || scrapType == '1') {
 scrapState_update_b = true;
 scrapState_update = 1;
 // 使用车辆库的报废时间
 scrapDate_update = scrapDate == null ? null : str2date(scrapDate, 'yyyy-MM-dd');
 // 车辆库报废时间为空,再使用当前时间
 if (scrapDate_update == null) {
 scrapDate_update = new Date(); // 报废日期设定位当前日期
 }
 equipmentCode_update = 'BF-' + equipmentCode_update;
 scrapCode_update = 'BF-' + equipmentCode_update;
}
if (scrapState_update_b != scrap_state) {
 isScrapUpdate = true;
}
//-------------- 3、是否电车相关字段 ------------//
var sfdc_update = (carEnergyType == '常规柴油' ? 0 : 1); // 是否电车
var sfdc_update_b = (sfdc == true ? true : false); // 是否电车
var isSfdcUpdate = false; // 是否更新
if (sfdc_update_b != sfdc) { 
 isSfdcUpdate = true;
}</jsScript_script> | 2311 | + <jsScript_script>//Script here

//---------------- 更新用的字段重新命名(方便后续操作)-----------//
// TODO:后面还有更多的更新字段

var update_date = new Date();

//------------ 1、公司分公司相关字段 -----------//
var company_update = gsmc; // 公司名称
var branche_company_update = fgsmc; // 分公司名称
var business_code_update = gsdm; // 公司代码
var branch_company_code_update = fgsdm; // 分公司代码
var isGsUpdate = false; // 是否更新
if (!company_update.equals(company)) {
 isGsUpdate = true;
}
if (!branche_company_update.equals(branche_company)) {
 isGsUpdate = true;
}

//------------- 2、报废相关字段 ------------//
var equipmentCode_update = equipment_code; // 设备编号
var scrapCode_update = scrap_code; // 报废号
var scrapState_update = (scrap_state == true ? 1 : 0); // 报废状态
var scrapState_update_b = scrap_state; // 报废状态
var scrapDate_update = scrap_date; // 报废日期
var isScrapUpdate = false; // 是否更新
if (carState == '3' || scrapType == '1') {
 scrapState_update_b = true;
 scrapState_update = 1;
 // 使用车辆库的报废时间
 scrapDate_update = scrapDate == null ? null : str2date(scrapDate, 'yyyy-MM-dd');
 // 车辆库报废时间为空,再使用当前时间
 if (scrapDate_update == null) {
 scrapDate_update = new Date(); // 报废日期设定位当前日期
 }
 equipmentCode_update = 'BF-' + equipmentCode_update;
 scrapCode_update = 'BF-' + equipmentCode_update;
}
if (scrapState_update_b != scrap_state) {
 isScrapUpdate = true;
}
//-------------- 3、是否电车相关字段 ------------//
var sfdc_update = (carEnergyType == '常规柴油' ? 0 : 1); // 是否电车
var sfdc_update_b = (sfdc == true ? true : false); // 是否电车
var isSfdcUpdate = false; // 是否更新
if (sfdc_update_b != sfdc) { 
 isSfdcUpdate = true;
}
//--------------- 4、车牌号相关字段 ---------------//
var cph_update = cph; // 待更新车牌号
var isChpUpdate = false; // 是否更新
if (!cph_update.equals(car_plate)) {
 isChpUpdate = true;
}
</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('ScheduleApp').factory( | @@ -73,6 +73,10 @@ angular.module('ScheduleApp').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('ScheduleApp').controller( | @@ -86,7 +90,8 @@ angular.module('ScheduleApp').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('ScheduleApp').controller( | @@ -95,6 +100,21 @@ angular.module('ScheduleApp').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('ScheduleApp').factory( | @@ -69,6 +69,19 @@ angular.module('ScheduleApp').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("+binary", function(options, originalOptions, jqXHR){ | @@ -388,4 +393,4 @@ $.ajaxTransport("+binary", 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('ScheduleApp').factory( | @@ -255,6 +255,19 @@ angular.module('ScheduleApp').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 | } |