|
@@ -0,0 +1,62 @@
|
|
|
+package edp.davinci.controller;
|
|
|
+
|
|
|
+import edp.core.annotation.CurrentUser;
|
|
|
+import edp.davinci.common.controller.BaseController;
|
|
|
+import edp.davinci.core.common.Constants;
|
|
|
+import edp.davinci.core.common.ResultMap;
|
|
|
+import edp.davinci.model.Catalogue;
|
|
|
+import edp.davinci.model.User;
|
|
|
+import edp.davinci.service.DataSubjectService;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import io.swagger.annotations.ApiResponse;
|
|
|
+import io.swagger.annotations.ApiResponses;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.http.MediaType;
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
+import org.springframework.validation.BindingResult;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import springfox.documentation.annotations.ApiIgnore;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.validation.Valid;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@Api(value = "/dataRules", tags = "dataRules", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
+@ApiResponses(@ApiResponse(code = 404, message = "dataRules not found"))
|
|
|
+@Slf4j
|
|
|
+@RestController
|
|
|
+@RequestMapping(value = Constants.BASE_API_PATH + "/dataRules", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
+public class DataRulesController extends BaseController
|
|
|
+{
|
|
|
+ @Autowired
|
|
|
+ private DataSubjectService dataSubjectService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 增加数据规则
|
|
|
+ *
|
|
|
+ * @param catalogue
|
|
|
+ * @param bindingResult
|
|
|
+ * @param user
|
|
|
+ * @param request
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "create catalogue")
|
|
|
+ @PostMapping(value = "/createCatalogue",consumes = MediaType.APPLICATION_JSON_VALUE)
|
|
|
+ public ResponseEntity createCatalogue(@Valid @RequestBody Catalogue catalogue,
|
|
|
+ @ApiIgnore BindingResult bindingResult,
|
|
|
+ @ApiIgnore @CurrentUser User user,
|
|
|
+ HttpServletRequest request) {
|
|
|
+
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
+ ResultMap resultMap = new ResultMap(tokenUtils).failAndRefreshToken(request).message(bindingResult.getFieldErrors().get(0).getDefaultMessage());
|
|
|
+ return ResponseEntity.status(resultMap.getCode()).body(resultMap);
|
|
|
+ }
|
|
|
+
|
|
|
+// Catalogue catalogueInfo = catalogueService.createCatalogue(catalogue, user);
|
|
|
+//
|
|
|
+// return ResponseEntity.ok(new ResultMap(tokenUtils).successAndRefreshToken(request).payload(catalogueInfo));
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+}
|