|
|
|
@@ -5,6 +5,7 @@ import com.iformall.common.ResultData; |
|
|
|
import com.iformall.domain.po.WxCUser; |
|
|
|
import com.iformall.domain.po.WxCoupon; |
|
|
|
import com.iformall.domain.po.WxOrder; |
|
|
|
import com.iformall.enums.EnumOrderPressStatus; |
|
|
|
import com.iformall.exception.MallinkException; |
|
|
|
import com.iformall.service.WxCouponService; |
|
|
|
import com.iformall.service.WxOrderPressService; |
|
|
|
@@ -18,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
@RestController |
|
|
|
@@ -90,6 +92,36 @@ public class WxPressOrderController extends BaseController { |
|
|
|
return new ResultData(); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation(value = "砍价状态(1:我发起的砍价,2:未参与的砍价, 3:已参与的砍价)", notes = "{\"orderId\":\"String\"}") |
|
|
|
@PostMapping("getPressOrderStatus") |
|
|
|
public ResultData getPressOrderStatus(@RequestBody Map<String, String> paramMap) { |
|
|
|
Map ret = new HashMap(); |
|
|
|
String orderIdStr = paramMap.get("orderId"); |
|
|
|
if (StringUtils.isBlank(orderIdStr)) { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "orderId不能为空"); |
|
|
|
} |
|
|
|
Long orderId = 0L; |
|
|
|
try { |
|
|
|
orderId = Long.valueOf(orderIdStr); |
|
|
|
} catch (NumberFormatException e) { |
|
|
|
logger.error("orderId convert error, " + orderIdStr + ", e:" + e.getMessage()); |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), "orderId: " + orderIdStr + ", e:" + e.getMessage()); |
|
|
|
} |
|
|
|
WxCUser user = getUser(); |
|
|
|
WxOrder order = wxOrderService.getById(orderId); |
|
|
|
if(order == null) { |
|
|
|
logger.error("订单不存在:" + orderId); |
|
|
|
return new ResultData(ErrorCode.ORDER_IS_NOT_FIND); |
|
|
|
} |
|
|
|
if(order.getcUserId().equals(user.getId())) { |
|
|
|
ret.put("status", EnumOrderPressStatus.FIRST.getCode()); |
|
|
|
return new ResultData(ret); |
|
|
|
} |
|
|
|
int status = wxOrderPressService.pressCouponStatus(order, user); |
|
|
|
ret.put("status", status); |
|
|
|
return new ResultData(ret); |
|
|
|
} |
|
|
|
|
|
|
|
/// 砍价 - 统计 相关 ?????? |
|
|
|
|
|
|
|
|
|
|
|
|