浏览代码

【数据规则】、【质量任务】、【数据主题】init

vincent 3 年之前
父节点
当前提交
893e412f5b

+ 62 - 0
server/src/main/java/edp/davinci/controller/DataRulesController.java

@@ -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;
+    }
+}

+ 24 - 0
server/src/main/java/edp/davinci/controller/DataSubjectController.java

@@ -0,0 +1,24 @@
+package edp.davinci.controller;
+
+import edp.davinci.common.controller.BaseController;
+import edp.davinci.core.common.Constants;
+import edp.davinci.service.DataSubjectService;
+import io.swagger.annotations.Api;
+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.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Api(value = "/dataSubject", tags = "dataSubject", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+@ApiResponses(@ApiResponse(code = 404, message = "dataSubject not found"))
+@Slf4j
+@RestController
+@RequestMapping(value = Constants.BASE_API_PATH + "/dataSubject", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+public class DataSubjectController extends BaseController
+{
+    @Autowired
+    private DataSubjectService dataSubjectService;
+}

+ 24 - 0
server/src/main/java/edp/davinci/controller/QualityTaskController.java

@@ -0,0 +1,24 @@
+package edp.davinci.controller;
+
+import edp.davinci.common.controller.BaseController;
+import edp.davinci.core.common.Constants;
+import edp.davinci.service.QualityTaskService;
+import io.swagger.annotations.Api;
+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.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Api(value = "/qualityTask", tags = "qualityTask", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+@ApiResponses(@ApiResponse(code = 404, message = "qualityTask not found"))
+@Slf4j
+@RestController
+@RequestMapping(value = Constants.BASE_API_PATH + "/qualityTask", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+public class QualityTaskController extends BaseController
+{
+    @Autowired
+    private QualityTaskService qualityTaskService;
+}

+ 36 - 0
server/src/main/java/edp/davinci/dao/DataRulesMapper.java

@@ -0,0 +1,36 @@
+package edp.davinci.dao;
+
+import edp.davinci.model.DataRules;
+import edp.davinci.model.DataSubject;
+import org.apache.ibatis.annotations.Delete;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+@Component
+public interface DataRulesMapper
+{
+    int insert(DataRules dataRules);
+
+    @Delete({"delete from `data_rules` where id = #{id}"})
+    int deleteById(@Param("id") Long id);
+
+    @Update({
+            "update `dict_type`",
+            "set `dict_name` = #{dictName,jdbcType=VARCHAR},",
+            "`dict_type` = #{dictType,jdbcType=VARCHAR},",
+            "`status` = #{status,jdbcType=BIGINT},",
+            "`remark` = #{remark,jdbcType=VARCHAR},",
+            "`update_by` = #{updateBy,jdbcType=BIGINT},",
+            "`update_time` = #{updateTime,jdbcType=TIMESTAMP}",
+            "where dict_id = #{dictId,jdbcType=BIGINT}"
+    })
+    int update(DataRules dataRules);
+
+
+    @Select({"select * from `data_rules`"})
+    List<DataSubject> getDataRulesList();
+}

+ 37 - 0
server/src/main/java/edp/davinci/dao/DataSubjectMapper.java

@@ -0,0 +1,37 @@
+package edp.davinci.dao;
+
+import edp.davinci.model.Catalogue;
+import edp.davinci.model.DataSubject;
+import edp.davinci.model.DictType;
+import org.apache.ibatis.annotations.Delete;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+@Component
+public interface DataSubjectMapper
+{
+    int insert(DataSubject dataSubject);
+
+    @Delete({"delete from `dict_type` where dict_id = #{id}"})
+    int deleteById(@Param("id") Long id);
+
+    @Update({
+            "update `dict_type`",
+            "set `dict_name` = #{dictName,jdbcType=VARCHAR},",
+            "`dict_type` = #{dictType,jdbcType=VARCHAR},",
+            "`status` = #{status,jdbcType=BIGINT},",
+            "`remark` = #{remark,jdbcType=VARCHAR},",
+            "`update_by` = #{updateBy,jdbcType=BIGINT},",
+            "`update_time` = #{updateTime,jdbcType=TIMESTAMP}",
+            "where dict_id = #{dictId,jdbcType=BIGINT}"
+    })
+    int update(DataSubject dataSubject);
+
+
+    @Select({"select * from `data_subject`"})
+    List<DataSubject> getDataSubjectList();
+}

+ 37 - 0
server/src/main/java/edp/davinci/dao/QualityTaskMapper.java

@@ -0,0 +1,37 @@
+package edp.davinci.dao;
+
+import edp.davinci.model.DataRules;
+import edp.davinci.model.DataSubject;
+import edp.davinci.model.QualityTask;
+import org.apache.ibatis.annotations.Delete;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+@Component
+public interface QualityTaskMapper
+{
+    int insert(QualityTask qualityTask);
+
+    @Delete({"delete from `quality_task` where id = #{id}"})
+    int deleteById(@Param("id") Long id);
+
+    @Update({
+            "update `dict_type`",
+            "set `dict_name` = #{dictName,jdbcType=VARCHAR},",
+            "`dict_type` = #{dictType,jdbcType=VARCHAR},",
+            "`status` = #{status,jdbcType=BIGINT},",
+            "`remark` = #{remark,jdbcType=VARCHAR},",
+            "`update_by` = #{updateBy,jdbcType=BIGINT},",
+            "`update_time` = #{updateTime,jdbcType=TIMESTAMP}",
+            "where dict_id = #{dictId,jdbcType=BIGINT}"
+    })
+    int update(QualityTask qualityTask);
+
+
+    @Select({"select * from `quality_task`"})
+    List<DataSubject> getQualityTaskList();
+}

+ 24 - 0
server/src/main/java/edp/davinci/model/DataRules.java

@@ -0,0 +1,24 @@
+package edp.davinci.model;
+
+import edp.core.model.RecordInfo;
+import lombok.Data;
+
+/**
+ * 数据规则
+ */
+@Data
+public class DataRules extends RecordInfo<DataRules>
+{
+    private Long id;
+
+    private String ruleCode; // 规则编号
+
+    private String ruleName; // 规则名称
+
+    private String ruleDesc; // 规则描述
+
+    private String ruleType; // 规则类型  range: 值域 length:长度 date_format:日期格式
+
+    private String ruleConfig; // 规则配置 {range:{from:,to:},length:,date_format:}
+
+}

+ 28 - 0
server/src/main/java/edp/davinci/model/DataSubject.java

@@ -0,0 +1,28 @@
+package edp.davinci.model;
+
+import edp.core.model.RecordInfo;
+import lombok.Data;
+
+/**
+ *  数据主题
+ */
+@Data
+public class DataSubject extends RecordInfo<DataSubject>
+{
+    private Long id;
+
+    private String standardTheme; // 标准主题
+
+    private String standardCode; // 标准编号
+
+    private String standardName; // 标准名称
+
+    private String standardAlias; // 标准别名
+
+    private String englishName; // 英文名称
+
+    private String deptName; // 定义部门
+
+    private String management; // 管理人员
+
+}

+ 18 - 0
server/src/main/java/edp/davinci/model/QualityTask.java

@@ -0,0 +1,18 @@
+package edp.davinci.model;
+
+import edp.core.model.RecordInfo;
+import lombok.Data;
+
+/**
+ * 质量任务
+ */
+@Data
+public class QualityTask extends RecordInfo<QualityTask>
+{
+    private Long id;
+
+    private String metadataName; // 表名
+
+    private String metadataConfig; // [{"fieldName":"","fieldType":"","fieldAlias":"","subjectId":"","subjectName":""}]
+
+}

+ 5 - 0
server/src/main/java/edp/davinci/service/DataRulesService.java

@@ -0,0 +1,5 @@
+package edp.davinci.service;
+
+public interface DataRulesService
+{
+}

+ 5 - 0
server/src/main/java/edp/davinci/service/DataSubjectService.java

@@ -0,0 +1,5 @@
+package edp.davinci.service;
+
+public interface DataSubjectService
+{
+}

+ 5 - 0
server/src/main/java/edp/davinci/service/QualityTaskService.java

@@ -0,0 +1,5 @@
+package edp.davinci.service;
+
+public interface QualityTaskService
+{
+}

+ 11 - 0
server/src/main/java/edp/davinci/service/impl/DataRulesServiceImpl.java

@@ -0,0 +1,11 @@
+package edp.davinci.service.impl;
+
+import edp.davinci.service.DataRulesService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+@Slf4j
+@Service("dataRulesService")
+public class DataRulesServiceImpl implements DataRulesService
+{
+}

+ 12 - 0
server/src/main/java/edp/davinci/service/impl/DataSubjectServiceImpl.java

@@ -0,0 +1,12 @@
+package edp.davinci.service.impl;
+
+import edp.davinci.service.DataSubjectService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+
+@Slf4j
+@Service("dataSubjectService")
+public class DataSubjectServiceImpl implements DataSubjectService
+{
+}

+ 12 - 0
server/src/main/java/edp/davinci/service/impl/QualityTaskServiceImpl.java

@@ -0,0 +1,12 @@
+package edp.davinci.service.impl;
+
+import edp.davinci.service.QualityTaskService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+
+@Slf4j
+@Service("qualityTaskService")
+public class QualityTaskServiceImpl implements QualityTaskService
+{
+}