Commit 6000ae89 by wubh

包活干V2.3.0-E盾接口同步方式修改

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@30489 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent b98caaa1
...@@ -5,11 +5,11 @@ import java.util.Date; ...@@ -5,11 +5,11 @@ import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.glsx.common.constants.ResultObject; import com.glsx.common.constants.ResultObject;
import com.glsx.common.feign.client.UserClient;
import com.glsx.common.utils.DateUtil; import com.glsx.common.utils.DateUtil;
import com.glsx.common.utils.StringUtils; import com.glsx.common.utils.StringUtils;
import com.glsx.common.utils.UserUtils; import com.glsx.common.utils.UserUtils;
...@@ -39,9 +39,6 @@ import org.springframework.stereotype.Component; ...@@ -39,9 +39,6 @@ import org.springframework.stereotype.Component;
@Component("edunOrderSyncStrategy") @Component("edunOrderSyncStrategy")
public class EdunOrderSyncStrategy extends BaseOrderSyncStrategy { public class EdunOrderSyncStrategy extends BaseOrderSyncStrategy {
@Autowired @Autowired
private UserClient userClient;
@Autowired
private OrderUtil orderUtil; private OrderUtil orderUtil;
@Autowired @Autowired
...@@ -62,14 +59,12 @@ public class EdunOrderSyncStrategy extends BaseOrderSyncStrategy { ...@@ -62,14 +59,12 @@ public class EdunOrderSyncStrategy extends BaseOrderSyncStrategy {
try { try {
SysOrder savedOrder = this.orderMapper.selectByPrimaryKey(super.order.getId()); SysOrder savedOrder = this.orderMapper.selectByPrimaryKey(super.order.getId());
savedOrder.setIfRepair(super.order.getIfRepair()); savedOrder.setIfRepair(super.order.getIfRepair());
JSONObject req = new JSONObject(); JSONObject req = this.buildReqParam(savedOrder);
this.wrapBizParam(req, savedOrder);
String respJson = this.postForResult(req); String respJson = this.postForResult(req);
result = this.proceedResult(respJson, savedOrder); result = this.proceedResult(respJson, savedOrder);
} catch (Exception e) { } catch (Exception e) {
logger.error("设备同步错误", e); logger.error("设备同步错误", e);
throw BusinessException.create(ResultCodeEnum.FAIL.getCode(), throw BusinessException.create(ResultCodeEnum.FAIL);
ResultCodeEnum.FAIL.getMsg());
} }
super.logger.info("==== EdunOrderSyncStrategy result: {}", JSON.toJSONString(result)); super.logger.info("==== EdunOrderSyncStrategy result: {}", JSON.toJSONString(result));
...@@ -79,28 +74,21 @@ public class EdunOrderSyncStrategy extends BaseOrderSyncStrategy { ...@@ -79,28 +74,21 @@ public class EdunOrderSyncStrategy extends BaseOrderSyncStrategy {
/** /**
* 封装业务参数 * 封装业务参数
* *
* @param req 请求参数 * @param order 订单
*/ */
private void wrapBizParam(JSONObject req, SysOrder order) { private JSONObject buildReqParam(SysOrder order) {
JSONObject req = new JSONObject();
this.wrapOrderInfo(req, order); this.wrapOrderInfo(req, order);
this.wrapDeviceInfo(req, order); this.wrapDeviceInfo(req, order);
this.wrapInstallPicture(req, order); this.wrapInstallPicture(req, order);
this.wrapStatusName(req, order); this.wrapStatusName(req, order);
req.put("eDunWorkOrderNo", order.getWorkOrderNo()); return req;
req.put("name", order.getCarOwner());
req.put("standNo", order.getVinNo());
req.put("workOrderNo", order.getOrderSn());
req.put("ifRepair", order.getIfRepair());
req.put("nodeTime", DateUtil.formatDateYmd(new Date()));
} }
private void wrapOrderInfo(JSONObject req, SysOrder order) { private void wrapOrderInfo(JSONObject req, SysOrder order) {
// 工单信息 // 工单信息
req.put("eDunWorkOrderNo", order.getWorkOrderNo()); req.put("eDunWorkOrderNo", order.getWorkOrderNo());
req.put("ownerName", order.getCarOwner());
req.put("vin", order.getVinNo());
req.put("workOrderNo", order.getOrderSn()); req.put("workOrderNo", order.getOrderSn());
req.put("nodeTime", DateUtil.formatDateYmd(new Date()));
req.put("ifRepair", order.getIfRepair()); req.put("ifRepair", order.getIfRepair());
// 数据类型:1 激活,2 检修,3 试驾 // 数据类型:1 激活,2 检修,3 试驾
if (StringUtils.isBlank(order.getChannel())) { if (StringUtils.isBlank(order.getChannel())) {
...@@ -111,9 +99,13 @@ public class EdunOrderSyncStrategy extends BaseOrderSyncStrategy { ...@@ -111,9 +99,13 @@ public class EdunOrderSyncStrategy extends BaseOrderSyncStrategy {
} }
// 车辆信息 // 车辆信息
req.put("vin", order.getVinNo());
// 新车架号,没有
req.put("newStandNo", "");
// 车主性别,没有 // 车主性别,没有
req.put("ownerSex", ""); req.put("ownerName", order.getCarOwner());
req.put("ownerTel", order.getCarOwnerPhone()); req.put("ownerTel", order.getCarOwnerPhone());
req.put("ownerSex", "");
CarInfo carInfo = orderUtil.getCarInfo(order.getCarBrand(), CarInfo carInfo = orderUtil.getCarInfo(order.getCarBrand(),
order.getCarSeries(), order.getCarType()); order.getCarSeries(), order.getCarType());
req.put("carBrandId", order.getCarBrand()); req.put("carBrandId", order.getCarBrand());
...@@ -132,8 +124,6 @@ public class EdunOrderSyncStrategy extends BaseOrderSyncStrategy { ...@@ -132,8 +124,6 @@ public class EdunOrderSyncStrategy extends BaseOrderSyncStrategy {
req.put("color", order.getCarColor()); req.put("color", order.getCarColor());
// 车牌,没有 // 车牌,没有
req.put("licensePlate", ""); req.put("licensePlate", "");
// 新车架号,没有
req.put("newStandNo", "");
// 商户信息 // 商户信息
JSONObject merchantObj = UserUtils.getMerchantInfo(order.getShopId()); JSONObject merchantObj = UserUtils.getMerchantInfo(order.getShopId());
...@@ -168,31 +158,6 @@ public class EdunOrderSyncStrategy extends BaseOrderSyncStrategy { ...@@ -168,31 +158,6 @@ public class EdunOrderSyncStrategy extends BaseOrderSyncStrategy {
deviceList = super.orderDeviceList; deviceList = super.orderDeviceList;
} }
//// TODO 使用 UserUtils 获取技工信息
//String mechanicName;
//String mechanicNumberPhone;
//JSONObject mechanicObj = userClient.getMechanicById(order.getMechanicId());
//if (mechanicObj != null
// && mechanicObj.getIntValue("code") == ResultCodeEnum.SUCCESS.getCode()) {
// JSONObject data = mechanicObj.getJSONObject("data");
// mechanicName = data.getString("name");
// mechanicNumberPhone = data.getString("phoneNumber");
//} else {
// mechanicName = "";
// mechanicNumberPhone = "";
//}
//// TODO 使用 UserUtils 获取服务商信息
//String providerName;
//JSONObject providerObj = userClient.getServiceById(order.getMerchantId());
//if (providerObj != null
// && providerObj.getIntValue("code") == ResultCodeEnum.SUCCESS.getCode()) {
// JSONObject data = providerObj.getJSONObject("data");
// providerName = data.getString("providerName");
//} else {
// providerName = "";
//}
String repairTypeName; String repairTypeName;
if (ifRepair) { if (ifRepair) {
Map<Byte, String> map = new HashMap<>(); Map<Byte, String> map = new HashMap<>();
...@@ -210,8 +175,6 @@ public class EdunOrderSyncStrategy extends BaseOrderSyncStrategy { ...@@ -210,8 +175,6 @@ public class EdunOrderSyncStrategy extends BaseOrderSyncStrategy {
deviceInfo.put("installDeviceType", orderDevice.getDeviceType()); deviceInfo.put("installDeviceType", orderDevice.getDeviceType());
deviceInfo.put("installLocation", (orderDevice.getInstallLocation() == null) deviceInfo.put("installLocation", (orderDevice.getInstallLocation() == null)
? "" : orderDevice.getInstallLocation()); ? "" : orderDevice.getInstallLocation());
//deviceInfo.put("mechanicName", mechanicName);
//deviceInfo.put("mechanicNumberPhone", mechanicNumberPhone);
String newSn; String newSn;
if (ifRepair && repairType == 1) { if (ifRepair && repairType == 1) {
...@@ -226,7 +189,6 @@ public class EdunOrderSyncStrategy extends BaseOrderSyncStrategy { ...@@ -226,7 +189,6 @@ public class EdunOrderSyncStrategy extends BaseOrderSyncStrategy {
deviceInfo.put("newSn", (newSn == null) ? "" : newSn); deviceInfo.put("newSn", (newSn == null) ? "" : newSn);
deviceInfo.put("newStandNo", ""); deviceInfo.put("newStandNo", "");
deviceInfo.put("repairType", repairTypeName); deviceInfo.put("repairType", repairTypeName);
//deviceInfo.put("serviceName", providerName);
deviceInfo.put("sn", orderDevice.getDeviceNo()); deviceInfo.put("sn", orderDevice.getDeviceNo());
deviceInfos.add(deviceInfo); deviceInfos.add(deviceInfo);
} }
...@@ -254,16 +216,12 @@ public class EdunOrderSyncStrategy extends BaseOrderSyncStrategy { ...@@ -254,16 +216,12 @@ public class EdunOrderSyncStrategy extends BaseOrderSyncStrategy {
} }
if (ifRepair) { if (ifRepair) {
req.put("installLocionPicture", null); req.put("installLocationPicture", null);
} else { } else {
//只传给E盾照片列表 // 只传给E盾照片列表
List<String> pictureList = new ArrayList<>(); List<String> pictureList = fileList.stream().map(SysOrderFile::getFilePath)
for (SysOrderFile orderFile : fileList) { .collect(Collectors.toList());
String filePath = orderFile.getFilePath(); req.put("installLocationPicture", pictureList);
pictureList.add(filePath);
}
req.put("installLocionPicture", pictureList);
} }
} }
...@@ -274,7 +232,7 @@ public class EdunOrderSyncStrategy extends BaseOrderSyncStrategy { ...@@ -274,7 +232,7 @@ public class EdunOrderSyncStrategy extends BaseOrderSyncStrategy {
* @param order 订单 * @param order 订单
*/ */
private void wrapStatusName(JSONObject req, SysOrder order) { private void wrapStatusName(JSONObject req, SysOrder order) {
//已取消 // 已取消
if (order.getCanceled() == 0) { if (order.getCanceled() == 0) {
req.put("nodeName", "已取消"); req.put("nodeName", "已取消");
req.put("nodeStatus", "03"); req.put("nodeStatus", "03");
...@@ -282,6 +240,7 @@ public class EdunOrderSyncStrategy extends BaseOrderSyncStrategy { ...@@ -282,6 +240,7 @@ public class EdunOrderSyncStrategy extends BaseOrderSyncStrategy {
req.put("nodeName", "已完成"); req.put("nodeName", "已完成");
req.put("nodeStatus", "02"); req.put("nodeStatus", "02");
} }
req.put("nodeTime", DateUtil.formatDateYmd(new Date()));
} }
private String postForResult(JSONObject req) throws Exception { private String postForResult(JSONObject req) throws Exception {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!