|
@@ -1,14 +1,24 @@
|
|
|
package com.diagbot.web;
|
|
|
|
|
|
|
|
|
+import com.diagbot.annotation.SysLogger;
|
|
|
+import com.diagbot.dto.ProductServiceDTO;
|
|
|
import com.diagbot.dto.RespDTO;
|
|
|
+import com.diagbot.facade.ProductServiceFacade;
|
|
|
import com.diagbot.facade.ServiceTokenFacade;
|
|
|
+import com.diagbot.vo.ProductServiceSaveVO;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
import springfox.documentation.annotations.ApiIgnore;
|
|
|
|
|
|
+import javax.validation.Valid;
|
|
|
+
|
|
|
/**
|
|
|
* <p>
|
|
|
* 服务令牌表 前端控制器
|
|
@@ -23,6 +33,8 @@ public class ServiceTokenController {
|
|
|
|
|
|
@Autowired
|
|
|
ServiceTokenFacade serviceTokenFacade;
|
|
|
+ @Autowired
|
|
|
+ ProductServiceFacade productServiceFacade;
|
|
|
|
|
|
|
|
|
@PostMapping("/hasPermission")
|
|
@@ -33,5 +45,45 @@ public class ServiceTokenController {
|
|
|
// return serviceTokenFacade.hasPermission(appkey, secret, productId);
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "生成令牌",
|
|
|
+ notes = "productId:产品Id,必填<br>" +
|
|
|
+ "serviceId:服务Id,必填<br> ")
|
|
|
+ @PostMapping("/createServiceToken")
|
|
|
+ @SysLogger("createServiceToken")
|
|
|
+ @Transactional
|
|
|
+ public RespDTO<ProductServiceDTO> createServiceToken(@RequestBody @Valid ProductServiceSaveVO productServiceSaveVO) {
|
|
|
+ ProductServiceDTO productServiceDTO = productServiceFacade.genProductService(productServiceSaveVO);
|
|
|
+ return RespDTO.onSuc(productServiceDTO);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "令牌禁用",
|
|
|
+ notes = "productServiceId:产品服务id,必填<br>")
|
|
|
+ @PostMapping("/disableToken")
|
|
|
+ @SysLogger("disableToken")
|
|
|
+ @Transactional
|
|
|
+ public RespDTO<Integer> disableToken(@RequestParam Long productServiceId) {
|
|
|
+ Integer count = serviceTokenFacade.disableToken(productServiceId);
|
|
|
+ return RespDTO.onSuc(count);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "令牌启用",
|
|
|
+ notes = "productServiceId:产品服务id,必填<br>")
|
|
|
+ @PostMapping("/enableToken")
|
|
|
+ @SysLogger("enableToken")
|
|
|
+ @Transactional
|
|
|
+ public RespDTO<Integer> enableToken(@RequestParam Long productServiceId) {
|
|
|
+ Integer count = serviceTokenFacade.enableToken(productServiceId);
|
|
|
+ return RespDTO.onSuc(count);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "令牌删除",
|
|
|
+ notes = "productServiceId:产品服务id,必填<br>")
|
|
|
+ @PostMapping("/deleteTokenByProductServiceId")
|
|
|
+ @SysLogger("deleteTokenByProductServiceId")
|
|
|
+ @Transactional
|
|
|
+ public RespDTO<Integer> deleteTokenByProductServiceId(@RequestParam Long productServiceId) {
|
|
|
+ Integer count = serviceTokenFacade.deleteByProductServiceId(productServiceId);
|
|
|
+ return RespDTO.onSuc(count);
|
|
|
+ }
|
|
|
}
|
|
|
|