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
cc58b6b0
Commit
cc58b6b0
authored
Nov 11, 2025
by
杨浩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug调整
parent
3f54bac9
Hide whitespace changes
Inline
Side-by-side
Showing
58 changed files
with
528 additions
and
65 deletions
+528
-65
foodnexus-framework/foodnexus-common/src/main/java/cn/iocoder/foodnexus/framework/common/pojo/PageParam.java
+1
-1
foodnexus-framework/foodnexus-spring-boot-starter-biz-customer-permission/src/main/java/cn/iocoder/foodnexus/module/customerpermission/core/rule/customer/CustomerVisiblePermissionRule.java
+11
-11
foodnexus-framework/foodnexus-spring-boot-starter-redis/src/main/java/cn/iocoder/foodnexus/framework/redis/config/FoodnexusCacheAutoConfiguration.java
+2
-0
foodnexus-framework/foodnexus-spring-boot-starter-redis/src/main/java/cn/iocoder/foodnexus/framework/redis/config/FoodnexusRedisAutoConfiguration.java
+3
-1
foodnexus-module-erp-api/src/main/java/cn/iocoder/foodnexus/module/erp/api/service/ErpCustomerApi.java
+6
-0
foodnexus-module-erp-api/src/main/java/cn/iocoder/foodnexus/module/erp/api/vo/customer/DeptSimpleDTO.java
+17
-0
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/purchase/ErpPurchaseOrderController.java
+7
-5
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/purchase/ErpPurchaseReturnController.java
+1
-0
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/purchase/vo/order/ErpPurchaseOrderRespVO.java
+2
-2
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/sale/ErpSaleReturnController.java
+14
-4
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/sale/vo/order/DeliveryMyCountRespVO.java
+2
-2
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/sale/vo/order/DeliveryOrderPageReqVO.java
+4
-0
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/sale/vo/out/ErpSaleOutRespVO.java
+3
-0
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/sale/vo/returns/ErpSaleReturnRespVO.java
+16
-0
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/dal/dataobject/sale/ErpSaleReturnDO.java
+6
-0
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/dal/mysql/purchase/ErpPurchaseOrderMapper.java
+1
-0
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/dal/mysql/purchase/ErpPurchaseReturnMapper.java
+1
-0
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/dal/mysql/sale/ErpSaleOrderMapper.java
+2
-2
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/enums/ErrorCodeConstants.java
+1
-0
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/service/sale/ErpCustomerServiceImpl.java
+48
-3
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/service/sale/ErpSaleOutServiceImpl.java
+4
-2
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/service/sale/ErpSaleReturnService.java
+6
-3
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/service/sale/ErpSaleReturnServiceImpl.java
+45
-2
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/controller/admin/customerrequire/vo/CustomerRequireRespVO.java
+3
-0
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/controller/app/customerrequire/AppCustomerRequireController.java
+13
-2
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/service/inquirecustomerpush/InquireCustomerPushServiceImpl.java
+1
-1
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/service/inquiresupplierpush/InquireSupplierPushServiceImpl.java
+1
-1
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/service/scoringweight/ScoringWeightServiceImpl.java
+2
-2
foodnexus-module-mall/foodnexus-module-order-api/src/main/java/cn/iocoder/foodnexus/module/order/api/CustomerOrderApi.java
+2
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/checktask/vo/CheckTaskItemsSaveReqVO.java
+1
-1
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/customerorder/vo/CustomerOrderPageReqVO.java
+7
-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/app/customerOrder/AppCustomerOrderController.java
+11
-1
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/customerOrder/AppCustomerOrderReconciliationController.java
+9
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/customerOrder/vo/AppCustomerOrderReceiptRespVO.java
+3
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/customerOrder/vo/AppCustomerOrderReturnRespVO.java
+3
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/delivery/DeliverySaleOrderController.java
+30
-1
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/delivery/DeliverySaleReturnController.java
+23
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/delivery/vo/DeliveryOrderArrivalDetails.java
+33
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/shoppingcart/ShoppingCartController.java
+4
-1
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/shoppingcart/vo/ShoppingCartRespVO.java
+4
-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/mysql/customerorder/CustomerOrderMapper.java
+10
-4
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/CheckTaskServiceImpl.java
+1
-1
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/service/customerorder/CustomerOrderServiceImpl.java
+41
-6
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/service/shoppingcart/ShoppingCartServiceImpl.java
+22
-0
foodnexus-module-mall/foodnexus-module-product/src/main/java/cn/iocoder/foodnexus/module/product/controller/app/spu/AppProductSpuController.java
+9
-0
foodnexus-module-mall/foodnexus-module-product/src/main/java/cn/iocoder/foodnexus/module/product/controller/app/spu/vo/AppProductSpuDetailRespVO.java
+8
-0
foodnexus-module-mall/foodnexus-module-product/src/main/java/cn/iocoder/foodnexus/module/product/controller/app/spu/vo/AppProductSpuRespVO.java
+9
-0
foodnexus-module-mall/foodnexus-module-product/src/main/java/cn/iocoder/foodnexus/module/product/controller/app/spu/vo/AppProductSpuStatusRespVO.java
+23
-0
foodnexus-module-mall/foodnexus-module-product/src/main/java/cn/iocoder/foodnexus/module/product/service/category/ProductCategoryService.java
+4
-0
foodnexus-module-mall/foodnexus-module-product/src/main/java/cn/iocoder/foodnexus/module/product/service/spu/ProductSpuService.java
+4
-0
foodnexus-module-mall/foodnexus-module-product/src/main/java/cn/iocoder/foodnexus/module/product/service/spu/ProductSpuServiceImpl.java
+17
-1
foodnexus-module-system/src/main/java/cn/iocoder/foodnexus/module/system/dal/redis/RedisKeyConstants.java
+6
-0
foodnexus-module-system/src/main/java/cn/iocoder/foodnexus/module/system/service/dept/DeptServiceImpl.java
+4
-4
foodnexus-module-system/src/main/java/cn/iocoder/foodnexus/module/system/service/user/AdminUserServiceImpl.java
+5
-0
foodnexus-server/src/main/resources/application-local.yaml
+1
-1
No files found.
foodnexus-framework/foodnexus-common/src/main/java/cn/iocoder/foodnexus/framework/common/pojo/PageParam.java
View file @
cc58b6b0
...
...
@@ -29,7 +29,7 @@ public class PageParam implements Serializable {
@Schema
(
description
=
"每页条数,最大值为 100"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"10"
)
@NotNull
(
message
=
"每页条数不能为空"
)
@Min
(
value
=
1
,
message
=
"每页条数最小值为 1"
)
//
@Min(value = 1, message = "每页条数最小值为 1")
@Max
(
value
=
100
,
message
=
"每页条数最大值为 100"
)
private
Integer
pageSize
=
PAGE_SIZE
;
...
...
foodnexus-framework/foodnexus-spring-boot-starter-biz-customer-permission/src/main/java/cn/iocoder/foodnexus/module/customerpermission/core/rule/customer/CustomerVisiblePermissionRule.java
View file @
cc58b6b0
...
...
@@ -67,19 +67,19 @@ public class CustomerVisiblePermissionRule implements CustomerPermissionRule {
}
// 获得数据权限
CustomerVisibleProductRespDTO
customerVisibleDto
=
loginUser
.
getContext
(
CONTEXT_KEY
,
CustomerVisibleProductRespDTO
.
class
);
/*
CustomerVisibleProductRespDTO customerVisibleDto = loginUser.getContext(CONTEXT_KEY, CustomerVisibleProductRespDTO.class);
// 从上下文中拿不到,则调用逻辑进行获取
if
(
customerVisibleDto
==
null
)
{
Long
customerId
=
customerApi
.
queryCustomerIdByUserId
(
loginUser
.
getId
());
customerVisibleDto
=
inquireCustomerApi
.
queryCustomerIdByCustomerId
(
customerId
);
if
(
customerVisibleDto
==
null
||
CommonUtil
.
isEmpty
(
customerVisibleDto
.
getItems
()))
{
log
.
error
(
"[getExpression][LoginUser({}) 获取数据权限为 null]"
,
JsonUtils
.
toJsonString
(
loginUser
));
throw
new
NullPointerException
(
String
.
format
(
"LoginUser(%d) Table(%s/%s) 未返回数据权限"
,
loginUser
.
getId
(),
tableName
,
tableAlias
.
getName
()));
}
// 添加到上下文中,避免重复计算
loginUser
.
setContext
(
CONTEXT_KEY
,
customerVisibleDto
);
if (customerVisibleDto == null) {*/
Long
customerId
=
customerApi
.
queryCustomerIdByUserId
(
loginUser
.
getId
());
CustomerVisibleProductRespDTO
customerVisibleDto
=
inquireCustomerApi
.
queryCustomerIdByCustomerId
(
customerId
);
if
(
customerVisibleDto
==
null
||
CommonUtil
.
isEmpty
(
customerVisibleDto
.
getItems
()))
{
log
.
error
(
"[getExpression][LoginUser({}) 获取数据权限为 null]"
,
JsonUtils
.
toJsonString
(
loginUser
));
throw
new
NullPointerException
(
String
.
format
(
"LoginUser(%d) Table(%s/%s) 未返回数据权限"
,
loginUser
.
getId
(),
tableName
,
tableAlias
.
getName
()));
}
/* // 添加到上下文中,避免重复计算
loginUser.setContext(CONTEXT_KEY, customerVisibleDto);
}*/
Set
<
Long
>
productIds
=
CommonUtil
.
listConvertSet
(
customerVisibleDto
.
getItems
(),
CustomerVisibleProductRespDTO
.
CustomerProduct
::
getProductId
);
...
...
foodnexus-framework/foodnexus-spring-boot-starter-redis/src/main/java/cn/iocoder/foodnexus/framework/redis/config/FoodnexusCacheAutoConfiguration.java
View file @
cc58b6b0
...
...
@@ -14,7 +14,9 @@ import org.springframework.data.redis.cache.RedisCacheManager;
import
org.springframework.data.redis.cache.RedisCacheWriter
;
import
org.springframework.data.redis.connection.RedisConnectionFactory
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer
;
import
org.springframework.data.redis.serializer.RedisSerializationContext
;
import
org.springframework.data.redis.serializer.StringRedisSerializer
;
import
org.springframework.util.StringUtils
;
import
java.util.Objects
;
...
...
foodnexus-framework/foodnexus-spring-boot-starter-redis/src/main/java/cn/iocoder/foodnexus/framework/redis/config/FoodnexusRedisAutoConfiguration.java
View file @
cc58b6b0
...
...
@@ -8,6 +8,7 @@ import org.springframework.boot.autoconfigure.AutoConfiguration;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.data.redis.connection.RedisConnectionFactory
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer
;
import
org.springframework.data.redis.serializer.RedisSerializer
;
/**
...
...
@@ -35,7 +36,8 @@ public class FoodnexusRedisAutoConfiguration {
}
public
static
RedisSerializer
<?>
buildRedisSerializer
()
{
RedisSerializer
<
Object
>
json
=
RedisSerializer
.
json
();
GenericJackson2JsonRedisSerializer
json
=
new
GenericJackson2JsonRedisSerializer
();
// RedisSerializer<Object> json = RedisSerializer.json();
// 解决 LocalDateTime 的序列化
ObjectMapper
objectMapper
=
(
ObjectMapper
)
ReflectUtil
.
getFieldValue
(
json
,
"mapper"
);
objectMapper
.
registerModules
(
new
JavaTimeModule
());
...
...
foodnexus-module-erp-api/src/main/java/cn/iocoder/foodnexus/module/erp/api/service/ErpCustomerApi.java
View file @
cc58b6b0
package
cn
.
iocoder
.
foodnexus
.
module
.
erp
.
api
.
service
;
import
cn.hutool.core.lang.Pair
;
import
cn.iocoder.foodnexus.module.erp.api.vo.customer.CustomerAddReqVO
;
import
cn.iocoder.foodnexus.module.erp.api.vo.customer.DeptSimpleDTO
;
import
jakarta.validation.Valid
;
import
jakarta.validation.constraints.NotNull
;
...
...
@@ -32,4 +34,8 @@ public interface ErpCustomerApi {
Integer
queryCustomerTypeByUserId
(
Long
userId
);
Set
<
Long
>
queryCustomerDeptIdsByUserId
(
Long
userId
);
Pair
<
Boolean
,
Set
<
Long
>>
queryCustomerOrUserByUserId
(
Long
loginUserId
);
List
<
DeptSimpleDTO
>
querySubDeptByUserId
(
Long
loginUserId
);
}
foodnexus-module-erp-api/src/main/java/cn/iocoder/foodnexus/module/erp/api/vo/customer/DeptSimpleDTO.java
0 → 100644
View file @
cc58b6b0
package
cn
.
iocoder
.
foodnexus
.
module
.
erp
.
api
.
vo
.
customer
;
import
lombok.Data
;
/**
* @author : yanghao
* create at: 2025/11/6 10:03
* @description:
*/
@Data
public
class
DeptSimpleDTO
{
private
Long
customerDeptId
;
private
String
name
;
}
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/purchase/ErpPurchaseOrderController.java
View file @
cc58b6b0
...
...
@@ -191,15 +191,15 @@ public class ErpPurchaseOrderController {
Map
<
Long
,
CustomerOrderDTO
>
customerOrderMap
=
customerOrderApi
.
getOrderMap
(
convertSet
(
list
,
ErpPurchaseOrderDO:
:
getCustomerOrderId
));
Map
<
Long
,
CustomerOrderItemDTO
>
customerOrderItemMap
;
Map
<
Long
,
String
>
checkResultMap
;
/*Map<Long, String> checkResultMap;*/
List
<
CustomerOrderItemDTO
>
customerOrderItems
=
customerOrderApi
.
queryItemsByIds
(
CommonUtil
.
listConvert
(
purchaseOrderItemList
,
ErpPurchaseOrderItemDO:
:
getCustomerOrderItemId
));
customerOrderItemMap
=
CommonUtil
.
listConvertMap
(
customerOrderItems
,
CustomerOrderItemDTO:
:
getId
);
if
(
isDetails
)
{
checkResultMap
=
checkTaskApi
.
getCheckResultMapByPurchaseOrderItemIds
(
CommonUtil
.
listConvertSet
(
purchaseOrderItemList
,
ErpPurchaseOrderItemDO:
:
getId
));
/*
checkResultMap = checkTaskApi.getCheckResultMapByPurchaseOrderItemIds(CommonUtil.listConvertSet(purchaseOrderItemList,
ErpPurchaseOrderItemDO::getId));
*/
// TODO 退款待定
}
else
{
checkResultMap
=
new
HashMap
<>();
/*checkResultMap = new HashMap<>();*/
}
// 2. 开始拼接
return
BeanUtils
.
toBean
(
list
,
ErpPurchaseOrderRespVO
.
class
,
purchaseOrder
->
{
...
...
@@ -209,9 +209,11 @@ public class ErpPurchaseOrderController {
item
.
setSignedQuantity
(
customerOrderItem
.
getSignedQuantity
());
item
.
setSignedTotal
(
customerOrderItem
.
getSignedTotal
());
item
.
setProductInfo
(
customerOrderItem
.
getProductInfo
());
item
.
setReturnsCount
(
customerOrderItem
.
getReturnsQuantity
());
item
.
setReturnsTotal
(
customerOrderItem
.
getReturnsTotal
());
});
if
(
isDetails
)
{
MapUtils
.
findAndThen
(
checkResultMap
,
item
.
getId
(),
item:
:
setCheckResult
);
/*MapUtils.findAndThen(checkResultMap, item.getId(), item::setCheckResult);*/
}}));
purchaseOrder
.
setProductNames
(
CollUtil
.
join
(
purchaseOrder
.
getItems
(),
","
,
item
->
Optional
.
ofNullable
(
item
.
getProductInfo
()).
map
(
ProductInfo:
:
getName
).
orElse
(
""
)));
...
...
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/purchase/ErpPurchaseReturnController.java
View file @
cc58b6b0
...
...
@@ -122,6 +122,7 @@ public class ErpPurchaseReturnController {
String
orderCode
=
Optional
.
ofNullable
(
customerOrderApi
.
queryById
(
purchaseReturnVO
.
getCustomerOrderId
())).
map
(
CustomerOrderDTO:
:
getCode
).
orElse
(
""
);
purchaseReturnVO
.
setSupplierName
(
supplierName
);
purchaseReturnVO
.
setCustomerOrderCode
(
orderCode
);
purchaseReturnVO
.
setCustomerName
(
customerApi
.
queryNameStrById
(
purchaseReturnVO
.
getCustomerId
()));
purchaseReturnVO
.
setItems
(
BeanUtils
.
toBean
(
purchaseReturnItemList
,
ErpPurchaseReturnRespVO
.
Item
.
class
,
item
->
{
ErpStockDO
stock
=
stockService
.
getStock
(
item
.
getProductId
(),
item
.
getWarehouseId
());
item
.
setStockCount
(
stock
!=
null
?
stock
.
getCount
()
:
BigDecimal
.
ZERO
);
...
...
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/purchase/vo/order/ErpPurchaseOrderRespVO.java
View file @
cc58b6b0
...
...
@@ -212,8 +212,8 @@ public class ErpPurchaseOrderRespVO {
@Schema
(
description
=
"签收总价,单位:分"
)
private
Integer
signedTotal
;
@Schema
(
description
=
"质检结果(详情接口返回)"
)
private
String
checkResult
;
/*
@Schema(description = "质检结果(详情接口返回)")
private String checkResult;
*/
@Schema
(
description
=
"退货数量"
)
private
Integer
returnsCount
;
...
...
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/sale/ErpSaleReturnController.java
View file @
cc58b6b0
...
...
@@ -8,9 +8,11 @@ import cn.iocoder.foodnexus.framework.common.pojo.PageResult;
import
cn.iocoder.foodnexus.framework.common.util.CommonUtil
;
import
cn.iocoder.foodnexus.framework.common.util.collection.MapUtils
;
import
cn.iocoder.foodnexus.framework.common.util.object.BeanUtils
;
import
cn.iocoder.foodnexus.framework.common.util.spring.SpringUtils
;
import
cn.iocoder.foodnexus.framework.excel.core.util.ExcelUtils
;
import
cn.iocoder.foodnexus.module.erp.api.service.ErpSupplierApi
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.product.vo.product.ErpProductRespVO
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.order.ErpSaleOrderRespVO
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.returns.ErpSaleReturnPageReqVO
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.returns.ErpSaleReturnRespVO
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.returns.ErpSaleReturnSaveReqVO
;
...
...
@@ -30,6 +32,7 @@ import cn.iocoder.foodnexus.module.order.dto.DeliveryStaffSimpleInfo;
import
cn.iocoder.foodnexus.module.product.api.dto.ProductInfo
;
import
cn.iocoder.foodnexus.module.system.api.user.AdminUserApi
;
import
cn.iocoder.foodnexus.module.system.api.user.dto.AdminUserRespDTO
;
import
cn.iocoder.foodnexus.module.system.controller.admin.vo.AuditCommonReqVO
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.Parameter
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
...
...
@@ -77,6 +80,9 @@ public class ErpSaleReturnController {
@Autowired
private
ErpPurchaseReturnService
purchaseReturnService
;
@Autowired
private
CustomerOrderApi
customerOrderApi
;
@PostMapping
(
"/create"
)
@Operation
(
summary
=
"创建销售退货"
)
...
...
@@ -95,10 +101,8 @@ public class ErpSaleReturnController {
@PutMapping
(
"/update-status"
)
@Operation
(
summary
=
"更新销售退货的状态(确认退货)"
)
@PreAuthorize
(
"@ss.hasPermission('erp:sale-return:update-status')"
)
public
CommonResult
<
Boolean
>
updateSaleReturnStatus
(
@RequestParam
(
"id"
)
Long
id
,
@RequestParam
(
"status"
)
Integer
status
)
{
saleReturnService
.
updateSaleReturnStatus
(
id
,
status
);
public
CommonResult
<
Boolean
>
updateSaleReturnStatus
(
@RequestBody
AuditCommonReqVO
auditCommonReqVO
)
{
saleReturnService
.
updateSaleReturnStatus
(
auditCommonReqVO
);
return
success
(
true
);
}
...
...
@@ -129,12 +133,16 @@ public class ErpSaleReturnController {
saleReturnVO
.
setCustomerName
(
customerName
);
saleReturnVO
.
setCreatorName
(
creatorName
);
saleReturnVO
.
setDeliveryStaffInfo
(
deliveryStaffApi
.
querybyStaffId
(
saleReturnVO
.
getDeliveryStaffId
()));
String
orderCode
=
Optional
.
ofNullable
(
customerOrderApi
.
queryById
(
saleReturnVO
.
getCustomerOrderId
())).
map
(
CustomerOrderDTO:
:
getCode
).
orElse
(
""
);
saleReturnVO
.
setCustomerOrderCode
(
orderCode
);
saleReturnVO
.
setItems
(
BeanUtils
.
toBean
(
saleReturnItemList
,
ErpSaleReturnRespVO
.
Item
.
class
,
item
->
{
ErpStockDO
stock
=
stockService
.
getStock
(
item
.
getProductId
(),
item
.
getWarehouseId
());
item
.
setStockCount
(
stock
!=
null
?
stock
.
getCount
()
:
BigDecimal
.
ZERO
);
MapUtils
.
findAndThen
(
supplierMap
,
item
.
getSupplierId
(),
item:
:
setSupplierName
);
MapUtils
.
findAndThen
(
prNoMap
,
item
.
getPurchaseReturnOrderId
(),
item:
:
setPurchaseReturnOrderNo
);
}));
CommonResult
<
ErpSaleOrderRespVO
>
saleOrder
=
SpringUtils
.
getBean
(
ErpSaleOrderController
.
class
).
getSaleOrder
(
saleReturn
.
getOrderId
());
saleReturnVO
.
setSaleOrderItems
(
saleOrder
.
getData
().
getItems
());
}));
}
...
...
@@ -173,6 +181,7 @@ public class ErpSaleReturnController {
Map
<
Long
,
AdminUserRespDTO
>
userMap
=
adminUserApi
.
getUserMap
(
convertSet
(
pageResult
.
getList
(),
saleReturn
->
Long
.
parseLong
(
saleReturn
.
getCreator
())));
Map
<
Long
,
DeliveryStaffSimpleInfo
>
deliveryMap
=
deliveryStaffApi
.
getMap
(
CommonUtil
.
listConvertSet
(
pageResult
.
getList
(),
ErpSaleReturnDO:
:
getDeliveryStaffId
));
Map
<
Long
,
String
>
codeMap
=
customerOrderApi
.
getCodeMap
(
CommonUtil
.
listConvertSet
(
pageResult
.
getList
(),
ErpSaleReturnDO:
:
getCustomerOrderId
));
// 2. 开始拼接
return
BeanUtils
.
toBean
(
pageResult
,
ErpSaleReturnRespVO
.
class
,
saleReturn
->
{
...
...
@@ -182,6 +191,7 @@ public class ErpSaleReturnController {
MapUtils
.
findAndThen
(
customerMap
,
saleReturn
.
getCustomerId
(),
supplier
->
saleReturn
.
setCustomerName
(
supplier
.
getName
()));
MapUtils
.
findAndThen
(
userMap
,
Long
.
parseLong
(
saleReturn
.
getCreator
()),
user
->
saleReturn
.
setCreatorName
(
user
.
getNickname
()));
MapUtils
.
findAndThen
(
deliveryMap
,
saleReturn
.
getDeliveryStaffId
(),
saleReturn:
:
setDeliveryStaffInfo
);
MapUtils
.
findAndThen
(
codeMap
,
saleReturn
.
getCustomerOrderId
(),
saleReturn:
:
setCustomerOrderCode
);
});
}
...
...
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/sale/vo/order/DeliveryMyCountRespVO.java
View file @
cc58b6b0
...
...
@@ -15,9 +15,9 @@ public class DeliveryMyCountRespVO {
private
Long
allCount
;
@Schema
(
description
=
"今日订单数"
)
private
Long
todayCount
;
private
Integer
todayCount
;
@Schema
(
description
=
"本月订单数"
)
private
Long
monthCount
;
private
Integer
monthCount
;
}
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/sale/vo/order/DeliveryOrderPageReqVO.java
View file @
cc58b6b0
...
...
@@ -7,6 +7,7 @@ import lombok.Data;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.time.LocalDateTime
;
import
java.util.List
;
import
static
cn
.
iocoder
.
foodnexus
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
;
...
...
@@ -29,6 +30,9 @@ public class DeliveryOrderPageReqVO extends PageParam {
@Schema
(
description
=
"拣货状态"
)
private
SaleOrderPickUpStatus
pickUpStatus
;
@Schema
(
description
=
"拣货状态"
)
private
List
<
String
>
pickUpStatusList
;
@Schema
(
description
=
"订单类型(1-配送单 2-退货单)"
)
private
Integer
type
;
...
...
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/sale/vo/out/ErpSaleOutRespVO.java
View file @
cc58b6b0
...
...
@@ -180,6 +180,9 @@ public class ErpSaleOutRespVO {
@Schema
(
description
=
"拣货状态"
)
private
SaleOrderPickUpStatus
pickUpStatus
;
@Schema
(
description
=
"相关文件"
)
private
List
<
String
>
remarkFiles
;
// ========== 关联字段 ==========
@Schema
(
description
=
"产品名称"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"巧克力"
)
...
...
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/sale/vo/returns/ErpSaleReturnRespVO.java
View file @
cc58b6b0
...
...
@@ -3,6 +3,7 @@ package cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.returns;
import
cn.idev.excel.annotation.ExcelIgnoreUnannotated
;
import
cn.idev.excel.annotation.ExcelProperty
;
import
cn.iocoder.foodnexus.module.erp.api.vo.warehouse.WarehouseInfo
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.order.ErpSaleOrderRespVO
;
import
cn.iocoder.foodnexus.module.order.dto.CustomerAddressInfo
;
import
cn.iocoder.foodnexus.module.order.dto.DeliveryStaffSimpleInfo
;
import
cn.iocoder.foodnexus.module.product.api.dto.ProductInfo
;
...
...
@@ -39,6 +40,12 @@ public class ErpSaleReturnRespVO {
@ExcelProperty
(
"客户名称"
)
private
String
customerName
;
@Schema
(
description
=
"客户订单id"
)
private
Long
customerOrderId
;
@Schema
(
description
=
"客户订单code"
)
private
String
customerOrderCode
;
@Schema
(
description
=
"结算账户编号"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"311.89"
)
@ExcelProperty
(
"结算账户编号"
)
private
Long
accountId
;
...
...
@@ -137,6 +144,15 @@ public class ErpSaleReturnRespVO {
@Schema
(
description
=
"送达时间"
)
private
LocalDateTime
arrivalTime
;
@Schema
(
description
=
"审核意见"
)
private
String
auditReason
;
@Schema
(
description
=
"审核时间"
)
private
LocalDateTime
auditTime
;
@Schema
(
description
=
"销售配货单子项"
)
private
List
<
ErpSaleOrderRespVO
.
Item
>
saleOrderItems
;
@Data
public
static
class
Item
{
...
...
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/dal/dataobject/sale/ErpSaleReturnDO.java
View file @
cc58b6b0
...
...
@@ -199,4 +199,9 @@ public class ErpSaleReturnDO extends BaseDO {
*/
private
LocalDateTime
auditTime
;
/**
* 审核意见
*/
private
String
auditReason
;
}
\ No newline at end of file
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/dal/mysql/purchase/ErpPurchaseOrderMapper.java
View file @
cc58b6b0
...
...
@@ -135,6 +135,7 @@ public interface ErpPurchaseOrderMapper extends BaseMapperX<ErpPurchaseOrderDO>
if
(
CommonUtil
.
isNotBlank
(
reqVO
.
getCustomerOrderCode
()))
{
query
.
leftJoin
(
"order_customer_order oco3 on oco3.id = t.customer_order_id"
);
query
.
eq
(
"oco3.code"
,
reqVO
.
getCustomerOrderCode
());
query
.
or
().
eq
(
ErpPurchaseReturnDO:
:
getNo
,
reqVO
.
getCustomerOrderCode
());
query
.
groupBy
(
ErpPurchaseReturnDO:
:
getId
);
}
return
query
;
...
...
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/dal/mysql/purchase/ErpPurchaseReturnMapper.java
View file @
cc58b6b0
...
...
@@ -79,6 +79,7 @@ public interface ErpPurchaseReturnMapper extends BaseMapperX<ErpPurchaseReturnDO
if
(
CommonUtil
.
isNotBlank
(
reqVO
.
getCustomerOrderCode
()))
{
query
.
leftJoin
(
"order_customer_order oco3 on oco3.id = t.customer_order_id"
);
query
.
eq
(
"oco3.code"
,
reqVO
.
getCustomerOrderCode
());
query
.
or
().
eq
(
ErpPurchaseReturnDO:
:
getNo
,
reqVO
.
getCustomerOrderCode
());
query
.
groupBy
(
ErpPurchaseReturnDO:
:
getId
);
}
return
selectJoinPage
(
reqVO
,
ErpPurchaseReturnDO
.
class
,
query
);
...
...
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/dal/mysql/sale/ErpSaleOrderMapper.java
View file @
cc58b6b0
...
...
@@ -85,9 +85,9 @@ public interface ErpSaleOrderMapper extends BaseMapperX<ErpSaleOrderDO> {
}
if
(
CommonUtil
.
isNotEmpty
(
reqVO
.
getType
()))
{
if
(
reqVO
.
getType
()
==
1
)
{
query
.
in
(
ErpSaleOrderDO:
:
getPickUpStatus
,
SaleOrderPickUpStatus
.
getList
(
Boolean
.
TRUE
));
}
else
if
(
reqVO
.
getType
()
==
2
)
{
query
.
in
(
ErpSaleOrderDO:
:
getPickUpStatus
,
SaleOrderPickUpStatus
.
getList
(
Boolean
.
FALSE
));
}
else
if
(
reqVO
.
getType
()
==
2
)
{
query
.
in
(
ErpSaleOrderDO:
:
getPickUpStatus
,
SaleOrderPickUpStatus
.
getList
(
Boolean
.
TRUE
));
}
}
return
selectJoinPage
(
reqVO
,
ErpSaleOrderDO
.
class
,
query
);
...
...
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/enums/ErrorCodeConstants.java
View file @
cc58b6b0
...
...
@@ -96,6 +96,7 @@ ErrorCode PURCHASE_ORDER_ITEM_RETURN_FAIL_IN_EXCEED = new ErrorCode(1_030_101_00
ErrorCode
SALE_RETURN_FAIL_REFUND_PRICE_EXCEED
=
new
ErrorCode
(
1_020_203_007
,
"退款金额({})超过销售退货单总金额({})"
);
ErrorCode
SALE_RETURN_PROCESS_FAIL_EXISTS_REFUND
=
new
ErrorCode
(
1_020_203_008
,
"反审核失败,已存在对应的退款单"
);
ErrorCode
SALERETURN_ERROR_ORDER_ITEM
=
new
ErrorCode
(
1_020_203_009
,
"订单子项异常"
);
ErrorCode
SALE_RETURN_COUNT_ERROR
=
new
ErrorCode
(
1_020_203_010
,
"订单子项({})异常,退款数量不能大于签收数量"
);
// ========== ERP 仓库 1-030-400-000 ==========
ErrorCode
WAREHOUSE_NOT_EXISTS
=
new
ErrorCode
(
1_030_400_000
,
"仓库不存在"
);
...
...
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/service/sale/ErpCustomerServiceImpl.java
View file @
cc58b6b0
package
cn
.
iocoder
.
foodnexus
.
module
.
erp
.
service
.
sale
;
import
cn.hutool.core.lang.Pair
;
import
cn.hutool.extra.spring.SpringUtil
;
import
cn.iocoder.foodnexus.framework.common.enums.CommonStatusEnum
;
import
cn.iocoder.foodnexus.framework.common.enums.CustomerTypeEnum
;
import
cn.iocoder.foodnexus.framework.common.exception.ServiceException
;
import
cn.iocoder.foodnexus.framework.common.pojo.PageResult
;
import
cn.iocoder.foodnexus.framework.common.util.CommonUtil
;
import
cn.iocoder.foodnexus.framework.common.util.object.BeanUtils
;
import
cn.iocoder.foodnexus.framework.common.util.spring.SpringUtils
;
import
cn.iocoder.foodnexus.module.erp.api.service.ErpCustomerApi
;
import
cn.iocoder.foodnexus.module.erp.api.vo.customer.CustomerAddReqVO
;
import
cn.iocoder.foodnexus.module.erp.api.vo.customer.DeptSimpleDTO
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.customerwarehouse.vo.CustomerWarehouseSaveReqVO
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.customer.ErpCustomerPageReqVO
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.customer.ErpCustomerSaveReqVO
;
...
...
@@ -27,6 +31,7 @@ import com.google.common.collect.Maps;
import
jakarta.annotation.Resource
;
import
org.apache.commons.compress.utils.Lists
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.stereotype.Service
;
...
...
@@ -180,6 +185,7 @@ public class ErpCustomerServiceImpl implements ErpCustomerService, ErpCustomerAp
}
@Override
@Cacheable
(
cacheNames
=
RedisKeyConstants
.
USER_TO_CUSTOMER
,
key
=
"#userId"
)
public
ErpCustomerDO
getCustomerByUserId
(
Long
userId
)
{
AdminUserDO
user
=
userService
.
getUser
(
userId
);
if
(!
UserSystemEnum
.
CUSTOMER
.
getKey
().
equals
(
user
.
getUserSystem
()))
{
...
...
@@ -205,6 +211,7 @@ public class ErpCustomerServiceImpl implements ErpCustomerService, ErpCustomerAp
}
@Override
@CacheEvict
(
cacheNames
=
RedisKeyConstants
.
USER_TO_CUSTOMER
,
allEntries
=
true
)
public
void
updateByDept
(
Long
deptId
,
CustomerAddReqVO
customerAddReqVO
)
{
ErpCustomerDO
customer
=
customerMapper
.
selectOne
(
ErpCustomerDO:
:
getSystemDeptId
,
deptId
);
if
(
CommonUtil
.
isEmpty
(
customer
))
{
...
...
@@ -219,13 +226,15 @@ public class ErpCustomerServiceImpl implements ErpCustomerService, ErpCustomerAp
}
@Override
@CacheEvict
(
cacheNames
=
RedisKeyConstants
.
USER_TO_CUSTOMER
,
allEntries
=
true
)
public
void
deleteByDept
(
Long
deptId
)
{
customerMapper
.
delete
(
ErpCustomerDO:
:
getSystemDeptId
,
deptId
);
}
@Override
//@Cacheable(cacheNames = RedisKeyConstants.USER_TO_CUSTOMER, key = "#userId")
public
Long
queryCustomerIdByUserId
(
Long
userId
)
{
AdminUserDO
user
=
userService
.
getUser
(
userId
);
/*
AdminUserDO user = userService.getUser(userId);
if (!UserSystemEnum.CUSTOMER.getKey().equals(user.getUserSystem())) {
throw exception(ERROR_CUSTOMER_USER);
}
...
...
@@ -236,8 +245,9 @@ public class ErpCustomerServiceImpl implements ErpCustomerService, ErpCustomerAp
}
if (CommonStatusEnum.isDisable(customer.getStatus())) {
throw exception(CUSTOMER_NOT_ENABLE, customer.getName());
}
return
customer
.
getId
();
}*/
ErpCustomerServiceImpl
bean
=
SpringUtil
.
getBean
(
getClass
());
return
Optional
.
ofNullable
(
bean
.
getCustomerByUserId
(
userId
)).
map
(
ErpCustomerDO:
:
getId
).
orElse
(
null
);
}
@Override
...
...
@@ -295,4 +305,39 @@ public class ErpCustomerServiceImpl implements ErpCustomerService, ErpCustomerAp
deptIds
.
add
(
user
.
getDeptId
());
return
deptIds
;
}
@Override
public
Pair
<
Boolean
,
Set
<
Long
>>
queryCustomerOrUserByUserId
(
Long
userId
)
{
AdminUserDO
user
=
userService
.
getUser
(
userId
);
if
(!
UserSystemEnum
.
CUSTOMER
.
getKey
().
equals
(
user
.
getUserSystem
()))
{
throw
exception
(
ERROR_CUSTOMER_USER
);
}
DeptDO
userDept
=
deptService
.
getDept
(
user
.
getDeptId
());
if
(
Objects
.
equals
(
userDept
.
getParentId
(),
DeptDO
.
PARENT_ID_ROOT
))
{
Set
<
Long
>
deptIds
=
deptService
.
getChildDeptIdListFromCache
(
user
.
getDeptId
());
deptIds
.
add
(
user
.
getDeptId
());
return
new
Pair
<>(
Boolean
.
TRUE
,
deptIds
);
}
return
new
Pair
<>(
Boolean
.
FALSE
,
null
);
}
@Override
public
List
<
DeptSimpleDTO
>
querySubDeptByUserId
(
Long
userId
)
{
AdminUserDO
user
=
userService
.
getUser
(
userId
);
if
(!
UserSystemEnum
.
CUSTOMER
.
getKey
().
equals
(
user
.
getUserSystem
()))
{
throw
exception
(
ERROR_CUSTOMER_USER
);
}
DeptDO
userDept
=
deptService
.
getDept
(
user
.
getDeptId
());
if
(
Objects
.
equals
(
userDept
.
getParentId
(),
DeptDO
.
PARENT_ID_ROOT
))
{
return
CommonUtil
.
listConvert
(
deptService
.
getChildDeptList
(
user
.
getDeptId
()),
item
->{
DeptSimpleDTO
dto
=
new
DeptSimpleDTO
();
dto
.
setCustomerDeptId
(
item
.
getId
());
dto
.
setName
(
item
.
getName
());
return
dto
;
});
}
return
new
ArrayList
<>();
}
}
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/service/sale/ErpSaleOutServiceImpl.java
View file @
cc58b6b0
...
...
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.iocoder.foodnexus.framework.common.pojo.PageResult
;
import
cn.iocoder.foodnexus.framework.common.util.CommonUtil
;
import
cn.iocoder.foodnexus.framework.common.util.collection.MapUtils
;
import
cn.iocoder.foodnexus.framework.common.util.number.MoneyUtils
;
import
cn.iocoder.foodnexus.framework.common.util.object.BeanUtils
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.out.ErpSaleOutPageReqVO
;
...
...
@@ -217,10 +218,11 @@ public class ErpSaleOutServiceImpl implements ErpSaleOutService {
private
List
<
ErpSaleOutItemDO
>
validateSaleOutItems
(
List
<
ErpSaleOutSaveReqVO
.
Item
>
list
)
{
// 1. 校验产品存在
Map
<
Long
,
ProductSpuDO
>
productMap
=
productSpuService
.
getSpuMap
(
convertSet
(
list
,
ErpSaleOutSaveReqVO
.
Item
::
getProductId
));
/*Map<Long, ProductSpuDO> productMap = productSpuService.getSpuMap(convertSet(list, ErpSaleOutSaveReqVO.Item::getProductId));*/
// 2. 转化为 ErpSaleOutItemDO 列表
return
convertList
(
list
,
o
->
BeanUtils
.
toBean
(
o
,
ErpSaleOutItemDO
.
class
,
item
->
{
item
.
setProductUnit
(
productMap
.
get
(
item
.
getProductId
()).
getUnitName
());
// item.setProductUnit(productMap.get(item.getProductId()).getUnitName());
/*MapUtils.findAndThen(productMap, item.getProductId(), product->item.setProductUnit(product.getUnitName()));*/
item
.
setTotalPrice
(
item
.
getProductPrice
()
*
item
.
getCount
());
if
(
item
.
getTotalPrice
()
==
null
)
{
return
;
...
...
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/service/sale/ErpSaleReturnService.java
View file @
cc58b6b0
...
...
@@ -6,6 +6,7 @@ import cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.returns.ErpSaleR
import
cn.iocoder.foodnexus.module.erp.dal.dataobject.sale.ErpSaleReturnDO
;
import
cn.iocoder.foodnexus.module.erp.dal.dataobject.sale.ErpSaleReturnItemDO
;
import
cn.iocoder.foodnexus.module.order.dto.DeliveryOrderUpdateReqVO
;
import
cn.iocoder.foodnexus.module.system.controller.admin.vo.AuditCommonReqVO
;
import
jakarta.validation.Valid
;
import
java.math.BigDecimal
;
...
...
@@ -37,10 +38,8 @@ public interface ErpSaleReturnService {
/**
* 更新销售退货的状态
*
* @param id 编号
* @param status 状态
*/
void
updateSaleReturnStatus
(
Long
id
,
Integer
status
);
void
updateSaleReturnStatus
(
AuditCommonReqVO
auditCommonReqVO
);
/**
* 更新销售退货的退款金额
...
...
@@ -111,4 +110,7 @@ public interface ErpSaleReturnService {
void
delivery
(
Long
id
,
Long
deliveryStaffId
);
void
arrival
(
DeliveryOrderUpdateReqVO
reqVO
,
Long
aLong
);
ErpSaleReturnDO
getSaleReturnByCustomerOrderId
(
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 @
cc58b6b0
...
...
@@ -33,11 +33,13 @@ import cn.iocoder.foodnexus.module.erp.service.purchase.ErpPurchaseReturnService
import
cn.iocoder.foodnexus.module.erp.service.stock.ErpStockRecordService
;
import
cn.iocoder.foodnexus.module.erp.service.stock.bo.ErpStockRecordCreateReqBO
;
import
cn.iocoder.foodnexus.module.order.api.CustomerOrderApi
;
import
cn.iocoder.foodnexus.module.order.dto.CustomerOrderDTO
;
import
cn.iocoder.foodnexus.module.order.dto.CustomerOrderItemDTO
;
import
cn.iocoder.foodnexus.module.order.dto.DeliveryOrderUpdateReqVO
;
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
cn.iocoder.foodnexus.module.system.controller.admin.vo.AuditCommonReqVO
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
jakarta.annotation.Resource
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -200,7 +202,9 @@ public class ErpSaleReturnServiceImpl implements ErpSaleReturnService {
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
updateSaleReturnStatus
(
Long
id
,
Integer
status
)
{
public
void
updateSaleReturnStatus
(
AuditCommonReqVO
reqVO
)
{
Integer
status
=
Integer
.
parseInt
(
reqVO
.
getAuditStatus
());
Long
id
=
reqVO
.
getId
();
boolean
approve
=
ErpAuditStatus
.
APPROVE
.
getStatus
().
equals
(
status
);
// 1.1 校验存在
ErpSaleReturnDO
saleReturn
=
validateSaleReturnExists
(
id
);
...
...
@@ -215,13 +219,44 @@ public class ErpSaleReturnServiceImpl implements ErpSaleReturnService {
// 2. 更新状态
int
updateCount
=
saleReturnMapper
.
updateByIdAndStatus
(
id
,
saleReturn
.
getStatus
(),
new
ErpSaleReturnDO
().
setStatus
(
status
).
setAuditTime
(
LocalDateTime
.
now
()).
setReturnsStatus
(
RETURNS_APPROVE
.
getType
()));
new
ErpSaleReturnDO
().
setStatus
(
status
).
setAudit
Reason
(
reqVO
.
getAuditReason
()).
setAudit
Time
(
LocalDateTime
.
now
()).
setReturnsStatus
(
RETURNS_APPROVE
.
getType
()));
if
(
updateCount
==
0
)
{
throw
exception
(
approve
?
SALE_RETURN_APPROVE_FAIL
:
SALE_RETURN_PROCESS_FAIL
);
}
// 3. 变更库存
List
<
ErpSaleReturnItemDO
>
saleReturnItems
=
saleReturnItemMapper
.
selectListByReturnId
(
id
);
// 更新客户订单退款字段
List
<
CustomerOrderItemDTO
>
customerORderItems
=
customerOrderApi
.
queryItemsByOrderId
(
saleReturn
.
getCustomerOrderId
());
Map
<
Long
,
CustomerOrderItemDTO
>
customerOrderItemMap
=
CommonUtil
.
listConvertMap
(
customerORderItems
,
CustomerOrderItemDTO:
:
getId
);
List
<
CustomerOrderItemDTO
>
updateItems
=
new
ArrayList
<>();
Integer
returnsTotal
=
0
;
for
(
ErpSaleReturnItemDO
item
:
saleReturnItems
)
{
Long
orderItemId
=
item
.
getCustomerOrderItemId
();
Integer
returnsCount
=
item
.
getCount
();
if
(!
customerOrderItemMap
.
containsKey
(
orderItemId
))
{
throw
exception
(
SALERETURN_ERROR_ORDER_ITEM
);
}
CustomerOrderItemDTO
orderItem
=
customerOrderItemMap
.
get
(
orderItemId
);
CustomerOrderItemDTO
updateItem
=
new
CustomerOrderItemDTO
();
updateItem
.
setId
(
orderItem
.
getId
());
updateItem
.
setReturnsQuantity
(
returnsCount
);
updateItem
.
setReturnsTotal
(
returnsCount
*
orderItem
.
getOrderItemPrice
());
if
(
orderItem
.
getSignedQuantity
()
<
CommonUtil
.
getEls
(
updateItem
.
getReturnsQuantity
(),
0
))
{
throw
exception
(
SALE_RETURN_COUNT_ERROR
,
orderItem
.
getProductName
());
}
/*updateItem.setSignedQuantity(orderItem.getSignedQuantity() - returnsCount);
updateItem.setSignedTotal(orderItem.getSignedTotal() - updateItem.getReturnsTotal());*/
updateItems
.
add
(
updateItem
);
returnsTotal
+=
updateItem
.
getReturnsTotal
();
}
customerOrderApi
.
updateActualAmount
(
saleReturn
.
getCustomerOrderId
(),
-
returnsTotal
);
customerOrderApi
.
updateItems
(
updateItems
);
// TODO 退款确认后才进行库存变更
/*Integer bizType = approve ? ErpStockRecordBizTypeEnum.SALE_RETURN.getType()
: ErpStockRecordBizTypeEnum.SALE_RETURN_CANCEL.getType();
...
...
@@ -562,4 +597,12 @@ public class ErpSaleReturnServiceImpl implements ErpSaleReturnService {
}
}
@Override
public
ErpSaleReturnDO
getSaleReturnByCustomerOrderId
(
Long
customerOrderId
)
{
return
saleReturnMapper
.
selectOne
(
Wrappers
.<
ErpSaleReturnDO
>
lambdaQuery
()
.
eq
(
ErpSaleReturnDO:
:
getCustomerOrderId
,
customerOrderId
)
.
orderByDesc
(
ErpSaleReturnDO:
:
getId
)
.
last
(
"LIMIT 1"
));
}
}
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/controller/admin/customerrequire/vo/CustomerRequireRespVO.java
View file @
cc58b6b0
...
...
@@ -32,6 +32,9 @@ public class CustomerRequireRespVO {
@ExcelProperty
(
"商品分类编号"
)
private
Long
categoryId
;
@Schema
(
description
=
"商品分类名称"
)
private
String
categoryName
;
@Schema
(
description
=
"是否受理"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@ExcelProperty
(
"是否受理"
)
private
Boolean
isRequire
;
...
...
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/controller/app/customerrequire/AppCustomerRequireController.java
View file @
cc58b6b0
...
...
@@ -6,6 +6,7 @@ import cn.iocoder.foodnexus.framework.common.pojo.CommonResult;
import
cn.iocoder.foodnexus.framework.common.pojo.PageParam
;
import
cn.iocoder.foodnexus.framework.common.pojo.PageResult
;
import
cn.iocoder.foodnexus.framework.common.util.CommonUtil
;
import
cn.iocoder.foodnexus.framework.common.util.collection.MapUtils
;
import
cn.iocoder.foodnexus.framework.common.util.object.BeanUtils
;
import
cn.iocoder.foodnexus.framework.excel.core.util.ExcelUtils
;
import
cn.iocoder.foodnexus.framework.security.core.util.SecurityFrameworkUtils
;
...
...
@@ -16,6 +17,7 @@ import cn.iocoder.foodnexus.module.operations.controller.admin.customerrequire.v
import
cn.iocoder.foodnexus.module.operations.controller.admin.customerrequire.vo.CustomerRequireSaveReqVO
;
import
cn.iocoder.foodnexus.module.operations.dal.dataobject.customerrequire.CustomerRequireDO
;
import
cn.iocoder.foodnexus.module.operations.service.customerrequire.CustomerRequireService
;
import
cn.iocoder.foodnexus.module.product.service.category.ProductCategoryService
;
import
cn.iocoder.foodnexus.module.system.annotations.AppSystemAuth
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.Parameter
;
...
...
@@ -30,6 +32,7 @@ import org.springframework.web.bind.annotation.*;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.Map
;
import
static
cn
.
iocoder
.
foodnexus
.
framework
.
apilog
.
core
.
enums
.
OperateTypeEnum
.
EXPORT
;
import
static
cn
.
iocoder
.
foodnexus
.
framework
.
common
.
pojo
.
CommonResult
.
success
;
...
...
@@ -47,6 +50,9 @@ public class AppCustomerRequireController {
@Autowired
private
ErpCustomerApi
customerApi
;
@Autowired
private
ProductCategoryService
productCategoryService
;
@PostMapping
(
"/create"
)
@Operation
(
summary
=
"创建客户需求"
)
public
CommonResult
<
Long
>
createCustomerRequire
(
@Valid
@RequestBody
CustomerRequireSaveReqVO
createReqVO
)
{
...
...
@@ -67,7 +73,9 @@ public class AppCustomerRequireController {
@Parameter
(
name
=
"id"
,
description
=
"编号"
,
required
=
true
,
example
=
"1024"
)
public
CommonResult
<
CustomerRequireRespVO
>
getCustomerRequire
(
@RequestParam
(
"id"
)
Long
id
)
{
CustomerRequireDO
customerRequire
=
customerRequireService
.
getCustomerRequire
(
id
);
return
success
(
BeanUtils
.
toBean
(
customerRequire
,
CustomerRequireRespVO
.
class
));
return
success
(
BeanUtils
.
toBean
(
customerRequire
,
CustomerRequireRespVO
.
class
,
item
->
{
item
.
setCategoryName
(
productCategoryService
.
queryNameById
(
customerRequire
.
getCategoryId
()));
}));
}
@GetMapping
(
"/page"
)
...
...
@@ -75,7 +83,10 @@ public class AppCustomerRequireController {
public
CommonResult
<
PageResult
<
CustomerRequireRespVO
>>
getCustomerRequirePage
(
@Valid
CustomerRequirePageReqVO
pageReqVO
)
{
pageReqVO
.
setCreator
(
SecurityFrameworkUtils
.
getLoginUserId
());
PageResult
<
CustomerRequireDO
>
pageResult
=
customerRequireService
.
getCustomerRequirePage
(
pageReqVO
);
return
success
(
BeanUtils
.
toBean
(
pageResult
,
CustomerRequireRespVO
.
class
));
Map
<
Long
,
String
>
map
=
productCategoryService
.
getMap
(
CommonUtil
.
listConvertSet
(
pageResult
.
getList
(),
CustomerRequireDO:
:
getCategoryId
));
return
success
(
BeanUtils
.
toBean
(
pageResult
,
CustomerRequireRespVO
.
class
,
item
->
{
MapUtils
.
findAndThen
(
map
,
item
.
getCategoryId
(),
item:
:
setCategoryName
);
}));
}
@DeleteMapping
(
"/delete"
)
...
...
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/service/inquirecustomerpush/InquireCustomerPushServiceImpl.java
View file @
cc58b6b0
...
...
@@ -112,7 +112,7 @@ public class InquireCustomerPushServiceImpl implements InquireCustomerPushServic
* @param id
*/
@Override
@CacheEvict
(
cacheNames
=
RedisKeyConstants
.
CUSTOMER_VISIBLE_PRODUCT
,
allEntries
=
true
)
@CacheEvict
(
cacheNames
=
RedisKeyConstants
.
CUSTOMER_VISIBLE_PRODUCT
,
key
=
"#id"
)
public
void
confirm
(
Long
id
)
{
validateInquireCustomerPushExists
(
id
);
inquireCustomerPushMapper
.
update
(
Wrappers
.<
InquireCustomerPushDO
>
lambdaUpdate
()
...
...
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/service/inquiresupplierpush/InquireSupplierPushServiceImpl.java
View file @
cc58b6b0
...
...
@@ -99,7 +99,7 @@ public class InquireSupplierPushServiceImpl implements InquireSupplierPushServic
* @param updateReqVO
*/
@Override
@CacheEvict
(
cacheNames
=
RedisKeyConstants
.
CUSTOMER_VISIBLE_PRODUCT
,
allEntries
=
true
)
/*@CacheEvict(cacheNames = RedisKeyConstants.CUSTOMER_VISIBLE_PRODUCT, allEntries = true)*/
public
void
confirm
(
AppInquireSupplierPushConfirmReqVO
updateReqVO
)
{
List
<
InquireSupplierPushDO
>
inquireSupplierPushDOS
=
inquireSupplierPushMapper
.
selectList
(
new
LambdaQueryWrapperX
<
InquireSupplierPushDO
>()
.
eq
(
InquireSupplierPushDO:
:
getSupplierId
,
updateReqVO
.
getSupplierId
())
...
...
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/service/scoringweight/ScoringWeightServiceImpl.java
View file @
cc58b6b0
...
...
@@ -100,10 +100,10 @@ public class ScoringWeightServiceImpl implements ScoringWeightService {
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
edit
(
ScoringWeightEditReqVO
reqVO
)
{
Long
allCount
=
scoringWeightMapper
.
selectCount
();
/*
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
)
{
...
...
foodnexus-module-mall/foodnexus-module-order-api/src/main/java/cn/iocoder/foodnexus/module/order/api/CustomerOrderApi.java
View file @
cc58b6b0
...
...
@@ -29,4 +29,6 @@ public interface CustomerOrderApi {
void
updateItems
(
List
<
CustomerOrderItemDTO
>
updateItems
);
Map
<
Long
,
String
>
getCodeMap
(
Collection
<
Long
>
longs
);
void
updateActualAmount
(
Long
id
,
int
addAmount
);
}
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/checktask/vo/CheckTaskItemsSaveReqVO.java
View file @
cc58b6b0
...
...
@@ -33,7 +33,7 @@ public class CheckTaskItemsSaveReqVO {
private
String
categoryName
;
@Schema
(
description
=
"商品封面图"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"https://www.iocoder.cn"
)
@NotEmpty
(
message
=
"商品封面图不能为空"
)
//
@NotEmpty(message = "商品封面图不能为空")
private
String
picUrl
;
@Schema
(
description
=
"检查数量"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"24148"
)
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/customerorder/vo/CustomerOrderPageReqVO.java
View file @
cc58b6b0
...
...
@@ -11,6 +11,7 @@ import cn.iocoder.foodnexus.framework.common.pojo.PageParam;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.time.LocalDateTime
;
import
java.util.List
;
import
java.util.Set
;
import
static
cn
.
iocoder
.
foodnexus
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
;
...
...
@@ -79,6 +80,12 @@ public class CustomerOrderPageReqVO extends PageParam {
@Schema
(
hidden
=
true
)
private
Long
creator
;
@Schema
(
hidden
=
true
)
private
Set
<
Long
>
deptIds
;
@Schema
(
description
=
"灶点id"
)
private
Long
customerDeptId
;
@Schema
(
description
=
"创建月份(yyyy-MM)"
)
private
String
createYearMonth
;
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/customerorder/vo/CustomerOrderRespVO.java
View file @
cc58b6b0
...
...
@@ -106,6 +106,9 @@ public class CustomerOrderRespVO {
@Schema
(
description
=
"是否已评论"
)
private
Boolean
hasScore
;
@Schema
(
description
=
"是否已确认"
)
private
Boolean
hasFinish
;
@Schema
(
description
=
"当前订单进度"
)
private
List
<
CustomerOrderRecordRespVO
>
currentRecords
;
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/customerOrder/AppCustomerOrderController.java
View file @
cc58b6b0
package
cn
.
iocoder
.
foodnexus
.
module
.
order
.
controller
.
app
.
customerOrder
;
import
cn.hutool.core.lang.Pair
;
import
cn.iocoder.foodnexus.framework.common.enums.UserSystemEnum
;
import
cn.iocoder.foodnexus.framework.common.pojo.CommonResult
;
import
cn.iocoder.foodnexus.framework.common.pojo.PageResult
;
import
cn.iocoder.foodnexus.framework.common.util.CommonUtil
;
import
cn.iocoder.foodnexus.framework.common.util.object.BeanUtils
;
import
cn.iocoder.foodnexus.module.erp.api.service.ErpCustomerApi
;
import
cn.iocoder.foodnexus.module.erp.dal.dataobject.sale.ErpSaleOutDO
;
import
cn.iocoder.foodnexus.module.erp.service.sale.ErpSaleOutService
;
import
cn.iocoder.foodnexus.module.order.controller.admin.customerorder.vo.CustomerOrderPageReqVO
;
...
...
@@ -32,6 +34,7 @@ import org.springframework.web.bind.annotation.*;
import
javax.sql.rowset.serial.SerialException
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
static
cn
.
iocoder
.
foodnexus
.
framework
.
common
.
pojo
.
CommonResult
.
success
;
import
static
cn
.
iocoder
.
foodnexus
.
framework
.
security
.
core
.
util
.
SecurityFrameworkUtils
.
getLoginUserId
;
...
...
@@ -50,6 +53,8 @@ public class AppCustomerOrderController {
private
CustomerOrderRecordService
customerOrderRecordService
;
@Autowired
private
CustomerOrderItemService
customerOrderItemService
;
@Autowired
private
ErpCustomerApi
customerApi
;
@GetMapping
(
"status-count"
)
@Operation
(
summary
=
"客户订单各状态对应数量"
)
...
...
@@ -145,7 +150,12 @@ public class AppCustomerOrderController {
@GetMapping
(
"/page"
)
@Operation
(
summary
=
"获得客户总订单分页"
)
public
CommonResult
<
PageResult
<
CustomerOrderRespVO
>>
getCustomerOrderPage
(
@Valid
CustomerOrderPageReqVO
pageReqVO
)
{
pageReqVO
.
setCreator
(
getLoginUserId
());
Pair
<
Boolean
,
Set
<
Long
>>
pair
=
customerApi
.
queryCustomerOrUserByUserId
(
getLoginUserId
());
if
(
pair
.
getKey
())
{
pageReqVO
.
setDeptIds
(
pair
.
getValue
());
}
else
{
pageReqVO
.
setCreator
(
getLoginUserId
());
}
PageResult
<
CustomerOrderDO
>
pageResult
=
customerOrderService
.
getCustomerOrderPage
(
pageReqVO
);
return
success
(
BeanUtils
.
toBean
(
pageResult
,
CustomerOrderRespVO
.
class
,
item
->
{
item
.
setCurrentRecords
(
customerOrderRecordService
.
queryCurrentRecords
(
item
.
getId
(),
item
.
getOrderStatus
()));
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/customerOrder/AppCustomerOrderReconciliationController.java
View file @
cc58b6b0
package
cn
.
iocoder
.
foodnexus
.
module
.
order
.
controller
.
app
.
customerOrder
;
import
cn.hutool.core.lang.Pair
;
import
cn.iocoder.foodnexus.framework.common.enums.UserSystemEnum
;
import
cn.iocoder.foodnexus.framework.common.pojo.CommonResult
;
import
cn.iocoder.foodnexus.framework.common.pojo.PageResult
;
import
cn.iocoder.foodnexus.framework.common.util.CommonUtil
;
import
cn.iocoder.foodnexus.module.erp.api.service.ErpCustomerApi
;
import
cn.iocoder.foodnexus.module.erp.api.vo.customer.DeptSimpleDTO
;
import
cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCustomerMonthOrderRespVO
;
import
cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCustomerMonthOrderTotalRespVO
;
import
cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCustomerOrderReconciliationReqVO
;
...
...
@@ -20,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
import
java.util.Set
;
import
static
cn
.
iocoder
.
foodnexus
.
framework
.
common
.
pojo
.
CommonResult
.
success
;
...
...
@@ -69,4 +72,10 @@ public class AppCustomerOrderReconciliationController {
return
success
(
Boolean
.
TRUE
);
}
@GetMapping
(
"/query-customer-dept-id"
)
@Operation
(
summary
=
"查询灶点信息"
)
public
CommonResult
<
List
<
DeptSimpleDTO
>>
queryCustomerDeptId
()
{
return
success
(
customerApi
.
querySubDeptByUserId
(
getLoginUserId
()));
}
}
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/customerOrder/vo/AppCustomerOrderReceiptRespVO.java
View file @
cc58b6b0
...
...
@@ -22,6 +22,9 @@ public class AppCustomerOrderReceiptRespVO {
@Schema
(
description
=
"实际签收数量"
)
private
Integer
signedQuantity
;
@Schema
(
description
=
"签收总价,单位:分"
)
private
Integer
signedTotal
;
@Schema
(
description
=
"说明"
)
private
String
remark
;
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/customerOrder/vo/AppCustomerOrderReturnRespVO.java
View file @
cc58b6b0
...
...
@@ -19,6 +19,9 @@ public class AppCustomerOrderReturnRespVO {
@Schema
(
description
=
"退货单id"
)
private
Long
saleReturnId
;
@Schema
(
description
=
"退货单编号"
)
private
String
saleReturnNo
;
@Schema
(
description
=
"说明"
)
private
String
remark
;
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/delivery/DeliverySaleOrderController.java
View file @
cc58b6b0
...
...
@@ -5,25 +5,35 @@ import cn.iocoder.foodnexus.framework.common.pojo.CommonResult;
import
cn.iocoder.foodnexus.framework.common.pojo.PageParam
;
import
cn.iocoder.foodnexus.framework.common.pojo.PageResult
;
import
cn.iocoder.foodnexus.framework.common.util.CommonUtil
;
import
cn.iocoder.foodnexus.framework.common.util.collection.MapUtils
;
import
cn.iocoder.foodnexus.framework.common.util.object.BeanUtils
;
import
cn.iocoder.foodnexus.framework.common.validation.InEnum
;
import
cn.iocoder.foodnexus.framework.security.core.util.SecurityFrameworkUtils
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.order.DeliveryMyCountRespVO
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.order.DeliveryOrderPageReqVO
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.order.ErpSaleOrderPageReqVO
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.out.ErpSaleOutRespVO
;
import
cn.iocoder.foodnexus.module.erp.dal.dataobject.sale.ErpSaleOrderDO
;
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.stock.ErpStockDO
;
import
cn.iocoder.foodnexus.module.erp.enums.SaleOrderPickUpStatus
;
import
cn.iocoder.foodnexus.module.erp.service.sale.ErpSaleOrderService
;
import
cn.iocoder.foodnexus.module.erp.service.sale.ErpSaleOutService
;
import
cn.iocoder.foodnexus.module.erp.service.stock.ErpStockService
;
import
cn.iocoder.foodnexus.module.operations.service.deliverystaffcustomer.DeliveryStaffCustomerService
;
import
cn.iocoder.foodnexus.module.order.api.DeliveryStaffApi
;
import
cn.iocoder.foodnexus.module.order.controller.admin.customerorder.vo.CustomerOrderRespVO
;
import
cn.iocoder.foodnexus.module.order.controller.admin.customerorderitem.vo.CustomerOrderItemRespVO
;
import
cn.iocoder.foodnexus.module.order.controller.app.delivery.vo.DeliveryOrderArrivalDetails
;
import
cn.iocoder.foodnexus.module.order.controller.app.delivery.vo.DeliveryOrderDetails
;
import
cn.iocoder.foodnexus.module.order.controller.app.delivery.vo.DeliverySaleOrderRespVO
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.order.DeliveryStatusCountRespVO
;
import
cn.iocoder.foodnexus.module.order.dto.DeliveryOrderUpdateReqVO
;
import
cn.iocoder.foodnexus.module.order.service.customerorder.CustomerOrderService
;
import
cn.iocoder.foodnexus.module.order.service.customerorderitem.CustomerOrderItemService
;
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.annotations.AppSystemAuth
;
import
cn.iocoder.foodnexus.module.system.controller.admin.dept.vo.dept.DeptSimpleRespVO
;
import
io.swagger.v3.oas.annotations.Operation
;
...
...
@@ -31,10 +41,13 @@ import io.swagger.v3.oas.annotations.Parameter;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
jakarta.validation.Valid
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
static
cn
.
iocoder
.
foodnexus
.
framework
.
common
.
pojo
.
CommonResult
.
success
;
...
...
@@ -69,10 +82,13 @@ public class DeliverySaleOrderController {
@Autowired
private
CustomerOrderItemService
customerOrderItemService
;
@Autowired
private
ErpSaleOutService
saleOutService
;
@GetMapping
(
"/my-count"
)
@Operation
(
summary
=
"个人中心 - 配送订单数"
)
public
CommonResult
<
DeliveryMyCountRespVO
>
queryMyCount
()
{
return
success
(
saleOrderService
.
queryMyCount
(
getLoginUserId
(
)));
return
success
(
saleOrderService
.
queryMyCount
(
deliveryStaffApi
.
queryStaffIdByUserId
(
getLoginUserId
()
)));
}
@GetMapping
(
"/status-count"
)
...
...
@@ -163,4 +179,17 @@ public class DeliverySaleOrderController {
return
success
(
Boolean
.
TRUE
);
}
@GetMapping
(
"/arrival"
)
@Operation
(
summary
=
"配货单 - 订单到货 详情"
)
@Parameter
(
name
=
"id"
,
description
=
"客户订单id(customerOrderInfo.id)"
,
required
=
true
)
public
CommonResult
<
List
<
DeliveryOrderArrivalDetails
>>
getSaleOut
(
@RequestParam
(
"id"
)
Long
id
)
{
ErpSaleOutDO
saleOut
=
saleOutService
.
getSaleOutByCustomerOrderId
(
id
);
if
(
saleOut
==
null
)
{
return
success
(
null
);
}
List
<
ErpSaleOutItemDO
>
saleOutItemList
=
saleOutService
.
getSaleOutItemListByOutId
(
saleOut
.
getId
());
return
success
(
BeanUtils
.
toBean
(
saleOutItemList
,
DeliveryOrderArrivalDetails
.
class
));
}
}
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/delivery/DeliverySaleReturnController.java
View file @
cc58b6b0
...
...
@@ -5,14 +5,19 @@ import cn.iocoder.foodnexus.framework.common.pojo.CommonResult;
import
cn.iocoder.foodnexus.framework.common.pojo.PageParam
;
import
cn.iocoder.foodnexus.framework.common.pojo.PageResult
;
import
cn.iocoder.foodnexus.framework.common.util.CommonUtil
;
import
cn.iocoder.foodnexus.framework.common.util.collection.MapUtils
;
import
cn.iocoder.foodnexus.framework.common.util.object.BeanUtils
;
import
cn.iocoder.foodnexus.framework.common.validation.InEnum
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.order.DeliveryMyCountRespVO
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.order.DeliveryOrderPageReqVO
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.order.DeliveryStatusCountRespVO
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.order.ErpSaleOrderPageReqVO
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.returns.ErpSaleReturnRespVO
;
import
cn.iocoder.foodnexus.module.erp.dal.dataobject.sale.ErpCustomerDO
;
import
cn.iocoder.foodnexus.module.erp.dal.dataobject.sale.ErpSaleOrderDO
;
import
cn.iocoder.foodnexus.module.erp.dal.dataobject.sale.ErpSaleReturnDO
;
import
cn.iocoder.foodnexus.module.erp.dal.dataobject.sale.ErpSaleReturnItemDO
;
import
cn.iocoder.foodnexus.module.erp.dal.dataobject.stock.ErpStockDO
;
import
cn.iocoder.foodnexus.module.erp.enums.SaleOrderPickUpStatus
;
import
cn.iocoder.foodnexus.module.erp.service.sale.ErpSaleOrderService
;
import
cn.iocoder.foodnexus.module.erp.service.sale.ErpSaleReturnService
;
...
...
@@ -20,6 +25,7 @@ import cn.iocoder.foodnexus.module.operations.service.deliverystaffcustomer.Deli
import
cn.iocoder.foodnexus.module.order.api.DeliveryStaffApi
;
import
cn.iocoder.foodnexus.module.order.controller.admin.customerorder.vo.CustomerOrderRespVO
;
import
cn.iocoder.foodnexus.module.order.controller.admin.customerorderitem.vo.CustomerOrderItemRespVO
;
import
cn.iocoder.foodnexus.module.order.controller.app.delivery.vo.DeliveryOrderArrivalDetails
;
import
cn.iocoder.foodnexus.module.order.controller.app.delivery.vo.DeliveryOrderDetails
;
import
cn.iocoder.foodnexus.module.order.controller.app.delivery.vo.DeliverySaleOrderRespVO
;
import
cn.iocoder.foodnexus.module.order.controller.app.delivery.vo.DeliverySaleReturnRespVO
;
...
...
@@ -27,16 +33,21 @@ import cn.iocoder.foodnexus.module.order.dto.DeliveryOrderUpdateReqVO;
import
cn.iocoder.foodnexus.module.order.service.customerorder.CustomerOrderService
;
import
cn.iocoder.foodnexus.module.order.service.customerorderitem.CustomerOrderItemService
;
import
cn.iocoder.foodnexus.module.system.annotations.AppSystemAuth
;
import
cn.iocoder.foodnexus.module.system.api.user.dto.AdminUserRespDTO
;
import
cn.iocoder.foodnexus.module.system.controller.admin.dept.vo.dept.DeptSimpleRespVO
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.Parameter
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
jakarta.validation.Valid
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.Set
;
import
static
cn
.
iocoder
.
foodnexus
.
framework
.
common
.
pojo
.
CommonResult
.
success
;
...
...
@@ -91,4 +102,16 @@ public class DeliverySaleReturnController {
return
success
(
Boolean
.
TRUE
);
}
@GetMapping
(
"/arrival"
)
@Operation
(
summary
=
"退货单 - 订单到货 详情"
)
@Parameter
(
name
=
"id"
,
description
=
"客户订单id(customerOrderInfo.id)"
,
required
=
true
)
public
CommonResult
<
List
<
DeliveryOrderArrivalDetails
>>
getSaleReturn
(
@RequestParam
(
"id"
)
Long
id
)
{
ErpSaleReturnDO
saleReturn
=
saleReturnService
.
getSaleReturnByCustomerOrderId
(
id
);
if
(
saleReturn
==
null
)
{
return
success
(
null
);
}
List
<
ErpSaleReturnItemDO
>
saleReturnItemList
=
saleReturnService
.
getSaleReturnItemListByReturnId
(
saleReturn
.
getId
());
return
success
(
BeanUtils
.
toBean
(
saleReturnItemList
,
DeliveryOrderArrivalDetails
.
class
));
}
}
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/delivery/vo/DeliveryOrderArrivalDetails.java
0 → 100644
View file @
cc58b6b0
package
cn
.
iocoder
.
foodnexus
.
module
.
order
.
controller
.
app
.
delivery
.
vo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
jakarta.validation.constraints.NotNull
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.util.List
;
/**
* @author : yanghao
* create at: 2025/11/4 15:10
* @description:
*/
@Data
public
class
DeliveryOrderArrivalDetails
{
@Schema
(
description
=
"客户订单子项id"
)
private
Long
customerOrderItemId
;
@Schema
(
description
=
"配送单/退货单 子项编号"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"11756"
)
private
Long
orderItemId
;
@Schema
(
description
=
"签收数量"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"100.00"
)
private
BigDecimal
count
;
@Schema
(
description
=
"备注"
,
example
=
"随便"
)
private
String
remark
;
@Schema
(
description
=
"相关文件"
)
private
List
<
String
>
remarkFiles
;
}
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/shoppingcart/ShoppingCartController.java
View file @
cc58b6b0
...
...
@@ -98,7 +98,10 @@ public class ShoppingCartController {
PageResult
<
ShoppingCartDO
>
pageResult
=
shoppingCartService
.
getShoppingCartPage
(
pageReqVO
);
Map
<
Long
,
ProductSpuDO
>
productMap
=
productService
.
getSpuMap
(
CommonUtil
.
listConvertSet
(
pageResult
.
getList
(),
ShoppingCartDO:
:
getProductId
));
return
success
(
BeanUtils
.
toBean
(
pageResult
,
ShoppingCartRespVO
.
class
,
item
->
{
MapUtils
.
findAndThen
(
productMap
,
item
.
getProductId
(),
product
->
item
.
setProductInfo
(
BeanUtils
.
toBean
(
product
,
ProductInfo
.
class
)));
MapUtils
.
findAndThen
(
productMap
,
item
.
getProductId
(),
product
->
{
item
.
setProductInfo
(
BeanUtils
.
toBean
(
product
,
ProductInfo
.
class
));
item
.
setStatus
(
product
.
getStatus
());
});
}));
}
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/shoppingcart/vo/ShoppingCartRespVO.java
View file @
cc58b6b0
...
...
@@ -44,4 +44,7 @@ public class ShoppingCartRespVO {
@ExcelProperty
(
"创建时间"
)
private
LocalDateTime
createTime
;
@Schema
(
description
=
"商品状态"
)
private
Integer
status
=
0
;
}
\ 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 @
cc58b6b0
...
...
@@ -119,4 +119,9 @@ public class CustomerOrderDO extends BaseDO {
*/
private
Boolean
hasScore
;
/**
* 是否已确认
*/
private
Boolean
hasFinish
;
}
\ No newline at end of file
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/dal/mysql/customerorder/CustomerOrderMapper.java
View file @
cc58b6b0
...
...
@@ -50,6 +50,8 @@ public interface CustomerOrderMapper extends BaseMapperX<CustomerOrderDO> {
.
eqIfPresent
(
CustomerOrderDO:
:
getOperCompany
,
reqVO
.
getOperCompany
())
.
betweenIfPresent
(
CustomerOrderDO:
:
getCreateTime
,
reqVO
.
getCreateTime
())
.
eqIfPresent
(
CustomerOrderDO:
:
getCreator
,
reqVO
.
getCreator
())
.
inIfPresent
(
CustomerOrderDO:
:
getCustomerDeptId
,
reqVO
.
getDeptIds
())
.
eqIfPresent
(
CustomerOrderDO:
:
getCustomerDeptId
,
reqVO
.
getCustomerDeptId
())
.
eqIfPresent
(
CustomerOrderDO:
:
getHasScore
,
reqVO
.
getHasScore
())
.
likeIfPresent
(
CustomerOrderDO:
:
getAddressInfo
,
reqVO
.
getContactPhone
())
.
likeIfPresent
(
CustomerOrderDO:
:
getAddressInfo
,
reqVO
.
getContactUser
())
...
...
@@ -95,7 +97,8 @@ public interface CustomerOrderMapper extends BaseMapperX<CustomerOrderDO> {
queryWrapperX
.
select
(
"count(*) as 'orderCount',SUM(order_amount) as 'orderAmount'"
);
queryWrapperX
.
between
(
"create_time"
,
begin
,
end
);
queryWrapperX
.
in
(
"order_status"
,
CommonUtil
.
asList
(
CustomerOrderStatus
.
SIGN_RECEIPT
.
getKey
(),
CustomerOrderStatus
.
FINISH
.
getKey
()));
CustomerOrderStatus
.
FINISH
.
getKey
(),
CustomerOrderStatus
.
RETURN
.
getKey
()));
queryWrapperX
.
in
(
"customer_dept_id"
,
deptIds
);
return
this
.
selectJoinOne
(
AppCustomerMonthOrderRespVO
.
class
,
queryWrapperX
);
}
...
...
@@ -109,7 +112,8 @@ public interface CustomerOrderMapper extends BaseMapperX<CustomerOrderDO> {
queryWrapperX
.
select
(
"CASE WHEN SUM(CASE WHEN order_status='SIGN_RECEIPT' THEN 1 ELSE 0 END)> 0 THEN 0 ELSE 1 END AS 'status'"
);
queryWrapperX
.
between
(
"create_time"
,
begin
,
end
);
queryWrapperX
.
in
(
"order_status"
,
CommonUtil
.
asList
(
CustomerOrderStatus
.
SIGN_RECEIPT
.
getKey
(),
CustomerOrderStatus
.
FINISH
.
getKey
()));
CustomerOrderStatus
.
FINISH
.
getKey
(),
CustomerOrderStatus
.
RETURN
.
getKey
()));
queryWrapperX
.
in
(
"customer_dept_id"
,
reqVO
.
getDeptIds
());
queryWrapperX
.
groupBy
(
"DATE_FORMAT(create_time, '%Y-%m') "
);
queryWrapperX
.
orderByDesc
(
"id"
);
...
...
@@ -117,7 +121,7 @@ public interface CustomerOrderMapper extends BaseMapperX<CustomerOrderDO> {
return
this
.
selectJoinPage
(
reqVO
,
AppCustomerMonthOrderRespVO
.
MonthItems
.
class
,
queryWrapperX
);
}
default
AppCustomerMonthOrderTotalRespVO
reconciliationMonthTotal
(
String
yearMonth
)
{
default
AppCustomerMonthOrderTotalRespVO
reconciliationMonthTotal
(
String
yearMonth
,
Set
<
Long
>
deptIds
)
{
String
createMonth
=
yearMonth
.
trim
();
String
startOfMonth
=
createMonth
+
"-01 00:00:00"
;
String
[]
parts
=
createMonth
.
split
(
"-"
);
...
...
@@ -131,7 +135,9 @@ public interface CustomerOrderMapper extends BaseMapperX<CustomerOrderDO> {
queryWrapperX
.
select
(
"count(*) as 'orderCount',SUM(order_amount) as 'orderAmount'"
);
queryWrapperX
.
between
(
"create_time"
,
startOfMonth
,
endOfMonth
);
queryWrapperX
.
in
(
"order_status"
,
CommonUtil
.
asList
(
CustomerOrderStatus
.
SIGN_RECEIPT
.
getKey
(),
CustomerOrderStatus
.
FINISH
.
getKey
()));
CustomerOrderStatus
.
FINISH
.
getKey
(),
CustomerOrderStatus
.
RETURN
.
getKey
()));
queryWrapperX
.
in
(
"customer_dept_id"
,
deptIds
);
queryWrapperX
.
orderByDesc
(
"id"
);
return
this
.
selectJoinOne
(
AppCustomerMonthOrderTotalRespVO
.
class
,
queryWrapperX
);
}
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/enums/ErrorCodeConstants.java
View file @
cc58b6b0
...
...
@@ -10,6 +10,7 @@ import cn.iocoder.foodnexus.framework.common.exception.ErrorCode;
public
interface
ErrorCodeConstants
{
// ========== 购物车 1_018-000-000 ==========
ErrorCode
SHOPPING_CART_NOT_EXISTS
=
new
ErrorCode
(
1_018_100_000
,
"购物车不存在"
);
ErrorCode
PRODUCT_DISABLE
=
new
ErrorCode
(
1_018_100_001
,
"商品【{}】已下架"
);
// ========== 客户总订单 1_019_100_0001 ==========
ErrorCode
CUSTOMER_ORDER_NOT_EXISTS
=
new
ErrorCode
(
1_019_100_001
,
"客户总订单不存在"
);
...
...
@@ -21,6 +22,7 @@ public interface ErrorCodeConstants {
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
,
"客户订单已评价"
);
ErrorCode
CUSTOMER_ORDER_HAS_FINISH
=
new
ErrorCode
(
1_019_100_007
,
"客户订单【{}】已确认"
);
// ========== 客户订单-子订单 1_020_100_0001 ==========
ErrorCode
CUSTOMER_ORDER_ITEM_NOT_EXISTS
=
new
ErrorCode
(
1_020_100_001
,
"客户订单-子订单不存在"
);
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/service/checktask/CheckTaskServiceImpl.java
View file @
cc58b6b0
...
...
@@ -189,7 +189,7 @@ public class CheckTaskServiceImpl implements CheckTaskService, CheckTaskApi {
throw
exception
(
CHECK_TASK_PURCHASE_ORDER_NOT_EXISTS
);
}
if
(!
Objects
.
equals
(
purchaseOrder
.
getDeliveryStatus
(),
ErpDeliveryStatus
.
ARRIVAL
.
getStatus
()))
{
throw
exception
(
CHECK_TASK_PURCHASE_ORDER_
NOT_EXISTS
);
throw
exception
(
CHECK_TASK_PURCHASE_ORDER_
STATUS_ERROR
);
}
if
(
CheckTaskStatus
.
NORMAL
.
getKey
().
equals
(
updateReqVO
.
getStatus
()))
{
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/service/customerorder/CustomerOrderServiceImpl.java
View file @
cc58b6b0
...
...
@@ -342,7 +342,8 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
try
{
CustomerOrderStatus
orderStatus
=
customerOrder
.
getOrderStatus
();
if
(
orderStatus
.
equals
(
CustomerOrderStatus
.
ORDER_SUCCESS
)
||
orderStatus
.
equals
(
CustomerOrderStatus
.
ORDER_MATCH
))
{
orderStatus
.
equals
(
CustomerOrderStatus
.
ORDER_MATCH
)
||
orderStatus
.
equals
(
CustomerOrderStatus
.
SUPPLIER_ACCEPT_ORDER
))
{
CustomerOrderRemark
orderRemark
=
new
CustomerOrderRemark
();
orderRemark
.
setOperTime
(
new
Date
());
orderRemark
.
setRemark
(
CommonUtil
.
getEls
(
reqVO
.
getRemark
(),
""
));
...
...
@@ -466,10 +467,12 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
if
(
productMap
.
containsKey
(
customerOrderItem
.
getProductId
()))
{
ErpSaleOutItemDO
saleOutItem
=
productMap
.
get
(
customerOrderItem
.
getProductId
());
result
.
setSignedQuantity
(
saleOutItem
.
getCount
());
result
.
setSignedTotal
(
saleOutItem
.
getCount
()
*
saleOutItem
.
getProductPrice
());
result
.
setRemark
(
saleOutItem
.
getRemark
());
result
.
setRemarkFiles
(
saleOutItem
.
getRemarkFiles
());
}
else
{
result
.
setSignedQuantity
(
customerOrderItem
.
getOrderItemQuantity
());
result
.
setSignedTotal
(
customerOrderItem
.
getOrderItemQuantity
()
*
customerOrderItem
.
getOrderItemPrice
());
}
return
result
;
});
...
...
@@ -642,9 +645,10 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
}
// TODO 待评价
result
.
put
(
"TO_BE_SCORE"
,
customerOrderMapper
.
selectCount
(
Wrappers
.<
CustomerOrderDO
>
lambdaQuery
()
.
eq
(
CustomerOrderDO:
:
getCreator
,
loginUserId
)
.
eq
(
CustomerOrderDO:
:
getHasScore
,
Boolean
.
FALSE
)
.
in
(
CustomerOrderDO:
:
getOrderStatus
,
CommonUtil
.
asList
(
CustomerOrderStatus
.
SIGN_RECEIPT
.
get
Label
(),
CustomerOrderStatus
.
FINISH
.
get
Label
()))));
.
in
(
CustomerOrderDO:
:
getOrderStatus
,
CommonUtil
.
asList
(
CustomerOrderStatus
.
SIGN_RECEIPT
.
get
Key
(),
CustomerOrderStatus
.
FINISH
.
get
Key
()))));
return
result
;
}
...
...
@@ -671,7 +675,7 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
*/
@Override
public
AppCustomerMonthOrderTotalRespVO
monthTotal
(
String
yearMonth
,
Set
<
Long
>
deptIds
)
{
return
customerOrderMapper
.
reconciliationMonthTotal
(
yearMonth
);
return
customerOrderMapper
.
reconciliationMonthTotal
(
yearMonth
,
deptIds
);
}
@Override
...
...
@@ -682,9 +686,20 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
if
(
CommonUtil
.
isEmpty
(
customerOrder
))
{
throw
exception
(
CUSTOMER_ORDER_NOT_EXISTS
);
}
if
(
CustomerOrderStatus
.
SIGN_RECEIPT
.
equals
(
customerOrder
.
getOrderStatus
()))
{
this
.
updateOrderStatus
(
id
,
CustomerOrderStatus
.
FINISH
);
/*if (customerOrder.getHasFinish()) {
throw exception(CUSTOMER_ORDER_HAS_FINISH, customerOrder.getCode());
}*/
if
(
CustomerOrderStatus
.
SIGN_RECEIPT
.
equals
(
customerOrder
.
getOrderStatus
())
||
CustomerOrderStatus
.
RETURN
.
equals
(
customerOrder
.
getOrderStatus
()))
{
// this.updateOrderStatus(id, CustomerOrderStatus.FINISH);
// 订单记录
CustomerOrderDO
updateDo
=
new
CustomerOrderDO
();
updateDo
.
setId
(
id
);
if
(
CustomerOrderStatus
.
SIGN_RECEIPT
.
equals
(
customerOrder
.
getOrderStatus
()))
{
updateDo
.
setOrderStatus
(
CustomerOrderStatus
.
FINISH
);
}
updateDo
.
setHasFinish
(
Boolean
.
TRUE
);
customerOrderMapper
.
updateById
(
updateDo
);
/*CustomerOrderRecordEvent event = new CustomerOrderRecordEvent();
event.setOrderStatus(CustomerOrderStatus.FINISH);
event.setCustomerOrderId(id);
...
...
@@ -714,6 +729,7 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
return
result
;
}
result
.
setSaleReturnId
(
saleReturn
.
getId
());
result
.
setSaleReturnNo
(
saleReturn
.
getNo
());
result
.
setTotalReturnPrice
(
saleReturn
.
getTotalPrice
());
result
.
setRemark
(
saleReturn
.
getRemark
());
result
.
setRemarkFiles
(
saleReturn
.
getFilesUrl
());
...
...
@@ -851,4 +867,22 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
return
CommonUtil
.
listConvertMap
(
customerOrderMapper
.
selectByIds
(
ids
),
CustomerOrderDO:
:
getId
,
CustomerOrderDO:
:
getCode
);
}
@Override
public
void
updateActualAmount
(
Long
id
,
int
addAmount
)
{
String
lock
=
String
.
format
(
ORDER_LOCK
,
id
);
RedisUtils
.
tryLockRds
(
lock
);
try
{
CustomerOrderDO
customerOrder
=
this
.
getCustomerOrder
(
id
);
if
(
CommonUtil
.
isNotEmpty
(
customerOrder
))
{
int
actualAmount
=
customerOrder
.
getActualAmount
()
+
addAmount
;
actualAmount
=
Math
.
max
(
actualAmount
,
0
);
customerOrderMapper
.
update
(
Wrappers
.<
CustomerOrderDO
>
lambdaUpdate
()
.
set
(
CustomerOrderDO:
:
getActualAmount
,
actualAmount
)
.
eq
(
CustomerOrderDO:
:
getId
,
id
));
}
}
finally
{
RedisUtils
.
unLockRds
(
lock
);
}
}
}
\ No newline at end of file
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/service/shoppingcart/ShoppingCartServiceImpl.java
View file @
cc58b6b0
...
...
@@ -4,13 +4,18 @@ import cn.iocoder.foodnexus.framework.common.util.CommonUtil;
import
cn.iocoder.foodnexus.module.order.controller.app.shoppingcart.vo.ShoppingCartPageReqVO
;
import
cn.iocoder.foodnexus.module.order.controller.app.shoppingcart.vo.ShoppingCartSaveBatchReqVO
;
import
cn.iocoder.foodnexus.module.order.controller.app.shoppingcart.vo.ShoppingCartSaveReqVO
;
import
cn.iocoder.foodnexus.module.product.dal.dataobject.spu.ProductSpuDO
;
import
cn.iocoder.foodnexus.module.product.enums.spu.ProductSpuStatusEnum
;
import
cn.iocoder.foodnexus.module.product.service.spu.ProductSpuService
;
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.transaction.annotation.Transactional
;
import
org.springframework.validation.annotation.Validated
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
cn.iocoder.foodnexus.module.order.dal.dataobject.shoppingcart.ShoppingCartDO
;
import
cn.iocoder.foodnexus.framework.common.pojo.PageResult
;
...
...
@@ -35,8 +40,12 @@ public class ShoppingCartServiceImpl implements ShoppingCartService {
@Resource
private
ShoppingCartMapper
shoppingCartMapper
;
@Autowired
private
ProductSpuService
productSpuService
;
@Override
public
Long
createShoppingCart
(
ShoppingCartSaveReqVO
createReqVO
)
{
validProduct
(
createReqVO
.
getProductId
());
ShoppingCartDO
cart
=
shoppingCartMapper
.
selectOne
(
Wrappers
.<
ShoppingCartDO
>
lambdaQuery
()
.
eq
(
ShoppingCartDO:
:
getProductId
,
createReqVO
.
getProductId
())
.
eq
(
ShoppingCartDO:
:
getCreator
,
getLoginUserId
())
...
...
@@ -57,9 +66,21 @@ public class ShoppingCartServiceImpl implements ShoppingCartService {
return
shoppingCart
.
getId
();
}
private
void
validProduct
(
Long
productId
)
{
ProductSpuDO
appSpu
=
productSpuService
.
getAppSpu
(
productId
);
if
(
CommonUtil
.
isEmpty
(
appSpu
)
||
!
ProductSpuStatusEnum
.
isEnable
(
appSpu
.
getStatus
())
){
throw
exception
(
PRODUCT_DISABLE
,
appSpu
.
getName
());
}
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
createBatch
(
ShoppingCartSaveBatchReqVO
createReqVO
)
{
List
<
ProductSpuDO
>
spuList
=
productSpuService
.
getSpuList
(
CommonUtil
.
listConvert
(
createReqVO
.
getItems
(),
ShoppingCartSaveReqVO:
:
getProductId
));
List
<
ProductSpuDO
>
collect
=
spuList
.
stream
().
filter
(
item
->
ProductSpuStatusEnum
.
isEnable
(
item
.
getStatus
())).
toList
();
if
(
CommonUtil
.
isEmpty
(
collect
))
{
throw
exception
(
PRODUCT_DISABLE
,
String
.
join
(
","
,
CommonUtil
.
listConvertSet
(
createReqVO
.
getItems
(),
ShoppingCartSaveReqVO:
:
getProductName
)));
}
for
(
ShoppingCartSaveReqVO
item
:
createReqVO
.
getItems
())
{
this
.
createShoppingCart
(
item
);
}
...
...
@@ -69,6 +90,7 @@ public class ShoppingCartServiceImpl implements ShoppingCartService {
public
void
updateShoppingCart
(
ShoppingCartSaveReqVO
updateReqVO
)
{
// 校验存在
validateShoppingCartExists
(
updateReqVO
.
getId
());
validProduct
(
updateReqVO
.
getProductId
());
// 更新
ShoppingCartDO
updateObj
=
BeanUtils
.
toBean
(
updateReqVO
,
ShoppingCartDO
.
class
);
shoppingCartMapper
.
updateById
(
updateObj
);
...
...
foodnexus-module-mall/foodnexus-module-product/src/main/java/cn/iocoder/foodnexus/module/product/controller/app/spu/AppProductSpuController.java
View file @
cc58b6b0
...
...
@@ -7,6 +7,7 @@ import cn.iocoder.foodnexus.framework.common.util.object.BeanUtils;
import
cn.iocoder.foodnexus.module.product.controller.app.spu.vo.AppProductSpuDetailRespVO
;
import
cn.iocoder.foodnexus.module.product.controller.app.spu.vo.AppProductSpuPageReqVO
;
import
cn.iocoder.foodnexus.module.product.controller.app.spu.vo.AppProductSpuRespVO
;
import
cn.iocoder.foodnexus.module.product.controller.app.spu.vo.AppProductSpuStatusRespVO
;
import
cn.iocoder.foodnexus.module.product.dal.dataobject.spu.ProductSpuDO
;
import
cn.iocoder.foodnexus.module.product.enums.spu.ProductSpuStatusEnum
;
import
cn.iocoder.foodnexus.module.product.service.history.ProductBrowseHistoryService
;
...
...
@@ -27,6 +28,7 @@ import org.springframework.web.bind.annotation.RestController;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
static
cn
.
iocoder
.
foodnexus
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
...
...
@@ -47,6 +49,13 @@ public class AppProductSpuController {
@Resource
private
ProductBrowseHistoryService
productBrowseHistoryService
;
@GetMapping
(
"/product-status"
)
@Operation
(
summary
=
"获取商品上下架情况"
)
public
CommonResult
<
List
<
AppProductSpuStatusRespVO
>>
productStatus
(
@RequestParam
(
"productIds"
)
List
<
Long
>
productIds
)
{
return
success
(
productSpuService
.
queryProductStatus
(
productIds
));
}
@GetMapping
(
"/page"
)
@Operation
(
summary
=
"获得商品 SPU 分页"
)
public
CommonResult
<
PageResult
<
AppProductSpuRespVO
>>
getSpuPage
(
@Valid
AppProductSpuPageReqVO
pageVO
)
{
...
...
foodnexus-module-mall/foodnexus-module-product/src/main/java/cn/iocoder/foodnexus/module/product/controller/app/spu/vo/AppProductSpuDetailRespVO.java
View file @
cc58b6b0
package
cn
.
iocoder
.
foodnexus
.
module
.
product
.
controller
.
app
.
spu
.
vo
;
import
cn.iocoder.foodnexus.module.product.controller.app.property.vo.value.AppProductPropertyValueDetailRespVO
;
import
cn.iocoder.foodnexus.module.product.enums.spu.ProductSpuStatusEnum
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
...
...
@@ -46,5 +47,12 @@ public class AppProductSpuDetailRespVO {
@Schema
(
description
=
"下浮率(%)"
)
private
BigDecimal
discount
;
/**
* 商品状态
*
* 枚举 {@link ProductSpuStatusEnum}
*/
@Schema
(
description
=
"商品状态"
)
private
Integer
status
;
}
foodnexus-module-mall/foodnexus-module-product/src/main/java/cn/iocoder/foodnexus/module/product/controller/app/spu/vo/AppProductSpuRespVO.java
View file @
cc58b6b0
package
cn
.
iocoder
.
foodnexus
.
module
.
product
.
controller
.
app
.
spu
.
vo
;
import
cn.iocoder.foodnexus.module.product.enums.spu.ProductSpuStatusEnum
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
...
...
@@ -41,4 +42,12 @@ public class AppProductSpuRespVO {
@Schema
(
description
=
"下浮率(%)"
)
private
BigDecimal
discount
;
/**
* 商品状态
*
* 枚举 {@link ProductSpuStatusEnum}
*/
@Schema
(
description
=
"商品状态"
)
private
Integer
status
;
}
foodnexus-module-mall/foodnexus-module-product/src/main/java/cn/iocoder/foodnexus/module/product/controller/app/spu/vo/AppProductSpuStatusRespVO.java
0 → 100644
View file @
cc58b6b0
package
cn
.
iocoder
.
foodnexus
.
module
.
product
.
controller
.
app
.
spu
.
vo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
/**
* @author : yanghao
* create at: 2025/11/5 17:28
* @description:
*/
@Data
public
class
AppProductSpuStatusRespVO
{
@Schema
(
description
=
"商品id"
)
private
Long
productId
;
@Schema
(
description
=
"商品名称"
)
private
String
productName
;
@Schema
(
description
=
"0-下架 1-上架"
)
private
Integer
status
;
}
foodnexus-module-mall/foodnexus-module-product/src/main/java/cn/iocoder/foodnexus/module/product/service/category/ProductCategoryService.java
View file @
cc58b6b0
package
cn
.
iocoder
.
foodnexus
.
module
.
product
.
service
.
category
;
import
cn.iocoder.foodnexus.framework.common.util.CommonUtil
;
import
cn.iocoder.foodnexus.module.product.controller.admin.category.vo.ProductCategoryListReqVO
;
import
cn.iocoder.foodnexus.module.product.controller.admin.category.vo.ProductCategorySaveReqVO
;
import
cn.iocoder.foodnexus.module.product.dal.dataobject.category.ProductCategoryDO
;
...
...
@@ -93,6 +94,9 @@ public interface ProductCategoryService {
void
validateCategoryList
(
Collection
<
Long
>
ids
);
default
String
queryNameById
(
Long
categoryId
)
{
if
(
CommonUtil
.
isEmpty
(
categoryId
))
{
return
""
;
}
return
Optional
.
ofNullable
(
this
.
getCategory
(
categoryId
))
.
map
(
ProductCategoryDO:
:
getName
).
orElse
(
""
);
}
...
...
foodnexus-module-mall/foodnexus-module-product/src/main/java/cn/iocoder/foodnexus/module/product/service/spu/ProductSpuService.java
View file @
cc58b6b0
...
...
@@ -8,6 +8,7 @@ import cn.iocoder.foodnexus.module.product.controller.admin.spu.vo.ProductSpuPag
import
cn.iocoder.foodnexus.module.product.controller.admin.spu.vo.ProductSpuSaveReqVO
;
import
cn.iocoder.foodnexus.module.product.controller.admin.spu.vo.ProductSpuUpdateStatusReqVO
;
import
cn.iocoder.foodnexus.module.product.controller.app.spu.vo.AppProductSpuPageReqVO
;
import
cn.iocoder.foodnexus.module.product.controller.app.spu.vo.AppProductSpuStatusRespVO
;
import
cn.iocoder.foodnexus.module.product.dal.dataobject.spu.ProductSpuDO
;
import
cn.iocoder.foodnexus.module.system.annotations.AutoSetPrice
;
import
cn.iocoder.foodnexus.module.system.controller.admin.vo.AuditCommonReqVO
;
...
...
@@ -165,4 +166,7 @@ public interface ProductSpuService {
}
String
queryName
(
Collection
<
Long
>
productIds
);
List
<
AppProductSpuStatusRespVO
>
queryProductStatus
(
List
<
Long
>
ids
);
}
foodnexus-module-mall/foodnexus-module-product/src/main/java/cn/iocoder/foodnexus/module/product/service/spu/ProductSpuServiceImpl.java
View file @
cc58b6b0
...
...
@@ -15,6 +15,7 @@ import cn.iocoder.foodnexus.module.product.controller.admin.spu.vo.ProductSpuPag
import
cn.iocoder.foodnexus.module.product.controller.admin.spu.vo.ProductSpuSaveReqVO
;
import
cn.iocoder.foodnexus.module.product.controller.admin.spu.vo.ProductSpuUpdateStatusReqVO
;
import
cn.iocoder.foodnexus.module.product.controller.app.spu.vo.AppProductSpuPageReqVO
;
import
cn.iocoder.foodnexus.module.product.controller.app.spu.vo.AppProductSpuStatusRespVO
;
import
cn.iocoder.foodnexus.module.product.dal.dataobject.category.ProductCategoryDO
;
import
cn.iocoder.foodnexus.module.product.dal.dataobject.spu.ProductSpuDO
;
import
cn.iocoder.foodnexus.module.product.dal.mysql.spu.ProductSpuMapper
;
...
...
@@ -154,7 +155,7 @@ public class ProductSpuServiceImpl implements ProductSpuService {
if
(
productMap
.
get
(
id
)
==
null
)
{
throw
exception
(
SPU_NOT_EXISTS
);
}
if
(
CommonStatusEnum
.
isDis
able
(
product
.
getStatus
()))
{
if
(
!
ProductSpuStatusEnum
.
isEn
able
(
product
.
getStatus
()))
{
throw
exception
(
SPU_NOT_ENABLE
,
product
.
getName
());
}
}
...
...
@@ -170,6 +171,21 @@ public class ProductSpuServiceImpl implements ProductSpuService {
}
@Override
@CustomerVisible
public
List
<
AppProductSpuStatusRespVO
>
queryProductStatus
(
List
<
Long
>
ids
)
{
List
<
ProductSpuDO
>
productSpuDOS
=
productSpuMapper
.
selectList
(
Wrappers
.<
ProductSpuDO
>
lambdaQuery
()
.
in
(
ProductSpuDO:
:
getId
,
ids
));
return
CommonUtil
.
listConvert
(
productSpuDOS
,
item
->
{
AppProductSpuStatusRespVO
resp
=
new
AppProductSpuStatusRespVO
();
resp
.
setProductId
(
item
.
getId
());
resp
.
setProductName
(
item
.
getName
());
resp
.
setStatus
(
item
.
getStatus
());
return
resp
;
});
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
deleteSpu
(
Long
id
)
{
// 校验存在
...
...
foodnexus-module-system/src/main/java/cn/iocoder/foodnexus/module/system/dal/redis/RedisKeyConstants.java
View file @
cc58b6b0
...
...
@@ -119,4 +119,10 @@ public interface RedisKeyConstants {
*/
String
USER_ID_TO_DELIVERY_STAFF_ID
=
"user_id_to_delivery_staff_id"
;
/**
* 用户绑定客户id
*
*/
String
USER_TO_CUSTOMER
=
"user_to_customer_id_0"
;
}
foodnexus-module-system/src/main/java/cn/iocoder/foodnexus/module/system/service/dept/DeptServiceImpl.java
View file @
cc58b6b0
...
...
@@ -52,7 +52,7 @@ public class DeptServiceImpl implements DeptService {
private
ErpCustomerApi
customerApi
;
@Override
@CacheEvict
(
cacheNames
=
RedisKeyConstants
.
DEPT_CHILDREN_ID_LIST
,
@CacheEvict
(
cacheNames
=
RedisKeyConstants
.
DEPT_CHILDREN_ID_LIST
,
allEntries
=
true
)
// allEntries 清空所有缓存,因为操作一个部门,涉及到多个缓存
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
DeptSaveRespVO
createDept
(
DeptSaveReqVO
createReqVO
)
{
...
...
@@ -82,7 +82,7 @@ public class DeptServiceImpl implements DeptService {
}
@Override
@CacheEvict
(
cacheNames
=
RedisKeyConstants
.
DEPT_CHILDREN_ID_LIST
,
@CacheEvict
(
cacheNames
=
{
RedisKeyConstants
.
DEPT_CHILDREN_ID_LIST
,
RedisKeyConstants
.
USER_TO_CUSTOMER
}
,
allEntries
=
true
)
// allEntries 清空所有缓存,因为操作一个部门,涉及到多个缓存
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
updateDept
(
DeptSaveReqVO
updateReqVO
)
{
...
...
@@ -109,7 +109,7 @@ public class DeptServiceImpl implements DeptService {
}
@Override
@CacheEvict
(
cacheNames
=
RedisKeyConstants
.
DEPT_CHILDREN_ID_LIST
,
@CacheEvict
(
cacheNames
=
{
RedisKeyConstants
.
DEPT_CHILDREN_ID_LIST
,
RedisKeyConstants
.
USER_TO_CUSTOMER
}
,
allEntries
=
true
)
// allEntries 清空所有缓存,因为操作一个部门,涉及到多个缓存
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
deleteDept
(
Long
id
)
{
...
...
@@ -131,7 +131,7 @@ public class DeptServiceImpl implements DeptService {
}
@Override
@CacheEvict
(
cacheNames
=
RedisKeyConstants
.
DEPT_CHILDREN_ID_LIST
,
@CacheEvict
(
cacheNames
=
{
RedisKeyConstants
.
DEPT_CHILDREN_ID_LIST
,
RedisKeyConstants
.
USER_TO_CUSTOMER
}
,
allEntries
=
true
)
// allEntries 清空所有缓存,因为操作一个部门,涉及到多个缓存
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
deleteDeptList
(
List
<
Long
>
ids
)
{
...
...
foodnexus-module-system/src/main/java/cn/iocoder/foodnexus/module/system/service/user/AdminUserServiceImpl.java
View file @
cc58b6b0
...
...
@@ -27,6 +27,7 @@ import cn.iocoder.foodnexus.module.system.dal.dataobject.dept.UserPostDO;
import
cn.iocoder.foodnexus.module.system.dal.dataobject.user.AdminUserDO
;
import
cn.iocoder.foodnexus.module.system.dal.mysql.dept.UserPostMapper
;
import
cn.iocoder.foodnexus.module.system.dal.mysql.user.AdminUserMapper
;
import
cn.iocoder.foodnexus.module.system.dal.redis.RedisKeyConstants
;
import
cn.iocoder.foodnexus.module.system.service.dept.DeptService
;
import
cn.iocoder.foodnexus.module.system.service.dept.PostService
;
import
cn.iocoder.foodnexus.module.system.service.permission.PermissionService
;
...
...
@@ -39,6 +40,7 @@ import jakarta.annotation.Resource;
import
jakarta.validation.ConstraintViolationException
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.security.crypto.password.PasswordEncoder
;
import
org.springframework.stereotype.Service
;
...
...
@@ -151,6 +153,7 @@ public class AdminUserServiceImpl implements AdminUserService {
@Transactional
(
rollbackFor
=
Exception
.
class
)
@LogRecord
(
type
=
SYSTEM_USER_TYPE
,
subType
=
SYSTEM_USER_UPDATE_SUB_TYPE
,
bizNo
=
"{{#updateReqVO.id}}"
,
success
=
SYSTEM_USER_UPDATE_SUCCESS
)
@CacheEvict
(
cacheNames
=
RedisKeyConstants
.
USER_TO_CUSTOMER
,
key
=
"#updateReqVO.id"
)
public
void
updateUser
(
UserSaveReqVO
updateReqVO
)
{
updateReqVO
.
setPassword
(
null
);
// 特殊:此处不更新密码
// 1. 校验正确性
...
...
@@ -246,6 +249,7 @@ public class AdminUserServiceImpl implements AdminUserService {
@Transactional
(
rollbackFor
=
Exception
.
class
)
@LogRecord
(
type
=
SYSTEM_USER_TYPE
,
subType
=
SYSTEM_USER_DELETE_SUB_TYPE
,
bizNo
=
"{{#id}}"
,
success
=
SYSTEM_USER_DELETE_SUCCESS
)
@CacheEvict
(
cacheNames
=
RedisKeyConstants
.
USER_TO_CUSTOMER
,
key
=
"#id"
)
public
void
deleteUser
(
Long
id
)
{
// 1. 校验用户存在
AdminUserDO
user
=
validateUserExists
(
id
);
...
...
@@ -263,6 +267,7 @@ public class AdminUserServiceImpl implements AdminUserService {
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@CacheEvict
(
cacheNames
=
RedisKeyConstants
.
USER_TO_CUSTOMER
,
allEntries
=
true
)
public
void
deleteUserList
(
List
<
Long
>
ids
)
{
// 1. 批量删除用户
userMapper
.
deleteByIds
(
ids
);
...
...
foodnexus-server/src/main/resources/application-local.yaml
View file @
cc58b6b0
...
...
@@ -81,7 +81,7 @@ spring:
redis
:
host
:
127.0.0.1
# 地址
port
:
6379
# 端口
database
:
1
# 数据库索引
database
:
2
# 数据库索引
password
:
123456
# 密码,建议生产环境开启
---
#################### 定时任务相关配置 ####################
...
...
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