Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
peizhen-java
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
PeiZhen-Java
peizhen-java
Commits
b1d8208d
Commit
b1d8208d
authored
Sep 18, 2023
by
sdif
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户端代码提交
parent
794320e1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
111 additions
and
9 deletions
+111
-9
pz-system/src/main/java/com/pz/merchant/domain/Company.java
+3
-3
pz-system/src/main/java/com/pz/merchant/domain/Employees.java
+3
-3
pz-system/src/main/java/com/pz/system/service/impl/ServicesServiceImpl.java
+1
-1
pz-system/src/main/java/com/pz/system/service/impl/TotalOrderServiceImpl.java
+104
-2
No files found.
pz-system/src/main/java/com/pz/merchant/domain/Company.java
View file @
b1d8208d
...
@@ -67,15 +67,15 @@ public class Company extends BaseEntity {
...
@@ -67,15 +67,15 @@ public class Company extends BaseEntity {
/**
/**
* 总收益
* 总收益
*/
*/
private
String
totalRevenue
;
private
double
totalRevenue
;
/**
/**
* 当前余额
* 当前余额
*/
*/
private
String
balance
;
private
double
balance
;
/**
/**
* 冻结余额
* 冻结余额
*/
*/
private
String
freezeBalance
;
private
double
freezeBalance
;
/**
/**
* 删除标志(0代表存在 2代表删除)
* 删除标志(0代表存在 2代表删除)
*/
*/
...
...
pz-system/src/main/java/com/pz/merchant/domain/Employees.java
View file @
b1d8208d
...
@@ -79,15 +79,15 @@ public class Employees extends BaseEntity {
...
@@ -79,15 +79,15 @@ public class Employees extends BaseEntity {
/**
/**
* 总收益
* 总收益
*/
*/
private
String
totalRevenue
;
private
double
totalRevenue
;
/**
/**
* 当前余额
* 当前余额
*/
*/
private
String
balance
;
private
double
balance
;
/**
/**
* 冻结余额
* 冻结余额
*/
*/
private
String
freezeBalance
;
private
double
freezeBalance
;
/**
/**
* 取消订单次数
* 取消订单次数
*/
*/
...
...
pz-system/src/main/java/com/pz/system/service/impl/ServicesServiceImpl.java
View file @
b1d8208d
...
@@ -52,7 +52,7 @@ public class ServicesServiceImpl implements IServicesService {
...
@@ -52,7 +52,7 @@ public class ServicesServiceImpl implements IServicesService {
LambdaQueryWrapper
<
Services
>
lqw
=
buildQueryWrapper
(
bo
);
LambdaQueryWrapper
<
Services
>
lqw
=
buildQueryWrapper
(
bo
);
Page
<
ServicesVo
>
result
=
baseMapper
.
selectVoPage
(
pageQuery
.
build
(),
lqw
);
Page
<
ServicesVo
>
result
=
baseMapper
.
selectVoPage
(
pageQuery
.
build
(),
lqw
);
Optional
.
ofNullable
(
result
.
getRecords
()).
ifPresent
(
records
->
{
Optional
.
ofNullable
(
result
.
getRecords
()).
ifPresent
(
records
->
{
List
<
Notice
>
notices
=
noticeMapper
.
selectList
();
List
<
Notice
>
notices
=
noticeMapper
.
selectList
(
new
LambdaQueryWrapper
<
Notice
>().
eq
(
Notice:
:
getSite
,
2
)
);
if
(
null
!=
notices
&&
notices
.
size
()
!=
0
){
if
(
null
!=
notices
&&
notices
.
size
()
!=
0
){
records
.
get
(
0
).
setNotice
(
notices
.
get
(
0
).
getInfo
());
records
.
get
(
0
).
setNotice
(
notices
.
get
(
0
).
getInfo
());
}
}
...
...
pz-system/src/main/java/com/pz/system/service/impl/TotalOrderServiceImpl.java
View file @
b1d8208d
...
@@ -26,9 +26,12 @@ import com.pz.common.enums.ShopOrderStatus;
...
@@ -26,9 +26,12 @@ import com.pz.common.enums.ShopOrderStatus;
import
com.pz.common.enums.TotalOrderStatus
;
import
com.pz.common.enums.TotalOrderStatus
;
import
com.pz.common.exception.ServiceException
;
import
com.pz.common.exception.ServiceException
;
import
com.pz.common.utils.HttpUtils
;
import
com.pz.common.utils.HttpUtils
;
import
com.pz.merchant.domain.Company
;
import
com.pz.merchant.domain.Employees
;
import
com.pz.merchant.domain.vo.EmployeesVo
;
import
com.pz.merchant.domain.vo.EmployeesVo
;
import
com.pz.common.utils.JsonUtils
;
import
com.pz.common.utils.JsonUtils
;
import
com.pz.merchant.domain.vo.SonOrderVo
;
import
com.pz.merchant.domain.vo.SonOrderVo
;
import
com.pz.merchant.mapper.CompanyMapper
;
import
com.pz.merchant.mapper.EmployeesMapper
;
import
com.pz.merchant.mapper.EmployeesMapper
;
import
com.pz.merchant.service.ISonOrderService
;
import
com.pz.merchant.service.ISonOrderService
;
import
com.pz.merchant.service.impl.SonOrderServiceBuilder
;
import
com.pz.merchant.service.impl.SonOrderServiceBuilder
;
...
@@ -123,6 +126,8 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
...
@@ -123,6 +126,8 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
private
final
UserRefundMapper
userRefundMapper
;
private
final
UserRefundMapper
userRefundMapper
;
private
final
CompanyMapper
companyMapper
;
@Override
@Override
public
TotalOrderVo
queryById
(
Long
id
)
{
public
TotalOrderVo
queryById
(
Long
id
)
{
return
baseMapper
.
selectVoById
(
id
);
return
baseMapper
.
selectVoById
(
id
);
...
@@ -360,6 +365,7 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
...
@@ -360,6 +365,7 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
List
<
Integer
>
ids
=
JsonUtils
.
parseArray
(
storeGoods
.
getTags
(),
Integer
.
class
);
List
<
Integer
>
ids
=
JsonUtils
.
parseArray
(
storeGoods
.
getTags
(),
Integer
.
class
);
List
<
StoreGoodsTag
>
storeGoodsTags
=
storeGoodsTagMapper
.
selectList
(
new
LambdaQueryWrapper
<
StoreGoodsTag
>().
in
(
StoreGoodsTag:
:
getId
,
ids
).
select
(
StoreGoodsTag:
:
getTitle
));
List
<
StoreGoodsTag
>
storeGoodsTags
=
storeGoodsTagMapper
.
selectList
(
new
LambdaQueryWrapper
<
StoreGoodsTag
>().
in
(
StoreGoodsTag:
:
getId
,
ids
).
select
(
StoreGoodsTag:
:
getTitle
));
totalOrderVo
.
setTags
(
storeGoodsTags
);
totalOrderVo
.
setTags
(
storeGoodsTags
);
totalOrderVo
.
setPrice
(
storeGoods
.
getPrice
());
totalOrderVo
.
setName
(
storeGoods
.
getTitle
());
totalOrderVo
.
setName
(
storeGoods
.
getTitle
());
}
}
...
@@ -495,6 +501,18 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
...
@@ -495,6 +501,18 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
}
else
if
(
bo
.
getBusinessId
()
==
0
)
{
// 商城订单
}
else
if
(
bo
.
getBusinessId
()
==
0
)
{
// 商城订单
StoreOrder
storeOrder
=
BeanUtil
.
toBean
(
bo
,
StoreOrder
.
class
);
StoreOrder
storeOrder
=
BeanUtil
.
toBean
(
bo
,
StoreOrder
.
class
);
StoreGoods
storeGoods1
=
storeGoodsMapper
.
selectById
(
storeOrder
.
getGoodsId
());
if
(
storeGoods1
.
getInventory
()
==
0
){
throw
new
ServiceException
(
"商品库存不足!"
);
}
//扣除库存
storeGoods1
.
setId
(
storeOrder
.
getId
());
storeGoods1
.
setInventory
(
storeGoods1
.
getInventory
()
-
storeOrder
.
getNum
());
storeGoods1
.
setSaleNum
(
storeGoods1
.
getSaleNum
()
+
1
);
storeGoodsMapper
.
updateById
(
storeGoods1
);
storeOrderMapper
.
insert
(
storeOrder
);
storeOrderMapper
.
insert
(
storeOrder
);
}
}
...
@@ -551,10 +569,22 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
...
@@ -551,10 +569,22 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
totalOrderBo
.
setIsRefund
(
0
);
totalOrderBo
.
setIsRefund
(
0
);
return
this
.
refundOrder
(
totalOrderBo
);
return
this
.
refundOrder
(
totalOrderBo
);
}
}
/*
if(){
}*/
if
(
sonOrderSimpleDataByTotalId
.
getOrderStatus
()
==
0
&&
totalOrder
.
getEmId
()
==
0
&&
totalOrder
.
getStatus
()
==
0
)
{
// 预约陪诊
if
(
sonOrderSimpleDataByTotalId
.
getOrderStatus
()
==
0
&&
totalOrder
.
getEmId
()
==
0
&&
totalOrder
.
getStatus
()
==
0
)
{
// 预约陪诊
// yypzOrderMapper.selectOne(new LambdaQueryWrapper<YypzOrder>().eq(YypzOrder::getOrderId,totalOrder));
// yypzOrderMapper.selectOne(new LambdaQueryWrapper<YypzOrder>().eq(YypzOrder::getOrderId,totalOrder));
totalOrder
.
setStatus
(
TotalOrderStatus
.
CANCEL
.
getCode
());
totalOrder
.
setStatus
(
TotalOrderStatus
.
CANCEL
.
getCode
());
if
(
totalOrder
.
getBusinessId
()
==
0
){
StoreOrder
storeOrder
=
storeOrderMapper
.
selectById
(
sonOrderSimpleDataByTotalId
.
getSonOrderId
());
StoreGoods
storeGoods
=
storeGoodsMapper
.
selectById
(
storeOrder
.
getGoodsId
());
storeGoods
.
setSaleNum
(
storeGoods
.
getSaleNum
()
-
1
);
storeGoods
.
setInventory
(
storeGoods
.
getInventory
()
+
1
);
storeGoodsMapper
.
updateById
(
storeGoods
);
}
return
baseMapper
.
updateById
(
totalOrder
)
>
0
;
return
baseMapper
.
updateById
(
totalOrder
)
>
0
;
}
else
{
}
else
{
throw
new
ServiceException
(
"该订单已分配给陪诊员,不允许取消订单!"
);
throw
new
ServiceException
(
"该订单已分配给陪诊员,不允许取消订单!"
);
...
@@ -567,6 +597,42 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
...
@@ -567,6 +597,42 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
TotalOrder
totalOrder
=
BeanUtil
.
toBean
(
bo
,
TotalOrder
.
class
);
TotalOrder
totalOrder
=
BeanUtil
.
toBean
(
bo
,
TotalOrder
.
class
);
totalOrder
.
setStatus
(
TotalOrderStatus
.
DONE
.
getCode
());
totalOrder
.
setStatus
(
TotalOrderStatus
.
DONE
.
getCode
());
TotalOrder
totalOrder1
=
baseMapper
.
selectById
(
totalOrder
.
getId
());
//除了商城订单和诊前挂号不需要给陪诊员和商户分成
if
(
totalOrder1
.
getBusinessId
()
!=
0
&&
totalOrder1
.
getBusinessId
()
!=
6
){
Services
services
=
servicesMapper
.
selectById
(
totalOrder1
.
getServiceId
());
if
(
services
.
getFenmo
()
!=
0
){
double
money
=
0
;
Employees
employees
=
employeesMapper
.
selectById
(
totalOrder1
.
getEmId
());
/**
* 1. 如果该陪诊员不属于任何商户,则陪诊员每完成一个订单,收益都会相应增加
* 2. 如果该陪诊员属于某个商户,则该陪诊员每完成一个订单,收益不会增加(因为陪诊员完成订单后,收益暂归商户所有)
*/
double
fenmo
=
(
double
)
services
.
getFenmo
()
/
100
;
double
v
=
totalOrder
.
getPayMoney
()
*
fenmo
;
money
=
v
;
if
(
employees
.
getCompanyId
()
!=
0
){
Company
company
=
companyMapper
.
selectById
(
employees
.
getCompanyId
());
company
.
setTotalRevenue
(
company
.
getTotalRevenue
()
+
money
);
company
.
setBalance
(
company
.
getBalance
()
+
money
);
companyMapper
.
updateById
(
company
);
}
else
{
employees
.
setTotalRevenue
(
employees
.
getTotalRevenue
());
employees
.
setBalance
(
employees
.
getBalance
());
employeesMapper
.
updateById
(
employees
);
}
}
}
return
baseMapper
.
updateById
(
totalOrder
)
>
0
;
return
baseMapper
.
updateById
(
totalOrder
)
>
0
;
}
}
...
@@ -637,7 +703,41 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
...
@@ -637,7 +703,41 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
// 修改子订单状态
// 修改子订单状态
boolean
sonOrderFlag
=
orderService
.
switchSonOrderStatus
(
totalOrder
.
getId
(),
CommonOrderStatus
.
REFUND
.
getCode
());
boolean
sonOrderFlag
=
orderService
.
switchSonOrderStatus
(
totalOrder
.
getId
(),
CommonOrderStatus
.
REFUND
.
getCode
());
if
(
sonOrderFlag
)
{
//除了商城订单和诊前挂号不需要给陪诊员和商户分成
if
(
totalOrder
.
getBusinessId
()
!=
0
&&
totalOrder
.
getBusinessId
()
!=
6
){
Services
services
=
servicesMapper
.
selectById
(
totalOrder
.
getServiceId
());
if
(
services
.
getFenmo
()
!=
0
){
double
money
=
0
;
Employees
employees
=
employeesMapper
.
selectById
(
totalOrder
.
getEmId
());
/**
* 1. 如果该陪诊员不属于任何商户,则陪诊员每完成一个订单,收益都会相应增加
* 2. 如果该陪诊员属于某个商户,则该陪诊员每完成一个订单,收益不会增加(因为陪诊员完成订单后,收益暂归商户所有)
*/
double
fenmo
=
(
double
)
services
.
getFenmo
()
/
100
;
double
v
=
totalOrder
.
getPayMoney
()
*
fenmo
;
money
=
v
;
if
(
employees
.
getCompanyId
()
!=
0
){
Company
company
=
companyMapper
.
selectById
(
employees
.
getCompanyId
());
company
.
setTotalRevenue
(
company
.
getTotalRevenue
()
-
money
);
company
.
setBalance
(
company
.
getBalance
()
-
money
);
companyMapper
.
updateById
(
company
);
}
else
{
employees
.
setTotalRevenue
(
employees
.
getTotalRevenue
());
employees
.
setBalance
(
employees
.
getBalance
());
employeesMapper
.
updateById
(
employees
);
}
}
}
if
(!
sonOrderFlag
)
{
throw
new
ServiceException
(
"子订单状态修改出错,接单失败"
);
throw
new
ServiceException
(
"子订单状态修改出错,接单失败"
);
}
}
if
(
baseMapper
.
updateById
(
totalOrder
)
>
0
)
{
if
(
baseMapper
.
updateById
(
totalOrder
)
>
0
)
{
...
@@ -707,6 +807,8 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
...
@@ -707,6 +807,8 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
String
serveTime
=
orderService
.
getFinishTime
(
totalOrder
.
getBusinessId
());
String
serveTime
=
orderService
.
getFinishTime
(
totalOrder
.
getBusinessId
());
if
(
StringUtils
.
isNotEmpty
(
serveTime
))
{
if
(
StringUtils
.
isNotEmpty
(
serveTime
))
{
money
=
getMoney
(
serveTime
,
totalOrder
.
getPayMoney
());
// 计算退款金额
money
=
getMoney
(
serveTime
,
totalOrder
.
getPayMoney
());
// 计算退款金额
}
else
{
money
=
totalOrder
.
getPayMoney
();
}
}
}
}
...
@@ -724,7 +826,7 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
...
@@ -724,7 +826,7 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
totalOrder
.
setRefundAmount
(
totalOrder
.
getPayMoney
()
);
totalOrder
.
setRefundAmount
(
money
);
}
else
if
(
bo
.
getIsRefund
()
==
1
)
{
// 陪诊员订单完成走审批流程
}
else
if
(
bo
.
getIsRefund
()
==
1
)
{
// 陪诊员订单完成走审批流程
if
(
sonOrderSimpleDataByTotalId
.
getOrderStatus
()
!=
2
)
{
if
(
sonOrderSimpleDataByTotalId
.
getOrderStatus
()
!=
2
)
{
throw
new
ServiceException
(
"订单状态错误"
);
throw
new
ServiceException
(
"订单状态错误"
);
...
...
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