Commit d4bca4e4 by zhanghj

V1.0.0--修复新增订单时,服务商和技工要匹配对应的服务项判断,以及取消订单的完善

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@18133 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent 17ee5e14
......@@ -33,7 +33,7 @@ public enum ResultCodeEnum {
ORDER_UNASSIGNED_SERVICE_PROVIDER(30010, "该服务品类尚未指派服务商,请联系平台运营"),
ORDER__FINISH_CAN_NOT_CANCEL(30011, "订单已完成,不允许取消"),
USER_TYPE_NOT_SP(30012, "非服务商类型用户,没有权限"),
ORDER_AFTER_SALEING_CAN_NOT_CANCEL(30013, "检修进行中不能取消订单"),
;
/**
*状态码
......
......@@ -388,7 +388,7 @@ public class OrderController extends BaseController {
*
* @author zhanghj
* @Title: cancel
* @Description: TODO 商户端取消订单
* @Description: TODO 商户端取消订单(包含新增单的取消,售后单的取消两种情况)
* @param orderId
* @return
* ResultObject
......
......@@ -1558,8 +1558,9 @@ public class OrderServiceImpl implements IOrderService {
* 设置订单的服务商和技工
*/
for (SysResourceMatching resourMatching : resourMatchings) {
String serviceKey = resourMatching.getServiceKey();
Integer userType = resourMatching.getUserType();
if (userType != null && com.glsx.common.constants.Constants.USER_TYPE_SP == userType) {
if (userType != null && com.glsx.common.constants.Constants.USER_TYPE_SP == userType && installDeviceType.equals(serviceKey)) {
Integer merchantId = resourMatching.getUserId();
sysOrder.setMerchantId(merchantId);
JSONObject data = getMerchantById(merchantId);
......@@ -1567,7 +1568,7 @@ public class OrderServiceImpl implements IOrderService {
String serviceType = data.getString("serviceType");
sysOrder.setServiceType(serviceType);
}
} else if (userType != null && userType != com.glsx.common.constants.Constants.USER_TYPE_SP) {
} else if (userType != null && userType != com.glsx.common.constants.Constants.USER_TYPE_SP && installDeviceType.equals(serviceKey)) {
Integer mechanicId = resourMatching.getUserId();
sysOrder.setMechanicId(mechanicId);
}
......@@ -1600,6 +1601,34 @@ public class OrderServiceImpl implements IOrderService {
return result;
}
SysOrder sysOrder = orderDao.selectByPrimaryKey(orderId);
List<SysOrder> repairs = getAfterSaleRepairList(orderId);
for (SysOrder order : repairs) {
Byte actStatus = order.getActiveStatus();
if (OrderActiveStatusEnum.ORDER_ACTIVE_STATUS_FINISH.getActiveStatus() == actStatus) {
return new ResultObject(ResultCodeEnum.ORDER_AFTER_SALEING_CAN_NOT_CANCEL.getCode(), ResultCodeEnum.ORDER__FINISH_CAN_NOT_CANCEL.getMsg());
}
}
/*
* 取消分为取消有售后 和无售后两种
*/
if (repairs != null && repairs.size() >0) {
for (SysOrder repair : repairs) {
Integer subOrderId = repair.getId();
Byte actStatus = repair.getActiveStatus();
if (OrderActiveStatusEnum.ORDER_ACTIVE_STATUS_FINISH.getActiveStatus() == actStatus) {
return new ResultObject(ResultCodeEnum.ORDER__FINISH_CAN_NOT_CANCEL.getCode(), ResultCodeEnum.ORDER__FINISH_CAN_NOT_CANCEL.getMsg());
} else {
SysOrder order = new SysOrder();
order.setId(subOrderId);
order.setCanceled((byte) BizConstants.ORDER_CANCELED);
order.setUpdateBy(UserUtils.getUserName(request));
Date now = new Date();
order.setUpdateTime(now);
orderDao.updateByPrimaryKeySelective(order);
}
}
} else {
Byte activeStatus = sysOrder.getActiveStatus();
if (OrderActiveStatusEnum.ORDER_ACTIVE_STATUS_FINISH.getActiveStatus() == activeStatus) {
return new ResultObject(ResultCodeEnum.ORDER__FINISH_CAN_NOT_CANCEL.getCode(), ResultCodeEnum.ORDER__FINISH_CAN_NOT_CANCEL.getMsg());
......@@ -1611,6 +1640,8 @@ public class OrderServiceImpl implements IOrderService {
Date now = new Date();
order.setUpdateTime(now);
orderDao.updateByPrimaryKeySelective(order);
}
return new ResultObject(ResultCodeEnum.SUCCESS.getCode(), ResultCodeEnum.SUCCESS.getMsg());
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!