Commit ebba8f5b by wubh

包活干V1.9.1-修改:调整大搜车反馈代码

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@28042 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent 93ecff2a
...@@ -409,13 +409,21 @@ public class OrderController extends BaseController { ...@@ -409,13 +409,21 @@ public class OrderController extends BaseController {
dscFeedbackService.syncOrder(data); dscFeedbackService.syncOrder(data);
} }
//// 1.9.1 同步工单信息到渠道,虎哥e盾、长城
//ResultObject result;
//JSONObject data = new JSONObject();
//data.put("orderId", id);
//result = orderService.syncOrderCore(data);
return result; return result;
//// 1.9.1 同步工单信息到渠道,虎哥e盾、长城
//ResultObject syncResult;
//if (ResultCodeEnum.SUCCESS.getCode() == result.getCode()) {
// JSONObject data = new JSONObject();
// data.put("orderId", orderDeviceReq.getOrderId());
// data.put("orderDeviceList", orderDeviceReq.getOrderDeviceList());
// data.put("orderFileList", orderDeviceReq.getOrderFileList());
// syncResult = orderService.syncOrderCore(data);
//} else {
// syncResult = result;
//}
//
//return syncResult;
} }
/** /**
...@@ -457,15 +465,21 @@ public class OrderController extends BaseController { ...@@ -457,15 +465,21 @@ public class OrderController extends BaseController {
dscFeedbackService.syncOrder(data); dscFeedbackService.syncOrder(data);
} }
//// 1.9.1 同步工单信息到渠道,虎哥e盾、长城
//ResultObject result;
//JSONObject data = new JSONObject();
//data.put("orderId", orderDeviceReq.getOrderId());
//data.put("orderDeviceList", orderDeviceReq.getOrderDeviceList());
//data.put("orderFileList", orderDeviceReq.getOrderFileList());
//result = orderService.syncOrderCore(data);
return result; return result;
//// 1.9.1 同步工单信息到渠道,虎哥e盾、长城
//ResultObject syncResult;
//if (ResultCodeEnum.SUCCESS.getCode() == result.getCode()) {
// JSONObject data = new JSONObject();
// data.put("orderId", orderDeviceReq.getOrderId());
// data.put("orderDeviceList", orderDeviceReq.getOrderDeviceList());
// data.put("orderFileList", orderDeviceReq.getOrderFileList());
// syncResult = orderService.syncOrderCore(data);
//} else {
// syncResult = result;
//}
//
//return syncResult;
} }
/** /**
...@@ -1009,15 +1023,21 @@ public class OrderController extends BaseController { ...@@ -1009,15 +1023,21 @@ public class OrderController extends BaseController {
dscFeedbackService.syncOrder(data); dscFeedbackService.syncOrder(data);
} }
//// 1.9.1 同步工单信息到渠道,虎哥e盾、长城
//ResultObject result;
//JSONObject data = new JSONObject();
//data.put("orderId", orderDeviceReq.getOrderId());
//data.put("orderDeviceList", orderDeviceReq.getOrderDeviceList());
//data.put("orderFileList", orderDeviceReq.getOrderFileList());
//result = orderService.syncOrderCore(data);
return result; return result;
//// 1.9.1 同步工单信息到渠道,虎哥e盾、长城
//ResultObject syncResult;
//if (ResultCodeEnum.SUCCESS.getCode() == result.getCode()) {
// JSONObject data = new JSONObject();
// data.put("orderId", orderDeviceReq.getOrderId());
// data.put("orderDeviceList", orderDeviceReq.getOrderDeviceList());
// data.put("orderFileList", orderDeviceReq.getOrderFileList());
// syncResult = orderService.syncOrderCore(data);
//} else {
// syncResult = result;
//}
//
//return syncResult;
} }
/** /**
......
...@@ -109,7 +109,7 @@ public class DscFeedbackServiceImpl implements DscFeedbackService { ...@@ -109,7 +109,7 @@ public class DscFeedbackServiceImpl implements DscFeedbackService {
ResultCodeEnum.SUCCESS.getMsg()); ResultCodeEnum.SUCCESS.getMsg());
} }
} else { } else {
this.logger.info("==== Channel = {},no need to sync to DaSouChe DSC", this.logger.info("==== Channel = {}, no need to sync to DaSouChe",
order.getChannel()); order.getChannel());
dscResult = new DSCResultObject(ResultCodeEnum.SUCCESS.getCode() + "", dscResult = new DSCResultObject(ResultCodeEnum.SUCCESS.getCode() + "",
ResultCodeEnum.SUCCESS.getMsg()); ResultCodeEnum.SUCCESS.getMsg());
...@@ -236,8 +236,6 @@ public class DscFeedbackServiceImpl implements DscFeedbackService { ...@@ -236,8 +236,6 @@ public class DscFeedbackServiceImpl implements DscFeedbackService {
} }
private DSCResultObject syncInstallOrderCore(SysOrder order) { private DSCResultObject syncInstallOrderCore(SysOrder order) {
Long timestamp = System.currentTimeMillis() / 1000;
DaSouCheRequest dscReq = new DaSouCheRequest(installApi, appKey, timestamp);
DscOrderFeedBackDto dscOrderFeedBackDto = new DscOrderFeedBackDto(); DscOrderFeedBackDto dscOrderFeedBackDto = new DscOrderFeedBackDto();
dscOrderFeedBackDto.setIzayoiSerialNum(Long.toString(new Date().getTime())); dscOrderFeedBackDto.setIzayoiSerialNum(Long.toString(new Date().getTime()));
DSCResultObject dscResult; DSCResultObject dscResult;
...@@ -311,7 +309,7 @@ public class DscFeedbackServiceImpl implements DscFeedbackService { ...@@ -311,7 +309,7 @@ public class DscFeedbackServiceImpl implements DscFeedbackService {
orderDto.setDevice(deviceDtoList); orderDto.setDevice(deviceDtoList);
orderDtoList.add(orderDto); orderDtoList.add(orderDto);
dscOrderFeedBackDto.setData(orderDtoList); dscOrderFeedBackDto.setData(orderDtoList);
dscResult = this.postForResult(dscReq, dscOrderFeedBackDto); dscResult = this.postForResult(this.installApi, dscOrderFeedBackDto);
} catch (DSCBusinessException e) { } catch (DSCBusinessException e) {
this.logger.error("==== DscFeedbackService syncInstallOrderCore ERROR: ", e); this.logger.error("==== DscFeedbackService syncInstallOrderCore ERROR: ", e);
dscResult = e.getResultEntity(); dscResult = e.getResultEntity();
...@@ -325,8 +323,6 @@ public class DscFeedbackServiceImpl implements DscFeedbackService { ...@@ -325,8 +323,6 @@ public class DscFeedbackServiceImpl implements DscFeedbackService {
} }
private DSCResultObject syncDismantleOrderCore(SysOrder order) { private DSCResultObject syncDismantleOrderCore(SysOrder order) {
Long timestamp = System.currentTimeMillis() / 1000;
DaSouCheRequest dscReq = new DaSouCheRequest(removeApi, appKey, timestamp);
DscOrderFeedBackDto dscOrderFeedBackDto = new DscOrderFeedBackDto(); DscOrderFeedBackDto dscOrderFeedBackDto = new DscOrderFeedBackDto();
dscOrderFeedBackDto.setIzayoiSerialNum(Long.toString(new Date().getTime())); dscOrderFeedBackDto.setIzayoiSerialNum(Long.toString(new Date().getTime()));
DSCResultObject dscResult; DSCResultObject dscResult;
...@@ -379,7 +375,7 @@ public class DscFeedbackServiceImpl implements DscFeedbackService { ...@@ -379,7 +375,7 @@ public class DscFeedbackServiceImpl implements DscFeedbackService {
orderDto.setDevice(deviceDtoList); orderDto.setDevice(deviceDtoList);
orderDtoList.add(orderDto); orderDtoList.add(orderDto);
dscOrderFeedBackDto.setData(orderDtoList); dscOrderFeedBackDto.setData(orderDtoList);
dscResult = this.postForResult(dscReq, dscOrderFeedBackDto); dscResult = this.postForResult(this.removeApi, dscOrderFeedBackDto);
} catch (DSCBusinessException e) { } catch (DSCBusinessException e) {
this.logger.error("==== DscFeedbackService syncDismantleOrderCore ERROR: ", e); this.logger.error("==== DscFeedbackService syncDismantleOrderCore ERROR: ", e);
dscResult = e.getResultEntity(); dscResult = e.getResultEntity();
...@@ -393,8 +389,6 @@ public class DscFeedbackServiceImpl implements DscFeedbackService { ...@@ -393,8 +389,6 @@ public class DscFeedbackServiceImpl implements DscFeedbackService {
} }
private DSCResultObject syncRepairOrderCore(SysOrder order) { private DSCResultObject syncRepairOrderCore(SysOrder order) {
Long timestamp = System.currentTimeMillis() / 1000;
DaSouCheRequest dscReq = new DaSouCheRequest(repairApi, appKey, timestamp);
DscOrderFeedBackDto dscOrderFeedBackDto = new DscOrderFeedBackDto(); DscOrderFeedBackDto dscOrderFeedBackDto = new DscOrderFeedBackDto();
dscOrderFeedBackDto.setIzayoiSerialNum(Long.toString(new Date().getTime())); dscOrderFeedBackDto.setIzayoiSerialNum(Long.toString(new Date().getTime()));
DSCResultObject dscResult; DSCResultObject dscResult;
...@@ -506,7 +500,7 @@ public class DscFeedbackServiceImpl implements DscFeedbackService { ...@@ -506,7 +500,7 @@ public class DscFeedbackServiceImpl implements DscFeedbackService {
orderDto.setDevice(deviceDtoList); orderDto.setDevice(deviceDtoList);
orderDtoList.add(orderDto); orderDtoList.add(orderDto);
dscOrderFeedBackDto.setData(orderDtoList); dscOrderFeedBackDto.setData(orderDtoList);
dscResult = this.postForResult(dscReq, dscOrderFeedBackDto); dscResult = this.postForResult(this.repairApi, dscOrderFeedBackDto);
} catch (DSCBusinessException e) { } catch (DSCBusinessException e) {
this.logger.error("==== DscFeedbackService syncRepairOrderCore ERROR: ", e); this.logger.error("==== DscFeedbackService syncRepairOrderCore ERROR: ", e);
dscResult = e.getResultEntity(); dscResult = e.getResultEntity();
...@@ -520,8 +514,6 @@ public class DscFeedbackServiceImpl implements DscFeedbackService { ...@@ -520,8 +514,6 @@ public class DscFeedbackServiceImpl implements DscFeedbackService {
} }
private DSCResultObject syncCanceledOrderCore(String workOrderNo) { private DSCResultObject syncCanceledOrderCore(String workOrderNo) {
Long timestamp = System.currentTimeMillis() / 1000;
DaSouCheRequest req = new DaSouCheRequest(cancelApi, appKey, timestamp);
DscOrderFeedBackDto dscOrderFeedBackDto = new DscOrderFeedBackDto(); DscOrderFeedBackDto dscOrderFeedBackDto = new DscOrderFeedBackDto();
dscOrderFeedBackDto.setIzayoiSerialNum(Long.toString(new Date().getTime())); dscOrderFeedBackDto.setIzayoiSerialNum(Long.toString(new Date().getTime()));
DSCResultObject dscResult; DSCResultObject dscResult;
...@@ -552,7 +544,7 @@ public class DscFeedbackServiceImpl implements DscFeedbackService { ...@@ -552,7 +544,7 @@ public class DscFeedbackServiceImpl implements DscFeedbackService {
orderMapper.updateByPrimaryKeySelective(savedOrder); orderMapper.updateByPrimaryKeySelective(savedOrder);
} }
dscResult = this.postForResult(req, dscOrderFeedBackDto); dscResult = this.postForResult(this.cancelApi, dscOrderFeedBackDto);
} catch (DSCBusinessException e) { } catch (DSCBusinessException e) {
this.logger.error("==== DscFeedbackService syncCanceledOrderCore ERROR: ", e); this.logger.error("==== DscFeedbackService syncCanceledOrderCore ERROR: ", e);
dscResult = e.getResultEntity(); dscResult = e.getResultEntity();
...@@ -565,18 +557,20 @@ public class DscFeedbackServiceImpl implements DscFeedbackService { ...@@ -565,18 +557,20 @@ public class DscFeedbackServiceImpl implements DscFeedbackService {
return dscResult; return dscResult;
} }
private DSCResultObject postForResult(DaSouCheRequest dscReq, Object data) throws Exception { private DSCResultObject postForResult(String api, Object data) throws Exception {
long timestamp = System.currentTimeMillis() / 1000;
DaSouCheRequest dscReq = new DaSouCheRequest(api, this.appKey, timestamp);
DSCResultObject dscResult; DSCResultObject dscResult;
dscReq.setData(JSON.toJSONString(data)); dscReq.setData(JSON.toJSONString(data));
Map<String, String> signMap = DaSouCheUtil.doGetSign(dscReq); Map<String, String> signMap = DaSouCheUtil.doGetSign(dscReq);
String sign = SoucheSignature.sign(signMap, this.appSecret); String sign = SoucheSignature.sign(signMap, this.appSecret);
dscReq.setSign(sign); dscReq.setSign(sign);
logger.info("==== 请求大搜车检修单反馈参数:{}", JSON.toJSONString(dscReq)); logger.info("==== 请求大搜车接口地址 url = {}, api = {}", this.dscUrl, api);
logger.info("==== 请求大搜车接口地址:{}", this.dscUrl); logger.info("==== 请求大搜车反馈参数:{}", JSON.toJSONString(dscReq));
String respJson = HttpUtil.postData(this.dscUrl, JSON.toJSONString(dscReq), String respJson = HttpUtil.postData(this.dscUrl, JSON.toJSONString(dscReq),
ContentType.APPLICATION_JSON); ContentType.APPLICATION_JSON);
logger.info("==== 大搜车检修单反馈接口返回:{}", respJson); logger.info("==== 大搜车反馈接口返回:{}", respJson);
JSONObject dscResp = JSON.parseObject(respJson); JSONObject dscResp = JSON.parseObject(respJson);
if (Boolean.TRUE.equals(dscResp.getJSONObject("data").getBoolean("success"))) { if (Boolean.TRUE.equals(dscResp.getJSONObject("data").getBoolean("success"))) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!