Commit e7a46a3f by zhanghj

V1.0.0--完善商户新增订单功能接口

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@17892 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent b0272920
......@@ -3,9 +3,12 @@ package com.glsx.common.feign.client;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSONObject;
import com.glsx.common.config.FeignConfig;
import com.glsx.common.constants.ResultObject;
......@@ -45,4 +48,17 @@ public interface UserClient {
*/
@RequestMapping(method = RequestMethod.GET, value = "/carservice/usercenter/user/getUserById")
JSONObject getUserById(Integer id);
/**
*
* @author zhanghj
* @Title: getMerchantById
* @Description: TODO 根据用户id获取商户信息
* @param merchantId
* @return
* ResultObject
*
*/
@RequestMapping( method = RequestMethod.GET, value = "/carservice/usercenter/user/getMerchantById")
JSONObject getMerchantById(@RequestParam("merchantId")Integer merchantId);
}
......@@ -1261,9 +1261,9 @@ public class OrderServiceImpl implements IOrderService {
ResultObject result = null;
JSONObject obj = userClient.getUserById(userId);
if (obj != null && obj.getIntValue("code") == ResultCodeEnum.SUCCESS.getCode()) {
SysUser user = (SysUser) obj.get("data");
Byte userStatus = user.getUserStatus();
Byte userType = user.getUserType();
JSONObject data = obj.getJSONObject("data");
Byte userStatus = data.getByte("userStatus");
Byte userType = data.getByte("userType");
if (userStatus != null && userStatus != com.glsx.common.constants.Constants.USER_STATUS_NOMAL) {
result = new ResultObject(ResultCodeEnum.USER_IS_DISABLE_OR_LOGOUT.getCode(), ResultCodeEnum.USER_IS_DISABLE_OR_LOGOUT.getMsg());
return result;
......@@ -1491,6 +1491,11 @@ public class OrderServiceImpl implements IOrderService {
if (userType != null && com.glsx.common.constants.Constants.USER_TYPE_SP == userType) {
Integer merchantId = resourMatching.getUserId();
sysOrder.setMerchantId(merchantId);
JSONObject data = getMerchantById(merchantId);
if (data != null) {
String serviceType = data.getString("serviceType");
sysOrder.setServiceType(serviceType);
}
} else if (userType != null && userType != com.glsx.common.constants.Constants.USER_TYPE_SP) {
Integer mechanicId = resourMatching.getUserId();
sysOrder.setMechanicId(mechanicId);
......@@ -1499,4 +1504,14 @@ public class OrderServiceImpl implements IOrderService {
insertSelective(sysOrder);
return new ResultObject(ResultCodeEnum.SUCCESS.getCode(), ResultCodeEnum.SUCCESS.getMsg());
}
private JSONObject getMerchantById(Integer merchantId) {
// TODO Auto-generated method stub
JSONObject data = null;
JSONObject obj = userClient.getMerchantById(merchantId);
if (obj != null && obj.getIntValue("code") == ResultCodeEnum.SUCCESS.getCode()) {
data = obj.getJSONObject("data");
}
return data;
}
}
......@@ -562,6 +562,7 @@ public class UserController extends BaseController {
merchantInfo.setName(sysMerchant.getName());
merchantInfo.setPhoneNumber(sysMerchant.getPhoneNumber());
merchantInfo.setSysArea(iAreaService.getAllChargeItems(Integer.valueOf(sysMerchant.getDistrict())));
merchantInfo.setServiceType(sysMerchant.getServiceType());
return new ResultObject(ResultCodeEnum.SUCCESS.getCode(), ResultCodeEnum.SUCCESS.getMsg(), merchantInfo);
}
......
......@@ -18,6 +18,8 @@ public class MerchantInfo {
private String phoneNumber;
private SysArea sysArea;
private Integer serviceType;
public Integer getId() {
return id;
......@@ -50,4 +52,13 @@ public class MerchantInfo {
public void setSysArea(SysArea sysArea) {
this.sysArea = sysArea;
}
public Integer getServiceType() {
return serviceType;
}
public void setServiceType(Integer serviceType) {
this.serviceType = serviceType;
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!