Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
4d298b15
Commit
4d298b15
authored
May 09, 2024
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
查询图录加上title
parent
e8e0e590
Changes
12
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
591 additions
and
48 deletions
+591
-48
ch-admin-api/src/main/java/com/wwdz/ch/admin/controller/IdentifyOrderController.java
...com/wwdz/ch/admin/controller/IdentifyOrderController.java
+79
-4
ch-admin-api/src/main/java/com/wwdz/ch/admin/impl/ImageCatelogDetailServiceImpl.java
...com/wwdz/ch/admin/impl/ImageCatelogDetailServiceImpl.java
+12
-1
ch-admin-api/src/main/java/com/wwdz/ch/admin/impl/SysIdentifyOrderServiceImpl.java
...a/com/wwdz/ch/admin/impl/SysIdentifyOrderServiceImpl.java
+126
-7
ch-admin-api/src/main/java/com/wwdz/ch/admin/service/SysIdentifyOrderService.java
...va/com/wwdz/ch/admin/service/SysIdentifyOrderService.java
+15
-0
ch-core/src/main/java/com/wwdz/ch/core/consts/CommConsts.java
...ore/src/main/java/com/wwdz/ch/core/consts/CommConsts.java
+1
-1
ch-core/src/main/java/com/wwdz/ch/core/consts/DistributionEnum.java
...c/main/java/com/wwdz/ch/core/consts/DistributionEnum.java
+5
-4
ch-dao/src/main/java/com/wwdz/ch/db/domain/distribution/IdentifyOrder.java
...ava/com/wwdz/ch/db/domain/distribution/IdentifyOrder.java
+21
-4
ch-dao/src/main/java/com/wwdz/ch/db/domain/distribution/IdentifyOrderExample.java
.../wwdz/ch/db/domain/distribution/IdentifyOrderExample.java
+264
-0
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/distribution/IdentifyOrderRequestDto.java
.../db/dto/request/distribution/IdentifyOrderRequestDto.java
+10
-0
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/distribution/IdentifyOrderMapper.xml
...om/wwdz/ch/db/mapper/distribution/IdentifyOrderMapper.xml
+54
-22
ch-wx-api/src/main/java/com/wwdz/ch/wx/api/WxPayCallbackController.java
...main/java/com/wwdz/ch/wx/api/WxPayCallbackController.java
+3
-2
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/DistributionOrderServiceImpl.java
...ch/wx/impl/distribution/DistributionOrderServiceImpl.java
+1
-3
No files found.
ch-admin-api/src/main/java/com/wwdz/ch/admin/controller/IdentifyOrderController.java
View file @
4d298b15
...
...
@@ -3,7 +3,9 @@ package com.wwdz.ch.admin.controller;
import
com.alibaba.fastjson.JSON
;
import
com.wwdz.ch.admin.service.SysIdentifyOrderService
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.db.dto.request.ConsignSaleRequestDto
;
import
com.wwdz.ch.db.dto.request.distribution.IdentifyOrderRequestDto
;
import
com.xxdxxs.service.FormHandler
;
import
com.xxdxxs.validation.Validator
;
import
io.swagger.annotations.ApiOperation
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -22,10 +24,83 @@ public class IdentifyOrderController {
@Autowired
SysIdentifyOrderService
sysIdentifyOrderService
;
@ApiOperation
(
value
=
"查询寄售单"
)
@ApiOperation
(
value
=
"查询鉴定单"
)
@PostMapping
(
"/findList"
)
public
Result
findList
(
@RequestBody
ConsignSaleRequestDto
dto
)
{
return
null
;
public
Result
findList
(
@RequestBody
IdentifyOrderRequestDto
dto
)
{
logger
.
info
(
"审核鉴定单,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
Validator
validator
=
new
Validator
(
FormHandler
.
ofEntity
(
dto
));
validator
.
set
(
"distributionOrderId"
,
"分销订单号"
).
must
().
string
()
.
set
(
"identifyOrderId"
,
"鉴定单号"
).
must
().
string
()
.
set
(
"approved"
,
"审核结果"
).
must
().
number
()
.
end
();
if
(!
validator
.
isValid
())
{
return
Result
.
failed
(
validator
.
getErrorInfo
());
}
return
sysIdentifyOrderService
.
identify
(
dto
);
}
@ApiOperation
(
value
=
"审核鉴定单"
)
@PostMapping
(
"/identify"
)
public
Result
identify
(
@RequestBody
IdentifyOrderRequestDto
dto
)
{
logger
.
info
(
"审核鉴定单,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
Validator
validator
=
new
Validator
(
FormHandler
.
ofEntity
(
dto
));
validator
.
set
(
"distributionOrderId"
,
"分销订单号"
).
must
().
string
()
.
set
(
"identifyOrderId"
,
"鉴定单号"
).
must
().
string
()
.
set
(
"approved"
,
"审核结果"
).
must
().
number
()
.
end
();
if
(!
validator
.
isValid
())
{
return
Result
.
failed
(
validator
.
getErrorInfo
());
}
return
sysIdentifyOrderService
.
identify
(
dto
);
}
@ApiOperation
(
value
=
"鉴定单审核后发出"
)
@PostMapping
(
"/delivery"
)
public
Result
delivery
(
@RequestBody
IdentifyOrderRequestDto
dto
)
{
logger
.
info
(
"鉴定单审核后发出,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
Validator
validator
=
new
Validator
(
FormHandler
.
ofEntity
(
dto
));
validator
.
set
(
"distributionOrderId"
,
"分销订单号"
).
must
().
string
()
.
set
(
"identifyOrderId"
,
"鉴定单号"
).
must
().
string
()
.
set
(
"outLogisticsCode"
,
"物流公司编码"
).
must
().
string
()
.
set
(
"outWaybill"
,
"物流单号"
).
must
().
string
()
.
end
();
if
(!
validator
.
isValid
())
{
return
Result
.
failed
(
validator
.
getErrorInfo
());
}
return
sysIdentifyOrderService
.
delivery
(
dto
);
}
@ApiOperation
(
value
=
"鉴定单审核不通过后退回寄出"
)
@PostMapping
(
"/sendBack"
)
public
Result
sendBack
(
@RequestBody
IdentifyOrderRequestDto
dto
)
{
logger
.
info
(
"鉴定单审核不通过后退回寄出,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
Validator
validator
=
new
Validator
(
FormHandler
.
ofEntity
(
dto
));
validator
.
set
(
"distributionOrderId"
,
"分销订单号"
).
must
().
string
()
.
set
(
"identifyOrderId"
,
"鉴定单号"
).
must
().
string
()
.
set
(
"outLogisticsCode"
,
"物流公司编码"
).
must
().
string
()
.
set
(
"outWaybill"
,
"物流单号"
).
must
().
string
()
.
end
();
if
(!
validator
.
isValid
())
{
return
Result
.
failed
(
validator
.
getErrorInfo
());
}
return
sysIdentifyOrderService
.
sendBack
(
dto
);
}
@ApiOperation
(
value
=
"平台确认收货"
)
@PostMapping
(
"signed"
)
public
Result
signed
(
@RequestBody
IdentifyOrderRequestDto
dto
)
{
logger
.
info
(
"平台确认收货,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
Validator
validator
=
new
Validator
(
FormHandler
.
ofEntity
(
dto
));
validator
.
set
(
"identifyOrderId"
,
"鉴定单号"
).
must
().
string
()
.
end
();
if
(!
validator
.
isValid
())
{
return
Result
.
failed
(
validator
.
getErrorInfo
());
}
return
sysIdentifyOrderService
.
signed
(
dto
);
}
}
ch-admin-api/src/main/java/com/wwdz/ch/admin/impl/ImageCatelogDetailServiceImpl.java
View file @
4d298b15
...
...
@@ -4,6 +4,7 @@ import com.github.pagehelper.PageInfo;
import
com.wwdz.ch.admin.service.ImageCatelogDetailService
;
import
com.wwdz.ch.core.type.PageSearchResult
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.db.dao.distribution.ImageCatelogDao
;
import
com.wwdz.ch.db.dao.distribution.ImageCatelogDetailDao
;
import
com.wwdz.ch.db.domain.distribution.ImageCatelog
;
import
com.wwdz.ch.db.domain.distribution.ImageCatelogDetail
;
...
...
@@ -13,7 +14,9 @@ import org.slf4j.LoggerFactory;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Service
public
class
ImageCatelogDetailServiceImpl
implements
ImageCatelogDetailService
{
...
...
@@ -23,12 +26,20 @@ public class ImageCatelogDetailServiceImpl implements ImageCatelogDetailService
@Autowired
ImageCatelogDetailDao
imageCatelogDetailDao
;
@Autowired
ImageCatelogDao
imageCatelogDao
;
@Override
public
Result
findDetailList
(
ImageCatelogRequestDto
dto
)
{
try
{
dto
.
setOrder
(
" asc"
);
List
<
ImageCatelogDetail
>
list
=
imageCatelogDetailDao
.
findList
(
dto
);
return
Result
.
success
(
list
);
ImageCatelog
imageCatelog
=
imageCatelogDao
.
findById
(
dto
.
getId
());
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"title"
,
imageCatelog
.
getTitle
());
map
.
put
(
"name"
,
imageCatelog
.
getName
());
map
.
put
(
"data"
,
list
);
return
Result
.
success
(
map
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"查询图录内容 error:{}"
,
e
);
}
...
...
ch-admin-api/src/main/java/com/wwdz/ch/admin/impl/SysIdentifyOrderServiceImpl.java
View file @
4d298b15
package
com.wwdz.ch.admin.impl
;
import
com.wechat.pay.java.service.refund.model.Refund
;
import
com.wechat.pay.java.service.refund.model.Status
;
import
com.wwdz.ch.admin.service.SysIdentifyOrderService
;
import
com.wwdz.ch.core.api.wxpay.WxPayServiceApi
;
import
com.wwdz.ch.core.consts.CommConsts
;
import
com.wwdz.ch.core.consts.DistributionEnum
;
import
com.wwdz.ch.core.consts.RefundOrderEnum
;
import
com.wwdz.ch.core.entity.DeliveryNoticeMsg
;
import
com.wwdz.ch.core.entity.wxPay.DistributionOrderRefundRequestDto
;
import
com.wwdz.ch.core.service.SendMsgService
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.db.dao.distribution.DistributionOrderDao
;
import
com.wwdz.ch.db.dao.distribution.DistributorProfitDao
;
import
com.wwdz.ch.db.dao.distribution.IdentifyOrderDao
;
import
com.wwdz.ch.db.dao.distribution.SupplierItemDao
;
import
com.wwdz.ch.core.util.IdUtils
;
import
com.wwdz.ch.core.util.RedisUtils
;
import
com.wwdz.ch.db.dao.distribution.*
;
import
com.wwdz.ch.db.domain.distribution.DistributionOrder
;
import
com.wwdz.ch.db.domain.distribution.IdentifyOrder
;
import
com.wwdz.ch.db.domain.distribution.RefundOrder
;
import
com.wwdz.ch.db.domain.distribution.SupplierItem
;
import
com.wwdz.ch.db.dto.request.distribution.DistributionOrderRequestDto
;
import
com.wwdz.ch.db.dto.request.distribution.IdentifyOrderRequestDto
;
import
com.wwdz.ch.wx.service.distribution.DistributionOrderService
;
import
org.redisson.api.RLock
;
import
org.redisson.api.RedissonClient
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -21,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
java.util.Date
;
import
java.util.concurrent.TimeUnit
;
@Service
public
class
SysIdentifyOrderServiceImpl
implements
SysIdentifyOrderService
{
...
...
@@ -42,6 +53,15 @@ public class SysIdentifyOrderServiceImpl implements SysIdentifyOrderService {
@Autowired
SendMsgService
sendMsgService
;
@Autowired
WxPayServiceApi
wxPayServiceApi
;
@Autowired
RefundOrderDao
refundOrderDao
;
@Autowired
RedissonClient
redissonClient
;
@Override
@Transactional
public
Result
identify
(
IdentifyOrderRequestDto
dto
)
{
...
...
@@ -56,9 +76,13 @@ public class SysIdentifyOrderServiceImpl implements SysIdentifyOrderService {
identifyOrder
.
setState
(
DistributionEnum
.
IdentifyOrderStateEnum
.
CHANNEL_WAIT_RETURN
.
getCode
());
identifyOrder
.
setRemark
(
dto
.
getRemark
());
//藏馆订单状态修改为已取消
//藏馆订单取消并退款
DistributionOrderRequestDto
distributionOrderRequestDto
=
new
DistributionOrderRequestDto
();
distributionOrderRequestDto
.
setDistributionOrderId
(
dto
.
getDistributionOrderId
());
refund
(
distributionOrderRequestDto
);
/*
distributionOrderDao.updateState(dto.getDistributionOrderId(), DistributionEnum.DistributionOrderStateEnum.CANCEL.getCode());
distributorProfitDao
.
updateValidState
(
dto
.
getDistributionOrderId
(),
false
);
distributorProfitDao.updateValidState(dto.getDistributionOrderId(), false);
*/
}
identifyOrder
.
setUpdateTime
(
new
Date
());
identifyOrderDao
.
update
(
identifyOrder
);
...
...
@@ -86,6 +110,13 @@ public class SysIdentifyOrderServiceImpl implements SysIdentifyOrderService {
orderUpdateDto
.
setDeliveryTime
(
now
);
orderUpdateDto
.
setState
(
DistributionEnum
.
DistributionOrderStateEnum
.
PRE_SIGNED
.
getCode
());
distributionOrderDao
.
update
(
orderUpdateDto
);
//修改鉴定单状态
IdentifyOrder
identifyOrder
=
new
IdentifyOrder
();
identifyOrder
.
setIdentifyOrderId
(
dto
.
getIdentifyOrderId
());
identifyOrder
.
setState
(
DistributionEnum
.
IdentifyOrderStateEnum
.
CHANNEL_SENDED
.
getCode
());
identifyOrder
.
setOutLogisticsCode
(
dto
.
getOutLogisticsCode
());
identifyOrder
.
setOutWaybill
(
dto
.
getOutWaybill
());
identifyOrderDao
.
update
(
identifyOrder
);
//发货成功,发送模板信息通知买家
try
{
DeliveryNoticeMsg
deliveryNoticeMsg
=
new
DeliveryNoticeMsg
();
...
...
@@ -115,7 +146,95 @@ public class SysIdentifyOrderServiceImpl implements SysIdentifyOrderService {
}
@Override
@Transactional
public
Result
sendBack
(
IdentifyOrderRequestDto
dto
)
{
return
null
;
try
{
//修改鉴定单状态
IdentifyOrder
identifyOrder
=
new
IdentifyOrder
();
identifyOrder
.
setIdentifyOrderId
(
dto
.
getIdentifyOrderId
());
identifyOrder
.
setState
(
DistributionEnum
.
IdentifyOrderStateEnum
.
CHANNEL_SENDED
.
getCode
());
identifyOrder
.
setOutLogisticsCode
(
dto
.
getOutLogisticsCode
());
identifyOrder
.
setOutWaybill
(
dto
.
getOutWaybill
());
identifyOrderDao
.
update
(
identifyOrder
);
return
Result
.
success
();
}
catch
(
Exception
e
)
{
logger
.
info
(
"审核不通过退回商品失败 error: {}"
,
e
);
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
}
return
Result
.
failed
();
}
@Override
public
Result
signed
(
IdentifyOrderRequestDto
dto
)
{
try
{
//修改鉴定单状态
identifyOrderDao
.
updateState
(
dto
.
getIdentifyOrderId
(),
DistributionEnum
.
IdentifyOrderStateEnum
.
CHANNEL_IDENTIFYING
.
getCode
());
return
Result
.
success
();
}
catch
(
Exception
e
)
{
logger
.
info
(
"平台确认收货失败 error: {}"
,
e
);
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
}
return
Result
.
failed
();
}
@Override
public
Result
refund
(
DistributionOrderRequestDto
dto
)
throws
InterruptedException
{
RLock
lock
=
null
;
try
{
String
refundId
=
IdUtils
.
getOrderNumber
(
CommConsts
.
REFUND_ORDER_PREFIX
);
//判断订单状态
String
distributionOrderId
=
dto
.
getDistributionOrderId
();
DistributionOrder
distributionOrder
=
distributionOrderDao
.
findById
(
distributionOrderId
);
DistributionOrderRefundRequestDto
refundRequestDto
=
new
DistributionOrderRefundRequestDto
();
refundRequestDto
.
setDistributionOrderId
(
distributionOrderId
);
refundRequestDto
.
setRefundPrice
(
distributionOrder
.
getAmount
());
refundRequestDto
.
setAmount
(
distributionOrder
.
getAmount
());
refundRequestDto
.
setRefundId
(
refundId
);
Result
result
=
wxPayServiceApi
.
orderRefund
(
refundRequestDto
);
if
(!
result
.
getSuccess
())
{
throw
new
InterruptedException
(
"调用微信支付退款接口错误"
);
}
Refund
refundResponse
=
(
Refund
)
result
.
getData
();
if
(
refundResponse
.
getStatus
().
equals
(
Status
.
SUCCESS
)
||
refundResponse
.
getStatus
().
equals
(
Status
.
PROCESSING
))
{
Date
now
=
new
Date
();
//创建退款单
RefundOrder
refundOrder
=
new
RefundOrder
();
refundOrder
.
setRefundId
(
refundId
);
refundOrder
.
setRefundAmount
(
distributionOrder
.
getAmount
());
refundOrder
.
setAmount
(
distributionOrder
.
getAmount
());
refundOrder
.
setDistributionOrderId
(
distributionOrderId
);
refundOrder
.
setDistributorId
(
distributionOrder
.
getSellerId
());
refundOrder
.
setCreateTime
(
now
);
refundOrder
.
setUpdateTime
(
now
);
refundOrder
.
setState
(
RefundOrderEnum
.
StateEnum
.
PROCESSING
.
getCode
());
refundOrderDao
.
insert
(
refundOrder
);
//退款受理成功,订单的状态改为退款受理中
distributionOrderDao
.
updateState
(
distributionOrderId
,
DistributionEnum
.
DistributionOrderStateEnum
.
REFUNDING
.
getCode
());
//恢复商品库存
long
itemId
=
distributionOrder
.
getItemId
();
String
itemIdKey
=
String
.
valueOf
(
itemId
);
lock
=
redissonClient
.
getLock
(
itemIdKey
);
if
(
lock
.
tryLock
(
5
,
5
,
TimeUnit
.
SECONDS
))
{
SupplierItem
supplierItem
=
supplierItemDao
.
findById
(
itemId
);
int
updateStock
=
supplierItem
.
getStock
().
intValue
()
+
distributionOrder
.
getItemNum
().
intValue
();
supplierItemDao
.
updateStock
(
itemId
,
updateStock
);
}
else
{
logger
.
error
(
">>>>>>>>> 未能获取到锁,退款后恢复库存失败 <<<<<<<<<<"
);
return
Result
.
failed
(
"退款后恢复库存失败"
);
}
logger
.
info
(
">>>>>>>> 藏馆单号:{}, 退款单号:{}, 退款申请成功,创建退款单 <<<<<<<<<"
,
distributionOrderId
,
refundId
);
return
Result
.
success
(
refundId
);
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"退款申请失败 error : {}"
,
e
);
throw
e
;
}
finally
{
if
(
lock
!=
null
&&
lock
.
isHeldByCurrentThread
())
{
lock
.
unlock
();
}
}
return
Result
.
failed
();
}
}
ch-admin-api/src/main/java/com/wwdz/ch/admin/service/SysIdentifyOrderService.java
View file @
4d298b15
package
com.wwdz.ch.admin.service
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.db.dto.request.distribution.DistributionOrderRequestDto
;
import
com.wwdz.ch.db.dto.request.distribution.IdentifyOrderRequestDto
;
public
interface
SysIdentifyOrderService
{
...
...
@@ -26,4 +27,18 @@ public interface SysIdentifyOrderService {
* @return
*/
Result
sendBack
(
IdentifyOrderRequestDto
dto
);
/**
* 平台确认收货
* @param dto
* @return
*/
Result
signed
(
IdentifyOrderRequestDto
dto
);
/**
* 订单取消并退款
* @param dto
* @return
*/
Result
refund
(
DistributionOrderRequestDto
dto
)
throws
InterruptedException
;
}
ch-core/src/main/java/com/wwdz/ch/core/consts/CommConsts.java
View file @
4d298b15
...
...
@@ -56,5 +56,5 @@ public interface CommConsts {
public
static
final
String
DEFAULT_BACKGROUND_URL
=
"https://cdn.wanwudezhi.com/static/web-static/image/1c679aa4e27789e491c070d52577efb1_1125x480.png"
;
public
final
static
String
REFUND_ORDER_PREFIX
=
"RF"
;
}
ch-core/src/main/java/com/wwdz/ch/core/consts/DistributionEnum.java
View file @
4d298b15
...
...
@@ -271,12 +271,13 @@ public class DistributionEnum {
* 鉴定单状态
*/
public
enum
IdentifyOrderStateEnum
{
CHANNEL_WAIT_RECEIVE
(
12
,
"
平台待
收货"
),
CHANNEL_WAIT_RECEIVE
(
12
,
"
待平台
收货"
),
CHANNEL_IDENTIFYING
(
13
,
"平台鉴定中"
),
CHANNEL_WAIT_SEND
(
14
,
"
平台待
发货"
),
CHANNEL_WAIT_RETURN
(
15
,
"
平台待
退回"
),
CHANNEL_WAIT_SEND
(
14
,
"
待平台
发货"
),
CHANNEL_WAIT_RETURN
(
15
,
"
待平台
退回"
),
CHANNEL_SENDED
(
16
,
"平台已发货"
),
CHANNEL_RETURNED
(
17
,
"平台已退回"
),
CHANNEL_RETURNED
(
17
,
"退回待收货"
),
RETURN_SIGNED
(
18
,
"退回已收货"
),
;
private
int
code
;
...
...
ch-dao/src/main/java/com/wwdz/ch/db/domain/distribution/IdentifyOrder.java
View file @
4d298b15
package
com.wwdz.ch.db.domain.distribution
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
com.xxdxxs.entity.Entity
;
import
lombok.Data
;
/**
* @author shiyu
* @date 2024/05/0
8
* @date 2024/05/0
9
*/
@Data
public
class
IdentifyOrder
implements
Entity
{
private
Integer
id
;
/**
...
...
@@ -25,11 +26,21 @@ public class IdentifyOrder implements Entity {
*/
private
String
identifyOrderId
;
/**
* 卖方id
*/
private
Long
sellerId
;
/**
* 商品id
*/
private
Long
itemId
;
/**
* 商品数量
*/
private
Integer
itemNum
;
/**
* 寄来的快递公司编码
*/
...
...
@@ -47,8 +58,6 @@ public class IdentifyOrder implements Entity {
/**
* 审核结果
* 0不通过
* 1通过
*/
private
Integer
approved
;
...
...
@@ -103,7 +112,9 @@ public class IdentifyOrder implements Entity {
sb
.
append
(
", id="
).
append
(
id
);
sb
.
append
(
", distributionOrderId="
).
append
(
distributionOrderId
);
sb
.
append
(
", identifyOrderId="
).
append
(
identifyOrderId
);
sb
.
append
(
", sellerId="
).
append
(
sellerId
);
sb
.
append
(
", itemId="
).
append
(
itemId
);
sb
.
append
(
", itemNum="
).
append
(
itemNum
);
sb
.
append
(
", fromLogisticsCode="
).
append
(
fromLogisticsCode
);
sb
.
append
(
", fromWaybill="
).
append
(
fromWaybill
);
sb
.
append
(
", state="
).
append
(
state
);
...
...
@@ -136,7 +147,9 @@ public class IdentifyOrder implements Entity {
return
(
this
.
getId
()
==
null
?
other
.
getId
()
==
null
:
this
.
getId
().
equals
(
other
.
getId
()))
&&
(
this
.
getDistributionOrderId
()
==
null
?
other
.
getDistributionOrderId
()
==
null
:
this
.
getDistributionOrderId
().
equals
(
other
.
getDistributionOrderId
()))
&&
(
this
.
getIdentifyOrderId
()
==
null
?
other
.
getIdentifyOrderId
()
==
null
:
this
.
getIdentifyOrderId
().
equals
(
other
.
getIdentifyOrderId
()))
&&
(
this
.
getSellerId
()
==
null
?
other
.
getSellerId
()
==
null
:
this
.
getSellerId
().
equals
(
other
.
getSellerId
()))
&&
(
this
.
getItemId
()
==
null
?
other
.
getItemId
()
==
null
:
this
.
getItemId
().
equals
(
other
.
getItemId
()))
&&
(
this
.
getItemNum
()
==
null
?
other
.
getItemNum
()
==
null
:
this
.
getItemNum
().
equals
(
other
.
getItemNum
()))
&&
(
this
.
getFromLogisticsCode
()
==
null
?
other
.
getFromLogisticsCode
()
==
null
:
this
.
getFromLogisticsCode
().
equals
(
other
.
getFromLogisticsCode
()))
&&
(
this
.
getFromWaybill
()
==
null
?
other
.
getFromWaybill
()
==
null
:
this
.
getFromWaybill
().
equals
(
other
.
getFromWaybill
()))
&&
(
this
.
getState
()
==
null
?
other
.
getState
()
==
null
:
this
.
getState
().
equals
(
other
.
getState
()))
...
...
@@ -158,7 +171,9 @@ public class IdentifyOrder implements Entity {
result
=
prime
*
result
+
((
getId
()
==
null
)
?
0
:
getId
().
hashCode
());
result
=
prime
*
result
+
((
getDistributionOrderId
()
==
null
)
?
0
:
getDistributionOrderId
().
hashCode
());
result
=
prime
*
result
+
((
getIdentifyOrderId
()
==
null
)
?
0
:
getIdentifyOrderId
().
hashCode
());
result
=
prime
*
result
+
((
getSellerId
()
==
null
)
?
0
:
getSellerId
().
hashCode
());
result
=
prime
*
result
+
((
getItemId
()
==
null
)
?
0
:
getItemId
().
hashCode
());
result
=
prime
*
result
+
((
getItemNum
()
==
null
)
?
0
:
getItemNum
().
hashCode
());
result
=
prime
*
result
+
((
getFromLogisticsCode
()
==
null
)
?
0
:
getFromLogisticsCode
().
hashCode
());
result
=
prime
*
result
+
((
getFromWaybill
()
==
null
)
?
0
:
getFromWaybill
().
hashCode
());
result
=
prime
*
result
+
((
getState
()
==
null
)
?
0
:
getState
().
hashCode
());
...
...
@@ -185,7 +200,9 @@ public class IdentifyOrder implements Entity {
id
(
"id"
,
"id"
,
"INTEGER"
,
false
),
distributionOrderId
(
"distribution_order_id"
,
"distributionOrderId"
,
"VARCHAR"
,
false
),
identifyOrderId
(
"identify_order_id"
,
"identifyOrderId"
,
"VARCHAR"
,
false
),
sellerId
(
"seller_id"
,
"sellerId"
,
"BIGINT"
,
false
),
itemId
(
"item_id"
,
"itemId"
,
"BIGINT"
,
false
),
itemNum
(
"item_num"
,
"itemNum"
,
"INTEGER"
,
false
),
fromLogisticsCode
(
"from_logistics_code"
,
"fromLogisticsCode"
,
"VARCHAR"
,
false
),
fromWaybill
(
"from_waybill"
,
"fromWaybill"
,
"VARCHAR"
,
false
),
state
(
"state"
,
"state"
,
"INTEGER"
,
true
),
...
...
ch-dao/src/main/java/com/wwdz/ch/db/domain/distribution/IdentifyOrderExample.java
View file @
4d298b15
This diff is collapsed.
Click to expand it.
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/distribution/IdentifyOrderRequestDto.java
View file @
4d298b15
...
...
@@ -21,11 +21,21 @@ public class IdentifyOrderRequestDto extends BaseRequestDto implements Entity {
*/
private
String
identifyOrderId
;
/**
* 卖方id
*/
private
Long
sellerId
;
/**
* 商品id
*/
private
Long
itemId
;
/**
* 商品数量
*/
private
Integer
itemNum
;
/**
* 寄来的快递公司编码
*/
...
...
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/distribution/IdentifyOrderMapper.xml
View file @
4d298b15
...
...
@@ -5,7 +5,9 @@
<id
column=
"id"
jdbcType=
"INTEGER"
property=
"id"
/>
<result
column=
"distribution_order_id"
jdbcType=
"VARCHAR"
property=
"distributionOrderId"
/>
<result
column=
"identify_order_id"
jdbcType=
"VARCHAR"
property=
"identifyOrderId"
/>
<result
column=
"seller_id"
jdbcType=
"BIGINT"
property=
"sellerId"
/>
<result
column=
"item_id"
jdbcType=
"BIGINT"
property=
"itemId"
/>
<result
column=
"item_num"
jdbcType=
"INTEGER"
property=
"itemNum"
/>
<result
column=
"from_logistics_code"
jdbcType=
"VARCHAR"
property=
"fromLogisticsCode"
/>
<result
column=
"from_waybill"
jdbcType=
"VARCHAR"
property=
"fromWaybill"
/>
<result
column=
"state"
jdbcType=
"INTEGER"
property=
"state"
/>
...
...
@@ -78,9 +80,9 @@
</where>
</sql>
<sql
id=
"Base_Column_List"
>
id, distribution_order_id, identify_order_id,
item_id, from_logistics_code, from_waybill
,
`state`, approved, remark, out_logistics_code, out_waybill, return_name, return_phon
e,
return_address, create_time, update_time
id, distribution_order_id, identify_order_id,
seller_id, item_id, item_num, from_logistics_code
,
from_waybill, `state`, approved, remark, out_logistics_code, out_waybill, return_nam
e,
return_
phone, return_
address, create_time, update_time
</sql>
<select
id=
"selectByExample"
parameterType=
"com.wwdz.ch.db.domain.distribution.IdentifyOrderExample"
resultMap=
"BaseResultMap"
>
select
...
...
@@ -115,9 +117,9 @@
</foreach>
</when>
<otherwise>
id, distribution_order_id, identify_order_id,
item_id, from_logistics_code, from_waybill
,
`state`, approved, remark, out_logistics_code, out_waybill, return_name, return_phon
e,
return_address, create_time, update_time
id, distribution_order_id, identify_order_id,
seller_id, item_id, item_num, from_logistics_code
,
from_waybill, `state`, approved, remark, out_logistics_code, out_waybill, return_nam
e,
return_
phone, return_
address, create_time, update_time
</otherwise>
</choose>
from identify_order
...
...
@@ -148,9 +150,9 @@
</foreach>
</when>
<otherwise>
id, distribution_order_id, identify_order_id,
item_id, from_logistics_code, from_waybill
,
`state`, approved, remark, out_logistics_code, out_waybill, return_name, return_phon
e,
return_address, create_time, update_time
id, distribution_order_id, identify_order_id,
seller_id, item_id, item_num, from_logistics_code
,
from_waybill, `state`, approved, remark, out_logistics_code, out_waybill, return_nam
e,
return_
phone, return_
address, create_time, update_time
</otherwise>
</choose>
from identify_order
...
...
@@ -171,17 +173,19 @@
SELECT LAST_INSERT_ID()
</selectKey>
insert into identify_order (distribution_order_id, identify_order_id,
item_id, from_logistics_code, from_waybill,
`state`, approved, remark,
out_logistics_code, out_waybill, return_name,
return_phone, return_address, create_time,
update_time)
seller_id, item_id, item_num,
from_logistics_code, from_waybill, `state`,
approved, remark, out_logistics_code,
out_waybill, return_name, return_phone,
return_address, create_time, update_time
)
values (#{distributionOrderId,jdbcType=VARCHAR}, #{identifyOrderId,jdbcType=VARCHAR},
#{itemId,jdbcType=BIGINT}, #{fromLogisticsCode,jdbcType=VARCHAR}, #{fromWaybill,jdbcType=VARCHAR},
#{state,jdbcType=INTEGER}, #{approved,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR},
#{outLogisticsCode,jdbcType=VARCHAR}, #{outWaybill,jdbcType=VARCHAR}, #{returnName,jdbcType=VARCHAR},
#{returnPhone,jdbcType=VARCHAR}, #{returnAddress,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
#{sellerId,jdbcType=BIGINT}, #{itemId,jdbcType=BIGINT}, #{itemNum,jdbcType=INTEGER},
#{fromLogisticsCode,jdbcType=VARCHAR}, #{fromWaybill,jdbcType=VARCHAR}, #{state,jdbcType=INTEGER},
#{approved,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR}, #{outLogisticsCode,jdbcType=VARCHAR},
#{outWaybill,jdbcType=VARCHAR}, #{returnName,jdbcType=VARCHAR}, #{returnPhone,jdbcType=VARCHAR},
#{returnAddress,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.wwdz.ch.db.domain.distribution.IdentifyOrder"
>
<selectKey
keyProperty=
"id"
order=
"AFTER"
resultType=
"java.lang.Integer"
>
...
...
@@ -195,9 +199,15 @@
<if
test=
"identifyOrderId != null"
>
identify_order_id,
</if>
<if
test=
"sellerId != null"
>
seller_id,
</if>
<if
test=
"itemId != null"
>
item_id,
</if>
<if
test=
"itemNum != null"
>
item_num,
</if>
<if
test=
"fromLogisticsCode != null"
>
from_logistics_code,
</if>
...
...
@@ -242,9 +252,15 @@
<if
test=
"identifyOrderId != null"
>
#{identifyOrderId,jdbcType=VARCHAR},
</if>
<if
test=
"sellerId != null"
>
#{sellerId,jdbcType=BIGINT},
</if>
<if
test=
"itemId != null"
>
#{itemId,jdbcType=BIGINT},
</if>
<if
test=
"itemNum != null"
>
#{itemNum,jdbcType=INTEGER},
</if>
<if
test=
"fromLogisticsCode != null"
>
#{fromLogisticsCode,jdbcType=VARCHAR},
</if>
...
...
@@ -301,9 +317,15 @@
<if
test=
"record.identifyOrderId != null"
>
identify_order_id = #{record.identifyOrderId,jdbcType=VARCHAR},
</if>
<if
test=
"record.sellerId != null"
>
seller_id = #{record.sellerId,jdbcType=BIGINT},
</if>
<if
test=
"record.itemId != null"
>
item_id = #{record.itemId,jdbcType=BIGINT},
</if>
<if
test=
"record.itemNum != null"
>
item_num = #{record.itemNum,jdbcType=INTEGER},
</if>
<if
test=
"record.fromLogisticsCode != null"
>
from_logistics_code = #{record.fromLogisticsCode,jdbcType=VARCHAR},
</if>
...
...
@@ -350,7 +372,9 @@
set id = #{record.id,jdbcType=INTEGER},
distribution_order_id = #{record.distributionOrderId,jdbcType=VARCHAR},
identify_order_id = #{record.identifyOrderId,jdbcType=VARCHAR},
seller_id = #{record.sellerId,jdbcType=BIGINT},
item_id = #{record.itemId,jdbcType=BIGINT},
item_num = #{record.itemNum,jdbcType=INTEGER},
from_logistics_code = #{record.fromLogisticsCode,jdbcType=VARCHAR},
from_waybill = #{record.fromWaybill,jdbcType=VARCHAR},
`state` = #{record.state,jdbcType=INTEGER},
...
...
@@ -376,9 +400,15 @@
<if
test=
"identifyOrderId != null"
>
identify_order_id = #{identifyOrderId,jdbcType=VARCHAR},
</if>
<if
test=
"sellerId != null"
>
seller_id = #{sellerId,jdbcType=BIGINT},
</if>
<if
test=
"itemId != null"
>
item_id = #{itemId,jdbcType=BIGINT},
</if>
<if
test=
"itemNum != null"
>
item_num = #{itemNum,jdbcType=INTEGER},
</if>
<if
test=
"fromLogisticsCode != null"
>
from_logistics_code = #{fromLogisticsCode,jdbcType=VARCHAR},
</if>
...
...
@@ -422,7 +452,9 @@
update identify_order
set distribution_order_id = #{distributionOrderId,jdbcType=VARCHAR},
identify_order_id = #{identifyOrderId,jdbcType=VARCHAR},
seller_id = #{sellerId,jdbcType=BIGINT},
item_id = #{itemId,jdbcType=BIGINT},
item_num = #{itemNum,jdbcType=INTEGER},
from_logistics_code = #{fromLogisticsCode,jdbcType=VARCHAR},
from_waybill = #{fromWaybill,jdbcType=VARCHAR},
`state` = #{state,jdbcType=INTEGER},
...
...
@@ -470,9 +502,9 @@
</foreach>
</when>
<otherwise>
id, distribution_order_id, identify_order_id,
item_id, from_logistics_code, from_waybill
,
`state`, approved, remark, out_logistics_code, out_waybill, return_name, return_phon
e,
return_address, create_time, update_time
id, distribution_order_id, identify_order_id,
seller_id, item_id, item_num, from_logistics_code
,
from_waybill, `state`, approved, remark, out_logistics_code, out_waybill, return_nam
e,
return_
phone, return_
address, create_time, update_time
</otherwise>
</choose>
from identify_order
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/api/WxPayCallbackController.java
View file @
4d298b15
...
...
@@ -9,6 +9,7 @@ import com.wwdz.ch.core.api.OfficialAccountApi;
import
com.wwdz.ch.core.api.WxAppletApi
;
import
com.wwdz.ch.core.api.wxpay.WxPayServiceApi
;
import
com.wwdz.ch.core.consts.DistributionEnum
;
import
com.wwdz.ch.core.consts.RefundOrderEnum
;
import
com.wwdz.ch.core.notify.AliSmsSender
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.util.PriceUtil
;
...
...
@@ -453,7 +454,7 @@ public class WxPayCallbackController {
refundOrder
.
setUpdateTime
(
new
Date
());
refundOrder
.
setSuccessTime
(
TimeUtil
.
wxTimeConvertToDate
(
successTime
));
refundOrder
.
setUserReceivedAccount
(
refundNotification
.
getUserReceivedAccount
());
refundOrder
.
setState
(
DistributionEnum
.
RefundOrder
StateEnum
.
SUCCESS
.
getCode
());
refundOrder
.
setState
(
RefundOrderEnum
.
StateEnum
.
SUCCESS
.
getCode
());
refundOrderDao
.
update
(
refundOrder
);
//分销商利润记录改为无效
distributorProfitDao
.
updateValidState
(
distributionOrderId
,
false
);
...
...
@@ -467,7 +468,7 @@ public class WxPayCallbackController {
RefundOrder
refundOrder
=
new
RefundOrder
();
refundOrder
.
setRefundId
(
refundId
);
refundOrder
.
setUpdateTime
(
new
Date
());
refundOrder
.
setState
(
DistributionEnum
.
RefundOrder
StateEnum
.
FAILED
.
getCode
());
refundOrder
.
setState
(
RefundOrderEnum
.
StateEnum
.
FAILED
.
getCode
());
refundOrderDao
.
update
(
refundOrder
);
}
}
catch
(
Exception
e
)
{
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/DistributionOrderServiceImpl.java
View file @
4d298b15
...
...
@@ -54,8 +54,6 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
private
final
static
String
DISTRIBUTION_ORDER_PREFIX
=
"DA"
;
private
final
static
String
REFUND_ORDER_PREFIX
=
"RF"
;
private
final
static
String
SECRET
=
"117eb48AX0864490fbe4d1ef081B9cc25"
;
private
static
final
String
CREATE_ORDER_KEY_PRE
=
"AUCTION:CREATE:"
;
...
...
@@ -1120,7 +1118,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
public
Result
refund
(
DistributionOrderRequestDto
dto
)
{
RLock
lock
=
null
;
try
{
String
refundId
=
IdUtils
.
getOrderNumber
(
REFUND_ORDER_PREFIX
);
String
refundId
=
IdUtils
.
getOrderNumber
(
CommConsts
.
REFUND_ORDER_PREFIX
);
//判断订单状态
String
distributionOrderId
=
dto
.
getDistributionOrderId
();
DistributionOrder
distributionOrder
=
distributionOrderDao
.
findById
(
distributionOrderId
);
...
...
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