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
808d7ee7
Commit
808d7ee7
authored
Oct 30, 2025
by
杨浩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug修复
parent
b481db08
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
84 additions
and
2 deletions
+84
-2
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/purchase/vo/returns/ErpPurchaseReturnPageReqVO.java
+35
-0
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/dal/mysql/purchase/ErpPurchaseReturnMapper.java
+25
-0
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/service/customeraddress/CustomerAddressServiceImpl.java
+24
-2
No files found.
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/controller/admin/purchase/vo/returns/ErpPurchaseReturnPageReqVO.java
View file @
808d7ee7
package
cn
.
iocoder
.
foodnexus
.
module
.
erp
.
controller
.
admin
.
purchase
.
vo
.
returns
;
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
;
import
cn.iocoder.foodnexus.module.erp.enums.SaleOrderPickUpStatus
;
import
cn.iocoder.foodnexus.module.order.enums.DeliveryMode
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
...
...
@@ -8,6 +12,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
;
...
...
@@ -58,4 +63,33 @@ public class ErpPurchaseReturnPageReqVO extends PageParam {
@Schema
(
description
=
"是否可退款"
,
example
=
"true"
)
private
Boolean
refundEnable
;
// 对应 refundStatus = [0, 1]
/**
* 枚举 {@link SaleOrderPickUpStatus}
*/
@Schema
(
description
=
"退货状态"
)
@InEnum
(
SaleOrderPickUpStatus
.
class
)
private
String
returnsStatus
;
@Schema
(
description
=
"客户订单id"
)
private
Long
customerOrderId
;
@Schema
(
description
=
"客户名称"
)
private
String
customerName
;
@Schema
(
description
=
"联系人"
)
private
String
contactUser
;
@Schema
(
description
=
"联系号码"
)
private
String
contactPhone
;
@Schema
(
description
=
"商品名称"
)
private
String
productName
;
@Schema
(
description
=
"创建时间"
)
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
private
LocalDateTime
[]
createTime
;
@Schema
(
description
=
"配送时间"
)
private
LocalDateTime
[]
deliveryTime
;
}
\ No newline at end of file
foodnexus-module-erp/src/main/java/cn/iocoder/foodnexus/module/erp/dal/mysql/purchase/ErpPurchaseReturnMapper.java
View file @
808d7ee7
package
cn
.
iocoder
.
foodnexus
.
module
.
erp
.
dal
.
mysql
.
purchase
;
import
cn.iocoder.foodnexus.framework.common.pojo.PageResult
;
import
cn.iocoder.foodnexus.framework.common.util.CommonUtil
;
import
cn.iocoder.foodnexus.framework.mybatis.core.mapper.BaseMapperX
;
import
cn.iocoder.foodnexus.framework.mybatis.core.query.MPJLambdaWrapperX
;
import
cn.iocoder.foodnexus.module.erp.controller.admin.purchase.vo.returns.ErpPurchaseReturnPageReqVO
;
...
...
@@ -8,6 +9,9 @@ import cn.iocoder.foodnexus.module.erp.dal.dataobject.purchase.ErpPurchaseInDO;
import
cn.iocoder.foodnexus.module.erp.dal.dataobject.purchase.ErpPurchaseReturnDO
;
import
cn.iocoder.foodnexus.module.erp.dal.dataobject.purchase.ErpPurchaseReturnItemDO
;
import
cn.iocoder.foodnexus.module.erp.api.enums.ErpAuditStatus
;
import
cn.iocoder.foodnexus.module.erp.dal.dataobject.sale.ErpCustomerDO
;
import
cn.iocoder.foodnexus.module.erp.dal.dataobject.sale.ErpSaleReturnDO
;
import
cn.iocoder.foodnexus.module.product.dal.dataobject.spu.ProductSpuDO
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
org.apache.ibatis.annotations.Mapper
;
...
...
@@ -32,6 +36,11 @@ public interface ErpPurchaseReturnMapper extends BaseMapperX<ErpPurchaseReturnDO
.
eqIfPresent
(
ErpPurchaseReturnDO:
:
getCreator
,
reqVO
.
getCreator
())
.
eqIfPresent
(
ErpPurchaseReturnDO:
:
getAccountId
,
reqVO
.
getAccountId
())
.
likeIfPresent
(
ErpPurchaseReturnDO:
:
getOrderNo
,
reqVO
.
getOrderNo
())
.
eqIfPresent
(
ErpPurchaseReturnDO:
:
getReturnsStatus
,
reqVO
.
getReturnsStatus
())
.
eqIfPresent
(
ErpPurchaseReturnDO:
:
getCustomerOrderId
,
reqVO
.
getCustomerOrderId
())
.
likeIfPresent
(
ErpPurchaseReturnDO:
:
getAddressInfo
,
reqVO
.
getContactUser
())
.
likeIfPresent
(
ErpPurchaseReturnDO:
:
getAddressInfo
,
reqVO
.
getContactPhone
())
.
betweenIfPresent
(
ErpPurchaseReturnDO:
:
getCreateTime
,
reqVO
.
getCreateTime
())
.
orderByDesc
(
ErpPurchaseReturnDO:
:
getId
);
// 退款状态。为什么需要 t. 的原因,是因为联表查询时,需要指定表名,不然会报字段不存在的错误
if
(
Objects
.
equals
(
reqVO
.
getRefundStatus
(),
ErpPurchaseReturnPageReqVO
.
REFUND_STATUS_NONE
))
{
...
...
@@ -51,6 +60,22 @@ public interface ErpPurchaseReturnMapper extends BaseMapperX<ErpPurchaseReturnDO
.
eq
(
reqVO
.
getProductId
()
!=
null
,
ErpPurchaseReturnItemDO:
:
getProductId
,
reqVO
.
getProductId
())
.
groupBy
(
ErpPurchaseReturnDO:
:
getId
);
// 避免 1 对多查询,产生相同的 1
}
if
(
CommonUtil
.
isNotBlank
(
reqVO
.
getCustomerName
()))
{
query
.
leftJoin
(
ErpCustomerDO
.
class
,
ErpCustomerDO:
:
getId
,
ErpPurchaseReturnDO:
:
getCustomerId
);
query
.
eq
(
ErpCustomerDO:
:
getName
,
reqVO
.
getCustomerName
());
query
.
groupBy
(
ErpPurchaseReturnDO:
:
getId
);
}
if
(
CommonUtil
.
isNotBlank
(
reqVO
.
getProductName
()))
{
query
.
leftJoin
(
ErpPurchaseReturnItemDO
.
class
,
ErpPurchaseReturnItemDO:
:
getReturnId
,
ErpPurchaseReturnDO:
:
getId
)
.
leftJoin
(
ProductSpuDO
.
class
,
ProductSpuDO:
:
getId
,
ErpPurchaseReturnItemDO:
:
getProductId
)
.
like
(
ProductSpuDO:
:
getName
,
reqVO
.
getProductName
());
query
.
groupBy
(
ErpPurchaseReturnDO:
:
getId
);
}
if
(
CommonUtil
.
isNotEmpty
(
reqVO
.
getDeliveryTime
()))
{
query
.
leftJoin
(
ErpSaleReturnDO
.
class
,
ErpSaleReturnDO:
:
getId
,
ErpPurchaseReturnDO:
:
getSaleOrderId
);
query
.
betweenIfPresent
(
ErpSaleReturnDO:
:
getDeliveryTime
,
reqVO
.
getDeliveryTime
());
query
.
groupBy
(
ErpPurchaseReturnDO:
:
getId
);
}
return
selectJoinPage
(
reqVO
,
ErpPurchaseReturnDO
.
class
,
query
);
}
...
...
foodnexus-module-mall/foodnexus-module-order/src/main/java/cn/iocoder/foodnexus/module/order/service/customeraddress/CustomerAddressServiceImpl.java
View file @
808d7ee7
package
cn
.
iocoder
.
foodnexus
.
module
.
order
.
service
.
customeraddress
;
import
cn.iocoder.foodnexus.framework.common.util.CommonUtil
;
import
cn.iocoder.foodnexus.module.order.controller.app.customeraddress.vo.CustomerAddressPageReqVO
;
import
cn.iocoder.foodnexus.module.order.controller.app.customeraddress.vo.CustomerAddressSaveReqVO
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
org.springframework.security.core.parameters.P
;
import
org.springframework.stereotype.Service
;
import
jakarta.annotation.Resource
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.validation.annotation.Validated
;
import
java.util.*
;
...
...
@@ -85,18 +87,38 @@ public class CustomerAddressServiceImpl implements CustomerAddressService {
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
deleteCustomerAddress
(
Long
id
)
{
// 校验存在
validateCustomerAddressExists
(
id
);
CustomerAddressDO
customerAddressDO
=
validateCustomerAddressExists
(
id
);
Boolean
isDefault
=
customerAddressDO
.
getIsDefault
();
// 删除
customerAddressMapper
.
deleteById
(
id
);
deleteSetDefault
(
isDefault
,
CommonUtil
.
asList
(
id
));
}
@Override
public
void
deleteCustomerAddressListByIds
(
List
<
Long
>
ids
)
{
public
void
deleteCustomerAddressListByIds
(
List
<
Long
>
ids
)
{
List
<
CustomerAddressDO
>
customerAddressDOS
=
customerAddressMapper
.
selectByIds
(
ids
);
boolean
isDefault
=
customerAddressDOS
.
stream
().
anyMatch
(
CustomerAddressDO:
:
getIsDefault
);
// 删除
customerAddressMapper
.
deleteByIds
(
ids
);
deleteSetDefault
(
isDefault
,
ids
);
}
private
void
deleteSetDefault
(
boolean
isDefault
,
List
<
Long
>
ids
)
{
if
(
isDefault
)
{
Long
loginUserId
=
getLoginUserId
();
CustomerAddressDO
newAddress
=
customerAddressMapper
.
selectOne
(
Wrappers
.<
CustomerAddressDO
>
lambdaQuery
()
.
eq
(
CustomerAddressDO:
:
getCreator
,
loginUserId
)
.
notIn
(
CustomerAddressDO:
:
getId
,
ids
)
.
orderByDesc
(
CustomerAddressDO:
:
getId
)
.
last
(
"LIMIT 1"
));
if
(
CommonUtil
.
isNotEmpty
(
newAddress
))
{
this
.
updateAddressDefault
(
newAddress
.
getId
(),
loginUserId
);
}
}
}
private
CustomerAddressDO
validateCustomerAddressExists
(
Long
id
)
{
...
...
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