Jelajahi Sumber

双十一活动调整

zouxuan 1 tahun lalu
induk
melakukan
47b30cb487

+ 14 - 10
mec-application/src/main/java/com/ym/mec/student/controller/SporadicChargeInfoController.java

@@ -11,6 +11,7 @@ import com.ym.mec.biz.dal.enums.PayStatus;
 import com.ym.mec.biz.service.MusicGroupService;
 import com.ym.mec.biz.service.SporadicChargeInfoService;
 import com.ym.mec.biz.service.StudentPaymentOrderService;
+import com.ym.mec.biz.service.SysUserService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
@@ -18,6 +19,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.*;
@@ -33,7 +35,7 @@ public class SporadicChargeInfoController extends BaseController {
     @Autowired
     private SporadicChargeInfoService sporadicChargeInfoService;
     @Autowired
-    private SysUserFeignService sysUserFeignService;
+    private SysUserService sysUserService;
     @Autowired
     private StudentPaymentOrderService studentPaymentOrderService;
     @Autowired
@@ -44,7 +46,15 @@ public class SporadicChargeInfoController extends BaseController {
     @ApiOperation(value = "单查询")
     @GetMapping("/get")
     public Object get(Integer id, Integer userId) {
-        return succeed(sporadicChargeInfoService.findDetail(id, userId));
+        SysUser sysUser = sysUserService.getUser();
+        SporadicChargeInfo detail = sporadicChargeInfoService.findDetail(id, userId);
+        if (detail == null) {
+            throw new BizException("数据不存在");
+        }
+        if (StringUtils.isNotEmpty(detail.getOrganId()) && !detail.getOrganId().contains(sysUser.getOrganId().toString())) {
+            throw new BizException("您所在分部不参与此活动");
+        }
+        return succeed(detail);
     }
 
 
@@ -57,10 +67,7 @@ public class SporadicChargeInfoController extends BaseController {
             throw new BizException("参数校验失败");
         }
         if (sporadicPayDto.getUserId() == null) {
-            SysUser sysUser = sysUserFeignService.queryUserInfo();
-            if (sysUser == null || sysUser.getId() == null) {
-                return failed("用户不存在");
-            }
+            SysUser sysUser = sysUserService.getUser();
             sporadicPayDto.setUserId(sysUser.getId());
             sporadicPayDto.setOrganId(sysUser.getOrganId());
         }
@@ -115,13 +122,10 @@ public class SporadicChargeInfoController extends BaseController {
     @GetMapping("/activityInfo")
     @ApiImplicitParams({@ApiImplicitParam(name = "type", value = "类型(福袋活动6)", required = true, dataType = "String")})
     public HttpResponseResult activityInfo(Integer type) throws Exception {
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        SysUser sysUser = sysUserService.getUser();
         if (sysUser == null || sysUser.getId() == null) {
             return failed("请先登录");
         }
-        if (sysUser.getOrganId() == null) {
-            return failed("用户信息有误,没有分部信息");
-        }
         Integer organId = sysUser.getOrganId();
 
         if (type == null || type <= 0) {