소스 검색

完成时间规则基础功能开发

liyuntian 10 달 전
부모
커밋
13cc1ea701
25개의 변경된 파일372개의 추가작업 그리고 56개의 파일을 삭제
  1. 12 0
      mcp/src/main/java/com/chuanxia/mcp/bean/dto/DomainTimeRuleBindDto.java
  2. 19 0
      mcp/src/main/java/com/chuanxia/mcp/bean/dto/DomainTimeRuleQueryDto.java
  3. 7 0
      mcp/src/main/java/com/chuanxia/mcp/bean/model/CdnCity.java
  4. 18 0
      mcp/src/main/java/com/chuanxia/mcp/bean/model/CdnDomainTimeRule.java
  5. 35 0
      mcp/src/main/java/com/chuanxia/mcp/bean/model/CdnTimeRule.java
  6. 24 0
      mcp/src/main/java/com/chuanxia/mcp/bean/vo/CdnDomainTimeRuleVo.java
  7. 10 5
      mcp/src/main/java/com/chuanxia/mcp/controller/CdnDomainCityController.java
  8. 7 4
      mcp/src/main/java/com/chuanxia/mcp/controller/CdnDomainController.java
  9. 8 18
      mcp/src/main/java/com/chuanxia/mcp/controller/CdnOperatorController.java
  10. 39 0
      mcp/src/main/java/com/chuanxia/mcp/controller/CdnTimeRuleController.java
  11. 14 0
      mcp/src/main/java/com/chuanxia/mcp/mapper/CdnDomainTimeRuleMapper.java
  12. 9 0
      mcp/src/main/java/com/chuanxia/mcp/mapper/CdnTimeRuleMapper.java
  13. 5 4
      mcp/src/main/java/com/chuanxia/mcp/service/CdnDoaminService.java
  14. 3 1
      mcp/src/main/java/com/chuanxia/mcp/service/CdnDomainCityService.java
  15. 7 0
      mcp/src/main/java/com/chuanxia/mcp/service/CdnDomainTimeRuleService.java
  16. 7 5
      mcp/src/main/java/com/chuanxia/mcp/service/CdnOperatorService.java
  17. 3 1
      mcp/src/main/java/com/chuanxia/mcp/service/CdnService.java
  18. 15 0
      mcp/src/main/java/com/chuanxia/mcp/service/CdnTimeRuleService.java
  19. 7 7
      mcp/src/main/java/com/chuanxia/mcp/service/impl/CdnDoaminServiceImpl.java
  20. 1 1
      mcp/src/main/java/com/chuanxia/mcp/service/impl/CdnDomainCityServiceImpl.java
  21. 15 0
      mcp/src/main/java/com/chuanxia/mcp/service/impl/CdnDomainTimeRuleServiceImpl.java
  22. 9 9
      mcp/src/main/java/com/chuanxia/mcp/service/impl/CdnOperatorServiceImpl.java
  23. 1 1
      mcp/src/main/java/com/chuanxia/mcp/service/impl/CdnServiceImpl.java
  24. 67 0
      mcp/src/main/java/com/chuanxia/mcp/service/impl/CdnTimeRuleServiceImpl.java
  25. 30 0
      mcp/src/main/resources/com/chuanxia/mcp/mapper/CdnDomainTimeRuleMapper.xml

+ 12 - 0
mcp/src/main/java/com/chuanxia/mcp/bean/dto/DomainTimeRuleBindDto.java

@@ -0,0 +1,12 @@
+package com.chuanxia.mcp.bean.dto;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+@ApiModel("域名绑定时间规则实体")
+@Data
+public class DomainTimeRuleBindDto {
+    private Integer domainId;
+    private Integer startTime;
+    private Integer endTime;
+}

+ 19 - 0
mcp/src/main/java/com/chuanxia/mcp/bean/dto/DomainTimeRuleQueryDto.java

@@ -0,0 +1,19 @@
+package com.chuanxia.mcp.bean.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@ApiModel("分页查询对象")
+public class DomainTimeRuleQueryDto extends PageQueryBaseDto {
+    @ApiModelProperty("域名")
+    private String domain;
+    @ApiModelProperty("时间规则-开始时间")
+    private Integer startTime;
+    @ApiModelProperty("时间规则-结束时间")
+    private Integer endTime;
+
+}

