|
@@ -1,12 +1,19 @@
|
|
|
package com.fdkankan.scene.controller;
|
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.fdkankan.common.constant.ErrorCode;
|
|
|
+import com.fdkankan.common.constant.PayStatus;
|
|
|
import com.fdkankan.common.constant.SceneInfoReqType;
|
|
|
+import com.fdkankan.common.exception.BusinessException;
|
|
|
import com.fdkankan.common.response.ResultData;
|
|
|
+import com.fdkankan.scene.entity.SceneEditInfo;
|
|
|
+import com.fdkankan.scene.entity.ScenePro;
|
|
|
import com.fdkankan.scene.service.*;
|
|
|
import com.fdkankan.scene.vo.*;
|
|
|
+import java.util.Objects;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -228,40 +235,31 @@ public class SceneController {
|
|
|
// return Result.success((Object) sceneProEntity.getEcs());
|
|
|
// }
|
|
|
//
|
|
|
-// /**
|
|
|
-// * 根据场景密码打开场景
|
|
|
-// */
|
|
|
-// @ApiOperation("根据场景密码打开场景")
|
|
|
-// @PostMapping(value = "/openSceneBykey")
|
|
|
-// @ApiImplicitParams({
|
|
|
-// @ApiImplicitParam(name = "sceneKey", value = "场景秘钥", dataType = "String"),
|
|
|
-// @ApiImplicitParam(name = "num", value = "场景码", dataType = "String")})
|
|
|
-// public ResultData openSceneBykey(HttpServletRequest request) throws Exception {
|
|
|
-// String sceneNum = request.getParameter("num");
|
|
|
-// String sceneKey = request.getParameter("sceneKey");
|
|
|
-// if (StringUtils.isEmpty(sceneNum) || StringUtils.isEmpty(sceneKey)) {
|
|
|
-// throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
|
|
|
-// }
|
|
|
-// SceneProEntity sceneProEntity = sceneProService.findBySceneNum(sceneNum);
|
|
|
-// if (sceneProEntity == null) {
|
|
|
-// throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
|
|
|
-// }
|
|
|
-// if (sceneProEntity.getPayStatus() != 1) {
|
|
|
-// throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
|
|
|
-// }
|
|
|
-//
|
|
|
-// SceneProEditEntity editEntity = sceneProEditService.findByProId(sceneProEntity.getId());
|
|
|
-// if (editEntity == null) {
|
|
|
-// throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
|
|
|
-// }
|
|
|
-//
|
|
|
-// if(!sceneKey.equals(editEntity.getSceneKey())){
|
|
|
-// throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5021, SceneConstant.FAILURE_MSG_5021);
|
|
|
-// }
|
|
|
-//
|
|
|
-// return Result.success();
|
|
|
-// }
|
|
|
-//
|
|
|
+ /**
|
|
|
+ * 根据场景密码打开场景
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/check/key")
|
|
|
+ public ResultData checkKey(@RequestBody @Validated SceneCheckKeyParamVO param) throws Exception {
|
|
|
+ ScenePro scenePro = sceneProService.getOne(
|
|
|
+ new LambdaQueryWrapper<ScenePro>()
|
|
|
+ .eq(ScenePro::getNum, param.getNum())
|
|
|
+ .eq(ScenePro::getPayStatus,PayStatus.PAY.code()));
|
|
|
+ if (Objects.isNull(scenePro)) {
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
+ }
|
|
|
+ SceneEditInfo sceneEditInfo = sceneEditInfoService.getBySceneProId(scenePro.getId());
|
|
|
+
|
|
|
+ if (Objects.isNull(sceneEditInfo)) {
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!param.getPassword().equals(sceneEditInfo.getScenePassword())){
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5021);
|
|
|
+ }
|
|
|
+
|
|
|
+ return ResultData.ok();
|
|
|
+ }
|
|
|
+
|
|
|
// /**
|
|
|
// * 是否已登录
|
|
|
// * @return
|