winter 3 лет назад
Родитель
Сommit
45cd8ee9d6
1 измененных файлов: 28 добавлений и 59 удалений
  1. +28
    -59
      mallinkBApi/src/main/java/com/iformall/controller/WxCouponOrderController.java

+ 28
- 59
mallinkBApi/src/main/java/com/iformall/controller/WxCouponOrderController.java Просмотреть файл

@@ -154,6 +154,23 @@ public class WxCouponOrderController extends BaseController {
}


private TenantEntity getCouponOrderTenantEntity(String couponTenantId) {
TenantEntity curTenantEntity = getTenantInfo();
TenantEntity couponOrderTenantEntity = null;
if (StringUtils.isBlank(couponTenantId) || "null".equals(couponTenantId) || "NULL".equals(couponTenantId)) {
couponOrderTenantEntity = curTenantEntity;
}else {
if (curTenantEntity.getTenantId().equals(couponTenantId)) {
couponOrderTenantEntity = curTenantEntity;
}else {
couponOrderTenantEntity = new TenantEntity();
couponOrderTenantEntity.setTenantId(couponTenantId);
couponOrderTenantEntity.setParentTenantId(null);
}
}
return couponOrderTenantEntity;
}
@TenantIgnore
@ApiOperation(value = "卡券详情接口")
@GetMapping("detail")
@@ -195,16 +212,9 @@ public class WxCouponOrderController extends BaseController {
throw new MallinkException(ErrorCode.MERCHANT_INFO_NOT_FOUND);
}
WxCouponOrderCVo wxCouponOrderCVo = null;
TenantEntity parentTenantEntity = null;
if (StringUtils.isBlank(couponTenantId) || "null".equals(couponTenantId) || "NULL".equals(couponTenantId)) {
parentTenantEntity = getTenantInfo();
}else {
parentTenantEntity = new TenantEntity();
parentTenantEntity.setTenantId(couponTenantId);
parentTenantEntity.setParentTenantId(null);
}
TenantEntity couponOrderTenantEntity = getCouponOrderTenantEntity(couponTenantId);
try {
wxCouponOrderCVo = wxCouponOrderService.simpleDetailCUserVo(couponOrderId,parentTenantEntity);
wxCouponOrderCVo = wxCouponOrderService.simpleDetailCUserVo(couponOrderId,couponOrderTenantEntity);
} catch (Exception e) {
return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL);
}
@@ -260,17 +270,10 @@ public class WxCouponOrderController extends BaseController {
if (couponOrderId == null) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
}
TenantEntity parentTenantEntity = null;
if (StringUtils.isBlank(couponTenantId) || "null".equals(couponTenantId) || "NULL".equals(couponTenantId)) {
parentTenantEntity = getTenantInfo();
}else {
parentTenantEntity = new TenantEntity();
parentTenantEntity.setTenantId(couponTenantId);
parentTenantEntity.setParentTenantId(null);
}
TenantEntity couponOrderTenantEntity = getCouponOrderTenantEntity(couponTenantId);
WxCouponOrderCVo wxCouponOrderCVo = null;
try {
wxCouponOrderCVo = wxCouponOrderService.simpleDetailCUserVo(couponOrderId,parentTenantEntity);
wxCouponOrderCVo = wxCouponOrderService.simpleDetailCUserVo(couponOrderId,couponOrderTenantEntity);
} catch (Exception e) {
return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL);
}
@@ -336,21 +339,10 @@ public class WxCouponOrderController extends BaseController {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
}

TenantEntity tenantEntity = getTenantInfo();
WxCouponOrderCVo wxCouponOrderCVo = null;
String couponTenantId = paramMap.get("couponTenantId");
TenantEntity parentTenantEntity = null;
if (StringUtils.isBlank(couponTenantId) || "null".equals(couponTenantId) || "NULL".equals(couponTenantId)) {
wxCouponOrderCVo = wxCouponOrderService.detailCUserVo(couponOrderIdStr,tenantEntity);
}else {
//查询父
parentTenantEntity = new TenantEntity();
parentTenantEntity.setTenantId(couponTenantId);
parentTenantEntity.setParentTenantId(null);
wxCouponOrderCVo = wxCouponOrderService.detailCUserVo(couponOrderIdStr,parentTenantEntity);
}
TenantEntity couponOrderTenantEntity = getCouponOrderTenantEntity(couponTenantId);
wxCouponOrderCVo = wxCouponOrderService.detailCUserVo(couponOrderIdStr,couponOrderTenantEntity);
if (wxCouponOrderCVo == null)
return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL);

@@ -389,12 +381,7 @@ public class WxCouponOrderController extends BaseController {
}
}

WxCouponOrder wxCouponOrder = null;
if (null != parentTenantEntity ) {
wxCouponOrder = wxCouponOrderService.getById(couponOrderId,parentTenantEntity.getTenantId());
}else {
wxCouponOrder = wxCouponOrderService.getById(couponOrderId,tenantEntity.getTenantId());
}
WxCouponOrder wxCouponOrder = wxCouponOrderService.getById(couponOrderId,couponOrderTenantEntity.getTenantId());
if (wxCouponOrder == null) {
logger.error("券ID不存在:" + couponOrderId);
return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL);
@@ -448,17 +435,8 @@ public class WxCouponOrderController extends BaseController {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
}
String couponTenantId = paramMap.get("couponTenantId");
TenantEntity parentTenantEntity = null;
if (StringUtils.isBlank(couponTenantId) || "null".equals(couponTenantId) || "NULL".equals(couponTenantId)) {
parentTenantEntity = getTenantInfo();
}else {
//查询父
parentTenantEntity = new TenantEntity();
parentTenantEntity.setTenantId(couponTenantId);
parentTenantEntity.setParentTenantId(null);
}
return new ResultData(Result.SUCCESS, "查询成功", wxCouponOrderService.getById(couponOrderId,parentTenantEntity.getTenantId()));
TenantEntity couponOrderTenantEntity = getCouponOrderTenantEntity(couponTenantId);
return new ResultData(Result.SUCCESS, "查询成功", wxCouponOrderService.getById(couponOrderId,couponOrderTenantEntity.getTenantId()));
}

@ApiOperation(value = "核销接口", notes = "{\"couponOrderId\":\"string\"}")
@@ -483,17 +461,8 @@ public class WxCouponOrderController extends BaseController {
try {
String couponTenantId = wxCouponOrder.getCouponTenantId();
TenantEntity parentTenantEntity = null;
if (StringUtils.isBlank(couponTenantId) || "null".equals(couponTenantId) || "NULL".equals(couponTenantId)) {
parentTenantEntity = getTenantInfo();
}else {
//查询父
parentTenantEntity = new TenantEntity();
parentTenantEntity.setTenantId(couponTenantId);
parentTenantEntity.setParentTenantId(null);
}
WxCouponOrder couponOrder = wxCouponOrderService.getById(wxCouponOrder.getId(), parentTenantEntity.getTenantId());
TenantEntity couponOrderTenantEntity = getCouponOrderTenantEntity(couponTenantId);
WxCouponOrder couponOrder = wxCouponOrderService.getById(wxCouponOrder.getId(), couponOrderTenantEntity.getTenantId());
if(couponOrder==null){
return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL);
}


Загрузка…
Отмена
Сохранить