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
2ce031c5
Commit
2ce031c5
authored
Apr 12, 2024
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
标签取消关联
parent
d588ec1b
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
314 additions
and
15 deletions
+314
-15
ch-dao/src/main/java/com/wwdz/ch/db/domain/distribution/DistributorProfit.java
...com/wwdz/ch/db/domain/distribution/DistributorProfit.java
+10
-2
ch-dao/src/main/java/com/wwdz/ch/db/domain/distribution/DistributorProfitExample.java
...z/ch/db/domain/distribution/DistributorProfitExample.java
+132
-0
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/distribution/DistributorProfitMapper.xml
...wdz/ch/db/mapper/distribution/DistributorProfitMapper.xml
+28
-11
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/distribution/DistributionOrderDetailVo.java
.../wx/entity/vo/distribution/DistributionOrderDetailVo.java
+5
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/DistributionOrderServiceImpl.java
...ch/wx/impl/distribution/DistributionOrderServiceImpl.java
+107
-1
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/SupplierItemServiceImpl.java
...wwdz/ch/wx/impl/distribution/SupplierItemServiceImpl.java
+9
-1
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/distribution/DistributionOrderService.java
.../ch/wx/service/distribution/DistributionOrderService.java
+9
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/distribution/DistributionOrderController.java
...z/ch/wx/web/distribution/DistributionOrderController.java
+14
-0
No files found.
ch-dao/src/main/java/com/wwdz/ch/db/domain/distribution/DistributorProfit.java
View file @
2ce031c5
...
...
@@ -3,13 +3,12 @@ package com.wwdz.ch.db.domain.distribution;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
com.xxdxxs.entity.Entity
;
import
lombok.Data
;
/**
* @author shiyu
* @date 2024/0
1/3
1
* @date 2024/0
4/1
1
*/
@Data
public
class
DistributorProfit
implements
Entity
{
...
...
@@ -50,6 +49,11 @@ public class DistributorProfit implements Entity {
*/
private
Long
channelCost
;
/**
* 介绍人佣金
*/
private
Long
introduceCost
;
/**
* 利润
*/
...
...
@@ -81,6 +85,7 @@ public class DistributorProfit implements Entity {
sb
.
append
(
", amount="
).
append
(
amount
);
sb
.
append
(
", itemCost="
).
append
(
itemCost
);
sb
.
append
(
", channelCost="
).
append
(
channelCost
);
sb
.
append
(
", introduceCost="
).
append
(
introduceCost
);
sb
.
append
(
", profit="
).
append
(
profit
);
sb
.
append
(
", createTime="
).
append
(
createTime
);
sb
.
append
(
", isValid="
).
append
(
isValid
);
...
...
@@ -109,6 +114,7 @@ public class DistributorProfit implements Entity {
&&
(
this
.
getAmount
()
==
null
?
other
.
getAmount
()
==
null
:
this
.
getAmount
().
equals
(
other
.
getAmount
()))
&&
(
this
.
getItemCost
()
==
null
?
other
.
getItemCost
()
==
null
:
this
.
getItemCost
().
equals
(
other
.
getItemCost
()))
&&
(
this
.
getChannelCost
()
==
null
?
other
.
getChannelCost
()
==
null
:
this
.
getChannelCost
().
equals
(
other
.
getChannelCost
()))
&&
(
this
.
getIntroduceCost
()
==
null
?
other
.
getIntroduceCost
()
==
null
:
this
.
getIntroduceCost
().
equals
(
other
.
getIntroduceCost
()))
&&
(
this
.
getProfit
()
==
null
?
other
.
getProfit
()
==
null
:
this
.
getProfit
().
equals
(
other
.
getProfit
()))
&&
(
this
.
getCreateTime
()
==
null
?
other
.
getCreateTime
()
==
null
:
this
.
getCreateTime
().
equals
(
other
.
getCreateTime
()))
&&
(
this
.
getIsValid
()
==
null
?
other
.
getIsValid
()
==
null
:
this
.
getIsValid
().
equals
(
other
.
getIsValid
()));
...
...
@@ -126,6 +132,7 @@ public class DistributorProfit implements Entity {
result
=
prime
*
result
+
((
getAmount
()
==
null
)
?
0
:
getAmount
().
hashCode
());
result
=
prime
*
result
+
((
getItemCost
()
==
null
)
?
0
:
getItemCost
().
hashCode
());
result
=
prime
*
result
+
((
getChannelCost
()
==
null
)
?
0
:
getChannelCost
().
hashCode
());
result
=
prime
*
result
+
((
getIntroduceCost
()
==
null
)
?
0
:
getIntroduceCost
().
hashCode
());
result
=
prime
*
result
+
((
getProfit
()
==
null
)
?
0
:
getProfit
().
hashCode
());
result
=
prime
*
result
+
((
getCreateTime
()
==
null
)
?
0
:
getCreateTime
().
hashCode
());
result
=
prime
*
result
+
((
getIsValid
()
==
null
)
?
0
:
getIsValid
().
hashCode
());
...
...
@@ -148,6 +155,7 @@ public class DistributorProfit implements Entity {
amount
(
"amount"
,
"amount"
,
"BIGINT"
,
false
),
itemCost
(
"item_cost"
,
"itemCost"
,
"BIGINT"
,
false
),
channelCost
(
"channel_cost"
,
"channelCost"
,
"BIGINT"
,
false
),
introduceCost
(
"introduce_cost"
,
"introduceCost"
,
"BIGINT"
,
false
),
profit
(
"profit"
,
"profit"
,
"BIGINT"
,
false
),
createTime
(
"create_time"
,
"createTime"
,
"TIMESTAMP"
,
false
),
isValid
(
"is_valid"
,
"isValid"
,
"BIT"
,
false
);
...
...
ch-dao/src/main/java/com/wwdz/ch/db/domain/distribution/DistributorProfitExample.java
View file @
2ce031c5
...
...
@@ -1214,6 +1214,138 @@ public class DistributorProfitExample {
return
(
Criteria
)
this
;
}
public
Criteria
andIntroduceCostIsNull
()
{
addCriterion
(
"introduce_cost is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIntroduceCostIsNotNull
()
{
addCriterion
(
"introduce_cost is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIntroduceCostEqualTo
(
Long
value
)
{
addCriterion
(
"introduce_cost ="
,
value
,
"introduceCost"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distributor_profit
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andIntroduceCostEqualToColumn
(
DistributorProfit
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"introduce_cost = "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andIntroduceCostNotEqualTo
(
Long
value
)
{
addCriterion
(
"introduce_cost <>"
,
value
,
"introduceCost"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distributor_profit
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andIntroduceCostNotEqualToColumn
(
DistributorProfit
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"introduce_cost <> "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andIntroduceCostGreaterThan
(
Long
value
)
{
addCriterion
(
"introduce_cost >"
,
value
,
"introduceCost"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distributor_profit
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andIntroduceCostGreaterThanColumn
(
DistributorProfit
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"introduce_cost > "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andIntroduceCostGreaterThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"introduce_cost >="
,
value
,
"introduceCost"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distributor_profit
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andIntroduceCostGreaterThanOrEqualToColumn
(
DistributorProfit
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"introduce_cost >= "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andIntroduceCostLessThan
(
Long
value
)
{
addCriterion
(
"introduce_cost <"
,
value
,
"introduceCost"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distributor_profit
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andIntroduceCostLessThanColumn
(
DistributorProfit
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"introduce_cost < "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andIntroduceCostLessThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"introduce_cost <="
,
value
,
"introduceCost"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distributor_profit
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andIntroduceCostLessThanOrEqualToColumn
(
DistributorProfit
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"introduce_cost <= "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andIntroduceCostIn
(
List
<
Long
>
values
)
{
addCriterion
(
"introduce_cost in"
,
values
,
"introduceCost"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIntroduceCostNotIn
(
List
<
Long
>
values
)
{
addCriterion
(
"introduce_cost not in"
,
values
,
"introduceCost"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIntroduceCostBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"introduce_cost between"
,
value1
,
value2
,
"introduceCost"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIntroduceCostNotBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"introduce_cost not between"
,
value1
,
value2
,
"introduceCost"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProfitIsNull
()
{
addCriterion
(
"profit is null"
);
return
(
Criteria
)
this
;
...
...
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/distribution/DistributorProfitMapper.xml
View file @
2ce031c5
...
...
@@ -10,6 +10,7 @@
<result
column=
"amount"
jdbcType=
"BIGINT"
property=
"amount"
/>
<result
column=
"item_cost"
jdbcType=
"BIGINT"
property=
"itemCost"
/>
<result
column=
"channel_cost"
jdbcType=
"BIGINT"
property=
"channelCost"
/>
<result
column=
"introduce_cost"
jdbcType=
"BIGINT"
property=
"introduceCost"
/>
<result
column=
"profit"
jdbcType=
"BIGINT"
property=
"profit"
/>
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"is_valid"
jdbcType=
"BIT"
property=
"isValid"
/>
...
...
@@ -74,7 +75,7 @@
</sql>
<sql
id=
"Base_Column_List"
>
id, distribution_order_id, distributor_id, item_id, item_num, amount, item_cost,
channel_cost, profit, create_time, is_valid
channel_cost,
introduce_cost,
profit, create_time, is_valid
</sql>
<select
id=
"selectByExample"
parameterType=
"com.wwdz.ch.db.domain.distribution.DistributorProfitExample"
resultMap=
"BaseResultMap"
>
select
...
...
@@ -103,14 +104,14 @@
distinct
</if>
<choose>
<when
test=
"selective != null and selective.length
>
0"
>
<when
test=
"selective != null and selective.length
>
0"
>
<foreach
collection=
"selective"
item=
"column"
separator=
","
>
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, distribution_order_id, distributor_id, item_id, item_num, amount, item_cost,
channel_cost, profit, create_time, is_valid
channel_cost,
introduce_cost,
profit, create_time, is_valid
</otherwise>
</choose>
from distributor_profit
...
...
@@ -135,14 +136,14 @@
-->
select
<choose>
<when
test=
"selective != null and selective.length
>
0"
>
<when
test=
"selective != null and selective.length
>
0"
>
<foreach
collection=
"selective"
item=
"column"
separator=
","
>
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, distribution_order_id, distributor_id, item_id, item_num, amount, item_cost,
channel_cost, profit, create_time, is_valid
channel_cost,
introduce_cost,
profit, create_time, is_valid
</otherwise>
</choose>
from distributor_profit
...
...
@@ -164,12 +165,14 @@
</selectKey>
insert into distributor_profit (distribution_order_id, distributor_id,
item_id, item_num, amount,
item_cost, channel_cost, profit,
create_time, is_valid)
item_cost, channel_cost, introduce_cost,
profit, create_time, is_valid
)
values (#{distributionOrderId,jdbcType=VARCHAR}, #{distributorId,jdbcType=BIGINT},
#{itemId,jdbcType=BIGINT}, #{itemNum,jdbcType=INTEGER}, #{amount,jdbcType=BIGINT},
#{itemCost,jdbcType=BIGINT}, #{channelCost,jdbcType=BIGINT}, #{profit,jdbcType=BIGINT},
#{createTime,jdbcType=TIMESTAMP}, #{isValid,jdbcType=BIT})
#{itemCost,jdbcType=BIGINT}, #{channelCost,jdbcType=BIGINT}, #{introduceCost,jdbcType=BIGINT},
#{profit,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{isValid,jdbcType=BIT}
)
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.wwdz.ch.db.domain.distribution.DistributorProfit"
>
<selectKey
keyProperty=
"id"
order=
"AFTER"
resultType=
"java.lang.Long"
>
...
...
@@ -198,6 +201,9 @@
<if
test=
"channelCost != null"
>
channel_cost,
</if>
<if
test=
"introduceCost != null"
>
introduce_cost,
</if>
<if
test=
"profit != null"
>
profit,
</if>
...
...
@@ -230,6 +236,9 @@
<if
test=
"channelCost != null"
>
#{channelCost,jdbcType=BIGINT},
</if>
<if
test=
"introduceCost != null"
>
#{introduceCost,jdbcType=BIGINT},
</if>
<if
test=
"profit != null"
>
#{profit,jdbcType=BIGINT},
</if>
...
...
@@ -274,6 +283,9 @@
<if
test=
"record.channelCost != null"
>
channel_cost = #{record.channelCost,jdbcType=BIGINT},
</if>
<if
test=
"record.introduceCost != null"
>
introduce_cost = #{record.introduceCost,jdbcType=BIGINT},
</if>
<if
test=
"record.profit != null"
>
profit = #{record.profit,jdbcType=BIGINT},
</if>
...
...
@@ -298,6 +310,7 @@
amount = #{record.amount,jdbcType=BIGINT},
item_cost = #{record.itemCost,jdbcType=BIGINT},
channel_cost = #{record.channelCost,jdbcType=BIGINT},
introduce_cost = #{record.introduceCost,jdbcType=BIGINT},
profit = #{record.profit,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
is_valid = #{record.isValid,jdbcType=BIT}
...
...
@@ -329,6 +342,9 @@
<if
test=
"channelCost != null"
>
channel_cost = #{channelCost,jdbcType=BIGINT},
</if>
<if
test=
"introduceCost != null"
>
introduce_cost = #{introduceCost,jdbcType=BIGINT},
</if>
<if
test=
"profit != null"
>
profit = #{profit,jdbcType=BIGINT},
</if>
...
...
@@ -350,6 +366,7 @@
amount = #{amount,jdbcType=BIGINT},
item_cost = #{itemCost,jdbcType=BIGINT},
channel_cost = #{channelCost,jdbcType=BIGINT},
introduce_cost = #{introduceCost,jdbcType=BIGINT},
profit = #{profit,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
is_valid = #{isValid,jdbcType=BIT}
...
...
@@ -382,14 +399,14 @@
select
'true' as QUERYID,
<choose>
<when
test=
"selective != null and selective.length
>
0"
>
<when
test=
"selective != null and selective.length
>
0"
>
<foreach
collection=
"selective"
item=
"column"
separator=
","
>
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, distribution_order_id, distributor_id, item_id, item_num, amount, item_cost,
channel_cost, profit, create_time, is_valid
channel_cost,
introduce_cost,
profit, create_time, is_valid
</otherwise>
</choose>
from distributor_profit
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/distribution/DistributionOrderDetailVo.java
View file @
2ce031c5
...
...
@@ -89,6 +89,11 @@ public class DistributionOrderDetailVo implements Entity {
*/
private
String
channelCost
;
/**
* 介绍人分佣
*/
private
String
introduceCost
;
/**
* 盈利
*/
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/DistributionOrderServiceImpl.java
View file @
2ce031c5
...
...
@@ -13,9 +13,12 @@ import com.wwdz.ch.core.notify.AliSmsSender;
import
com.wwdz.ch.core.type.PageSearchResult
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.util.*
;
import
com.wwdz.ch.db.dao.FollowFansRecordDao
;
import
com.wwdz.ch.db.dao.distribution.*
;
import
com.wwdz.ch.db.domain.FollowFansRecord
;
import
com.wwdz.ch.db.domain.User
;
import
com.wwdz.ch.db.domain.distribution.*
;
import
com.wwdz.ch.db.dto.request.FollowFansRecordRequestDto
;
import
com.wwdz.ch.db.dto.request.distribution.DistributionOrderRequestDto
;
import
com.wwdz.ch.db.dto.request.distribution.SupplierItemRequestDto
;
import
com.wwdz.ch.wx.api.WxAppletApi
;
...
...
@@ -101,6 +104,9 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
@Autowired
WxAppletApi
wxAppletApi
;
@Autowired
FollowFansRecordDao
followFansRecordDao
;
@Transactional
@Override
public
Result
createDistributionOrder
(
DistributionOrderRequestDto
dto
)
{
...
...
@@ -365,6 +371,106 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
return
Result
.
failed
(
"拍卖分销订单下单失败"
);
}
@Override
public
Result
createCollectionOrder
(
DistributionOrderRequestDto
dto
)
{
try
{
Long
itemId
=
dto
.
getItemId
();
String
shareRecordId
=
dto
.
getShareRecordId
();
if
(
StringUtils
.
hasLength
(
shareRecordId
))
{
//查询分享记录详细信息
DistributorShareRecord
distributorShareRecord
=
distributorShareRecordDao
.
findById
(
shareRecordId
);
if
(
distributorShareRecord
==
null
)
{
return
Result
.
failed
(
"该分享链接无效"
);
}
if
(!
distributorShareRecord
.
getEnabled
())
{
return
Result
.
failed
(
"该分享链接已失效"
);
}
itemId
=
distributorShareRecord
.
getItemId
();
}
//查询商品信息,检查商品库存
SupplierItem
supplierItem
=
supplierItemDao
.
findById
(
itemId
);
int
stock
=
supplierItem
.
getStock
();
if
(
stock
<=
0
)
{
return
Result
.
failed
(
"商品库存不足"
);
}
//商品限购数量
if
(
dto
.
getItemNum
()
>
stock
)
{
return
Result
.
failed
(
"超出库存"
);
}
String
distributionOrderId
=
IdUtils
.
getOrderNumber
(
DISTRIBUTION_ORDER_PREFIX
);
DistributionOrderRequestDto
prePayDto
=
new
DistributionOrderRequestDto
();
prePayDto
.
setDistributionOrderId
(
distributionOrderId
);
prePayDto
.
setAmount
(
String
.
valueOf
(
supplierItem
.
getDistributionPrice
()
*
dto
.
getItemNum
()));
prePayDto
.
setBuyerOpenid
(
dto
.
getBuyerOpenid
());
prePayDto
.
setItemName
(
supplierItem
.
getName
());
Result
prePayResult
=
wxPayServiceApi
.
createPrepareOrder
(
prePayDto
);
if
(!
prePayResult
.
getSuccess
())
{
return
Result
.
failed
(
"购买藏品预下单失败"
);
}
String
prepayId
=
(
String
)
prePayResult
.
getData
();
//查询该用户和藏家的介绍人
FollowFansRecordRequestDto
followFansRecordRequestDto
=
new
FollowFansRecordRequestDto
();
followFansRecordRequestDto
.
setFollowerId
(
supplierItem
.
getCreatorId
());
followFansRecordRequestDto
.
setFansId
(
dto
.
getBuyerId
());
FollowFansRecord
followFansRecord
=
followFansRecordDao
.
findOne
(
followFansRecordRequestDto
);
//把介绍人作为该订单的分享链接字段的值
long
introducerId
=
followFansRecord
.
getIntroducerId
();
DistributionOrder
distributionOrder
=
new
DistributionOrder
();
distributionOrder
.
setItemId
(
itemId
);
distributionOrder
.
setItemNum
(
dto
.
getItemNum
());
distributionOrder
.
setShareRecordId
(
String
.
valueOf
(
introducerId
));
distributionOrder
.
setDistributionOrderId
(
distributionOrderId
);
distributionOrder
.
setPrepayId
(
prepayId
);
distributionOrder
.
setBuyerId
(
dto
.
getBuyerId
());
distributionOrder
.
setBuyerOpenid
(
dto
.
getBuyerOpenid
());
distributionOrder
.
setShopId
(
supplierItem
.
getCreatorId
());
distributionOrder
.
setSellerId
(
supplierItem
.
getCreatorId
());
distributionOrder
.
setAmount
(
supplierItem
.
getDistributionPrice
()
*
dto
.
getItemNum
());
distributionOrder
.
setAddressId
(
dto
.
getAddressId
());
distributionOrder
.
setReceiverAddress
(
dto
.
getReceiverAddress
());
distributionOrder
.
setReceiverName
(
dto
.
getReceiverName
());
distributionOrder
.
setReceiverPhone
(
dto
.
getReceiverPhone
());
distributionOrder
.
setCreateTime
(
new
Date
());
distributionOrder
.
setUpdateTime
(
new
Date
());
distributionOrder
.
setType
(
DistributionEnum
.
DistributionTypeEnum
.
COLLECT
.
getCode
());
distributionOrder
.
setState
(
DistributionEnum
.
DistributionOrderStateEnum
.
PRE_PAY
.
getCode
());
distributionOrderDao
.
insert
(
distributionOrder
);
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"distributionOrderId"
,
distributionOrderId
);
map
.
put
(
"prepayId"
,
prepayId
);
//计算分销商的利润
DistributorProfit
distributorProfit
=
new
DistributorProfit
();
//平台服务费
double
channelServiceCost
=
distributionOrder
.
getAmount
().
doubleValue
()
*
0.05
;
//介绍人分佣,自己推荐获得的订单无需计算介绍佣金
double
introduceCost
=
0
;
if
(
supplierItem
.
getCreatorId
()
!=
introducerId
)
{
introduceCost
=
distributionOrder
.
getAmount
().
doubleValue
()
*
0.03
;
}
distributorProfit
.
setDistributionOrderId
(
distributionOrderId
);
distributorProfit
.
setDistributorId
(
distributionOrder
.
getSellerId
());
distributorProfit
.
setItemId
(
distributionOrder
.
getItemId
());
distributorProfit
.
setItemNum
(
distributionOrder
.
getItemNum
());
distributorProfit
.
setAmount
(
distributionOrder
.
getAmount
());
distributorProfit
.
setItemCost
(
null
);
distributorProfit
.
setChannelCost
(
PriceUtil
.
convertPriceFromStr
(
PriceUtil
.
convertDoubleToString
(
channelServiceCost
)));
distributorProfit
.
setIntroduceCost
(
PriceUtil
.
convertPriceFromStr
(
PriceUtil
.
convertDoubleToString
(
introduceCost
)));
long
profit
=
distributionOrder
.
getAmount
()
-
distributorProfit
.
getChannelCost
()
-
distributorProfit
.
getIntroduceCost
();
distributorProfit
.
setProfit
(
profit
);
distributorProfit
.
setCreateTime
(
new
Date
());
distributorProfit
.
setIsValid
(
false
);
distributorProfitDao
.
insert
(
distributorProfit
);
return
Result
.
success
(
map
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"创建藏品一口价订单失败 error : {}"
,
e
);
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
}
return
Result
.
failed
(
"藏品一口价订单下单失败"
);
}
@Override
public
Result
auctionPay
(
DistributionOrderRequestDto
dto
)
{
try
{
...
...
@@ -891,7 +997,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
double
channelServiceCost
=
distributionOrder
.
getAmount
().
doubleValue
()
*
0.05
;
//介绍人分佣
double
introduceCost
=
distributionOrder
.
getAmount
().
doubleValue
()
*
0.03
;
//利润
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/SupplierItemServiceImpl.java
View file @
2ce031c5
...
...
@@ -621,8 +621,8 @@ public class SupplierItemServiceImpl implements SupplierItemService {
}
//删除去掉的标签对应的关系
List
<
CollectionItemsRelation
>
collectionItemsRelations
=
collectionItemsRelationDao
.
findByItemId
(
dto
.
getId
());
if
(!
CollectionUtils
.
isEmpty
(
collectionItemsRelations
)
&&
StringUtils
.
hasLength
(
dto
.
getCollectionBookId
()))
{
List
<
Long
>
collectionBookIds
=
collectionItemsRelations
.
stream
().
map
(
CollectionItemsRelation:
:
getCollectionBookId
).
collect
(
Collectors
.
toList
());
if
(!
CollectionUtils
.
isEmpty
(
collectionItemsRelations
)
&&
StringUtils
.
hasLength
(
dto
.
getCollectionBookId
()))
{
List
<
String
>
newLinkIds
=
StringUtils
.
stringToList
(
dto
.
getCollectionBookId
(),
";"
);
collectionBookIds
.
forEach
(
id
->
{
//新选的标签中不包含原来的数据,说明该标签和商品的关联关系取消
...
...
@@ -633,6 +633,14 @@ public class SupplierItemServiceImpl implements SupplierItemService {
collectionItemsRelationDao
.
delete
(
deleteDto
);
}
});
}
else
if
(
StringUtils
.
isEmpty
(
dto
.
getCollectionBookId
())
&&
!
CollectionUtils
.
isEmpty
(
collectionBookIds
))
{
//取消所有的标签关联
collectionBookIds
.
forEach
(
id
->
{
CollectionItemsRelationRequestDto
deleteDto
=
new
CollectionItemsRelationRequestDto
();
deleteDto
.
setCollectionBookId
(
id
);
deleteDto
.
setItemId
(
dto
.
getId
());
collectionItemsRelationDao
.
delete
(
deleteDto
);
});
}
return
Result
.
success
();
}
catch
(
Exception
e
)
{
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/distribution/DistributionOrderService.java
View file @
2ce031c5
...
...
@@ -21,6 +21,15 @@ public interface DistributionOrderService {
Result
createAuctionOrder
(
DistributionOrderRequestDto
dto
);
/**
* 创建藏品一口价订单
* @param dto
* @return
*/
Result
createCollectionOrder
(
DistributionOrderRequestDto
dto
);
/**
* 拍卖订单付款,先调用微信预支付接口,再拿prepay_id获取支付参数返回前端
* @param dto
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/distribution/DistributionOrderController.java
View file @
2ce031c5
...
...
@@ -61,6 +61,20 @@ public class DistributionOrderController {
}
@ApiOperation
(
value
=
"购买用户藏品下单,尚未付款"
)
@PostMapping
(
"/createCollectionOrder"
)
public
Result
createCollectionOrder
(
@RequestBody
DistributionOrderRequestDto
dto
)
{
logger
.
info
(
"购买用户藏品下单,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
Validator
validator
=
new
Validator
(
FormHandler
.
ofEntity
(
dto
));
validator
.
set
(
"itemId"
,
"商品id"
).
must
().
number
()
.
end
();
if
(!
validator
.
isValid
())
{
return
Result
.
failed
(
validator
.
getErrorInfo
());
}
return
distributionOrderService
.
createCollectionOrder
(
dto
);
}
@ApiOperation
(
value
=
"拍卖分销单付款,预下单并获取支付参数"
)
@PostMapping
(
"/auctionPay"
)
public
Result
auctionPay
(
@RequestBody
DistributionOrderRequestDto
dto
)
{
...
...
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