소스 검색

安全管理功能

jincheng 2 주 전
부모
커밋
130df69bcf
17개의 변경된 파일759개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      ship-module-product/ship-module-product-api/src/main/java/com/yc/ship/module/product/enums/ErrorCodeConstants.java
  2. 93 0
      ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/controller/admin/redddata/ReddDataController.java
  3. 35 0
      ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/controller/admin/redddata/vo/ReddDataPageReqVO.java
  4. 41 0
      ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/controller/admin/redddata/vo/ReddDataRespVO.java
  5. 29 0
      ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/controller/admin/redddata/vo/ReddDataSaveReqVO.java
  6. 87 0
      ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/controller/admin/voyagedata/VoyageDataController.java
  7. 19 0
      ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/controller/admin/voyagedata/vo/VoyageDataPageReqVO.java
  8. 97 0
      ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/controller/admin/voyagedata/vo/VoyageDataRespVO.java
  9. 69 0
      ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/controller/admin/voyagedata/vo/VoyageDataSaveReqVO.java
  10. 30 0
      ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/dal/dataobject/redddata/ReddDataDO.java
  11. 44 0
      ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/dal/dataobject/voyagedata/VoyageDataDO.java
  12. 25 0
      ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/dal/mysql/redddata/ReddDataMapper.java
  13. 20 0
      ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/dal/mysql/voyagedata/VoyageDataMapper.java
  14. 26 0
      ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/service/redddata/ReddDataService.java
  15. 65 0
      ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/service/redddata/ReddDataServiceImpl.java
  16. 21 0
      ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/service/voyagedata/VoyageDataService.java
  17. 55 0
      ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/service/voyagedata/VoyageDataServiceImpl.java

+ 3 - 0
ship-module-product/ship-module-product-api/src/main/java/com/yc/ship/module/product/enums/ErrorCodeConstants.java

