Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
foodNexus-admin
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
副食品筹措管理平台
foodNexus-admin
Commits
a6abc1df
Commit
a6abc1df
authored
Oct 14, 2025
by
杨浩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
评分权重;
bug修复;
parent
12350c4e
Hide whitespace changes
Inline
Side-by-side
Showing
43 changed files
with
746 additions
and
62 deletions
+746
-62
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/purchase/ErpPurchaseOrderController.java
+0
-1
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/purchase/vo/supplier/SupplierScoringWeightRespVO.java
+15
-0
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/service/sale/ErpSaleReturnService.java
+7
-0
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/service/sale/ErpSaleReturnServiceImpl.java
+16
-2
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/controller/admin/scoringweight/ScoringWeightController.java
+8
-1
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/controller/admin/scoringweight/vo/ScoringWeightEditReqVO.java
+39
-0
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/controller/admin/scoringweight/vo/ScoringWeightSaveReqVO.java
+4
-15
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/controller/admin/scoringweight/vo/ScoringWeightUpateReqVO.java
+40
-0
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/controller/app/customerrequire/AppCustomerRequireController.java
+17
-0
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/enums/ErrorCodeConstants.java
+2
-0
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/service/scoringweight/ScoringWeightService.java
+8
-2
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/service/scoringweight/ScoringWeightServiceImpl.java
+32
-5
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/checktask/CheckTaskController.java
+9
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/checktask/vo/CheckTaskCheckReqVO.java
+4
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/checktask/vo/CheckTaskRespVO.java
+3
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/checktask/vo/CheckTaskSupplierScoreReqVO.java
+42
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/checktask/vo/CheckTaskSupplierScoreRespVO.java
+37
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/customerorder/vo/CustomerOrderPageReqVO.java
+4
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/customerorder/vo/CustomerOrderRespVO.java
+3
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/orderScore/OrderScoreController.java
+13
-5
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/orderScore/vo/OrderScorePageReqVO.java
+1
-1
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/orderScore/vo/OrderScoreRespVO.java
+1
-1
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/orderScore/vo/OrderScoreSaveReqVO.java
+1
-1
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/orderScore/vo/OrderScoreSupplierPageReqVO.java
+31
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/orderScore/vo/OrderScoreSupplierRespVO.java
+54
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/customerOrder/AppCustomerOrderController.java
+7
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/customerOrder/vo/AppCustomerOrderReturnRespVO.java
+63
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/dal/dataobject/checktask/CheckTaskDO.java
+5
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/dal/dataobject/customerorder/CustomerOrderDO.java
+6
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/dal/dataobject/orderScore/OrderScoreDO.java
+1
-2
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/dal/mysql/customerorder/CustomerOrderMapper.java
+5
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/enums/ErrorCodeConstants.java
+2
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/service/checktask/CheckTaskService.java
+4
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/service/checktask/CheckTaskServiceImpl.java
+63
-2
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/service/customerorder/CustomerOrderService.java
+12
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/service/customerorder/CustomerOrderServiceImpl.java
+63
-20
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/service/orderScore/OrderScoreService.java
+4
-2
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/service/orderScore/OrderScoreServiceImpl.java
+20
-0
foodnexus-module-mall/foodnexus-module-product/src/main/java/cn/iocoder/foodnexus/module/product/controller/app/spu/vo/AppProductSpuDetailRespVO.java
+7
-0
foodnexus-module-mall/foodnexus-module-product/src/main/java/cn/iocoder/foodnexus/module/product/controller/app/spu/vo/AppProductSpuRespVO.java
+8
-0
foodnexus-module-mall/foodnexus-module-product/src/main/java/cn/iocoder/foodnexus/module/product/dal/dataobject/spu/ProductSpuDO.java
+13
-0
foodnexus-module-system/src/main/java/cn/iocoder/foodnexus/module/system/annotations/AutoSetPrice.java
+12
-0
foodnexus-module-system/src/main/java/cn/iocoder/foodnexus/module/system/aspect/AutoSetPriceAspect.java
+60
-2
No files found.
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/purchase/ErpPurchaseOrderController.java
View file @
a6abc1df
...
...
@@ -50,7 +50,6 @@ import static cn.iocoder.foodnexus.framework.common.util.collection.CollectionUt
@RestController
@RequestMapping
(
"/erp/purchase-order"
)
@Validated
@AppSystemAuth
(
UserSystemEnum
.
SUPPLIER
)
public
class
ErpPurchaseOrderController
{
@Resource
...
...
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/purchase/vo/supplier/SupplierScoringWeightRespVO.java
0 → 100644
View file @
a6abc1df
package
cn
.
iocoder
.
foodnexus
.
module
.
erp
.
controller
.
admin
.
purchase
.
vo
.
supplier
;
import
lombok.Data
;
/**
* @author : yanghao
* create at: 2025/10/13 17:46
* @description: 供应商 - 评分明细
*/
@Data
public
class
SupplierScoringWeightRespVO
{
}
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/service/sale/ErpSaleReturnService.java
View file @
a6abc1df
...
...
@@ -98,4 +98,10 @@ public interface ErpSaleReturnService {
*/
List
<
ErpSaleReturnItemDO
>
getSaleReturnItemListByReturnIds
(
Collection
<
Long
>
returnIds
);
/**
* 根据客户订单id查询
* @param id
* @return
*/
ErpSaleReturnDO
queryByCustomerOrderId
(
Long
id
);
}
\ No newline at end of file
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/service/sale/ErpSaleReturnServiceImpl.java
View file @
a6abc1df
...
...
@@ -24,6 +24,7 @@ import cn.iocoder.foodnexus.module.product.api.ProductSpuApi;
import
cn.iocoder.foodnexus.module.product.dal.dataobject.spu.ProductSpuDO
;
import
cn.iocoder.foodnexus.module.product.service.spu.ProductSpuService
;
import
cn.iocoder.foodnexus.module.system.api.user.AdminUserApi
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
jakarta.annotation.Resource
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.stereotype.Service
;
...
...
@@ -79,12 +80,12 @@ public class ErpSaleReturnServiceImpl implements ErpSaleReturnService {
ErpSaleOrderDO
saleOrder
=
saleOrderService
.
validateSaleOrder
(
createReqVO
.
getOrderId
());
// 1.2 校验退货项的有效性
List
<
ErpSaleReturnItemDO
>
saleReturnItems
=
validateSaleReturnItems
(
createReqVO
.
getItems
());
// 1.3 校验结算账户
/
*/
/ 1.3 校验结算账户
accountService.validateAccount(createReqVO.getAccountId());
// 1.4 校验销售人员
if (createReqVO.getSaleUserId() != null) {
adminUserApi.validateUser(createReqVO.getSaleUserId());
}
}
*/
// 1.5 生成退货单号,并校验唯一性
String
no
=
noRedisDAO
.
generate
(
ErpNoRedisDAO
.
SALE_RETURN_NO_PREFIX
);
if
(
saleReturnMapper
.
selectByNo
(
no
)
!=
null
)
{
...
...
@@ -316,4 +317,17 @@ public class ErpSaleReturnServiceImpl implements ErpSaleReturnService {
return
saleReturnItemMapper
.
selectListByReturnIds
(
returnIds
);
}
/**
* 根据客户订单id查询
*
* @param customerOrderId
* @return
*/
@Override
public
ErpSaleReturnDO
queryByCustomerOrderId
(
Long
customerOrderId
)
{
return
saleReturnMapper
.
selectOne
(
Wrappers
.<
ErpSaleReturnDO
>
lambdaQuery
()
.
eq
(
ErpSaleReturnDO:
:
getCustomerOrderId
,
customerOrderId
)
.
last
(
"LIMIT 1"
));
}
}
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/controller/admin/scoringweight/ScoringWeightController.java
View file @
a6abc1df
...
...
@@ -48,11 +48,18 @@ public class ScoringWeightController {
@PutMapping
(
"/update"
)
@Operation
(
summary
=
"更新评分权重"
)
@PreAuthorize
(
"@ss.hasPermission('operations:scoring-weight:update')"
)
public
CommonResult
<
Boolean
>
updateScoringWeight
(
@Valid
@RequestBody
ScoringWeight
Sav
eReqVO
updateReqVO
)
{
public
CommonResult
<
Boolean
>
updateScoringWeight
(
@Valid
@RequestBody
ScoringWeight
Upat
eReqVO
updateReqVO
)
{
scoringWeightService
.
updateScoringWeight
(
updateReqVO
);
return
success
(
true
);
}
@PostMapping
(
"/edit"
)
@Operation
(
summary
=
"编辑权重"
)
public
CommonResult
<
Boolean
>
edit
(
@Valid
@RequestBody
ScoringWeightEditReqVO
reqVO
)
{
scoringWeightService
.
edit
(
reqVO
);
return
success
(
Boolean
.
TRUE
);
}
@DeleteMapping
(
"/delete"
)
@Operation
(
summary
=
"删除评分权重"
)
@Parameter
(
name
=
"id"
,
description
=
"编号"
,
required
=
true
)
...
...
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/controller/admin/scoringweight/vo/ScoringWeightEditReqVO.java
0 → 100644
View file @
a6abc1df
package
cn
.
iocoder
.
foodnexus
.
module
.
operations
.
controller
.
admin
.
scoringweight
.
vo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
jakarta.validation.Valid
;
import
jakarta.validation.constraints.NotNull
;
import
jakarta.validation.constraints.Size
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.util.List
;
/**
* @author : yanghao
* create at: 2025/10/13 17:32
* @description:
*/
@Data
public
class
ScoringWeightEditReqVO
{
@Schema
(
description
=
"设置权重项"
)
@NotNull
(
message
=
"设置权重项不能为空"
)
@Size
(
min
=
1
,
message
=
"设置权重项不能为空"
)
@Valid
private
List
<
EditItems
>
editItems
;
@Data
public
static
class
EditItems
{
@Schema
(
description
=
"id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"8877"
)
@NotNull
(
message
=
"id不能为空"
)
private
Long
id
;
@Schema
(
description
=
"评分权重,单位:%"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@NotNull
(
message
=
"评分权重不能为空"
)
private
BigDecimal
weightRatio
;
}
}
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/controller/admin/scoringweight/vo/ScoringWeightSaveReqVO.java
View file @
a6abc1df
package
cn
.
iocoder
.
foodnexus
.
module
.
operations
.
controller
.
admin
.
scoringweight
.
vo
;
import
cn.iocoder.foodnexus.framework.common.enums.UserSystemEnum
;
import
cn.iocoder.foodnexus.framework.common.enums.UserTypeEnum
;
import
cn.iocoder.foodnexus.framework.common.validation.InEnum
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.*
;
import
java.util.*
;
import
jakarta.validation.constraints.*
;
import
jakarta.validation.constraints.NotEmpty
;
import
jakarta.validation.constraints.NotNull
;
import
lombok.Data
;
import
java.math.BigDecimal
;
@Schema
(
description
=
"管理后台 - 评分权重新增/修改 Request VO"
)
@Data
public
class
ScoringWeightSaveReqVO
{
@Schema
(
description
=
"id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"8877"
)
private
Long
id
;
@Schema
(
description
=
"评价指标名称"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"赵六"
)
@NotEmpty
(
message
=
"评价指标名称不能为空"
)
private
String
scoreName
;
@Schema
(
description
=
"评分权重"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@NotNull
(
message
=
"评分权重不能为空"
)
private
BigDecimal
weightRatio
;
@Schema
(
description
=
"是否展示"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@NotNull
(
message
=
"是否展示不能为空"
)
private
Boolean
isDisplay
;
@Schema
(
description
=
"面向用户群体"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@NotEmpty
(
message
=
"面向用户群体不能为空"
)
@InEnum
(
value
=
UserSystemEnum
.
class
,
message
=
"用户类型必须是 {value}"
)
...
...
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/controller/admin/scoringweight/vo/ScoringWeightUpateReqVO.java
0 → 100644
View file @
a6abc1df
package
cn
.
iocoder
.
foodnexus
.
module
.
operations
.
controller
.
admin
.
scoringweight
.
vo
;
import
cn.iocoder.foodnexus.framework.common.enums.UserSystemEnum
;
import
cn.iocoder.foodnexus.framework.common.enums.UserTypeEnum
;
import
cn.iocoder.foodnexus.framework.common.validation.InEnum
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.*
;
import
java.util.*
;
import
jakarta.validation.constraints.*
;
import
java.math.BigDecimal
;
@Schema
(
description
=
"管理后台 - 评分权重新增/修改 Request VO"
)
@Data
public
class
ScoringWeightUpateReqVO
{
@Schema
(
description
=
"id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"8877"
)
private
Long
id
;
@Schema
(
description
=
"评价指标名称"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"赵六"
)
@NotEmpty
(
message
=
"评价指标名称不能为空"
)
private
String
scoreName
;
@Schema
(
description
=
"评分权重"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@NotNull
(
message
=
"评分权重不能为空"
)
private
BigDecimal
weightRatio
;
@Schema
(
description
=
"是否展示"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@NotNull
(
message
=
"是否展示不能为空"
)
private
Boolean
isDisplay
;
@Schema
(
description
=
"面向用户群体"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@NotEmpty
(
message
=
"面向用户群体不能为空"
)
@InEnum
(
value
=
UserSystemEnum
.
class
,
message
=
"用户类型必须是 {value}"
)
private
String
userSystem
;
@Schema
(
description
=
"排序"
)
private
Integer
sort
;
}
\ No newline at end of file
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/controller/app/customerrequire/AppCustomerRequireController.java
View file @
a6abc1df
...
...
@@ -75,4 +75,20 @@ public class AppCustomerRequireController {
return
success
(
BeanUtils
.
toBean
(
pageResult
,
CustomerRequireRespVO
.
class
));
}
@DeleteMapping
(
"/delete"
)
@Operation
(
summary
=
"删除客户需求"
)
@Parameter
(
name
=
"id"
,
description
=
"编号"
,
required
=
true
)
public
CommonResult
<
Boolean
>
deleteCustomerRequire
(
@RequestParam
(
"id"
)
Long
id
)
{
customerRequireService
.
deleteCustomerRequire
(
id
);
return
success
(
true
);
}
@DeleteMapping
(
"/delete-list"
)
@Parameter
(
name
=
"ids"
,
description
=
"编号"
,
required
=
true
)
@Operation
(
summary
=
"批量删除客户需求"
)
public
CommonResult
<
Boolean
>
deleteCustomerRequireList
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
customerRequireService
.
deleteCustomerRequireListByIds
(
ids
);
return
success
(
true
);
}
}
\ No newline at end of file
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/enums/ErrorCodeConstants.java
View file @
a6abc1df
...
...
@@ -40,4 +40,6 @@ public interface ErrorCodeConstants {
// ========== 评分权重 1_008_018_000 ==========
ErrorCode
SCORING_WEIGHT_NOT_EXISTS
=
new
ErrorCode
(
1_008_018_000
,
"评分权重不存在"
);
ErrorCode
SCORING_WEIGHT_LIST_ERROR
=
new
ErrorCode
(
1_008_018_001
,
"评分权重数量不对"
);
ErrorCode
SCORING_WEIGHT_WEIGHTRATIO_ERROR
=
new
ErrorCode
(
1_008_018_002
,
"评分权重相加必须为100%"
);
}
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/service/scoringweight/ScoringWeightService.java
View file @
a6abc1df
...
...
@@ -7,7 +7,6 @@ import jakarta.validation.*;
import
cn.iocoder.foodnexus.module.operations.controller.admin.scoringweight.vo.*
;
import
cn.iocoder.foodnexus.module.operations.dal.dataobject.scoringweight.ScoringWeightDO
;
import
cn.iocoder.foodnexus.framework.common.pojo.PageResult
;
import
cn.iocoder.foodnexus.framework.common.pojo.PageParam
;
/**
* 评分权重 Service 接口
...
...
@@ -29,7 +28,7 @@ public interface ScoringWeightService {
*
* @param updateReqVO 更新信息
*/
void
updateScoringWeight
(
@Valid
ScoringWeight
Sav
eReqVO
updateReqVO
);
void
updateScoringWeight
(
@Valid
ScoringWeight
Upat
eReqVO
updateReqVO
);
/**
* 删除评分权重
...
...
@@ -62,4 +61,10 @@ public interface ScoringWeightService {
PageResult
<
ScoringWeightDO
>
getScoringWeightPage
(
ScoringWeightPageReqVO
pageReqVO
);
List
<
ScoringWeightDO
>
queryByUserSystem
(
UserSystemEnum
userSystemEnum
);
/**
* 设置权重
* @param reqVO
*/
void
edit
(
ScoringWeightEditReqVO
reqVO
);
}
\ No newline at end of file
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/service/scoringweight/ScoringWeightServiceImpl.java
View file @
a6abc1df
package
cn
.
iocoder
.
foodnexus
.
module
.
operations
.
service
.
scoringweight
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.iocoder.foodnexus.framework.common.enums.UserSystemEnum
;
import
cn.iocoder.foodnexus.framework.common.util.CommonUtil
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
jakarta.validation.Valid
;
import
org.springframework.stereotype.Service
;
import
jakarta.annotation.Resource
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.validation.annotation.Validated
;
import
java.util.*
;
import
cn.iocoder.foodnexus.module.operations.controller.admin.scoringweight.vo.*
;
import
cn.iocoder.foodnexus.module.operations.dal.dataobject.scoringweight.ScoringWeightDO
;
import
cn.iocoder.foodnexus.framework.common.pojo.PageResult
;
import
cn.iocoder.foodnexus.framework.common.pojo.PageParam
;
import
cn.iocoder.foodnexus.framework.common.util.object.BeanUtils
;
import
cn.iocoder.foodnexus.module.operations.dal.mysql.scoringweight.ScoringWeightMapper
;
import
static
cn
.
iocoder
.
foodnexus
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
import
static
cn
.
iocoder
.
foodnexus
.
framework
.
common
.
util
.
collection
.
CollectionUtils
.
convertList
;
import
static
cn
.
iocoder
.
foodnexus
.
framework
.
common
.
util
.
collection
.
CollectionUtils
.
diffList
;
import
static
cn
.
iocoder
.
foodnexus
.
module
.
operations
.
enums
.
ErrorCodeConstants
.*;
/**
...
...
@@ -45,7 +44,7 @@ public class ScoringWeightServiceImpl implements ScoringWeightService {
}
@Override
public
void
updateScoringWeight
(
ScoringWeightSav
eReqVO
updateReqVO
)
{
public
void
updateScoringWeight
(
@Valid
ScoringWeightUpat
eReqVO
updateReqVO
)
{
// 校验存在
validateScoringWeightExists
(
updateReqVO
.
getId
());
// 更新
...
...
@@ -92,4 +91,31 @@ public class ScoringWeightServiceImpl implements ScoringWeightService {
.
orderByAsc
(
ScoringWeightDO:
:
getSort
));
}
/**
* 设置权重
*
* @param reqVO
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
edit
(
ScoringWeightEditReqVO
reqVO
)
{
Long
allCount
=
scoringWeightMapper
.
selectCount
();
if
(
reqVO
.
getEditItems
().
size
()
!=
allCount
)
{
throw
exception
(
SCORING_WEIGHT_LIST_ERROR
);
}
double
sum
=
reqVO
.
getEditItems
().
stream
().
mapToDouble
(
item
->
item
.
getWeightRatio
().
doubleValue
()).
sum
();
if
(
sum
!=
100
)
{
throw
exception
(
SCORING_WEIGHT_WEIGHTRATIO_ERROR
);
}
List
<
ScoringWeightDO
>
scoringWeightDOS
=
CommonUtil
.
listConvert
(
reqVO
.
getEditItems
(),
item
->
{
ScoringWeightDO
scoringWeightDO
=
new
ScoringWeightDO
();
scoringWeightDO
.
setId
(
item
.
getId
());
scoringWeightDO
.
setWeightRatio
(
item
.
getWeightRatio
());
return
scoringWeightDO
;
});
scoringWeightMapper
.
updateBatch
(
scoringWeightDOS
);
}
}
\ No newline at end of file
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/checktask/CheckTaskController.java
View file @
a6abc1df
package
cn
.
iocoder
.
foodnexus
.
module
.
order
.
controller
.
admin
.
checktask
;
import
cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCustomerOrderScoreReqVO
;
import
cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCustomerOrderScoreRespVO
;
import
cn.iocoder.foodnexus.module.order.service.checktaskitems.CheckTaskItemsService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -95,6 +97,13 @@ public class CheckTaskController {
return
success
(
BeanUtils
.
toBean
(
pageResult
,
CheckTaskRespVO
.
class
));
}
@GetMapping
(
"score"
)
@Operation
(
summary
=
"查询订单评价"
)
@Parameter
(
name
=
"id"
,
description
=
"来料质检id"
,
required
=
true
)
public
CommonResult
<
CheckTaskSupplierScoreRespVO
>
queryScore
(
@RequestParam
(
"id"
)
Long
id
)
{
return
success
(
checkTaskService
.
queryScore
(
id
));
}
@GetMapping
(
"/export-excel"
)
@Operation
(
summary
=
"导出来料质检 Excel"
)
@PreAuthorize
(
"@ss.hasPermission('order:check-task:export')"
)
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/checktask/vo/CheckTaskCheckReqVO.java
View file @
a6abc1df
...
...
@@ -40,6 +40,10 @@ public class CheckTaskCheckReqVO {
@Size
(
min
=
1
,
message
=
"质检清单不能为空"
)
private
List
<
Item
>
items
;
@Schema
(
description
=
"供应商评价"
)
@Valid
private
CheckTaskSupplierScoreReqVO
score
;
@Data
public
static
class
Item
{
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/checktask/vo/CheckTaskRespVO.java
View file @
a6abc1df
...
...
@@ -59,6 +59,9 @@ public class CheckTaskRespVO {
@ExcelProperty
(
"创建时间"
)
private
LocalDateTime
createTime
;
@Schema
(
description
=
"供应商评价"
)
private
String
scoreRemark
;
@Schema
(
description
=
"质检子项(详情接口返回)"
)
private
List
<
CheckTaskItemsRespVO
>
items
;
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/checktask/vo/CheckTaskSupplierScoreReqVO.java
0 → 100644
View file @
a6abc1df
package
cn
.
iocoder
.
foodnexus
.
module
.
order
.
controller
.
admin
.
checktask
.
vo
;
import
cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCustomerOrderScoreRespVO
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
jakarta.validation.Valid
;
import
jakarta.validation.constraints.Max
;
import
jakarta.validation.constraints.Min
;
import
jakarta.validation.constraints.NotNull
;
import
lombok.Data
;
import
java.util.List
;
/**
* @author : yanghao
* create at: 2025/10/13 17:51
* @description: 供应商评价
*/
@Data
public
class
CheckTaskSupplierScoreReqVO
{
@Schema
(
description
=
"供应商评价"
)
private
String
scoreRemark
;
@Schema
(
description
=
"评价指标项"
)
@Valid
private
List
<
Item
>
items
;
@Data
public
static
class
Item
{
@Schema
(
description
=
"评价指标id"
)
@NotNull
(
message
=
"评价指标id不能为空"
)
private
Long
scoreId
;
@Schema
(
description
=
"得分"
)
@Min
(
value
=
1
,
message
=
"得分最低1分"
)
@Max
(
value
=
5
,
message
=
"得分最高5分"
)
private
Integer
score
;
}
}
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/checktask/vo/CheckTaskSupplierScoreRespVO.java
0 → 100644
View file @
a6abc1df
package
cn
.
iocoder
.
foodnexus
.
module
.
order
.
controller
.
admin
.
checktask
.
vo
;
import
cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCustomerOrderScoreRespVO
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
java.util.List
;
/**
* @author : yanghao
* create at: 2025/10/13 17:49
* @description: 供应商评价
*/
@Data
public
class
CheckTaskSupplierScoreRespVO
{
@Schema
(
description
=
"备注"
)
private
String
remark
;
@Schema
(
description
=
"评价指标项"
)
private
List
<
Item
>
items
;
@Data
public
static
class
Item
{
@Schema
(
description
=
"评价指标id"
)
private
Long
scoreId
;
@Schema
(
description
=
"评价指标名称"
)
private
String
scoreName
;
@Schema
(
description
=
"得分"
)
private
Integer
score
;
}
}
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/customerorder/vo/CustomerOrderPageReqVO.java
View file @
a6abc1df
...
...
@@ -78,4 +78,7 @@ public class CustomerOrderPageReqVO extends PageParam {
@Schema
(
description
=
"创建月份(yyyy-MM)"
)
private
String
createYearMonth
;
@Schema
(
description
=
"筛选待评价"
)
private
Boolean
filterToBeScore
;
}
\ No newline at end of file
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/customerorder/vo/CustomerOrderRespVO.java
View file @
a6abc1df
...
...
@@ -103,6 +103,9 @@ public class CustomerOrderRespVO {
@Schema
(
description
=
"订单备注"
)
private
CustomerOrderRemark
orderRemark
;
@Schema
(
description
=
"是否已评论"
)
private
Boolean
hasScore
;
@Schema
(
description
=
"当前订单进度"
)
private
List
<
CustomerOrderRecordRespVO
>
currentRecords
;
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/orderScore/OrderScoreController.java
View file @
a6abc1df
...
...
@@ -29,7 +29,7 @@ import cn.iocoder.foodnexus.module.order.controller.admin.orderScore.vo.*;
import
cn.iocoder.foodnexus.module.order.dal.dataobject.orderScore.OrderScoreDO
;
import
cn.iocoder.foodnexus.module.order.service.orderScore.OrderScoreService
;
@Tag
(
name
=
"管理后台 -
订单
评价"
)
@Tag
(
name
=
"管理后台 -
供应商
评价"
)
@RestController
@RequestMapping
(
"/order/score"
)
@Validated
...
...
@@ -38,7 +38,14 @@ public class OrderScoreController {
@Resource
private
OrderScoreService
scoreService
;
@PostMapping
(
"/create"
)
@GetMapping
(
"/supplier/page"
)
@Operation
(
summary
=
"获得订单评价分页"
)
@PreAuthorize
(
"@ss.hasPermission('order:score:query')"
)
public
CommonResult
<
PageResult
<
OrderScoreSupplierRespVO
>>
supplierPage
(
@Valid
OrderScoreSupplierPageReqVO
pageReqVO
)
{
return
success
(
scoreService
.
supplierPage
(
pageReqVO
));
}
/*@PostMapping("/create")
@Operation(summary = "创建订单评价")
@PreAuthorize("@ss.hasPermission('order:score:create')")
public CommonResult<Long> createScore(@Valid @RequestBody OrderScoreSaveReqVO createReqVO) {
...
...
@@ -69,9 +76,9 @@ public class OrderScoreController {
public CommonResult<Boolean> deleteScoreList(@RequestParam("ids") List<Long> ids) {
scoreService.deleteScoreListByIds(ids);
return success(true);
}
}
*/
@GetMapping
(
"/get"
)
/*
@GetMapping("/get")
@Operation(summary = "获得订单评价")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('order:score:query')")
...
...
@@ -99,6 +106,6 @@ public class OrderScoreController {
// 导出 Excel
ExcelUtils.write(response, "订单评价.xls", "数据", OrderScoreRespVO.class,
BeanUtils.toBean(list, OrderScoreRespVO.class));
}
}
*/
}
\ No newline at end of file
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/orderScore/vo/OrderScorePageReqVO.java
View file @
a6abc1df
...
...
@@ -23,7 +23,7 @@ public class OrderScorePageReqVO extends PageParam {
private
String
scoreName
;
@Schema
(
description
=
"供应商id"
,
example
=
"23453"
)
private
Set
<
Long
>
supplierIds
;
private
Long
supplierId
;
@Schema
(
description
=
"客户id"
,
example
=
"7606"
)
private
Long
customerId
;
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/orderScore/vo/OrderScoreRespVO.java
View file @
a6abc1df
...
...
@@ -30,7 +30,7 @@ public class OrderScoreRespVO {
@Schema
(
description
=
"供应商id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"23453"
)
@ExcelProperty
(
"供应商id"
)
private
Set
<
Long
>
supplierIds
;
private
Long
supplierId
;
@Schema
(
description
=
"客户id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"7606"
)
@ExcelProperty
(
"客户id"
)
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/orderScore/vo/OrderScoreSaveReqVO.java
View file @
a6abc1df
...
...
@@ -25,7 +25,7 @@ public class OrderScoreSaveReqVO {
@Schema
(
description
=
"供应商id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"23453"
)
@NotNull
(
message
=
"供应商id不能为空"
)
private
Set
<
Long
>
supplierIds
;
private
Long
supplierId
;
@Schema
(
description
=
"客户id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"7606"
)
@NotNull
(
message
=
"客户id不能为空"
)
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/orderScore/vo/OrderScoreSupplierPageReqVO.java
0 → 100644
View file @
a6abc1df
package
cn
.
iocoder
.
foodnexus
.
module
.
order
.
controller
.
admin
.
orderScore
.
vo
;
import
cn.iocoder.foodnexus.framework.common.pojo.PageParam
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
jakarta.validation.constraints.NotNull
;
import
lombok.Data
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.time.LocalDateTime
;
import
static
cn
.
iocoder
.
foodnexus
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
;
@Schema
(
description
=
"管理后台 - 订单评价分页 Request VO"
)
@Data
public
class
OrderScoreSupplierPageReqVO
extends
PageParam
{
@Schema
(
description
=
"year"
)
@NotNull
(
message
=
"评分年度不能为空"
)
private
String
year
;
@Schema
(
description
=
"供应商名称"
,
example
=
"芋道源码"
)
private
String
name
;
@Schema
(
description
=
"手机号码"
,
example
=
"15601691300"
)
private
String
mobile
;
@Schema
(
description
=
"联系电话"
,
example
=
"18818288888"
)
private
String
telephone
;
}
\ No newline at end of file
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/orderScore/vo/OrderScoreSupplierRespVO.java
0 → 100644
View file @
a6abc1df
package
cn
.
iocoder
.
foodnexus
.
module
.
order
.
controller
.
admin
.
orderScore
.
vo
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.purchase.vo.supplier.ErpSupplierRespVO
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.util.List
;
/**
* @author : yanghao
* create at: 2025/10/13 18:14
* @description: 供应商 - 评价
*/
@Data
public
class
OrderScoreSupplierRespVO
{
@Schema
(
description
=
"评分年度"
)
private
String
year
;
@Schema
(
description
=
"供应商id"
)
private
Long
supplierId
;
@Schema
(
description
=
"供应商信息"
)
private
ErpSupplierRespVO
supplierInfo
;
@Schema
(
description
=
"评分维度得分"
)
private
List
<
ScoreItems
>
scoreItems
;
@Schema
(
description
=
"综合得分"
)
private
BigDecimal
finalScore
;
@Data
public
static
class
ScoreItems
{
@Schema
(
description
=
"评价指标id"
)
private
Long
scoreId
;
@Schema
(
description
=
"评价指标名称"
)
private
String
scoreName
;
@Schema
(
description
=
"总得分"
)
private
Integer
allScore
;
@Schema
(
description
=
"总评价数"
)
private
Integer
scoreCount
;
@Schema
(
description
=
"得分(平均)"
)
private
BigDecimal
score
;
}
}
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/customerOrder/AppCustomerOrderController.java
View file @
a6abc1df
...
...
@@ -100,6 +100,13 @@ public class AppCustomerOrderController {
return
success
(
Boolean
.
TRUE
);
}
@GetMapping
(
"query-return"
)
@Operation
(
summary
=
"查询退货说明"
)
@Parameter
(
name
=
"id"
,
description
=
"客户订单id"
,
required
=
true
)
public
CommonResult
<
AppCustomerOrderReturnRespVO
>
queryReturn
(
@RequestParam
(
"id"
)
Long
id
)
{
return
success
(
customerOrderService
.
queryReturn
(
id
));
}
@GetMapping
(
"score"
)
@Operation
(
summary
=
"查询订单评价"
)
@Parameter
(
name
=
"id"
,
description
=
"客户订单id"
,
required
=
true
)
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/customerOrder/vo/AppCustomerOrderReturnRespVO.java
0 → 100644
View file @
a6abc1df
package
cn
.
iocoder
.
foodnexus
.
module
.
order
.
controller
.
app
.
customerOrder
.
vo
;
import
cn.idev.excel.annotation.ExcelProperty
;
import
cn.iocoder.foodnexus.module.product.api.dto.ProductInfo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
jakarta.validation.constraints.NotNull
;
import
lombok.Data
;
import
java.util.List
;
/**
* @author : yanghao
* create at: 2025/10/14 10:16
* @description: 退货说明
*/
@Data
public
class
AppCustomerOrderReturnRespVO
{
@Schema
(
description
=
"退货单id"
)
private
Long
saleReturnId
;
@Schema
(
description
=
"说明"
)
private
String
remark
;
@Schema
(
description
=
"相关文件"
)
private
List
<
String
>
remarkFiles
;
@Schema
(
description
=
"最终合计价格,单位:分"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"24906"
)
private
Integer
totalReturnPrice
;
@Schema
(
description
=
"退货子项"
)
private
List
<
ReturnItems
>
returnItems
;
@Data
public
static
class
ReturnItems
{
@Schema
(
description
=
"客户子订单id"
)
private
Long
customerOrderItemId
;
@Schema
(
description
=
"商品id"
)
private
Long
productId
;
@Schema
(
description
=
"商品基本信息"
)
private
ProductInfo
productInfo
;
@Schema
(
description
=
"订单商品单价,单位:分"
)
private
Integer
orderItemPrice
;
@Schema
(
description
=
"退货数量"
)
private
Integer
returnCount
;
@Schema
(
description
=
"退货金额,单位:分"
)
private
Integer
returnPrice
;
@Schema
(
description
=
"退货总金额,单位:分"
)
private
Integer
totalReturnPrice
;
@Schema
(
description
=
"备注"
)
private
String
remark
;
}
}
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/dal/dataobject/checktask/CheckTaskDO.java
View file @
a6abc1df
...
...
@@ -75,5 +75,9 @@ public class CheckTaskDO extends BaseDO {
* 质检用户
*/
private
Long
checkUserId
;
/**
* 供应商评价
*/
private
String
scoreRemark
;
}
\ No newline at end of file
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/dal/dataobject/customerorder/CustomerOrderDO.java
View file @
a6abc1df
...
...
@@ -114,4 +114,9 @@ public class CustomerOrderDO extends BaseDO {
@TableField
(
typeHandler
=
JacksonTypeHandler
.
class
)
private
CustomerOrderRemark
orderRemark
;
/**
* 是否已评论
*/
private
Boolean
hasScore
;
}
\ No newline at end of file
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/dal/dataobject/orderScore/OrderScoreDO.java
View file @
a6abc1df
...
...
@@ -43,8 +43,7 @@ public class OrderScoreDO extends BaseDO {
/**
* 供应商id
*/
@TableField
(
typeHandler
=
JacksonTypeHandler
.
class
)
private
Set
<
Long
>
supplierIds
;
private
Long
supplierId
;
/**
* 客户id
*/
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/dal/mysql/customerorder/CustomerOrderMapper.java
View file @
a6abc1df
...
...
@@ -60,6 +60,11 @@ public interface CustomerOrderMapper extends BaseMapperX<CustomerOrderDO> {
queryWrapperX
.
ge
(
CustomerOrderDO:
:
getCreateTime
,
startOfMonth
)
.
lt
(
CustomerOrderDO:
:
getCreateTime
,
endOfMonth
);
}
if
(
CommonUtil
.
isNotEmpty
(
reqVO
.
getFilterToBeScore
())
&&
reqVO
.
getFilterToBeScore
())
{
queryWrapperX
.
eq
(
CustomerOrderDO:
:
getHasScore
,
Boolean
.
FALSE
);
queryWrapperX
.
in
(
CustomerOrderDO:
:
getOrderStatus
,
CommonUtil
.
asList
(
CustomerOrderStatus
.
SIGN_RECEIPT
.
getKey
(),
CustomerOrderStatus
.
FINISH
.
getKey
()));
}
return
selectPage
(
reqVO
,
queryWrapperX
);
}
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/enums/ErrorCodeConstants.java
View file @
a6abc1df
...
...
@@ -20,6 +20,7 @@ public interface ErrorCodeConstants {
ErrorCode
CUSTOMER_ORDER_OUT_ERROR
=
new
ErrorCode
(
1_019_100_006
,
"客户订单出库环节异常"
);
ErrorCode
CUSTOMER_ORDER_RETURN_PRODUCT_ERROR
=
new
ErrorCode
(
1_019_100_006
,
"客户订单退货商品异常"
);
ErrorCode
CUSTOMER_ORDER_RETURN_COUNT_ERROR
=
new
ErrorCode
(
1_019_100_007
,
"商品{}退货数量异常"
);
ErrorCode
CUSTOMER_ORDER_HAS_RECEIPT
=
new
ErrorCode
(
1_019_100_006
,
"客户订单已评价"
);
// ========== 客户订单-子订单 1_020_100_0001 ==========
ErrorCode
CUSTOMER_ORDER_ITEM_NOT_EXISTS
=
new
ErrorCode
(
1_020_100_001
,
"客户订单-子订单不存在"
);
...
...
@@ -35,6 +36,7 @@ public interface ErrorCodeConstants {
ErrorCode
CHECK_TASK_NOT_EXISTS
=
new
ErrorCode
(
1_023_100_001
,
"来料质检不存在"
);
ErrorCode
CHECK_TASK_CREATE_ERROR
=
new
ErrorCode
(
1_023_100_002
,
"来料质检新增失败"
);
ErrorCode
CHECK_TASK_STATUS_ERROR
=
new
ErrorCode
(
1_023_100_003
,
"来料质检已质检"
);
ErrorCode
CHECK_TASK_TO_BE_CHECK
=
new
ErrorCode
(
1_023_100_003
,
"请先完成质检"
);
// ========== 订单评价 1_024_100_001 ==========
ErrorCode
SCORE_NOT_EXISTS
=
new
ErrorCode
(
1_024_100_001
,
"订单评价不存在"
);
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/service/checktask/CheckTaskService.java
View file @
a6abc1df
...
...
@@ -64,4 +64,7 @@ public interface CheckTaskService {
* @param updateReqVO
*/
void
check
(
CheckTaskCheckReqVO
updateReqVO
);
CheckTaskSupplierScoreRespVO
queryScore
(
Long
id
);
}
\ No newline at end of file
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/service/checktask/CheckTaskServiceImpl.java
View file @
a6abc1df
package
cn
.
iocoder
.
foodnexus
.
module
.
order
.
service
.
checktask
;
import
cn.iocoder.foodnexus.framework.common.enums.UserSystemEnum
;
import
cn.iocoder.foodnexus.framework.common.util.CommonUtil
;
import
cn.iocoder.foodnexus.framework.common.util.spring.SpringUtils
;
import
cn.iocoder.foodnexus.framework.security.core.util.SecurityFrameworkUtils
;
...
...
@@ -10,10 +11,14 @@ import cn.iocoder.foodnexus.module.erp.dal.dataobject.purchase.ErpPurchaseOrderI
import
cn.iocoder.foodnexus.module.erp.dal.mysql.purchase.ErpPurchaseOrderMapper
;
import
cn.iocoder.foodnexus.module.erp.service.purchase.ErpPurchaseOrderService
;
import
cn.iocoder.foodnexus.module.erp.service.sale.ErpSaleOrderService
;
import
cn.iocoder.foodnexus.module.operations.dal.dataobject.scoringweight.ScoringWeightDO
;
import
cn.iocoder.foodnexus.module.operations.service.scoringweight.ScoringWeightService
;
import
cn.iocoder.foodnexus.module.order.api.CheckTaskApi
;
import
cn.iocoder.foodnexus.module.order.api.CustomerOrderRecordApi
;
import
cn.iocoder.foodnexus.module.order.controller.admin.orderScore.vo.OrderScoreSaveReqVO
;
import
cn.iocoder.foodnexus.module.order.dal.dataobject.checktaskitems.CheckTaskItemsDO
;
import
cn.iocoder.foodnexus.module.order.dal.dataobject.customerorder.CustomerOrderDO
;
import
cn.iocoder.foodnexus.module.order.dal.dataobject.customerorderitem.CustomerOrderItemDO
;
import
cn.iocoder.foodnexus.module.order.dal.mysql.checktaskitems.CheckTaskItemsMapper
;
import
cn.iocoder.foodnexus.module.order.dto.CheckTaskCreateEvent
;
import
cn.iocoder.foodnexus.module.order.dto.CustomerOrderRecordEvent
;
...
...
@@ -21,10 +26,12 @@ import cn.iocoder.foodnexus.module.order.enums.CheckTaskStatus;
import
cn.iocoder.foodnexus.module.order.enums.CustomerOrderStatus
;
import
cn.iocoder.foodnexus.module.order.service.checktaskitems.CheckTaskItemsService
;
import
cn.iocoder.foodnexus.module.order.service.customerorder.CustomerOrderService
;
import
cn.iocoder.foodnexus.module.order.service.orderScore.OrderScoreService
;
import
cn.iocoder.foodnexus.module.product.dal.dataobject.spu.ProductSpuDO
;
import
cn.iocoder.foodnexus.module.product.service.category.ProductCategoryService
;
import
cn.iocoder.foodnexus.module.product.service.spu.ProductSpuService
;
import
cn.iocoder.foodnexus.module.system.util.GenCodeUtils
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
jakarta.annotation.PostConstruct
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -97,6 +104,12 @@ public class CheckTaskServiceImpl implements CheckTaskService, CheckTaskApi {
private
ErpSaleOrderService
saleOrderService
;
@Autowired
private
ScoringWeightService
scoringWeightService
;
@Autowired
private
OrderScoreService
orderScoreService
;
@Autowired
private
GenCodeUtils
genCodeUtils
;
@Override
...
...
@@ -172,13 +185,17 @@ public class CheckTaskServiceImpl implements CheckTaskService, CheckTaskApi {
throw
exception
(
CHECK_TASK_STATUS_ERROR
);
}
checkTaskMapper
.
update
(
Wrappers
.<
CheckTaskDO
>
lambdaUpdate
()
LambdaUpdateWrapper
<
CheckTaskDO
>
updateWrapper
=
Wrappers
.<
CheckTaskDO
>
lambdaUpdate
()
.
set
(
CheckTaskDO:
:
getRemark
,
updateReqVO
.
getRemark
())
.
set
(
CheckTaskDO:
:
getFiles
,
updateReqVO
.
getFiles
())
.
set
(
CheckTaskDO:
:
getCheckTime
,
LocalDateTime
.
now
())
.
set
(
CheckTaskDO:
:
getCheckUserId
,
SecurityFrameworkUtils
.
getLoginUserId
())
.
set
(
CheckTaskDO:
:
getStatus
,
updateReqVO
.
getStatus
())
.
eq
(
CheckTaskDO:
:
getId
,
updateReqVO
.
getId
()));
.
eq
(
CheckTaskDO:
:
getId
,
updateReqVO
.
getId
());
if
(
CommonUtil
.
isNotEmpty
(
updateReqVO
.
getScore
())
&&
CommonUtil
.
isNotBlank
(
updateReqVO
.
getScore
().
getScoreRemark
()))
{
updateWrapper
.
set
(
CheckTaskDO:
:
getScoreRemark
,
updateReqVO
.
getScore
().
getScoreRemark
());
}
checkTaskMapper
.
update
(
updateWrapper
);
List
<
CheckTaskItemsDO
>
updateItems
=
BeanUtils
.
toBean
(
updateReqVO
.
getItems
(),
CheckTaskItemsDO
.
class
);
checkTaskItemsMapper
.
updateById
(
updateItems
);
...
...
@@ -205,6 +222,50 @@ public class CheckTaskServiceImpl implements CheckTaskService, CheckTaskApi {
event
.
setCopyWriter
(
CommonUtil
.
asList
(
warehouseName
,
updateReqVO
.
getFiles
()));
orderRecordApi
.
recordEvent
(
event
);
}
if
(
CommonUtil
.
isNotEmpty
(
updateReqVO
.
getScore
()))
{
this
.
score
(
checkTaskDO
,
updateReqVO
.
getScore
());
}
}
@Override
public
CheckTaskSupplierScoreRespVO
queryScore
(
Long
id
)
{
CheckTaskSupplierScoreRespVO
result
=
new
CheckTaskSupplierScoreRespVO
();
CheckTaskDO
checkTask
=
this
.
getCheckTask
(
id
);
if
(
CommonUtil
.
isEmpty
(
checkTask
))
{
throw
exception
(
CHECK_TASK_NOT_EXISTS
);
}
result
.
setRemark
(
checkTask
.
getRemark
());
List
<
ScoringWeightDO
>
scoringWeightDOS
=
scoringWeightService
.
queryByUserSystem
(
UserSystemEnum
.
OPER
);
result
.
setItems
(
CommonUtil
.
listConvert
(
scoringWeightDOS
,
item
->
{
CheckTaskSupplierScoreRespVO
.
Item
resultItem
=
new
CheckTaskSupplierScoreRespVO
.
Item
();
resultItem
.
setScoreId
(
item
.
getId
());
resultItem
.
setScoreName
(
item
.
getScoreName
());
resultItem
.
setScore
(
orderScoreService
.
queryScore
(
id
,
item
.
getId
()));
return
resultItem
;
}));
return
result
;
}
public
void
score
(
CheckTaskDO
checkTaskDO
,
CheckTaskSupplierScoreReqVO
reqVO
)
{
Long
id
=
checkTaskDO
.
getId
();
if
(
CommonUtil
.
isNotEmpty
(
reqVO
.
getItems
()))
{
reqVO
.
getItems
().
forEach
(
item
->
{
if
(!
orderScoreService
.
exists
(
id
,
item
.
getScoreId
()))
{
ScoringWeightDO
scoringWeight
=
scoringWeightService
.
getScoringWeight
(
item
.
getScoreId
());
OrderScoreSaveReqVO
saveReqVO
=
new
OrderScoreSaveReqVO
();
saveReqVO
.
setOrderId
(
id
);
saveReqVO
.
setScoreId
(
item
.
getScoreId
());
saveReqVO
.
setScoreName
(
scoringWeight
.
getScoreName
());
saveReqVO
.
setSupplierId
(
checkTaskDO
.
getSupplierId
());
saveReqVO
.
setCustomerId
(
checkTaskDO
.
getCustomerId
());
saveReqVO
.
setScore
(
item
.
getScore
());
saveReqVO
.
setSort
(
scoringWeight
.
getSort
());
orderScoreService
.
createScore
(
saveReqVO
);
}
});
}
}
@Override
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/service/customerorder/CustomerOrderService.java
View file @
a6abc1df
...
...
@@ -130,5 +130,16 @@ public interface CustomerOrderService {
*/
AppCustomerMonthOrderTotalRespVO
monthTotal
(
String
yearMonth
);
/**
* 对账确认
* @param reqVO
*/
void
reconciliationConfirm
(
AppCustomerOrderReconciliationReqVO
reqVO
);
/**
* 查询退款
* @param id
* @return
*/
AppCustomerOrderReturnRespVO
queryReturn
(
Long
id
);
}
\ No newline at end of file
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/service/customerorder/CustomerOrderServiceImpl.java
View file @
a6abc1df
...
...
@@ -11,10 +11,7 @@ import cn.iocoder.foodnexus.module.erp.api.service.ErpCustomerApi;
import
cn.iocoder.foodnexus.module.erp.api.service.ErpSupplierApi
;
import
cn.iocoder.foodnexus.module.erp.api.service.ErpWarehouseApi
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.returns.ErpSaleReturnSaveReqVO
;
import
cn.iocoder.foodnexus.module.erp.dal.dataobject.sale.ErpSaleOrderDO
;
import
cn.iocoder.foodnexus.module.erp.dal.dataobject.sale.ErpSaleOrderItemDO
;
import
cn.iocoder.foodnexus.module.erp.dal.dataobject.sale.ErpSaleOutDO
;
import
cn.iocoder.foodnexus.module.erp.dal.dataobject.sale.ErpSaleOutItemDO
;
import
cn.iocoder.foodnexus.module.erp.dal.dataobject.sale.*
;
import
cn.iocoder.foodnexus.module.erp.service.customerwarehouse.CustomerWarehouseService
;
import
cn.iocoder.foodnexus.module.erp.service.purchase.ErpPurchaseOrderServiceImpl
;
import
cn.iocoder.foodnexus.module.erp.service.sale.ErpSaleOrderService
;
...
...
@@ -39,6 +36,7 @@ import cn.iocoder.foodnexus.module.order.service.orderScore.OrderScoreService;
import
cn.iocoder.foodnexus.module.product.api.InquireCustomerApi
;
import
cn.iocoder.foodnexus.module.product.api.dto.CustomerVisibleProductRespDTO
;
import
cn.iocoder.foodnexus.module.product.api.dto.ProductInfo
;
import
cn.iocoder.foodnexus.module.product.dal.dataobject.spu.ProductSpuDO
;
import
cn.iocoder.foodnexus.module.product.service.spu.ProductSpuService
;
import
cn.iocoder.foodnexus.module.system.dal.dataobject.user.AdminUserDO
;
import
cn.iocoder.foodnexus.module.system.service.user.AdminUserService
;
...
...
@@ -517,22 +515,25 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
if
(
CommonUtil
.
isEmpty
(
customerOrder
))
{
throw
exception
(
CUSTOMER_ORDER_NOT_EXISTS
);
}
if
(
!
customerOrder
.
getOrderStatus
().
equals
(
CustomerOrderStatus
.
SIGN_RECEIPT
))
{
throw
exception
(
CUSTOMER_ORDER_
STATUS_ERROR
);
if
(
CommonUtil
.
isNotEmpty
(
customerOrder
.
getHasScore
())
&&
customerOrder
.
getHasScore
(
))
{
throw
exception
(
CUSTOMER_ORDER_
HAS_RECEIPT
);
}
if
(
CommonUtil
.
isNotEmpty
(
reqVO
.
getItems
()))
{
reqVO
.
getItems
().
forEach
(
item
->
{
if
(!
orderScoreService
.
exists
(
id
,
item
.
getScoreId
()))
{
ScoringWeightDO
scoringWeight
=
scoringWeightService
.
getScoringWeight
(
item
.
getScoreId
());
OrderScoreSaveReqVO
saveReqVO
=
new
OrderScoreSaveReqVO
();
saveReqVO
.
setOrderId
(
id
);
saveReqVO
.
setScoreId
(
item
.
getScoreId
());
saveReqVO
.
setScoreName
(
scoringWeight
.
getScoreName
());
saveReqVO
.
setSupplierIds
(
CommonUtil
.
listConvertSet
(
customerOrderItemMapper
.
selectList
(
CustomerOrderItemDO:
:
getOrderId
,
id
),
CustomerOrderItemDO:
:
getSupplierId
));
saveReqVO
.
setCustomerId
(
customerOrder
.
getCustomerId
());
saveReqVO
.
setScore
(
item
.
getScore
());
saveReqVO
.
setSort
(
scoringWeight
.
getSort
());
orderScoreService
.
createScore
(
saveReqVO
);
Set
<
Long
>
supplierIds
=
CommonUtil
.
listConvertSet
(
customerOrderItemMapper
.
selectList
(
CustomerOrderItemDO:
:
getOrderId
,
id
),
CustomerOrderItemDO:
:
getSupplierId
);
for
(
Long
supplierId
:
supplierIds
)
{
OrderScoreSaveReqVO
saveReqVO
=
new
OrderScoreSaveReqVO
();
saveReqVO
.
setOrderId
(
id
);
saveReqVO
.
setScoreId
(
item
.
getScoreId
());
saveReqVO
.
setScoreName
(
scoringWeight
.
getScoreName
());
saveReqVO
.
setSupplierId
(
supplierId
);
saveReqVO
.
setCustomerId
(
customerOrder
.
getCustomerId
());
saveReqVO
.
setScore
(
item
.
getScore
());
saveReqVO
.
setSort
(
scoringWeight
.
getSort
());
orderScoreService
.
createScore
(
saveReqVO
);
}
}
else
{
throw
exception
(
SCORE_EXISTS
);
}
...
...
@@ -545,11 +546,10 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
.
set
(
CustomerOrderDO:
:
getOrderRemark
,
reqVO
.
getOrderRemark
()));
}
// TODO 待替换 订单记录
CustomerOrderRecordEvent
event
=
new
CustomerOrderRecordEvent
();
event
.
setOrderStatus
(
CustomerOrderStatus
.
FINISH
);
event
.
setCustomerOrderId
(
id
);
orderRecordApi
.
recordEvent
(
event
);
CustomerOrderDO
updateScore
=
new
CustomerOrderDO
();
updateScore
.
setId
(
id
);
updateScore
.
setHasScore
(
Boolean
.
TRUE
);
customerOrderMapper
.
updateById
(
updateScore
);
}
@Override
...
...
@@ -609,6 +609,49 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
}
/**
* 查询退款
*
* @param id
* @return
*/
@Override
public
AppCustomerOrderReturnRespVO
queryReturn
(
Long
id
)
{
AppCustomerOrderReturnRespVO
result
=
new
AppCustomerOrderReturnRespVO
();
CustomerOrderDO
customerOrder
=
getCustomerOrder
(
id
);
if
(
CommonUtil
.
isEmpty
(
customerOrder
))
{
throw
exception
(
CUSTOMER_ORDER_NOT_EXISTS
);
}
if
(!
customerOrder
.
getOrderStatus
().
equals
(
CustomerOrderStatus
.
RETURN
))
{
throw
exception
(
CUSTOMER_ORDER_STATUS_ERROR
);
}
ErpSaleReturnDO
saleReturn
=
saleReturnService
.
queryByCustomerOrderId
(
id
);
if
(
CommonUtil
.
isEmpty
(
saleReturn
))
{
return
result
;
}
result
.
setSaleReturnId
(
saleReturn
.
getId
());
result
.
setTotalReturnPrice
(
saleReturn
.
getTotalPrice
());
result
.
setRemark
(
saleReturn
.
getRemark
());
result
.
setRemarkFiles
(
saleReturn
.
getFilesUrl
());
List
<
ErpSaleReturnItemDO
>
returnItems
=
saleReturnService
.
getSaleReturnItemListByReturnId
(
saleReturn
.
getId
());
List
<
CustomerOrderItemDO
>
customerOrderItems
=
customerOrderItemMapper
.
selectList
(
CustomerOrderItemDO:
:
getOrderId
,
id
);
Map
<
Long
,
CustomerOrderItemDO
>
orderItemMap
=
CommonUtil
.
listConvertMap
(
customerOrderItems
,
CustomerOrderItemDO:
:
getId
);
result
.
setReturnItems
(
CommonUtil
.
listConvert
(
returnItems
,
item
->
{
CustomerOrderItemDO
customerOrderItemDO
=
orderItemMap
.
get
(
item
.
getCustomerOrderItemId
());
AppCustomerOrderReturnRespVO
.
ReturnItems
returnItem
=
new
AppCustomerOrderReturnRespVO
.
ReturnItems
();
returnItem
.
setProductId
(
item
.
getProductId
());
returnItem
.
setCustomerOrderItemId
(
customerOrderItemDO
.
getId
());
returnItem
.
setProductInfo
(
customerOrderItemDO
.
getProductInfo
());
returnItem
.
setOrderItemPrice
(
customerOrderItemDO
.
getOrderItemPrice
());
returnItem
.
setReturnCount
(
item
.
getCount
());
returnItem
.
setReturnPrice
(
item
.
getProductPrice
());
returnItem
.
setTotalReturnPrice
(
item
.
getTotalPrice
());
returnItem
.
setRemark
(
item
.
getRemark
());
return
returnItem
;
}));
return
result
;
}
/**
* {@link ErpPurchaseOrderServiceImpl#orderSplit(PurchaseOrderSplitEvent)}
*/
private
void
orderSplitPurchase
(
Long
customerOrderId
)
{
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/service/orderScore/OrderScoreService.java
View file @
a6abc1df
...
...
@@ -59,8 +59,9 @@ public interface OrderScoreService {
*/
PageResult
<
OrderScoreDO
>
getScorePage
(
OrderScorePageReqVO
pageReqVO
);
Integer
queryScore
(
Long
customerO
rderId
,
Long
scoreId
);
Integer
queryScore
(
Long
o
rderId
,
Long
scoreId
);
boolean
exists
(
Long
customerO
rderId
,
Long
scoreId
);
boolean
exists
(
Long
o
rderId
,
Long
scoreId
);
PageResult
<
OrderScoreSupplierRespVO
>
supplierPage
(
OrderScoreSupplierPageReqVO
pageReqVO
);
}
\ No newline at end of file
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/service/orderScore/OrderScoreServiceImpl.java
View file @
a6abc1df
package
cn
.
iocoder
.
foodnexus
.
module
.
order
.
service
.
orderScore
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.iocoder.foodnexus.framework.common.pojo.CommonResult
;
import
cn.iocoder.foodnexus.framework.common.util.CommonUtil
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.purchase.vo.supplier.ErpSupplierPageReqVO
;
import
cn.iocoder.foodnexus.module.erp.dal.dataobject.purchase.ErpSupplierDO
;
import
cn.iocoder.foodnexus.module.erp.service.purchase.ErpSupplierService
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
jakarta.annotation.Resource
;
import
org.springframework.validation.annotation.Validated
;
...
...
@@ -33,6 +39,9 @@ public class OrderScoreServiceImpl implements OrderScoreService {
@Resource
private
OrderScoreMapper
scoreMapper
;
@Autowired
private
ErpSupplierService
supplierService
;
@Override
public
Long
createScore
(
OrderScoreSaveReqVO
createReqVO
)
{
// 插入
...
...
@@ -98,4 +107,14 @@ public class OrderScoreServiceImpl implements OrderScoreService {
.
eq
(
OrderScoreDO:
:
getScoreId
,
scoreId
));
}
@Override
public
PageResult
<
OrderScoreSupplierRespVO
>
supplierPage
(
OrderScoreSupplierPageReqVO
pageReqVO
)
{
PageResult
<
ErpSupplierDO
>
supplierPage
=
supplierService
.
getSupplierPage
(
BeanUtils
.
toBean
(
pageReqVO
,
ErpSupplierPageReqVO
.
class
));
if
(
CommonUtil
.
isNotEmpty
(
supplierPage
.
getList
()))
{
Set
<
Long
>
supplierIds
=
CommonUtil
.
listConvertSet
(
supplierPage
.
getList
(),
ErpSupplierDO:
:
getId
);
// scoreMapper.
}
return
null
;
}
}
\ No newline at end of file
foodnexus-module-mall/foodnexus-module-product/src/main/java/cn/iocoder/foodnexus/module/product/controller/app/spu/vo/AppProductSpuDetailRespVO.java
View file @
a6abc1df
...
...
@@ -4,6 +4,7 @@ import cn.iocoder.foodnexus.module.product.controller.app.property.vo.value.AppP
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.util.List
;
@Schema
(
description
=
"用户 App - 商品 SPU 明细 Response VO"
)
...
...
@@ -39,5 +40,11 @@ public class AppProductSpuDetailRespVO {
@Schema
(
description
=
"商品单位"
)
private
String
unitName
;
@Schema
(
description
=
"市场价"
)
private
Integer
marketPrice
;
@Schema
(
description
=
"下浮率(%)"
)
private
BigDecimal
discount
;
}
foodnexus-module-mall/foodnexus-module-product/src/main/java/cn/iocoder/foodnexus/module/product/controller/app/spu/vo/AppProductSpuRespVO.java
View file @
a6abc1df
package
cn
.
iocoder
.
foodnexus
.
module
.
product
.
controller
.
app
.
spu
.
vo
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.util.List
;
@Schema
(
description
=
"用户 App - 商品 SPU Response VO"
)
...
...
@@ -33,4 +35,10 @@ public class AppProductSpuRespVO {
@Schema
(
description
=
"商品单位"
)
private
String
unitName
;
@Schema
(
description
=
"市场价"
)
private
Integer
marketPrice
;
@Schema
(
description
=
"下浮率(%)"
)
private
BigDecimal
discount
;
}
foodnexus-module-mall/foodnexus-module-product/src/main/java/cn/iocoder/foodnexus/module/product/dal/dataobject/spu/ProductSpuDO.java
View file @
a6abc1df
...
...
@@ -14,6 +14,7 @@ import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.*
;
import
java.math.BigDecimal
;
import
java.time.LocalDateTime
;
import
java.util.List
;
...
...
@@ -127,4 +128,16 @@ public class ProductSpuDO extends BaseDO {
@TableField
(
exist
=
false
)
private
Integer
supplierQuote
;
/**
* 市场价
*/
@TableField
(
exist
=
false
)
private
Integer
marketPrice
;
/**
* 下浮率(%)
*/
@TableField
(
exist
=
false
)
private
BigDecimal
discount
;
}
foodnexus-module-system/src/main/java/cn/iocoder/foodnexus/module/system/annotations/AutoSetPrice.java
View file @
a6abc1df
...
...
@@ -26,4 +26,16 @@ public @interface AutoSetPrice {
*/
String
priceField
()
default
"supplierQuote"
;
/**
* 对象中的市场价字段(int类型)
* @return
*/
String
marketPriceFiled
()
default
"marketPrice"
;
/**
* 对象中的下浮率字段(BigDecimal类型)
* @return
*/
String
discountFiled
()
default
"discount"
;
}
foodnexus-module-system/src/main/java/cn/iocoder/foodnexus/module/system/aspect/AutoSetPriceAspect.java
View file @
a6abc1df
...
...
@@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Component
;
import
java.lang.reflect.Field
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -118,7 +119,15 @@ public class AutoSetPriceAspect {
Integer
supplierQuote
=
priceDataList
.
stream
().
filter
(
item
->
item
.
getProductId
().
equals
(
id
)).
findFirst
()
.
orElseThrow
(()
->
new
ServiceException
(
CUSTOMER_PRODUCT_CUSTOMER_ERROR
))
.
getSupplierQuote
();
Integer
marketPrice
=
priceDataList
.
stream
().
filter
(
item
->
item
.
getProductId
().
equals
(
id
)).
findFirst
()
.
orElseThrow
(()
->
new
ServiceException
(
CUSTOMER_PRODUCT_CUSTOMER_ERROR
))
.
getMarketPrice
();
BigDecimal
discount
=
priceDataList
.
stream
().
filter
(
item
->
item
.
getProductId
().
equals
(
id
)).
findFirst
()
.
orElseThrow
(()
->
new
ServiceException
(
CUSTOMER_PRODUCT_CUSTOMER_ERROR
))
.
getFloatingRate
();
setPrice
(
obj
,
autoSetPrice
,
supplierQuote
);
setMarketPrice
(
obj
,
autoSetPrice
,
marketPrice
);
setDiscount
(
obj
,
autoSetPrice
,
discount
);
}
}
}
...
...
@@ -129,7 +138,15 @@ public class AutoSetPriceAspect {
Integer
supplierQuote
=
priceDataList
.
stream
().
filter
(
item
->
item
.
getProductId
().
equals
(
id
)).
findFirst
()
.
orElseThrow
(()
->
new
ServiceException
(
CUSTOMER_PRODUCT_CUSTOMER_ERROR
))
.
getSupplierQuote
();
Integer
marketPrice
=
priceDataList
.
stream
().
filter
(
item
->
item
.
getProductId
().
equals
(
id
)).
findFirst
()
.
orElseThrow
(()
->
new
ServiceException
(
CUSTOMER_PRODUCT_CUSTOMER_ERROR
))
.
getMarketPrice
();
BigDecimal
discount
=
priceDataList
.
stream
().
filter
(
item
->
item
.
getProductId
().
equals
(
id
)).
findFirst
()
.
orElseThrow
(()
->
new
ServiceException
(
CUSTOMER_PRODUCT_CUSTOMER_ERROR
))
.
getFloatingRate
();
setPrice
(
obj
,
autoSetPrice
,
supplierQuote
);
setMarketPrice
(
obj
,
autoSetPrice
,
marketPrice
);
setDiscount
(
obj
,
autoSetPrice
,
discount
);
}
/** 获取 productId,并做类型校验 */
...
...
@@ -170,10 +187,51 @@ public class AutoSetPriceAspect {
field
.
set
(
obj
,
value
);
}
catch
(
NoSuchFieldException
e
)
{
log
.
error
(
"未找到字段: "
+
autoSetPrice
.
priceField
(),
e
);
throw
exception
(
"未找到字段: "
+
autoSetPrice
.
priceField
());
//
throw exception("未找到字段: " + autoSetPrice.priceField());
}
catch
(
Exception
e
)
{
throw
exception
(
CUSTOMER_PRODUCT_CUSTOMER_ERROR
);
//
throw exception(CUSTOMER_PRODUCT_CUSTOMER_ERROR);
}
}
private
void
setDiscount
(
Object
obj
,
AutoSetPrice
autoSetPrice
,
BigDecimal
discount
)
{
try
{
Field
field
=
obj
.
getClass
().
getDeclaredField
(
autoSetPrice
.
discountFiled
());
field
.
setAccessible
(
true
);
if
(!
field
.
getType
().
equals
(
BigDecimal
.
class
))
{
log
.
error
(
String
.
format
(
"字段 %s 必须是 int/Integer 类型,实际是 %s"
,
autoSetPrice
.
discountFiled
(),
field
.
getType
().
getSimpleName
()));
throw
exception
(
String
.
format
(
"字段 %s 必须是 int/Integer 类型,实际是 %s"
,
autoSetPrice
.
discountFiled
(),
field
.
getType
().
getSimpleName
())
);
}
field
.
set
(
obj
,
discount
);
}
catch
(
NoSuchFieldException
e
)
{
log
.
error
(
"未找到字段: "
+
autoSetPrice
.
priceField
(),
e
);
// throw exception("未找到字段: " + autoSetPrice.priceField());
}
catch
(
Exception
e
)
{
// throw exception(CUSTOMER_PRODUCT_CUSTOMER_ERROR);
}
}
private
void
setMarketPrice
(
Object
obj
,
AutoSetPrice
autoSetPrice
,
Integer
marketPrice
)
{
try
{
Field
field
=
obj
.
getClass
().
getDeclaredField
(
autoSetPrice
.
marketPriceFiled
());
field
.
setAccessible
(
true
);
if
(!
field
.
getType
().
equals
(
Integer
.
class
)
&&
!
field
.
getType
().
equals
(
int
.
class
))
{
log
.
error
(
String
.
format
(
"字段 %s 必须是 int/Integer 类型,实际是 %s"
,
autoSetPrice
.
marketPriceFiled
(),
field
.
getType
().
getSimpleName
()));
throw
exception
(
String
.
format
(
"字段 %s 必须是 int/Integer 类型,实际是 %s"
,
autoSetPrice
.
marketPriceFiled
(),
field
.
getType
().
getSimpleName
())
);
}
field
.
set
(
obj
,
marketPrice
);
}
catch
(
NoSuchFieldException
e
)
{
log
.
error
(
"未找到字段: "
+
autoSetPrice
.
priceField
(),
e
);
// throw exception("未找到字段: " + autoSetPrice.priceField());
}
catch
(
Exception
e
)
{
// throw exception(CUSTOMER_PRODUCT_CUSTOMER_ERROR);
}
}
}
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