Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
a26f8f6d
authored
Sep 28, 2025
by
Jony.L
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
算力资源重构 代码生成
parent
40d1ac94
Hide whitespace changes
Inline
Side-by-side
Showing
40 changed files
with
2376 additions
and
0 deletions
+2376
-0
computility-module-compute/computility-module-compute-api/pom.xml
+26
-0
computility-module-compute/computility-module-compute-api/src/main/java/com/luhu/computility/module/compute/enums/ErrorCodeConstants.java
+17
-0
computility-module-compute/computility-module-compute-biz/pom.xml
+80
-0
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/controller/admin/resourcecategory/ResourceCategoryController.java
+105
-0
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/controller/admin/resourcecategory/vo/ResourceCategoryPageReqVO.java
+33
-0
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/controller/admin/resourcecategory/vo/ResourceCategoryRespVO.java
+40
-0
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/controller/admin/resourcecategory/vo/ResourceCategorySaveReqVO.java
+31
-0
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/controller/admin/resourceorder/ResourceOrderController.java
+105
-0
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/controller/admin/resourceorder/vo/ResourceOrderPageReqVO.java
+82
-0
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/controller/admin/resourceorder/vo/ResourceOrderRespVO.java
+100
-0
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/controller/admin/resourceorder/vo/ResourceOrderSaveReqVO.java
+80
-0
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/controller/admin/resourcesku/ResourceSkuController.java
+105
-0
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/controller/admin/resourcesku/vo/ResourceSkuPageReqVO.java
+36
-0
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/controller/admin/resourcesku/vo/ResourceSkuRespVO.java
+44
-0
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/controller/admin/resourcesku/vo/ResourceSkuSaveReqVO.java
+35
-0
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/controller/admin/resourcespu/ResourceSpuController.java
+105
-0
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/controller/admin/resourcespu/vo/ResourceSpuPageReqVO.java
+66
-0
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/controller/admin/resourcespu/vo/ResourceSpuRespVO.java
+84
-0
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/controller/admin/resourcespu/vo/ResourceSpuSaveReqVO.java
+73
-0
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/dal/dataobject/resourcecategory/ResourceCategoryDO.java
+49
-0
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/dal/dataobject/resourceorder/ResourceOrderDO.java
+113
-0
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/dal/dataobject/resourcesku/ResourceSkuDO.java
+53
-0
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/dal/dataobject/resourcespu/ResourceSpuDO.java
+93
-0
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/dal/mysql/resourcecategory/ResourceCategoryMapper.java
+31
-0
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/dal/mysql/resourceorder/ResourceOrderMapper.java
+46
-0
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/dal/mysql/resourcesku/ResourceSkuMapper.java
+32
-0
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/dal/mysql/resourcespu/ResourceSpuMapper.java
+42
-0
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/service/resourcecategory/ResourceCategoryService.java
+63
-0
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/service/resourcecategory/ResourceCategoryServiceImpl.java
+86
-0
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/service/resourceorder/ResourceOrderService.java
+63
-0
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/service/resourceorder/ResourceOrderServiceImpl.java
+86
-0
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/service/resourcesku/ResourceSkuService.java
+63
-0
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/service/resourcesku/ResourceSkuServiceImpl.java
+86
-0
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/service/resourcespu/ResourceSpuService.java
+63
-0
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/service/resourcespu/ResourceSpuServiceImpl.java
+86
-0
computility-module-compute/computility-module-compute-biz/src/main/resources/mapper/resourcecategory/ResourceCategoryMapper.xml
+13
-0
computility-module-compute/computility-module-compute-biz/src/main/resources/mapper/resourceorder/ResourceOrderMapper.xml
+13
-0
computility-module-compute/computility-module-compute-biz/src/main/resources/mapper/resourcesku/ResourceSkuMapper.xml
+13
-0
computility-module-compute/computility-module-compute-biz/src/main/resources/mapper/resourcespu/ResourceSpuMapper.xml
+13
-0
computility-module-compute/pom.xml
+22
-0
No files found.
computility-module-compute/computility-module-compute-api/pom.xml
0 → 100644
View file @
a26f8f6d
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4_0_0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
com.luhu
</groupId>
<artifactId>
computility-module-compute
</artifactId>
<version>
${revision}
</version>
</parent>
<artifactId>
computility-module-compute-api
</artifactId>
<packaging>
jar
</packaging>
<url>
http://maven.apache.org
</url>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>
com.luhu
</groupId>
<artifactId>
computility-common
</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
computility-module-compute/computility-module-compute-api/src/main/java/com/luhu/computility/module/compute/enums/ErrorCodeConstants.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
enums
;
import
com.luhu.computility.framework.common.exception.ErrorCode
;
/**
* Compute 错误码枚举类
* <p>
* Compute 系统,使用 1-020-000-000 段
*/
public
interface
ErrorCodeConstants
{
// ========== 算力资源分类表(仅用于算力服务器分类) 1-020-001-000 ==========
ErrorCode
RESOURCE_CATEGORY_NOT_EXISTS
=
new
ErrorCode
(
1_030_001_000
,
"算力资源分类表(仅用于算力服务器分类)不存在"
);
ErrorCode
RESOURCE_SKU_NOT_EXISTS
=
new
ErrorCode
(
1_030_002_000
,
"算力资源SKU表(价格和租赁信息)不存在"
);
ErrorCode
RESOURCE_SPU_NOT_EXISTS
=
new
ErrorCode
(
1_030_003_000
,
"算力资源SPU表(基础配置信息)不存在"
);
ErrorCode
RESOURCE_ORDER_NOT_EXISTS
=
new
ErrorCode
(
1_030_004_000
,
"算力资源订单不存在"
);
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/pom.xml
0 → 100644
View file @
a26f8f6d
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4_0_0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
com.luhu
</groupId>
<artifactId>
computility-module-compute
</artifactId>
<version>
${revision}
</version>
</parent>
<artifactId>
computility-module-compute-biz
</artifactId>
<packaging>
jar
</packaging>
<url>
http://maven.apache.org
</url>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- 依赖自身模块的 api 模块 -->
<dependency>
<groupId>
com.luhu
</groupId>
<artifactId>
computility-module-compute-api
</artifactId>
<version>
${revision}
</version>
</dependency>
<!-- 依赖系统模块 -->
<dependency>
<groupId>
com.luhu
</groupId>
<artifactId>
computility-module-system
</artifactId>
<version>
${revision}
</version>
</dependency>
<!-- 业务组件 -->
<dependency>
<groupId>
com.luhu
</groupId>
<artifactId>
computility-spring-boot-starter-biz-tenant
</artifactId>
</dependency>
<dependency>
<groupId>
com.luhu
</groupId>
<artifactId>
computility-spring-boot-starter-biz-ip
</artifactId>
</dependency>
<!-- Web 相关 -->
<dependency>
<groupId>
com.luhu
</groupId>
<artifactId>
computility-spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
com.luhu
</groupId>
<artifactId>
computility-spring-boot-starter-security
</artifactId>
</dependency>
<!-- DB 相关 -->
<dependency>
<groupId>
com.luhu
</groupId>
<artifactId>
computility-spring-boot-starter-mybatis
</artifactId>
</dependency>
<dependency>
<groupId>
com.luhu
</groupId>
<artifactId>
computility-spring-boot-starter-redis
</artifactId>
</dependency>
<!-- Test 测试相关 -->
<dependency>
<groupId>
com.luhu
</groupId>
<artifactId>
computility-spring-boot-starter-test
</artifactId>
</dependency>
<!-- 工具类相关 -->
<dependency>
<groupId>
com.luhu
</groupId>
<artifactId>
computility-spring-boot-starter-excel
</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/controller/admin/resourcecategory/ResourceCategoryController.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
controller
.
admin
.
resourcecategory
;
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.constraints.*
;
import
javax.validation.*
;
import
javax.servlet.http.*
;
import
java.util.*
;
import
java.io.IOException
;
import
com.luhu.computility.framework.common.pojo.PageParam
;
import
com.luhu.computility.framework.common.pojo.PageResult
;
import
com.luhu.computility.framework.common.pojo.CommonResult
;
import
com.luhu.computility.framework.common.util.object.BeanUtils
;
import
static
com
.
luhu
.
computility
.
framework
.
common
.
pojo
.
CommonResult
.
success
;
import
com.luhu.computility.framework.excel.core.util.ExcelUtils
;
import
com.luhu.computility.framework.apilog.core.annotation.ApiAccessLog
;
import
static
com
.
luhu
.
computility
.
framework
.
apilog
.
core
.
enums
.
OperateTypeEnum
.*;
import
com.luhu.computility.module.compute.controller.admin.resourcecategory.vo.*
;
import
com.luhu.computility.module.compute.dal.dataobject.resourcecategory.ResourceCategoryDO
;
import
com.luhu.computility.module.compute.service.resourcecategory.ResourceCategoryService
;
@Tag
(
name
=
"管理后台 - 算力资源分类表(仅用于算力服务器分类)"
)
@RestController
@RequestMapping
(
"/compute/resource-category"
)
@Validated
public
class
ResourceCategoryController
{
@Resource
private
ResourceCategoryService
resourceCategoryService
;
@PostMapping
(
"/create"
)
@Operation
(
summary
=
"创建算力资源分类表(仅用于算力服务器分类)"
)
@PreAuthorize
(
"@ss.hasPermission('compute:resource-category:create')"
)
public
CommonResult
<
Long
>
createResourceCategory
(
@Valid
@RequestBody
ResourceCategorySaveReqVO
createReqVO
)
{
return
success
(
resourceCategoryService
.
createResourceCategory
(
createReqVO
));
}
@PutMapping
(
"/update"
)
@Operation
(
summary
=
"更新算力资源分类表(仅用于算力服务器分类)"
)
@PreAuthorize
(
"@ss.hasPermission('compute:resource-category:update')"
)
public
CommonResult
<
Boolean
>
updateResourceCategory
(
@Valid
@RequestBody
ResourceCategorySaveReqVO
updateReqVO
)
{
resourceCategoryService
.
updateResourceCategory
(
updateReqVO
);
return
success
(
true
);
}
@DeleteMapping
(
"/delete"
)
@Operation
(
summary
=
"删除算力资源分类表(仅用于算力服务器分类)"
)
@Parameter
(
name
=
"id"
,
description
=
"编号"
,
required
=
true
)
@PreAuthorize
(
"@ss.hasPermission('compute:resource-category:delete')"
)
public
CommonResult
<
Boolean
>
deleteResourceCategory
(
@RequestParam
(
"id"
)
Long
id
)
{
resourceCategoryService
.
deleteResourceCategory
(
id
);
return
success
(
true
);
}
@DeleteMapping
(
"/delete-list"
)
@Parameter
(
name
=
"ids"
,
description
=
"编号"
,
required
=
true
)
@Operation
(
summary
=
"批量删除算力资源分类表(仅用于算力服务器分类)"
)
@PreAuthorize
(
"@ss.hasPermission('compute:resource-category:delete')"
)
public
CommonResult
<
Boolean
>
deleteResourceCategoryList
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
resourceCategoryService
.
deleteResourceCategoryListByIds
(
ids
);
return
success
(
true
);
}
@GetMapping
(
"/get"
)
@Operation
(
summary
=
"获得算力资源分类表(仅用于算力服务器分类)"
)
@Parameter
(
name
=
"id"
,
description
=
"编号"
,
required
=
true
,
example
=
"1024"
)
@PreAuthorize
(
"@ss.hasPermission('compute:resource-category:query')"
)
public
CommonResult
<
ResourceCategoryRespVO
>
getResourceCategory
(
@RequestParam
(
"id"
)
Long
id
)
{
ResourceCategoryDO
resourceCategory
=
resourceCategoryService
.
getResourceCategory
(
id
);
return
success
(
BeanUtils
.
toBean
(
resourceCategory
,
ResourceCategoryRespVO
.
class
));
}
@GetMapping
(
"/page"
)
@Operation
(
summary
=
"获得算力资源分类表(仅用于算力服务器分类)分页"
)
@PreAuthorize
(
"@ss.hasPermission('compute:resource-category:query')"
)
public
CommonResult
<
PageResult
<
ResourceCategoryRespVO
>>
getResourceCategoryPage
(
@Valid
ResourceCategoryPageReqVO
pageReqVO
)
{
PageResult
<
ResourceCategoryDO
>
pageResult
=
resourceCategoryService
.
getResourceCategoryPage
(
pageReqVO
);
return
success
(
BeanUtils
.
toBean
(
pageResult
,
ResourceCategoryRespVO
.
class
));
}
@GetMapping
(
"/export-excel"
)
@Operation
(
summary
=
"导出算力资源分类表(仅用于算力服务器分类) Excel"
)
@PreAuthorize
(
"@ss.hasPermission('compute:resource-category:export')"
)
@ApiAccessLog
(
operateType
=
EXPORT
)
public
void
exportResourceCategoryExcel
(
@Valid
ResourceCategoryPageReqVO
pageReqVO
,
HttpServletResponse
response
)
throws
IOException
{
pageReqVO
.
setPageSize
(
PageParam
.
PAGE_SIZE_NONE
);
List
<
ResourceCategoryDO
>
list
=
resourceCategoryService
.
getResourceCategoryPage
(
pageReqVO
).
getList
();
// 导出 Excel
ExcelUtils
.
write
(
response
,
"算力资源分类表(仅用于算力服务器分类).xls"
,
"数据"
,
ResourceCategoryRespVO
.
class
,
BeanUtils
.
toBean
(
list
,
ResourceCategoryRespVO
.
class
));
}
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/controller/admin/resourcecategory/vo/ResourceCategoryPageReqVO.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
controller
.
admin
.
resourcecategory
.
vo
;
import
lombok.*
;
import
java.util.*
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
com.luhu.computility.framework.common.pojo.PageParam
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.time.LocalDateTime
;
import
static
com
.
luhu
.
computility
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
;
@Schema
(
description
=
"管理后台 - 算力资源分类表(仅用于算力服务器分类)分页 Request VO"
)
@Data
public
class
ResourceCategoryPageReqVO
extends
PageParam
{
@Schema
(
description
=
"分类名称(如:高性能计算服务资源)"
,
example
=
"王五"
)
private
String
name
;
@Schema
(
description
=
"分类图标地址"
,
example
=
"https://www.iocoder.cn"
)
private
String
picUrl
;
@Schema
(
description
=
"分类排序(数字越小越靠前)"
)
private
Integer
sort
;
@Schema
(
description
=
"状态(0=启用,1=禁用)"
,
example
=
"1"
)
private
Integer
status
;
@Schema
(
description
=
"创建时间"
)
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
private
LocalDateTime
[]
createTime
;
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/controller/admin/resourcecategory/vo/ResourceCategoryRespVO.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
controller
.
admin
.
resourcecategory
.
vo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.*
;
import
java.util.*
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.time.LocalDateTime
;
import
com.alibaba.excel.annotation.*
;
@Schema
(
description
=
"管理后台 - 算力资源分类表(仅用于算力服务器分类) Response VO"
)
@Data
@ExcelIgnoreUnannotated
public
class
ResourceCategoryRespVO
{
@Schema
(
description
=
"分类编号"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"13591"
)
@ExcelProperty
(
"分类编号"
)
private
Long
id
;
@Schema
(
description
=
"分类名称(如:高性能计算服务资源)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"王五"
)
@ExcelProperty
(
"分类名称(如:高性能计算服务资源)"
)
private
String
name
;
@Schema
(
description
=
"分类图标地址"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"https://www.iocoder.cn"
)
@ExcelProperty
(
"分类图标地址"
)
private
String
picUrl
;
@Schema
(
description
=
"分类排序(数字越小越靠前)"
)
@ExcelProperty
(
"分类排序(数字越小越靠前)"
)
private
Integer
sort
;
@Schema
(
description
=
"状态(0=启用,1=禁用)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"1"
)
@ExcelProperty
(
"状态(0=启用,1=禁用)"
)
private
Integer
status
;
@Schema
(
description
=
"创建时间"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@ExcelProperty
(
"创建时间"
)
private
LocalDateTime
createTime
;
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/controller/admin/resourcecategory/vo/ResourceCategorySaveReqVO.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
controller
.
admin
.
resourcecategory
.
vo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.*
;
import
java.util.*
;
import
javax.validation.constraints.*
;
@Schema
(
description
=
"管理后台 - 算力资源分类表(仅用于算力服务器分类)新增/修改 Request VO"
)
@Data
public
class
ResourceCategorySaveReqVO
{
@Schema
(
description
=
"分类编号"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"13591"
)
private
Long
id
;
@Schema
(
description
=
"分类名称(如:高性能计算服务资源)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"王五"
)
@NotEmpty
(
message
=
"分类名称(如:高性能计算服务资源)不能为空"
)
private
String
name
;
@Schema
(
description
=
"分类图标地址"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"https://www.iocoder.cn"
)
@NotEmpty
(
message
=
"分类图标地址不能为空"
)
private
String
picUrl
;
@Schema
(
description
=
"分类排序(数字越小越靠前)"
)
private
Integer
sort
;
@Schema
(
description
=
"状态(0=启用,1=禁用)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"1"
)
@NotNull
(
message
=
"状态(0=启用,1=禁用)不能为空"
)
private
Integer
status
;
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/controller/admin/resourceorder/ResourceOrderController.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
controller
.
admin
.
resourceorder
;
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.constraints.*
;
import
javax.validation.*
;
import
javax.servlet.http.*
;
import
java.util.*
;
import
java.io.IOException
;
import
com.luhu.computility.framework.common.pojo.PageParam
;
import
com.luhu.computility.framework.common.pojo.PageResult
;
import
com.luhu.computility.framework.common.pojo.CommonResult
;
import
com.luhu.computility.framework.common.util.object.BeanUtils
;
import
static
com
.
luhu
.
computility
.
framework
.
common
.
pojo
.
CommonResult
.
success
;
import
com.luhu.computility.framework.excel.core.util.ExcelUtils
;
import
com.luhu.computility.framework.apilog.core.annotation.ApiAccessLog
;
import
static
com
.
luhu
.
computility
.
framework
.
apilog
.
core
.
enums
.
OperateTypeEnum
.*;
import
com.luhu.computility.module.compute.controller.admin.resourceorder.vo.*
;
import
com.luhu.computility.module.compute.dal.dataobject.resourceorder.ResourceOrderDO
;
import
com.luhu.computility.module.compute.service.resourceorder.ResourceOrderService
;
@Tag
(
name
=
"管理后台 - 算力资源订单"
)
@RestController
@RequestMapping
(
"/compute/resource-order"
)
@Validated
public
class
ResourceOrderController
{
@Resource
private
ResourceOrderService
resourceOrderService
;
@PostMapping
(
"/create"
)
@Operation
(
summary
=
"创建算力资源订单"
)
@PreAuthorize
(
"@ss.hasPermission('compute:resource-order:create')"
)
public
CommonResult
<
Long
>
createResourceOrder
(
@Valid
@RequestBody
ResourceOrderSaveReqVO
createReqVO
)
{
return
success
(
resourceOrderService
.
createResourceOrder
(
createReqVO
));
}
@PutMapping
(
"/update"
)
@Operation
(
summary
=
"更新算力资源订单"
)
@PreAuthorize
(
"@ss.hasPermission('compute:resource-order:update')"
)
public
CommonResult
<
Boolean
>
updateResourceOrder
(
@Valid
@RequestBody
ResourceOrderSaveReqVO
updateReqVO
)
{
resourceOrderService
.
updateResourceOrder
(
updateReqVO
);
return
success
(
true
);
}
@DeleteMapping
(
"/delete"
)
@Operation
(
summary
=
"删除算力资源订单"
)
@Parameter
(
name
=
"id"
,
description
=
"编号"
,
required
=
true
)
@PreAuthorize
(
"@ss.hasPermission('compute:resource-order:delete')"
)
public
CommonResult
<
Boolean
>
deleteResourceOrder
(
@RequestParam
(
"id"
)
Long
id
)
{
resourceOrderService
.
deleteResourceOrder
(
id
);
return
success
(
true
);
}
@DeleteMapping
(
"/delete-list"
)
@Parameter
(
name
=
"ids"
,
description
=
"编号"
,
required
=
true
)
@Operation
(
summary
=
"批量删除算力资源订单"
)
@PreAuthorize
(
"@ss.hasPermission('compute:resource-order:delete')"
)
public
CommonResult
<
Boolean
>
deleteResourceOrderList
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
resourceOrderService
.
deleteResourceOrderListByIds
(
ids
);
return
success
(
true
);
}
@GetMapping
(
"/get"
)
@Operation
(
summary
=
"获得算力资源订单"
)
@Parameter
(
name
=
"id"
,
description
=
"编号"
,
required
=
true
,
example
=
"1024"
)
@PreAuthorize
(
"@ss.hasPermission('compute:resource-order:query')"
)
public
CommonResult
<
ResourceOrderRespVO
>
getResourceOrder
(
@RequestParam
(
"id"
)
Long
id
)
{
ResourceOrderDO
resourceOrder
=
resourceOrderService
.
getResourceOrder
(
id
);
return
success
(
BeanUtils
.
toBean
(
resourceOrder
,
ResourceOrderRespVO
.
class
));
}
@GetMapping
(
"/page"
)
@Operation
(
summary
=
"获得算力资源订单分页"
)
@PreAuthorize
(
"@ss.hasPermission('compute:resource-order:query')"
)
public
CommonResult
<
PageResult
<
ResourceOrderRespVO
>>
getResourceOrderPage
(
@Valid
ResourceOrderPageReqVO
pageReqVO
)
{
PageResult
<
ResourceOrderDO
>
pageResult
=
resourceOrderService
.
getResourceOrderPage
(
pageReqVO
);
return
success
(
BeanUtils
.
toBean
(
pageResult
,
ResourceOrderRespVO
.
class
));
}
@GetMapping
(
"/export-excel"
)
@Operation
(
summary
=
"导出算力资源订单 Excel"
)
@PreAuthorize
(
"@ss.hasPermission('compute:resource-order:export')"
)
@ApiAccessLog
(
operateType
=
EXPORT
)
public
void
exportResourceOrderExcel
(
@Valid
ResourceOrderPageReqVO
pageReqVO
,
HttpServletResponse
response
)
throws
IOException
{
pageReqVO
.
setPageSize
(
PageParam
.
PAGE_SIZE_NONE
);
List
<
ResourceOrderDO
>
list
=
resourceOrderService
.
getResourceOrderPage
(
pageReqVO
).
getList
();
// 导出 Excel
ExcelUtils
.
write
(
response
,
"算力资源订单.xls"
,
"数据"
,
ResourceOrderRespVO
.
class
,
BeanUtils
.
toBean
(
list
,
ResourceOrderRespVO
.
class
));
}
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/controller/admin/resourceorder/vo/ResourceOrderPageReqVO.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
controller
.
admin
.
resourceorder
.
vo
;
import
lombok.*
;
import
java.util.*
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
com.luhu.computility.framework.common.pojo.PageParam
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.time.LocalDateTime
;
import
static
com
.
luhu
.
computility
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
;
@Schema
(
description
=
"管理后台 - 算力资源订单分页 Request VO"
)
@Data
public
class
ResourceOrderPageReqVO
extends
PageParam
{
@Schema
(
description
=
"下单用户ID"
,
example
=
"14416"
)
private
Long
userId
;
@Schema
(
description
=
"算力资源SKU ID"
,
example
=
"31061"
)
private
Long
skuId
;
@Schema
(
description
=
"算力资源名称(下单时快照)"
,
example
=
"王五"
)
private
String
spuName
;
@Schema
(
description
=
"订单编号"
)
private
String
orderNo
;
@Schema
(
description
=
"订单状态:0=待支付,1=已支付,2=已取消"
,
example
=
"1"
)
private
Integer
status
;
@Schema
(
description
=
"市场价格(分)"
,
example
=
"17709"
)
private
Long
marketPrice
;
@Schema
(
description
=
"实付金额(分)"
,
example
=
"30624"
)
private
Long
paymentPrice
;
@Schema
(
description
=
"支付订单编号"
,
example
=
"15798"
)
private
Long
payOrderId
;
@Schema
(
description
=
"支付时间"
)
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
private
LocalDateTime
[]
payTime
;
@Schema
(
description
=
"支付渠道"
)
private
String
payChannelCode
;
@Schema
(
description
=
"租赁开始时间"
)
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
private
LocalDateTime
[]
rentStartTime
;
@Schema
(
description
=
"租赁结束时间"
)
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
private
LocalDateTime
[]
rentEndTime
;
@Schema
(
description
=
"取消时间"
)
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
private
LocalDateTime
[]
cancelTime
;
@Schema
(
description
=
"备注"
,
example
=
"你说的对"
)
private
String
remark
;
@Schema
(
description
=
"算力资源状态:[0]未启用,[1]使用中,[2]已释放"
,
example
=
"1"
)
private
Integer
resourceStatus
;
@Schema
(
description
=
"退款状态"
,
example
=
"1"
)
private
Integer
refundStatus
;
@Schema
(
description
=
"退款金额"
,
example
=
"7376"
)
private
String
refundPrice
;
@Schema
(
description
=
"开票状态:[0]未开 [1]开票中 [2]已开票"
,
example
=
"1"
)
private
Integer
invoiceStatus
;
@Schema
(
description
=
"发票链接"
,
example
=
"https://www.iocoder.cn"
)
private
String
invoiceUrl
;
@Schema
(
description
=
"创建时间"
)
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
private
LocalDateTime
[]
createTime
;
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/controller/admin/resourceorder/vo/ResourceOrderRespVO.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
controller
.
admin
.
resourceorder
.
vo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.*
;
import
java.util.*
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.time.LocalDateTime
;
import
com.alibaba.excel.annotation.*
;
@Schema
(
description
=
"管理后台 - 算力资源订单 Response VO"
)
@Data
@ExcelIgnoreUnannotated
public
class
ResourceOrderRespVO
{
@Schema
(
description
=
"订单ID"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"1595"
)
@ExcelProperty
(
"订单ID"
)
private
Long
id
;
@Schema
(
description
=
"下单用户ID"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"14416"
)
@ExcelProperty
(
"下单用户ID"
)
private
Long
userId
;
@Schema
(
description
=
"算力资源SKU ID"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"31061"
)
@ExcelProperty
(
"算力资源SKU ID"
)
private
Long
skuId
;
@Schema
(
description
=
"算力资源名称(下单时快照)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"王五"
)
@ExcelProperty
(
"算力资源名称(下单时快照)"
)
private
String
spuName
;
@Schema
(
description
=
"订单编号"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@ExcelProperty
(
"订单编号"
)
private
String
orderNo
;
@Schema
(
description
=
"订单状态:0=待支付,1=已支付,2=已取消"
,
example
=
"1"
)
@ExcelProperty
(
"订单状态:0=待支付,1=已支付,2=已取消"
)
private
Integer
status
;
@Schema
(
description
=
"市场价格(分)"
,
example
=
"17709"
)
@ExcelProperty
(
"市场价格(分)"
)
private
Long
marketPrice
;
@Schema
(
description
=
"实付金额(分)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"30624"
)
@ExcelProperty
(
"实付金额(分)"
)
private
Long
paymentPrice
;
@Schema
(
description
=
"支付订单编号"
,
example
=
"15798"
)
@ExcelProperty
(
"支付订单编号"
)
private
Long
payOrderId
;
@Schema
(
description
=
"支付时间"
)
@ExcelProperty
(
"支付时间"
)
private
LocalDateTime
payTime
;
@Schema
(
description
=
"支付渠道"
)
@ExcelProperty
(
"支付渠道"
)
private
String
payChannelCode
;
@Schema
(
description
=
"租赁开始时间"
)
@ExcelProperty
(
"租赁开始时间"
)
private
LocalDateTime
rentStartTime
;
@Schema
(
description
=
"租赁结束时间"
)
@ExcelProperty
(
"租赁结束时间"
)
private
LocalDateTime
rentEndTime
;
@Schema
(
description
=
"取消时间"
)
@ExcelProperty
(
"取消时间"
)
private
LocalDateTime
cancelTime
;
@Schema
(
description
=
"备注"
,
example
=
"你说的对"
)
@ExcelProperty
(
"备注"
)
private
String
remark
;
@Schema
(
description
=
"算力资源状态:[0]未启用,[1]使用中,[2]已释放"
,
example
=
"1"
)
@ExcelProperty
(
"算力资源状态:[0]未启用,[1]使用中,[2]已释放"
)
private
Integer
resourceStatus
;
@Schema
(
description
=
"退款状态"
,
example
=
"1"
)
@ExcelProperty
(
"退款状态"
)
private
Integer
refundStatus
;
@Schema
(
description
=
"退款金额"
,
example
=
"7376"
)
@ExcelProperty
(
"退款金额"
)
private
String
refundPrice
;
@Schema
(
description
=
"开票状态:[0]未开 [1]开票中 [2]已开票"
,
example
=
"1"
)
@ExcelProperty
(
"开票状态:[0]未开 [1]开票中 [2]已开票"
)
private
Integer
invoiceStatus
;
@Schema
(
description
=
"发票链接"
,
example
=
"https://www.iocoder.cn"
)
@ExcelProperty
(
"发票链接"
)
private
String
invoiceUrl
;
@Schema
(
description
=
"创建时间"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@ExcelProperty
(
"创建时间"
)
private
LocalDateTime
createTime
;
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/controller/admin/resourceorder/vo/ResourceOrderSaveReqVO.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
controller
.
admin
.
resourceorder
.
vo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.*
;
import
java.util.*
;
import
javax.validation.constraints.*
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.time.LocalDateTime
;
@Schema
(
description
=
"管理后台 - 算力资源订单新增/修改 Request VO"
)
@Data
public
class
ResourceOrderSaveReqVO
{
@Schema
(
description
=
"订单ID"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"1595"
)
private
Long
id
;
@Schema
(
description
=
"下单用户ID"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"14416"
)
@NotNull
(
message
=
"下单用户ID不能为空"
)
private
Long
userId
;
@Schema
(
description
=
"算力资源SKU ID"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"31061"
)
@NotNull
(
message
=
"算力资源SKU ID不能为空"
)
private
Long
skuId
;
@Schema
(
description
=
"算力资源名称(下单时快照)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"王五"
)
@NotEmpty
(
message
=
"算力资源名称(下单时快照)不能为空"
)
private
String
spuName
;
@Schema
(
description
=
"订单编号"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@NotEmpty
(
message
=
"订单编号不能为空"
)
private
String
orderNo
;
@Schema
(
description
=
"订单状态:0=待支付,1=已支付,2=已取消"
,
example
=
"1"
)
private
Integer
status
;
@Schema
(
description
=
"市场价格(分)"
,
example
=
"17709"
)
private
Long
marketPrice
;
@Schema
(
description
=
"实付金额(分)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"30624"
)
@NotNull
(
message
=
"实付金额(分)不能为空"
)
private
Long
paymentPrice
;
@Schema
(
description
=
"支付订单编号"
,
example
=
"15798"
)
private
Long
payOrderId
;
@Schema
(
description
=
"支付时间"
)
private
LocalDateTime
payTime
;
@Schema
(
description
=
"支付渠道"
)
private
String
payChannelCode
;
@Schema
(
description
=
"租赁开始时间"
)
private
LocalDateTime
rentStartTime
;
@Schema
(
description
=
"租赁结束时间"
)
private
LocalDateTime
rentEndTime
;
@Schema
(
description
=
"取消时间"
)
private
LocalDateTime
cancelTime
;
@Schema
(
description
=
"备注"
,
example
=
"你说的对"
)
private
String
remark
;
@Schema
(
description
=
"算力资源状态:[0]未启用,[1]使用中,[2]已释放"
,
example
=
"1"
)
private
Integer
resourceStatus
;
@Schema
(
description
=
"退款状态"
,
example
=
"1"
)
private
Integer
refundStatus
;
@Schema
(
description
=
"退款金额"
,
example
=
"7376"
)
private
String
refundPrice
;
@Schema
(
description
=
"开票状态:[0]未开 [1]开票中 [2]已开票"
,
example
=
"1"
)
private
Integer
invoiceStatus
;
@Schema
(
description
=
"发票链接"
,
example
=
"https://www.iocoder.cn"
)
private
String
invoiceUrl
;
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/controller/admin/resourcesku/ResourceSkuController.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
controller
.
admin
.
resourcesku
;
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.constraints.*
;
import
javax.validation.*
;
import
javax.servlet.http.*
;
import
java.util.*
;
import
java.io.IOException
;
import
com.luhu.computility.framework.common.pojo.PageParam
;
import
com.luhu.computility.framework.common.pojo.PageResult
;
import
com.luhu.computility.framework.common.pojo.CommonResult
;
import
com.luhu.computility.framework.common.util.object.BeanUtils
;
import
static
com
.
luhu
.
computility
.
framework
.
common
.
pojo
.
CommonResult
.
success
;
import
com.luhu.computility.framework.excel.core.util.ExcelUtils
;
import
com.luhu.computility.framework.apilog.core.annotation.ApiAccessLog
;
import
static
com
.
luhu
.
computility
.
framework
.
apilog
.
core
.
enums
.
OperateTypeEnum
.*;
import
com.luhu.computility.module.compute.controller.admin.resourcesku.vo.*
;
import
com.luhu.computility.module.compute.dal.dataobject.resourcesku.ResourceSkuDO
;
import
com.luhu.computility.module.compute.service.resourcesku.ResourceSkuService
;
@Tag
(
name
=
"管理后台 - 算力资源SKU表(价格和租赁信息)"
)
@RestController
@RequestMapping
(
"/compute/resource-sku"
)
@Validated
public
class
ResourceSkuController
{
@Resource
private
ResourceSkuService
resourceSkuService
;
@PostMapping
(
"/create"
)
@Operation
(
summary
=
"创建算力资源SKU表(价格和租赁信息)"
)
@PreAuthorize
(
"@ss.hasPermission('compute:resource-sku:create')"
)
public
CommonResult
<
Long
>
createResourceSku
(
@Valid
@RequestBody
ResourceSkuSaveReqVO
createReqVO
)
{
return
success
(
resourceSkuService
.
createResourceSku
(
createReqVO
));
}
@PutMapping
(
"/update"
)
@Operation
(
summary
=
"更新算力资源SKU表(价格和租赁信息)"
)
@PreAuthorize
(
"@ss.hasPermission('compute:resource-sku:update')"
)
public
CommonResult
<
Boolean
>
updateResourceSku
(
@Valid
@RequestBody
ResourceSkuSaveReqVO
updateReqVO
)
{
resourceSkuService
.
updateResourceSku
(
updateReqVO
);
return
success
(
true
);
}
@DeleteMapping
(
"/delete"
)
@Operation
(
summary
=
"删除算力资源SKU表(价格和租赁信息)"
)
@Parameter
(
name
=
"id"
,
description
=
"编号"
,
required
=
true
)
@PreAuthorize
(
"@ss.hasPermission('compute:resource-sku:delete')"
)
public
CommonResult
<
Boolean
>
deleteResourceSku
(
@RequestParam
(
"id"
)
Long
id
)
{
resourceSkuService
.
deleteResourceSku
(
id
);
return
success
(
true
);
}
@DeleteMapping
(
"/delete-list"
)
@Parameter
(
name
=
"ids"
,
description
=
"编号"
,
required
=
true
)
@Operation
(
summary
=
"批量删除算力资源SKU表(价格和租赁信息)"
)
@PreAuthorize
(
"@ss.hasPermission('compute:resource-sku:delete')"
)
public
CommonResult
<
Boolean
>
deleteResourceSkuList
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
resourceSkuService
.
deleteResourceSkuListByIds
(
ids
);
return
success
(
true
);
}
@GetMapping
(
"/get"
)
@Operation
(
summary
=
"获得算力资源SKU表(价格和租赁信息)"
)
@Parameter
(
name
=
"id"
,
description
=
"编号"
,
required
=
true
,
example
=
"1024"
)
@PreAuthorize
(
"@ss.hasPermission('compute:resource-sku:query')"
)
public
CommonResult
<
ResourceSkuRespVO
>
getResourceSku
(
@RequestParam
(
"id"
)
Long
id
)
{
ResourceSkuDO
resourceSku
=
resourceSkuService
.
getResourceSku
(
id
);
return
success
(
BeanUtils
.
toBean
(
resourceSku
,
ResourceSkuRespVO
.
class
));
}
@GetMapping
(
"/page"
)
@Operation
(
summary
=
"获得算力资源SKU表(价格和租赁信息)分页"
)
@PreAuthorize
(
"@ss.hasPermission('compute:resource-sku:query')"
)
public
CommonResult
<
PageResult
<
ResourceSkuRespVO
>>
getResourceSkuPage
(
@Valid
ResourceSkuPageReqVO
pageReqVO
)
{
PageResult
<
ResourceSkuDO
>
pageResult
=
resourceSkuService
.
getResourceSkuPage
(
pageReqVO
);
return
success
(
BeanUtils
.
toBean
(
pageResult
,
ResourceSkuRespVO
.
class
));
}
@GetMapping
(
"/export-excel"
)
@Operation
(
summary
=
"导出算力资源SKU表(价格和租赁信息) Excel"
)
@PreAuthorize
(
"@ss.hasPermission('compute:resource-sku:export')"
)
@ApiAccessLog
(
operateType
=
EXPORT
)
public
void
exportResourceSkuExcel
(
@Valid
ResourceSkuPageReqVO
pageReqVO
,
HttpServletResponse
response
)
throws
IOException
{
pageReqVO
.
setPageSize
(
PageParam
.
PAGE_SIZE_NONE
);
List
<
ResourceSkuDO
>
list
=
resourceSkuService
.
getResourceSkuPage
(
pageReqVO
).
getList
();
// 导出 Excel
ExcelUtils
.
write
(
response
,
"算力资源SKU表(价格和租赁信息).xls"
,
"数据"
,
ResourceSkuRespVO
.
class
,
BeanUtils
.
toBean
(
list
,
ResourceSkuRespVO
.
class
));
}
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/controller/admin/resourcesku/vo/ResourceSkuPageReqVO.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
controller
.
admin
.
resourcesku
.
vo
;
import
lombok.*
;
import
java.util.*
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
com.luhu.computility.framework.common.pojo.PageParam
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.time.LocalDateTime
;
import
static
com
.
luhu
.
computility
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
;
@Schema
(
description
=
"管理后台 - 算力资源SKU表(价格和租赁信息)分页 Request VO"
)
@Data
public
class
ResourceSkuPageReqVO
extends
PageParam
{
@Schema
(
description
=
"关联的SPU ID"
,
example
=
"11013"
)
private
Long
spuId
;
@Schema
(
description
=
"租赁天数(30/90/365等)"
)
private
Integer
durationDays
;
@Schema
(
description
=
"支付价格(单位:分)"
,
example
=
"22794"
)
private
Integer
paymentPrice
;
@Schema
(
description
=
"市场价格(单位:分)"
,
example
=
"5360"
)
private
Integer
marketPrice
;
@Schema
(
description
=
"状态(0-下架,1-上架)"
,
example
=
"2"
)
private
Integer
status
;
@Schema
(
description
=
"创建时间"
)
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
private
LocalDateTime
[]
createTime
;
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/controller/admin/resourcesku/vo/ResourceSkuRespVO.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
controller
.
admin
.
resourcesku
.
vo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.*
;
import
java.util.*
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.time.LocalDateTime
;
import
com.alibaba.excel.annotation.*
;
@Schema
(
description
=
"管理后台 - 算力资源SKU表(价格和租赁信息) Response VO"
)
@Data
@ExcelIgnoreUnannotated
public
class
ResourceSkuRespVO
{
@Schema
(
description
=
"主键ID"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"29086"
)
@ExcelProperty
(
"主键ID"
)
private
Long
id
;
@Schema
(
description
=
"关联的SPU ID"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"11013"
)
@ExcelProperty
(
"关联的SPU ID"
)
private
Long
spuId
;
@Schema
(
description
=
"租赁天数(30/90/365等)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@ExcelProperty
(
"租赁天数(30/90/365等)"
)
private
Integer
durationDays
;
@Schema
(
description
=
"支付价格(单位:分)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"22794"
)
@ExcelProperty
(
"支付价格(单位:分)"
)
private
Integer
paymentPrice
;
@Schema
(
description
=
"市场价格(单位:分)"
,
example
=
"5360"
)
@ExcelProperty
(
"市场价格(单位:分)"
)
private
Integer
marketPrice
;
@Schema
(
description
=
"状态(0-下架,1-上架)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"2"
)
@ExcelProperty
(
"状态(0-下架,1-上架)"
)
private
Integer
status
;
@Schema
(
description
=
"创建时间"
)
@ExcelProperty
(
"创建时间"
)
private
LocalDateTime
createTime
;
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/controller/admin/resourcesku/vo/ResourceSkuSaveReqVO.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
controller
.
admin
.
resourcesku
.
vo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.*
;
import
java.util.*
;
import
javax.validation.constraints.*
;
@Schema
(
description
=
"管理后台 - 算力资源SKU表(价格和租赁信息)新增/修改 Request VO"
)
@Data
public
class
ResourceSkuSaveReqVO
{
@Schema
(
description
=
"主键ID"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"29086"
)
private
Long
id
;
@Schema
(
description
=
"关联的SPU ID"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"11013"
)
@NotNull
(
message
=
"关联的SPU ID不能为空"
)
private
Long
spuId
;
@Schema
(
description
=
"租赁天数(30/90/365等)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@NotNull
(
message
=
"租赁天数(30/90/365等)不能为空"
)
private
Integer
durationDays
;
@Schema
(
description
=
"支付价格(单位:分)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"22794"
)
@NotNull
(
message
=
"支付价格(单位:分)不能为空"
)
private
Integer
paymentPrice
;
@Schema
(
description
=
"市场价格(单位:分)"
,
example
=
"5360"
)
private
Integer
marketPrice
;
@Schema
(
description
=
"状态(0-下架,1-上架)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"2"
)
@NotNull
(
message
=
"状态(0-下架,1-上架)不能为空"
)
private
Integer
status
;
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/controller/admin/resourcespu/ResourceSpuController.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
controller
.
admin
.
resourcespu
;
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.constraints.*
;
import
javax.validation.*
;
import
javax.servlet.http.*
;
import
java.util.*
;
import
java.io.IOException
;
import
com.luhu.computility.framework.common.pojo.PageParam
;
import
com.luhu.computility.framework.common.pojo.PageResult
;
import
com.luhu.computility.framework.common.pojo.CommonResult
;
import
com.luhu.computility.framework.common.util.object.BeanUtils
;
import
static
com
.
luhu
.
computility
.
framework
.
common
.
pojo
.
CommonResult
.
success
;
import
com.luhu.computility.framework.excel.core.util.ExcelUtils
;
import
com.luhu.computility.framework.apilog.core.annotation.ApiAccessLog
;
import
static
com
.
luhu
.
computility
.
framework
.
apilog
.
core
.
enums
.
OperateTypeEnum
.*;
import
com.luhu.computility.module.compute.controller.admin.resourcespu.vo.*
;
import
com.luhu.computility.module.compute.dal.dataobject.resourcespu.ResourceSpuDO
;
import
com.luhu.computility.module.compute.service.resourcespu.ResourceSpuService
;
@Tag
(
name
=
"管理后台 - 算力资源SPU表(基础配置信息)"
)
@RestController
@RequestMapping
(
"/compute/resource-spu"
)
@Validated
public
class
ResourceSpuController
{
@Resource
private
ResourceSpuService
resourceSpuService
;
@PostMapping
(
"/create"
)
@Operation
(
summary
=
"创建算力资源SPU表(基础配置信息)"
)
@PreAuthorize
(
"@ss.hasPermission('compute:resource-spu:create')"
)
public
CommonResult
<
Long
>
createResourceSpu
(
@Valid
@RequestBody
ResourceSpuSaveReqVO
createReqVO
)
{
return
success
(
resourceSpuService
.
createResourceSpu
(
createReqVO
));
}
@PutMapping
(
"/update"
)
@Operation
(
summary
=
"更新算力资源SPU表(基础配置信息)"
)
@PreAuthorize
(
"@ss.hasPermission('compute:resource-spu:update')"
)
public
CommonResult
<
Boolean
>
updateResourceSpu
(
@Valid
@RequestBody
ResourceSpuSaveReqVO
updateReqVO
)
{
resourceSpuService
.
updateResourceSpu
(
updateReqVO
);
return
success
(
true
);
}
@DeleteMapping
(
"/delete"
)
@Operation
(
summary
=
"删除算力资源SPU表(基础配置信息)"
)
@Parameter
(
name
=
"id"
,
description
=
"编号"
,
required
=
true
)
@PreAuthorize
(
"@ss.hasPermission('compute:resource-spu:delete')"
)
public
CommonResult
<
Boolean
>
deleteResourceSpu
(
@RequestParam
(
"id"
)
Long
id
)
{
resourceSpuService
.
deleteResourceSpu
(
id
);
return
success
(
true
);
}
@DeleteMapping
(
"/delete-list"
)
@Parameter
(
name
=
"ids"
,
description
=
"编号"
,
required
=
true
)
@Operation
(
summary
=
"批量删除算力资源SPU表(基础配置信息)"
)
@PreAuthorize
(
"@ss.hasPermission('compute:resource-spu:delete')"
)
public
CommonResult
<
Boolean
>
deleteResourceSpuList
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
resourceSpuService
.
deleteResourceSpuListByIds
(
ids
);
return
success
(
true
);
}
@GetMapping
(
"/get"
)
@Operation
(
summary
=
"获得算力资源SPU表(基础配置信息)"
)
@Parameter
(
name
=
"id"
,
description
=
"编号"
,
required
=
true
,
example
=
"1024"
)
@PreAuthorize
(
"@ss.hasPermission('compute:resource-spu:query')"
)
public
CommonResult
<
ResourceSpuRespVO
>
getResourceSpu
(
@RequestParam
(
"id"
)
Long
id
)
{
ResourceSpuDO
resourceSpu
=
resourceSpuService
.
getResourceSpu
(
id
);
return
success
(
BeanUtils
.
toBean
(
resourceSpu
,
ResourceSpuRespVO
.
class
));
}
@GetMapping
(
"/page"
)
@Operation
(
summary
=
"获得算力资源SPU表(基础配置信息)分页"
)
@PreAuthorize
(
"@ss.hasPermission('compute:resource-spu:query')"
)
public
CommonResult
<
PageResult
<
ResourceSpuRespVO
>>
getResourceSpuPage
(
@Valid
ResourceSpuPageReqVO
pageReqVO
)
{
PageResult
<
ResourceSpuDO
>
pageResult
=
resourceSpuService
.
getResourceSpuPage
(
pageReqVO
);
return
success
(
BeanUtils
.
toBean
(
pageResult
,
ResourceSpuRespVO
.
class
));
}
@GetMapping
(
"/export-excel"
)
@Operation
(
summary
=
"导出算力资源SPU表(基础配置信息) Excel"
)
@PreAuthorize
(
"@ss.hasPermission('compute:resource-spu:export')"
)
@ApiAccessLog
(
operateType
=
EXPORT
)
public
void
exportResourceSpuExcel
(
@Valid
ResourceSpuPageReqVO
pageReqVO
,
HttpServletResponse
response
)
throws
IOException
{
pageReqVO
.
setPageSize
(
PageParam
.
PAGE_SIZE_NONE
);
List
<
ResourceSpuDO
>
list
=
resourceSpuService
.
getResourceSpuPage
(
pageReqVO
).
getList
();
// 导出 Excel
ExcelUtils
.
write
(
response
,
"算力资源SPU表(基础配置信息).xls"
,
"数据"
,
ResourceSpuRespVO
.
class
,
BeanUtils
.
toBean
(
list
,
ResourceSpuRespVO
.
class
));
}
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/controller/admin/resourcespu/vo/ResourceSpuPageReqVO.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
controller
.
admin
.
resourcespu
.
vo
;
import
lombok.*
;
import
java.util.*
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
com.luhu.computility.framework.common.pojo.PageParam
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.time.LocalDateTime
;
import
static
com
.
luhu
.
computility
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
;
@Schema
(
description
=
"管理后台 - 算力资源SPU表(基础配置信息)分页 Request VO"
)
@Data
public
class
ResourceSpuPageReqVO
extends
PageParam
{
@Schema
(
description
=
"算力资源名称"
,
example
=
"李四"
)
private
String
name
;
@Schema
(
description
=
"CPU配置"
)
private
String
cpu
;
@Schema
(
description
=
"GPU配置"
)
private
String
gpu
;
@Schema
(
description
=
"内存配置"
)
private
String
ram
;
@Schema
(
description
=
"存储配置"
)
private
String
storage
;
@Schema
(
description
=
"服务器ip"
)
private
String
ip
;
@Schema
(
description
=
"初始用户名"
,
example
=
"芋艿"
)
private
String
initUsername
;
@Schema
(
description
=
"初始密码"
)
private
String
initPassword
;
@Schema
(
description
=
"商品简介"
)
private
String
intro
;
@Schema
(
description
=
"算力资源分类编号"
,
example
=
"21747"
)
private
Long
categoryId
;
@Schema
(
description
=
"商品封面图"
,
example
=
"https://www.iocoder.cn"
)
private
String
picUrl
;
@Schema
(
description
=
"商品轮播图地址,以逗号分隔,最多15张"
)
private
String
sliderPicUrls
;
@Schema
(
description
=
"总库存数量"
)
private
Integer
stock
;
@Schema
(
description
=
"商品销量"
)
private
Integer
sales
;
@Schema
(
description
=
"状态(0 下架,1 上架,2 回收)"
,
example
=
"1"
)
private
Integer
status
;
@Schema
(
description
=
"创建时间"
)
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
private
LocalDateTime
[]
createTime
;
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/controller/admin/resourcespu/vo/ResourceSpuRespVO.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
controller
.
admin
.
resourcespu
.
vo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.*
;
import
java.util.*
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.time.LocalDateTime
;
import
com.alibaba.excel.annotation.*
;
@Schema
(
description
=
"管理后台 - 算力资源SPU表(基础配置信息) Response VO"
)
@Data
@ExcelIgnoreUnannotated
public
class
ResourceSpuRespVO
{
@Schema
(
description
=
"主键ID"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"22333"
)
@ExcelProperty
(
"主键ID"
)
private
Long
id
;
@Schema
(
description
=
"算力资源名称"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"李四"
)
@ExcelProperty
(
"算力资源名称"
)
private
String
name
;
@Schema
(
description
=
"CPU配置"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@ExcelProperty
(
"CPU配置"
)
private
String
cpu
;
@Schema
(
description
=
"GPU配置"
)
@ExcelProperty
(
"GPU配置"
)
private
String
gpu
;
@Schema
(
description
=
"内存配置"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@ExcelProperty
(
"内存配置"
)
private
String
ram
;
@Schema
(
description
=
"存储配置"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@ExcelProperty
(
"存储配置"
)
private
String
storage
;
@Schema
(
description
=
"服务器ip"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@ExcelProperty
(
"服务器ip"
)
private
String
ip
;
@Schema
(
description
=
"初始用户名"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"芋艿"
)
@ExcelProperty
(
"初始用户名"
)
private
String
initUsername
;
@Schema
(
description
=
"初始密码"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@ExcelProperty
(
"初始密码"
)
private
String
initPassword
;
@Schema
(
description
=
"商品简介"
)
@ExcelProperty
(
"商品简介"
)
private
String
intro
;
@Schema
(
description
=
"算力资源分类编号"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"21747"
)
@ExcelProperty
(
"算力资源分类编号"
)
private
Long
categoryId
;
@Schema
(
description
=
"商品封面图"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"https://www.iocoder.cn"
)
@ExcelProperty
(
"商品封面图"
)
private
String
picUrl
;
@Schema
(
description
=
"商品轮播图地址,以逗号分隔,最多15张"
)
@ExcelProperty
(
"商品轮播图地址,以逗号分隔,最多15张"
)
private
String
sliderPicUrls
;
@Schema
(
description
=
"总库存数量"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@ExcelProperty
(
"总库存数量"
)
private
Integer
stock
;
@Schema
(
description
=
"商品销量"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@ExcelProperty
(
"商品销量"
)
private
Integer
sales
;
@Schema
(
description
=
"状态(0 下架,1 上架,2 回收)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"1"
)
@ExcelProperty
(
"状态(0 下架,1 上架,2 回收)"
)
private
Integer
status
;
@Schema
(
description
=
"创建时间"
)
@ExcelProperty
(
"创建时间"
)
private
LocalDateTime
createTime
;
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/controller/admin/resourcespu/vo/ResourceSpuSaveReqVO.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
controller
.
admin
.
resourcespu
.
vo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.*
;
import
java.util.*
;
import
javax.validation.constraints.*
;
@Schema
(
description
=
"管理后台 - 算力资源SPU表(基础配置信息)新增/修改 Request VO"
)
@Data
public
class
ResourceSpuSaveReqVO
{
@Schema
(
description
=
"主键ID"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"22333"
)
private
Long
id
;
@Schema
(
description
=
"算力资源名称"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"李四"
)
@NotEmpty
(
message
=
"算力资源名称不能为空"
)
private
String
name
;
@Schema
(
description
=
"CPU配置"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@NotEmpty
(
message
=
"CPU配置不能为空"
)
private
String
cpu
;
@Schema
(
description
=
"GPU配置"
)
private
String
gpu
;
@Schema
(
description
=
"内存配置"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@NotEmpty
(
message
=
"内存配置不能为空"
)
private
String
ram
;
@Schema
(
description
=
"存储配置"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@NotEmpty
(
message
=
"存储配置不能为空"
)
private
String
storage
;
@Schema
(
description
=
"服务器ip"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@NotEmpty
(
message
=
"服务器ip不能为空"
)
private
String
ip
;
@Schema
(
description
=
"初始用户名"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"芋艿"
)
@NotEmpty
(
message
=
"初始用户名不能为空"
)
private
String
initUsername
;
@Schema
(
description
=
"初始密码"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@NotEmpty
(
message
=
"初始密码不能为空"
)
private
String
initPassword
;
@Schema
(
description
=
"商品简介"
)
private
String
intro
;
@Schema
(
description
=
"算力资源分类编号"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"21747"
)
@NotNull
(
message
=
"算力资源分类编号不能为空"
)
private
Long
categoryId
;
@Schema
(
description
=
"商品封面图"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"https://www.iocoder.cn"
)
@NotEmpty
(
message
=
"商品封面图不能为空"
)
private
String
picUrl
;
@Schema
(
description
=
"商品轮播图地址,以逗号分隔,最多15张"
)
private
String
sliderPicUrls
;
@Schema
(
description
=
"总库存数量"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@NotNull
(
message
=
"总库存数量不能为空"
)
private
Integer
stock
;
@Schema
(
description
=
"商品销量"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@NotNull
(
message
=
"商品销量不能为空"
)
private
Integer
sales
;
@Schema
(
description
=
"状态(0 下架,1 上架,2 回收)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"1"
)
@NotNull
(
message
=
"状态(0 下架,1 上架,2 回收)不能为空"
)
private
Integer
status
;
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/dal/dataobject/resourcecategory/ResourceCategoryDO.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
dal
.
dataobject
.
resourcecategory
;
import
lombok.*
;
import
java.util.*
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
com.baomidou.mybatisplus.annotation.*
;
import
com.luhu.computility.framework.mybatis.core.dataobject.BaseDO
;
/**
* 算力资源分类表(仅用于算力服务器分类) DO
*
* @author 呼啦啦
*/
@TableName
(
"compute_resource_category"
)
@KeySequence
(
"compute_resource_category_seq"
)
// 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ToString
(
callSuper
=
true
)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
ResourceCategoryDO
extends
BaseDO
{
/**
* 分类编号
*/
@TableId
private
Long
id
;
/**
* 分类名称(如:高性能计算服务资源)
*/
private
String
name
;
/**
* 分类图标地址
*/
private
String
picUrl
;
/**
* 分类排序(数字越小越靠前)
*/
private
Integer
sort
;
/**
* 状态(0=启用,1=禁用)
*/
private
Integer
status
;
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/dal/dataobject/resourceorder/ResourceOrderDO.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
dal
.
dataobject
.
resourceorder
;
import
lombok.*
;
import
java.util.*
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
com.baomidou.mybatisplus.annotation.*
;
import
com.luhu.computility.framework.mybatis.core.dataobject.BaseDO
;
/**
* 算力资源订单 DO
*
* @author 呼啦啦
*/
@TableName
(
"compute_resource_order"
)
@KeySequence
(
"compute_resource_order_seq"
)
// 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ToString
(
callSuper
=
true
)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
ResourceOrderDO
extends
BaseDO
{
/**
* 订单ID
*/
@TableId
private
Long
id
;
/**
* 下单用户ID
*/
private
Long
userId
;
/**
* 算力资源SKU ID
*/
private
Long
skuId
;
/**
* 算力资源名称(下单时快照)
*/
private
String
spuName
;
/**
* 订单编号
*/
private
String
orderNo
;
/**
* 订单状态:0=待支付,1=已支付,2=已取消
*/
private
Integer
status
;
/**
* 市场价格(分)
*/
private
Long
marketPrice
;
/**
* 实付金额(分)
*/
private
Long
paymentPrice
;
/**
* 支付订单编号
*/
private
Long
payOrderId
;
/**
* 支付时间
*/
private
LocalDateTime
payTime
;
/**
* 支付渠道
*/
private
String
payChannelCode
;
/**
* 租赁开始时间
*/
private
LocalDateTime
rentStartTime
;
/**
* 租赁结束时间
*/
private
LocalDateTime
rentEndTime
;
/**
* 取消时间
*/
private
LocalDateTime
cancelTime
;
/**
* 备注
*/
private
String
remark
;
/**
* 算力资源状态:[0]未启用,[1]使用中,[2]已释放
*/
private
Integer
resourceStatus
;
/**
* 退款状态
*/
private
Integer
refundStatus
;
/**
* 退款金额
*/
private
String
refundPrice
;
/**
* 开票状态:[0]未开 [1]开票中 [2]已开票
*/
private
Integer
invoiceStatus
;
/**
* 发票链接
*/
private
String
invoiceUrl
;
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/dal/dataobject/resourcesku/ResourceSkuDO.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
dal
.
dataobject
.
resourcesku
;
import
lombok.*
;
import
java.util.*
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
com.baomidou.mybatisplus.annotation.*
;
import
com.luhu.computility.framework.mybatis.core.dataobject.BaseDO
;
/**
* 算力资源SKU表(价格和租赁信息) DO
*
* @author 呼啦啦
*/
@TableName
(
"compute_resource_sku"
)
@KeySequence
(
"compute_resource_sku_seq"
)
// 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ToString
(
callSuper
=
true
)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
ResourceSkuDO
extends
BaseDO
{
/**
* 主键ID
*/
@TableId
private
Long
id
;
/**
* 关联的SPU ID
*/
private
Long
spuId
;
/**
* 租赁天数(30/90/365等)
*/
private
Integer
durationDays
;
/**
* 支付价格(单位:分)
*/
private
Integer
paymentPrice
;
/**
* 市场价格(单位:分)
*/
private
Integer
marketPrice
;
/**
* 状态(0-下架,1-上架)
*/
private
Integer
status
;
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/dal/dataobject/resourcespu/ResourceSpuDO.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
dal
.
dataobject
.
resourcespu
;
import
lombok.*
;
import
java.util.*
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
com.baomidou.mybatisplus.annotation.*
;
import
com.luhu.computility.framework.mybatis.core.dataobject.BaseDO
;
/**
* 算力资源SPU表(基础配置信息) DO
*
* @author 呼啦啦
*/
@TableName
(
"compute_resource_spu"
)
@KeySequence
(
"compute_resource_spu_seq"
)
// 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ToString
(
callSuper
=
true
)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
ResourceSpuDO
extends
BaseDO
{
/**
* 主键ID
*/
@TableId
private
Long
id
;
/**
* 算力资源名称
*/
private
String
name
;
/**
* CPU配置
*/
private
String
cpu
;
/**
* GPU配置
*/
private
String
gpu
;
/**
* 内存配置
*/
private
String
ram
;
/**
* 存储配置
*/
private
String
storage
;
/**
* 服务器ip
*/
private
String
ip
;
/**
* 初始用户名
*/
private
String
initUsername
;
/**
* 初始密码
*/
private
String
initPassword
;
/**
* 商品简介
*/
private
String
intro
;
/**
* 算力资源分类编号
*/
private
Long
categoryId
;
/**
* 商品封面图
*/
private
String
picUrl
;
/**
* 商品轮播图地址,以逗号分隔,最多15张
*/
private
String
sliderPicUrls
;
/**
* 总库存数量
*/
private
Integer
stock
;
/**
* 商品销量
*/
private
Integer
sales
;
/**
* 状态(0 下架,1 上架,2 回收)
*/
private
Integer
status
;
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/dal/mysql/resourcecategory/ResourceCategoryMapper.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
dal
.
mysql
.
resourcecategory
;
import
java.util.*
;
import
com.luhu.computility.framework.common.pojo.PageResult
;
import
com.luhu.computility.framework.mybatis.core.query.LambdaQueryWrapperX
;
import
com.luhu.computility.framework.mybatis.core.mapper.BaseMapperX
;
import
com.luhu.computility.module.compute.dal.dataobject.resourcecategory.ResourceCategoryDO
;
import
org.apache.ibatis.annotations.Mapper
;
import
com.luhu.computility.module.compute.controller.admin.resourcecategory.vo.*
;
/**
* 算力资源分类表(仅用于算力服务器分类) Mapper
*
* @author 呼啦啦
*/
@Mapper
public
interface
ResourceCategoryMapper
extends
BaseMapperX
<
ResourceCategoryDO
>
{
default
PageResult
<
ResourceCategoryDO
>
selectPage
(
ResourceCategoryPageReqVO
reqVO
)
{
return
selectPage
(
reqVO
,
new
LambdaQueryWrapperX
<
ResourceCategoryDO
>()
.
likeIfPresent
(
ResourceCategoryDO:
:
getName
,
reqVO
.
getName
())
.
eqIfPresent
(
ResourceCategoryDO:
:
getPicUrl
,
reqVO
.
getPicUrl
())
.
eqIfPresent
(
ResourceCategoryDO:
:
getSort
,
reqVO
.
getSort
())
.
eqIfPresent
(
ResourceCategoryDO:
:
getStatus
,
reqVO
.
getStatus
())
.
betweenIfPresent
(
ResourceCategoryDO:
:
getCreateTime
,
reqVO
.
getCreateTime
())
.
orderByDesc
(
ResourceCategoryDO:
:
getId
));
}
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/dal/mysql/resourceorder/ResourceOrderMapper.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
dal
.
mysql
.
resourceorder
;
import
java.util.*
;
import
com.luhu.computility.framework.common.pojo.PageResult
;
import
com.luhu.computility.framework.mybatis.core.query.LambdaQueryWrapperX
;
import
com.luhu.computility.framework.mybatis.core.mapper.BaseMapperX
;
import
com.luhu.computility.module.compute.dal.dataobject.resourceorder.ResourceOrderDO
;
import
org.apache.ibatis.annotations.Mapper
;
import
com.luhu.computility.module.compute.controller.admin.resourceorder.vo.*
;
/**
* 算力资源订单 Mapper
*
* @author 呼啦啦
*/
@Mapper
public
interface
ResourceOrderMapper
extends
BaseMapperX
<
ResourceOrderDO
>
{
default
PageResult
<
ResourceOrderDO
>
selectPage
(
ResourceOrderPageReqVO
reqVO
)
{
return
selectPage
(
reqVO
,
new
LambdaQueryWrapperX
<
ResourceOrderDO
>()
.
eqIfPresent
(
ResourceOrderDO:
:
getUserId
,
reqVO
.
getUserId
())
.
eqIfPresent
(
ResourceOrderDO:
:
getSkuId
,
reqVO
.
getSkuId
())
.
likeIfPresent
(
ResourceOrderDO:
:
getSpuName
,
reqVO
.
getSpuName
())
.
eqIfPresent
(
ResourceOrderDO:
:
getOrderNo
,
reqVO
.
getOrderNo
())
.
eqIfPresent
(
ResourceOrderDO:
:
getStatus
,
reqVO
.
getStatus
())
.
eqIfPresent
(
ResourceOrderDO:
:
getMarketPrice
,
reqVO
.
getMarketPrice
())
.
eqIfPresent
(
ResourceOrderDO:
:
getPaymentPrice
,
reqVO
.
getPaymentPrice
())
.
eqIfPresent
(
ResourceOrderDO:
:
getPayOrderId
,
reqVO
.
getPayOrderId
())
.
betweenIfPresent
(
ResourceOrderDO:
:
getPayTime
,
reqVO
.
getPayTime
())
.
eqIfPresent
(
ResourceOrderDO:
:
getPayChannelCode
,
reqVO
.
getPayChannelCode
())
.
betweenIfPresent
(
ResourceOrderDO:
:
getRentStartTime
,
reqVO
.
getRentStartTime
())
.
betweenIfPresent
(
ResourceOrderDO:
:
getRentEndTime
,
reqVO
.
getRentEndTime
())
.
betweenIfPresent
(
ResourceOrderDO:
:
getCancelTime
,
reqVO
.
getCancelTime
())
.
eqIfPresent
(
ResourceOrderDO:
:
getRemark
,
reqVO
.
getRemark
())
.
eqIfPresent
(
ResourceOrderDO:
:
getResourceStatus
,
reqVO
.
getResourceStatus
())
.
eqIfPresent
(
ResourceOrderDO:
:
getRefundStatus
,
reqVO
.
getRefundStatus
())
.
eqIfPresent
(
ResourceOrderDO:
:
getRefundPrice
,
reqVO
.
getRefundPrice
())
.
eqIfPresent
(
ResourceOrderDO:
:
getInvoiceStatus
,
reqVO
.
getInvoiceStatus
())
.
eqIfPresent
(
ResourceOrderDO:
:
getInvoiceUrl
,
reqVO
.
getInvoiceUrl
())
.
betweenIfPresent
(
ResourceOrderDO:
:
getCreateTime
,
reqVO
.
getCreateTime
())
.
orderByDesc
(
ResourceOrderDO:
:
getId
));
}
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/dal/mysql/resourcesku/ResourceSkuMapper.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
dal
.
mysql
.
resourcesku
;
import
java.util.*
;
import
com.luhu.computility.framework.common.pojo.PageResult
;
import
com.luhu.computility.framework.mybatis.core.query.LambdaQueryWrapperX
;
import
com.luhu.computility.framework.mybatis.core.mapper.BaseMapperX
;
import
com.luhu.computility.module.compute.dal.dataobject.resourcesku.ResourceSkuDO
;
import
org.apache.ibatis.annotations.Mapper
;
import
com.luhu.computility.module.compute.controller.admin.resourcesku.vo.*
;
/**
* 算力资源SKU表(价格和租赁信息) Mapper
*
* @author 呼啦啦
*/
@Mapper
public
interface
ResourceSkuMapper
extends
BaseMapperX
<
ResourceSkuDO
>
{
default
PageResult
<
ResourceSkuDO
>
selectPage
(
ResourceSkuPageReqVO
reqVO
)
{
return
selectPage
(
reqVO
,
new
LambdaQueryWrapperX
<
ResourceSkuDO
>()
.
eqIfPresent
(
ResourceSkuDO:
:
getSpuId
,
reqVO
.
getSpuId
())
.
eqIfPresent
(
ResourceSkuDO:
:
getDurationDays
,
reqVO
.
getDurationDays
())
.
eqIfPresent
(
ResourceSkuDO:
:
getPaymentPrice
,
reqVO
.
getPaymentPrice
())
.
eqIfPresent
(
ResourceSkuDO:
:
getMarketPrice
,
reqVO
.
getMarketPrice
())
.
eqIfPresent
(
ResourceSkuDO:
:
getStatus
,
reqVO
.
getStatus
())
.
betweenIfPresent
(
ResourceSkuDO:
:
getCreateTime
,
reqVO
.
getCreateTime
())
.
orderByDesc
(
ResourceSkuDO:
:
getId
));
}
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/dal/mysql/resourcespu/ResourceSpuMapper.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
dal
.
mysql
.
resourcespu
;
import
java.util.*
;
import
com.luhu.computility.framework.common.pojo.PageResult
;
import
com.luhu.computility.framework.mybatis.core.query.LambdaQueryWrapperX
;
import
com.luhu.computility.framework.mybatis.core.mapper.BaseMapperX
;
import
com.luhu.computility.module.compute.dal.dataobject.resourcespu.ResourceSpuDO
;
import
org.apache.ibatis.annotations.Mapper
;
import
com.luhu.computility.module.compute.controller.admin.resourcespu.vo.*
;
/**
* 算力资源SPU表(基础配置信息) Mapper
*
* @author 呼啦啦
*/
@Mapper
public
interface
ResourceSpuMapper
extends
BaseMapperX
<
ResourceSpuDO
>
{
default
PageResult
<
ResourceSpuDO
>
selectPage
(
ResourceSpuPageReqVO
reqVO
)
{
return
selectPage
(
reqVO
,
new
LambdaQueryWrapperX
<
ResourceSpuDO
>()
.
likeIfPresent
(
ResourceSpuDO:
:
getName
,
reqVO
.
getName
())
.
eqIfPresent
(
ResourceSpuDO:
:
getCpu
,
reqVO
.
getCpu
())
.
eqIfPresent
(
ResourceSpuDO:
:
getGpu
,
reqVO
.
getGpu
())
.
eqIfPresent
(
ResourceSpuDO:
:
getRam
,
reqVO
.
getRam
())
.
eqIfPresent
(
ResourceSpuDO:
:
getStorage
,
reqVO
.
getStorage
())
.
eqIfPresent
(
ResourceSpuDO:
:
getIp
,
reqVO
.
getIp
())
.
likeIfPresent
(
ResourceSpuDO:
:
getInitUsername
,
reqVO
.
getInitUsername
())
.
eqIfPresent
(
ResourceSpuDO:
:
getInitPassword
,
reqVO
.
getInitPassword
())
.
eqIfPresent
(
ResourceSpuDO:
:
getIntro
,
reqVO
.
getIntro
())
.
eqIfPresent
(
ResourceSpuDO:
:
getCategoryId
,
reqVO
.
getCategoryId
())
.
eqIfPresent
(
ResourceSpuDO:
:
getPicUrl
,
reqVO
.
getPicUrl
())
.
eqIfPresent
(
ResourceSpuDO:
:
getSliderPicUrls
,
reqVO
.
getSliderPicUrls
())
.
eqIfPresent
(
ResourceSpuDO:
:
getStock
,
reqVO
.
getStock
())
.
eqIfPresent
(
ResourceSpuDO:
:
getSales
,
reqVO
.
getSales
())
.
eqIfPresent
(
ResourceSpuDO:
:
getStatus
,
reqVO
.
getStatus
())
.
betweenIfPresent
(
ResourceSpuDO:
:
getCreateTime
,
reqVO
.
getCreateTime
())
.
orderByDesc
(
ResourceSpuDO:
:
getId
));
}
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/service/resourcecategory/ResourceCategoryService.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
service
.
resourcecategory
;
import
java.util.*
;
import
javax.validation.*
;
import
com.luhu.computility.module.compute.controller.admin.resourcecategory.vo.*
;
import
com.luhu.computility.module.compute.dal.dataobject.resourcecategory.ResourceCategoryDO
;
import
com.luhu.computility.framework.common.pojo.PageResult
;
import
com.luhu.computility.framework.common.pojo.PageParam
;
/**
* 算力资源分类表(仅用于算力服务器分类) Service 接口
*
* @author 呼啦啦
*/
public
interface
ResourceCategoryService
{
/**
* 创建算力资源分类表(仅用于算力服务器分类)
*
* @param createReqVO 创建信息
* @return 编号
*/
Long
createResourceCategory
(
@Valid
ResourceCategorySaveReqVO
createReqVO
);
/**
* 更新算力资源分类表(仅用于算力服务器分类)
*
* @param updateReqVO 更新信息
*/
void
updateResourceCategory
(
@Valid
ResourceCategorySaveReqVO
updateReqVO
);
/**
* 删除算力资源分类表(仅用于算力服务器分类)
*
* @param id 编号
*/
void
deleteResourceCategory
(
Long
id
);
/**
* 批量删除算力资源分类表(仅用于算力服务器分类)
*
* @param ids 编号
*/
void
deleteResourceCategoryListByIds
(
List
<
Long
>
ids
);
/**
* 获得算力资源分类表(仅用于算力服务器分类)
*
* @param id 编号
* @return 算力资源分类表(仅用于算力服务器分类)
*/
ResourceCategoryDO
getResourceCategory
(
Long
id
);
/**
* 获得算力资源分类表(仅用于算力服务器分类)分页
*
* @param pageReqVO 分页查询
* @return 算力资源分类表(仅用于算力服务器分类)分页
*/
PageResult
<
ResourceCategoryDO
>
getResourceCategoryPage
(
ResourceCategoryPageReqVO
pageReqVO
);
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/service/resourcecategory/ResourceCategoryServiceImpl.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
service
.
resourcecategory
;
import
cn.hutool.core.collection.CollUtil
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.*
;
import
com.luhu.computility.module.compute.controller.admin.resourcecategory.vo.*
;
import
com.luhu.computility.module.compute.dal.dataobject.resourcecategory.ResourceCategoryDO
;
import
com.luhu.computility.framework.common.pojo.PageResult
;
import
com.luhu.computility.framework.common.pojo.PageParam
;
import
com.luhu.computility.framework.common.util.object.BeanUtils
;
import
com.luhu.computility.module.compute.dal.mysql.resourcecategory.ResourceCategoryMapper
;
import
static
com
.
luhu
.
computility
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
import
static
com
.
luhu
.
computility
.
framework
.
common
.
util
.
collection
.
CollectionUtils
.
convertList
;
import
static
com
.
luhu
.
computility
.
framework
.
common
.
util
.
collection
.
CollectionUtils
.
diffList
;
import
static
com
.
luhu
.
computility
.
module
.
compute
.
enums
.
ErrorCodeConstants
.*;
/**
* 算力资源分类表(仅用于算力服务器分类) Service 实现类
*
* @author 呼啦啦
*/
@Service
@Validated
public
class
ResourceCategoryServiceImpl
implements
ResourceCategoryService
{
@Resource
private
ResourceCategoryMapper
resourceCategoryMapper
;
@Override
public
Long
createResourceCategory
(
ResourceCategorySaveReqVO
createReqVO
)
{
// 插入
ResourceCategoryDO
resourceCategory
=
BeanUtils
.
toBean
(
createReqVO
,
ResourceCategoryDO
.
class
);
resourceCategoryMapper
.
insert
(
resourceCategory
);
// 返回
return
resourceCategory
.
getId
();
}
@Override
public
void
updateResourceCategory
(
ResourceCategorySaveReqVO
updateReqVO
)
{
// 校验存在
validateResourceCategoryExists
(
updateReqVO
.
getId
());
// 更新
ResourceCategoryDO
updateObj
=
BeanUtils
.
toBean
(
updateReqVO
,
ResourceCategoryDO
.
class
);
resourceCategoryMapper
.
updateById
(
updateObj
);
}
@Override
public
void
deleteResourceCategory
(
Long
id
)
{
// 校验存在
validateResourceCategoryExists
(
id
);
// 删除
resourceCategoryMapper
.
deleteById
(
id
);
}
@Override
public
void
deleteResourceCategoryListByIds
(
List
<
Long
>
ids
)
{
// 删除
resourceCategoryMapper
.
deleteByIds
(
ids
);
}
private
void
validateResourceCategoryExists
(
Long
id
)
{
if
(
resourceCategoryMapper
.
selectById
(
id
)
==
null
)
{
throw
exception
(
RESOURCE_CATEGORY_NOT_EXISTS
);
}
}
@Override
public
ResourceCategoryDO
getResourceCategory
(
Long
id
)
{
return
resourceCategoryMapper
.
selectById
(
id
);
}
@Override
public
PageResult
<
ResourceCategoryDO
>
getResourceCategoryPage
(
ResourceCategoryPageReqVO
pageReqVO
)
{
return
resourceCategoryMapper
.
selectPage
(
pageReqVO
);
}
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/service/resourceorder/ResourceOrderService.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
service
.
resourceorder
;
import
java.util.*
;
import
javax.validation.*
;
import
com.luhu.computility.module.compute.controller.admin.resourceorder.vo.*
;
import
com.luhu.computility.module.compute.dal.dataobject.resourceorder.ResourceOrderDO
;
import
com.luhu.computility.framework.common.pojo.PageResult
;
import
com.luhu.computility.framework.common.pojo.PageParam
;
/**
* 算力资源订单 Service 接口
*
* @author 呼啦啦
*/
public
interface
ResourceOrderService
{
/**
* 创建算力资源订单
*
* @param createReqVO 创建信息
* @return 编号
*/
Long
createResourceOrder
(
@Valid
ResourceOrderSaveReqVO
createReqVO
);
/**
* 更新算力资源订单
*
* @param updateReqVO 更新信息
*/
void
updateResourceOrder
(
@Valid
ResourceOrderSaveReqVO
updateReqVO
);
/**
* 删除算力资源订单
*
* @param id 编号
*/
void
deleteResourceOrder
(
Long
id
);
/**
* 批量删除算力资源订单
*
* @param ids 编号
*/
void
deleteResourceOrderListByIds
(
List
<
Long
>
ids
);
/**
* 获得算力资源订单
*
* @param id 编号
* @return 算力资源订单
*/
ResourceOrderDO
getResourceOrder
(
Long
id
);
/**
* 获得算力资源订单分页
*
* @param pageReqVO 分页查询
* @return 算力资源订单分页
*/
PageResult
<
ResourceOrderDO
>
getResourceOrderPage
(
ResourceOrderPageReqVO
pageReqVO
);
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/service/resourceorder/ResourceOrderServiceImpl.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
service
.
resourceorder
;
import
cn.hutool.core.collection.CollUtil
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.*
;
import
com.luhu.computility.module.compute.controller.admin.resourceorder.vo.*
;
import
com.luhu.computility.module.compute.dal.dataobject.resourceorder.ResourceOrderDO
;
import
com.luhu.computility.framework.common.pojo.PageResult
;
import
com.luhu.computility.framework.common.pojo.PageParam
;
import
com.luhu.computility.framework.common.util.object.BeanUtils
;
import
com.luhu.computility.module.compute.dal.mysql.resourceorder.ResourceOrderMapper
;
import
static
com
.
luhu
.
computility
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
import
static
com
.
luhu
.
computility
.
framework
.
common
.
util
.
collection
.
CollectionUtils
.
convertList
;
import
static
com
.
luhu
.
computility
.
framework
.
common
.
util
.
collection
.
CollectionUtils
.
diffList
;
import
static
com
.
luhu
.
computility
.
module
.
compute
.
enums
.
ErrorCodeConstants
.*;
/**
* 算力资源订单 Service 实现类
*
* @author 呼啦啦
*/
@Service
@Validated
public
class
ResourceOrderServiceImpl
implements
ResourceOrderService
{
@Resource
private
ResourceOrderMapper
resourceOrderMapper
;
@Override
public
Long
createResourceOrder
(
ResourceOrderSaveReqVO
createReqVO
)
{
// 插入
ResourceOrderDO
resourceOrder
=
BeanUtils
.
toBean
(
createReqVO
,
ResourceOrderDO
.
class
);
resourceOrderMapper
.
insert
(
resourceOrder
);
// 返回
return
resourceOrder
.
getId
();
}
@Override
public
void
updateResourceOrder
(
ResourceOrderSaveReqVO
updateReqVO
)
{
// 校验存在
validateResourceOrderExists
(
updateReqVO
.
getId
());
// 更新
ResourceOrderDO
updateObj
=
BeanUtils
.
toBean
(
updateReqVO
,
ResourceOrderDO
.
class
);
resourceOrderMapper
.
updateById
(
updateObj
);
}
@Override
public
void
deleteResourceOrder
(
Long
id
)
{
// 校验存在
validateResourceOrderExists
(
id
);
// 删除
resourceOrderMapper
.
deleteById
(
id
);
}
@Override
public
void
deleteResourceOrderListByIds
(
List
<
Long
>
ids
)
{
// 删除
resourceOrderMapper
.
deleteByIds
(
ids
);
}
private
void
validateResourceOrderExists
(
Long
id
)
{
if
(
resourceOrderMapper
.
selectById
(
id
)
==
null
)
{
throw
exception
(
RESOURCE_ORDER_NOT_EXISTS
);
}
}
@Override
public
ResourceOrderDO
getResourceOrder
(
Long
id
)
{
return
resourceOrderMapper
.
selectById
(
id
);
}
@Override
public
PageResult
<
ResourceOrderDO
>
getResourceOrderPage
(
ResourceOrderPageReqVO
pageReqVO
)
{
return
resourceOrderMapper
.
selectPage
(
pageReqVO
);
}
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/service/resourcesku/ResourceSkuService.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
service
.
resourcesku
;
import
java.util.*
;
import
javax.validation.*
;
import
com.luhu.computility.module.compute.controller.admin.resourcesku.vo.*
;
import
com.luhu.computility.module.compute.dal.dataobject.resourcesku.ResourceSkuDO
;
import
com.luhu.computility.framework.common.pojo.PageResult
;
import
com.luhu.computility.framework.common.pojo.PageParam
;
/**
* 算力资源SKU表(价格和租赁信息) Service 接口
*
* @author 呼啦啦
*/
public
interface
ResourceSkuService
{
/**
* 创建算力资源SKU表(价格和租赁信息)
*
* @param createReqVO 创建信息
* @return 编号
*/
Long
createResourceSku
(
@Valid
ResourceSkuSaveReqVO
createReqVO
);
/**
* 更新算力资源SKU表(价格和租赁信息)
*
* @param updateReqVO 更新信息
*/
void
updateResourceSku
(
@Valid
ResourceSkuSaveReqVO
updateReqVO
);
/**
* 删除算力资源SKU表(价格和租赁信息)
*
* @param id 编号
*/
void
deleteResourceSku
(
Long
id
);
/**
* 批量删除算力资源SKU表(价格和租赁信息)
*
* @param ids 编号
*/
void
deleteResourceSkuListByIds
(
List
<
Long
>
ids
);
/**
* 获得算力资源SKU表(价格和租赁信息)
*
* @param id 编号
* @return 算力资源SKU表(价格和租赁信息)
*/
ResourceSkuDO
getResourceSku
(
Long
id
);
/**
* 获得算力资源SKU表(价格和租赁信息)分页
*
* @param pageReqVO 分页查询
* @return 算力资源SKU表(价格和租赁信息)分页
*/
PageResult
<
ResourceSkuDO
>
getResourceSkuPage
(
ResourceSkuPageReqVO
pageReqVO
);
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/service/resourcesku/ResourceSkuServiceImpl.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
service
.
resourcesku
;
import
cn.hutool.core.collection.CollUtil
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.*
;
import
com.luhu.computility.module.compute.controller.admin.resourcesku.vo.*
;
import
com.luhu.computility.module.compute.dal.dataobject.resourcesku.ResourceSkuDO
;
import
com.luhu.computility.framework.common.pojo.PageResult
;
import
com.luhu.computility.framework.common.pojo.PageParam
;
import
com.luhu.computility.framework.common.util.object.BeanUtils
;
import
com.luhu.computility.module.compute.dal.mysql.resourcesku.ResourceSkuMapper
;
import
static
com
.
luhu
.
computility
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
import
static
com
.
luhu
.
computility
.
framework
.
common
.
util
.
collection
.
CollectionUtils
.
convertList
;
import
static
com
.
luhu
.
computility
.
framework
.
common
.
util
.
collection
.
CollectionUtils
.
diffList
;
import
static
com
.
luhu
.
computility
.
module
.
compute
.
enums
.
ErrorCodeConstants
.*;
/**
* 算力资源SKU表(价格和租赁信息) Service 实现类
*
* @author 呼啦啦
*/
@Service
@Validated
public
class
ResourceSkuServiceImpl
implements
ResourceSkuService
{
@Resource
private
ResourceSkuMapper
resourceSkuMapper
;
@Override
public
Long
createResourceSku
(
ResourceSkuSaveReqVO
createReqVO
)
{
// 插入
ResourceSkuDO
resourceSku
=
BeanUtils
.
toBean
(
createReqVO
,
ResourceSkuDO
.
class
);
resourceSkuMapper
.
insert
(
resourceSku
);
// 返回
return
resourceSku
.
getId
();
}
@Override
public
void
updateResourceSku
(
ResourceSkuSaveReqVO
updateReqVO
)
{
// 校验存在
validateResourceSkuExists
(
updateReqVO
.
getId
());
// 更新
ResourceSkuDO
updateObj
=
BeanUtils
.
toBean
(
updateReqVO
,
ResourceSkuDO
.
class
);
resourceSkuMapper
.
updateById
(
updateObj
);
}
@Override
public
void
deleteResourceSku
(
Long
id
)
{
// 校验存在
validateResourceSkuExists
(
id
);
// 删除
resourceSkuMapper
.
deleteById
(
id
);
}
@Override
public
void
deleteResourceSkuListByIds
(
List
<
Long
>
ids
)
{
// 删除
resourceSkuMapper
.
deleteByIds
(
ids
);
}
private
void
validateResourceSkuExists
(
Long
id
)
{
if
(
resourceSkuMapper
.
selectById
(
id
)
==
null
)
{
throw
exception
(
RESOURCE_SKU_NOT_EXISTS
);
}
}
@Override
public
ResourceSkuDO
getResourceSku
(
Long
id
)
{
return
resourceSkuMapper
.
selectById
(
id
);
}
@Override
public
PageResult
<
ResourceSkuDO
>
getResourceSkuPage
(
ResourceSkuPageReqVO
pageReqVO
)
{
return
resourceSkuMapper
.
selectPage
(
pageReqVO
);
}
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/service/resourcespu/ResourceSpuService.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
service
.
resourcespu
;
import
java.util.*
;
import
javax.validation.*
;
import
com.luhu.computility.module.compute.controller.admin.resourcespu.vo.*
;
import
com.luhu.computility.module.compute.dal.dataobject.resourcespu.ResourceSpuDO
;
import
com.luhu.computility.framework.common.pojo.PageResult
;
import
com.luhu.computility.framework.common.pojo.PageParam
;
/**
* 算力资源SPU表(基础配置信息) Service 接口
*
* @author 呼啦啦
*/
public
interface
ResourceSpuService
{
/**
* 创建算力资源SPU表(基础配置信息)
*
* @param createReqVO 创建信息
* @return 编号
*/
Long
createResourceSpu
(
@Valid
ResourceSpuSaveReqVO
createReqVO
);
/**
* 更新算力资源SPU表(基础配置信息)
*
* @param updateReqVO 更新信息
*/
void
updateResourceSpu
(
@Valid
ResourceSpuSaveReqVO
updateReqVO
);
/**
* 删除算力资源SPU表(基础配置信息)
*
* @param id 编号
*/
void
deleteResourceSpu
(
Long
id
);
/**
* 批量删除算力资源SPU表(基础配置信息)
*
* @param ids 编号
*/
void
deleteResourceSpuListByIds
(
List
<
Long
>
ids
);
/**
* 获得算力资源SPU表(基础配置信息)
*
* @param id 编号
* @return 算力资源SPU表(基础配置信息)
*/
ResourceSpuDO
getResourceSpu
(
Long
id
);
/**
* 获得算力资源SPU表(基础配置信息)分页
*
* @param pageReqVO 分页查询
* @return 算力资源SPU表(基础配置信息)分页
*/
PageResult
<
ResourceSpuDO
>
getResourceSpuPage
(
ResourceSpuPageReqVO
pageReqVO
);
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/java/com/luhu/computility/module/compute/service/resourcespu/ResourceSpuServiceImpl.java
0 → 100644
View file @
a26f8f6d
package
com
.
luhu
.
computility
.
module
.
compute
.
service
.
resourcespu
;
import
cn.hutool.core.collection.CollUtil
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.*
;
import
com.luhu.computility.module.compute.controller.admin.resourcespu.vo.*
;
import
com.luhu.computility.module.compute.dal.dataobject.resourcespu.ResourceSpuDO
;
import
com.luhu.computility.framework.common.pojo.PageResult
;
import
com.luhu.computility.framework.common.pojo.PageParam
;
import
com.luhu.computility.framework.common.util.object.BeanUtils
;
import
com.luhu.computility.module.compute.dal.mysql.resourcespu.ResourceSpuMapper
;
import
static
com
.
luhu
.
computility
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
import
static
com
.
luhu
.
computility
.
framework
.
common
.
util
.
collection
.
CollectionUtils
.
convertList
;
import
static
com
.
luhu
.
computility
.
framework
.
common
.
util
.
collection
.
CollectionUtils
.
diffList
;
import
static
com
.
luhu
.
computility
.
module
.
compute
.
enums
.
ErrorCodeConstants
.*;
/**
* 算力资源SPU表(基础配置信息) Service 实现类
*
* @author 呼啦啦
*/
@Service
@Validated
public
class
ResourceSpuServiceImpl
implements
ResourceSpuService
{
@Resource
private
ResourceSpuMapper
resourceSpuMapper
;
@Override
public
Long
createResourceSpu
(
ResourceSpuSaveReqVO
createReqVO
)
{
// 插入
ResourceSpuDO
resourceSpu
=
BeanUtils
.
toBean
(
createReqVO
,
ResourceSpuDO
.
class
);
resourceSpuMapper
.
insert
(
resourceSpu
);
// 返回
return
resourceSpu
.
getId
();
}
@Override
public
void
updateResourceSpu
(
ResourceSpuSaveReqVO
updateReqVO
)
{
// 校验存在
validateResourceSpuExists
(
updateReqVO
.
getId
());
// 更新
ResourceSpuDO
updateObj
=
BeanUtils
.
toBean
(
updateReqVO
,
ResourceSpuDO
.
class
);
resourceSpuMapper
.
updateById
(
updateObj
);
}
@Override
public
void
deleteResourceSpu
(
Long
id
)
{
// 校验存在
validateResourceSpuExists
(
id
);
// 删除
resourceSpuMapper
.
deleteById
(
id
);
}
@Override
public
void
deleteResourceSpuListByIds
(
List
<
Long
>
ids
)
{
// 删除
resourceSpuMapper
.
deleteByIds
(
ids
);
}
private
void
validateResourceSpuExists
(
Long
id
)
{
if
(
resourceSpuMapper
.
selectById
(
id
)
==
null
)
{
throw
exception
(
RESOURCE_SPU_NOT_EXISTS
);
}
}
@Override
public
ResourceSpuDO
getResourceSpu
(
Long
id
)
{
return
resourceSpuMapper
.
selectById
(
id
);
}
@Override
public
PageResult
<
ResourceSpuDO
>
getResourceSpuPage
(
ResourceSpuPageReqVO
pageReqVO
)
{
return
resourceSpuMapper
.
selectPage
(
pageReqVO
);
}
}
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/resources/mapper/resourcecategory/ResourceCategoryMapper.xml
0 → 100644
View file @
a26f8f6d
<?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.luhu.computility.module.compute.dal.mysql.resourcecategory.ResourceCategoryMapper"
>
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/resources/mapper/resourceorder/ResourceOrderMapper.xml
0 → 100644
View file @
a26f8f6d
<?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.luhu.computility.module.compute.dal.mysql.resourceorder.ResourceOrderMapper"
>
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/resources/mapper/resourcesku/ResourceSkuMapper.xml
0 → 100644
View file @
a26f8f6d
<?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.luhu.computility.module.compute.dal.mysql.resourcesku.ResourceSkuMapper"
>
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>
\ No newline at end of file
computility-module-compute/computility-module-compute-biz/src/main/resources/mapper/resourcespu/ResourceSpuMapper.xml
0 → 100644
View file @
a26f8f6d
<?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.luhu.computility.module.compute.dal.mysql.resourcespu.ResourceSpuMapper"
>
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>
\ No newline at end of file
computility-module-compute/pom.xml
0 → 100644
View file @
a26f8f6d
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
>
<parent>
<artifactId>
computility
</artifactId>
<groupId>
com.luhu
</groupId>
<version>
${revision}
</version>
</parent>
<modules>
<module>
computility-module-compute-api
</module>
<module>
computility-module-compute-biz
</module>
</modules>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
computility-module-compute
</artifactId>
<packaging>
pom
</packaging>
<name>
${project.artifactId}
</name>
<description>
算力资源
</description>
</project>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment