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
3f54bac9
Commit
3f54bac9
authored
Nov 04, 2025
by
杨浩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
对账权限控制;
日期格式化;
parent
d4a9d030
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
249 additions
and
32 deletions
+249
-32
foodnexus-framework/foodnexus-common/src/main/java/cn/iocoder/foodnexus/framework/common/util/json/databind/FlexibleLocalDateDeserializer.java
+53
-0
foodnexus-framework/foodnexus-common/src/main/java/cn/iocoder/foodnexus/framework/common/util/json/databind/FlexibleLocalDateTimeDeserializer.java
+59
-0
foodnexus-framework/foodnexus-spring-boot-starter-web/src/main/java/cn/iocoder/foodnexus/framework/jackson/config/FoodnexusJacksonAutoConfiguration.java
+3
-5
foodnexus-module-erp-api/src/main/java/cn/iocoder/foodnexus/module/erp/api/service/ErpCustomerApi.java
+4
-0
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/purchase/vo/order/ErpPurchaseOrderPageReqVO.java
+8
-0
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/dal/mysql/purchase/ErpPurchaseOrderMapper.java
+2
-0
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/dal/redis/no/ErpNoRedisDAO.java
+8
-2
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/service/sale/ErpCustomerServiceImpl.java
+23
-4
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/checktask/CheckTaskController.java
+12
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/checktask/vo/CheckTaskWithScoreRespVO.java
+20
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/orderScore/OrderScoreController.java
+0
-1
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/customerOrder/AppCustomerOrderController.java
+2
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/customerOrder/AppCustomerOrderReconciliationController.java
+15
-1
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/customerOrder/vo/AppCustomerOrderSaveReqVO.java
+1
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/customerOrder/vo/AppCustomerYearOrderPageReqVO.java
+6
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/dal/mysql/customerorder/CustomerOrderMapper.java
+3
-1
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/service/checktask/CheckTaskService.java
+3
-1
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/service/checktask/CheckTaskServiceImpl.java
+19
-12
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/service/customerorder/CustomerOrderService.java
+1
-1
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/service/customerorder/CustomerOrderServiceImpl.java
+5
-4
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/service/shoppingcart/ShoppingCartServiceImpl.java
+2
-0
No files found.
foodnexus-framework/foodnexus-common/src/main/java/cn/iocoder/foodnexus/framework/common/util/json/databind/FlexibleLocalDateDeserializer.java
0 → 100644
View file @
3f54bac9
package
cn
.
iocoder
.
foodnexus
.
framework
.
common
.
util
.
json
.
databind
;
import
com.fasterxml.jackson.core.JsonParser
;
import
com.fasterxml.jackson.databind.DeserializationContext
;
import
com.fasterxml.jackson.databind.deser.std.StdDeserializer
;
import
java.io.IOException
;
import
java.time.Instant
;
import
java.time.LocalDate
;
import
java.time.ZoneId
;
import
java.time.format.DateTimeFormatter
;
import
java.time.format.DateTimeParseException
;
/**
* @author : yanghao
* create at: 2025/11/4 10:29
* @description:
*/
public
class
FlexibleLocalDateDeserializer
extends
StdDeserializer
<
LocalDate
>
{
// 定义日期字符串格式(与前端保持一致)
private
static
final
DateTimeFormatter
DATE_FORMATTER
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
);
// 时区(默认北京时间)
private
static
final
ZoneId
ZONE_ID
=
ZoneId
.
of
(
"GMT+8"
);
public
FlexibleLocalDateDeserializer
()
{
super
(
LocalDate
.
class
);
}
@Override
public
LocalDate
deserialize
(
JsonParser
p
,
DeserializationContext
ctxt
)
throws
IOException
{
String
value
=
p
.
getValueAsString
();
if
(
value
==
null
||
value
.
trim
().
isEmpty
())
{
return
null
;
// 允许空值
}
// 尝试解析时间戳(Long类型)
try
{
long
timestamp
=
Long
.
parseLong
(
value
.
trim
());
// 时间戳转LocalDate(先转Instant,再转指定时区的LocalDate)
return
Instant
.
ofEpochMilli
(
timestamp
)
.
atZone
(
ZONE_ID
)
.
toLocalDate
();
}
catch
(
NumberFormatException
e
)
{
// 时间戳解析失败,尝试解析日期字符串
try
{
return
LocalDate
.
parse
(
value
.
trim
(),
DATE_FORMATTER
);
}
catch
(
DateTimeParseException
ex
)
{
// 两种格式都失败,抛出异常(包含具体错误信息)
throw
new
IOException
(
"无法解析LocalDate:"
+
value
+
",支持格式:时间戳(毫秒)或 yyyy-MM-dd"
,
ex
);
}
}
}
}
foodnexus-framework/foodnexus-common/src/main/java/cn/iocoder/foodnexus/framework/common/util/json/databind/FlexibleLocalDateTimeDeserializer.java
0 → 100644
View file @
3f54bac9
package
cn
.
iocoder
.
foodnexus
.
framework
.
common
.
util
.
json
.
databind
;
import
com.fasterxml.jackson.core.JsonParser
;
import
com.fasterxml.jackson.databind.DeserializationContext
;
import
com.fasterxml.jackson.databind.deser.std.StdDeserializer
;
import
java.io.IOException
;
import
java.time.Instant
;
import
java.time.LocalDateTime
;
import
java.time.ZoneId
;
import
java.time.ZonedDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.time.format.DateTimeParseException
;
/**
* @author : yanghao
* create at: 2025/11/4 10:22
* @description:
*/
public
class
FlexibleLocalDateTimeDeserializer
extends
StdDeserializer
<
LocalDateTime
>
{
private
static
final
DateTimeFormatter
DATETIME_FORMATTER
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
);
private
static
final
ZoneId
DEFAULT_ZONE
=
ZoneId
.
of
(
"GMT+8"
);
public
FlexibleLocalDateTimeDeserializer
()
{
super
(
LocalDateTime
.
class
);
}
@Override
public
LocalDateTime
deserialize
(
JsonParser
p
,
DeserializationContext
ctxt
)
throws
IOException
{
String
value
=
p
.
getValueAsString
();
if
(
value
==
null
||
value
.
trim
().
isEmpty
())
{
return
null
;
}
value
=
value
.
trim
();
// 1. 尝试解析时间戳(毫秒级)
try
{
long
timestamp
=
Long
.
parseLong
(
value
);
return
Instant
.
ofEpochMilli
(
timestamp
).
atZone
(
DEFAULT_ZONE
).
toLocalDateTime
();
}
catch
(
NumberFormatException
e
)
{
// 2. 尝试解析 ISO 8601 格式(带 Z 或时区偏移)
try
{
ZonedDateTime
zonedDateTime
=
ZonedDateTime
.
parse
(
value
);
return
zonedDateTime
.
withZoneSameInstant
(
DEFAULT_ZONE
).
toLocalDateTime
();
}
catch
(
DateTimeParseException
ex
)
{
// 3. 尝试解析 yyyy-MM-dd HH:mm:ss 字符串格式
try
{
return
LocalDateTime
.
parse
(
value
,
DATETIME_FORMATTER
);
}
catch
(
DateTimeParseException
exc
)
{
throw
new
IOException
(
"无法解析LocalDateTime:"
+
value
+
",支持格式:时间戳(毫秒)、yyyy-MM-dd HH:mm:ss、ISO 8601(如 2025-11-04T06:00:00.000Z)"
,
exc
);
}
}
}
}
}
foodnexus-framework/foodnexus-spring-boot-starter-web/src/main/java/cn/iocoder/foodnexus/framework/jackson/config/FoodnexusJacksonAutoConfiguration.java
View file @
3f54bac9
...
...
@@ -2,9 +2,7 @@ package cn.iocoder.foodnexus.framework.jackson.config;
import
cn.hutool.core.collection.CollUtil
;
import
cn.iocoder.foodnexus.framework.common.util.json.JsonUtils
;
import
cn.iocoder.foodnexus.framework.common.util.json.databind.NumberSerializer
;
import
cn.iocoder.foodnexus.framework.common.util.json.databind.TimestampLocalDateTimeDeserializer
;
import
cn.iocoder.foodnexus.framework.common.util.json.databind.TimestampLocalDateTimeSerializer
;
import
cn.iocoder.foodnexus.framework.common.util.json.databind.*
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.module.SimpleModule
;
import
com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer
;
...
...
@@ -34,12 +32,12 @@ public class FoodnexusJacksonAutoConfiguration {
.
addSerializer
(
Long
.
class
,
NumberSerializer
.
INSTANCE
)
.
addSerializer
(
Long
.
TYPE
,
NumberSerializer
.
INSTANCE
)
.
addSerializer
(
LocalDate
.
class
,
LocalDateSerializer
.
INSTANCE
)
.
addDeserializer
(
LocalDate
.
class
,
LocalDateDeserializer
.
INSTANCE
)
.
addDeserializer
(
LocalDate
.
class
,
new
FlexibleLocalDateDeserializer
()
)
.
addSerializer
(
LocalTime
.
class
,
LocalTimeSerializer
.
INSTANCE
)
.
addDeserializer
(
LocalTime
.
class
,
LocalTimeDeserializer
.
INSTANCE
)
// 新增 LocalDateTime 序列化、反序列化规则,使用 Long 时间戳
.
addSerializer
(
LocalDateTime
.
class
,
TimestampLocalDateTimeSerializer
.
INSTANCE
)
.
addDeserializer
(
LocalDateTime
.
class
,
TimestampLocalDateTimeDeserializer
.
INSTANCE
);
.
addDeserializer
(
LocalDateTime
.
class
,
new
FlexibleLocalDateTimeDeserializer
()
);
// 1.2 注册到 objectMapper
objectMappers
.
forEach
(
objectMapper
->
objectMapper
.
registerModule
(
simpleModule
));
...
...
foodnexus-module-erp-api/src/main/java/cn/iocoder/foodnexus/module/erp/api/service/ErpCustomerApi.java
View file @
3f54bac9
...
...
@@ -5,7 +5,9 @@ import jakarta.validation.Valid;
import
jakarta.validation.constraints.NotNull
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
/**
* @author : yanghao
...
...
@@ -28,4 +30,6 @@ public interface ErpCustomerApi {
String
queryNameStrById
(
Long
customerId
);
Integer
queryCustomerTypeByUserId
(
Long
userId
);
Set
<
Long
>
queryCustomerDeptIdsByUserId
(
Long
userId
);
}
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/purchase/vo/order/ErpPurchaseOrderPageReqVO.java
View file @
3f54bac9
package
cn
.
iocoder
.
foodnexus
.
module
.
erp
.
controller
.
admin
.
purchase
.
vo
.
order
;
import
cn.idev.excel.annotation.ExcelProperty
;
import
cn.iocoder.foodnexus.framework.common.enums.CheckTaskStatus
;
import
cn.iocoder.foodnexus.framework.common.pojo.PageParam
;
import
cn.iocoder.foodnexus.framework.common.validation.InEnum
;
import
cn.iocoder.foodnexus.module.erp.api.enums.ErpDeliveryStatus
;
...
...
@@ -106,6 +107,13 @@ public class ErpPurchaseOrderPageReqVO extends PageParam {
@InEnum
(
ErpDeliveryStatus
.
class
)
private
String
deliveryStatus
;
@Schema
(
description
=
"质检状态"
)
@InEnum
(
CheckTaskStatus
.
class
)
private
String
checkTaskStatus
;
@Schema
(
description
=
"质检状态"
)
private
List
<
String
>
checkTaskStatusList
;
@Schema
(
description
=
"配送模式"
)
private
DeliveryMode
deliveryMode
;
...
...
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/dal/mysql/purchase/ErpPurchaseOrderMapper.java
View file @
3f54bac9
...
...
@@ -58,6 +58,8 @@ public interface ErpPurchaseOrderMapper extends BaseMapperX<ErpPurchaseOrderDO>
.
eqIfPresent
(
ErpPurchaseOrderDO:
:
getCreator
,
reqVO
.
getCreator
())
.
eqIfPresent
(
ErpPurchaseOrderDO:
:
getDeliveryStatus
,
reqVO
.
getDeliveryStatus
())
.
inIfPresent
(
ErpPurchaseOrderDO:
:
getDeliveryStatus
,
reqVO
.
getDeliveryStatusList
())
.
eqIfPresent
(
ErpPurchaseOrderDO:
:
getCheckTaskStatus
,
reqVO
.
getCheckTaskStatus
())
.
inIfPresent
(
ErpPurchaseOrderDO:
:
getCheckTaskStatus
,
reqVO
.
getCheckTaskStatusList
())
.
eqIfPresent
(
ErpPurchaseOrderDO:
:
getCustomerOrderId
,
reqVO
.
getCustomerOrderId
())
.
orderByDesc
(
ErpPurchaseOrderDO:
:
getId
);
// 入库状态。为什么需要 t. 的原因,是因为联表查询时,需要指定表名,不然会报 in_count 错误
...
...
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/dal/redis/no/ErpNoRedisDAO.java
View file @
3f54bac9
...
...
@@ -3,7 +3,9 @@ package cn.iocoder.foodnexus.module.erp.dal.redis.no;
import
cn.hutool.core.date.DatePattern
;
import
cn.hutool.core.date.DateUtil
;
import
cn.iocoder.foodnexus.module.erp.dal.redis.RedisKeyConstants
;
import
cn.iocoder.foodnexus.module.system.util.GenCodeUtils
;
import
jakarta.annotation.Resource
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.stereotype.Repository
;
...
...
@@ -77,6 +79,9 @@ public class ErpNoRedisDAO {
@Resource
private
StringRedisTemplate
stringRedisTemplate
;
@Autowired
private
GenCodeUtils
genCodeUtils
;
/**
* 生成序号,使用当前日期,格式为 {PREFIX} + yyyyMMdd + 6 位自增
* 例如说:QTRK 202109 000001 (没有中间空格)
...
...
@@ -85,13 +90,14 @@ public class ErpNoRedisDAO {
* @return 序号
*/
public
String
generate
(
String
prefix
)
{
// 递增序号
return
genCodeUtils
.
createAmBatch
(
prefix
);
/*// 递增序号
String noPrefix = prefix + DateUtil.format(LocalDateTime.now(), DatePattern.PURE_DATE_PATTERN);
String key = RedisKeyConstants.NO + noPrefix;
Long no = stringRedisTemplate.opsForValue().increment(key);
// 设置过期时间
stringRedisTemplate.expire(key, Duration.ofDays(1L));
return
noPrefix
+
random
()
+
String
.
format
(
"%06d"
,
no
);
return noPrefix + random() + String.format("%06d", no);
*/
}
private
int
random
()
{
...
...
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/service/sale/ErpCustomerServiceImpl.java
View file @
3f54bac9
...
...
@@ -20,21 +20,20 @@ import cn.iocoder.foodnexus.module.erp.service.stock.ErpWarehouseService;
import
cn.iocoder.foodnexus.module.system.dal.dataobject.dept.DeptDO
;
import
cn.iocoder.foodnexus.module.system.dal.dataobject.user.AdminUserDO
;
import
cn.iocoder.foodnexus.framework.common.enums.UserSystemEnum
;
import
cn.iocoder.foodnexus.module.system.dal.redis.RedisKeyConstants
;
import
cn.iocoder.foodnexus.module.system.service.dept.DeptService
;
import
cn.iocoder.foodnexus.module.system.service.user.AdminUserService
;
import
com.google.common.collect.Maps
;
import
jakarta.annotation.Resource
;
import
org.apache.commons.compress.utils.Lists
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.validation.annotation.Validated
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.*
;
import
static
cn
.
iocoder
.
foodnexus
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
import
static
cn
.
iocoder
.
foodnexus
.
module
.
erp
.
enums
.
ErrorCodeConstants
.*;
...
...
@@ -276,4 +275,24 @@ public class ErpCustomerServiceImpl implements ErpCustomerService, ErpCustomerAp
}
return
CustomerTypeEnum
.
CHIEF
.
getKey
();
}
@Override
public
Set
<
Long
>
queryCustomerDeptIdsByUserId
(
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
());
}
Set
<
Long
>
deptIds
=
deptService
.
getChildDeptIdListFromCache
(
user
.
getDeptId
());
deptIds
.
add
(
user
.
getDeptId
());
return
deptIds
;
}
}
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/checktask/CheckTaskController.java
View file @
3f54bac9
...
...
@@ -136,6 +136,18 @@ public class CheckTaskController {
return
success
(
checkTaskService
.
queryScore
(
id
));
}
@GetMapping
(
"query-checktask-and-score"
)
@Operation
(
summary
=
"根据采购订单id获取质检报告和评价"
)
@Parameter
(
name
=
"purchaseOrderId"
,
description
=
"采购订单id"
,
required
=
true
)
public
CommonResult
<
CheckTaskWithScoreRespVO
>
queryCheckTaskAndScore
(
@RequestParam
(
"purchaseOrderId"
)
Long
purchaseOrderId
)
{
CheckTaskDO
checkTaskDO
=
checkTaskService
.
queryScorebyPurchaseOrderId
(
purchaseOrderId
);
if
(
CommonUtil
.
isNotEmpty
(
checkTaskDO
))
{
return
success
(
new
CheckTaskWithScoreRespVO
(
this
.
getCheckTask
(
checkTaskDO
.
getId
()).
getData
(),
this
.
queryScore
(
checkTaskDO
.
getId
()).
getData
()));
}
return
success
(
null
);
}
@GetMapping
(
"/export-excel"
)
@Operation
(
summary
=
"导出来料质检 Excel"
)
@PreAuthorize
(
"@ss.hasPermission('order:check-task:export')"
)
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/checktask/vo/CheckTaskWithScoreRespVO.java
0 → 100644
View file @
3f54bac9
package
cn
.
iocoder
.
foodnexus
.
module
.
order
.
controller
.
admin
.
checktask
.
vo
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
/**
* @author : yanghao
* create at: 2025/11/3 18:06
* @description:
*/
@Data
@AllArgsConstructor
public
class
CheckTaskWithScoreRespVO
{
private
CheckTaskRespVO
checkTask
;
private
CheckTaskSupplierScoreRespVO
score
;
}
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/admin/orderScore/OrderScoreController.java
View file @
3f54bac9
...
...
@@ -40,7 +40,6 @@ public class OrderScoreController {
@GetMapping
(
"/supplier/page"
)
@Operation
(
summary
=
"获得订单评价分页"
)
@PreAuthorize
(
"@ss.hasPermission('order:score:query')"
)
public
CommonResult
<
PageResult
<
OrderScoreSupplierRespVO
>>
supplierPage
(
@Valid
OrderScoreSupplierPageReqVO
pageReqVO
)
{
return
success
(
scoreService
.
supplierPage
(
pageReqVO
));
}
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/customerOrder/AppCustomerOrderController.java
View file @
3f54bac9
...
...
@@ -24,6 +24,7 @@ import io.swagger.v3.oas.annotations.Parameter;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
jakarta.annotation.Resource
;
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.*
;
...
...
@@ -40,6 +41,7 @@ import static cn.iocoder.foodnexus.framework.security.core.util.SecurityFramewor
@RequestMapping
(
"/order/customer-order"
)
@Validated
@AppSystemAuth
(
UserSystemEnum
.
CUSTOMER
)
@Slf4j
public
class
AppCustomerOrderController
{
@Resource
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/customerOrder/AppCustomerOrderReconciliationController.java
View file @
3f54bac9
...
...
@@ -3,6 +3,8 @@ package cn.iocoder.foodnexus.module.order.controller.app.customerOrder;
import
cn.iocoder.foodnexus.framework.common.enums.UserSystemEnum
;
import
cn.iocoder.foodnexus.framework.common.pojo.CommonResult
;
import
cn.iocoder.foodnexus.framework.common.pojo.PageResult
;
import
cn.iocoder.foodnexus.framework.common.util.CommonUtil
;
import
cn.iocoder.foodnexus.module.erp.api.service.ErpCustomerApi
;
import
cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCustomerMonthOrderRespVO
;
import
cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCustomerMonthOrderTotalRespVO
;
import
cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCustomerOrderReconciliationReqVO
;
...
...
@@ -18,7 +20,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Set
;
import
static
cn
.
iocoder
.
foodnexus
.
framework
.
common
.
pojo
.
CommonResult
.
success
;
import
static
cn
.
iocoder
.
foodnexus
.
framework
.
security
.
core
.
util
.
SecurityFrameworkUtils
.
getLoginUser
;
import
static
cn
.
iocoder
.
foodnexus
.
framework
.
security
.
core
.
util
.
SecurityFrameworkUtils
.
getLoginUserId
;
/**
* @author : yanghao
...
...
@@ -35,9 +41,16 @@ public class AppCustomerOrderReconciliationController {
@Autowired
private
CustomerOrderService
customerOrderService
;
@Autowired
private
ErpCustomerApi
customerApi
;
@GetMapping
(
"/page-year"
)
@Operation
(
summary
=
"分页获取月度账单(按年份)"
)
public
CommonResult
<
AppCustomerMonthOrderRespVO
>
pageYear
(
@Valid
AppCustomerYearOrderPageReqVO
reqVO
)
{
reqVO
.
setDeptIds
(
customerApi
.
queryCustomerDeptIdsByUserId
(
getLoginUserId
()));
if
(
CommonUtil
.
isEmpty
(
reqVO
.
getDeptIds
()))
{
return
success
(
null
);
}
return
success
(
customerOrderService
.
reconciliationPageYear
(
reqVO
));
}
...
...
@@ -45,7 +58,8 @@ public class AppCustomerOrderReconciliationController {
@Operation
(
summary
=
"分页获取客户订单(按月份)"
)
@Parameter
(
name
=
"yearMonth"
,
description
=
"年月(yyyy-MM)"
,
required
=
true
)
public
CommonResult
<
AppCustomerMonthOrderTotalRespVO
>
monthTotal
(
@RequestParam
(
"yearMonth"
)
String
yearMonth
)
{
return
success
(
customerOrderService
.
monthTotal
(
yearMonth
));
Set
<
Long
>
deptIds
=
customerApi
.
queryCustomerDeptIdsByUserId
(
getLoginUserId
());
return
success
(
customerOrderService
.
monthTotal
(
yearMonth
,
deptIds
));
}
@PostMapping
(
"/confirm"
)
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/customerOrder/vo/AppCustomerOrderSaveReqVO.java
View file @
3f54bac9
...
...
@@ -2,6 +2,7 @@ package cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo;
import
cn.iocoder.foodnexus.framework.common.validation.InEnum
;
import
cn.iocoder.foodnexus.module.order.enums.DeliveryMode
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
jakarta.validation.Valid
;
import
jakarta.validation.constraints.NotEmpty
;
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/controller/app/customerOrder/vo/AppCustomerYearOrderPageReqVO.java
View file @
3f54bac9
...
...
@@ -7,6 +7,9 @@ import jakarta.validation.constraints.Min;
import
jakarta.validation.constraints.NotNull
;
import
lombok.Data
;
import
java.util.List
;
import
java.util.Set
;
/**
* @author : yanghao
* create at: 2025/10/13 14:16
...
...
@@ -19,6 +22,9 @@ public class AppCustomerYearOrderPageReqVO extends PageParam {
@NotNull
(
message
=
"年份不能为空"
)
private
String
year
;
@Schema
(
description
=
"客户灶点集合"
,
hidden
=
true
)
private
Set
<
Long
>
deptIds
;
/*@Schema(description = "月份(1-12)")
@Max(value = 12, message = "异常月份")
@Min(value = 1, message = "异常月份")
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/dal/mysql/customerorder/CustomerOrderMapper.java
View file @
3f54bac9
...
...
@@ -87,7 +87,7 @@ public interface CustomerOrderMapper extends BaseMapperX<CustomerOrderDO> {
return
this
.
selectMaps
(
queryWrapper
);
}
default
AppCustomerMonthOrderRespVO
reconciliationPageYearTotal
(
String
year
)
{
default
AppCustomerMonthOrderRespVO
reconciliationPageYearTotal
(
String
year
,
Set
<
Long
>
deptIds
)
{
year
=
year
.
trim
();
String
begin
=
year
+
"-01-01 00:00:00"
;
String
end
=
year
+
"-12-31 23:59:59"
;
...
...
@@ -96,6 +96,7 @@ public interface CustomerOrderMapper extends BaseMapperX<CustomerOrderDO> {
queryWrapperX
.
between
(
"create_time"
,
begin
,
end
);
queryWrapperX
.
in
(
"order_status"
,
CommonUtil
.
asList
(
CustomerOrderStatus
.
SIGN_RECEIPT
.
getKey
(),
CustomerOrderStatus
.
FINISH
.
getKey
()));
queryWrapperX
.
in
(
"customer_dept_id"
,
deptIds
);
return
this
.
selectJoinOne
(
AppCustomerMonthOrderRespVO
.
class
,
queryWrapperX
);
}
...
...
@@ -109,6 +110,7 @@ public interface CustomerOrderMapper extends BaseMapperX<CustomerOrderDO> {
queryWrapperX
.
between
(
"create_time"
,
begin
,
end
);
queryWrapperX
.
in
(
"order_status"
,
CommonUtil
.
asList
(
CustomerOrderStatus
.
SIGN_RECEIPT
.
getKey
(),
CustomerOrderStatus
.
FINISH
.
getKey
()));
queryWrapperX
.
in
(
"customer_dept_id"
,
reqVO
.
getDeptIds
());
queryWrapperX
.
groupBy
(
"DATE_FORMAT(create_time, '%Y-%m') "
);
queryWrapperX
.
orderByDesc
(
"id"
);
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/service/checktask/CheckTaskService.java
View file @
3f54bac9
package
cn
.
iocoder
.
foodnexus
.
module
.
order
.
service
.
checktask
;
import
java.util.*
;
import
jakarta.validation.*
;
import
cn.iocoder.foodnexus.module.order.controller.admin.checktask.vo.*
;
import
cn.iocoder.foodnexus.module.order.dal.dataobject.checktask.CheckTaskDO
;
import
cn.iocoder.foodnexus.framework.common.pojo.PageResult
;
import
cn.iocoder.foodnexus.framework.common.pojo.PageParam
;
/**
* 来料质检 Service 接口
...
...
@@ -67,4 +67,5 @@ public interface CheckTaskService {
CheckTaskSupplierScoreRespVO
queryScore
(
Long
id
);
CheckTaskDO
queryScorebyPurchaseOrderId
(
Long
purchaseOrderId
);
}
\ No newline at end of file
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/service/checktask/CheckTaskServiceImpl.java
View file @
3f54bac9
...
...
@@ -267,22 +267,29 @@ public class CheckTaskServiceImpl implements CheckTaskService, CheckTaskApi {
return
result
;
}
@Override
public
CheckTaskDO
queryScorebyPurchaseOrderId
(
Long
purchaseOrderId
)
{
return
checkTaskMapper
.
selectOne
(
Wrappers
.<
CheckTaskDO
>
lambdaQuery
()
.
eq
(
CheckTaskDO:
:
getPurchaseOrderId
,
purchaseOrderId
)
.
orderByDesc
(
CheckTaskDO:
:
getId
)
.
last
(
"LIMIT 1"
));
}
public
void
score
(
CheckTaskDO
checkTaskDO
,
CheckTaskSupplierScoreReqVO
reqVO
)
{
Long
id
=
checkTaskDO
.
getId
();
if
(
CommonUtil
.
isNotEmpty
(
reqVO
.
getItems
()))
{
orderScoreService
.
deleteByOrderId
(
id
);
reqVO
.
getItems
().
forEach
(
item
->
{
if
(!
orderScoreService
.
exists
(
id
,
item
.
getScoreId
()))
{
ScoringWeightDO
scoringWeight
=
scoringWeightService
.
getScoringWeight
(
item
.
getScoreId
());
OrderScoreSaveReqVO
saveReqVO
=
new
OrderScoreSaveReqVO
();
saveReqVO
.
setOrderId
(
id
);
saveReqVO
.
setScoreId
(
item
.
getScoreId
());
saveReqVO
.
setScoreName
(
scoringWeight
.
getScoreName
());
saveReqVO
.
setSupplierId
(
checkTaskDO
.
getSupplierId
());
saveReqVO
.
setCustomerId
(
checkTaskDO
.
getCustomerId
());
saveReqVO
.
setScore
(
item
.
getScore
());
saveReqVO
.
setSort
(
scoringWeight
.
getSort
());
orderScoreService
.
createScore
(
saveReqVO
);
}
ScoringWeightDO
scoringWeight
=
scoringWeightService
.
getScoringWeight
(
item
.
getScoreId
());
OrderScoreSaveReqVO
saveReqVO
=
new
OrderScoreSaveReqVO
();
saveReqVO
.
setOrderId
(
id
);
saveReqVO
.
setScoreId
(
item
.
getScoreId
());
saveReqVO
.
setScoreName
(
scoringWeight
.
getScoreName
());
saveReqVO
.
setSupplierId
(
checkTaskDO
.
getSupplierId
());
saveReqVO
.
setCustomerId
(
checkTaskDO
.
getCustomerId
());
saveReqVO
.
setScore
(
item
.
getScore
());
saveReqVO
.
setSort
(
scoringWeight
.
getSort
());
orderScoreService
.
createScore
(
saveReqVO
);
});
}
}
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/service/customerorder/CustomerOrderService.java
View file @
3f54bac9
...
...
@@ -130,7 +130,7 @@ public interface CustomerOrderService {
* @param yearMonth
* @return
*/
AppCustomerMonthOrderTotalRespVO
monthTotal
(
String
yearMonth
);
AppCustomerMonthOrderTotalRespVO
monthTotal
(
String
yearMonth
,
Set
<
Long
>
deptIds
);
/**
* 对账确认
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/service/customerorder/CustomerOrderServiceImpl.java
View file @
3f54bac9
...
...
@@ -656,7 +656,7 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
*/
@Override
public
AppCustomerMonthOrderRespVO
reconciliationPageYear
(
AppCustomerYearOrderPageReqVO
reqVO
)
{
AppCustomerMonthOrderRespVO
respVO
=
customerOrderMapper
.
reconciliationPageYearTotal
(
reqVO
.
getYear
());
AppCustomerMonthOrderRespVO
respVO
=
customerOrderMapper
.
reconciliationPageYearTotal
(
reqVO
.
getYear
()
,
reqVO
.
getDeptIds
()
);
if
(
CommonUtil
.
isNotEmpty
(
respVO
))
{
respVO
.
setPageResult
(
customerOrderMapper
.
reconciliationPageYearPage
(
reqVO
));
}
...
...
@@ -670,7 +670,7 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
* @return
*/
@Override
public
AppCustomerMonthOrderTotalRespVO
monthTotal
(
String
yearMonth
)
{
public
AppCustomerMonthOrderTotalRespVO
monthTotal
(
String
yearMonth
,
Set
<
Long
>
deptIds
)
{
return
customerOrderMapper
.
reconciliationMonthTotal
(
yearMonth
);
}
...
...
@@ -683,11 +683,12 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
throw
exception
(
CUSTOMER_ORDER_NOT_EXISTS
);
}
if
(
CustomerOrderStatus
.
SIGN_RECEIPT
.
equals
(
customerOrder
.
getOrderStatus
()))
{
this
.
updateOrderStatus
(
id
,
CustomerOrderStatus
.
FINISH
);
// 订单记录
CustomerOrderRecordEvent
event
=
new
CustomerOrderRecordEvent
();
/*
CustomerOrderRecordEvent event = new CustomerOrderRecordEvent();
event.setOrderStatus(CustomerOrderStatus.FINISH);
event.setCustomerOrderId(id);
orderRecordApi
.
recordEvent
(
event
);
orderRecordApi.recordEvent(event);
*/
}
});
}
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/service/shoppingcart/ShoppingCartServiceImpl.java
View file @
3f54bac9
...
...
@@ -20,6 +20,7 @@ import cn.iocoder.foodnexus.module.order.dal.mysql.shoppingcart.ShoppingCartMapp
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
.
security
.
core
.
util
.
SecurityFrameworkUtils
.
getLoginUserId
;
import
static
cn
.
iocoder
.
foodnexus
.
module
.
order
.
enums
.
ErrorCodeConstants
.*;
/**
...
...
@@ -38,6 +39,7 @@ public class ShoppingCartServiceImpl implements ShoppingCartService {
public
Long
createShoppingCart
(
ShoppingCartSaveReqVO
createReqVO
)
{
ShoppingCartDO
cart
=
shoppingCartMapper
.
selectOne
(
Wrappers
.<
ShoppingCartDO
>
lambdaQuery
()
.
eq
(
ShoppingCartDO:
:
getProductId
,
createReqVO
.
getProductId
())
.
eq
(
ShoppingCartDO:
:
getCreator
,
getLoginUserId
())
.
last
(
"LIMIT 1"
));
if
(
CommonUtil
.
isNotEmpty
(
cart
))
{
ShoppingCartDO
updateCart
=
new
ShoppingCartDO
();
...
...
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