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
c37edf85
Commit
c37edf85
authored
Oct 15, 2025
by
杨浩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
配送员端接口
parent
e0e76314
Show whitespace changes
Inline
Side-by-side
Showing
52 changed files
with
1705 additions
and
245 deletions
+1705
-245
foodnexus-framework/foodnexus-common/src/main/java/cn/iocoder/foodnexus/framework/common/enums/UserSystemEnum.java
+1
-1
foodnexus-framework/foodnexus-spring-boot-starter-redis/src/main/java/cn/iocoder/foodnexus/framework/redis/utils/RedisUtils.java
+636
-0
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/purchase/vo/supplier/ErpSupplierPageReqVO.java
+7
-0
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/sale/ErpCustomerController.java
+5
-1
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/sale/vo/order/ErpSaleOrderPageReqVO.java
+7
-0
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/sale/vo/order/ErpSaleOrderRespVO.java
+28
-1
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/sale/vo/order/ErpSaleOrderSaveReqVO.java
+24
-1
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/sale/vo/out/ErpSaleOutRespVO.java
+27
-1
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/sale/vo/out/ErpSaleOutSaveReqVO.java
+37
-1
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/dal/dataobject/sale/ErpSaleOrderDO.java
+45
-1
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/dal/dataobject/sale/ErpSaleOutDO.java
+47
-1
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/dal/dataobject/sale/ErpSaleOutItemDO.java
+14
-0
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/dal/mysql/purchase/ErpSupplierMapper.java
+2
-0
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/dal/mysql/sale/ErpSaleOrderMapper.java
+2
-0
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/dal/redis/no/ErpNoRedisDAO.java
+5
-1
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/enums/SaleOrderPickUpStatus.java
+19
-2
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/service/customerwarehouse/CustomerWarehouseServiceImpl.java
+2
-1
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/service/sale/ErpCustomerService.java
+3
-0
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/service/sale/ErpCustomerServiceImpl.java
+18
-1
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/service/sale/ErpSaleOrderService.java
+12
-2
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/service/sale/ErpSaleOrderServiceImpl.java
+116
-17
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/service/sale/ErpSaleOutService.java
+3
-0
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/service/sale/ErpSaleOutServiceImpl.java
+20
-0
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/controller/admin/deliverystaff/DeliveryStaffController.java
+17
-1
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/controller/admin/deliverystaff/vo/DeliveryStaffBindDeptReqVO.java
+25
-0
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/controller/admin/deliverystaffcustomer/vo/DeliveryStaffCustomerRespVO.java
+5
-3
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/controller/admin/deliverystaffcustomer/vo/DeliveryStaffCustomerSaveReqVO.java
+7
-6
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/controller/admin/scoringweight/ScoringWeightController.java
+6
-0
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/controller/app/customer/AppCustomerController.java
+44
-0
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/controller/app/customerrequire/AppCustomerRequireController.java
+3
-0
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/controller/app/delivery/AppDeliveryStaffController.java
+58
-0
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/dal/dataobject/deliverystaffcustomer/DeliveryStaffCustomerDO.java
+5
-4
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/service/deliverystaff/DeliveryStaffService.java
+9
-1
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/service/deliverystaff/DeliveryStaffServiceImpl.java
+58
-13
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/service/deliverystaffcustomer/DeliveryStaffCustomerServiceImpl.java
+9
-4
foodnexus-module-mall/foodnexus-module-order-api/src/main/java/cn/iocoder/foodnexus/module/order/dto/CustomerOrderDTO.java
+10
-0
foodnexus-module-mall/foodnexus-module-order-api/src/main/java/cn/iocoder/foodnexus/module/order/dto/DeliveryOrderUpdateReqVO.java
+16
-25
foodnexus-module-mall/foodnexus-module-order-api/src/main/java/cn/iocoder/foodnexus/module/order/enums/CustomerOrderStatus.java
+1
-1
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/orderScore/vo/OrderScoreSupplierPageReqVO.java
+7
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/customerOrder/vo/AppCustomerOrderItemSaveReqVO.java
+2
-2
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/customerOrder/vo/AppCustomerOrderSaveReqVO.java
+2
-4
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/delivery/DeliveryOrderController.java
+0
-138
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/delivery/DeliverySaleOrderController.java
+147
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/delivery/vo/DeliveryOrderDetails.java
+20
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/delivery/vo/DeliverySaleOrderRespVO.java
+86
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/shoppingcart/ShoppingCartController.java
+17
-2
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/service/customerorder/CustomerOrderService.java
+2
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/service/customerorder/CustomerOrderServiceImpl.java
+54
-5
foodnexus-module-system/src/main/java/cn/iocoder/foodnexus/module/system/controller/admin/auth/vo/AuthLoginReqVO.java
+2
-2
foodnexus-module-system/src/main/java/cn/iocoder/foodnexus/module/system/controller/app/auth/AppAuthController.java
+2
-0
foodnexus-module-system/src/main/java/cn/iocoder/foodnexus/module/system/util/GenCodeUtils.java
+7
-2
No files found.
foodnexus-framework/foodnexus-common/src/main/java/cn/iocoder/foodnexus/framework/common/enums/UserSystemEnum.java
View file @
c37edf85
...
...
@@ -23,7 +23,7 @@ public enum UserSystemEnum implements ArrayValuable<String> {
// 客户
CUSTOMER
(
"客户"
,
"CUSTOMER"
),
// 运营人员
OPER
(
"运营
人员
"
,
"OPER"
);
OPER
(
"运营"
,
"OPER"
);
private
final
String
label
;
private
final
String
key
;
...
...
foodnexus-framework/foodnexus-spring-boot-starter-redis/src/main/java/cn/iocoder/foodnexus/framework/redis/utils/RedisUtils.java
0 → 100644
View file @
c37edf85
package
cn
.
iocoder
.
foodnexus
.
framework
.
redis
.
utils
;
import
cn.iocoder.foodnexus.framework.common.exception.ServerException
;
import
cn.iocoder.foodnexus.framework.common.util.spring.SpringUtils
;
import
lombok.AccessLevel
;
import
lombok.NoArgsConstructor
;
import
org.redisson.api.*
;
import
org.redisson.api.options.KeysScanOptions
;
import
java.time.Duration
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.concurrent.TimeUnit
;
import
java.util.function.Consumer
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
/**
* redis 工具类
*
* @author Lion Li
* @version 3.1.0 新增
*/
@NoArgsConstructor
(
access
=
AccessLevel
.
PRIVATE
)
@SuppressWarnings
(
value
=
{
"unchecked"
,
"rawtypes"
})
public
class
RedisUtils
{
private
static
final
RedissonClient
CLIENT
=
SpringUtils
.
getBean
(
RedissonClient
.
class
);
/**
* 限流
*
* @param key 限流key
* @param rateType 限流类型
* @param rate 速率
* @param rateInterval 速率间隔
* @return -1 表示失败
*/
public
static
long
rateLimiter
(
String
key
,
RateType
rateType
,
int
rate
,
int
rateInterval
)
{
return
rateLimiter
(
key
,
rateType
,
rate
,
rateInterval
,
0
);
}
/**
* 限流
*
* @param key 限流key
* @param rateType 限流类型
* @param rate 速率
* @param rateInterval 速率间隔
* @param timeout 超时时间
* @return -1 表示失败
*/
public
static
long
rateLimiter
(
String
key
,
RateType
rateType
,
int
rate
,
int
rateInterval
,
int
timeout
)
{
RRateLimiter
rateLimiter
=
CLIENT
.
getRateLimiter
(
key
);
rateLimiter
.
trySetRate
(
rateType
,
rate
,
Duration
.
ofSeconds
(
rateInterval
),
Duration
.
ofSeconds
(
timeout
));
if
(
rateLimiter
.
tryAcquire
())
{
return
rateLimiter
.
availablePermits
();
}
else
{
return
-
1L
;
}
}
/**
* 获取客户端实例
*/
public
static
RedissonClient
getClient
()
{
return
CLIENT
;
}
/**
* 发布通道消息
*
* @param channelKey 通道key
* @param msg 发送数据
* @param consumer 自定义处理
*/
public
static
<
T
>
void
publish
(
String
channelKey
,
T
msg
,
Consumer
<
T
>
consumer
)
{
RTopic
topic
=
CLIENT
.
getTopic
(
channelKey
);
topic
.
publish
(
msg
);
consumer
.
accept
(
msg
);
}
/**
* 发布消息到指定的频道
*
* @param channelKey 通道key
* @param msg 发送数据
*/
public
static
<
T
>
void
publish
(
String
channelKey
,
T
msg
)
{
RTopic
topic
=
CLIENT
.
getTopic
(
channelKey
);
topic
.
publish
(
msg
);
}
/**
* 订阅通道接收消息
*
* @param channelKey 通道key
* @param clazz 消息类型
* @param consumer 自定义处理
*/
public
static
<
T
>
void
subscribe
(
String
channelKey
,
Class
<
T
>
clazz
,
Consumer
<
T
>
consumer
)
{
RTopic
topic
=
CLIENT
.
getTopic
(
channelKey
);
topic
.
addListener
(
clazz
,
(
channel
,
msg
)
->
consumer
.
accept
(
msg
));
}
/**
* 缓存基本的对象,Integer、String、实体类等
*
* @param key 缓存的键值
* @param value 缓存的值
*/
public
static
<
T
>
void
setCacheObject
(
final
String
key
,
final
T
value
)
{
setCacheObject
(
key
,
value
,
false
);
}
/**
* 缓存基本的对象,保留当前对象 TTL 有效期
*
* @param key 缓存的键值
* @param value 缓存的值
* @param isSaveTtl 是否保留TTL有效期(例如: set之前ttl剩余90 set之后还是为90)
* @since Redis 6.X 以上使用 setAndKeepTTL 兼容 5.X 方案
*/
public
static
<
T
>
void
setCacheObject
(
final
String
key
,
final
T
value
,
final
boolean
isSaveTtl
)
{
RBucket
<
T
>
bucket
=
CLIENT
.
getBucket
(
key
);
if
(
isSaveTtl
)
{
try
{
bucket
.
setAndKeepTTL
(
value
);
}
catch
(
Exception
e
)
{
long
timeToLive
=
bucket
.
remainTimeToLive
();
if
(
timeToLive
==
-
1
)
{
setCacheObject
(
key
,
value
);
}
else
{
setCacheObject
(
key
,
value
,
Duration
.
ofMillis
(
timeToLive
));
}
}
}
else
{
bucket
.
set
(
value
);
}
}
/**
* 缓存基本的对象,Integer、String、实体类等
*
* @param key 缓存的键值
* @param value 缓存的值
* @param duration 时间
*/
public
static
<
T
>
void
setCacheObject
(
final
String
key
,
final
T
value
,
final
Duration
duration
)
{
RBatch
batch
=
CLIENT
.
createBatch
();
RBucketAsync
<
T
>
bucket
=
batch
.
getBucket
(
key
);
bucket
.
setAsync
(
value
);
bucket
.
expireAsync
(
duration
);
batch
.
execute
();
}
/**
* 如果不存在则设置 并返回 true 如果存在则返回 false
*
* @param key 缓存的键值
* @param value 缓存的值
* @return set成功或失败
*/
public
static
<
T
>
boolean
setObjectIfAbsent
(
final
String
key
,
final
T
value
,
final
Duration
duration
)
{
RBucket
<
T
>
bucket
=
CLIENT
.
getBucket
(
key
);
return
bucket
.
setIfAbsent
(
value
,
duration
);
}
/**
* 如果存在则设置 并返回 true 如果存在则返回 false
*
* @param key 缓存的键值
* @param value 缓存的值
* @return set成功或失败
*/
public
static
<
T
>
boolean
setObjectIfExists
(
final
String
key
,
final
T
value
,
final
Duration
duration
)
{
RBucket
<
T
>
bucket
=
CLIENT
.
getBucket
(
key
);
return
bucket
.
setIfExists
(
value
,
duration
);
}
/**
* 注册对象监听器
* <p>
* key 监听器需开启 `notify-keyspace-events` 等 redis 相关配置
*
* @param key 缓存的键值
* @param listener 监听器配置
*/
public
static
<
T
>
void
addObjectListener
(
final
String
key
,
final
ObjectListener
listener
)
{
RBucket
<
T
>
result
=
CLIENT
.
getBucket
(
key
);
result
.
addListener
(
listener
);
}
/**
* 设置有效时间
*
* @param key Redis键
* @param timeout 超时时间
* @return true=设置成功;false=设置失败
*/
public
static
boolean
expire
(
final
String
key
,
final
long
timeout
)
{
return
expire
(
key
,
Duration
.
ofSeconds
(
timeout
));
}
/**
* 设置有效时间
*
* @param key Redis键
* @param duration 超时时间
* @return true=设置成功;false=设置失败
*/
public
static
boolean
expire
(
final
String
key
,
final
Duration
duration
)
{
RBucket
rBucket
=
CLIENT
.
getBucket
(
key
);
return
rBucket
.
expire
(
duration
);
}
/**
* 获得缓存的基本对象。
*
* @param key 缓存键值
* @return 缓存键值对应的数据
*/
public
static
<
T
>
T
getCacheObject
(
final
String
key
)
{
RBucket
<
T
>
rBucket
=
CLIENT
.
getBucket
(
key
);
return
rBucket
.
get
();
}
/**
* 获得key剩余存活时间
*
* @param key 缓存键值
* @return 剩余存活时间
*/
public
static
<
T
>
long
getTimeToLive
(
final
String
key
)
{
RBucket
<
T
>
rBucket
=
CLIENT
.
getBucket
(
key
);
return
rBucket
.
remainTimeToLive
();
}
/**
* 删除单个对象
*
* @param key 缓存的键值
*/
public
static
boolean
deleteObject
(
final
String
key
)
{
return
CLIENT
.
getBucket
(
key
).
delete
();
}
/**
* 删除集合对象
*
* @param collection 多个对象
*/
public
static
void
deleteObject
(
final
Collection
collection
)
{
RBatch
batch
=
CLIENT
.
createBatch
();
collection
.
forEach
(
t
->
{
batch
.
getBucket
(
t
.
toString
()).
deleteAsync
();
});
batch
.
execute
();
}
/**
* 检查缓存对象是否存在
*
* @param key 缓存的键值
*/
public
static
boolean
isExistsObject
(
final
String
key
)
{
return
CLIENT
.
getBucket
(
key
).
isExists
();
}
/**
* 缓存List数据
*
* @param key 缓存的键值
* @param dataList 待缓存的List数据
* @return 缓存的对象
*/
public
static
<
T
>
boolean
setCacheList
(
final
String
key
,
final
List
<
T
>
dataList
)
{
RList
<
T
>
rList
=
CLIENT
.
getList
(
key
);
return
rList
.
addAll
(
dataList
);
}
/**
* 追加缓存List数据
*
* @param key 缓存的键值
* @param data 待缓存的数据
* @return 缓存的对象
*/
public
static
<
T
>
boolean
addCacheList
(
final
String
key
,
final
T
data
)
{
RList
<
T
>
rList
=
CLIENT
.
getList
(
key
);
return
rList
.
add
(
data
);
}
/**
* 注册List监听器
* <p>
* key 监听器需开启 `notify-keyspace-events` 等 redis 相关配置
*
* @param key 缓存的键值
* @param listener 监听器配置
*/
public
static
<
T
>
void
addListListener
(
final
String
key
,
final
ObjectListener
listener
)
{
RList
<
T
>
rList
=
CLIENT
.
getList
(
key
);
rList
.
addListener
(
listener
);
}
/**
* 获得缓存的list对象
*
* @param key 缓存的键值
* @return 缓存键值对应的数据
*/
public
static
<
T
>
List
<
T
>
getCacheList
(
final
String
key
)
{
RList
<
T
>
rList
=
CLIENT
.
getList
(
key
);
return
rList
.
readAll
();
}
/**
* 获得缓存的list对象(范围)
*
* @param key 缓存的键值
* @param form 起始下标
* @param to 截止下标
* @return 缓存键值对应的数据
*/
public
static
<
T
>
List
<
T
>
getCacheListRange
(
final
String
key
,
int
form
,
int
to
)
{
RList
<
T
>
rList
=
CLIENT
.
getList
(
key
);
return
rList
.
range
(
form
,
to
);
}
/**
* 缓存Set
*
* @param key 缓存键值
* @param dataSet 缓存的数据
* @return 缓存数据的对象
*/
public
static
<
T
>
boolean
setCacheSet
(
final
String
key
,
final
Set
<
T
>
dataSet
)
{
RSet
<
T
>
rSet
=
CLIENT
.
getSet
(
key
);
return
rSet
.
addAll
(
dataSet
);
}
/**
* 追加缓存Set数据
*
* @param key 缓存的键值
* @param data 待缓存的数据
* @return 缓存的对象
*/
public
static
<
T
>
boolean
addCacheSet
(
final
String
key
,
final
T
data
)
{
RSet
<
T
>
rSet
=
CLIENT
.
getSet
(
key
);
return
rSet
.
add
(
data
);
}
/**
* 注册Set监听器
* <p>
* key 监听器需开启 `notify-keyspace-events` 等 redis 相关配置
*
* @param key 缓存的键值
* @param listener 监听器配置
*/
public
static
<
T
>
void
addSetListener
(
final
String
key
,
final
ObjectListener
listener
)
{
RSet
<
T
>
rSet
=
CLIENT
.
getSet
(
key
);
rSet
.
addListener
(
listener
);
}
/**
* 获得缓存的set
*
* @param key 缓存的key
* @return set对象
*/
public
static
<
T
>
Set
<
T
>
getCacheSet
(
final
String
key
)
{
RSet
<
T
>
rSet
=
CLIENT
.
getSet
(
key
);
return
rSet
.
readAll
();
}
/**
* 缓存Map
*
* @param key 缓存的键值
* @param dataMap 缓存的数据
*/
public
static
<
T
>
void
setCacheMap
(
final
String
key
,
final
Map
<
String
,
T
>
dataMap
)
{
if
(
dataMap
!=
null
)
{
RMap
<
String
,
T
>
rMap
=
CLIENT
.
getMap
(
key
);
rMap
.
putAll
(
dataMap
);
}
}
/**
* 注册Map监听器
* <p>
* key 监听器需开启 `notify-keyspace-events` 等 redis 相关配置
*
* @param key 缓存的键值
* @param listener 监听器配置
*/
public
static
<
T
>
void
addMapListener
(
final
String
key
,
final
ObjectListener
listener
)
{
RMap
<
String
,
T
>
rMap
=
CLIENT
.
getMap
(
key
);
rMap
.
addListener
(
listener
);
}
/**
* 获得缓存的Map
*
* @param key 缓存的键值
* @return map对象
*/
public
static
<
T
>
Map
<
String
,
T
>
getCacheMap
(
final
String
key
)
{
RMap
<
String
,
T
>
rMap
=
CLIENT
.
getMap
(
key
);
return
rMap
.
getAll
(
rMap
.
keySet
());
}
/**
* 获得缓存Map的key列表
*
* @param key 缓存的键值
* @return key列表
*/
public
static
<
T
>
Set
<
String
>
getCacheMapKeySet
(
final
String
key
)
{
RMap
<
String
,
T
>
rMap
=
CLIENT
.
getMap
(
key
);
return
rMap
.
keySet
();
}
/**
* 往Hash中存入数据
*
* @param key Redis键
* @param hKey Hash键
* @param value 值
*/
public
static
<
T
>
void
setCacheMapValue
(
final
String
key
,
final
String
hKey
,
final
T
value
)
{
RMap
<
String
,
T
>
rMap
=
CLIENT
.
getMap
(
key
);
rMap
.
put
(
hKey
,
value
);
}
/**
* 获取Hash中的数据
*
* @param key Redis键
* @param hKey Hash键
* @return Hash中的对象
*/
public
static
<
T
>
T
getCacheMapValue
(
final
String
key
,
final
String
hKey
)
{
RMap
<
String
,
T
>
rMap
=
CLIENT
.
getMap
(
key
);
return
rMap
.
get
(
hKey
);
}
/**
* 删除Hash中的数据
*
* @param key Redis键
* @param hKey Hash键
* @return Hash中的对象
*/
public
static
<
T
>
T
delCacheMapValue
(
final
String
key
,
final
String
hKey
)
{
RMap
<
String
,
T
>
rMap
=
CLIENT
.
getMap
(
key
);
return
rMap
.
remove
(
hKey
);
}
/**
* 删除Hash中的数据
*
* @param key Redis键
* @param hKeys Hash键
*/
public
static
<
T
>
void
delMultiCacheMapValue
(
final
String
key
,
final
Set
<
String
>
hKeys
)
{
RBatch
batch
=
CLIENT
.
createBatch
();
RMapAsync
<
String
,
T
>
rMap
=
batch
.
getMap
(
key
);
for
(
String
hKey
:
hKeys
)
{
rMap
.
removeAsync
(
hKey
);
}
batch
.
execute
();
}
/**
* 获取多个Hash中的数据
*
* @param key Redis键
* @param hKeys Hash键集合
* @return Hash对象集合
*/
public
static
<
K
,
V
>
Map
<
K
,
V
>
getMultiCacheMapValue
(
final
String
key
,
final
Set
<
K
>
hKeys
)
{
RMap
<
K
,
V
>
rMap
=
CLIENT
.
getMap
(
key
);
return
rMap
.
getAll
(
hKeys
);
}
/**
* 设置原子值
*
* @param key Redis键
* @param value 值
*/
public
static
void
setAtomicValue
(
String
key
,
long
value
)
{
RAtomicLong
atomic
=
CLIENT
.
getAtomicLong
(
key
);
atomic
.
set
(
value
);
}
/**
* 获取原子值
*
* @param key Redis键
* @return 当前值
*/
public
static
long
getAtomicValue
(
String
key
)
{
RAtomicLong
atomic
=
CLIENT
.
getAtomicLong
(
key
);
return
atomic
.
get
();
}
/**
* 递增原子值
*
* @param key Redis键
* @return 当前值
*/
public
static
long
incrAtomicValue
(
String
key
)
{
RAtomicLong
atomic
=
CLIENT
.
getAtomicLong
(
key
);
return
atomic
.
incrementAndGet
();
}
/**
* 递减原子值
*
* @param key Redis键
* @return 当前值
*/
public
static
long
decrAtomicValue
(
String
key
)
{
RAtomicLong
atomic
=
CLIENT
.
getAtomicLong
(
key
);
return
atomic
.
decrementAndGet
();
}
/**
* 获得缓存的基本对象列表(全局匹配忽略租户 自行拼接租户id)
* <p>
* limit-设置扫描的限制数量(默认为0,查询全部)
* pattern-设置键的匹配模式(默认为null)
* chunkSize-设置每次扫描的块大小(默认为0,本方法设置为1000)
* type-设置键的类型(默认为null,查询全部类型)
* </P>
*
* @param pattern 字符串前缀
* @return 对象列表
* @see KeysScanOptions
*/
public
static
Collection
<
String
>
keys
(
final
String
pattern
)
{
return
keys
(
KeysScanOptions
.
defaults
().
pattern
(
pattern
).
chunkSize
(
1000
));
}
/**
* 通过扫描参数获取缓存的基本对象列表
*
* @param keysScanOptions 扫描参数
* <p>
* limit-设置扫描的限制数量(默认为0,查询全部)
* pattern-设置键的匹配模式(默认为null)
* chunkSize-设置每次扫描的块大小(默认为0)
* type-设置键的类型(默认为null,查询全部类型)
* </P>
* @see KeysScanOptions
*/
public
static
Collection
<
String
>
keys
(
final
KeysScanOptions
keysScanOptions
)
{
Stream
<
String
>
keysStream
=
CLIENT
.
getKeys
().
getKeysStream
(
keysScanOptions
);
return
keysStream
.
collect
(
Collectors
.
toList
());
}
/**
* 删除缓存的基本对象列表(全局匹配忽略租户 自行拼接租户id)
*
* @param pattern 字符串前缀
*/
public
static
void
deleteKeys
(
final
String
pattern
)
{
CLIENT
.
getKeys
().
deleteByPattern
(
pattern
);
}
/**
* 检查redis中是否存在key
*
* @param key 键
*/
public
static
Boolean
hasKey
(
String
key
)
{
RKeys
rKeys
=
CLIENT
.
getKeys
();
return
rKeys
.
countExists
(
key
)
>
0
;
}
/**
* redisson加锁
* 不等待锁释放
*
* @param key 锁
*/
public
static
RLock
tryLockRds
(
String
key
)
{
RLock
rLock
=
CLIENT
.
getLock
(
key
);
try
{
boolean
b
=
rLock
.
tryLock
(
0
,
90
,
TimeUnit
.
SECONDS
);
if
(
b
)
{
return
rLock
;
}
throw
new
ServerException
(
10000
,
"操作过快,请稍等"
);
}
catch
(
InterruptedException
e
)
{
throw
new
ServerException
(
10000
,
"操作过快,请稍等"
);
}
}
/**
* redisson加锁-不续锁
* 等待锁释放最多 LOCK_WAIT_TIME 秒时间
*
* @param key 锁
*/
public
static
RLock
tryLockRdsWait
(
String
key
)
{
RLock
lock
=
CLIENT
.
getLock
(
key
);
try
{
boolean
b
=
lock
.
tryLock
(
5
,
60
,
TimeUnit
.
SECONDS
);
if
(
b
)
{
return
lock
;
}
}
catch
(
InterruptedException
e
)
{
throw
new
ServerException
(
10000
,
"操作过快,请稍等"
);
}
throw
new
ServerException
(
10000
,
"操作过快,请稍等"
);
}
/**
* redisson 解锁
*
* @param key 锁
*/
public
static
void
unLockRds
(
String
key
)
{
RLock
lock
=
CLIENT
.
getLock
(
key
);
lock
.
unlock
();
}
}
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/purchase/vo/supplier/ErpSupplierPageReqVO.java
View file @
c37edf85
...
...
@@ -29,4 +29,10 @@ public class ErpSupplierPageReqVO extends PageParam {
@Schema
(
description
=
"联系电话"
,
example
=
"18818288888"
)
private
String
telephone
;
@Schema
(
description
=
"联系人"
)
private
String
contact
;
@Schema
(
description
=
"统一社会信用代码"
)
private
String
unifiedSocialCreditCode
;
}
\ No newline at end of file
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/sale/ErpCustomerController.java
View file @
c37edf85
...
...
@@ -18,6 +18,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import
jakarta.annotation.Resource
;
import
jakarta.servlet.http.HttpServletResponse
;
import
jakarta.validation.Valid
;
import
jakarta.validation.constraints.Size
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -68,7 +69,10 @@ public class ErpCustomerController {
@Operation
(
summary
=
"客户绑定仓库"
)
@Parameter
(
name
=
"id"
,
description
=
"编号"
,
required
=
true
,
example
=
"1024"
)
@Parameter
(
name
=
"warehouseAreaIds"
,
description
=
"库区id集合"
,
required
=
true
,
example
=
"1024"
)
public
CommonResult
<
Boolean
>
bindWarehouse
(
@RequestParam
(
"id"
)
Long
id
,
@RequestParam
(
"warehouseAreaIds"
)
List
<
Long
>
warehouseAreaIds
)
{
public
CommonResult
<
Boolean
>
bindWarehouse
(
@RequestParam
(
"id"
)
Long
id
,
@RequestParam
(
"warehouseAreaIds"
)
@Size
(
max
=
1
,
min
=
1
,
message
=
"只能绑定一个库区"
)
List
<
Long
>
warehouseAreaIds
)
{
customerService
.
bindWarehouse
(
id
,
warehouseAreaIds
);
return
success
(
Boolean
.
TRUE
);
}
...
...
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/sale/vo/order/ErpSaleOrderPageReqVO.java
View file @
c37edf85
...
...
@@ -9,6 +9,7 @@ import lombok.ToString;
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
;
...
...
@@ -50,6 +51,12 @@ public class ErpSaleOrderPageReqVO extends PageParam {
@Schema
(
description
=
"客户编号"
,
example
=
"1724"
)
private
Long
customerId
;
@Schema
(
description
=
"灶点id"
)
private
Long
customerDeptId
;
@Schema
(
description
=
"灶点id集合"
)
private
List
<
Long
>
customerDeptIds
;
@Schema
(
description
=
"下单时间"
)
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
private
LocalDateTime
[]
orderTime
;
...
...
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/sale/vo/order/ErpSaleOrderRespVO.java
View file @
c37edf85
...
...
@@ -2,6 +2,7 @@ package cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.order;
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.enums.SaleOrderPickUpStatus
;
import
cn.iocoder.foodnexus.module.order.dto.CustomerAddressInfo
;
import
cn.iocoder.foodnexus.module.order.enums.DeliveryMode
;
...
...
@@ -111,9 +112,18 @@ public class ErpSaleOrderRespVO {
@Schema
(
description
=
"配送模式"
)
private
DeliveryMode
deliveryMode
;
@Schema
(
description
=
"配送时间"
)
@Schema
(
description
=
"配送时间
(取货时间)
"
)
private
LocalDateTime
deliveryTime
;
@Schema
(
description
=
"接单时间"
)
private
LocalDateTime
acceptTime
;
@Schema
(
description
=
"送达时间"
)
private
LocalDateTime
arrivalTime
;
@Schema
(
description
=
"客户签收时间"
)
private
LocalDateTime
signTime
;
@Schema
(
description
=
"配送人员"
)
private
Long
deliveryStaffId
;
...
...
@@ -127,6 +137,23 @@ public class ErpSaleOrderRespVO {
@Schema
(
description
=
"拣货状态"
)
private
SaleOrderPickUpStatus
pickUpStatus
;
@Schema
(
description
=
"收获仓库id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"27065"
)
private
Long
warehouseId
;
@Schema
(
description
=
"收获库区id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"26507"
)
private
Long
warehouseAreaId
;
@Schema
(
description
=
"仓库信息"
)
private
WarehouseInfo
warehouseInfo
;
@Schema
(
description
=
"预计配送开始时间"
)
private
LocalDateTime
planDeliveryStartTime
;
@Schema
(
description
=
"预计配送结束时间"
)
private
LocalDateTime
planDeliveryEndTime
;
@Data
public
static
class
Item
{
...
...
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/sale/vo/order/ErpSaleOrderSaveReqVO.java
View file @
c37edf85
package
cn
.
iocoder
.
foodnexus
.
module
.
erp
.
controller
.
admin
.
sale
.
vo
.
order
;
import
cn.idev.excel.annotation.ExcelProperty
;
import
cn.iocoder.foodnexus.module.erp.api.vo.warehouse.WarehouseInfo
;
import
cn.iocoder.foodnexus.module.erp.enums.SaleOrderPickUpStatus
;
import
cn.iocoder.foodnexus.module.order.dto.CustomerAddressInfo
;
import
cn.iocoder.foodnexus.module.order.enums.DeliveryMode
;
...
...
@@ -24,6 +26,9 @@ public class ErpSaleOrderSaveReqVO {
@NotNull
(
message
=
"客户编号不能为空"
)
private
Long
customerId
;
@Schema
(
description
=
"灶点id"
)
private
Long
customerDeptId
;
@Schema
(
description
=
"下单时间"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@NotNull
(
message
=
"下单时间不能为空"
)
private
LocalDateTime
orderTime
;
...
...
@@ -53,7 +58,7 @@ public class ErpSaleOrderSaveReqVO {
@Schema
(
description
=
"配送模式"
)
private
DeliveryMode
deliveryMode
;
@Schema
(
description
=
"配送时间"
)
@Schema
(
description
=
"配送时间
(取货时间)
"
)
private
LocalDateTime
deliveryTime
;
@Schema
(
description
=
"配送人员"
)
...
...
@@ -66,6 +71,24 @@ public class ErpSaleOrderSaveReqVO {
@TableField
(
typeHandler
=
JacksonTypeHandler
.
class
)
private
CustomerAddressInfo
addressInfo
;
@Schema
(
description
=
"收获仓库id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"27065"
)
private
Long
warehouseId
;
@Schema
(
description
=
"收获库区id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"26507"
)
private
Long
warehouseAreaId
;
@Schema
(
description
=
"仓库信息"
)
private
WarehouseInfo
warehouseInfo
;
@Schema
(
description
=
"预计配送开始时间"
)
private
LocalDateTime
planDeliveryStartTime
;
@Schema
(
description
=
"预计配送结束时间"
)
private
LocalDateTime
planDeliveryEndTime
;
@Schema
(
description
=
"拣货状态"
)
private
SaleOrderPickUpStatus
pickUpStatus
;
@Schema
(
description
=
"订单清单列表"
)
private
List
<
Item
>
items
;
...
...
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/sale/vo/out/ErpSaleOutRespVO.java
View file @
c37edf85
...
...
@@ -2,6 +2,8 @@ package cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.out;
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.enums.SaleOrderPickUpStatus
;
import
cn.iocoder.foodnexus.module.order.dto.CustomerAddressInfo
;
import
cn.iocoder.foodnexus.module.order.enums.DeliveryMode
;
import
com.baomidou.mybatisplus.annotation.TableField
;
...
...
@@ -107,7 +109,7 @@ public class ErpSaleOutRespVO {
@Schema
(
description
=
"配送模式"
)
private
DeliveryMode
deliveryMode
;
@Schema
(
description
=
"配送时间"
)
@Schema
(
description
=
"配送时间
(取货时间)
"
)
private
LocalDateTime
deliveryTime
;
@Schema
(
description
=
"配送人员"
)
...
...
@@ -120,6 +122,24 @@ public class ErpSaleOutRespVO {
@TableField
(
typeHandler
=
JacksonTypeHandler
.
class
)
private
CustomerAddressInfo
addressInfo
;
@Schema
(
description
=
"收获仓库id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"27065"
)
private
Long
warehouseId
;
@Schema
(
description
=
"收获库区id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"26507"
)
private
Long
warehouseAreaId
;
@Schema
(
description
=
"仓库信息"
)
private
WarehouseInfo
warehouseInfo
;
@Schema
(
description
=
"预计配送开始时间"
)
private
LocalDateTime
planDeliveryStartTime
;
@Schema
(
description
=
"预计配送结束时间"
)
private
LocalDateTime
planDeliveryEndTime
;
@Schema
(
description
=
"拣货状态"
)
private
SaleOrderPickUpStatus
pickUpStatus
;
@Data
public
static
class
Item
{
...
...
@@ -154,6 +174,12 @@ public class ErpSaleOutRespVO {
@Schema
(
description
=
"备注"
,
example
=
"随便"
)
private
String
remark
;
@Schema
(
description
=
"客户订单子项id"
)
private
Long
customerOrderItemId
;
@Schema
(
description
=
"拣货状态"
)
private
SaleOrderPickUpStatus
pickUpStatus
;
// ========== 关联字段 ==========
@Schema
(
description
=
"产品名称"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"巧克力"
)
...
...
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/sale/vo/out/ErpSaleOutSaveReqVO.java
View file @
c37edf85
package
cn
.
iocoder
.
foodnexus
.
module
.
erp
.
controller
.
admin
.
sale
.
vo
.
out
;
import
cn.iocoder.foodnexus.module.erp.api.vo.warehouse.WarehouseInfo
;
import
cn.iocoder.foodnexus.module.erp.enums.SaleOrderPickUpStatus
;
import
cn.iocoder.foodnexus.module.order.dto.CustomerAddressInfo
;
import
cn.iocoder.foodnexus.module.order.enums.DeliveryMode
;
import
com.baomidou.mybatisplus.annotation.TableField
;
...
...
@@ -54,9 +56,18 @@ public class ErpSaleOutSaveReqVO {
@Schema
(
description
=
"配送模式"
)
private
DeliveryMode
deliveryMode
;
@Schema
(
description
=
"配送时间"
)
@Schema
(
description
=
"配送时间
(取货时间)
"
)
private
LocalDateTime
deliveryTime
;
@Schema
(
description
=
"接单时间"
)
private
LocalDateTime
acceptTime
;
@Schema
(
description
=
"送达时间"
)
private
LocalDateTime
arrivalTime
;
@Schema
(
description
=
"客户签收时间"
)
private
LocalDateTime
signTime
;
@Schema
(
description
=
"配送人员"
)
private
Long
deliveryStaffId
;
...
...
@@ -67,6 +78,24 @@ public class ErpSaleOutSaveReqVO {
@TableField
(
typeHandler
=
JacksonTypeHandler
.
class
)
private
CustomerAddressInfo
addressInfo
;
@Schema
(
description
=
"收获仓库id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"27065"
)
private
Long
warehouseId
;
@Schema
(
description
=
"收获库区id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"26507"
)
private
Long
warehouseAreaId
;
@Schema
(
description
=
"仓库信息"
)
private
WarehouseInfo
warehouseInfo
;
@Schema
(
description
=
"预计配送开始时间"
)
private
LocalDateTime
planDeliveryStartTime
;
@Schema
(
description
=
"预计配送结束时间"
)
private
LocalDateTime
planDeliveryEndTime
;
@Schema
(
description
=
"拣货状态"
)
private
SaleOrderPickUpStatus
pickUpStatus
;
@Data
public
static
class
Item
{
...
...
@@ -102,6 +131,12 @@ public class ErpSaleOutSaveReqVO {
@Schema
(
description
=
"备注"
,
example
=
"随便"
)
private
String
remark
;
@Schema
(
description
=
"客户订单子项id"
)
private
Long
customerOrderItemId
;
@Schema
(
description
=
"拣货状态"
)
private
SaleOrderPickUpStatus
pickUpStatus
;
}
}
\ No newline at end of file
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/dal/dataobject/sale/ErpSaleOrderDO.java
View file @
c37edf85
...
...
@@ -2,6 +2,7 @@ package cn.iocoder.foodnexus.module.erp.dal.dataobject.sale;
import
cn.iocoder.foodnexus.framework.mybatis.core.dataobject.BaseDO
;
import
cn.iocoder.foodnexus.module.erp.api.enums.ErpAuditStatus
;
import
cn.iocoder.foodnexus.module.erp.api.vo.warehouse.WarehouseInfo
;
import
cn.iocoder.foodnexus.module.erp.dal.dataobject.finance.ErpAccountDO
;
import
cn.iocoder.foodnexus.module.erp.enums.SaleOrderPickUpStatus
;
import
cn.iocoder.foodnexus.module.order.dto.CustomerAddressInfo
;
...
...
@@ -53,6 +54,10 @@ public class ErpSaleOrderDO extends BaseDO {
*/
private
Long
customerId
;
/**
* 灶点id
*/
private
Long
customerDeptId
;
/**
* 结算账户编号
*
* 关联 {@link ErpAccountDO#getId()}
...
...
@@ -137,11 +142,26 @@ public class ErpSaleOrderDO extends BaseDO {
private
DeliveryMode
deliveryMode
;
/**
* 配送时间
* 配送时间
(取货时间)
*/
private
LocalDateTime
deliveryTime
;
/**
* 接单时间
*/
private
LocalDateTime
acceptTime
;
/**
* 送达时间
*/
private
LocalDateTime
arrivalTime
;
/**
* 客户签收时间
*/
private
LocalDateTime
signTime
;
/**
* 配送人员
*
* DeliveryStaffDO
...
...
@@ -163,4 +183,27 @@ public class ErpSaleOrderDO extends BaseDO {
* 拣货状态
*/
private
SaleOrderPickUpStatus
pickUpStatus
;
/**
* 收获仓库id
*/
private
Long
warehouseId
;
/**
* 收获库区id
*/
private
Long
warehouseAreaId
;
/**
* 仓库信息
*/
@TableField
(
typeHandler
=
JacksonTypeHandler
.
class
)
private
WarehouseInfo
warehouseInfo
;
/**
* 预计配送开始时间
*/
private
LocalDateTime
planDeliveryStartTime
;
/**
* 预计配送结束时间
*/
private
LocalDateTime
planDeliveryEndTime
;
}
\ No newline at end of file
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/dal/dataobject/sale/ErpSaleOutDO.java
View file @
c37edf85
...
...
@@ -2,7 +2,9 @@ package cn.iocoder.foodnexus.module.erp.dal.dataobject.sale;
import
cn.iocoder.foodnexus.framework.mybatis.core.dataobject.BaseDO
;
import
cn.iocoder.foodnexus.module.erp.api.enums.ErpAuditStatus
;
import
cn.iocoder.foodnexus.module.erp.api.vo.warehouse.WarehouseInfo
;
import
cn.iocoder.foodnexus.module.erp.dal.dataobject.finance.ErpAccountDO
;
import
cn.iocoder.foodnexus.module.erp.enums.SaleOrderPickUpStatus
;
import
cn.iocoder.foodnexus.module.order.dto.CustomerAddressInfo
;
import
cn.iocoder.foodnexus.module.order.enums.DeliveryMode
;
import
com.baomidou.mybatisplus.annotation.KeySequence
;
...
...
@@ -143,11 +145,26 @@ public class ErpSaleOutDO extends BaseDO {
private
DeliveryMode
deliveryMode
;
/**
* 配送时间
* 配送时间
(取货时间)
*/
private
LocalDateTime
deliveryTime
;
/**
* 接单时间
*/
private
LocalDateTime
acceptTime
;
/**
* 送达时间
*/
private
LocalDateTime
arrivalTime
;
/**
* 客户签收时间
*/
private
LocalDateTime
signTime
;
/**
* 配送人员
*
* DeliveryStaffDO
...
...
@@ -164,4 +181,32 @@ public class ErpSaleOutDO extends BaseDO {
*/
@TableField
(
typeHandler
=
JacksonTypeHandler
.
class
)
private
CustomerAddressInfo
addressInfo
;
/**
* 收获仓库id
*/
private
Long
warehouseId
;
/**
* 收获库区id
*/
private
Long
warehouseAreaId
;
/**
* 仓库信息
*/
@TableField
(
typeHandler
=
JacksonTypeHandler
.
class
)
private
WarehouseInfo
warehouseInfo
;
/**
* 预计配送开始时间
*/
private
LocalDateTime
planDeliveryStartTime
;
/**
* 预计配送结束时间
*/
private
LocalDateTime
planDeliveryEndTime
;
/**
* 拣货状态
*/
private
SaleOrderPickUpStatus
pickUpStatus
;
}
\ No newline at end of file
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/dal/dataobject/sale/ErpSaleOutItemDO.java
View file @
c37edf85
...
...
@@ -4,6 +4,7 @@ import cn.iocoder.foodnexus.framework.mybatis.core.dataobject.BaseDO;
import
cn.iocoder.foodnexus.module.erp.dal.dataobject.product.ErpProductDO
;
import
cn.iocoder.foodnexus.module.erp.dal.dataobject.stock.ErpStockOutDO
;
import
cn.iocoder.foodnexus.module.erp.dal.dataobject.stock.ErpWarehouseDO
;
import
cn.iocoder.foodnexus.module.erp.enums.SaleOrderPickUpStatus
;
import
com.baomidou.mybatisplus.annotation.KeySequence
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
...
...
@@ -100,4 +101,16 @@ public class ErpSaleOutItemDO extends BaseDO {
@TableField
(
typeHandler
=
JacksonTypeHandler
.
class
)
private
List
<
String
>
remarkFiles
;
/**
* 客户订单子项id
* @link // CustomerOrderItemDO#getId()
*/
private
Long
customerOrderItemId
;
/**
* 拣货状态
*
* {@link SaleOrderPickUpStatus}
*/
private
SaleOrderPickUpStatus
pickUpStatus
;
}
\ No newline at end of file
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/dal/mysql/purchase/ErpSupplierMapper.java
View file @
c37edf85
...
...
@@ -25,6 +25,8 @@ public interface ErpSupplierMapper extends BaseMapperX<ErpSupplierDO> {
.
inIfPresent
(
ErpSupplierDO:
:
getId
,
reqVO
.
getIdList
())
.
likeIfPresent
(
ErpSupplierDO:
:
getMobile
,
reqVO
.
getMobile
())
.
likeIfPresent
(
ErpSupplierDO:
:
getTelephone
,
reqVO
.
getTelephone
())
.
eqIfPresent
(
ErpSupplierDO:
:
getUnifiedSocialCreditCode
,
reqVO
.
getUnifiedSocialCreditCode
())
.
likeIfPresent
(
ErpSupplierDO:
:
getContact
,
reqVO
.
getContact
())
.
orderByDesc
(
ErpSupplierDO:
:
getId
));
}
...
...
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/dal/mysql/sale/ErpSaleOrderMapper.java
View file @
c37edf85
...
...
@@ -31,6 +31,8 @@ public interface ErpSaleOrderMapper extends BaseMapperX<ErpSaleOrderDO> {
.
eqIfPresent
(
ErpSaleOrderDO:
:
getCreator
,
reqVO
.
getCreator
())
.
eqIfPresent
(
ErpSaleOrderDO:
:
getDeliveryStaffId
,
reqVO
.
getDeliveryStaffId
())
.
eqIfPresent
(
ErpSaleOrderDO:
:
getPickUpStatus
,
reqVO
.
getPickUpStatus
())
.
eqIfPresent
(
ErpSaleOrderDO:
:
getCustomerDeptId
,
reqVO
.
getCustomerDeptId
())
.
inIfPresent
(
ErpSaleOrderDO:
:
getCustomerDeptId
,
reqVO
.
getCustomerDeptIds
())
.
orderByDesc
(
ErpSaleOrderDO:
:
getId
);
// 入库状态。为什么需要 t. 的原因,是因为联表查询时,需要指定表名,不然会报 out_count 错误
if
(
Objects
.
equals
(
reqVO
.
getOutStatus
(),
ErpSaleOrderPageReqVO
.
OUT_STATUS_NONE
))
{
...
...
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/dal/redis/no/ErpNoRedisDAO.java
View file @
c37edf85
...
...
@@ -9,6 +9,7 @@ import org.springframework.stereotype.Repository;
import
java.time.Duration
;
import
java.time.LocalDateTime
;
import
java.util.concurrent.ThreadLocalRandom
;
/**
...
...
@@ -90,7 +91,10 @@ public class ErpNoRedisDAO {
Long
no
=
stringRedisTemplate
.
opsForValue
().
increment
(
key
);
// 设置过期时间
stringRedisTemplate
.
expire
(
key
,
Duration
.
ofDays
(
1L
));
return
noPrefix
+
String
.
format
(
"%06d"
,
no
);
return
noPrefix
+
random
()
+
String
.
format
(
"%06d"
,
no
);
}
private
int
random
()
{
return
ThreadLocalRandom
.
current
().
nextInt
(
100
,
1000
);
}
}
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/enums/SaleOrderPickUpStatus.java
View file @
c37edf85
package
cn
.
iocoder
.
foodnexus
.
module
.
erp
.
enums
;
import
cn.iocoder.foodnexus.framework.common.core.ArrayValuable
;
import
cn.iocoder.foodnexus.framework.common.util.CommonUtil
;
import
cn.iocoder.foodnexus.module.erp.enums.stock.ErpStockRecordBizTypeEnum
;
import
lombok.Getter
;
import
lombok.RequiredArgsConstructor
;
...
...
@@ -18,12 +19,16 @@ public enum SaleOrderPickUpStatus implements ArrayValuable<String> {
TO_BE
(
"TO_BE"
,
"待拣"
),
PICK_UP
(
"PICK_UP"
,
"
已拣
"
),
PICK_UP
(
"PICK_UP"
,
"
待接单
"
),
ALREADY
(
"ALREADY"
,
"已发货"
),
ACCEPT
(
"ACCEPT"
,
"待配送"
),
ALREADY
(
"ALREADY"
,
"配送中"
),
ARRIVAL
(
"ARRIVAL"
,
"已到货"
),
SIGN
(
"SIGN"
,
"已签收"
),
;
public
static
final
String
[]
ARRAYS
=
Arrays
.
stream
(
values
()).
map
(
SaleOrderPickUpStatus:
:
getType
).
toArray
(
String
[]::
new
);
...
...
@@ -37,6 +42,18 @@ public enum SaleOrderPickUpStatus implements ArrayValuable<String> {
*/
private
final
String
name
;
public
static
SaleOrderPickUpStatus
getByType
(
String
pickUpStatus
)
{
if
(
CommonUtil
.
isBlank
(
pickUpStatus
))
{
return
null
;
}
for
(
SaleOrderPickUpStatus
em
:
values
())
{
if
(
em
.
getType
().
equals
(
pickUpStatus
))
{
return
em
;
}
}
return
null
;
}
@Override
public
String
[]
array
()
{
return
ARRAYS
;
...
...
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/service/customerwarehouse/CustomerWarehouseServiceImpl.java
View file @
c37edf85
package
cn
.
iocoder
.
foodnexus
.
module
.
erp
.
service
.
customerwarehouse
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.iocoder.foodnexus.framework.common.util.CommonUtil
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
org.springframework.stereotype.Service
;
import
jakarta.annotation.Resource
;
...
...
@@ -92,7 +93,7 @@ public class CustomerWarehouseServiceImpl implements CustomerWarehouseService {
public
void
deleteByCustomerId
(
Long
customerId
,
List
<
Long
>
warehouseAreaIds
)
{
customerWarehouseMapper
.
delete
(
Wrappers
.<
CustomerWarehouseDO
>
lambdaQuery
()
.
eq
(
CustomerWarehouseDO:
:
getCustomerId
,
customerId
)
.
in
(
CustomerWarehouseDO:
:
getWarehouseAreaId
,
warehouseAreaIds
));
.
in
(
C
ommonUtil
.
isNotEmpty
(
warehouseAreaIds
),
C
ustomerWarehouseDO:
:
getWarehouseAreaId
,
warehouseAreaIds
));
}
@Override
...
...
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/service/sale/ErpCustomerService.java
View file @
c37edf85
...
...
@@ -110,4 +110,6 @@ public interface ErpCustomerService {
* @return
*/
List
<
Long
>
queryWarehouseAreaIdByCustomerId
(
Long
id
);
ErpCustomerDO
getCustomerByUserId
(
Long
loginUserId
);
}
\ No newline at end of file
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/service/sale/ErpCustomerServiceImpl.java
View file @
c37edf85
...
...
@@ -147,7 +147,7 @@ public class ErpCustomerServiceImpl implements ErpCustomerService, ErpCustomerAp
ErpWarehouseDO
warehouse
=
warehouseService
.
getWarehouse
(
warehouseArea
.
getParentId
());
Optional
.
ofNullable
(
warehouse
).
orElseThrow
(()
->
new
ServiceException
(
WAREHOUSE_NOT_EXISTS
));
customerWarehouseService
.
deleteByCustomerId
(
id
,
CommonUtil
.
asList
(
warehouseAreaId
)
);
customerWarehouseService
.
deleteByCustomerId
(
id
,
null
);
CustomerWarehouseSaveReqVO
saveReqVO
=
new
CustomerWarehouseSaveReqVO
();
saveReqVO
.
setCustomerId
(
id
);
...
...
@@ -179,6 +179,23 @@ public class ErpCustomerServiceImpl implements ErpCustomerService, ErpCustomerAp
return
CommonUtil
.
listConvert
(
customerWarehouseService
.
getCustomerWarehouseByCustomerId
(
id
),
CustomerWarehouseDO:
:
getWarehouseAreaId
);
}
@Override
public
ErpCustomerDO
getCustomerByUserId
(
Long
userId
)
{
AdminUserDO
user
=
userService
.
getUser
(
userId
);
if
(!
UserSystemEnum
.
CUSTOMER
.
getKey
().
equals
(
user
.
getUserSystem
()))
{
throw
exception
(
ERROR_CUSTOMER_USER
);
}
DeptDO
topDept
=
deptService
.
getTopDept
(
user
.
getDeptId
());
ErpCustomerDO
customer
=
customerMapper
.
selectOne
(
ErpCustomerDO:
:
getSystemDeptId
,
topDept
.
getId
());
if
(
CommonUtil
.
isEmpty
(
customer
))
{
throw
exception
(
CUSTOMER_NOT_EXISTS
);
}
if
(
CommonStatusEnum
.
isDisable
(
customer
.
getStatus
()))
{
throw
exception
(
CUSTOMER_NOT_ENABLE
,
customer
.
getName
());
}
return
customer
;
}
/* --------------- api --------------- */
@Override
...
...
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/service/sale/ErpSaleOrderService.java
View file @
c37edf85
...
...
@@ -20,6 +20,8 @@ import java.util.Map;
*/
public
interface
ErpSaleOrderService
{
String
SALE_ORDER_LOCK
=
"saleOrderLock:%s"
;
/**
* 创建销售订单
*
...
...
@@ -123,15 +125,20 @@ public interface ErpSaleOrderService {
void
updatePickUp
(
Long
id
,
Long
itemId
);
/**
*
配送
*
取货,生成销售出库单
*/
void
delivery
(
Long
id
,
Long
deliveryStaffId
);
/**
*
到货
*
接单
* @param id
* @param deliveryStaffId
*/
void
accept
(
Long
id
,
Long
deliveryStaffId
);
/**
* 到货
*/
void
arrival
(
DeliveryOrderUpdateReqVO
reqVO
,
Long
deliveryStaffId
);
/**
...
...
@@ -143,4 +150,6 @@ public interface ErpSaleOrderService {
ErpSaleOrderDO
queryByCustomerOrderId
(
Long
customerOrderId
);
ErpSaleOrderItemDO
queryItemByCustomerOrderItemId
(
Long
customerOrderItemId
);
void
receiptByCustomerOrderId
(
Long
id
,
List
<
Long
>
customerOrderItemId
);
}
\ No newline at end of file
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/service/sale/ErpSaleOrderServiceImpl.java
View file @
c37edf85
...
...
@@ -6,6 +6,7 @@ import cn.iocoder.foodnexus.framework.common.pojo.PageResult;
import
cn.iocoder.foodnexus.framework.common.util.CommonUtil
;
import
cn.iocoder.foodnexus.framework.common.util.number.MoneyUtils
;
import
cn.iocoder.foodnexus.framework.common.util.object.BeanUtils
;
import
cn.iocoder.foodnexus.framework.redis.utils.RedisUtils
;
import
cn.iocoder.foodnexus.module.erp.api.vo.warehouse.WarehouseInfo
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.purchase.vo.in.ErpPurchaseInSaveReqVO
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.order.ErpSaleOrderPageReqVO
;
...
...
@@ -20,6 +21,7 @@ import cn.iocoder.foodnexus.module.erp.dal.dataobject.sale.ErpSaleOutItemDO;
import
cn.iocoder.foodnexus.module.erp.dal.mysql.sale.ErpSaleOrderItemMapper
;
import
cn.iocoder.foodnexus.module.erp.dal.mysql.sale.ErpSaleOrderMapper
;
import
cn.iocoder.foodnexus.module.erp.dal.mysql.sale.ErpSaleOutItemMapper
;
import
cn.iocoder.foodnexus.module.erp.dal.mysql.sale.ErpSaleOutMapper
;
import
cn.iocoder.foodnexus.module.erp.dal.redis.no.ErpNoRedisDAO
;
import
cn.iocoder.foodnexus.module.erp.api.enums.ErpAuditStatus
;
import
cn.iocoder.foodnexus.module.erp.enums.SaleOrderPickUpStatus
;
...
...
@@ -99,6 +101,9 @@ public class ErpSaleOrderServiceImpl implements ErpSaleOrderService {
private
ErpSaleOutService
saleOutService
;
@Autowired
private
ErpSaleOutMapper
saleOutMapper
;
@Autowired
private
ErpSaleOutItemMapper
saleOutItemMapper
;
@Override
...
...
@@ -365,6 +370,9 @@ public class ErpSaleOrderServiceImpl implements ErpSaleOrderService {
if
(
CommonUtil
.
isEmpty
(
saleItemOrder
))
{
throw
exception
(
SALE_ORDER_NOT_EXISTS
);
}
String
lock
=
String
.
format
(
SALE_ORDER_LOCK
,
id
);
RedisUtils
.
tryLockRds
(
lock
);
try
{
CustomerOrderDTO
customerOrder
=
customerOrderApi
.
queryById
(
saleOrder
.
getCustomerOrderId
());
saleOrderItemMapper
.
update
(
Wrappers
.<
ErpSaleOrderItemDO
>
lambdaUpdate
()
...
...
@@ -377,34 +385,37 @@ public class ErpSaleOrderServiceImpl implements ErpSaleOrderService {
.
eq
(
ErpSaleOrderItemDO:
:
getOrderId
,
saleOrder
.
getId
())
.
eq
(
ErpSaleOrderItemDO:
:
getPickUpStatus
,
SaleOrderPickUpStatus
.
PICK_UP
.
getType
()));
if
(
allCount
>
0
&&
Objects
.
equals
(
pickUpCount
,
allCount
))
{
if
(
CommonUtil
.
isEmpty
(
saleOrder
.
getDeliveryStaffId
()))
{
throw
exception
(
SALE_ORDER_NO_DELIVERY_STAFF
);
}
saleOrderMapper
.
update
(
Wrappers
.<
ErpSaleOrderDO
>
lambdaUpdate
()
.
set
(
ErpSaleOrderDO:
:
getPickUpStatus
,
SaleOrderPickUpStatus
.
PICK_UP
.
getType
())
.
eq
(
ErpSaleOrderDO:
:
getId
,
saleOrder
.
getId
()));
String
deliveryName
=
deliveryStaffApi
.
queryNameByStaffId
(
saleOrder
.
getDeliveryStaffId
());
String
warehouseName
=
Optional
.
ofNullable
(
customerOrder
.
getWarehouseInfo
()).
map
(
WarehouseInfo:
:
getName
).
orElse
(
""
);
CustomerOrderRecordEvent
event
=
new
CustomerOrderRecordEvent
();
event
.
setOrderStatus
(
CustomerOrderStatus
.
SORTING
);
event
.
setCustomerOrderId
(
saleOrder
.
getCustomerOrderId
());
event
.
setCopyWriter
(
CommonUtil
.
asList
(
warehouseName
,
delivery
Name
));
event
.
setCopyWriter
(
CommonUtil
.
asList
(
warehouse
Name
));
orderRecordApi
.
recordEvent
(
event
);
}
}
finally
{
RedisUtils
.
unLockRds
(
lock
);
}
}
/**
*
配送
*
确认取货
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
delivery
(
Long
id
,
Long
deliveryStaffId
)
{
ErpSaleOrderDO
saleOrder
=
this
.
validateSaleOrder
(
id
);
if
(!
SaleOrderPickUpStatus
.
PICK_UP
.
equals
(
saleOrder
.
getPickUpStatus
()))
{
if
(!
SaleOrderPickUpStatus
.
ACCEPT
.
equals
(
saleOrder
.
getPickUpStatus
()))
{
throw
exception
(
SALE_ORDER_PICKUP_STATUS_FAIL
);
}
String
key
=
String
.
format
(
SALE_ORDER_LOCK
,
id
);
RedisUtils
.
tryLockRds
(
key
);
try
{
LocalDateTime
deliveryTime
=
LocalDateTime
.
now
();
saleOrderMapper
.
update
(
Wrappers
.<
ErpSaleOrderDO
>
lambdaUpdate
()
.
set
(
ErpSaleOrderDO:
:
getPickUpStatus
,
SaleOrderPickUpStatus
.
ALREADY
.
getType
())
...
...
@@ -428,22 +439,31 @@ public class ErpSaleOrderServiceImpl implements ErpSaleOrderService {
saleOutSaveReqVO
.
setCustomerOrderId
(
saleOrder
.
getCustomerOrderId
());
saleOutSaveReqVO
.
setDeliveryMode
(
saleOrder
.
getDeliveryMode
());
saleOutSaveReqVO
.
setAcceptTime
(
saleOrder
.
getAcceptTime
());
saleOutSaveReqVO
.
setDeliveryTime
(
deliveryTime
);
saleOutSaveReqVO
.
setDeliveryStaffId
(
deliveryStaffId
);
saleOutSaveReqVO
.
setAddressId
(
saleOrder
.
getAddressId
());
saleOutSaveReqVO
.
setAddressInfo
(
saleOrder
.
getAddressInfo
());
CustomerOrderDTO
customerOrderDTO
=
customerOrderApi
.
queryById
(
saleOrder
.
getCustomerOrderId
());
saleOutSaveReqVO
.
setWarehouseId
(
saleOrder
.
getWarehouseId
());
saleOutSaveReqVO
.
setWarehouseAreaId
(
saleOrder
.
getWarehouseAreaId
());
saleOutSaveReqVO
.
setWarehouseInfo
(
saleOrder
.
getWarehouseInfo
());
saleOutSaveReqVO
.
setPlanDeliveryStartTime
(
saleOrder
.
getPlanDeliveryStartTime
());
saleOutSaveReqVO
.
setPlanDeliveryEndTime
(
saleOrder
.
getPlanDeliveryEndTime
());
saleOutSaveReqVO
.
setPickUpStatus
(
SaleOrderPickUpStatus
.
ALREADY
);
// CustomerOrderDTO customerOrderDTO = customerOrderApi.queryById(saleOrder.getCustomerOrderId());
saleOutSaveReqVO
.
setItems
(
CommonUtil
.
listConvert
(
saleOrderItems
,
saleOrderItem
->
{
ErpSaleOutSaveReqVO
.
Item
item
=
new
ErpSaleOutSaveReqVO
.
Item
();
item
.
setOrderItemId
(
saleOrderItem
.
getId
());
item
.
setWarehouseId
(
customerOrderDTO
.
getWarehouseAreaId
());
item
.
setWarehouseId
(
saleOrder
.
getWarehouseAreaId
());
item
.
setProductId
(
saleOrderItem
.
getProductId
());
item
.
setProductUnit
(
saleOrderItem
.
getProductUnit
());
item
.
setProductPrice
(
saleOrderItem
.
getProductPrice
());
item
.
setCount
(
saleOrderItem
.
getCount
());
item
.
setTaxPercent
(
saleOrderItem
.
getTaxPercent
());
item
.
setRemark
(
saleOrderItem
.
getRemark
());
item
.
setCustomerOrderItemId
(
saleOrderItem
.
getCustomerOrderItemId
());
item
.
setPickUpStatus
(
SaleOrderPickUpStatus
.
ALREADY
);
return
item
;
}));
saleOutService
.
createSaleOut
(
saleOutSaveReqVO
);
...
...
@@ -454,6 +474,39 @@ public class ErpSaleOrderServiceImpl implements ErpSaleOrderService {
event
.
setCustomerOrderId
(
saleOrder
.
getCustomerOrderId
());
event
.
setCopyWriter
(
CommonUtil
.
asList
(
deliveryStaffSimpleInfo
.
getName
(),
deliveryStaffSimpleInfo
.
getContact
()));
orderRecordApi
.
recordEvent
(
event
);
}
finally
{
RedisUtils
.
unLockRds
(
key
);
}
}
/**
* 接单
*
* @param id
* @param deliveryStaffId
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
accept
(
Long
id
,
Long
deliveryStaffId
)
{
ErpSaleOrderDO
saleOrder
=
this
.
validateSaleOrder
(
id
);
if
(!
SaleOrderPickUpStatus
.
PICK_UP
.
equals
(
saleOrder
.
getPickUpStatus
()))
{
throw
exception
(
SALE_ORDER_PICKUP_STATUS_FAIL
);
}
String
key
=
String
.
format
(
SALE_ORDER_LOCK
,
id
);
RedisUtils
.
tryLockRds
(
key
);
try
{
saleOrderMapper
.
update
(
Wrappers
.<
ErpSaleOrderDO
>
lambdaUpdate
()
.
set
(
ErpSaleOrderDO:
:
getPickUpStatus
,
SaleOrderPickUpStatus
.
ACCEPT
.
getType
())
.
set
(
ErpSaleOrderDO:
:
getAcceptTime
,
LocalDateTime
.
now
())
.
set
(
ErpSaleOrderDO:
:
getDeliveryStaffId
,
deliveryStaffId
)
.
eq
(
ErpSaleOrderDO:
:
getId
,
saleOrder
.
getId
()));
saleOrderItemMapper
.
update
(
Wrappers
.<
ErpSaleOrderItemDO
>
lambdaUpdate
()
.
set
(
ErpSaleOrderItemDO:
:
getPickUpStatus
,
SaleOrderPickUpStatus
.
ACCEPT
.
getType
())
.
eq
(
ErpSaleOrderItemDO:
:
getOrderId
,
saleOrder
.
getId
()));
}
finally
{
RedisUtils
.
unLockRds
(
key
);
}
}
/**
...
...
@@ -462,29 +515,49 @@ public class ErpSaleOrderServiceImpl implements ErpSaleOrderService {
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
arrival
(
DeliveryOrderUpdateReqVO
reqVO
,
Long
deliveryStaffId
)
{
ErpSaleOutDO
saleOut
=
saleOutService
.
validateSaleOut
(
reqVO
.
getSaleOutId
());
Long
orderId
=
reqVO
.
getId
();
ErpSaleOutDO
saleOut
=
saleOutMapper
.
selectOne
(
Wrappers
.<
ErpSaleOutDO
>
lambdaQuery
()
.
eq
(
ErpSaleOutDO:
:
getCustomerOrderId
,
orderId
)
.
last
(
"LIMIT 1"
));
if
(
CommonUtil
.
isEmpty
(
saleOut
))
{
throw
exception
(
SALE_OUT_NOT_EXISTS
);
}
ErpSaleOrderDO
saleOrder
=
this
.
validateSaleOrder
(
saleOut
.
getOrderId
());
if
(!
SaleOrderPickUpStatus
.
ALREADY
.
equals
(
saleOrder
.
getPickUpStatus
()))
{
throw
exception
(
SALE_ORDER_PICKUP_STATUS_FAIL
);
}
String
key
=
String
.
format
(
SALE_ORDER_LOCK
,
saleOrder
.
getId
());
RedisUtils
.
tryLockRds
(
key
);
try
{
LocalDateTime
arrivalTime
=
LocalDateTime
.
now
();
saleOrderMapper
.
update
(
Wrappers
.<
ErpSaleOrderDO
>
lambdaUpdate
()
.
set
(
ErpSaleOrderDO:
:
getPickUpStatus
,
SaleOrderPickUpStatus
.
ARRIVAL
.
getType
())
.
set
(
ErpSaleOrderDO:
:
getDeliveryStaffId
,
deliveryStaffId
)
.
set
(
ErpSaleOrderDO:
:
getArrivalTime
,
arrivalTime
)
.
eq
(
ErpSaleOrderDO:
:
getId
,
saleOrder
.
getId
()));
saleOrderItemMapper
.
update
(
Wrappers
.<
ErpSaleOrderItemDO
>
lambdaUpdate
()
.
set
(
ErpSaleOrderItemDO:
:
getPickUpStatus
,
SaleOrderPickUpStatus
.
ARRIVAL
.
getType
())
.
eq
(
ErpSaleOrderItemDO:
:
getOrderId
,
saleOrder
.
getId
()));
saleOutMapper
.
update
(
Wrappers
.<
ErpSaleOutDO
>
lambdaUpdate
()
.
set
(
ErpSaleOutDO:
:
getPickUpStatus
,
SaleOrderPickUpStatus
.
ARRIVAL
.
getType
())
.
set
(
ErpSaleOutDO:
:
getDeliveryStaffId
,
deliveryStaffId
)
.
set
(
ErpSaleOutDO:
:
getArrivalTime
,
arrivalTime
)
.
eq
(
ErpSaleOutDO:
:
getId
,
saleOrder
.
getId
()));
saleOutItemMapper
.
update
(
Wrappers
.<
ErpSaleOutItemDO
>
lambdaUpdate
()
.
set
(
ErpSaleOutItemDO:
:
getPickUpStatus
,
SaleOrderPickUpStatus
.
ARRIVAL
.
getType
())
.
eq
(
ErpSaleOutItemDO:
:
getOutId
,
saleOut
.
getId
()));
// 更新出库单价格
if
(
CommonUtil
.
isNotEmpty
(
reqVO
.
get
Items
()))
{
Map
<
Long
,
DeliveryOrderUpdateReqVO
.
Item
>
itemMap
=
CommonUtil
.
listConvertMap
(
reqVO
.
getItems
(),
DeliveryOrderUpdateReqVO
.
Item
::
getSaleOutItemi
d
);
List
<
ErpSaleOutItemDO
>
saleOutItems
=
saleOutService
.
getSaleOutItemListByOutId
(
reqVO
.
getSaleOu
tId
());
if
(
CommonUtil
.
isNotEmpty
(
reqVO
.
getOrder
Items
()))
{
Map
<
Long
,
DeliveryOrderUpdateReqVO
.
DeliveryOrderUpdateItems
>
itemMap
=
CommonUtil
.
listConvertMap
(
reqVO
.
getOrderItems
(),
DeliveryOrderUpdateReqVO
.
DeliveryOrderUpdateItems
::
getI
d
);
List
<
ErpSaleOutItemDO
>
saleOutItems
=
saleOutService
.
getSaleOutItemListByOutId
(
saleOut
.
ge
tId
());
List
<
ErpSaleOutItemDO
>
updateBatch
=
new
ArrayList
<>();
saleOutItems
.
forEach
(
saleOutItem
->
{
if
(
itemMap
.
containsKey
(
saleOutItem
.
get
Id
()))
{
DeliveryOrderUpdateReqVO
.
Item
item
=
itemMap
.
get
(
saleOutItem
.
get
Id
());
if
(
itemMap
.
containsKey
(
saleOutItem
.
getCustomerOrderItem
Id
()))
{
DeliveryOrderUpdateReqVO
.
DeliveryOrderUpdateItems
item
=
itemMap
.
get
(
saleOutItem
.
getCustomerOrderItem
Id
());
ErpSaleOutItemDO
updateItem
=
new
ErpSaleOutItemDO
();
updateItem
.
setId
(
item
.
getSaleOutItemi
d
());
updateItem
.
setId
(
saleOutItem
.
getI
d
());
updateItem
.
setCount
(
item
.
getSignedQuantity
());
updateItem
.
setRemark
(
item
.
getRemark
());
updateItem
.
setRemarkFiles
(
item
.
getRemarkFiles
());
...
...
@@ -501,6 +574,9 @@ public class ErpSaleOrderServiceImpl implements ErpSaleOrderService {
event
.
setCustomerOrderId
(
saleOrder
.
getCustomerOrderId
());
event
.
setCopyWriter
(
CommonUtil
.
asList
(
deliveryStaffSimpleInfo
.
getName
(),
deliveryStaffSimpleInfo
.
getContact
()));
orderRecordApi
.
recordEvent
(
event
);
}
finally
{
RedisUtils
.
unLockRds
(
key
);
}
}
/**
...
...
@@ -524,12 +600,19 @@ public class ErpSaleOrderServiceImpl implements ErpSaleOrderService {
ErpSaleOrderSaveReqVO
saveReqVO
=
new
ErpSaleOrderSaveReqVO
();
saveReqVO
.
setCustomerId
(
order
.
getCustomerId
());
saveReqVO
.
setCustomerDeptId
(
order
.
getCustomerDeptId
());
saveReqVO
.
setOrderTime
(
order
.
getCreateTime
());
saveReqVO
.
setDepositPrice
(
order
.
getOrderAmount
());
saveReqVO
.
setCustomerOrderId
(
order
.
getId
());
saveReqVO
.
setDeliveryMode
(
order
.
getDeliveryMode
());
saveReqVO
.
setAddressId
(
order
.
getAddressId
());
saveReqVO
.
setAddressInfo
(
order
.
getAddressInfo
());
saveReqVO
.
setWarehouseId
(
order
.
getWarehouseId
());
saveReqVO
.
setWarehouseAreaId
(
order
.
getWarehouseAreaId
());
saveReqVO
.
setWarehouseInfo
(
order
.
getWarehouseInfo
());
saveReqVO
.
setPlanDeliveryStartTime
(
order
.
getPlanDeliveryStartTime
());
saveReqVO
.
setPlanDeliveryEndTime
(
order
.
getPlanDeliveryEndTime
());
saveReqVO
.
setPickUpStatus
(
SaleOrderPickUpStatus
.
TO_BE
);
saveReqVO
.
setItems
(
CommonUtil
.
listConvert
(
orderItems
,
orderItem
->
{
ErpSaleOrderSaveReqVO
.
Item
item
=
new
ErpSaleOrderSaveReqVO
.
Item
();
item
.
setCustomerOrderItemId
(
orderItem
.
getId
());
...
...
@@ -554,4 +637,20 @@ public class ErpSaleOrderServiceImpl implements ErpSaleOrderService {
return
saleOrderItemMapper
.
selectOne
(
ErpSaleOrderItemDO:
:
getCustomerOrderItemId
,
customerOrderItemId
);
}
@Override
public
void
receiptByCustomerOrderId
(
Long
customerOrderId
,
List
<
Long
>
customerOrderItemId
)
{
LocalDateTime
receiptTime
=
LocalDateTime
.
now
();
saleOrderMapper
.
update
(
Wrappers
.<
ErpSaleOrderDO
>
lambdaUpdate
()
.
set
(
ErpSaleOrderDO:
:
getPickUpStatus
,
SaleOrderPickUpStatus
.
SIGN
.
getType
())
.
set
(
ErpSaleOrderDO:
:
getSignTime
,
receiptTime
)
.
eq
(
ErpSaleOrderDO:
:
getCustomerOrderId
,
customerOrderId
)
.
eq
(
ErpSaleOrderDO:
:
getPickUpStatus
,
SaleOrderPickUpStatus
.
ARRIVAL
.
getType
()));
if
(
CommonUtil
.
isNotEmpty
(
customerOrderItemId
))
{
saleOrderItemMapper
.
update
(
Wrappers
.<
ErpSaleOrderItemDO
>
lambdaUpdate
()
.
set
(
ErpSaleOrderItemDO:
:
getPickUpStatus
,
SaleOrderPickUpStatus
.
SIGN
.
getType
())
.
in
(
ErpSaleOrderItemDO:
:
getCustomerOrderItemId
,
customerOrderItemId
));
}
}
}
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/service/sale/ErpSaleOutService.java
View file @
c37edf85
...
...
@@ -100,4 +100,6 @@ public interface ErpSaleOutService {
ErpSaleOutDO
getSaleOutByCustomerOrderId
(
Long
customerOrderId
);
void
receiptByCustomerOrderId
(
Long
customerOrderId
,
List
<
Long
>
customerOrderItemId
);
}
\ No newline at end of file
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/service/sale/ErpSaleOutServiceImpl.java
View file @
c37edf85
...
...
@@ -3,6 +3,7 @@ package cn.iocoder.foodnexus.module.erp.service.sale;
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.number.MoneyUtils
;
import
cn.iocoder.foodnexus.framework.common.util.object.BeanUtils
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.out.ErpSaleOutPageReqVO
;
...
...
@@ -15,6 +16,7 @@ import cn.iocoder.foodnexus.module.erp.dal.mysql.sale.ErpSaleOutItemMapper;
import
cn.iocoder.foodnexus.module.erp.dal.mysql.sale.ErpSaleOutMapper
;
import
cn.iocoder.foodnexus.module.erp.dal.redis.no.ErpNoRedisDAO
;
import
cn.iocoder.foodnexus.module.erp.api.enums.ErpAuditStatus
;
import
cn.iocoder.foodnexus.module.erp.enums.SaleOrderPickUpStatus
;
import
cn.iocoder.foodnexus.module.erp.enums.stock.ErpStockRecordBizTypeEnum
;
import
cn.iocoder.foodnexus.module.erp.service.finance.ErpAccountService
;
import
cn.iocoder.foodnexus.module.erp.service.product.ErpProductService
;
...
...
@@ -23,6 +25,7 @@ import cn.iocoder.foodnexus.module.erp.service.stock.bo.ErpStockRecordCreateReqB
import
cn.iocoder.foodnexus.module.product.dal.dataobject.spu.ProductSpuDO
;
import
cn.iocoder.foodnexus.module.product.service.spu.ProductSpuService
;
import
cn.iocoder.foodnexus.module.system.api.user.AdminUserApi
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
jakarta.annotation.Resource
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.stereotype.Service
;
...
...
@@ -30,6 +33,7 @@ import org.springframework.transaction.annotation.Transactional;
import
org.springframework.validation.annotation.Validated
;
import
java.math.BigDecimal
;
import
java.time.LocalDateTime
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.List
;
...
...
@@ -315,4 +319,20 @@ public class ErpSaleOutServiceImpl implements ErpSaleOutService {
return
saleOutMapper
.
selectOne
(
ErpSaleOutDO:
:
getCustomerOrderId
,
customerOrderId
);
}
@Override
public
void
receiptByCustomerOrderId
(
Long
customerOrderId
,
List
<
Long
>
customerOrderItemId
)
{
LocalDateTime
receiptTime
=
LocalDateTime
.
now
();
saleOutMapper
.
update
(
Wrappers
.<
ErpSaleOutDO
>
lambdaUpdate
()
.
set
(
ErpSaleOutDO:
:
getPickUpStatus
,
SaleOrderPickUpStatus
.
SIGN
.
getType
())
.
set
(
ErpSaleOutDO:
:
getSignTime
,
receiptTime
)
.
eq
(
ErpSaleOutDO:
:
getCustomerOrderId
,
customerOrderId
)
.
eq
(
ErpSaleOutDO:
:
getPickUpStatus
,
SaleOrderPickUpStatus
.
ARRIVAL
.
getType
()));
if
(
CommonUtil
.
isNotEmpty
(
customerOrderItemId
))
{
saleOutItemMapper
.
update
(
Wrappers
.<
ErpSaleOutItemDO
>
lambdaUpdate
()
.
set
(
ErpSaleOutItemDO:
:
getPickUpStatus
,
SaleOrderPickUpStatus
.
SIGN
.
getType
())
.
in
(
ErpSaleOutItemDO:
:
getCustomerOrderItemId
,
customerOrderItemId
));
}
}
}
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/controller/admin/deliverystaff/DeliveryStaffController.java
View file @
c37edf85
...
...
@@ -31,7 +31,7 @@ import cn.iocoder.foodnexus.module.operations.controller.admin.deliverystaff.vo.
import
cn.iocoder.foodnexus.module.operations.dal.dataobject.deliverystaff.DeliveryStaffDO
;
import
cn.iocoder.foodnexus.module.operations.service.deliverystaff.DeliveryStaffService
;
@Tag
(
name
=
"
APP
- 配送员信息"
)
@Tag
(
name
=
"
管理后台
- 配送员信息"
)
@RestController
@RequestMapping
(
"/operation/delivery-staff"
)
@Validated
...
...
@@ -77,6 +77,22 @@ public class DeliveryStaffController {
return
success
(
true
);
}
@PutMapping
(
"/bind-dept"
)
@Operation
(
summary
=
"配送员绑定灶点"
)
@PreAuthorize
(
"@ss.hasPermission('operation:delivery-staff:update')"
)
public
CommonResult
<
Boolean
>
bindDept
(
@Valid
@RequestBody
DeliveryStaffBindDeptReqVO
updateReqVO
)
{
deliveryStaffService
.
bindDept
(
updateReqVO
);
return
success
(
true
);
}
@PutMapping
(
"bind-dept-release"
)
@Operation
(
summary
=
"配送员解绑灶点"
)
@PreAuthorize
(
"@ss.hasPermission('operation:delivery-staff:update')"
)
public
CommonResult
<
Boolean
>
bindDeptRelease
(
@Valid
@RequestBody
DeliveryStaffBindDeptReqVO
updateReqVO
)
{
deliveryStaffService
.
bindDeptRelease
(
updateReqVO
);
return
success
(
true
);
}
@DeleteMapping
(
"/delete"
)
@Operation
(
summary
=
"删除配送员信息"
)
...
...
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/controller/admin/deliverystaff/vo/DeliveryStaffBindDeptReqVO.java
0 → 100644
View file @
c37edf85
package
cn
.
iocoder
.
foodnexus
.
module
.
operations
.
controller
.
admin
.
deliverystaff
.
vo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
jakarta.validation.constraints.NotNull
;
import
lombok.Data
;
import
java.util.List
;
/**
* @author : yanghao
* create at: 2025/8/28 16:57
* @description: 配送员绑定客户
*/
@Data
public
class
DeliveryStaffBindDeptReqVO
{
@Schema
(
description
=
"配送员id"
)
@NotNull
(
message
=
"配送员不能为空"
)
private
Long
staffId
;
@Schema
(
description
=
"灶点id集合"
)
@NotNull
(
message
=
"灶点id不能为空"
)
private
List
<
Long
>
deptIdList
;
}
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/controller/admin/deliverystaffcustomer/vo/DeliveryStaffCustomerRespVO.java
View file @
c37edf85
...
...
@@ -20,9 +20,11 @@ public class DeliveryStaffCustomerRespVO {
@ExcelProperty
(
"配送员id"
)
private
Long
deliveryStaffId
;
@Schema
(
description
=
"客户id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"24925"
)
@ExcelProperty
(
"客户id"
)
private
Long
customerId
;
@Schema
(
description
=
"客户id/灶点id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"24925"
)
@ExcelProperty
(
"客户id/灶点id"
)
private
Long
targetId
;
private
Boolean
isDept
;
@Schema
(
description
=
"创建时间"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@ExcelProperty
(
"创建时间"
)
...
...
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/controller/admin/deliverystaffcustomer/vo/DeliveryStaffCustomerSaveReqVO.java
View file @
c37edf85
...
...
@@ -16,12 +16,12 @@ public class DeliveryStaffCustomerSaveReqVO {
@NotNull
(
message
=
"配送员id不能为空"
)
private
Long
deliveryStaffId
;
@Schema
(
description
=
"客户id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"24925"
)
@NotNull
(
message
=
"
客户
id不能为空"
)
private
Long
customer
Id
;
@Schema
(
description
=
"客户id
/灶点id
"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"24925"
)
@NotNull
(
message
=
"
目标
id不能为空"
)
private
Long
target
Id
;
@Schema
(
description
=
"
客户灶点id
"
)
@NotNull
(
message
=
"
客户灶点id
不能可空"
)
private
Long
customerDeptId
;
@Schema
(
description
=
"
true-灶点 / false-客户
"
)
@NotNull
(
message
=
"
isDept
不能可空"
)
private
Boolean
isDept
;
}
\ No newline at end of file
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/controller/admin/scoringweight/ScoringWeightController.java
View file @
c37edf85
...
...
@@ -95,6 +95,12 @@ public class ScoringWeightController {
return
success
(
BeanUtils
.
toBean
(
pageResult
,
ScoringWeightRespVO
.
class
));
}
@GetMapping
(
"/list"
)
@Operation
(
summary
=
"获取全部评分权重"
)
public
CommonResult
<
List
<
ScoringWeightRespVO
>>
getScoringWeightList
()
{
return
success
(
BeanUtils
.
toBean
(
scoringWeightService
.
listAll
(),
ScoringWeightRespVO
.
class
));
}
@GetMapping
(
"/export-excel"
)
@Operation
(
summary
=
"导出评分权重 Excel"
)
@PreAuthorize
(
"@ss.hasPermission('operations:scoring-weight:export')"
)
...
...
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/controller/app/customer/AppCustomerController.java
0 → 100644
View file @
c37edf85
package
cn
.
iocoder
.
foodnexus
.
module
.
operations
.
controller
.
app
.
customer
;
import
cn.iocoder.foodnexus.framework.common.enums.UserSystemEnum
;
import
cn.iocoder.foodnexus.framework.common.pojo.CommonResult
;
import
cn.iocoder.foodnexus.framework.common.util.object.BeanUtils
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.customer.ErpCustomerRespVO
;
import
cn.iocoder.foodnexus.module.erp.dal.dataobject.sale.ErpCustomerDO
;
import
cn.iocoder.foodnexus.module.erp.service.sale.ErpCustomerService
;
import
cn.iocoder.foodnexus.module.system.annotations.AppSystemAuth
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
jakarta.annotation.Resource
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
static
cn
.
iocoder
.
foodnexus
.
framework
.
common
.
pojo
.
CommonResult
.
success
;
import
static
cn
.
iocoder
.
foodnexus
.
framework
.
security
.
core
.
util
.
SecurityFrameworkUtils
.
getLoginUserId
;
/**
* @author : yanghao
* create at: 2025/10/14 17:08
* @description: APP - 客户信息
*/
@Tag
(
name
=
"管理后台 - ERP 客户"
)
@RestController
@RequestMapping
(
"/erp/customer"
)
@Validated
@AppSystemAuth
(
UserSystemEnum
.
CUSTOMER
)
public
class
AppCustomerController
{
@Resource
private
ErpCustomerService
customerService
;
@GetMapping
(
"/get"
)
@Operation
(
summary
=
"获得客户"
)
public
CommonResult
<
ErpCustomerRespVO
>
getCustomer
()
{
ErpCustomerDO
customer
=
customerService
.
getCustomerByUserId
(
getLoginUserId
());
return
success
(
BeanUtils
.
toBean
(
customer
,
ErpCustomerRespVO
.
class
,
item
->
{
item
.
setWarehouseAreaIds
(
customerService
.
queryWarehouseAreaIdByCustomerId
(
item
.
getId
()));
}));
}
}
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/controller/app/customerrequire/AppCustomerRequireController.java
View file @
c37edf85
package
cn
.
iocoder
.
foodnexus
.
module
.
operations
.
controller
.
app
.
customerrequire
;
import
cn.iocoder.foodnexus.framework.apilog.core.annotation.ApiAccessLog
;
import
cn.iocoder.foodnexus.framework.common.enums.UserSystemEnum
;
import
cn.iocoder.foodnexus.framework.common.pojo.CommonResult
;
import
cn.iocoder.foodnexus.framework.common.pojo.PageParam
;
import
cn.iocoder.foodnexus.framework.common.pojo.PageResult
;
...
...
@@ -15,6 +16,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.system.annotations.AppSystemAuth
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.Parameter
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
...
...
@@ -36,6 +38,7 @@ import static cn.iocoder.foodnexus.framework.common.pojo.CommonResult.success;
@RestController
@RequestMapping
(
"/oper/customer-require"
)
@Validated
@AppSystemAuth
(
UserSystemEnum
.
CUSTOMER
)
public
class
AppCustomerRequireController
{
@Resource
...
...
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/controller/app/delivery/AppDeliveryStaffController.java
0 → 100644
View file @
c37edf85
package
cn
.
iocoder
.
foodnexus
.
module
.
operations
.
controller
.
app
.
delivery
;
import
cn.iocoder.foodnexus.framework.common.enums.UserSystemEnum
;
import
cn.iocoder.foodnexus.framework.common.pojo.CommonResult
;
import
cn.iocoder.foodnexus.framework.common.util.object.BeanUtils
;
import
cn.iocoder.foodnexus.framework.security.core.util.SecurityFrameworkUtils
;
import
cn.iocoder.foodnexus.module.operations.controller.admin.deliverystaff.vo.DeliveryStaffRespVO
;
import
cn.iocoder.foodnexus.module.operations.controller.admin.deliverystaff.vo.DeliveryStaffSaveReqVO
;
import
cn.iocoder.foodnexus.module.operations.dal.dataobject.deliverystaff.DeliveryStaffDO
;
import
cn.iocoder.foodnexus.module.operations.service.deliverystaff.DeliveryStaffService
;
import
cn.iocoder.foodnexus.module.operations.service.deliverystaffcustomer.DeliveryStaffCustomerService
;
import
cn.iocoder.foodnexus.module.operations.service.vehicleinfo.VehicleInfoService
;
import
cn.iocoder.foodnexus.module.system.annotations.AppSystemAuth
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
jakarta.annotation.Resource
;
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
static
cn
.
iocoder
.
foodnexus
.
framework
.
common
.
pojo
.
CommonResult
.
success
;
/**
* @author : yanghao
* create at: 2025/10/14 16:14
* @description: 配送员 - 个人信息
*/
@Tag
(
name
=
"配送员 - 个人信息"
)
@RestController
@RequestMapping
(
"/delivery/oper"
)
@Validated
@AppSystemAuth
(
UserSystemEnum
.
DELIVERY
)
public
class
AppDeliveryStaffController
{
@Autowired
private
DeliveryStaffService
deliveryStaffService
;
@Resource
private
DeliveryStaffCustomerService
deliveryStaffCustomerService
;
@Resource
private
VehicleInfoService
vehicleInfoService
;
@GetMapping
(
"/get"
)
@Operation
(
summary
=
"获得配送员信息"
)
public
CommonResult
<
DeliveryStaffRespVO
>
getDeliveryStaff
()
{
DeliveryStaffDO
deliveryStaff
=
deliveryStaffService
.
getDeliveryStaffByUserId
(
SecurityFrameworkUtils
.
getLoginUserId
());
return
success
(
BeanUtils
.
toBean
(
deliveryStaff
,
DeliveryStaffRespVO
.
class
,
item
->
{
// item.setCustomerList(deliveryStaffCustomerService.queryCustomerListByDeliveryStaffId(item.getId()));
item
.
setVehicleInfo
(
vehicleInfoService
.
queryByStaffId
(
item
.
getId
()));
// item.setCustomerDeptList(deliveryStaffCustomerService.queryDeptListByStaffId(item.getId()));
}));
}
}
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/dal/dataobject/deliverystaffcustomer/DeliveryStaffCustomerDO.java
View file @
c37edf85
...
...
@@ -32,13 +32,13 @@ public class DeliveryStaffCustomerDO extends BaseDO {
*/
private
Long
deliveryStaffId
;
/**
* 客户id
* 客户id
/灶点id
*/
private
Long
customer
Id
;
private
Long
target
Id
;
/**
*
客户灶点id
*
false-客户/true-灶点
*/
private
Long
customerDeptId
;
private
Boolean
isDept
;
}
\ No newline at end of file
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/service/deliverystaff/DeliveryStaffService.java
View file @
c37edf85
...
...
@@ -5,7 +5,6 @@ import jakarta.validation.*;
import
cn.iocoder.foodnexus.module.operations.controller.admin.deliverystaff.vo.*
;
import
cn.iocoder.foodnexus.module.operations.dal.dataobject.deliverystaff.DeliveryStaffDO
;
import
cn.iocoder.foodnexus.framework.common.pojo.PageResult
;
import
cn.iocoder.foodnexus.framework.common.pojo.PageParam
;
/**
* 配送员信息 Service 接口
...
...
@@ -14,6 +13,8 @@ import cn.iocoder.foodnexus.framework.common.pojo.PageParam;
*/
public
interface
DeliveryStaffService
{
String
USER_INIT_PASSWORD_KEY
=
"system.user.init-password"
;
/**
* 创建配送员信息
*
...
...
@@ -62,4 +63,10 @@ public interface DeliveryStaffService {
void
bindCustomer
(
DeliveryStaffBindCustomerReqVO
updateReqVO
);
void
bindCustomerRelease
(
DeliveryStaffBindCustomerReqVO
updateReqVO
);
DeliveryStaffDO
getDeliveryStaffByUserId
(
Long
loginUserId
);
void
bindDept
(
@Valid
DeliveryStaffBindDeptReqVO
updateReqVO
);
void
bindDeptRelease
(
@Valid
DeliveryStaffBindDeptReqVO
updateReqVO
);
}
\ No newline at end of file
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/service/deliverystaff/DeliveryStaffServiceImpl.java
View file @
c37edf85
package
cn
.
iocoder
.
foodnexus
.
module
.
operations
.
service
.
deliverystaff
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.stream.StreamUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.iocoder.foodnexus.framework.common.enums.UserSystemEnum
;
import
cn.iocoder.foodnexus.framework.common.util.CommonUtil
;
import
cn.iocoder.foodnexus.module.infra.api.config.ConfigApi
;
import
cn.iocoder.foodnexus.module.operations.dal.dataobject.deliverystaffcustomer.DeliveryStaffCustomerDO
;
import
cn.iocoder.foodnexus.module.operations.dal.mysql.deliverystaffcustomer.DeliveryStaffCustomerMapper
;
import
cn.iocoder.foodnexus.module.order.api.DeliveryStaffApi
;
import
cn.iocoder.foodnexus.module.order.dto.DeliveryStaffSimpleInfo
;
import
cn.iocoder.foodnexus.module.system.controller.admin.user.vo.user.UserSaveReqVO
;
import
cn.iocoder.foodnexus.module.system.
service.dept.DeptService
;
import
cn.iocoder.foodnexus.module.system.
dal.dataobject.user.AdminUserDO
;
import
cn.iocoder.foodnexus.module.system.service.user.AdminUserService
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -22,15 +22,13 @@ import java.util.*;
import
cn.iocoder.foodnexus.module.operations.controller.admin.deliverystaff.vo.*
;
import
cn.iocoder.foodnexus.module.operations.dal.dataobject.deliverystaff.DeliveryStaffDO
;
import
cn.iocoder.foodnexus.framework.common.pojo.PageResult
;
import
cn.iocoder.foodnexus.framework.common.pojo.PageParam
;
import
cn.iocoder.foodnexus.framework.common.util.object.BeanUtils
;
import
cn.iocoder.foodnexus.module.operations.dal.mysql.deliverystaff.DeliveryStaffMapper
;
import
static
cn
.
iocoder
.
foodnexus
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
import
static
cn
.
iocoder
.
foodnexus
.
framework
.
common
.
util
.
collection
.
CollectionUtils
.
convertList
;
import
static
cn
.
iocoder
.
foodnexus
.
framework
.
common
.
util
.
collection
.
CollectionUtils
.
diffList
;
import
static
cn
.
iocoder
.
foodnexus
.
module
.
operations
.
enums
.
ErrorCodeConstants
.*;
import
static
cn
.
iocoder
.
foodnexus
.
module
.
system
.
enums
.
ErrorCodeConstants
.
USER_IMPORT_INIT_PASSWORD
;
/**
* 配送员信息 Service 实现类
...
...
@@ -50,31 +48,46 @@ public class DeliveryStaffServiceImpl implements DeliveryStaffService, DeliveryS
@Autowired
private
AdminUserService
userService
;
@Autowired
private
ConfigApi
configApi
;
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Long
createDeliveryStaff
(
DeliveryStaffSaveReqVO
createReqVO
)
{
// 插入
DeliveryStaffDO
deliveryStaff
=
BeanUtils
.
toBean
(
createReqVO
,
DeliveryStaffDO
.
class
);
String
userName
=
validStaffName
(
createReqVO
.
getName
(),
1
);
// 新建一个账号
UserSaveReqVO
userSaveReqVO
=
new
UserSaveReqVO
();
userSaveReqVO
.
setUsername
(
createReqVO
.
getName
()
);
userSaveReqVO
.
setNickname
(
createReqVO
.
getName
()
);
userSaveReqVO
.
setUsername
(
userName
);
userSaveReqVO
.
setNickname
(
userName
);
userSaveReqVO
.
setRemark
(
createReqVO
.
getRemark
());
// TODO 待定
userSaveReqVO
.
setDeptId
(
100L
);
userSaveReqVO
.
setMobile
(
createReqVO
.
getContact
());
userSaveReqVO
.
setUserSystem
(
UserSystemEnum
.
DELIVERY
.
getKey
());
userSaveReqVO
.
setPassword
(
"123456"
);
String
initPassword
=
configApi
.
getConfigValueByKey
(
USER_INIT_PASSWORD_KEY
);
if
(
StrUtil
.
isEmpty
(
initPassword
))
{
throw
exception
(
USER_IMPORT_INIT_PASSWORD
);
}
userSaveReqVO
.
setPassword
(
initPassword
);
Long
userId
=
userService
.
createUser
(
userSaveReqVO
);
deliveryStaff
.
setUserId
(
userId
);
deliveryStaffMapper
.
insert
(
deliveryStaff
);
// 返回
return
deliveryStaff
.
getId
();
}
private
String
validStaffName
(
String
name
,
int
suffix
)
{
AdminUserDO
user
=
userService
.
getUserByUsername
(
name
);
if
(
CommonUtil
.
isNotEmpty
(
user
))
{
return
validStaffName
(
name
+
suffix
,
suffix
+
1
);
}
return
name
;
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
updateDeliveryStaff
(
DeliveryStaffSaveReqVO
updateReqVO
)
{
...
...
@@ -86,7 +99,7 @@ public class DeliveryStaffServiceImpl implements DeliveryStaffService, DeliveryS
UserSaveReqVO
updateUser
=
new
UserSaveReqVO
();
updateUser
.
setId
(
deliveryStaffDO
.
getUserId
());
updateUser
.
setUsername
(
updateReqVO
.
getName
());
//
updateUser.setUsername(updateReqVO.getName());
updateUser
.
setNickname
(
updateReqVO
.
getName
());
updateUser
.
setRemark
(
updateReqVO
.
getRemark
());
updateUser
.
setMobile
(
updateReqVO
.
getContact
());
...
...
@@ -133,7 +146,8 @@ public class DeliveryStaffServiceImpl implements DeliveryStaffService, DeliveryS
if
(
CommonUtil
.
isNotEmpty
(
updateReqVO
.
getCustomerIdList
()))
{
List
<
DeliveryStaffCustomerDO
>
deliveryStaffCustomerDOS
=
CommonUtil
.
listConvert
(
updateReqVO
.
getCustomerIdList
(),
customer
->
{
DeliveryStaffCustomerDO
deliveryStaffCustomerDO
=
new
DeliveryStaffCustomerDO
();
deliveryStaffCustomerDO
.
setCustomerId
(
customer
);
deliveryStaffCustomerDO
.
setTargetId
(
customer
);
deliveryStaffCustomerDO
.
setIsDept
(
Boolean
.
FALSE
);
deliveryStaffCustomerDO
.
setDeliveryStaffId
(
updateReqVO
.
getStaffId
());
return
deliveryStaffCustomerDO
;
});
...
...
@@ -146,7 +160,38 @@ public class DeliveryStaffServiceImpl implements DeliveryStaffService, DeliveryS
validateDeliveryStaffExists
(
updateReqVO
.
getStaffId
());
deliveryStaffCustomerMapper
.
delete
(
Wrappers
.<
DeliveryStaffCustomerDO
>
lambdaQuery
()
.
eq
(
DeliveryStaffCustomerDO:
:
getDeliveryStaffId
,
updateReqVO
.
getStaffId
())
.
in
(
DeliveryStaffCustomerDO:
:
getCustomerId
,
updateReqVO
.
getCustomerIdList
()));
.
eq
(
DeliveryStaffCustomerDO:
:
getIsDept
,
Boolean
.
FALSE
)
.
in
(
DeliveryStaffCustomerDO:
:
getTargetId
,
updateReqVO
.
getCustomerIdList
()));
}
@Override
public
DeliveryStaffDO
getDeliveryStaffByUserId
(
Long
loginUserId
)
{
return
deliveryStaffMapper
.
selectOne
(
DeliveryStaffDO:
:
getUserId
,
loginUserId
);
}
@Override
public
void
bindDept
(
DeliveryStaffBindDeptReqVO
updateReqVO
)
{
validateDeliveryStaffExists
(
updateReqVO
.
getStaffId
());
deliveryStaffCustomerMapper
.
delete
(
DeliveryStaffCustomerDO:
:
getDeliveryStaffId
,
updateReqVO
.
getStaffId
());
if
(
CommonUtil
.
isNotEmpty
(
updateReqVO
.
getDeptIdList
()))
{
List
<
DeliveryStaffCustomerDO
>
deliveryStaffCustomerDOS
=
CommonUtil
.
listConvert
(
updateReqVO
.
getDeptIdList
(),
deptId
->
{
DeliveryStaffCustomerDO
deliveryStaffCustomerDO
=
new
DeliveryStaffCustomerDO
();
deliveryStaffCustomerDO
.
setTargetId
(
deptId
);
deliveryStaffCustomerDO
.
setIsDept
(
Boolean
.
TRUE
);
deliveryStaffCustomerDO
.
setDeliveryStaffId
(
updateReqVO
.
getStaffId
());
return
deliveryStaffCustomerDO
;
});
deliveryStaffCustomerMapper
.
insertBatch
(
deliveryStaffCustomerDOS
);
}
}
@Override
public
void
bindDeptRelease
(
DeliveryStaffBindDeptReqVO
updateReqVO
)
{
validateDeliveryStaffExists
(
updateReqVO
.
getStaffId
());
deliveryStaffCustomerMapper
.
delete
(
Wrappers
.<
DeliveryStaffCustomerDO
>
lambdaQuery
()
.
eq
(
DeliveryStaffCustomerDO:
:
getDeliveryStaffId
,
updateReqVO
.
getStaffId
())
.
eq
(
DeliveryStaffCustomerDO:
:
getIsDept
,
Boolean
.
TRUE
)
.
in
(
DeliveryStaffCustomerDO:
:
getTargetId
,
updateReqVO
.
getDeptIdList
()));
}
@Override
...
...
foodnexus-module-mall/foodnexus-module-operations/src/main/java/cn/iocoder/foodnexus/module/operations/service/deliverystaffcustomer/DeliveryStaffCustomerServiceImpl.java
View file @
c37edf85
...
...
@@ -92,14 +92,19 @@ public class DeliveryStaffCustomerServiceImpl implements DeliveryStaffCustomerSe
public
List
<
ErpCustomerRespVO
>
queryCustomerListByDeliveryStaffId
(
Long
staffId
)
{
List
<
DeliveryStaffCustomerDO
>
list
=
deliveryStaffCustomerMapper
.
selectList
(
Wrappers
.<
DeliveryStaffCustomerDO
>
lambdaQuery
()
.
eq
(
DeliveryStaffCustomerDO:
:
getDeliveryStaffId
,
staffId
)
.
groupBy
(
DeliveryStaffCustomerDO:
:
getCustomerId
));
return
BeanUtils
.
toBean
(
customerService
.
getCustomerList
(
list
.
stream
().
map
(
DeliveryStaffCustomerDO:
:
getCustomerId
).
toList
()),
ErpCustomerRespVO
.
class
);
.
eq
(
DeliveryStaffCustomerDO:
:
getIsDept
,
Boolean
.
FALSE
)
.
groupBy
(
DeliveryStaffCustomerDO:
:
getTargetId
));
return
BeanUtils
.
toBean
(
customerService
.
getCustomerList
(
list
.
stream
().
map
(
DeliveryStaffCustomerDO:
:
getTargetId
).
toList
()),
ErpCustomerRespVO
.
class
);
}
@Override
public
List
<
DeptSimpleRespVO
>
queryDeptListByStaffId
(
Long
staffId
)
{
List
<
DeliveryStaffCustomerDO
>
deliveryStaffCustomerDOS
=
deliveryStaffCustomerMapper
.
selectList
(
DeliveryStaffCustomerDO:
:
getDeliveryStaffId
,
staffId
);
return
BeanUtils
.
toBean
(
deptService
.
getDeptList
(
CommonUtil
.
listConvertSet
(
deliveryStaffCustomerDOS
,
DeliveryStaffCustomerDO:
:
getCustomerDeptId
)),
List
<
DeliveryStaffCustomerDO
>
deliveryStaffCustomerDOS
=
deliveryStaffCustomerMapper
.
selectList
(
Wrappers
.<
DeliveryStaffCustomerDO
>
lambdaQuery
()
.
eq
(
DeliveryStaffCustomerDO:
:
getDeliveryStaffId
,
staffId
)
.
eq
(
DeliveryStaffCustomerDO:
:
getIsDept
,
Boolean
.
TRUE
)
.
groupBy
(
DeliveryStaffCustomerDO:
:
getTargetId
));
return
BeanUtils
.
toBean
(
deptService
.
getDeptList
(
CommonUtil
.
listConvertSet
(
deliveryStaffCustomerDOS
,
DeliveryStaffCustomerDO:
:
getTargetId
)),
DeptSimpleRespVO
.
class
);
}
...
...
foodnexus-module-mall/foodnexus-module-order-api/src/main/java/cn/iocoder/foodnexus/module/order/dto/CustomerOrderDTO.java
View file @
c37edf85
...
...
@@ -3,6 +3,7 @@ package cn.iocoder.foodnexus.module.order.dto;
import
cn.iocoder.foodnexus.module.erp.api.vo.warehouse.WarehouseInfo
;
import
cn.iocoder.foodnexus.module.order.enums.CustomerOrderStatus
;
import
cn.iocoder.foodnexus.module.order.enums.DeliveryMode
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
java.time.LocalDateTime
;
...
...
@@ -34,6 +35,10 @@ public class CustomerOrderDTO {
*/
private
Long
customerId
;
/**
* 灶点id
*/
private
Long
customerDeptId
;
/**
* 收获仓库id
*/
private
Long
warehouseId
;
...
...
@@ -100,4 +105,9 @@ public class CustomerOrderDTO {
*/
private
CustomerOrderRemark
orderRemark
;
/**
* 是否已评论
*/
private
Boolean
hasScore
;
}
foodnexus-module-mall/foodnexus-module-order-api/src/main/java/cn/iocoder/foodnexus/module/order/dto/DeliveryOrderUpdateReqVO.java
View file @
c37edf85
package
cn
.
iocoder
.
foodnexus
.
module
.
order
.
dto
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
jakarta.validation.Valid
;
import
jakarta.validation.constraints.Min
;
import
jakarta.validation.constraints.NotNull
;
import
jakarta.validation.constraints.Size
;
import
lombok.Data
;
import
java.util.List
;
...
...
@@ -15,43 +17,32 @@ import java.util.List;
@Data
public
class
DeliveryOrderUpdateReqVO
{
/**
* 销售出库单id
*/
@NotNull
(
message
=
"销售出库单id不能为空"
)
private
Long
saleOutId
;
@Schema
(
description
=
"客户订单id(customerOrderInfo.id)"
)
@NotNull
(
message
=
"客户订单id(customerOrderInfo.id)"
)
private
Long
id
;
/**
* 销售出库子项
*/
@NotNull
(
message
=
"销售出库子项不能为空"
)
@Schema
(
description
=
"子项"
)
@NotNull
(
message
=
"子项不能为空"
)
@Valid
private
List
<
Item
>
items
;
@Size
(
min
=
1
,
message
=
"子项不能为空"
)
private
List
<
DeliveryOrderUpdateItems
>
orderItems
;
@Data
public
static
class
Item
{
public
static
class
DeliveryOrderUpdateItems
{
/**
* 销售出库子id
*/
@NotNull
(
message
=
"销售出库子id不能为空"
)
private
Long
saleOutItemid
;
@Schema
(
description
=
"客户子订单id"
)
@NotNull
(
message
=
"客户子订单id不能为空"
)
private
Long
id
;
/**
* 实际签收数量
*/
@Schema
(
description
=
"实际签收数量"
)
@NotNull
(
message
=
"实际签收数量不能为空"
)
@Min
(
value
=
0
,
message
=
"实际签收数量最小为0"
)
private
Integer
signedQuantity
;
/**
* 说明
*/
@Schema
(
description
=
"说明"
)
private
String
remark
;
/**
* 相关文件
*/
@Schema
(
description
=
"相关文件"
)
private
List
<
String
>
remarkFiles
;
}
...
...
foodnexus-module-mall/foodnexus-module-order-api/src/main/java/cn/iocoder/foodnexus/module/order/enums/CustomerOrderStatus.java
View file @
c37edf85
...
...
@@ -62,7 +62,7 @@ public enum CustomerOrderStatus implements ArrayValuable<String> {
SORTING
(
"商品分拣"
,
"SORTING"
,
6
)
{
@Override
public
String
getText
()
{
return
"您的商品在【%s】分仓已完成分拣
,【%s】正在进行配送
"
;
return
"您的商品在【%s】分仓已完成分拣"
;
}
},
// 商品配送
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/orderScore/vo/OrderScoreSupplierPageReqVO.java
View file @
c37edf85
...
...
@@ -30,4 +30,10 @@ public class OrderScoreSupplierPageReqVO extends PageParam {
@Schema
(
description
=
"联系电话"
,
example
=
"18818288888"
)
private
String
telephone
;
@Schema
(
description
=
"联系人"
)
private
String
contact
;
@Schema
(
description
=
"统一社会信用代码"
)
private
String
unifiedSocialCreditCode
;
}
\ No newline at end of file
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/customerOrder/vo/AppCustomerOrderItemSaveReqVO.java
View file @
c37edf85
...
...
@@ -23,10 +23,10 @@ public class AppCustomerOrderItemSaveReqVO {
@Schema
(
description
=
"订单商品总价,单位:分"
,
hidden
=
true
)
private
Integer
orderItemTotal
;
@Schema
(
description
=
"市场价,单位使用:分"
)
@Schema
(
description
=
"市场价,单位使用:分"
,
hidden
=
true
)
private
Integer
marketPrice
;
@Schema
(
description
=
"下浮率(%)"
)
@Schema
(
description
=
"下浮率(%)"
,
hidden
=
true
)
private
BigDecimal
discount
;
@Schema
(
description
=
"订单商品数量"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/customerOrder/vo/AppCustomerOrderSaveReqVO.java
View file @
c37edf85
...
...
@@ -19,12 +19,10 @@ public class AppCustomerOrderSaveReqVO {
@Schema
(
description
=
"订单id,新增为空"
)
private
Long
id
;
@Schema
(
description
=
"收获仓库id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"27065"
)
@NotNull
(
message
=
"收获仓库id不能为空"
)
@Schema
(
description
=
"收获仓库id"
,
hidden
=
true
)
private
Long
warehouseId
;
@Schema
(
description
=
"收获库区id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"26507"
)
@NotNull
(
message
=
"收获库区id不能为空"
)
@Schema
(
description
=
"收获库区id"
,
hidden
=
true
)
private
Long
warehouseAreaId
;
@Schema
(
description
=
"客户收货地址id"
)
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/delivery/DeliveryOrderController.java
deleted
100644 → 0
View file @
e0e76314
package
cn
.
iocoder
.
foodnexus
.
module
.
order
.
controller
.
app
.
delivery
;
import
cn.hutool.core.collection.CollUtil
;
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.collection.MapUtils
;
import
cn.iocoder.foodnexus.framework.common.util.object.BeanUtils
;
import
cn.iocoder.foodnexus.framework.security.core.util.SecurityFrameworkUtils
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.product.vo.product.ErpProductRespVO
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.order.ErpSaleOrderPageReqVO
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.order.ErpSaleOrderRespVO
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.out.ErpSaleOutPageReqVO
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.out.ErpSaleOutRespVO
;
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.ErpSaleOrderItemDO
;
import
cn.iocoder.foodnexus.module.erp.dal.dataobject.sale.ErpSaleOutDO
;
import
cn.iocoder.foodnexus.module.erp.service.product.ErpProductService
;
import
cn.iocoder.foodnexus.module.erp.service.sale.ErpCustomerService
;
import
cn.iocoder.foodnexus.module.erp.service.sale.ErpSaleOrderService
;
import
cn.iocoder.foodnexus.module.erp.service.sale.ErpSaleOutService
;
import
cn.iocoder.foodnexus.module.order.api.DeliveryStaffApi
;
import
cn.iocoder.foodnexus.module.order.dto.DeliveryOrderUpdateReqVO
;
import
cn.iocoder.foodnexus.module.system.annotations.AppSystemAuth
;
import
cn.iocoder.foodnexus.module.system.api.user.AdminUserApi
;
import
cn.iocoder.foodnexus.module.system.api.user.dto.AdminUserRespDTO
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.Parameter
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
jakarta.annotation.Resource
;
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.util.List
;
import
java.util.Map
;
import
static
cn
.
iocoder
.
foodnexus
.
framework
.
common
.
pojo
.
CommonResult
.
success
;
import
static
cn
.
iocoder
.
foodnexus
.
framework
.
common
.
util
.
collection
.
CollectionUtils
.
convertMultiMap
;
import
static
cn
.
iocoder
.
foodnexus
.
framework
.
common
.
util
.
collection
.
CollectionUtils
.
convertSet
;
/**
* @author : yanghao
* create at: 2025/9/26 09:49
* @description: 订单 - 配送
*/
@Tag
(
name
=
"配送员 - 订单 - 配送"
)
@RestController
@RequestMapping
(
"/delivery/order"
)
@Validated
@AppSystemAuth
(
UserSystemEnum
.
DELIVERY
)
public
class
DeliveryOrderController
{
@Autowired
private
DeliveryStaffApi
deliveryStaffApi
;
@Autowired
private
ErpSaleOrderService
saleOrderService
;
@Resource
private
ErpProductService
productService
;
@Resource
private
ErpCustomerService
customerService
;
@Autowired
private
ErpSaleOutService
saleOutService
;
@Resource
private
AdminUserApi
adminUserApi
;
// 查询所有已拣销售订单
@GetMapping
(
"/page"
)
@Operation
(
summary
=
"获得销售订单分页"
)
public
CommonResult
<
PageResult
<
ErpSaleOrderRespVO
>>
getSaleOrderPage
(
@Valid
ErpSaleOrderPageReqVO
pageReqVO
)
{
pageReqVO
.
setDeliveryStaffId
(
deliveryStaffApi
.
queryStaffIdByUserId
(
SecurityFrameworkUtils
.
getLoginUserId
()));
// pageReqVO.setPickUpStatus(SaleOrderPickUpStatus.PICK_UP);
PageResult
<
ErpSaleOrderDO
>
pageResult
=
saleOrderService
.
getSaleOrderPage
(
pageReqVO
);
return
success
(
buildSaleOrderVOPageResult
(
pageResult
));
}
// TODO 配送单修改实际配送数量在哪一步?
// 配送订单,生成销售出库单
@PostMapping
(
"/delivery"
)
@Operation
(
summary
=
"配送订单"
)
@Parameter
(
name
=
"id"
,
description
=
"销售订单id"
,
required
=
true
)
public
CommonResult
<
Boolean
>
delivery
(
@RequestParam
(
"id"
)
Long
id
)
{
saleOrderService
.
delivery
(
id
,
deliveryStaffApi
.
queryStaffIdByUserId
(
SecurityFrameworkUtils
.
getLoginUserId
()));
return
success
(
Boolean
.
TRUE
);
}
@GetMapping
(
"/sale-out/page"
)
@Operation
(
summary
=
"获得销售出库分页"
)
public
CommonResult
<
PageResult
<
ErpSaleOutRespVO
>>
getSaleOutPage
(
@Valid
ErpSaleOutPageReqVO
pageReqVO
)
{
PageResult
<
ErpSaleOutDO
>
pageResult
=
saleOutService
.
getSaleOutPage
(
pageReqVO
);
return
success
(
BeanUtils
.
toBean
(
pageResult
,
ErpSaleOutRespVO
.
class
));
}
// 订单到货
@PostMapping
(
"/arrival"
)
@Operation
(
summary
=
"订单到货"
)
@Parameter
(
name
=
"id"
,
description
=
"销售订单id"
,
required
=
true
)
public
CommonResult
<
Boolean
>
arrival
(
@RequestBody
@Valid
DeliveryOrderUpdateReqVO
reqVO
)
{
saleOrderService
.
arrival
(
reqVO
,
deliveryStaffApi
.
queryStaffIdByUserId
(
SecurityFrameworkUtils
.
getLoginUserId
()));
return
success
(
Boolean
.
TRUE
);
}
private
PageResult
<
ErpSaleOrderRespVO
>
buildSaleOrderVOPageResult
(
PageResult
<
ErpSaleOrderDO
>
pageResult
)
{
if
(
CollUtil
.
isEmpty
(
pageResult
.
getList
()))
{
return
PageResult
.
empty
(
pageResult
.
getTotal
());
}
// 1.1 订单项
List
<
ErpSaleOrderItemDO
>
saleOrderItemList
=
saleOrderService
.
getSaleOrderItemListByOrderIds
(
convertSet
(
pageResult
.
getList
(),
ErpSaleOrderDO:
:
getId
));
Map
<
Long
,
List
<
ErpSaleOrderItemDO
>>
saleOrderItemMap
=
convertMultiMap
(
saleOrderItemList
,
ErpSaleOrderItemDO:
:
getOrderId
);
// 1.2 产品信息
Map
<
Long
,
ErpProductRespVO
>
productMap
=
productService
.
getProductVOMap
(
convertSet
(
saleOrderItemList
,
ErpSaleOrderItemDO:
:
getProductId
));
// 1.3 客户信息
Map
<
Long
,
ErpCustomerDO
>
customerMap
=
customerService
.
getCustomerMap
(
convertSet
(
pageResult
.
getList
(),
ErpSaleOrderDO:
:
getCustomerId
));
// 1.4 管理员信息
Map
<
Long
,
AdminUserRespDTO
>
userMap
=
adminUserApi
.
getUserMap
(
convertSet
(
pageResult
.
getList
(),
saleOrder
->
Long
.
parseLong
(
saleOrder
.
getCreator
())));
// 2. 开始拼接
return
BeanUtils
.
toBean
(
pageResult
,
ErpSaleOrderRespVO
.
class
,
saleOrder
->
{
saleOrder
.
setItems
(
BeanUtils
.
toBean
(
saleOrderItemMap
.
get
(
saleOrder
.
getId
()),
ErpSaleOrderRespVO
.
Item
.
class
,
item
->
MapUtils
.
findAndThen
(
productMap
,
item
.
getProductId
(),
product
->
item
.
setProductName
(
product
.
getName
())
.
setProductBarCode
(
product
.
getBarCode
()).
setProductUnitName
(
product
.
getUnitName
()))));
saleOrder
.
setProductNames
(
CollUtil
.
join
(
saleOrder
.
getItems
(),
","
,
ErpSaleOrderRespVO
.
Item
::
getProductName
));
MapUtils
.
findAndThen
(
customerMap
,
saleOrder
.
getCustomerId
(),
supplier
->
saleOrder
.
setCustomerName
(
supplier
.
getName
()));
MapUtils
.
findAndThen
(
userMap
,
Long
.
parseLong
(
saleOrder
.
getCreator
()),
user
->
saleOrder
.
setCreatorName
(
user
.
getNickname
()));
});
}
}
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/delivery/DeliverySaleOrderController.java
0 → 100644
View file @
c37edf85
package
cn
.
iocoder
.
foodnexus
.
module
.
order
.
controller
.
app
.
delivery
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.iocoder.foodnexus.framework.common.enums.UserSystemEnum
;
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.ErpSaleOrderPageReqVO
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.order.ErpSaleOrderRespVO
;
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.ErpSaleOrderItemDO
;
import
cn.iocoder.foodnexus.module.erp.enums.SaleOrderPickUpStatus
;
import
cn.iocoder.foodnexus.module.erp.service.sale.ErpCustomerService
;
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.dal.dataobject.deliverystaff.DeliveryStaffDO
;
import
cn.iocoder.foodnexus.module.operations.service.deliverystaff.DeliveryStaffService
;
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.DeliveryOrderDetails
;
import
cn.iocoder.foodnexus.module.order.controller.app.delivery.vo.DeliverySaleOrderRespVO
;
import
cn.iocoder.foodnexus.module.order.dal.dataobject.customerorder.CustomerOrderDO
;
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.api.user.AdminUserApi
;
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.annotation.Resource
;
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
static
cn
.
iocoder
.
foodnexus
.
framework
.
common
.
pojo
.
CommonResult
.
success
;
import
static
cn
.
iocoder
.
foodnexus
.
framework
.
common
.
util
.
collection
.
CollectionUtils
.
convertMultiMap
;
import
static
cn
.
iocoder
.
foodnexus
.
framework
.
common
.
util
.
collection
.
CollectionUtils
.
convertSet
;
/**
* @author : yanghao
* create at: 2025/10/14 17:56
* @description: 配送员 - 订单 - 接单
*/
@Tag
(
name
=
"配送员 - 订单 - 接单"
)
@RestController
@RequestMapping
(
"/delivery/sale-order"
)
@Validated
@AppSystemAuth
(
UserSystemEnum
.
DELIVERY
)
public
class
DeliverySaleOrderController
{
@Autowired
private
DeliveryStaffApi
deliveryStaffApi
;
@Autowired
private
DeliveryStaffCustomerService
deliveryStaffCustomerService
;
@Autowired
private
ErpSaleOrderService
saleOrderService
;
@Autowired
private
CustomerOrderService
customerOrderService
;
@Autowired
private
CustomerOrderItemService
customerOrderItemService
;
@GetMapping
(
"/page"
)
@Operation
(
summary
=
"查询配送单"
)
@Parameter
(
name
=
"pickUpStatus"
,
description
=
"拣货状态(字典类型:sale_order_pick_up_status)"
,
required
=
true
,
example
=
"1024"
)
public
CommonResult
<
PageResult
<
DeliverySaleOrderRespVO
>>
getSaleOrderPage
(
@Valid
PageParam
pageReq
,
@InEnum
(
value
=
SaleOrderPickUpStatus
.
class
)
@RequestParam
(
"pickUpStatus"
)
String
pickUpStatus
)
{
ErpSaleOrderPageReqVO
pageReqVO
=
new
ErpSaleOrderPageReqVO
();
pageReqVO
.
setPageNo
(
pageReq
.
getPageNo
());
pageReqVO
.
setPageSize
(
pageReq
.
getPageSize
());
if
(
SaleOrderPickUpStatus
.
PICK_UP
.
getType
().
equals
(
pickUpStatus
)
||
SaleOrderPickUpStatus
.
TO_BE
.
getType
().
equals
(
pickUpStatus
)
)
{
List
<
DeptSimpleRespVO
>
deptSimpleRespVOS
=
deliveryStaffCustomerService
.
queryDeptListByStaffId
(
deliveryStaffApi
.
queryStaffIdByUserId
(
SecurityFrameworkUtils
.
getLoginUserId
()));
pageReqVO
.
setCustomerDeptIds
(
CommonUtil
.
listConvert
(
deptSimpleRespVOS
,
DeptSimpleRespVO:
:
getId
));
}
else
{
pageReqVO
.
setDeliveryStaffId
(
deliveryStaffApi
.
queryStaffIdByUserId
(
SecurityFrameworkUtils
.
getLoginUserId
()));
}
pageReqVO
.
setPickUpStatus
(
SaleOrderPickUpStatus
.
getByType
(
pickUpStatus
));
return
success
(
BeanUtils
.
toBean
(
saleOrderService
.
getSaleOrderPage
(
pageReqVO
),
DeliverySaleOrderRespVO
.
class
));
}
@GetMapping
(
"/get"
)
@Operation
(
summary
=
"获得销售订单"
)
@Parameter
(
name
=
"id"
,
description
=
"编号"
,
required
=
true
,
example
=
"1024"
)
public
CommonResult
<
DeliveryOrderDetails
<
DeliverySaleOrderRespVO
>>
getSaleOrder
(
@RequestParam
(
"id"
)
Long
id
)
{
ErpSaleOrderDO
saleOrder
=
saleOrderService
.
getSaleOrder
(
id
);
if
(
saleOrder
==
null
)
{
return
success
(
null
);
}
DeliveryOrderDetails
<
DeliverySaleOrderRespVO
>
result
=
new
DeliveryOrderDetails
<>();
result
.
setDeliveryInfo
(
BeanUtils
.
toBean
(
saleOrder
,
DeliverySaleOrderRespVO
.
class
));
result
.
setCustomerOrderInfo
(
BeanUtils
.
toBean
(
customerOrderService
.
getCustomerOrder
(
saleOrder
.
getCustomerOrderId
()),
CustomerOrderRespVO
.
class
,
item
->
item
.
setOrderItems
(
BeanUtils
.
toBean
(
customerOrderItemService
.
queryByOrderId
(
item
.
getId
()),
CustomerOrderItemRespVO
.
class
))));
return
success
(
result
);
}
@PostMapping
(
"/accept"
)
@Operation
(
summary
=
"确认接单"
)
@Parameter
(
name
=
"id"
,
description
=
"配送单id(deliveryInfo.id)"
,
required
=
true
)
public
CommonResult
<
Boolean
>
accept
(
@RequestParam
(
"id"
)
Long
id
)
{
saleOrderService
.
accept
(
id
,
deliveryStaffApi
.
queryStaffIdByUserId
(
SecurityFrameworkUtils
.
getLoginUserId
()));
return
success
(
Boolean
.
TRUE
);
}
// 配送订单,生成销售出库单
@PostMapping
(
"/delivery"
)
@Operation
(
summary
=
"确认取货"
)
@Parameter
(
name
=
"id"
,
description
=
"配送单id(deliveryInfo.id)"
,
required
=
true
)
public
CommonResult
<
Boolean
>
delivery
(
@RequestParam
(
"id"
)
Long
id
)
{
saleOrderService
.
delivery
(
id
,
deliveryStaffApi
.
queryStaffIdByUserId
(
SecurityFrameworkUtils
.
getLoginUserId
()));
return
success
(
Boolean
.
TRUE
);
}
// 订单到货
@PostMapping
(
"/arrival"
)
@Operation
(
summary
=
"订单到货"
)
public
CommonResult
<
Boolean
>
arrival
(
@RequestBody
@Valid
DeliveryOrderUpdateReqVO
reqVO
)
{
saleOrderService
.
arrival
(
reqVO
,
deliveryStaffApi
.
queryStaffIdByUserId
(
SecurityFrameworkUtils
.
getLoginUserId
()));
return
success
(
Boolean
.
TRUE
);
}
}
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/delivery/vo/DeliveryOrderDetails.java
0 → 100644
View file @
c37edf85
package
cn
.
iocoder
.
foodnexus
.
module
.
order
.
controller
.
app
.
delivery
.
vo
;
import
cn.iocoder.foodnexus.module.order.controller.admin.customerorder.vo.CustomerOrderRespVO
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
/**
* @author : yanghao
* create at: 2025/10/15 10:18
* @description: 配送员 - 订单详情
*/
@Data
public
class
DeliveryOrderDetails
<
T
>
{
@Schema
(
description
=
"配送信息"
)
private
T
deliveryInfo
;
@Schema
(
description
=
"客户订单信息"
)
private
CustomerOrderRespVO
customerOrderInfo
;
}
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/delivery/vo/DeliverySaleOrderRespVO.java
0 → 100644
View file @
c37edf85
package
cn
.
iocoder
.
foodnexus
.
module
.
order
.
controller
.
app
.
delivery
.
vo
;
import
cn.idev.excel.annotation.ExcelProperty
;
import
cn.iocoder.foodnexus.module.erp.api.vo.warehouse.WarehouseInfo
;
import
cn.iocoder.foodnexus.module.erp.enums.SaleOrderPickUpStatus
;
import
cn.iocoder.foodnexus.module.order.dto.CustomerAddressInfo
;
import
cn.iocoder.foodnexus.module.order.enums.DeliveryMode
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
java.time.LocalDateTime
;
/**
* @author : yanghao
* create at: 2025/10/14 18:16
* @description: 配送员 - 销售订单
*/
@Data
public
class
DeliverySaleOrderRespVO
{
@Schema
(
description
=
"编号"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"17386"
)
@ExcelProperty
(
"编号"
)
private
Long
id
;
@Schema
(
description
=
"销售单编号"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"XS001"
)
@ExcelProperty
(
"销售单编号"
)
private
String
no
;
@Schema
(
description
=
"客户编号"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"1724"
)
private
Long
customerId
;
@Schema
(
description
=
"客户名称"
,
example
=
"芋道"
)
@ExcelProperty
(
"客户名称"
)
private
String
customerName
;
@Schema
(
description
=
"下单时间"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@ExcelProperty
(
"下单时间"
)
private
LocalDateTime
orderTime
;
@Schema
(
description
=
"客户订单id"
)
private
Long
customerOrderId
;
@Schema
(
description
=
"配送模式"
)
private
DeliveryMode
deliveryMode
;
@Schema
(
description
=
"配送时间(取货时间)"
)
private
LocalDateTime
deliveryTime
;
@Schema
(
description
=
"接单时间"
)
private
LocalDateTime
acceptTime
;
@Schema
(
description
=
"送达时间"
)
private
LocalDateTime
arrivalTime
;
@Schema
(
description
=
"客户签收时间"
)
private
LocalDateTime
signTime
;
@Schema
(
description
=
"客户收货地址id"
)
private
Long
addressId
;
@Schema
(
description
=
"客户收货地址info"
)
@TableField
(
typeHandler
=
JacksonTypeHandler
.
class
)
private
CustomerAddressInfo
addressInfo
;
@Schema
(
description
=
"拣货状态"
)
private
SaleOrderPickUpStatus
pickUpStatus
;
@Schema
(
description
=
"收获仓库id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"27065"
)
private
Long
warehouseId
;
@Schema
(
description
=
"收获库区id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"26507"
)
private
Long
warehouseAreaId
;
@Schema
(
description
=
"仓库信息"
)
private
WarehouseInfo
warehouseInfo
;
@Schema
(
description
=
"预计配送开始时间"
)
private
LocalDateTime
planDeliveryStartTime
;
@Schema
(
description
=
"预计配送结束时间"
)
private
LocalDateTime
planDeliveryEndTime
;
}
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/shoppingcart/ShoppingCartController.java
View file @
c37edf85
package
cn
.
iocoder
.
foodnexus
.
module
.
order
.
controller
.
app
.
shoppingcart
;
import
cn.iocoder.foodnexus.framework.common.enums.UserSystemEnum
;
import
cn.iocoder.foodnexus.framework.common.util.CommonUtil
;
import
cn.iocoder.foodnexus.framework.common.util.collection.MapUtils
;
import
cn.iocoder.foodnexus.framework.security.core.util.SecurityFrameworkUtils
;
import
cn.iocoder.foodnexus.module.order.controller.app.shoppingcart.vo.ShoppingCartPageReqVO
;
import
cn.iocoder.foodnexus.module.order.controller.app.shoppingcart.vo.ShoppingCartRespVO
;
import
cn.iocoder.foodnexus.module.order.controller.app.shoppingcart.vo.ShoppingCartSaveReqVO
;
import
cn.iocoder.foodnexus.module.product.api.ProductSpuApi
;
import
cn.iocoder.foodnexus.module.product.api.dto.ProductInfo
;
import
cn.iocoder.foodnexus.module.product.dal.dataobject.spu.ProductSpuDO
;
import
cn.iocoder.foodnexus.module.product.service.spu.ProductSpuService
;
import
cn.iocoder.foodnexus.module.system.annotations.AppSystemAuth
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
jakarta.annotation.Resource
;
import
org.springframework.validation.annotation.Validated
;
...
...
@@ -36,6 +43,9 @@ public class ShoppingCartController {
@Resource
private
ShoppingCartService
shoppingCartService
;
@Autowired
private
ProductSpuService
productService
;
@PostMapping
(
"/create"
)
@Operation
(
summary
=
"创建购物车"
)
public
CommonResult
<
Long
>
createShoppingCart
(
@Valid
@RequestBody
ShoppingCartSaveReqVO
createReqVO
)
{
...
...
@@ -70,7 +80,8 @@ public class ShoppingCartController {
@Parameter
(
name
=
"id"
,
description
=
"编号"
,
required
=
true
,
example
=
"1024"
)
public
CommonResult
<
ShoppingCartRespVO
>
getShoppingCart
(
@RequestParam
(
"id"
)
Long
id
)
{
ShoppingCartDO
shoppingCart
=
shoppingCartService
.
getShoppingCart
(
id
);
return
success
(
BeanUtils
.
toBean
(
shoppingCart
,
ShoppingCartRespVO
.
class
));
return
success
(
BeanUtils
.
toBean
(
shoppingCart
,
ShoppingCartRespVO
.
class
,
cart
->
cart
.
setProductInfo
(
BeanUtils
.
toBean
(
productService
.
getSpu
(
cart
.
getProductId
()),
ProductInfo
.
class
))));
}
@GetMapping
(
"/page"
)
...
...
@@ -78,7 +89,10 @@ public class ShoppingCartController {
public
CommonResult
<
PageResult
<
ShoppingCartRespVO
>>
getShoppingCartPage
(
@Valid
ShoppingCartPageReqVO
pageReqVO
)
{
pageReqVO
.
setCreator
(
SecurityFrameworkUtils
.
getLoginUserId
());
PageResult
<
ShoppingCartDO
>
pageResult
=
shoppingCartService
.
getShoppingCartPage
(
pageReqVO
);
return
success
(
BeanUtils
.
toBean
(
pageResult
,
ShoppingCartRespVO
.
class
));
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
)));
}));
}
}
\ No newline at end of file
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/shoppingcart/vo/ShoppingCartRespVO.java
View file @
c37edf85
package
cn
.
iocoder
.
foodnexus
.
module
.
order
.
controller
.
app
.
shoppingcart
.
vo
;
import
cn.iocoder.foodnexus.module.product.api.dto.ProductInfo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.*
;
import
java.util.*
;
...
...
@@ -24,6 +25,9 @@ public class ShoppingCartRespVO {
@ExcelProperty
(
"商品名称"
)
private
String
productName
;
@Schema
(
description
=
"商品信息"
)
private
ProductInfo
productInfo
;
@Schema
(
description
=
"单价(分)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"6013"
)
@ExcelProperty
(
"单价(分)"
)
private
Integer
unitPrice
;
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/service/customerorder/CustomerOrderService.java
View file @
c37edf85
...
...
@@ -18,6 +18,8 @@ import cn.iocoder.foodnexus.framework.common.pojo.PageParam;
*/
public
interface
CustomerOrderService
{
String
ORDER_LOCK
=
"orderLock:%s"
;
/**
* 创建客户总订单
*
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/service/customerorder/CustomerOrderServiceImpl.java
View file @
c37edf85
...
...
@@ -3,6 +3,7 @@ package cn.iocoder.foodnexus.module.order.service.customerorder;
import
cn.iocoder.foodnexus.framework.common.enums.UserSystemEnum
;
import
cn.iocoder.foodnexus.framework.common.util.CommonUtil
;
import
cn.iocoder.foodnexus.framework.common.util.spring.SpringUtils
;
import
cn.iocoder.foodnexus.framework.redis.utils.RedisUtils
;
import
cn.iocoder.foodnexus.framework.security.core.LoginUser
;
import
cn.iocoder.foodnexus.framework.security.core.util.SecurityFrameworkUtils
;
import
cn.iocoder.foodnexus.module.customerpermission.core.annotation.CustomerVisible
;
...
...
@@ -11,6 +12,7 @@ import cn.iocoder.foodnexus.module.erp.api.service.ErpCustomerApi;
import
cn.iocoder.foodnexus.module.erp.api.service.ErpSupplierApi
;
import
cn.iocoder.foodnexus.module.erp.api.service.ErpWarehouseApi
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.returns.ErpSaleReturnSaveReqVO
;
import
cn.iocoder.foodnexus.module.erp.dal.dataobject.customerwarehouse.CustomerWarehouseDO
;
import
cn.iocoder.foodnexus.module.erp.dal.dataobject.sale.*
;
import
cn.iocoder.foodnexus.module.erp.service.customerwarehouse.CustomerWarehouseService
;
import
cn.iocoder.foodnexus.module.erp.service.purchase.ErpPurchaseOrderServiceImpl
;
...
...
@@ -197,7 +199,20 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
public
Long
appCreateCustomerOrder
(
AppCustomerOrderSaveReqVO
createReqVO
)
{
LoginUser
loginUser
=
SecurityFrameworkUtils
.
getLoginUser
();
Long
customerId
=
customerApi
.
queryCustomerIdByUserId
(
loginUser
.
getId
());
List
<
CustomerWarehouseDO
>
customerWarehouse
=
customerWarehouseService
.
getCustomerWarehouseByCustomerId
(
customerId
);
if
(
CommonUtil
.
isEmpty
(
customerWarehouse
)
||
CommonUtil
.
isEmpty
(
customerWarehouse
.
get
(
0
)))
{
throw
exception
(
CUSTOMER_ORDER_ADDRESS_NOEXISTS
);
}
else
{
// TODO 理论上客户只对应一个库区
createReqVO
.
setWarehouseId
(
customerWarehouse
.
get
(
0
).
getWarehouseId
());
createReqVO
.
setWarehouseAreaId
(
customerWarehouse
.
get
(
0
).
getWarehouseAreaId
());
}
this
.
validCustomerOrder
(
createReqVO
,
customerId
);
Long
customerOrderId
;
String
lock
=
String
.
format
(
ORDER_LOCK
,
loginUser
.
getId
());
RedisUtils
.
tryLockRds
(
lock
);
try
{
CustomerVisibleProductRespDTO
dto
=
inquireCustomerApi
.
queryCustomerIdByCustomerId
(
customerId
);
Map
<
Long
,
CustomerVisibleProductRespDTO
.
CustomerProduct
>
customerProductMap
=
CommonUtil
.
listConvertMap
(
dto
.
getItems
(),
CustomerVisibleProductRespDTO
.
CustomerProduct
::
getProductId
);
Set
<
Long
>
supplierSet
=
new
HashSet
<>();
...
...
@@ -245,7 +260,7 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
createOrder
.
setOrderAmount
(
orderAmount
.
get
());
Long
customerOrderId
=
this
.
createCustomerOrder
(
createOrder
);
customerOrderId
=
this
.
createCustomerOrder
(
createOrder
);
customerOrderItemService
.
createBatch
(
collect
,
customerOrderId
);
// 拆分采购订单
...
...
@@ -258,6 +273,9 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
event
.
setCopyWriter
(
CommonUtil
.
asList
(
String
.
valueOf
(
createOrder
.
getOrderAmount
()),
String
.
valueOf
(
createOrder
.
getProductCount
())));
orderRecordApi
.
recordEvent
(
event
);
}
finally
{
RedisUtils
.
unLockRds
(
lock
);
}
return
customerOrderId
;
}
...
...
@@ -276,8 +294,6 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
if
(
CommonUtil
.
isEmpty
(
customerOrder
))
{
throw
exception
(
CUSTOMER_ORDER_NOT_EXISTS
);
}
Long
customerId
=
customerApi
.
queryCustomerIdByUserId
(
loginUser
.
getId
());
this
.
validCustomerOrder
(
updateReqVO
,
customerId
);
// TODO 具体修改什么待定
// TODO 采购订单拆分更新
...
...
@@ -295,7 +311,9 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
if
(
CommonUtil
.
isEmpty
(
customerOrder
))
{
throw
exception
(
CUSTOMER_ORDER_NOT_EXISTS
);
}
// TODO ... 取消订单校验待定(订单状态)
String
lock
=
String
.
format
(
ORDER_LOCK
,
reqVO
.
getId
());
RedisUtils
.
tryLockRds
(
lock
);
try
{
CustomerOrderStatus
orderStatus
=
customerOrder
.
getOrderStatus
();
if
(
orderStatus
.
equals
(
CustomerOrderStatus
.
ORDER_SUCCESS
)
||
orderStatus
.
equals
(
CustomerOrderStatus
.
ORDER_MATCH
))
{
...
...
@@ -317,6 +335,9 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
}
else
{
throw
exception
(
CUSTOMER_ORDER_STATUS_ERROR
);
}
}
finally
{
RedisUtils
.
unLockRds
(
lock
);
}
}
/**
...
...
@@ -339,6 +360,9 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
if
(
CommonUtil
.
isEmpty
(
saleOut
))
{
throw
exception
(
CUSTOMER_ORDER_OUT_ERROR
);
}
String
lock
=
String
.
format
(
ORDER_LOCK
,
reqVO
.
getId
());
RedisUtils
.
tryLockRds
(
lock
);
try
{
List
<
ErpSaleOutItemDO
>
saleOutItems
=
saleOutService
.
getSaleOutItemListByOutId
(
saleOut
.
getId
());
Map
<
Long
,
ErpSaleOutItemDO
>
productMap
=
CommonUtil
.
listConvertMap
(
saleOutItems
,
ErpSaleOutItemDO:
:
getProductId
);
...
...
@@ -353,7 +377,7 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
CustomerOrderRemark
remark
=
new
CustomerOrderRemark
();
remark
.
setOperTime
(
Date
.
from
(
saleOutItem
.
getCreateTime
()
.
atZone
(
ZoneId
.
systemDefault
())
// 绑定系统默认时区
.
toInstant
()
));
.
toInstant
()
));
remark
.
setRemarkFiles
(
saleOutItem
.
getRemarkFiles
());
remark
.
setRemark
(
saleOutItem
.
getRemark
());
updateItem
.
setOrderRemark
(
remark
);
...
...
@@ -372,6 +396,10 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
updateOrder
.
setActualAmount
(
actualAmount
.
get
());
customerOrderMapper
.
updateById
(
updateOrder
);
// 更新销售单和销售出库单的状态
saleOrderService
.
receiptByCustomerOrderId
(
reqVO
.
getId
(),
CommonUtil
.
listConvert
(
customerOrderItems
,
CustomerOrderItemDO:
:
getId
));
saleOutService
.
receiptByCustomerOrderId
(
reqVO
.
getId
(),
CommonUtil
.
listConvert
(
customerOrderItems
,
CustomerOrderItemDO:
:
getId
));
// 订单记录
CustomerOrderRecordEvent
event
=
new
CustomerOrderRecordEvent
();
event
.
setOrderStatus
(
CustomerOrderStatus
.
SIGN_RECEIPT
);
...
...
@@ -379,6 +407,9 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
// TODO 签收单链接
event
.
setCopyWriter
(
CommonUtil
.
asList
(
"TODO 签收单链接"
));
orderRecordApi
.
recordEvent
(
event
);
}
finally
{
RedisUtils
.
unLockRds
(
lock
);
}
}
@Override
...
...
@@ -430,6 +461,10 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
throw
exception
(
CUSTOMER_ORDER_STATUS_ERROR
);
}
String
lock
=
String
.
format
(
ORDER_LOCK
,
reqVO
.
getCustomerOrderId
());
RedisUtils
.
tryLockRds
(
lock
);
try
{
// 修改客户订单状态
CustomerOrderRecordEvent
event
=
new
CustomerOrderRecordEvent
();
event
.
setOrderStatus
(
CustomerOrderStatus
.
RETURN
);
...
...
@@ -475,6 +510,9 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
}
returnSaveReqVO
.
setItems
(
items
);
saleReturnService
.
createSaleReturn
(
returnSaveReqVO
);
}
finally
{
RedisUtils
.
unLockRds
(
lock
);
}
}
/**
...
...
@@ -518,6 +556,9 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
if
(
CommonUtil
.
isNotEmpty
(
customerOrder
.
getHasScore
())
&&
customerOrder
.
getHasScore
())
{
throw
exception
(
CUSTOMER_ORDER_HAS_RECEIPT
);
}
String
lock
=
String
.
format
(
ORDER_LOCK
,
reqVO
.
getOrderId
());
RedisUtils
.
tryLockRds
(
lock
);
try
{
if
(
CommonUtil
.
isNotEmpty
(
reqVO
.
getItems
()))
{
reqVO
.
getItems
().
forEach
(
item
->
{
if
(!
orderScoreService
.
exists
(
id
,
item
.
getScoreId
()))
{
...
...
@@ -550,6 +591,9 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
updateScore
.
setId
(
id
);
updateScore
.
setHasScore
(
Boolean
.
TRUE
);
customerOrderMapper
.
updateById
(
updateScore
);
}
finally
{
RedisUtils
.
unLockRds
(
lock
);
}
}
@Override
...
...
@@ -561,6 +605,11 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
for
(
CustomerOrderStatus
em
:
CustomerOrderStatus
.
values
())
{
result
.
put
(
em
.
getKey
(),
statusMap
.
getOrDefault
(
em
.
getKey
(),
0L
));
}
// TODO 待评价
result
.
put
(
"TO_BE_SCORE"
,
customerOrderMapper
.
selectCount
(
Wrappers
.<
CustomerOrderDO
>
lambdaQuery
()
.
eq
(
CustomerOrderDO:
:
getHasScore
,
Boolean
.
FALSE
)
.
in
(
CustomerOrderDO:
:
getOrderStatus
,
CommonUtil
.
asList
(
CustomerOrderStatus
.
SIGN_RECEIPT
.
getLabel
(),
CustomerOrderStatus
.
FINISH
.
getLabel
()))));
return
result
;
}
...
...
foodnexus-module-system/src/main/java/cn/iocoder/foodnexus/module/system/controller/admin/auth/vo/AuthLoginReqVO.java
View file @
c37edf85
...
...
@@ -23,8 +23,8 @@ public class AuthLoginReqVO extends CaptchaVerificationReqVO {
@Schema
(
description
=
"账号"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"foodnexusyuanma"
)
@NotEmpty
(
message
=
"登录账号不能为空"
)
@Length
(
min
=
4
,
max
=
16
,
message
=
"账号长度为 4-16 位"
)
@Pattern
(
regexp
=
"^[A-Za-z0-9]+$"
,
message
=
"账号格式为数字以及字母"
)
/*
@Length(min = 4, max = 16, message = "账号长度为 4-16 位")
@Pattern(regexp = "^[A-Za-z0-9]+$", message = "账号格式为数字以及字母")
*/
private
String
username
;
@Schema
(
description
=
"密码"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"buzhidao"
)
...
...
foodnexus-module-system/src/main/java/cn/iocoder/foodnexus/module/system/controller/app/auth/AppAuthController.java
View file @
c37edf85
...
...
@@ -7,6 +7,7 @@ import cn.iocoder.foodnexus.framework.common.enums.UserTypeEnum;
import
cn.iocoder.foodnexus.framework.common.pojo.CommonResult
;
import
cn.iocoder.foodnexus.framework.security.config.SecurityProperties
;
import
cn.iocoder.foodnexus.framework.security.core.util.SecurityFrameworkUtils
;
import
cn.iocoder.foodnexus.module.erp.api.service.ErpCustomerApi
;
import
cn.iocoder.foodnexus.module.system.controller.admin.auth.vo.*
;
import
cn.iocoder.foodnexus.module.system.convert.auth.AuthConvert
;
import
cn.iocoder.foodnexus.module.system.dal.dataobject.permission.MenuDO
;
...
...
@@ -28,6 +29,7 @@ import jakarta.annotation.security.PermitAll;
import
jakarta.servlet.http.HttpServletRequest
;
import
jakarta.validation.Valid
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
...
...
foodnexus-module-system/src/main/java/cn/iocoder/foodnexus/module/system/util/GenCodeUtils.java
View file @
c37edf85
...
...
@@ -7,6 +7,7 @@ import org.springframework.stereotype.Component;
import
java.time.Duration
;
import
java.time.LocalDate
;
import
java.time.format.DateTimeFormatter
;
import
java.util.concurrent.ThreadLocalRandom
;
/**
...
...
@@ -35,9 +36,13 @@ public class GenCodeUtils {
private
String
getCode
(
String
type
,
String
monthDay
,
Long
increment
)
{
if
(
increment
<
MAX
)
{
return
String
.
format
(
"%s%s
0%s"
,
type
,
monthDay
,
String
.
valueOf
(
increment
+
MAX
).
substring
(
1
));
return
String
.
format
(
"%s%s
%s0%s"
,
type
,
monthDay
,
random
()
,
String
.
valueOf
(
increment
+
MAX
).
substring
(
1
));
}
return
String
.
format
(
"%s%s%s"
,
type
,
monthDay
,
increment
);
return
String
.
format
(
"%s%s%s%s"
,
type
,
monthDay
,
random
(),
increment
);
}
private
int
random
()
{
return
ThreadLocalRandom
.
current
().
nextInt
(
100
,
1000
);
}
}
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