+ 7 - 0
mcp/src/main/java/com/chuanxia/mcp/bean/model/CdnCity.java

@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 /**
@@ -11,13 +13,18 @@ import lombok.Data;
  */
 @Data
 @TableName("cdn_city")
+@ApiModel("城市")
 public class CdnCity {
+    @ApiModelProperty("主键")
     @TableId(type = IdType.AUTO)
     private Integer id;
+    @ApiModelProperty("城市名")
     @TableField("cname")
     private String cname;
+    @ApiModelProperty("上级城市id")
     @TableField("parent_id")
     private Integer parentId;
     @TableField("ctype")
+    @ApiModelProperty("城市类型")
     private Integer ctype;
 }

+ 18 - 0
mcp/src/main/java/com/chuanxia/mcp/bean/model/CdnDomainTimeRule.java

@@ -0,0 +1,18 @@
+package com.chuanxia.mcp.bean.model;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+@Data
+@TableName("cdn_domain_time_rule")
+public class CdnDomainTimeRule {
+    @TableId(type = IdType.AUTO)
+    private Integer id;
+    @TableField("domain_id")
+    private Integer domainId;
+    @TableField("time_rule_id")
+    private Integer timeRuleId;
+}

+ 35 - 0
mcp/src/main/java/com/chuanxia/mcp/bean/model/CdnTimeRule.java

@@ -0,0 +1,35 @@
+package com.chuanxia.mcp.bean.model;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 时间规则实体
+ *
+ * @author Administrator
+ */
+@Data
+@TableName("cdn_time_rule")
+@ApiModel("时间规则")
+public class CdnTimeRule {
+    @ApiModelProperty("主键")
+    @TableId(type = IdType.AUTO)
+    private Integer id;
+    @ApiModelProperty("开始时间")
+    @TableField("start_time")
+    private Integer startTime;
+    @ApiModelProperty("结束时间")
+    @TableField("end_time")
+    private Integer endTime;
+    @TableField("create_time")
+    private Date createTime;
+    @TableField("create_by")
+    private Integer createBy;
+}

+ 24 - 0
mcp/src/main/java/com/chuanxia/mcp/bean/vo/CdnDomainTimeRuleVo.java

@@ -0,0 +1,24 @@
+package com.chuanxia.mcp.bean.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@ApiModel("域名-时间规则视图")
+@Data
+public class CdnDomainTimeRuleVo {
+    @ApiModelProperty("主键")
+    private Integer id;
+    @ApiModelProperty("域名id")
+    private Integer domainId;
+    @ApiModelProperty("域名")
+    private String domain;
+    @ApiModelProperty("时间规则id")
+    private Integer timeRuleId;
+    @ApiModelProperty("时间规则-开始时间")
+    private Integer startTime;
+    @ApiModelProperty("时间规则-结束时间")
+    private Integer endTime;
+
+
+}

+ 10 - 5
mcp/src/main/java/com/chuanxia/mcp/controller/CdnDomainCityController.java

@@ -1,8 +1,11 @@
 package com.chuanxia.mcp.controller;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.chuanxia.mcp.aop.Login;
 import com.chuanxia.mcp.bean.dto.DomainBindDto;
 import com.chuanxia.mcp.bean.dto.DomainCityQueryDto;
+import com.chuanxia.mcp.bean.model.CdnCity;
+import com.chuanxia.mcp.bean.vo.CdnDomainCityVo;
 import com.chuanxia.mcp.bean.vo.Result;
 import com.chuanxia.mcp.service.CdnDoaminService;
 import com.chuanxia.mcp.service.CdnService;
@@ -12,6 +15,8 @@ import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
+
 @RestController
 @Api("区域绑定")
 @RequestMapping("cdnDomainCity")