@@ -51,6 +51,9 @@ public interface ErrorCodeConstants {
 
     ErrorCode VOYAGE_ROOM_NOT_EXIST = new ErrorCode(10_032, "订单所选房间%s不存在");
 
+    ErrorCode VOYAGE_DATA_NOT_EXISTS = new ErrorCode(10_200, "航行数据不存在");
+    ErrorCode REDD_DATA_NOT_EXISTS = new ErrorCode(10_201, "碳排放指标管理不存在");
+
 
 
 

+ 93 - 0
ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/controller/admin/redddata/ReddDataController.java

@@ -0,0 +1,93 @@
+package com.yc.ship.module.product.controller.admin.redddata;
+
+import org.springframework.web.bind.annotation.*;
+import javax.annotation.Resource;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.security.access.prepost.PreAuthorize;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.Operation;
+
+import javax.validation.*;
+import javax.servlet.http.*;
+import java.util.*;
+import java.io.IOException;
+
+import com.yc.ship.framework.common.pojo.PageParam;
+import com.yc.ship.framework.common.pojo.PageResult;
+import com.yc.ship.framework.common.pojo.CommonResult;
+import com.yc.ship.framework.common.util.object.BeanUtils;
+import static com.yc.ship.framework.common.pojo.CommonResult.success;
+
+import com.yc.ship.framework.excel.core.util.ExcelUtils;
+
+import com.yc.ship.framework.apilog.core.annotation.ApiAccessLog;
+import static com.yc.ship.framework.apilog.core.enums.OperateTypeEnum.*;
+
+import com.yc.ship.module.product.controller.admin.redddata.vo.*;
+import com.yc.ship.module.product.dal.dataobject.redddata.ReddDataDO;
+import com.yc.ship.module.product.service.redddata.ReddDataService;
+
+@Tag(name = "管理后台 - 碳排放指标管理")
+@RestController
+@RequestMapping("/buss/redd-data")
+@Validated
+public class ReddDataController {
+
+    @Resource
+    private ReddDataService reddDataService;
+
+    @PostMapping("/create")
+    @Operation(summary = "创建碳排放指标管理")
+    @PreAuthorize("@ss.hasPermission('buss:redd-data:create')")
+    public CommonResult<String> createReddData(@Valid @RequestBody ReddDataSaveReqVO createReqVO) {
+        return success(reddDataService.createReddData(createReqVO));
+    }
+
+    @PutMapping("/update")
+    @Operation(summary = "更新碳排放指标管理")
+    @PreAuthorize("@ss.hasPermission('buss:redd-data:update')")
+    public CommonResult<Boolean> updateReddData(@Valid @RequestBody ReddDataSaveReqVO updateReqVO) {
+        reddDataService.updateReddData(updateReqVO);
+        return success(true);
+    }
+
+    @DeleteMapping("/delete")
+    @Operation(summary = "删除碳排放指标管理")
+    @Parameter(name = "id", description = "编号", required = true)
+    @PreAuthorize("@ss.hasPermission('buss:redd-data:delete')")
+    public CommonResult<Boolean> deleteReddData(@RequestParam("id") String id) {
+        reddDataService.deleteReddData(id);
+        return success(true);
+    }
+
+    @GetMapping("/get")
+    @Operation(summary = "获得碳排放指标管理")
+    @Parameter(name = "id", description = "编号", required = true, example = "1024")
+    @PreAuthorize("@ss.hasPermission('buss:redd-data:query')")
+    public CommonResult<ReddDataRespVO> getReddData(@RequestParam("id") String id) {
+        ReddDataDO reddData = reddDataService.getReddData(id);
+        return success(BeanUtils.toBean(reddData, ReddDataRespVO.class));
+    }
+
+    @GetMapping("/page")
+    @Operation(summary = "获得碳排放指标管理分页")
+    @PreAuthorize("@ss.hasPermission('buss:redd-data:query')")
+    public CommonResult<PageResult<ReddDataRespVO>> getReddDataPage(@Valid ReddDataPageReqVO pageReqVO) {
+        PageResult<ReddDataDO> pageResult = reddDataService.getReddDataPage(pageReqVO);
+        return success(BeanUtils.toBean(pageResult, ReddDataRespVO.class));
+    }
+
+    @GetMapping("/export-excel")
+    @Operation(summary = "导出碳排放指标管理 Excel")
+    @PreAuthorize("@ss.hasPermission('buss:redd-data:export')")
+    @ApiAccessLog(operateType = EXPORT)
+    public void exportReddDataExcel(@Valid ReddDataPageReqVO pageReqVO,
+              HttpServletResponse response) throws IOException {
+        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+        List<ReddDataDO> list = reddDataService.getReddDataPage(pageReqVO).getList();
+        ExcelUtils.write(response, "碳排放指标管理.xls", "数据", ReddDataRespVO.class,
+                        BeanUtils.toBean(list, ReddDataRespVO.class));
+    }
+
+}

+ 35 - 0
ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/controller/admin/redddata/vo/ReddDataPageReqVO.java

@@ -0,0 +1,35 @@
+package com.yc.ship.module.product.controller.admin.redddata.vo;
+
+import lombok.*;
+import io.swagger.v3.oas.annotations.media.Schema;
+import com.yc.ship.framework.common.pojo.PageParam;
+import java.math.BigDecimal;
+import org.springframework.format.annotation.DateTimeFormat;
+import java.time.LocalDateTime;
+
+import static com.yc.ship.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+
+@Schema(description = "管理后台 - 碳排放指标管理分页 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class ReddDataPageReqVO extends PageParam {
+
+    @Schema(description = "记录日期")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private String[] recordDate;
+
+    @Schema(description = "燃油类型", example = "1")
+    private String fuelType;
+
+    @Schema(description = "消耗量")
+    private BigDecimal consume;
+
+    @Schema(description = "碳排放量")
+    private BigDecimal redd;
+
+    @Schema(description = "创建时间")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private LocalDateTime[] createTime;
+
+}

+ 41 - 0
ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/controller/admin/redddata/vo/ReddDataRespVO.java

@@ -0,0 +1,41 @@
+package com.yc.ship.module.product.controller.admin.redddata.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import com.alibaba.excel.annotation.*;
+import com.yc.ship.framework.excel.core.annotations.DictFormat;
+import com.yc.ship.framework.excel.core.convert.DictConvert;
+
+@Schema(description = "管理后台 - 碳排放指标管理 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class ReddDataRespVO {
+
+    @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "12932")
+    @ExcelProperty("主键")
+    private String id;
+
+    @Schema(description = "记录日期", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("记录日期")
+    private String recordDate;
+
+    @Schema(description = "燃油类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
+    @ExcelProperty(value = "燃油类型", converter = DictConvert.class)
+    @DictFormat("fuel_type")
+    private String fuelType;
+
+    @Schema(description = "消耗量")
+    @ExcelProperty("消耗量")
+    private BigDecimal consume;
+
+    @Schema(description = "碳排放量")
+    @ExcelProperty("碳排放量")
+    private BigDecimal redd;
+
+    @Schema(description = "创建时间")
+    @ExcelProperty("创建时间")
+    private LocalDateTime createTime;
+
+}

+ 29 - 0
ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/controller/admin/redddata/vo/ReddDataSaveReqVO.java

@@ -0,0 +1,29 @@
+package com.yc.ship.module.product.controller.admin.redddata.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+import javax.validation.constraints.*;
+import java.math.BigDecimal;
+
+@Schema(description = "管理后台 - 碳排放指标管理新增/修改 Request VO")
+@Data
+public class ReddDataSaveReqVO {
+
+    @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "12932")
+    private String id;
+
+    @Schema(description = "记录日期", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotEmpty(message = "记录日期不能为空")
+    private String recordDate;
+
+    @Schema(description = "燃油类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
+    @NotEmpty(message = "燃油类型不能为空")
+    private String fuelType;
+
+    @Schema(description = "消耗量")
+    private BigDecimal consume;
+
+    @Schema(description = "碳排放量")
+    private BigDecimal redd;
+
+}

+ 87 - 0
ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/controller/admin/voyagedata/VoyageDataController.java

@@ -0,0 +1,87 @@
+package com.yc.ship.module.product.controller.admin.voyagedata;
+
+import org.springframework.web.bind.annotation.*;
+import javax.annotation.Resource;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.security.access.prepost.PreAuthorize;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.Operation;
+import javax.validation.*;
+import javax.servlet.http.*;
+import java.util.*;
+import java.io.IOException;
+import com.yc.ship.framework.common.pojo.PageParam;
+import com.yc.ship.framework.common.pojo.PageResult;
+import com.yc.ship.framework.common.pojo.CommonResult;
+import com.yc.ship.framework.common.util.object.BeanUtils;
+import static com.yc.ship.framework.common.pojo.CommonResult.success;
+import com.yc.ship.framework.excel.core.util.ExcelUtils;
+import com.yc.ship.framework.apilog.core.annotation.ApiAccessLog;
+import static com.yc.ship.framework.apilog.core.enums.OperateTypeEnum.*;
+import com.yc.ship.module.product.controller.admin.voyagedata.vo.*;
+import com.yc.ship.module.product.dal.dataobject.voyagedata.VoyageDataDO;
+import com.yc.ship.module.product.service.voyagedata.VoyageDataService;
+
+@Tag(name = "管理后台 - 航行数据")
+@RestController
+@RequestMapping("/buss/voyage-data")
+@Validated
+public class VoyageDataController {
+
+    @Resource
+    private VoyageDataService voyageDataService;
+
+    @PostMapping("/create")
+    @Operation(summary = "创建航行数据")
+    @PreAuthorize("@ss.hasPermission('buss:voyage-data:create')")
+    public CommonResult<String> createVoyageData(@Valid @RequestBody VoyageDataSaveReqVO createReqVO) {
+        return success(voyageDataService.createVoyageData(createReqVO));
+    }
+
+    @PutMapping("/update")
+    @Operation(summary = "更新航行数据")
+    @PreAuthorize("@ss.hasPermission('buss:voyage-data:update')")
+    public CommonResult<Boolean> updateVoyageData(@Valid @RequestBody VoyageDataSaveReqVO updateReqVO) {
+        voyageDataService.updateVoyageData(updateReqVO);
+        return success(true);
+    }
+
+    @DeleteMapping("/delete")
+    @Operation(summary = "删除航行数据")
+    @Parameter(name = "id", description = "编号", required = true)
+    @PreAuthorize("@ss.hasPermission('buss:voyage-data:delete')")
+    public CommonResult<Boolean> deleteVoyageData(@RequestParam("id") String id) {
+        voyageDataService.deleteVoyageData(id);
+        return success(true);
+    }
+
+    @GetMapping("/get")
+    @Operation(summary = "获得航行数据")
+    @Parameter(name = "id", description = "编号", required = true)
+    @PreAuthorize("@ss.hasPermission('buss:voyage-data:query')")
+    public CommonResult<VoyageDataRespVO> getVoyageData(@RequestParam("id") String id) {
+        VoyageDataDO voyageData = voyageDataService.getVoyageData(id);
+        return success(BeanUtils.toBean(voyageData, VoyageDataRespVO.class));
+    }
+
+    @GetMapping("/page")
+    @Operation(summary = "获得航行数据分页")
+    @PreAuthorize("@ss.hasPermission('buss:voyage-data:query')")
+    public CommonResult<PageResult<VoyageDataRespVO>> getVoyageDataPage(@Valid VoyageDataPageReqVO pageReqVO) {
+        PageResult<VoyageDataDO> pageResult = voyageDataService.getVoyageDataPage(pageReqVO);
+        return success(BeanUtils.toBean(pageResult, VoyageDataRespVO.class));
+    }
+
+    @GetMapping("/export-excel")
+    @Operation(summary = "导出航行数据 Excel")
+    @PreAuthorize("@ss.hasPermission('buss:voyage-data:export')")
+    @ApiAccessLog(operateType = EXPORT)
+    public void exportVoyageDataExcel(@Valid VoyageDataPageReqVO pageReqVO,
+              HttpServletResponse response) throws IOException {
+        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+        List<VoyageDataDO> list = voyageDataService.getVoyageDataPage(pageReqVO).getList();
+        ExcelUtils.write(response, "航行数据.xls", "数据", VoyageDataRespVO.class,
+                        BeanUtils.toBean(list, VoyageDataRespVO.class));
+    }
+} 

+ 19 - 0
ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/controller/admin/voyagedata/vo/VoyageDataPageReqVO.java

@@ -0,0 +1,19 @@
+package com.yc.ship.module.product.controller.admin.voyagedata.vo;
+
+import lombok.*;
+import io.swagger.v3.oas.annotations.media.Schema;
+import com.yc.ship.framework.common.pojo.PageParam;
+
+@Schema(description = "管理后台 - 航行数据分页 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class VoyageDataPageReqVO extends PageParam {
+
+    @Schema(description = "航次", example = "12324")
+    private Long voyageId;
+
+    @Schema(description = "记录日期")
+    private String[] recordDate;
+
+} 

+ 97 - 0
ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/controller/admin/voyagedata/vo/VoyageDataRespVO.java

@@ -0,0 +1,97 @@
+package com.yc.ship.module.product.controller.admin.voyagedata.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import com.alibaba.excel.annotation.*;
+import com.yc.ship.framework.excel.core.annotations.DictFormat;
+import com.yc.ship.framework.excel.core.convert.DictConvert;
+
+@Schema(description = "管理后台 - 航行数据 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class VoyageDataRespVO {
+
+    @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "32518")
+    @ExcelProperty("主键")
+    private String id;
+
+    @Schema(description = "记录日期")
+    @ExcelProperty("记录日期")
+    private String recordDate;
+
+    @Schema(description = "开始点位")
+    @ExcelProperty("开始点位")
+    private Long startPoint;
+
+    @Schema(description = "开始时间")
+    @ExcelProperty("开始时间")
+    private String startTime;
+
+    @Schema(description = "开始点位名称", example = "王五")
+    @ExcelProperty("开始点位名称")
+    private String startPointName;
+
+    @Schema(description = "航次", example = "12324")
+    @ExcelProperty("航次")
+    private Long voyageId;
+
+    @Schema(description = "航向")
+    @ExcelProperty(value = "航向", converter = DictConvert.class)
+    @DictFormat("voyage_course")
+    private String course;
+
+    @Schema(description = "结束点位")
+    @ExcelProperty("结束点位")
+    private Long endPoint;
+
+    @Schema(description = "结束时间")
+    @ExcelProperty("结束时间")
+    private String endTime;
+
+    @Schema(description = "结束点位名称", example = "王五")
+    @ExcelProperty("结束点位名称")
+    private String endPointName;
+
+    @Schema(description = "停泊时间")
+    @ExcelProperty("停泊时间")
+    private BigDecimal dockDuration;
+
+    @Schema(description = "航行时间")
+    @ExcelProperty("航行时间")
+    private BigDecimal voyageDuration;
+
+    @Schema(description = "航程")
+    @ExcelProperty("航程")
+    private BigDecimal voyageDistance;
+
+    @Schema(description = "锅炉1")
+    @ExcelProperty("锅炉1")
+    private BigDecimal boiler1;
+
+    @Schema(description = "锅炉2")
+    @ExcelProperty("锅炉2")
+    private BigDecimal boiler2;
+
+    @Schema(description = "DG1")
+    @ExcelProperty("DG1")
+    private BigDecimal dg1;
+
+    @Schema(description = "DG2")
+    @ExcelProperty("DG2")
+    private BigDecimal dg2;
+
+    @Schema(description = "DG3")
+    @ExcelProperty("DG3")
+    private BigDecimal dg3;
+
+    @Schema(description = "DG4")
+    @ExcelProperty("DG4")
+    private BigDecimal dg4;
+
+    @Schema(description = "创建时间")
+    @ExcelProperty("创建时间")
+    private LocalDateTime createTime;
+
+}

+ 69 - 0
ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/controller/admin/voyagedata/vo/VoyageDataSaveReqVO.java

@@ -0,0 +1,69 @@
+package com.yc.ship.module.product.controller.admin.voyagedata.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+import javax.validation.constraints.*;
+import java.math.BigDecimal;
+
+@Schema(description = "管理后台 - 航行数据新增/修改 Request VO")
+@Data
+public class VoyageDataSaveReqVO {
+
+    @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "32518")
+    private String id;
+
+    @Schema(description = "记录日期")
+    private String recordDate;
+
+    @Schema(description = "开始点位")
+    private Long startPoint;
+
+    @Schema(description = "开始时间")
+    private String startTime;
+
+    @Schema(description = "开始点位名称", example = "王五")
+    private String startPointName;
+
+    @Schema(description = "航次", example = "12324")
+    private Long voyageId;
+
+    @Schema(description = "航向")
+    private String course;
+
+    @Schema(description = "结束点位")
+    private Long endPoint;
+
+    @Schema(description = "结束时间")
+    private String endTime;
+
+    @Schema(description = "结束点位名称", example = "王五")
+    private String endPointName;
+
+    @Schema(description = "停泊时间")
+    private BigDecimal dockDuration;
+
+    @Schema(description = "航行时间")
+    private BigDecimal voyageDuration;
+
+    @Schema(description = "航程")
+    private BigDecimal voyageDistance;
+
+    @Schema(description = "锅炉1")
+    private BigDecimal boiler1;
+
+    @Schema(description = "锅炉2")
+    private BigDecimal boiler2;
+
+    @Schema(description = "DG1")
+    private BigDecimal dg1;
+
+    @Schema(description = "DG2")
+    private BigDecimal dg2;
+
+    @Schema(description = "DG3")
+    private BigDecimal dg3;
+
+    @Schema(description = "DG4")
+    private BigDecimal dg4;
+
+}

+ 30 - 0
ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/dal/dataobject/redddata/ReddDataDO.java

@@ -0,0 +1,30 @@
+package com.yc.ship.module.product.dal.dataobject.redddata;
+
+import lombok.*;
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.*;
+import com.yc.ship.framework.tenant.core.db.TenantBaseDO;
+
+/**
+ * 碳排放指标管理 DO
+ *
+ * @author 管理员
+ */
+@TableName("buss_redd_data")
+@KeySequence("buss_redd_data_seq")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class ReddDataDO extends TenantBaseDO {
+
+    @TableId(type = IdType.ASSIGN_ID)
+    private String id;
+    private String recordDate;
+    private String fuelType;
+    private BigDecimal consume;
+    private BigDecimal redd;
+
+}

+ 44 - 0
ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/dal/dataobject/voyagedata/VoyageDataDO.java

@@ -0,0 +1,44 @@
+package com.yc.ship.module.product.dal.dataobject.voyagedata;
+
+import lombok.*;
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.*;
+import com.yc.ship.framework.tenant.core.db.TenantBaseDO;
+
+/**
+ * 航行数据 DO
+ *
+ * @author 管理员
+ */
+@TableName("buss_voyage_data")
+@KeySequence("buss_voyage_data_seq")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class VoyageDataDO extends TenantBaseDO {
+
+    @TableId(type = IdType.ASSIGN_ID)
+    private String id;
+    private String recordDate;
+    private Long startPoint;
+    private String startTime;
+    private String startPointName;
+    private Long voyageId;
+    private String course;
+    private Long endPoint;
+    private String endTime;
+    private String endPointName;
+    private BigDecimal dockDuration;
+    private BigDecimal voyageDuration;
+    private BigDecimal voyageDistance;
+    private BigDecimal boiler1;
+    private BigDecimal boiler2;
+    private BigDecimal dg1;
+    private BigDecimal dg2;
+    private BigDecimal dg3;
+    private BigDecimal dg4;
+
+}

+ 25 - 0
ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/dal/mysql/redddata/ReddDataMapper.java

@@ -0,0 +1,25 @@
+package com.yc.ship.module.product.dal.mysql.redddata;
+
+import com.yc.ship.framework.common.pojo.PageResult;
+import com.yc.ship.framework.mybatis.core.query.LambdaQueryWrapperX;
+import com.yc.ship.framework.mybatis.core.mapper.BaseMapperX;
+import com.yc.ship.module.product.dal.dataobject.redddata.ReddDataDO;
+import org.apache.ibatis.annotations.Mapper;
+import com.yc.ship.module.product.controller.admin.redddata.vo.*;
+
+/**
+ * 碳排放指标管理 Mapper
+ *
+ * @author 管理员
+ */
+@Mapper
+public interface ReddDataMapper extends BaseMapperX<ReddDataDO> {
+
+    default PageResult<ReddDataDO> selectPage(ReddDataPageReqVO reqVO) {
+        return selectPage(reqVO, new LambdaQueryWrapperX<ReddDataDO>()
+                .betweenIfPresent(ReddDataDO::getRecordDate, reqVO.getRecordDate())
+                .eqIfPresent(ReddDataDO::getFuelType, reqVO.getFuelType())
+                .orderByDesc(ReddDataDO::getRecordDate));
+    }
+
+}

+ 20 - 0
ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/dal/mysql/voyagedata/VoyageDataMapper.java

@@ -0,0 +1,20 @@
+package com.yc.ship.module.product.dal.mysql.voyagedata;
+
+import com.yc.ship.framework.common.pojo.PageResult;
+import com.yc.ship.framework.mybatis.core.query.LambdaQueryWrapperX;
+import com.yc.ship.framework.mybatis.core.mapper.BaseMapperX;
+import com.yc.ship.module.product.dal.dataobject.voyagedata.VoyageDataDO;
+import org.apache.ibatis.annotations.Mapper;
+import com.yc.ship.module.product.controller.admin.voyagedata.vo.*;
+
+@Mapper
+public interface VoyageDataMapper extends BaseMapperX<VoyageDataDO> {
+
+    default PageResult<VoyageDataDO> selectPage(VoyageDataPageReqVO reqVO) {
+        return selectPage(reqVO, new LambdaQueryWrapperX<VoyageDataDO>()
+                .betweenIfPresent(VoyageDataDO::getRecordDate, reqVO.getRecordDate())
+                .eqIfPresent(VoyageDataDO::getVoyageId, reqVO.getVoyageId())
+                .orderByDesc(VoyageDataDO::getId));
+    }
+
+} 

+ 26 - 0
ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/service/redddata/ReddDataService.java

@@ -0,0 +1,26 @@
+package com.yc.ship.module.product.service.redddata;
+
+import com.yc.ship.module.product.controller.admin.redddata.vo.*;
+import com.yc.ship.module.product.dal.dataobject.redddata.ReddDataDO;
+import com.yc.ship.framework.common.pojo.PageResult;
+
+import javax.validation.Valid;
+
+/**
+ * 碳排放指标管理 Service 接口
+ *
+ * @author 管理员
+ */
+public interface ReddDataService {
+
+    String createReddData(@Valid ReddDataSaveReqVO createReqVO);
+
+    void updateReddData(@Valid ReddDataSaveReqVO updateReqVO);
+
+    void deleteReddData(String id);
+
+    ReddDataDO getReddData(String id);
+
+    PageResult<ReddDataDO> getReddDataPage(ReddDataPageReqVO pageReqVO);
+
+}

+ 65 - 0
ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/service/redddata/ReddDataServiceImpl.java

@@ -0,0 +1,65 @@
+package com.yc.ship.module.product.service.redddata;
+
+import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
+import org.springframework.validation.annotation.Validated;
+
+import com.yc.ship.module.product.controller.admin.redddata.vo.*;
+import com.yc.ship.module.product.dal.dataobject.redddata.ReddDataDO;
+import com.yc.ship.framework.common.pojo.PageResult;
+import com.yc.ship.framework.common.util.object.BeanUtils;
+
+import com.yc.ship.module.product.dal.mysql.redddata.ReddDataMapper;
+
+import static com.yc.ship.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static com.yc.ship.module.product.enums.ErrorCodeConstants.*;
+
+/**
+ * 碳排放指标管理 Service 实现类
+ *
+ * @author 管理员
+ */
+@Service
+@Validated
+public class ReddDataServiceImpl implements ReddDataService {
+
+    @Resource
+    private ReddDataMapper reddDataMapper;
+
+    @Override
+    public String createReddData(ReddDataSaveReqVO createReqVO) {
+        ReddDataDO reddData = BeanUtils.toBean(createReqVO, ReddDataDO.class);
+        reddDataMapper.insert(reddData);
+        return reddData.getId();
+    }
+
+    @Override
+    public void updateReddData(ReddDataSaveReqVO updateReqVO) {
+        validateReddDataExists(updateReqVO.getId());
+        ReddDataDO updateObj = BeanUtils.toBean(updateReqVO, ReddDataDO.class);
+        reddDataMapper.updateById(updateObj);
+    }
+
+    @Override
+    public void deleteReddData(String id) {
+        validateReddDataExists(id);
+        reddDataMapper.deleteById(id);
+    }
+
+    private void validateReddDataExists(String id) {
+        if (reddDataMapper.selectById(id) == null) {
+            throw exception(REDD_DATA_NOT_EXISTS);
+        }
+    }
+
+    @Override
+    public ReddDataDO getReddData(String id) {
+        return reddDataMapper.selectById(id);
+    }
+
+    @Override
+    public PageResult<ReddDataDO> getReddDataPage(ReddDataPageReqVO pageReqVO) {
+        return reddDataMapper.selectPage(pageReqVO);
+    }
+
+}

+ 21 - 0
ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/service/voyagedata/VoyageDataService.java

@@ -0,0 +1,21 @@
+package com.yc.ship.module.product.service.voyagedata;
+
+import com.yc.ship.module.product.controller.admin.voyagedata.vo.*;
+import com.yc.ship.module.product.dal.dataobject.voyagedata.VoyageDataDO;
+import com.yc.ship.framework.common.pojo.PageResult;
+
+import javax.validation.Valid;
+
+public interface VoyageDataService {
+
+    String createVoyageData(@Valid VoyageDataSaveReqVO createReqVO);
+
+    void updateVoyageData(@Valid VoyageDataSaveReqVO updateReqVO);
+
+    void deleteVoyageData(String id);
+
+    VoyageDataDO getVoyageData(String id);
+
+    PageResult<VoyageDataDO> getVoyageDataPage(VoyageDataPageReqVO pageReqVO);
+
+} 

+ 55 - 0
ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/service/voyagedata/VoyageDataServiceImpl.java

@@ -0,0 +1,55 @@
+package com.yc.ship.module.product.service.voyagedata;
+
+import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
+import org.springframework.validation.annotation.Validated;
+import com.yc.ship.module.product.controller.admin.voyagedata.vo.*;
+import com.yc.ship.module.product.dal.dataobject.voyagedata.VoyageDataDO;
+import com.yc.ship.framework.common.pojo.PageResult;
+import com.yc.ship.framework.common.util.object.BeanUtils;
+import com.yc.ship.module.product.dal.mysql.voyagedata.VoyageDataMapper;
+import static com.yc.ship.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static com.yc.ship.module.product.enums.ErrorCodeConstants.*;
+
+@Service
+@Validated
+public class VoyageDataServiceImpl implements VoyageDataService {
+    @Resource
+    private VoyageDataMapper voyageDataMapper;
+
+    @Override
+    public String createVoyageData(VoyageDataSaveReqVO createReqVO) {
+        VoyageDataDO voyageData = BeanUtils.toBean(createReqVO, VoyageDataDO.class);
+        voyageDataMapper.insert(voyageData);
+        return voyageData.getId();
+    }
+
+    @Override
+    public void updateVoyageData(VoyageDataSaveReqVO updateReqVO) {
+        validateVoyageDataExists(updateReqVO.getId());
+        VoyageDataDO updateObj = BeanUtils.toBean(updateReqVO, VoyageDataDO.class);
+        voyageDataMapper.updateById(updateObj);
+    }
+
+    @Override
+    public void deleteVoyageData(String id) {
+        validateVoyageDataExists(id);
+        voyageDataMapper.deleteById(id);
+    }
+
+    private void validateVoyageDataExists(String id) {
+        if (voyageDataMapper.selectById(id) == null) {
+            throw exception(VOYAGE_DATA_NOT_EXISTS);
+        }
+    }
+
+    @Override
+    public VoyageDataDO getVoyageData(String id) {
+        return voyageDataMapper.selectById(id);
+    }
+
+    @Override
+    public PageResult<VoyageDataDO> getVoyageDataPage(VoyageDataPageReqVO pageReqVO) {
+        return voyageDataMapper.selectPage(pageReqVO);
+    }
+}