|
|
@@ -14,8 +14,11 @@ import com.doc.common.core.page.TableDataInfo;
|
|
|
import com.doc.common.enums.BusinessType;
|
|
|
import com.doc.common.enums.EventLevel;
|
|
|
import com.doc.common.utils.SecurityUtils;
|
|
|
+import com.doc.sms.TencentSmsService;
|
|
|
+import com.doc.system.service.ISysUserService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import javafx.util.Pair;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
@@ -38,6 +41,8 @@ public class DocSpaceExpansionController extends BaseController {
|
|
|
private IDocSpaceService spaceService;
|
|
|
@Resource
|
|
|
private IChatMsgService msgService;
|
|
|
+ @Resource
|
|
|
+ private ISysUserService userService;
|
|
|
|
|
|
/**
|
|
|
* 查询空间扩容管理列表
|
|
|
@@ -55,7 +60,7 @@ public class DocSpaceExpansionController extends BaseController {
|
|
|
* 新增空间扩容管理
|
|
|
*/
|
|
|
@ApiOperation("申请扩容")
|
|
|
- @Log(title = "空间扩容管理", businessType = BusinessType.INSERT,eventLevel = EventLevel.MIDDLE)
|
|
|
+ @Log(title = "空间扩容管理", businessType = BusinessType.INSERT, eventLevel = EventLevel.MIDDLE)
|
|
|
@RepeatSubmit
|
|
|
@PostMapping
|
|
|
public AjaxResult apply(@RequestBody DocSpaceExpansion docSpaceExpansion) {
|
|
|
@@ -71,26 +76,26 @@ public class DocSpaceExpansionController extends BaseController {
|
|
|
@ApiOperation("是否已存在扩容申请")
|
|
|
@PostMapping("/exists/{spaceId}")
|
|
|
public AjaxResult apply(@PathVariable("spaceId") Long spaceId) {
|
|
|
- DocSpaceExpansion expansion=new DocSpaceExpansion();
|
|
|
+ DocSpaceExpansion expansion = new DocSpaceExpansion();
|
|
|
expansion.setSpaceId(spaceId);
|
|
|
expansion.setExpandStatus("1");
|
|
|
List<DocSpaceExpansion> list = docSpaceExpansionService.selectDocSpaceExpansionList(expansion);
|
|
|
- boolean result=false;
|
|
|
+ boolean result = false;
|
|
|
if (list.size() > 0) {
|
|
|
- result=true;
|
|
|
+ result = true;
|
|
|
}
|
|
|
return AjaxResult.success(result);
|
|
|
}
|
|
|
|
|
|
@ApiOperation("同意扩容")
|
|
|
- @Log(title = "空间扩容管理", businessType = BusinessType.UPDATE,eventLevel = EventLevel.MIDDLE)
|
|
|
+ @Log(title = "空间扩容管理", businessType = BusinessType.UPDATE, eventLevel = EventLevel.MIDDLE)
|
|
|
@RepeatSubmit
|
|
|
@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());
|
|
|
+ DocSpace space = spaceService.addCap(expansion.getSpaceId(), expansion.getExpandCap());
|
|
|
//发送消息
|
|
|
ChatMsg msg = new ChatMsg();
|
|
|
msg.setMsgType("2");
|
|
|
@@ -98,11 +103,17 @@ public class DocSpaceExpansionController extends BaseController {
|
|
|
msg.setContent("您申请的空间扩容已审核通过,请刷新界面后查看!");
|
|
|
msg.setFromId(SecurityUtils.getUserId());
|
|
|
msgService.send(msg);
|
|
|
+
|
|
|
+ Pair<Boolean, String> pair = userService.isOnline(expansion.getCreated());
|
|
|
+ if (!pair.getKey()) {
|
|
|
+ //如果不在线发送短信
|
|
|
+ TencentSmsService.send(TencentSmsService.CAP_EXPAND_SUCCESS, pair.getValue(), space.getFreeCap().toString() + "GB");
|
|
|
+ }
|
|
|
return success(docSpaceExpansionService.updateDocSpaceExpansion(expansion));
|
|
|
}
|
|
|
|
|
|
@ApiOperation("拒绝扩容")
|
|
|
- @Log(title = "空间扩容管理", businessType = BusinessType.UPDATE,eventLevel = EventLevel.MIDDLE)
|
|
|
+ @Log(title = "空间扩容管理", businessType = BusinessType.UPDATE, eventLevel = EventLevel.MIDDLE)
|
|
|
@RepeatSubmit
|
|
|
@PostMapping("/refuse/{autoId}")
|
|
|
public AjaxResult refuse(@PathVariable("autoId") Long autoId, @RequestBody String remark) {
|
|
|
@@ -117,6 +128,12 @@ public class DocSpaceExpansionController extends BaseController {
|
|
|
msg.setContent("您申请的空间扩容被拒绝,原因:" + remark);
|
|
|
msg.setFromId(SecurityUtils.getUserId());
|
|
|
msgService.send(msg);
|
|
|
+
|
|
|
+ Pair<Boolean, String> pair = userService.isOnline(expansion.getCreated());
|
|
|
+ if (!pair.getKey()) {
|
|
|
+ //如果不在线发送短信
|
|
|
+ TencentSmsService.send(TencentSmsService.CAP_EXPAND_FAIL, pair.getValue());
|
|
|
+ }
|
|
|
return success(docSpaceExpansionService.updateDocSpaceExpansion(expansion));
|
|
|
}
|
|
|
}
|