@@ -24,29 +29,29 @@ public class CdnDomainCityController {
     @GetMapping("cascade")
     @ApiOperation("级联查询城市信息")
     @Login
-    public Result cascade(@RequestParam(value = "parentId", required = false, defaultValue = "1") Integer parentId) {
+    public Result<List<CdnCity>> cascade(@RequestParam(value = "parentId", required = false, defaultValue = "1") Integer parentId) {
         return cdnService.cascade(parentId);
     }
 
     @PostMapping("listPage")
     @ApiOperation("分页获取区域域名列表")
     @Login
-    public Result listPage(@RequestBody DomainCityQueryDto queryDto) {
+    public Result<IPage<CdnDomainCityVo>> listPage(@RequestBody DomainCityQueryDto queryDto) {
         return domainCityService.listPage(queryDto);
     }
 
     @GetMapping("deleteById")
     @ApiOperation("删除绑定")
     @Login
-    public Result deleteById(@RequestParam("id") Integer id) {
+    public Result<String> deleteById(@RequestParam("id") Integer id) {
         domainCityService.removeById(id);
-        return Result.success();
+        return Result.success("操作成功");
     }
 
     @PostMapping("bindCdn")
     @ApiOperation("域名绑定城市")
     @Login
-    public Result bindCdn(@RequestBody DomainBindDto bindDto) {
+    public Result<String> bindCdn(@RequestBody DomainBindDto bindDto) {
         return doaminService.bindCdn(bindDto);
     }
 

+ 7 - 4
mcp/src/main/java/com/chuanxia/mcp/controller/CdnDomainController.java

@@ -4,6 +4,7 @@ package com.chuanxia.mcp.controller;
  * @author liyuntian
  */
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.chuanxia.mcp.aop.Login;
 import com.chuanxia.mcp.bean.dto.DomainQueryDto;
 import com.chuanxia.mcp.bean.model.CdnDomain;
@@ -14,6 +15,8 @@ import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
+
 
 /**
  * @author liyuntian
@@ -28,21 +31,21 @@ public class CdnDomainController {
     @PostMapping("listPage")
     @ApiOperation("cdn域名列表(分页)")
     @Login
-    public Result listPage(@RequestBody DomainQueryDto queryDto) {
+    public Result<IPage<CdnDomain>> listPage(@RequestBody DomainQueryDto queryDto) {
         return doaminService.listPage(queryDto);
     }
 
-    @PostMapping("getList")
+    @GetMapping("getList")
     @ApiOperation("cdn域名列表(不分页,用于区域绑定)")
     @Login
-    public Result getList() {
+    public Result<List<CdnDomain>> getList() {
         return Result.success(doaminService.list());
     }
 
     @PostMapping("saveDomain")
     @ApiOperation("新增域名")
     @Login
-    public Result saveDomain(@RequestBody CdnDomain domain) {
+    public Result<String> saveDomain(@RequestBody CdnDomain domain) {
         return doaminService.saveDomain(domain);
     }
 

+ 8 - 18
mcp/src/main/java/com/chuanxia/mcp/controller/CdnOperatorController.java

@@ -1,9 +1,11 @@
 package com.chuanxia.mcp.controller;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.chuanxia.mcp.aop.Login;
 import com.chuanxia.mcp.bean.dto.DomainOperatorBindDto;
 import com.chuanxia.mcp.bean.dto.OperatorQueryDto;
 import com.chuanxia.mcp.bean.model.CdnOperator;
+import com.chuanxia.mcp.bean.vo.CdnOperatorVo;
 import com.chuanxia.mcp.bean.vo.Result;
 import com.chuanxia.mcp.service.CdnOperatorService;
 import io.swagger.annotations.Api;
@@ -11,6 +13,8 @@ import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
+
 /**
  * @author liyuntian
  */
@@ -21,45 +25,31 @@ import org.springframework.web.bind.annotation.*;
 public class CdnOperatorController {
     private final CdnOperatorService operatorService;
 
-    @ApiOperation("新增运营商")
-    @Login
-    @PostMapping("saveOperator")
-    public Result saveOperator(@RequestBody CdnOperator operator) {
-        return operatorService.saveOperator(operator);
-    }
-
-    @ApiOperation("修改运营商")
-    @Login
-    @PostMapping("updateOperator")
-    public Result updateOperator(@RequestBody CdnOperator operator) {
-        return operatorService.updateOperator(operator);
-    }
-
     @GetMapping("getList")
     @ApiOperation("获取所有运营商列表(不分页)")
     @Login
-    public Result getList() {
+    public Result<List<CdnOperator>> getList() {
         return Result.success(operatorService.list());
     }
 
     @PostMapping("bindCdn")
     @ApiOperation("域名绑定运营商")
     @Login
-    public Result bindCdn(@RequestBody DomainOperatorBindDto bindDto) {
+    public Result<String> bindCdn(@RequestBody DomainOperatorBindDto bindDto) {
         return operatorService.bindCdn(bindDto);
     }
 
     @PostMapping("listPage")
     @ApiOperation("运营商分页列表")
     @Login
-    public Result listPage(@RequestBody OperatorQueryDto queryDto) {
+    public Result<IPage<CdnOperatorVo>> listPage(@RequestBody OperatorQueryDto queryDto) {
         return operatorService.listPage(queryDto);
     }
 
     @GetMapping("removeBind")
     @ApiOperation("删除某一条绑定运营商记录")
     @Login
-    public Result removeBind(@RequestParam("id") Integer id) {
+    public Result<String> removeBind(@RequestParam("id") Integer id) {
         return operatorService.removeBind(id);
     }
 

+ 39 - 0
mcp/src/main/java/com/chuanxia/mcp/controller/CdnTimeRuleController.java

@@ -0,0 +1,39 @@
+package com.chuanxia.mcp.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.chuanxia.mcp.aop.Login;
+import com.chuanxia.mcp.bean.dto.DomainTimeRuleBindDto;
+import com.chuanxia.mcp.bean.dto.DomainTimeRuleQueryDto;
+import com.chuanxia.mcp.bean.model.CdnTimeRule;
+import com.chuanxia.mcp.bean.vo.CdnDomainTimeRuleVo;
+import com.chuanxia.mcp.bean.vo.Result;
+import com.chuanxia.mcp.service.CdnTimeRuleService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+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.RestController;
+
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("cdnTimeRule")
+@Api("时间规则配置")
+public class CdnTimeRuleController {
+    private final CdnTimeRuleService ruleService;
+
+    @PostMapping("bindTimeRule")
+    @ApiOperation("绑定时间规则")
+    @Login
+    public Result<String> bindTimeRule(@RequestBody DomainTimeRuleBindDto timeRule) {
+        return ruleService.bindTimeRule(timeRule);
+    }
+
+    @PostMapping("listPage")
+    @ApiOperation("域名-时间规则分页列表")
+    @Login
+    public Result<IPage<CdnDomainTimeRuleVo>> listPage(@RequestBody DomainTimeRuleQueryDto queryDto) {
+        return ruleService.listPage(queryDto);
+    }
+}

+ 14 - 0
mcp/src/main/java/com/chuanxia/mcp/mapper/CdnDomainTimeRuleMapper.java

@@ -0,0 +1,14 @@
+package com.chuanxia.mcp.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.chuanxia.mcp.bean.dto.DomainTimeRuleQueryDto;
+import com.chuanxia.mcp.bean.model.CdnDomainTimeRule;
+import com.chuanxia.mcp.bean.vo.CdnDomainTimeRuleVo;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface CdnDomainTimeRuleMapper extends BaseMapper<CdnDomainTimeRule> {
+    IPage<CdnDomainTimeRuleVo> listPage(IPage<CdnDomainTimeRuleVo> page, @Param("queryDto") DomainTimeRuleQueryDto queryDto);
+}

+ 9 - 0
mcp/src/main/java/com/chuanxia/mcp/mapper/CdnTimeRuleMapper.java

@@ -0,0 +1,9 @@
+package com.chuanxia.mcp.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.chuanxia.mcp.bean.model.CdnTimeRule;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface CdnTimeRuleMapper extends BaseMapper<CdnTimeRule> {
+}

+ 5 - 4
mcp/src/main/java/com/chuanxia/mcp/service/CdnDoaminService.java

@@ -1,5 +1,6 @@
 package com.chuanxia.mcp.service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.chuanxia.mcp.bean.dto.DomainBindDto;
 import com.chuanxia.mcp.bean.dto.DomainQueryDto;
@@ -7,12 +8,12 @@ import com.chuanxia.mcp.bean.model.CdnDomain;
 import com.chuanxia.mcp.bean.vo.Result;
 
 public interface CdnDoaminService extends IService<CdnDomain> {
-    Result listPage(DomainQueryDto queryDto);
+    Result<IPage<CdnDomain>> listPage(DomainQueryDto queryDto);
 
-    Result saveDomain(CdnDomain domain);
+    Result<String> saveDomain(CdnDomain domain);
 
-    Result bindCdn(DomainBindDto bindDto);
+    Result<String> bindCdn(DomainBindDto bindDto);
 
-    Result updateDomain(CdnDomain domain);
+    Result<String> updateDomain(CdnDomain domain);
 
 }

+ 3 - 1
mcp/src/main/java/com/chuanxia/mcp/service/CdnDomainCityService.java

@@ -1,10 +1,12 @@
 package com.chuanxia.mcp.service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.chuanxia.mcp.bean.dto.DomainCityQueryDto;
 import com.chuanxia.mcp.bean.model.CdnDomainCity;
+import com.chuanxia.mcp.bean.vo.CdnDomainCityVo;
 import com.chuanxia.mcp.bean.vo.Result;
 
 public interface CdnDomainCityService extends IService<CdnDomainCity> {
-    Result listPage(DomainCityQueryDto queryDto);
+    Result<IPage<CdnDomainCityVo>> listPage(DomainCityQueryDto queryDto);
 }

+ 7 - 0
mcp/src/main/java/com/chuanxia/mcp/service/CdnDomainTimeRuleService.java

@@ -0,0 +1,7 @@
+package com.chuanxia.mcp.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.chuanxia.mcp.bean.model.CdnDomainTimeRule;
+
+public interface CdnDomainTimeRuleService extends IService<CdnDomainTimeRule> {
+}

+ 7 - 5
mcp/src/main/java/com/chuanxia/mcp/service/CdnOperatorService.java

@@ -1,19 +1,21 @@
 package com.chuanxia.mcp.service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.chuanxia.mcp.bean.dto.DomainOperatorBindDto;
 import com.chuanxia.mcp.bean.dto.OperatorQueryDto;
 import com.chuanxia.mcp.bean.model.CdnOperator;
+import com.chuanxia.mcp.bean.vo.CdnOperatorVo;
 import com.chuanxia.mcp.bean.vo.Result;
 
 public interface CdnOperatorService extends IService<CdnOperator> {
-    Result saveOperator(CdnOperator operator);
+    Result<String> saveOperator(CdnOperator operator);
 
-    Result updateOperator(CdnOperator operator);
+    Result<String> updateOperator(CdnOperator operator);
 
-    Result bindCdn(DomainOperatorBindDto bindDto);
+    Result<String> bindCdn(DomainOperatorBindDto bindDto);
 
-    Result listPage(OperatorQueryDto queryDto);
+    Result<IPage<CdnOperatorVo>> listPage(OperatorQueryDto queryDto);
 
-    Result removeBind(Integer id);
+    Result<String> removeBind(Integer id);
 }

+ 3 - 1
mcp/src/main/java/com/chuanxia/mcp/service/CdnService.java

@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.chuanxia.mcp.bean.model.CdnCity;
 import com.chuanxia.mcp.bean.vo.Result;
 
+import java.util.List;
+
 public interface CdnService extends IService<CdnCity> {
-    Result cascade(Integer parentId);
+    Result<List<CdnCity>> cascade(Integer parentId);
 }

+ 15 - 0
mcp/src/main/java/com/chuanxia/mcp/service/CdnTimeRuleService.java

@@ -0,0 +1,15 @@
+package com.chuanxia.mcp.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.chuanxia.mcp.bean.dto.DomainTimeRuleBindDto;
+import com.chuanxia.mcp.bean.dto.DomainTimeRuleQueryDto;
+import com.chuanxia.mcp.bean.model.CdnTimeRule;
+import com.chuanxia.mcp.bean.vo.CdnDomainTimeRuleVo;
+import com.chuanxia.mcp.bean.vo.Result;
+
+public interface CdnTimeRuleService extends IService<CdnTimeRule> {
+    Result<String> bindTimeRule(DomainTimeRuleBindDto timeRule);
+
+    Result<IPage<CdnDomainTimeRuleVo>> listPage(DomainTimeRuleQueryDto queryDto);
+}

+ 7 - 7
mcp/src/main/java/com/chuanxia/mcp/service/impl/CdnDoaminServiceImpl.java

@@ -39,7 +39,7 @@ public class CdnDoaminServiceImpl extends ServiceImpl<CdnDomainMapper, CdnDomain
     private final CdnDomainCityService domainCityService;
 
     @Override
-    public Result listPage(DomainQueryDto queryDto) {
+    public Result<IPage<CdnDomain>> listPage(DomainQueryDto queryDto) {
         IPage<CdnDomain> page = new Page<>(queryDto.getPageNum(), queryDto.getPageSize());
         LambdaQueryWrapper<CdnDomain> query = Wrappers.lambdaQuery();
         if (StringUtils.isNotBlank(queryDto.getDomain())) {
@@ -54,7 +54,7 @@ public class CdnDoaminServiceImpl extends ServiceImpl<CdnDomainMapper, CdnDomain
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public Result saveDomain(CdnDomain domain) {
+    public Result<String> saveDomain(CdnDomain domain) {
 
         SystemUser loginUser = userService.getLoginUser();
         if (StringUtils.isBlank(domain.getDomain())) {
@@ -75,12 +75,12 @@ public class CdnDoaminServiceImpl extends ServiceImpl<CdnDomainMapper, CdnDomain
         }
         domain.setCreateBy(loginUser.getId());
         this.save(domain);
-        return Result.success();
+        return Result.success("操作成功");
     }
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public Result bindCdn(DomainBindDto bindDto) {
+    public Result<String> bindCdn(DomainBindDto bindDto) {
         Integer domainId = bindDto.getDomainId();
         CdnDomain domain = this.getById(domainId);
         if (domain == null) {
@@ -101,11 +101,11 @@ public class CdnDoaminServiceImpl extends ServiceImpl<CdnDomainMapper, CdnDomain
         del.eq(CdnDomainCity::getDomainId, domainId);
         domainCityService.remove(del);
         domainCityService.saveBatch(domainCityList);
-        return Result.success();
+        return Result.success("操作成功");
     }
 
     @Override
-    public Result updateDomain(CdnDomain domain) {
+    public Result<String> updateDomain(CdnDomain domain) {
         Integer defaultDomain = domain.getDefaultDomain();
         if (DefaultDomainEnums.DEFAULTDOMAIN.getStatus().equals(defaultDomain)) {
             //判断是否已存在默认域名,存在则不允许添加了
@@ -117,6 +117,6 @@ public class CdnDoaminServiceImpl extends ServiceImpl<CdnDomainMapper, CdnDomain
             }
         }
         this.updateById(domain);
-        return Result.success();
+        return Result.success("操作成功");
     }
 }

+ 1 - 1
mcp/src/main/java/com/chuanxia/mcp/service/impl/CdnDomainCityServiceImpl.java

@@ -20,7 +20,7 @@ public class CdnDomainCityServiceImpl extends ServiceImpl<CdnDomainCityMapper, C
     private final CdnDomainCityMapper domainCityMapper;
 
     @Override
-    public Result listPage(DomainCityQueryDto queryDto) {
+    public Result<IPage<CdnDomainCityVo>> listPage(DomainCityQueryDto queryDto) {
         IPage<CdnDomainCityVo> page = new Page<>(queryDto.getPageNum(), queryDto.getPageSize());
         page = domainCityMapper.listPage(page, queryDto);
         return Result.success(page);

+ 15 - 0
mcp/src/main/java/com/chuanxia/mcp/service/impl/CdnDomainTimeRuleServiceImpl.java

@@ -0,0 +1,15 @@
+package com.chuanxia.mcp.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.chuanxia.mcp.bean.model.CdnDomainTimeRule;
+import com.chuanxia.mcp.mapper.CdnDomainTimeRuleMapper;
+import com.chuanxia.mcp.service.CdnDomainTimeRuleService;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+@Service
+@RequiredArgsConstructor
+@Slf4j
+public class CdnDomainTimeRuleServiceImpl extends ServiceImpl<CdnDomainTimeRuleMapper, CdnDomainTimeRule> implements CdnDomainTimeRuleService {
+}

+ 9 - 9
mcp/src/main/java/com/chuanxia/mcp/service/impl/CdnOperatorServiceImpl.java

@@ -42,24 +42,24 @@ public class CdnOperatorServiceImpl extends ServiceImpl<CdnOperatorMapper, CdnOp
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public Result saveOperator(CdnOperator operator) {
+    public Result<String> saveOperator(CdnOperator operator) {
         SystemUser loginUser = userService.getLoginUser();
         operator.setCreateBy(loginUser.getId());
         operatorMapper.insert(operator);
-        return Result.success();
+        return Result.success("操作成功");
     }
 
     @Override
-    public Result updateOperator(CdnOperator operator) {
+    public Result<String> updateOperator(CdnOperator operator) {
         SystemUser loginUser = userService.getLoginUser();
         operator.setUpdateBy(loginUser.getId());
         operatorMapper.updateById(operator);
-        return Result.success();
+        return Result.success("操作成功");
     }
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public Result bindCdn(DomainOperatorBindDto bindDto) {
+    public Result<String> bindCdn(DomainOperatorBindDto bindDto) {
         Integer domainId = bindDto.getDomainId();
         CdnDomain domain = domainMapper.selectById(domainId);
         if (domain == null) {
@@ -82,11 +82,11 @@ public class CdnOperatorServiceImpl extends ServiceImpl<CdnOperatorMapper, CdnOp
         del.eq(CdnDomainOperator::getDomainId, domainId);
         domainOperatorService.remove(del);
         domainOperatorService.saveBatch(arr);
-        return Result.success();
+        return Result.success("操作成功");
     }
 
     @Override
-    public Result listPage(OperatorQueryDto queryDto) {
+    public Result<IPage<CdnOperatorVo>> listPage(OperatorQueryDto queryDto) {
         IPage<CdnOperatorVo> page = new Page<>(queryDto.getPageSize(), queryDto.getPageNum());
         page = domainOperatorService.listPage(page, queryDto);
         return Result.success(page);
@@ -94,8 +94,8 @@ public class CdnOperatorServiceImpl extends ServiceImpl<CdnOperatorMapper, CdnOp
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public Result removeBind(Integer id) {
+    public Result<String> removeBind(Integer id) {
         domainOperatorService.removeById(id);
-        return Result.success();
+        return Result.success("操作成功");
     }
 }

+ 1 - 1
mcp/src/main/java/com/chuanxia/mcp/service/impl/CdnServiceImpl.java

@@ -23,7 +23,7 @@ public class CdnServiceImpl extends ServiceImpl<CdnCityMapper, CdnCity> implemen
     private final CdnCityMapper cityMapper;
 
     @Override
-    public Result cascade(Integer parentId) {
+    public Result<List<CdnCity>> cascade(Integer parentId) {
         LambdaQueryWrapper<CdnCity> query = Wrappers.lambdaQuery();
         query.eq(CdnCity::getParentId, parentId);
         List<CdnCity> cdnCities = cityMapper.selectList(query);

+ 67 - 0
mcp/src/main/java/com/chuanxia/mcp/service/impl/CdnTimeRuleServiceImpl.java

@@ -0,0 +1,67 @@
+package com.chuanxia.mcp.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.chuanxia.mcp.bean.dto.DomainTimeRuleBindDto;
+import com.chuanxia.mcp.bean.dto.DomainTimeRuleQueryDto;
+import com.chuanxia.mcp.bean.model.CdnDomainTimeRule;
+import com.chuanxia.mcp.bean.model.CdnTimeRule;
+import com.chuanxia.mcp.bean.vo.CdnDomainTimeRuleVo;
+import com.chuanxia.mcp.bean.vo.Result;
+import com.chuanxia.mcp.exception.ResultException;
+import com.chuanxia.mcp.mapper.CdnDomainTimeRuleMapper;
+import com.chuanxia.mcp.mapper.CdnTimeRuleMapper;
+import com.chuanxia.mcp.service.CdnTimeRuleService;
+import com.chuanxia.mcp.service.UserService;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@RequiredArgsConstructor
+@Slf4j
+public class CdnTimeRuleServiceImpl extends ServiceImpl<CdnTimeRuleMapper, CdnTimeRule> implements CdnTimeRuleService {
+    private final UserService userService;
+    private final CdnTimeRuleMapper ruleMapper;
+    private final CdnDomainTimeRuleMapper domainTimeRuleMapper;
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Result<String> bindTimeRule(DomainTimeRuleBindDto timeRule) {
+        Integer startTime = timeRule.getStartTime();
+        Integer endTime = timeRule.getEndTime();
+        if (startTime == null || endTime == null) {
+            throw new ResultException(500, "开始时间/结束时间不能为空");
+        }
+        if (startTime > endTime) {
+            throw new ResultException(500, "开始时间不能大于结束时间");
+        }
+        LambdaQueryWrapper<CdnTimeRule> query = Wrappers.lambdaQuery();
+        query.eq(CdnTimeRule::getStartTime, startTime).eq(CdnTimeRule::getEndTime, endTime);
+        CdnTimeRule cdnTimeRule = ruleMapper.selectOne(query);
+        if (cdnTimeRule == null) {
+            //不存在这个时间规则,创建
+            cdnTimeRule = new CdnTimeRule();
+            cdnTimeRule.setStartTime(startTime);
+            cdnTimeRule.setEndTime(endTime);
+            cdnTimeRule.setCreateBy(userService.getLoginUser().getId());
+            ruleMapper.insert(cdnTimeRule);
+        }
+        CdnDomainTimeRule rule = new CdnDomainTimeRule();
+        rule.setDomainId(timeRule.getDomainId());
+        rule.setTimeRuleId(cdnTimeRule.getId());
+        domainTimeRuleMapper.insert(rule);
+        return Result.success("操作成功");
+    }
+
+    @Override
+    public Result<IPage<CdnDomainTimeRuleVo>> listPage(DomainTimeRuleQueryDto queryDto) {
+        IPage<CdnDomainTimeRuleVo> page = new Page<>(queryDto.getPageNum(), queryDto.getPageSize());
+        page = domainTimeRuleMapper.listPage(page,queryDto);
+        return Result.success(page);
+    }
+}

+ 30 - 0
mcp/src/main/resources/com/chuanxia/mcp/mapper/CdnDomainTimeRuleMapper.xml

@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC
+        "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.chuanxia.mcp.mapper.CdnDomainTimeRuleMapper">
+    <select id="listPage" resultType="com.chuanxia.mcp.bean.vo.CdnDomainTimeRuleVo">
+        SELECT
+        dtr.`id`,
+        dtr.`domain_id` AS domainId,
+        dtr.`time_rule_id` AS timeRuleId,
+        cd.`domain`,
+        ctr.`start_time` AS startTime,
+        ctr.`end_time` AS endTime
+        FROM
+        `cdn_domain_time_rule` dtr
+        LEFT JOIN `cdn_domain` cd
+        ON dtr.`domain_id` = cd.`id`
+        LEFT JOIN `cdn_time_rule` ctr
+        ON dtr.`time_rule_id` = ctr.`id`
+        <if test="queryDto.domain != null and queryDto.domain != ''">
+            and cd.domain = #{queryDto.domain}
+        </if>
+        <if test="queryDto.startTime != null">
+            and ctr.start_time &gt;= #{queryDto.startTime}
+        </if>
+        <if test="queryDto.endTime != null">
+            and ctr.end_time &lt;= #{queryDto.endTime}
+        </if>
+    </select>
+</mapper>