|
@@ -13,6 +13,7 @@ import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.data.repository.query.Param;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import com.ruoyi.common.annotation.Log;
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
@@ -158,8 +159,15 @@ public class PoTetherController extends BaseController
|
|
|
{
|
|
|
//校验是否有操作的权限
|
|
|
poUserService.checkUserAllowed(poUser);
|
|
|
- //校验是否可以访问到数据
|
|
|
- poUserService.checkUserDataScope(poUser.getUserId());
|
|
|
+
|
|
|
+ TetherVo tetherVo1 = poTetherService.selectPoTetherByTetherIdWithCollection(tetherVo.getTetherId());
|
|
|
+
|
|
|
+ if (tetherVo1 == null){
|
|
|
+ return error("没有对应的数据");
|
|
|
+ }
|
|
|
+ if (tetherVo1.getCochain() == 0){
|
|
|
+ return error("已经上链");
|
|
|
+ }
|
|
|
|
|
|
if (UserConstants.NOT_UNIQUE.equals(poTetherService.checkPostTetherNameUnique(tetherVo))){
|
|
|
return AjaxResult.error("修改失败"+tetherVo.getTetherName()+"已经存在");
|
|
@@ -188,8 +196,56 @@ public class PoTetherController extends BaseController
|
|
|
if (!getUsername().equals("admin")){
|
|
|
return AjaxResult.error("删除消息失败当前用户不是管理员");
|
|
|
}
|
|
|
+ TetherVo tetherVo = poTetherService.selectPoTetherByTetherIdsWithCollection(tetherIds);
|
|
|
+ if (tetherVo == null){
|
|
|
+ return error("想要删除的套系不存在");
|
|
|
+ }
|
|
|
+ if (tetherVo.getCochain() == 0){
|
|
|
+ return error("想要删除的套系已经上链");
|
|
|
+ }
|
|
|
return toAjax(poTetherService.deletePoTetherByTetherIdsWithCollection(tetherIds));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 修改状态 是否上链
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:tether:isCochain')")
|
|
|
+ @PostMapping("/isCochain/{cochain}/{tetherId}")
|
|
|
+ public AjaxResult isCochain( @PathVariable("cochain") Integer cochain , @PathVariable("tetherId") Long tetherId){
|
|
|
+
|
|
|
+ if (!getUsername().equals("admin")){
|
|
|
+ return AjaxResult.error("不是管理员不可以修改上下链状态");
|
|
|
+ }
|
|
|
+
|
|
|
+ TetherVo tetherVo = poTetherService.selectPoTetherByTetherIdWithCollection(tetherId);
|
|
|
+ if (tetherVo.getCochain() == 0){
|
|
|
+ return error("禁止重复上链");
|
|
|
+ }
|
|
|
+ return toAjax(poTetherService.updatePoTetherIsCochain(cochain,tetherId));
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 修改状态 是否上架
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:tether:isGrounding')")
|
|
|
+ @PostMapping("/isGrounding/{grounding}/{tetherId}")
|
|
|
+ public AjaxResult isGrounding( @PathVariable("grounding") Integer grounding , @PathVariable("tetherId") Long tetherId){
|
|
|
+
|
|
|
+ if (!getUsername().equals("admin")){
|
|
|
+ return AjaxResult.error("不是管理员不可以修改上下架状态");
|
|
|
+ }
|
|
|
+ TetherVo tetherVo = poTetherService.selectPoTetherByTetherIdWithCollection(tetherId);
|
|
|
+
|
|
|
+ if (tetherVo.getCochain() == 0 ){
|
|
|
+
|
|
|
+ return error("此套系为上链状态禁止上架");
|
|
|
+ }
|
|
|
+ if (tetherVo.getGrounding() == 0){
|
|
|
+ return error("禁止重复上架");
|
|
|
+ }
|
|
|
+ return toAjax(poTetherService.updatePoTetherIsGrounding(grounding,tetherId));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|