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
5d5c3614
authored
Aug 11, 2025
by
Jony.L
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
订单相关提交
parent
955b441b
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
1006 additions
and
51 deletions
+1006
-51
computility-framework/computility-common/src/main/java/com/luhu/computility/framework/common/enums/TradeOrderTypeEnum.java
+36
-0
computility-framework/computility-common/src/main/java/com/luhu/computility/framework/common/util/order/OrderNoUtil.java
+15
-0
computility-module-biz/src/main/java/com/luhu/computility/module/biz/controller/app/index/ApiController.java
+37
-29
computility-module-biz/src/main/java/com/luhu/computility/module/biz/controller/app/index/vo/BizOrderCreateReqVO.java
+13
-0
computility-module-biz/src/main/java/com/luhu/computility/module/biz/controller/app/index/vo/ResourcesDetailBackRespVO.java
+29
-0
computility-module-biz/src/main/java/com/luhu/computility/module/biz/controller/app/index/vo/ResourcesDetailRespVO.java
+19
-1
computility-module-biz/src/main/java/com/luhu/computility/module/biz/controller/app/order/OrderController.java
+107
-0
computility-module-biz/src/main/java/com/luhu/computility/module/biz/controller/app/order/vo/OrderPageReqVO.java
+90
-0
computility-module-biz/src/main/java/com/luhu/computility/module/biz/controller/app/order/vo/OrderRespVO.java
+113
-0
computility-module-biz/src/main/java/com/luhu/computility/module/biz/controller/app/order/vo/OrderSaveReqVO.java
+91
-0
computility-module-biz/src/main/java/com/luhu/computility/module/biz/dal/dataobject/order/OrderDO.java
+126
-0
computility-module-biz/src/main/java/com/luhu/computility/module/biz/dal/mysql/order/OrderMapper.java
+47
-0
computility-module-biz/src/main/java/com/luhu/computility/module/biz/enums/ErrorCodeConstants.java
+1
-0
computility-module-biz/src/main/java/com/luhu/computility/module/biz/service/order/OrderService.java
+65
-0
computility-module-biz/src/main/java/com/luhu/computility/module/biz/service/order/OrderServiceImpl.java
+108
-0
computility-module-biz/src/main/java/com/luhu/computility/module/biz/service/resources/ResourcesDetailService.java
+13
-0
computility-module-biz/src/main/java/com/luhu/computility/module/biz/service/resources/ResourcesDetailServiceImpl.java
+62
-0
computility-module-biz/src/main/resources/mapper/order/OrderMapper.xml
+13
-0
computility-module-mall/computility-module-product/src/main/java/com/luhu/computility/module/product/dal/dataobject/sku/ProductSkuDO.java
+2
-2
computility-module-pay/src/main/java/com/luhu/computility/module/pay/service/order/PayOrderServiceImpl.java
+19
-19
No files found.
computility-framework/computility-common/src/main/java/com/luhu/computility/framework/common/enums/TradeOrderTypeEnum.java
0 → 100644
View file @
5d5c3614
package
com
.
luhu
.
computility
.
framework
.
common
.
enums
;
/**
* @Author: jony
* @Date : 2025/8/10 14:40
* @VERSION v1.0
*/
import
lombok.Getter
;
/**
* 交易订单类型
*/
@Getter
public
enum
TradeOrderTypeEnum
{
TICKET_TRADE_ORDER
(
"TO"
,
"交易订单"
);
/**
* 类型
*/
private
final
String
code
;
/**
* 类型名
*/
private
final
String
info
;
TradeOrderTypeEnum
(
String
code
,
String
info
)
{
this
.
code
=
code
;
this
.
info
=
info
;
}
}
computility-framework/computility-common/src/main/java/com/luhu/computility/framework/common/util/order/OrderNoUtil.java
0 → 100644
View file @
5d5c3614
package
com
.
luhu
.
computility
.
framework
.
common
.
util
.
order
;
import
cn.hutool.core.date.DateUtil
;
import
com.luhu.computility.framework.common.enums.TradeOrderTypeEnum
;
/**
* @Author: jony
* @Date : 2025/8/10 14:39
* @VERSION v1.0
*/
public
class
OrderNoUtil
{
public
static
String
generateOrderNo
(
TradeOrderTypeEnum
orderType
)
{
return
orderType
.
getCode
()
+
DateUtil
.
format
(
DateUtil
.
date
(),
"yyyyMMddHHmmssSSS"
);
}
}
computility-module-biz/src/main/java/com/luhu/computility/module/biz/controller/app/index/ApiController.java
View file @
5d5c3614
...
@@ -10,13 +10,18 @@ import com.luhu.computility.framework.common.util.object.BeanUtils;
...
@@ -10,13 +10,18 @@ import com.luhu.computility.framework.common.util.object.BeanUtils;
import
com.luhu.computility.module.biz.controller.admin.bannerinfo.vo.BannerInfoPageReqVO
;
import
com.luhu.computility.module.biz.controller.admin.bannerinfo.vo.BannerInfoPageReqVO
;
import
com.luhu.computility.module.biz.controller.admin.bannerinfo.vo.BannerInfoRespVO
;
import
com.luhu.computility.module.biz.controller.admin.bannerinfo.vo.BannerInfoRespVO
;
import
com.luhu.computility.module.biz.controller.admin.computilityinformation.vo.ComputilityInformationRespVO
;
import
com.luhu.computility.module.biz.controller.admin.computilityinformation.vo.ComputilityInformationRespVO
;
import
com.luhu.computility.module.biz.controller.app.index.vo.ComputeRespVO
;
import
com.luhu.computility.module.biz.controller.app.index.vo.BizOrderCreateReqVO
;
import
com.luhu.computility.module.biz.controller.app.index.vo.ResourcesDetailRespVO
;
import
com.luhu.computility.module.biz.controller.client.dto.MenuDTO
;
import
com.luhu.computility.module.biz.controller.client.dto.MenuDTO
;
import
com.luhu.computility.module.biz.dal.dataobject.bannerinfo.BannerInfoDO
;
import
com.luhu.computility.module.biz.dal.dataobject.bannerinfo.BannerInfoDO
;
import
com.luhu.computility.module.biz.service.bannerinfo.BannerInfoService
;
import
com.luhu.computility.module.biz.service.bannerinfo.BannerInfoService
;
import
com.luhu.computility.module.biz.service.order.OrderService
;
import
com.luhu.computility.module.biz.service.resources.ResourcesDetailService
;
import
com.luhu.computility.module.product.dal.dataobject.category.ProductCategoryDO
;
import
com.luhu.computility.module.product.dal.dataobject.sku.ProductSkuDO
;
import
com.luhu.computility.module.product.dal.dataobject.sku.ProductSkuDO
;
import
com.luhu.computility.module.product.dal.dataobject.spu.ProductSpuDO
;
import
com.luhu.computility.module.product.dal.dataobject.spu.ProductSpuDO
;
import
com.luhu.computility.module.product.enums.spu.ProductSpuStatusEnum
;
import
com.luhu.computility.module.product.enums.spu.ProductSpuStatusEnum
;
import
com.luhu.computility.module.product.service.category.ProductCategoryService
;
import
com.luhu.computility.module.product.service.sku.ProductSkuService
;
import
com.luhu.computility.module.product.service.sku.ProductSkuService
;
import
com.luhu.computility.module.product.service.spu.ProductSpuService
;
import
com.luhu.computility.module.product.service.spu.ProductSpuService
;
import
com.luhu.computility.module.system.dal.dataobject.dict.DictDataDO
;
import
com.luhu.computility.module.system.dal.dataobject.dict.DictDataDO
;
...
@@ -72,6 +77,12 @@ public class ApiController {
...
@@ -72,6 +77,12 @@ public class ApiController {
private
ProductSpuService
productSpuService
;
private
ProductSpuService
productSpuService
;
@Resource
@Resource
private
ProductSkuService
productSkuService
;
private
ProductSkuService
productSkuService
;
@Resource
private
ProductCategoryService
productCategoryService
;
@Resource
private
OrderService
orderService
;
@Resource
private
ResourcesDetailService
resourcesDetailService
;
/*
/*
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
...
@@ -142,7 +153,7 @@ public class ApiController {
...
@@ -142,7 +153,7 @@ public class ApiController {
@GetMapping
(
value
=
"/computilityMenu"
)
@GetMapping
(
value
=
"/computilityMenu"
)
@ResponseBody
@ResponseBody
public
CommonResult
<
List
<
MenuDTO
>>
computilityMenu
()
{
public
CommonResult
<
List
<
MenuDTO
>>
computilityMenu
()
{
List
<
MenuDTO
>
menuDTOList
=
getMenus
(
"
application
_category"
);
List
<
MenuDTO
>
menuDTOList
=
getMenus
(
"
computility
_category"
);
return
success
(
menuDTOList
);
return
success
(
menuDTOList
);
}
}
...
@@ -163,7 +174,7 @@ public class ApiController {
...
@@ -163,7 +174,7 @@ public class ApiController {
*/
*/
@GetMapping
(
value
=
"/getRListByCategory"
)
@GetMapping
(
value
=
"/getRListByCategory"
)
@ResponseBody
@ResponseBody
public
CommonResult
<
List
<
Compute
RespVO
>>
getResourceListByCategory
(
@NotNull
(
message
=
"计算机资源编号不能为空"
)
Integer
categoryId
)
{
public
CommonResult
<
List
<
ResourcesDetail
RespVO
>>
getResourceListByCategory
(
@NotNull
(
message
=
"计算机资源编号不能为空"
)
Integer
categoryId
)
{
/**
/**
* 根据前段传的categoryId,去product_spu表查对应的多个spu
* 根据前段传的categoryId,去product_spu表查对应的多个spu
* 每个spu会有多个对应的sku,目前都要展示出来
* 每个spu会有多个对应的sku,目前都要展示出来
...
@@ -179,13 +190,13 @@ public class ApiController {
...
@@ -179,13 +190,13 @@ public class ApiController {
.
map
(
ProductSpuDO:
:
getId
)
.
map
(
ProductSpuDO:
:
getId
)
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
List
<
ProductSkuDO
>
skuDOList
=
productSkuService
.
getSkuListBySpuId
(
spuIdList
);
List
<
ProductSkuDO
>
skuDOList
=
productSkuService
.
getSkuListBySpuId
(
spuIdList
);
List
<
ComputeRespVO
>
computeRespVOS
=
new
ArrayList
<
ComputeRespVO
>();
List
<
ResourcesDetailRespVO
>
computeRespVOS
=
new
ArrayList
<
>();
for
(
ProductSkuDO
productSkuDO
:
skuDOList
)
{
//处理每个sku对应的cpu、gpu、内存、存储、时长等需要展示的字段
for
(
ProductSkuDO
productSkuDO
:
skuDOList
)
{
//处理每个sku对应的cpu、gpu、内存、存储、时长等需要展示的字段
List
<
ProductSkuDO
.
Property
>
properties
=
productSkuDO
.
getProperties
();
List
<
ProductSkuDO
.
Property
>
properties
=
productSkuDO
.
getProperties
();
String
spuName
=
productSpuService
.
getSpu
(
productSkuDO
.
getSpuId
()).
getName
();
//spuName实际上是每个服务器的名字
String
spuName
=
productSpuService
.
getSpu
(
productSkuDO
.
getSpuId
()).
getName
();
//spuName实际上是每个服务器的名字
ComputeRespVO
computeRespVO
=
new
Compute
RespVO
();
ResourcesDetailRespVO
computeRespVO
=
new
ResourcesDetail
RespVO
();
for
(
ProductSkuDO
.
Property
property
:
properties
)
{
for
(
ProductSkuDO
.
Property
property
:
properties
)
{
switch
(
Convert
.
toInt
(
property
.
getPropertyId
()))
{
switch
(
Convert
.
toInt
(
property
.
getPropertyId
()))
{
...
@@ -205,25 +216,31 @@ public class ApiController {
...
@@ -205,25 +216,31 @@ public class ApiController {
computeRespVO
.
setTerm
(
property
.
getValueName
());
computeRespVO
.
setTerm
(
property
.
getValueName
());
break
;
break
;
}
}
computeRespVO
.
setId
(
productSkuDO
.
getId
());
computeRespVO
.
setModel
(
spuName
);
computeRespVO
.
setModel
(
spuName
);
}
}
computeRespVO
.
setPublicPrice
(
String
.
format
(
"%.2f"
,
productSkuDO
.
getPrice
()/
100.0
));
computeRespVO
.
setPublicPrice
(
String
.
format
(
"%.2f"
,
productSkuDO
.
getPrice
()/
100.0
));
computeRespVOS
.
add
(
computeRespVO
);
computeRespVOS
.
add
(
computeRespVO
);
}
}
return
success
(
computeRespVOS
);
return
success
(
computeRespVOS
);
// startPage();
}
// BizComputility bizComputility = new BizComputility();
/**
// bizComputility.setCategory(nav);
* 订单 - 计算机资源详情
// Integer groundingStatus = Integer.valueOf(DictUtils.getDictValue("grounding_status", "已上架"));
*/
// bizComputility.setGroundingStatus(groundingStatus);
// @ApiOperation(value = "计算机资源 - 详情2",notes = "计算机资源详情2")
//
@GetMapping
(
value
=
"/getRDetail"
)
// List<BizComputility> bizComputilities = bizComputilityService.selectBizComputilityDetailList(bizComputility);
@ResponseBody
// List<BizResourceDetail> bizResourceDetails = new ArrayList<>();
public
CommonResult
<
ResourcesDetailRespVO
>
getResourceDetail
(
@Param
(
value
=
"id"
)
@NotNull
(
message
=
"计算机资源编号不能为空"
)
Long
id
){
// bizComputilities.forEach(item -> {
ProductSkuDO
skuDO
=
productSkuService
.
getSku
(
id
);
// BizResourceDetail bizResourceDetail = bizComputilityService.bizResourceDetail(item);
ResourcesDetailRespVO
resourcesDetailBySkuDO
=
resourcesDetailService
.
getResourcesDetailBySkuDO
(
skuDO
);
// bizResourceDetails.add(bizResourceDetail);
return
success
(
resourcesDetailBySkuDO
);
// });
}
// return getDataTable(bizResourceDetails,bizComputilities);
@PostMapping
(
value
=
"/bizOrderSubmit"
)
public
CommonResult
<
Long
>
bizOrderSubmit
(
BizOrderCreateReqVO
bizOrderCreateReqVO
){
Long
skuId
=
bizOrderCreateReqVO
.
getSkuId
();
orderService
.
bizOrderSubmit
(
skuId
);
return
null
;
}
}
// *//**
// *//**
// *行业应用二级菜单
// *行业应用二级菜单
...
@@ -311,6 +328,7 @@ public class ApiController {
...
@@ -311,6 +328,7 @@ public class ApiController {
// return R.ok(detail);
// return R.ok(detail);
// }else {
// }else {
// return R.fail("无法获取详情,请重试!");
// return R.fail("无法获取详情,请重试!");
// }
// }
// }
// }
//
//
...
@@ -364,19 +382,9 @@ public class ApiController {
...
@@ -364,19 +382,9 @@ public class ApiController {
// List<BizPartner> bizPartners = bizPartnerService.selectBizPartnerList(bizPartner);
// List<BizPartner> bizPartners = bizPartnerService.selectBizPartnerList(bizPartner);
// return R.ok(bizPartners);
// return R.ok(bizPartners);
// }
// }
//
//
// *//**
// * 订单 - 计算机资源详情
// *//*
// @ApiOperation(value = "计算机资源 - 详情2",notes = "计算机资源详情2")
// @GetMapping(value = "/getRDetail")
// @ResponseBody
// public R<BizResourceDetailRespVO> getResourceDetail(@Param(value = "id") @NotNull(message = "计算机资源编号不能为空") Long id){
// BizResourceDetailRespVO getResourceDetail = bizComputilityService.getResourceDetail(id);
// return R.ok(getResourceDetail);
// }
//
//
// *//**
// *//**
// * 订单-我的订单列表
// * 订单-我的订单列表
...
...
computility-module-biz/src/main/java/com/luhu/computility/module/biz/controller/app/index/vo/BizOrderCreateReqVO.java
0 → 100644
View file @
5d5c3614
package
com
.
luhu
.
computility
.
module
.
biz
.
controller
.
app
.
index
.
vo
;
import
lombok.Data
;
/**
* @Author: jony
* @Date : 2025/8/11 14:13
* @VERSION v1.0
*/
@Data
public
class
BizOrderCreateReqVO
{
private
Long
skuId
;
}
computility-module-biz/src/main/java/com/luhu/computility/module/biz/controller/app/index/vo/ResourcesDetailBackRespVO.java
0 → 100644
View file @
5d5c3614
package
com
.
luhu
.
computility
.
module
.
biz
.
controller
.
app
.
index
.
vo
;
import
lombok.Data
;
/**
* @Author: jony
* @Date : 2025/8/10 15:35
* @VERSION v1.0
*/
@Data
public
class
ResourcesDetailBackRespVO
{
private
Long
id
;
private
Long
category
;
private
String
model
;
private
Long
cpu
;
private
Long
gpu
;
private
Long
memory
;
private
Long
storage
;
private
Long
term
;
private
String
publicPrice
;
}
computility-module-biz/src/main/java/com/luhu/computility/module/biz/controller/app/index/vo/
Compute
RespVO.java
→
computility-module-biz/src/main/java/com/luhu/computility/module/biz/controller/app/index/vo/
ResourcesDetail
RespVO.java
View file @
5d5c3614
...
@@ -10,18 +10,36 @@ import lombok.Data;
...
@@ -10,18 +10,36 @@ import lombok.Data;
* @VERSION v1.0
* @VERSION v1.0
*/
*/
@Data
@Data
public
class
ComputeRespVO
{
public
class
ResourcesDetailRespVO
{
private
Long
id
;
//skuId
private
Integer
categoryId
;
private
String
category
;
private
Integer
modelId
;
private
String
model
;
private
String
model
;
private
Integer
cpuId
;
private
String
cpu
;
private
String
cpu
;
private
Integer
gpuId
;
private
String
gpu
;
private
String
gpu
;
private
Integer
memoryId
;
private
String
memory
;
private
String
memory
;
private
Integer
storageId
;
private
String
storage
;
private
String
storage
;
private
Integer
termId
;
private
String
term
;
private
String
term
;
private
String
publicPrice
;
private
String
publicPrice
;
...
...
computility-module-biz/src/main/java/com/luhu/computility/module/biz/controller/app/order/OrderController.java
0 → 100644
View file @
5d5c3614
package
com
.
luhu
.
computility
.
module
.
biz
.
controller
.
app
.
order
;
import
com.luhu.computility.module.biz.controller.app.order.vo.OrderPageReqVO
;
import
com.luhu.computility.module.biz.controller.app.order.vo.OrderRespVO
;
import
com.luhu.computility.module.biz.controller.app.order.vo.OrderSaveReqVO
;
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.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.biz.controller.app.order.vo.*
;
import
com.luhu.computility.module.biz.dal.dataobject.order.OrderDO
;
import
com.luhu.computility.module.biz.service.order.OrderService
;
@Tag
(
name
=
"管理后台 - 订单管理-需求单管理"
)
@RestController
@RequestMapping
(
"/biz/order"
)
@Validated
public
class
OrderController
{
@Resource
private
OrderService
orderService
;
@PostMapping
(
"/create"
)
@Operation
(
summary
=
"创建订单管理-需求单管理"
)
@PreAuthorize
(
"@ss.hasPermission('biz:order:create')"
)
public
CommonResult
<
Long
>
createOrder
(
@Valid
@RequestBody
OrderSaveReqVO
createReqVO
)
{
return
success
(
orderService
.
createOrder
(
createReqVO
));
}
@PutMapping
(
"/update"
)
@Operation
(
summary
=
"更新订单管理-需求单管理"
)
@PreAuthorize
(
"@ss.hasPermission('biz:order:update')"
)
public
CommonResult
<
Boolean
>
updateOrder
(
@Valid
@RequestBody
OrderSaveReqVO
updateReqVO
)
{
orderService
.
updateOrder
(
updateReqVO
);
return
success
(
true
);
}
@DeleteMapping
(
"/delete"
)
@Operation
(
summary
=
"删除订单管理-需求单管理"
)
@Parameter
(
name
=
"id"
,
description
=
"编号"
,
required
=
true
)
@PreAuthorize
(
"@ss.hasPermission('biz:order:delete')"
)
public
CommonResult
<
Boolean
>
deleteOrder
(
@RequestParam
(
"id"
)
Long
id
)
{
orderService
.
deleteOrder
(
id
);
return
success
(
true
);
}
@DeleteMapping
(
"/delete-list"
)
@Parameter
(
name
=
"ids"
,
description
=
"编号"
,
required
=
true
)
@Operation
(
summary
=
"批量删除订单管理-需求单管理"
)
@PreAuthorize
(
"@ss.hasPermission('biz:order:delete')"
)
public
CommonResult
<
Boolean
>
deleteOrderList
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
orderService
.
deleteOrderListByIds
(
ids
);
return
success
(
true
);
}
@GetMapping
(
"/get"
)
@Operation
(
summary
=
"获得订单管理-需求单管理"
)
@Parameter
(
name
=
"id"
,
description
=
"编号"
,
required
=
true
,
example
=
"1024"
)
@PreAuthorize
(
"@ss.hasPermission('biz:order:query')"
)
public
CommonResult
<
OrderRespVO
>
getOrder
(
@RequestParam
(
"id"
)
Long
id
)
{
OrderDO
order
=
orderService
.
getOrder
(
id
);
return
success
(
BeanUtils
.
toBean
(
order
,
OrderRespVO
.
class
));
}
@GetMapping
(
"/page"
)
@Operation
(
summary
=
"获得订单管理-需求单管理分页"
)
@PreAuthorize
(
"@ss.hasPermission('biz:order:query')"
)
public
CommonResult
<
PageResult
<
OrderRespVO
>>
getOrderPage
(
@Valid
OrderPageReqVO
pageReqVO
)
{
PageResult
<
OrderDO
>
pageResult
=
orderService
.
getOrderPage
(
pageReqVO
);
return
success
(
BeanUtils
.
toBean
(
pageResult
,
OrderRespVO
.
class
));
}
@GetMapping
(
"/export-excel"
)
@Operation
(
summary
=
"导出订单管理-需求单管理 Excel"
)
@PreAuthorize
(
"@ss.hasPermission('biz:order:export')"
)
@ApiAccessLog
(
operateType
=
EXPORT
)
public
void
exportOrderExcel
(
@Valid
OrderPageReqVO
pageReqVO
,
HttpServletResponse
response
)
throws
IOException
{
pageReqVO
.
setPageSize
(
PageParam
.
PAGE_SIZE_NONE
);
List
<
OrderDO
>
list
=
orderService
.
getOrderPage
(
pageReqVO
).
getList
();
// 导出 Excel
ExcelUtils
.
write
(
response
,
"订单管理-需求单管理.xls"
,
"数据"
,
OrderRespVO
.
class
,
BeanUtils
.
toBean
(
list
,
OrderRespVO
.
class
));
}
}
\ No newline at end of file
computility-module-biz/src/main/java/com/luhu/computility/module/biz/controller/app/order/vo/OrderPageReqVO.java
0 → 100644
View file @
5d5c3614
package
com
.
luhu
.
computility
.
module
.
biz
.
controller
.
app
.
order
.
vo
;
import
lombok.*
;
import
java.util.*
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
com.luhu.computility.framework.common.pojo.PageParam
;
import
java.math.BigDecimal
;
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
OrderPageReqVO
extends
PageParam
{
@Schema
(
description
=
"订单编号"
)
private
String
orderNo
;
@Schema
(
description
=
"商品类别"
)
private
Boolean
category
;
@Schema
(
description
=
"型号"
)
private
Boolean
model
;
@Schema
(
description
=
"CPU"
)
private
Boolean
cpu
;
@Schema
(
description
=
"GPU"
)
private
Boolean
gpu
;
@Schema
(
description
=
"内存"
)
private
Boolean
memory
;
@Schema
(
description
=
"存储硬盘"
)
private
Boolean
storage
;
@Schema
(
description
=
"算力金额"
,
example
=
"26427"
)
private
BigDecimal
price
;
@Schema
(
description
=
"状态:0-已确认,1-审核中,2-已驳回,3-已取消"
,
example
=
"2"
)
private
Boolean
orderStatus
;
@Schema
(
description
=
"网络带宽(M)"
,
example
=
"183"
)
private
Long
networkId
;
@Schema
(
description
=
"额外IP数量(个)"
)
private
Integer
ipNum
;
@Schema
(
description
=
"虚拟机存储(TB)"
)
private
Integer
vmStorage
;
@Schema
(
description
=
"申请时间"
)
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
private
LocalDateTime
[]
submitTime
;
@Schema
(
description
=
"应用人(购买人)"
)
private
Long
applyUser
;
@Schema
(
description
=
"支付状态 0 已支付 1未支付"
,
example
=
"2"
)
private
Boolean
payStatus
;
@Schema
(
description
=
"使用数量"
)
private
Integer
useNum
;
@Schema
(
description
=
"使用期限(年)"
)
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
private
String
[]
useTime
;
@Schema
(
description
=
"创建时间"
)
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
private
LocalDateTime
[]
createTime
;
@Schema
(
description
=
"备注"
,
example
=
"你说的对"
)
private
String
remark
;
@Schema
(
description
=
"对外总金额"
,
example
=
"18381"
)
private
BigDecimal
publicTotalPrice
;
@Schema
(
description
=
"对内总金额"
,
example
=
"1454"
)
private
BigDecimal
innerTotalPrice
;
@Schema
(
description
=
"参数字符串"
)
private
String
param
;
@Schema
(
description
=
"销售价格"
,
example
=
"11011"
)
private
BigDecimal
salesPrice
;
}
\ No newline at end of file
computility-module-biz/src/main/java/com/luhu/computility/module/biz/controller/app/order/vo/OrderRespVO.java
0 → 100644
View file @
5d5c3614
package
com
.
luhu
.
computility
.
module
.
biz
.
controller
.
app
.
order
.
vo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.*
;
import
java.util.*
;
import
java.math.BigDecimal
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.time.LocalDateTime
;
import
com.alibaba.excel.annotation.*
;
@Schema
(
description
=
"管理后台 - 订单管理-需求单管理 Response VO"
)
@Data
@ExcelIgnoreUnannotated
public
class
OrderRespVO
{
@Schema
(
description
=
"主键"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"31971"
)
@ExcelProperty
(
"主键"
)
private
Long
id
;
@Schema
(
description
=
"订单编号"
)
@ExcelProperty
(
"订单编号"
)
private
String
orderNo
;
@Schema
(
description
=
"商品类别"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@ExcelProperty
(
"商品类别"
)
private
Boolean
category
;
@Schema
(
description
=
"型号"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@ExcelProperty
(
"型号"
)
private
Boolean
model
;
@Schema
(
description
=
"CPU"
)
@ExcelProperty
(
"CPU"
)
private
Boolean
cpu
;
@Schema
(
description
=
"GPU"
)
@ExcelProperty
(
"GPU"
)
private
Boolean
gpu
;
@Schema
(
description
=
"内存"
)
@ExcelProperty
(
"内存"
)
private
Boolean
memory
;
@Schema
(
description
=
"存储硬盘"
)
@ExcelProperty
(
"存储硬盘"
)
private
Boolean
storage
;
@Schema
(
description
=
"算力金额"
,
example
=
"26427"
)
@ExcelProperty
(
"算力金额"
)
private
BigDecimal
price
;
@Schema
(
description
=
"状态:0-已确认,1-审核中,2-已驳回,3-已取消"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"2"
)
@ExcelProperty
(
"状态:0-已确认,1-审核中,2-已驳回,3-已取消"
)
private
Boolean
orderStatus
;
@Schema
(
description
=
"网络带宽(M)"
,
example
=
"183"
)
@ExcelProperty
(
"网络带宽(M)"
)
private
Long
networkId
;
@Schema
(
description
=
"额外IP数量(个)"
)
@ExcelProperty
(
"额外IP数量(个)"
)
private
Integer
ipNum
;
@Schema
(
description
=
"虚拟机存储(TB)"
)
@ExcelProperty
(
"虚拟机存储(TB)"
)
private
Integer
vmStorage
;
@Schema
(
description
=
"申请时间"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@ExcelProperty
(
"申请时间"
)
private
LocalDateTime
submitTime
;
@Schema
(
description
=
"应用人(购买人)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@ExcelProperty
(
"应用人(购买人)"
)
private
Long
applyUser
;
@Schema
(
description
=
"支付状态 0 已支付 1未支付"
,
example
=
"2"
)
@ExcelProperty
(
"支付状态 0 已支付 1未支付"
)
private
Boolean
payStatus
;
@Schema
(
description
=
"使用数量"
)
@ExcelProperty
(
"使用数量"
)
private
Integer
useNum
;
@Schema
(
description
=
"使用期限(年)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@ExcelProperty
(
"使用期限(年)"
)
private
String
useTime
;
@Schema
(
description
=
"创建时间"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@ExcelProperty
(
"创建时间"
)
private
LocalDateTime
createTime
;
@Schema
(
description
=
"备注"
,
example
=
"你说的对"
)
@ExcelProperty
(
"备注"
)
private
String
remark
;
@Schema
(
description
=
"对外总金额"
,
example
=
"18381"
)
@ExcelProperty
(
"对外总金额"
)
private
BigDecimal
publicTotalPrice
;
@Schema
(
description
=
"对内总金额"
,
example
=
"1454"
)
@ExcelProperty
(
"对内总金额"
)
private
BigDecimal
innerTotalPrice
;
@Schema
(
description
=
"参数字符串"
)
@ExcelProperty
(
"参数字符串"
)
private
String
param
;
@Schema
(
description
=
"销售价格"
,
example
=
"11011"
)
@ExcelProperty
(
"销售价格"
)
private
BigDecimal
salesPrice
;
}
\ No newline at end of file
computility-module-biz/src/main/java/com/luhu/computility/module/biz/controller/app/order/vo/OrderSaveReqVO.java
0 → 100644
View file @
5d5c3614
package
com
.
luhu
.
computility
.
module
.
biz
.
controller
.
app
.
order
.
vo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.*
;
import
java.util.*
;
import
javax.validation.constraints.*
;
import
java.math.BigDecimal
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.time.LocalDateTime
;
@Schema
(
description
=
"管理后台 - 订单管理-需求单管理新增/修改 Request VO"
)
@Data
public
class
OrderSaveReqVO
{
@Schema
(
description
=
"主键"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"31971"
)
private
Long
id
;
@Schema
(
description
=
"订单编号"
)
private
String
orderNo
;
@Schema
(
description
=
"商品类别"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@NotNull
(
message
=
"商品类别不能为空"
)
private
Integer
category
;
@Schema
(
description
=
"型号"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@NotNull
(
message
=
"型号不能为空"
)
private
Long
model
;
@Schema
(
description
=
"CPU"
)
private
Integer
cpu
;
@Schema
(
description
=
"GPU"
)
private
Integer
gpu
;
@Schema
(
description
=
"内存"
)
private
Integer
memory
;
@Schema
(
description
=
"存储硬盘"
)
private
Integer
storage
;
@Schema
(
description
=
"算力金额"
,
example
=
"26427"
)
private
BigDecimal
price
;
@Schema
(
description
=
"状态:0-已确认,1-审核中,2-已驳回,3-已取消"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"2"
)
@NotNull
(
message
=
"状态:0-已确认,1-审核中,2-已驳回,3-已取消不能为空"
)
private
Boolean
orderStatus
;
@Schema
(
description
=
"网络带宽(M)"
,
example
=
"183"
)
private
Long
networkId
;
@Schema
(
description
=
"额外IP数量(个)"
)
private
Integer
ipNum
;
@Schema
(
description
=
"虚拟机存储(TB)"
)
private
Integer
vmStorage
;
@Schema
(
description
=
"申请时间"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@NotNull
(
message
=
"申请时间不能为空"
)
private
LocalDateTime
submitTime
;
@Schema
(
description
=
"应用人(购买人)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@NotNull
(
message
=
"应用人(购买人)不能为空"
)
private
Long
applyUser
;
@Schema
(
description
=
"支付状态 0 已支付 1未支付"
,
example
=
"2"
)
private
Boolean
payStatus
;
@Schema
(
description
=
"使用数量"
)
private
Integer
useNum
;
@Schema
(
description
=
"使用期限(年)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@NotEmpty
(
message
=
"使用期限(年)不能为空"
)
private
String
useTime
;
@Schema
(
description
=
"备注"
,
example
=
"你说的对"
)
private
String
remark
;
@Schema
(
description
=
"对外总金额"
,
example
=
"18381"
)
private
BigDecimal
publicTotalPrice
;
@Schema
(
description
=
"对内总金额"
,
example
=
"1454"
)
private
BigDecimal
innerTotalPrice
;
@Schema
(
description
=
"参数字符串"
)
private
String
param
;
@Schema
(
description
=
"销售价格"
,
example
=
"11011"
)
private
BigDecimal
salesPrice
;
}
\ No newline at end of file
computility-module-biz/src/main/java/com/luhu/computility/module/biz/dal/dataobject/order/OrderDO.java
0 → 100644
View file @
5d5c3614
package
com
.
luhu
.
computility
.
module
.
biz
.
dal
.
dataobject
.
order
;
import
lombok.*
;
import
java.util.*
;
import
java.math.BigDecimal
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
com.baomidou.mybatisplus.annotation.*
;
import
com.luhu.computility.framework.mybatis.core.dataobject.BaseDO
;
/**
* 订单管理-需求单管理 DO
*
* @author 测试号02
*/
@TableName
(
"biz_order"
)
@KeySequence
(
"biz_order_seq"
)
// 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ToString
(
callSuper
=
true
)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
OrderDO
extends
BaseDO
{
/**
* 主键
*/
@TableId
private
Long
id
;
/**
* 订单编号
*/
private
String
orderNo
;
/**
* 商品类别
*/
private
Integer
category
;
/**
* 型号
*/
private
Boolean
model
;
/**
* CPU
*/
private
Integer
cpu
;
/**
* GPU
*/
private
Boolean
gpu
;
/**
* 内存
*/
private
Boolean
memory
;
/**
* 存储硬盘
*/
private
Boolean
storage
;
/**
* 算力金额
*/
private
BigDecimal
price
;
/**
* 状态:0-已确认,1-审核中,2-已驳回,3-已取消
*/
private
Boolean
orderStatus
;
/**
* 网络带宽(M)
*/
private
Long
networkId
;
/**
* 额外IP数量(个)
*/
private
Integer
ipNum
;
/**
* 虚拟机存储(TB)
*/
private
Integer
vmStorage
;
/**
* 申请时间
*/
private
LocalDateTime
submitTime
;
/**
* 应用人(购买人)
*/
private
Long
applyUser
;
/**
* 支付状态 0 已支付 1未支付
*/
private
Boolean
payStatus
;
/**
* 使用数量
*/
private
Integer
useNum
;
/**
* 使用期限(年)
*/
private
String
useTime
;
/**
* 备注
*/
private
String
remark
;
/**
* 对外总金额
*/
private
BigDecimal
publicTotalPrice
;
/**
* 对内总金额
*/
private
BigDecimal
innerTotalPrice
;
/**
* 参数字符串
*/
private
String
param
;
/**
* 销售价格
*/
private
BigDecimal
salesPrice
;
}
\ No newline at end of file
computility-module-biz/src/main/java/com/luhu/computility/module/biz/dal/mysql/order/OrderMapper.java
0 → 100644
View file @
5d5c3614
package
com
.
luhu
.
computility
.
module
.
biz
.
dal
.
mysql
.
order
;
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.biz.controller.app.order.vo.OrderPageReqVO
;
import
com.luhu.computility.module.biz.dal.dataobject.order.OrderDO
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* 订单管理-需求单管理 Mapper
*
* @author 测试号02
*/
@Mapper
public
interface
OrderMapper
extends
BaseMapperX
<
OrderDO
>
{
default
PageResult
<
OrderDO
>
selectPage
(
OrderPageReqVO
reqVO
)
{
return
selectPage
(
reqVO
,
new
LambdaQueryWrapperX
<
OrderDO
>()
.
eqIfPresent
(
OrderDO:
:
getOrderNo
,
reqVO
.
getOrderNo
())
.
eqIfPresent
(
OrderDO:
:
getCategory
,
reqVO
.
getCategory
())
.
eqIfPresent
(
OrderDO:
:
getModel
,
reqVO
.
getModel
())
.
eqIfPresent
(
OrderDO:
:
getCpu
,
reqVO
.
getCpu
())
.
eqIfPresent
(
OrderDO:
:
getGpu
,
reqVO
.
getGpu
())
.
eqIfPresent
(
OrderDO:
:
getMemory
,
reqVO
.
getMemory
())
.
eqIfPresent
(
OrderDO:
:
getStorage
,
reqVO
.
getStorage
())
.
eqIfPresent
(
OrderDO:
:
getPrice
,
reqVO
.
getPrice
())
.
eqIfPresent
(
OrderDO:
:
getOrderStatus
,
reqVO
.
getOrderStatus
())
.
eqIfPresent
(
OrderDO:
:
getNetworkId
,
reqVO
.
getNetworkId
())
.
eqIfPresent
(
OrderDO:
:
getIpNum
,
reqVO
.
getIpNum
())
.
eqIfPresent
(
OrderDO:
:
getVmStorage
,
reqVO
.
getVmStorage
())
.
betweenIfPresent
(
OrderDO:
:
getSubmitTime
,
reqVO
.
getSubmitTime
())
.
eqIfPresent
(
OrderDO:
:
getApplyUser
,
reqVO
.
getApplyUser
())
.
eqIfPresent
(
OrderDO:
:
getPayStatus
,
reqVO
.
getPayStatus
())
.
eqIfPresent
(
OrderDO:
:
getUseNum
,
reqVO
.
getUseNum
())
.
betweenIfPresent
(
OrderDO:
:
getUseTime
,
reqVO
.
getUseTime
())
.
betweenIfPresent
(
OrderDO:
:
getCreateTime
,
reqVO
.
getCreateTime
())
.
eqIfPresent
(
OrderDO:
:
getRemark
,
reqVO
.
getRemark
())
.
eqIfPresent
(
OrderDO:
:
getPublicTotalPrice
,
reqVO
.
getPublicTotalPrice
())
.
eqIfPresent
(
OrderDO:
:
getInnerTotalPrice
,
reqVO
.
getInnerTotalPrice
())
.
eqIfPresent
(
OrderDO:
:
getParam
,
reqVO
.
getParam
())
.
eqIfPresent
(
OrderDO:
:
getSalesPrice
,
reqVO
.
getSalesPrice
())
.
orderByDesc
(
OrderDO:
:
getId
));
}
}
\ No newline at end of file
computility-module-biz/src/main/java/com/luhu/computility/module/biz/enums/ErrorCodeConstants.java
View file @
5d5c3614
...
@@ -18,5 +18,6 @@ public interface ErrorCodeConstants {
...
@@ -18,5 +18,6 @@ public interface ErrorCodeConstants {
ErrorCode
INFORMATION_NOT_EXISTS
=
new
ErrorCode
(
1_040_014_000
,
"活动资讯管理不存在"
);
ErrorCode
INFORMATION_NOT_EXISTS
=
new
ErrorCode
(
1_040_014_000
,
"活动资讯管理不存在"
);
ErrorCode
ORDER_NOT_EXISTS
=
new
ErrorCode
(
1_040_015_000
,
"订单管理-需求单管理不存在"
);
}
}
computility-module-biz/src/main/java/com/luhu/computility/module/biz/service/order/OrderService.java
0 → 100644
View file @
5d5c3614
package
com
.
luhu
.
computility
.
module
.
biz
.
service
.
order
;
import
java.util.*
;
import
javax.validation.*
;
import
com.luhu.computility.module.biz.controller.app.order.vo.OrderPageReqVO
;
import
com.luhu.computility.module.biz.controller.app.order.vo.OrderSaveReqVO
;
import
com.luhu.computility.module.biz.dal.dataobject.order.OrderDO
;
import
com.luhu.computility.framework.common.pojo.PageResult
;
/**
* 订单管理-需求单管理 Service 接口
*
* @author 测试号02
*/
public
interface
OrderService
{
void
bizOrderSubmit
(
Long
skuId
);
/**
* 创建订单管理-需求单管理
*
* @param createReqVO 创建信息
* @return 编号
*/
Long
createOrder
(
@Valid
OrderSaveReqVO
createReqVO
);
/**
* 更新订单管理-需求单管理
*
* @param updateReqVO 更新信息
*/
void
updateOrder
(
@Valid
OrderSaveReqVO
updateReqVO
);
/**
* 删除订单管理-需求单管理
*
* @param id 编号
*/
void
deleteOrder
(
Long
id
);
/**
* 批量删除订单管理-需求单管理
*
* @param ids 编号
*/
void
deleteOrderListByIds
(
List
<
Long
>
ids
);
/**
* 获得订单管理-需求单管理
*
* @param id 编号
* @return 订单管理-需求单管理
*/
OrderDO
getOrder
(
Long
id
);
/**
* 获得订单管理-需求单管理分页
*
* @param pageReqVO 分页查询
* @return 订单管理-需求单管理分页
*/
PageResult
<
OrderDO
>
getOrderPage
(
OrderPageReqVO
pageReqVO
);
}
\ No newline at end of file
computility-module-biz/src/main/java/com/luhu/computility/module/biz/service/order/OrderServiceImpl.java
0 → 100644
View file @
5d5c3614
package
com
.
luhu
.
computility
.
module
.
biz
.
service
.
order
;
import
com.luhu.computility.framework.common.enums.TradeOrderTypeEnum
;
import
com.luhu.computility.framework.common.util.order.OrderNoUtil
;
import
com.luhu.computility.module.biz.controller.app.index.vo.ResourcesDetailRespVO
;
import
com.luhu.computility.module.biz.controller.app.order.vo.OrderPageReqVO
;
import
com.luhu.computility.module.biz.controller.app.order.vo.OrderSaveReqVO
;
import
com.luhu.computility.module.biz.service.resources.ResourcesDetailService
;
import
com.luhu.computility.module.product.dal.dataobject.sku.ProductSkuDO
;
import
com.luhu.computility.module.product.dal.mysql.sku.ProductSkuMapper
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
org.springframework.validation.annotation.Validated
;
import
java.util.*
;
import
com.luhu.computility.module.biz.dal.dataobject.order.OrderDO
;
import
com.luhu.computility.framework.common.pojo.PageResult
;
import
com.luhu.computility.framework.common.util.object.BeanUtils
;
import
com.luhu.computility.module.biz.dal.mysql.order.OrderMapper
;
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
.
module
.
biz
.
enums
.
ErrorCodeConstants
.*;
/**
* 订单管理-需求单管理 Service 实现类
*
* @author 测试号02
*/
@Service
@Validated
public
class
OrderServiceImpl
implements
OrderService
{
@Resource
private
OrderMapper
orderMapper
;
@Resource
private
ProductSkuMapper
productSkuMapper
;
@Resource
private
ResourcesDetailService
resourcesDetailService
;
@Override
public
void
bizOrderSubmit
(
Long
skuId
)
{
ProductSkuDO
skuDo
=
productSkuMapper
.
selectById
(
skuId
);
ResourcesDetailRespVO
resourcesDetailRespVO
=
resourcesDetailService
.
getResourcesDetailBySkuDO
(
skuDo
);
OrderSaveReqVO
orderSaveReqVO
=
new
OrderSaveReqVO
();
orderSaveReqVO
.
setOrderNo
(
OrderNoUtil
.
generateOrderNo
(
TradeOrderTypeEnum
.
TICKET_TRADE_ORDER
));
orderSaveReqVO
.
setGpu
(
resourcesDetailRespVO
.
getGpuId
());
orderSaveReqVO
.
setCpu
(
resourcesDetailRespVO
.
getCpuId
());
orderSaveReqVO
.
setMemory
(
resourcesDetailRespVO
.
getMemoryId
());
orderSaveReqVO
.
setStorage
(
resourcesDetailRespVO
.
getStorageId
());
}
@Override
public
Long
createOrder
(
OrderSaveReqVO
createReqVO
)
{
// 插入
OrderDO
order
=
BeanUtils
.
toBean
(
createReqVO
,
OrderDO
.
class
);
orderMapper
.
insert
(
order
);
// 返回
return
order
.
getId
();
}
@Override
public
void
updateOrder
(
OrderSaveReqVO
updateReqVO
)
{
// 校验存在
validateOrderExists
(
updateReqVO
.
getId
());
// 更新
OrderDO
updateObj
=
BeanUtils
.
toBean
(
updateReqVO
,
OrderDO
.
class
);
orderMapper
.
updateById
(
updateObj
);
}
@Override
public
void
deleteOrder
(
Long
id
)
{
// 校验存在
validateOrderExists
(
id
);
// 删除
orderMapper
.
deleteById
(
id
);
}
@Override
public
void
deleteOrderListByIds
(
List
<
Long
>
ids
)
{
// 删除
orderMapper
.
deleteByIds
(
ids
);
}
private
void
validateOrderExists
(
Long
id
)
{
if
(
orderMapper
.
selectById
(
id
)
==
null
)
{
throw
exception
(
ORDER_NOT_EXISTS
);
}
}
@Override
public
OrderDO
getOrder
(
Long
id
)
{
return
orderMapper
.
selectById
(
id
);
}
@Override
public
PageResult
<
OrderDO
>
getOrderPage
(
OrderPageReqVO
pageReqVO
)
{
return
orderMapper
.
selectPage
(
pageReqVO
);
}
}
\ No newline at end of file
computility-module-biz/src/main/java/com/luhu/computility/module/biz/service/resources/ResourcesDetailService.java
0 → 100644
View file @
5d5c3614
package
com
.
luhu
.
computility
.
module
.
biz
.
service
.
resources
;
import
com.luhu.computility.module.biz.controller.app.index.vo.ResourcesDetailRespVO
;
import
com.luhu.computility.module.product.dal.dataobject.sku.ProductSkuDO
;
/**
* @Author: jony
* @Date : 2025/8/11 15:09
* @VERSION v1.0
*/
public
interface
ResourcesDetailService
{
ResourcesDetailRespVO
getResourcesDetailBySkuDO
(
ProductSkuDO
skuDO
);
}
computility-module-biz/src/main/java/com/luhu/computility/module/biz/service/resources/ResourcesDetailServiceImpl.java
0 → 100644
View file @
5d5c3614
package
com
.
luhu
.
computility
.
module
.
biz
.
service
.
resources
;
import
cn.hutool.core.convert.Convert
;
import
com.luhu.computility.module.biz.controller.app.index.vo.ResourcesDetailRespVO
;
import
com.luhu.computility.module.product.dal.dataobject.sku.ProductSkuDO
;
import
com.luhu.computility.module.product.dal.dataobject.spu.ProductSpuDO
;
import
com.luhu.computility.module.product.dal.mysql.category.ProductCategoryMapper
;
import
com.luhu.computility.module.product.dal.mysql.spu.ProductSpuMapper
;
import
com.luhu.computility.module.product.service.category.ProductCategoryService
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
* @Author: jony
* @Date : 2025/8/11 15:09
* @VERSION v1.0
*/
@Service
public
class
ResourcesDetailServiceImpl
implements
ResourcesDetailService
{
@Resource
ProductSpuMapper
productSpuMapper
;
@Resource
ProductCategoryMapper
productCategoryMapper
;
@Override
public
ResourcesDetailRespVO
getResourcesDetailBySkuDO
(
ProductSkuDO
skuDO
)
{
ResourcesDetailRespVO
resourcesDetailRespVO
=
new
ResourcesDetailRespVO
();
List
<
ProductSkuDO
.
Property
>
properties
=
skuDO
.
getProperties
();
ProductSpuDO
spuDo
=
productSpuMapper
.
selectById
(
skuDO
.
getSpuId
());
resourcesDetailRespVO
.
setCategory
(
productCategoryMapper
.
selectById
(
spuDo
.
getCategoryId
()).
getName
());
resourcesDetailRespVO
.
setModel
(
spuDo
.
getName
());
//spuName实际上是每个服务器的名字
resourcesDetailRespVO
.
setPublicPrice
(
String
.
format
(
"%.2f"
,
skuDO
.
getPrice
()/
100.0
));
for
(
ProductSkuDO
.
Property
property
:
properties
)
{
switch
(
Convert
.
toInt
(
property
.
getPropertyId
()))
{
case
18
:
resourcesDetailRespVO
.
setCpuId
(
property
.
getValueId
());
resourcesDetailRespVO
.
setCpu
(
property
.
getValueName
());
break
;
case
19
:
resourcesDetailRespVO
.
setGpuId
(
property
.
getValueId
());
resourcesDetailRespVO
.
setGpu
(
property
.
getValueName
());
break
;
case
20
:
resourcesDetailRespVO
.
setMemoryId
(
property
.
getValueId
());
resourcesDetailRespVO
.
setMemory
(
property
.
getValueName
());
break
;
case
21
:
resourcesDetailRespVO
.
setStorageId
(
property
.
getValueId
());
resourcesDetailRespVO
.
setStorage
(
property
.
getValueName
());
break
;
case
22
:
resourcesDetailRespVO
.
setTermId
(
property
.
getValueId
());
resourcesDetailRespVO
.
setTerm
(
property
.
getValueName
());
break
;
}
resourcesDetailRespVO
.
setId
(
skuDO
.
getId
());
}
return
resourcesDetailRespVO
;
}
}
computility-module-biz/src/main/resources/mapper/order/OrderMapper.xml
0 → 100644
View file @
5d5c3614
<?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.biz.dal.mysql.order.OrderMapper"
>
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>
\ No newline at end of file
computility-module-mall/computility-module-product/src/main/java/com/luhu/computility/module/product/dal/dataobject/sku/ProductSkuDO.java
View file @
5d5c3614
...
@@ -106,7 +106,7 @@ public class ProductSkuDO extends BaseDO {
...
@@ -106,7 +106,7 @@ public class ProductSkuDO extends BaseDO {
* 属性编号
* 属性编号
* 关联 {@link ProductPropertyDO#getId()}
* 关联 {@link ProductPropertyDO#getId()}
*/
*/
private
Long
propertyId
;
private
Integer
propertyId
;
/**
/**
* 属性名字
* 属性名字
* 冗余 {@link ProductPropertyDO#getName()}
* 冗余 {@link ProductPropertyDO#getName()}
...
@@ -119,7 +119,7 @@ public class ProductSkuDO extends BaseDO {
...
@@ -119,7 +119,7 @@ public class ProductSkuDO extends BaseDO {
* 属性值编号
* 属性值编号
* 关联 {@link ProductPropertyValueDO#getId()}
* 关联 {@link ProductPropertyValueDO#getId()}
*/
*/
private
Long
valueId
;
private
Integer
valueId
;
/**
/**
* 属性值名字
* 属性值名字
* 冗余 {@link ProductPropertyValueDO#getName()}
* 冗余 {@link ProductPropertyValueDO#getName()}
...
...
computility-module-pay/src/main/java/com/luhu/computility/module/pay/service/order/PayOrderServiceImpl.java
View file @
5d5c3614
...
@@ -61,7 +61,7 @@ public class PayOrderServiceImpl implements PayOrderService {
...
@@ -61,7 +61,7 @@ public class PayOrderServiceImpl implements PayOrderService {
private
PayProperties
payProperties
;
private
PayProperties
payProperties
;
@Resource
@Resource
private
PayOrderMapper
o
rderMapper
;
private
PayOrderMapper
payO
rderMapper
;
@Resource
@Resource
private
PayOrderExtensionMapper
orderExtensionMapper
;
private
PayOrderExtensionMapper
orderExtensionMapper
;
@Resource
@Resource
...
@@ -76,12 +76,12 @@ public class PayOrderServiceImpl implements PayOrderService {
...
@@ -76,12 +76,12 @@ public class PayOrderServiceImpl implements PayOrderService {
@Override
@Override
public
PayOrderDO
getOrder
(
Long
id
)
{
public
PayOrderDO
getOrder
(
Long
id
)
{
return
o
rderMapper
.
selectById
(
id
);
return
payO
rderMapper
.
selectById
(
id
);
}
}
@Override
@Override
public
PayOrderDO
getOrder
(
Long
appId
,
String
merchantOrderId
)
{
public
PayOrderDO
getOrder
(
Long
appId
,
String
merchantOrderId
)
{
return
o
rderMapper
.
selectByAppIdAndMerchantOrderId
(
appId
,
merchantOrderId
);
return
payO
rderMapper
.
selectByAppIdAndMerchantOrderId
(
appId
,
merchantOrderId
);
}
}
@Override
@Override
...
@@ -89,22 +89,22 @@ public class PayOrderServiceImpl implements PayOrderService {
...
@@ -89,22 +89,22 @@ public class PayOrderServiceImpl implements PayOrderService {
if
(
CollUtil
.
isEmpty
(
ids
))
{
if
(
CollUtil
.
isEmpty
(
ids
))
{
return
Collections
.
emptyList
();
return
Collections
.
emptyList
();
}
}
return
o
rderMapper
.
selectByIds
(
ids
);
return
payO
rderMapper
.
selectByIds
(
ids
);
}
}
@Override
@Override
public
Long
getOrderCountByAppId
(
Long
appId
)
{
public
Long
getOrderCountByAppId
(
Long
appId
)
{
return
o
rderMapper
.
selectCountByAppId
(
appId
);
return
payO
rderMapper
.
selectCountByAppId
(
appId
);
}
}
@Override
@Override
public
PageResult
<
PayOrderDO
>
getOrderPage
(
PayOrderPageReqVO
pageReqVO
)
{
public
PageResult
<
PayOrderDO
>
getOrderPage
(
PayOrderPageReqVO
pageReqVO
)
{
return
o
rderMapper
.
selectPage
(
pageReqVO
);
return
payO
rderMapper
.
selectPage
(
pageReqVO
);
}
}
@Override
@Override
public
List
<
PayOrderDO
>
getOrderList
(
PayOrderExportReqVO
exportReqVO
)
{
public
List
<
PayOrderDO
>
getOrderList
(
PayOrderExportReqVO
exportReqVO
)
{
return
o
rderMapper
.
selectList
(
exportReqVO
);
return
payO
rderMapper
.
selectList
(
exportReqVO
);
}
}
@Override
@Override
...
@@ -113,7 +113,7 @@ public class PayOrderServiceImpl implements PayOrderService {
...
@@ -113,7 +113,7 @@ public class PayOrderServiceImpl implements PayOrderService {
PayAppDO
app
=
appService
.
validPayApp
(
reqDTO
.
getAppKey
());
PayAppDO
app
=
appService
.
validPayApp
(
reqDTO
.
getAppKey
());
// 查询对应的支付交易单是否已经存在。如果是,则直接返回
// 查询对应的支付交易单是否已经存在。如果是,则直接返回
PayOrderDO
order
=
o
rderMapper
.
selectByAppIdAndMerchantOrderId
(
PayOrderDO
order
=
payO
rderMapper
.
selectByAppIdAndMerchantOrderId
(
app
.
getId
(),
reqDTO
.
getMerchantOrderId
());
app
.
getId
(),
reqDTO
.
getMerchantOrderId
());
if
(
order
!=
null
)
{
if
(
order
!=
null
)
{
log
.
warn
(
"[createOrder][appId({}) merchantOrderId({}) 已经存在对应的支付单({})]"
,
order
.
getAppId
(),
log
.
warn
(
"[createOrder][appId({}) merchantOrderId({}) 已经存在对应的支付单({})]"
,
order
.
getAppId
(),
...
@@ -129,7 +129,7 @@ public class PayOrderServiceImpl implements PayOrderService {
...
@@ -129,7 +129,7 @@ public class PayOrderServiceImpl implements PayOrderService {
.
setStatus
(
PayOrderStatusEnum
.
WAITING
.
getStatus
())
.
setStatus
(
PayOrderStatusEnum
.
WAITING
.
getStatus
())
// 退款相关字段
// 退款相关字段
.
setRefundPrice
(
0
);
.
setRefundPrice
(
0
);
o
rderMapper
.
insert
(
order
);
payO
rderMapper
.
insert
(
order
);
return
order
.
getId
();
return
order
.
getId
();
}
}
...
@@ -176,13 +176,13 @@ public class PayOrderServiceImpl implements PayOrderService {
...
@@ -176,13 +176,13 @@ public class PayOrderServiceImpl implements PayOrderService {
unifiedOrderResp
.
getChannelErrorMsg
());
unifiedOrderResp
.
getChannelErrorMsg
());
}
}
// 此处需要读取最新的状态
// 此处需要读取最新的状态
order
=
o
rderMapper
.
selectById
(
order
.
getId
());
order
=
payO
rderMapper
.
selectById
(
order
.
getId
());
}
}
return
PayOrderConvert
.
INSTANCE
.
convert
(
order
,
unifiedOrderResp
);
return
PayOrderConvert
.
INSTANCE
.
convert
(
order
,
unifiedOrderResp
);
}
}
private
PayOrderDO
validateOrderCanSubmit
(
Long
id
)
{
private
PayOrderDO
validateOrderCanSubmit
(
Long
id
)
{
PayOrderDO
order
=
o
rderMapper
.
selectById
(
id
);
PayOrderDO
order
=
payO
rderMapper
.
selectById
(
id
);
if
(
order
==
null
)
{
// 是否存在
if
(
order
==
null
)
{
// 是否存在
throw
exception
(
PAY_ORDER_NOT_FOUND
);
throw
exception
(
PAY_ORDER_NOT_FOUND
);
}
}
...
@@ -339,7 +339,7 @@ public class PayOrderServiceImpl implements PayOrderService {
...
@@ -339,7 +339,7 @@ public class PayOrderServiceImpl implements PayOrderService {
private
Boolean
updateOrderSuccess
(
PayChannelDO
channel
,
PayOrderExtensionDO
orderExtension
,
private
Boolean
updateOrderSuccess
(
PayChannelDO
channel
,
PayOrderExtensionDO
orderExtension
,
PayOrderRespDTO
notify
)
{
PayOrderRespDTO
notify
)
{
// 1. 判断 PayOrderDO 是否处于待支付
// 1. 判断 PayOrderDO 是否处于待支付
PayOrderDO
order
=
o
rderMapper
.
selectById
(
orderExtension
.
getOrderId
());
PayOrderDO
order
=
payO
rderMapper
.
selectById
(
orderExtension
.
getOrderId
());
if
(
order
==
null
)
{
if
(
order
==
null
)
{
throw
exception
(
PAY_ORDER_NOT_FOUND
);
throw
exception
(
PAY_ORDER_NOT_FOUND
);
}
}
...
@@ -353,7 +353,7 @@ public class PayOrderServiceImpl implements PayOrderService {
...
@@ -353,7 +353,7 @@ public class PayOrderServiceImpl implements PayOrderService {
}
}
// 2. 更新 PayOrderDO
// 2. 更新 PayOrderDO
int
updateCounts
=
o
rderMapper
.
updateByIdAndStatus
(
order
.
getId
(),
PayOrderStatusEnum
.
WAITING
.
getStatus
(),
int
updateCounts
=
payO
rderMapper
.
updateByIdAndStatus
(
order
.
getId
(),
PayOrderStatusEnum
.
WAITING
.
getStatus
(),
PayOrderDO
.
builder
().
status
(
PayOrderStatusEnum
.
SUCCESS
.
getStatus
())
PayOrderDO
.
builder
().
status
(
PayOrderStatusEnum
.
SUCCESS
.
getStatus
())
.
channelId
(
channel
.
getId
()).
channelCode
(
channel
.
getCode
())
.
channelId
(
channel
.
getId
()).
channelCode
(
channel
.
getCode
())
.
successTime
(
notify
.
getSuccessTime
()).
extensionId
(
orderExtension
.
getId
()).
no
(
orderExtension
.
getNo
())
.
successTime
(
notify
.
getSuccessTime
()).
extensionId
(
orderExtension
.
getId
()).
no
(
orderExtension
.
getNo
())
...
@@ -404,7 +404,7 @@ public class PayOrderServiceImpl implements PayOrderService {
...
@@ -404,7 +404,7 @@ public class PayOrderServiceImpl implements PayOrderService {
@Override
@Override
public
void
updateOrderRefundPrice
(
Long
id
,
Integer
incrRefundPrice
)
{
public
void
updateOrderRefundPrice
(
Long
id
,
Integer
incrRefundPrice
)
{
PayOrderDO
order
=
o
rderMapper
.
selectById
(
id
);
PayOrderDO
order
=
payO
rderMapper
.
selectById
(
id
);
if
(
order
==
null
)
{
if
(
order
==
null
)
{
throw
exception
(
PAY_ORDER_NOT_FOUND
);
throw
exception
(
PAY_ORDER_NOT_FOUND
);
}
}
...
@@ -419,7 +419,7 @@ public class PayOrderServiceImpl implements PayOrderService {
...
@@ -419,7 +419,7 @@ public class PayOrderServiceImpl implements PayOrderService {
PayOrderDO
updateObj
=
new
PayOrderDO
()
PayOrderDO
updateObj
=
new
PayOrderDO
()
.
setRefundPrice
(
order
.
getRefundPrice
()
+
incrRefundPrice
)
.
setRefundPrice
(
order
.
getRefundPrice
()
+
incrRefundPrice
)
.
setStatus
(
PayOrderStatusEnum
.
REFUND
.
getStatus
());
.
setStatus
(
PayOrderStatusEnum
.
REFUND
.
getStatus
());
int
updateCount
=
o
rderMapper
.
updateByIdAndStatus
(
id
,
order
.
getStatus
(),
updateObj
);
int
updateCount
=
payO
rderMapper
.
updateByIdAndStatus
(
id
,
order
.
getStatus
(),
updateObj
);
if
(
updateCount
==
0
)
{
if
(
updateCount
==
0
)
{
throw
exception
(
PAY_ORDER_REFUND_FAIL_STATUS_ERROR
);
throw
exception
(
PAY_ORDER_REFUND_FAIL_STATUS_ERROR
);
}
}
...
@@ -427,7 +427,7 @@ public class PayOrderServiceImpl implements PayOrderService {
...
@@ -427,7 +427,7 @@ public class PayOrderServiceImpl implements PayOrderService {
@Override
@Override
public
void
updatePayOrderPrice
(
Long
id
,
Integer
payPrice
)
{
public
void
updatePayOrderPrice
(
Long
id
,
Integer
payPrice
)
{
PayOrderDO
order
=
o
rderMapper
.
selectById
(
id
);
PayOrderDO
order
=
payO
rderMapper
.
selectById
(
id
);
if
(
order
==
null
)
{
if
(
order
==
null
)
{
throw
exception
(
PAY_ORDER_NOT_FOUND
);
throw
exception
(
PAY_ORDER_NOT_FOUND
);
}
}
...
@@ -438,7 +438,7 @@ public class PayOrderServiceImpl implements PayOrderService {
...
@@ -438,7 +438,7 @@ public class PayOrderServiceImpl implements PayOrderService {
return
;
return
;
}
}
o
rderMapper
.
updateById
(
new
PayOrderDO
().
setId
(
order
.
getId
()).
setPrice
(
payPrice
));
payO
rderMapper
.
updateById
(
new
PayOrderDO
().
setId
(
order
.
getId
()).
setPrice
(
payPrice
));
}
}
@Override
@Override
...
@@ -516,7 +516,7 @@ public class PayOrderServiceImpl implements PayOrderService {
...
@@ -516,7 +516,7 @@ public class PayOrderServiceImpl implements PayOrderService {
@Override
@Override
public
int
expireOrder
()
{
public
int
expireOrder
()
{
// 1. 查询过期的待支付订单
// 1. 查询过期的待支付订单
List
<
PayOrderDO
>
orders
=
o
rderMapper
.
selectListByStatusAndExpireTimeLt
(
List
<
PayOrderDO
>
orders
=
payO
rderMapper
.
selectListByStatusAndExpireTimeLt
(
PayOrderStatusEnum
.
WAITING
.
getStatus
(),
LocalDateTime
.
now
());
PayOrderStatusEnum
.
WAITING
.
getStatus
(),
LocalDateTime
.
now
());
if
(
CollUtil
.
isEmpty
(
orders
))
{
if
(
CollUtil
.
isEmpty
(
orders
))
{
return
0
;
return
0
;
...
@@ -581,7 +581,7 @@ public class PayOrderServiceImpl implements PayOrderService {
...
@@ -581,7 +581,7 @@ public class PayOrderServiceImpl implements PayOrderService {
// 2. 都没有上述情况,可以安心更新为已关闭
// 2. 都没有上述情况,可以安心更新为已关闭
PayOrderDO
updateObj
=
new
PayOrderDO
().
setStatus
(
PayOrderStatusEnum
.
CLOSED
.
getStatus
());
PayOrderDO
updateObj
=
new
PayOrderDO
().
setStatus
(
PayOrderStatusEnum
.
CLOSED
.
getStatus
());
if
(
o
rderMapper
.
updateByIdAndStatus
(
order
.
getId
(),
order
.
getStatus
(),
updateObj
)
==
0
)
{
if
(
payO
rderMapper
.
updateByIdAndStatus
(
order
.
getId
(),
order
.
getStatus
(),
updateObj
)
==
0
)
{
log
.
error
(
"[expireOrder][order({}) 更新为支付关闭失败]"
,
order
.
getId
());
log
.
error
(
"[expireOrder][order({}) 更新为支付关闭失败]"
,
order
.
getId
());
return
false
;
return
false
;
}
}
...
...
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