|
|
@@ -4,11 +4,14 @@ import com.doc.biz.domain.DocSpace;
|
|
|
import com.doc.biz.domain.DocSpaceExpansion;
|
|
|
import com.doc.biz.service.IDocSpaceExpansionService;
|
|
|
import com.doc.biz.service.IDocSpaceService;
|
|
|
+import com.doc.chat.domain.ChatMsg;
|
|
|
+import com.doc.chat.service.IChatMsgService;
|
|
|
import com.doc.common.annotation.Log;
|
|
|
import com.doc.common.core.controller.BaseController;
|
|
|
import com.doc.common.core.domain.AjaxResult;
|
|
|
import com.doc.common.core.page.TableDataInfo;
|
|
|
import com.doc.common.enums.BusinessType;
|
|
|
+import com.doc.common.utils.SecurityUtils;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
@@ -31,6 +34,8 @@ public class DocSpaceExpansionController extends BaseController {
|
|
|
|
|
|
@Resource
|
|
|
private IDocSpaceService spaceService;
|
|
|
+ @Resource
|
|
|
+ private IChatMsgService msgService;
|
|
|
|
|
|
/**
|
|
|
* 查询空间扩容管理列表
|
|
|
@@ -55,28 +60,62 @@ public class DocSpaceExpansionController extends BaseController {
|
|
|
docSpaceExpansion.setExpandStatus("1");
|
|
|
docSpaceExpansion.setSpaceName(space.getSpaceName());
|
|
|
docSpaceExpansion.setCurrentCap(space.getSpaceCap());
|
|
|
+ docSpaceExpansion.setCreated(SecurityUtils.getUserId());
|
|
|
+ docSpaceExpansion.setCreateBy(SecurityUtils.getLoginUser().getUser().getNickName());
|
|
|
return toAjax(docSpaceExpansionService.insertDocSpaceExpansion(docSpaceExpansion));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 新增空间扩容管理
|
|
|
+ */
|
|
|
+ @ApiOperation("是否已存在扩容申请")
|
|
|
+ @Log(title = "空间扩容管理", businessType = BusinessType.INSERT)
|
|
|
+ @PostMapping("/exists/{spaceId}")
|
|
|
+ public AjaxResult apply(@PathVariable("spaceId") Long spaceId) {
|
|
|
+ DocSpaceExpansion expansion=new DocSpaceExpansion();
|
|
|
+ expansion.setSpaceId(spaceId);
|
|
|
+ expansion.setExpandStatus("1");
|
|
|
+ List<DocSpaceExpansion> list = docSpaceExpansionService.selectDocSpaceExpansionList(expansion);
|
|
|
+ boolean result=false;
|
|
|
+ if (list.size() > 0) {
|
|
|
+ result=true;
|
|
|
+ }
|
|
|
+ return AjaxResult.success(result);
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation("同意扩容")
|
|
|
@Log(title = "空间扩容管理", businessType = BusinessType.UPDATE)
|
|
|
@PostMapping("/agree/{autoId}")
|
|
|
public AjaxResult agree(@PathVariable("autoId") Long autoId) {
|
|
|
DocSpaceExpansion expansion = docSpaceExpansionService.selectDocSpaceExpansionByAutoId(autoId);
|
|
|
expansion.setExpandStatus("2");
|
|
|
-
|
|
|
+ expansion.setUpdateBy(SecurityUtils.getUsername());
|
|
|
spaceService.addCap(expansion.getSpaceId(), expansion.getExpandCap());
|
|
|
-
|
|
|
+ //发送消息
|
|
|
+ ChatMsg msg = new ChatMsg();
|
|
|
+ msg.setMsgType("2");
|
|
|
+ msg.setToId(expansion.getCreated());
|
|
|
+ msg.setContent("您申请的空间扩容已审核通过,请刷新界面后查看!");
|
|
|
+ msg.setFromId(SecurityUtils.getUserId());
|
|
|
+ msgService.send(msg);
|
|
|
return success(docSpaceExpansionService.updateDocSpaceExpansion(expansion));
|
|
|
}
|
|
|
|
|
|
@ApiOperation("拒绝扩容")
|
|
|
@Log(title = "空间扩容管理", businessType = BusinessType.UPDATE)
|
|
|
@PostMapping("/refuse/{autoId}")
|
|
|
- public AjaxResult refuse(@PathVariable("autoId") Long autoId, @RequestParam String remark) {
|
|
|
+ public AjaxResult refuse(@PathVariable("autoId") Long autoId, @RequestBody String remark) {
|
|
|
DocSpaceExpansion expansion = docSpaceExpansionService.selectDocSpaceExpansionByAutoId(autoId);
|
|
|
expansion.setExpandStatus("3");
|
|
|
+ expansion.setUpdateBy(SecurityUtils.getUsername());
|
|
|
expansion.setDescription(remark);
|
|
|
+ //发送消息
|
|
|
+ ChatMsg msg = new ChatMsg();
|
|
|
+ msg.setMsgType("2");
|
|
|
+ msg.setToId(expansion.getCreated());
|
|
|
+ msg.setContent("您申请的空间扩容被拒绝,原因:" + remark);
|
|
|
+ msg.setFromId(SecurityUtils.getUserId());
|
|
|
+ msgService.send(msg);
|
|
|
return success(docSpaceExpansionService.updateDocSpaceExpansion(expansion));
|
|
|
}
|
|
|
}
|