Toggle navigation
Toggle navigation
This project
Loading...
Sign in
YOHOBUY
/
yohobuy-union
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
csgyoho
7 years ago
Commit
6331585904beaaf626ef6aec469b5bddcba9d755
1 parent
cedff572
channelType功能
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
617 additions
and
178 deletions
dal/src/main/java/com/yoho/unions/dal/IMktMarketingUrlDAO.java
dal/src/main/java/com/yoho/unions/dal/IOrdersMapper.java
dal/src/main/java/com/yoho/unions/dal/IUserOrdersDAO.java
dal/src/main/java/com/yoho/unions/dal/OrdersAccessOryMapper.java
dal/src/main/java/com/yoho/unions/dal/OrdersCouponsMapper.java
dal/src/main/java/com/yoho/unions/dal/UnionShareOrdersMapper.java
dal/src/main/java/com/yoho/unions/dal/UnionShareUserMapper.java
dal/src/main/java/com/yoho/unions/dal/model/UserOrderDatailBO.java
dal/src/main/resources/META-INF/mybatis/MktMarketingUrlMapper.xml
dal/src/main/resources/META-INF/mybatis/UnionShareOrdersMapper.xml
dal/src/main/resources/META-INF/mybatis/UserOrdersMapper.xml
dal/src/main/resources/META-INF/mybatis/unionShareUserMapper.xml
server/src/main/java/com/yoho/unions/server/restapi/UnionRest.java
server/src/main/java/com/yoho/unions/server/restapi/UnionShareRest.java
server/src/main/java/com/yoho/unions/server/service/IUnionShareService.java
server/src/main/java/com/yoho/unions/server/service/impl/UnionShareServiceImpl.java
server/src/main/java/com/yoho/unions/server/service/impl/UserOrdersServiceImpl.java
web/src/main/webapp/html/reportform/shareUserOrders.html
web/src/main/webapp/html/reportform/userOrders.html
dal/src/main/java/com/yoho/unions/dal/IMktMarketingUrlDAO.java
View file @
6331585
...
...
@@ -13,5 +13,7 @@ public interface IMktMarketingUrlDAO {
MktMarketingUrl
selectByName
(
String
name
);
List
<
Long
>
listUnionTypes
(
@Param
(
"unionType"
)
String
unionType
,
@Param
(
"name"
)
String
name
,
@Param
(
"channelType"
)
String
channelType
);
List
<
Long
>
selectUnionTypes
(
@Param
(
"unionType"
)
Long
unionType
,
@Param
(
"name"
)
String
name
,
@Param
(
"channelType"
)
String
channelType
);
Long
selectByNameAndUnionType
(
@Param
(
"name"
)
String
name
,
@Param
(
"unionType"
)
Long
unionType
);
}
\ No newline at end of file
...
...
dal/src/main/java/com/yoho/unions/dal/IOrdersMapper.java
View file @
6331585
...
...
@@ -13,7 +13,7 @@ public interface IOrdersMapper {
List
<
Orders
>
selectByOrderCode
(
@Param
(
"orderCode"
)
long
orderCode
);
List
<
Orders
>
selectByOrderCodeList
(
@Param
(
"list"
)
L
ist
<
Long
>
list
);
List
<
Orders
>
selectByOrderCodeList
(
@Param
(
"list"
)
L
ong
[]
list
);
/**
* 查询某用户一段时间以来的已交寄订单
...
...
dal/src/main/java/com/yoho/unions/dal/IUserOrdersDAO.java
View file @
6331585
...
...
@@ -35,7 +35,7 @@ public interface IUserOrdersDAO {
*/
List
<
UserOrders
>
getExistOrderCodes
(
@Param
(
"list"
)
Set
<
String
>
list
);
int
selectCount
(
@Param
(
"beginTime"
)
int
beginTime
,
@Param
(
"endTime"
)
int
endTime
,
@Param
(
"orderCode"
)
String
orderCode
,
@Param
(
"unionId
s"
)
List
<
Long
>
unionIds
,
@Param
(
"idList"
)
List
<
String
>
idList
);
int
selectCount
(
@Param
(
"beginTime"
)
int
beginTime
,
@Param
(
"endTime"
)
int
endTime
,
@Param
(
"orderCode"
)
String
orderCode
,
@Param
(
"unionId
"
)
String
unionId
,
@Param
(
"idList"
)
List
<
String
>
idList
);
List
<
UserOrders
>
selectUserOrderList
(
@Param
(
"beginTime"
)
int
beginTime
,
@Param
(
"endTime"
)
int
endTime
,
@Param
(
"orderCode"
)
String
orderCode
,
@Param
(
"unionId
s"
)
List
<
Long
>
unionIds
,
@Param
(
"idList"
)
List
<
String
>
idList
,
@Param
(
"startIndex"
)
int
startIndex
,
@Param
(
"pageSize"
)
int
pageSize
);
List
<
UserOrders
>
selectUserOrderList
(
@Param
(
"beginTime"
)
int
beginTime
,
@Param
(
"endTime"
)
int
endTime
,
@Param
(
"orderCode"
)
String
orderCode
,
@Param
(
"unionId
"
)
String
unionId
,
@Param
(
"idList"
)
List
<
String
>
idList
,
@Param
(
"startIndex"
)
int
startIndex
,
@Param
(
"pageSize"
)
int
pageSize
);
}
\ No newline at end of file
...
...
dal/src/main/java/com/yoho/unions/dal/OrdersAccessOryMapper.java
View file @
6331585
...
...
@@ -5,11 +5,10 @@ import com.yoho.unions.dal.model.OrdersAccessOry;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Set
;
public
interface
OrdersAccessOryMapper
{
OrdersAccessOry
selectByPrimaryKey
(
Long
orderCode
);
List
<
OrdersAccessOry
>
selectByOrderCodeList
(
@Param
(
"list"
)
L
ist
<
Long
>
orderCode
);
List
<
OrdersAccessOry
>
selectByOrderCodeList
(
@Param
(
"list"
)
L
ong
[]
orderCode
);
}
\ No newline at end of file
...
...
dal/src/main/java/com/yoho/unions/dal/OrdersCouponsMapper.java
View file @
6331585
...
...
@@ -5,12 +5,11 @@ import com.yoho.unions.dal.model.OrdersCoupons;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Set
;
public
interface
OrdersCouponsMapper
{
OrdersCoupons
selectByOrderCode
(
Long
orderCode
);
List
<
OrdersCoupons
>
selectByOrderCodeList
(
@Param
(
"list"
)
L
ist
<
Long
>
orderCode
);
List
<
OrdersCoupons
>
selectByOrderCodeList
(
@Param
(
"list"
)
L
ong
[]
orderCode
);
}
\ No newline at end of file
...
...
dal/src/main/java/com/yoho/unions/dal/UnionShareOrdersMapper.java
View file @
6331585
package
com
.
yoho
.
unions
.
dal
;
import
com.yoho.unions.dal.model.UnionShareOrders
;
import
org.apache.ibatis.annotations.MapKey
;
import
org.apache.ibatis.annotations.Param
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.Map
;
public
interface
UnionShareOrdersMapper
{
int
deleteByPrimaryKey
(
Integer
id
);
...
...
@@ -17,6 +19,11 @@ public interface UnionShareOrdersMapper {
UnionShareOrders
selectByCode
(
String
orderCode
);
int
selectCountByUids
(
@Param
(
"beginTime"
)
int
beginTime
,
@Param
(
"endTime"
)
int
endTime
,
@Param
(
"uids"
)
List
<
Integer
>
uids
);
@MapKey
(
"orderCode"
)
Map
<
String
,
UnionShareOrders
>
selectListByUids
(
@Param
(
"beginTime"
)
int
beginTime
,
@Param
(
"endTime"
)
int
endTime
,
@Param
(
"uids"
)
List
<
Integer
>
uids
,
@Param
(
"startIndex"
)
int
startIndex
,
@Param
(
"pageSize"
)
int
pageSize
);
int
selectCountByCondition
(
@Param
(
"promoteUid"
)
int
promoteUid
,
@Param
(
"status"
)
String
status
);
BigDecimal
selectAmountByStatus
(
@Param
(
"promoteUid"
)
int
promoteUid
,
@Param
(
"statusList"
)
List
<
String
>
statusList
);
...
...
dal/src/main/java/com/yoho/unions/dal/UnionShareUserMapper.java
View file @
6331585
package
com
.
yoho
.
unions
.
dal
;
import
com.yoho.unions.dal.model.UnionShareUser
;
import
org.apache.ibatis.annotations.MapKey
;
import
java.util.List
;
import
java.util.Map
;
public
interface
UnionShareUserMapper
{
int
deleteByPrimaryKey
(
Integer
id
);
...
...
@@ -18,4 +22,9 @@ public interface UnionShareUserMapper {
int
updateByPrimaryKeySelective
(
UnionShareUser
record
);
int
updateByPrimaryKey
(
UnionShareUser
record
);
List
<
Integer
>
selectUids
(
List
<
Long
>
unionTypes
);
@MapKey
(
"uid"
)
Map
<
Integer
,
UnionShareUser
>
selectByUids
(
List
<
Integer
>
uids
);
}
\ No newline at end of file
...
...
dal/src/main/java/com/yoho/unions/dal/model/UserOrderDatailBO.java
View file @
6331585
...
...
@@ -13,16 +13,6 @@ public class UserOrderDatailBO extends BaseBO {
private
String
unionName
;
private
Integer
channelType
;
public
Integer
getChannelType
()
{
return
channelType
;
}
public
void
setChannelType
(
Integer
channelType
)
{
this
.
channelType
=
channelType
;
}
public
Long
getOrderCode
()
{
return
orderCode
;
}
...
...
dal/src/main/resources/META-INF/mybatis/MktMarketingUrlMapper.xml
View file @
6331585
...
...
@@ -38,7 +38,7 @@
delete from mkt_marketing_url
where union_type = #{unionType,jdbcType=BIGINT}
</delete>
<select
id=
"
lis
tUnionTypes"
resultType=
"long"
>
<select
id=
"
selec
tUnionTypes"
resultType=
"long"
>
select union_type from mkt_marketing_url where
1=1
<if
test=
"unionType!=null"
>
...
...
@@ -51,4 +51,14 @@
and channel_type=#{channelType}
</if>
</select>
<select
id=
"selectByNameAndUnionType"
resultType=
"Long"
>
select union_type from mkt_marketing_url where 1=1
<if
test=
"unionType!=null"
>
and union_type=#{unionType}
</if>
<if
test=
"name!=null"
>
and name=#{name}
</if>
limit 1
</select>
</mapper>
\ No newline at end of file
...
...
dal/src/main/resources/META-INF/mybatis/UnionShareOrdersMapper.xml
View file @
6331585
...
...
@@ -181,6 +181,38 @@
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<select
id=
"selectCountByUids"
resultType=
"int"
>
select count(*) from union_share_orders where 1=1
<if
test=
"uids!=null and uids.size()>0"
>
and promote_uid in
<foreach
collection=
"uids"
open=
"("
close=
")"
item=
"uid"
separator=
","
>
#{uid}
</foreach>
</if>
<if
test=
"beginTime != 0"
>
and create_time
>
#{beginTime}
</if>
<if
test=
"endTime != 0"
>
and create_time
<
#{endTime}
</if>
</select>
<select
id=
"selectListByUids"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from union_share_orders where 1=1
<if
test=
"uids!=null and uids.size()>0"
>
and promote_uid in
<foreach
collection=
"uids"
open=
"("
close=
")"
item=
"uid"
separator=
","
>
#{uid}
</foreach>
</if>
<if
test=
"beginTime != 0"
>
and create_time
>
#{beginTime}
</if>
<if
test=
"endTime != 0"
>
and create_time
<
#{endTime}
</if>
order BY create_time desc
limit #{startIndex},#{pageSize}
</select>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.yoho.unions.dal.model.UnionShareOrders"
>
update union_share_orders
set order_code = #{orderCode,jdbcType=VARCHAR},
...
...
dal/src/main/resources/META-INF/mybatis/UserOrdersMapper.xml
View file @
6331585
...
...
@@ -352,11 +352,8 @@
<if
test=
"orderCode != 0"
>
and order_code = #{orderCode}
</if>
<if
test=
"unionIds != null and unionIds.size>0"
>
and uid in
<foreach
item=
"item"
index=
"index"
collection=
"unionIds"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
<if
test=
"unionId != null"
>
and uid = #{unionId}
</if>
<if
test=
"beginTime != 0"
>
and create_time
>
#{beginTime}
...
...
@@ -380,11 +377,8 @@
<if
test=
"orderCode != 0"
>
and order_code = #{orderCode}
</if>
<if
test=
"unionIds != null and unionIds.size>0"
>
and uid in
<foreach
item=
"item"
index=
"index"
collection=
"unionIds"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
<if
test=
"unionId != null"
>
and uid = #{unionId}
</if>
<if
test=
"beginTime != 0"
>
and create_time
>
#{beginTime}
...
...
dal/src/main/resources/META-INF/mybatis/unionShareUserMapper.xml
View file @
6331585
...
...
@@ -36,6 +36,15 @@
values (#{id,jdbcType=INTEGER}, #{uid,jdbcType=INTEGER}, #{unionType,jdbcType=VARCHAR},
#{updateTime,jdbcType=INTEGER})
</insert>
<select
id=
"selectByUids"
parameterType=
"Integer"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from union_share_user
where uid in
<foreach
collection=
"uids"
open=
"("
close=
")"
item=
"uid"
separator=
","
>
#{uid}
</foreach>
</select>
<insert
id=
"insertSelective"
parameterType=
"com.yoho.unions.dal.model.UnionShareUser"
>
insert into union_share_user
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
...
...
@@ -82,6 +91,12 @@
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<select
id=
"selectUids"
parameterType=
"Long"
>
select uid from union_share_user where union_type in
<foreach
collection=
"unionTypes"
open=
"("
close=
")"
item=
"unionType"
separator=
","
>
#{unionType}
</foreach>
</select>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.yoho.unions.dal.model.UnionShareUser"
>
update union_share_user
set uid = #{uid,jdbcType=INTEGER},
...
...
server/src/main/java/com/yoho/unions/server/restapi/UnionRest.java
View file @
6331585
package
com
.
yoho
.
unions
.
server
.
restapi
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yoho.service.model.union.request.ActiveUnionRequestBO
;
import
com.yoho.service.model.union.request.AddUnionRequestBO
;
import
com.yoho.service.model.union.request.ClickUnionRequestBO
;
import
com.yoho.service.model.union.request.UnionOrderReqBO
;
import
com.yoho.service.model.union.response.ActiveUnionResponseBO
;
import
com.yoho.service.model.union.response.PageUnionOrderRspBO
;
import
com.yoho.service.model.union.response.UnionResponse
;
import
com.yoho.service.model.union.response.UnionResponseBO
;
...
...
@@ -128,4 +124,5 @@ public class UnionRest {
return
new
ApiResponse
.
ApiResponseBuilder
().
code
(
500
).
message
(
"失败"
).
build
();
}
}
}
...
...
server/src/main/java/com/yoho/unions/server/restapi/UnionShareRest.java
View file @
6331585
package
com
.
yoho
.
unions
.
server
.
restapi
;
import
com.yoho.service.model.union.bo.ShareUserSettlementInfoBo
;
import
com.yoho.service.model.union.request.UnionShareOrderReqBO
;
import
com.yoho.service.model.union.response.PageUnionShareOrderRspBO
;
import
com.yoho.service.model.union.response.UnionResponse
;
import
com.yoho.unions.common.ApiResponse
;
import
com.yoho.unions.server.service.IUnionShareService
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -38,4 +41,20 @@ public class UnionShareRest {
unionShareService
.
addSettlement
(
uid
);
return
new
UnionResponse
(
200
,
"addSettlement success"
,
null
);
}
@RequestMapping
(
"/queryUnionShareOrders"
)
@ResponseBody
public
ApiResponse
queryUnionShareOrders
(
UnionShareOrderSearchReqBO
reqBO
){
log
.
info
(
"enter queryUnionShareOrders. param UnionShareOrderReqBO={}"
,
reqBO
);
if
(
reqBO
==
null
){
return
new
ApiResponse
.
ApiResponseBuilder
().
code
(
500
).
message
(
"缺少参数"
).
build
();
}
try
{
PageUnionShareOrderRspBO
unionOrderRspBO
=
unionShareService
.
queryUnionShareOrders
(
reqBO
);
return
new
ApiResponse
.
ApiResponseBuilder
().
code
(
200
).
message
(
"查询共享联盟订单"
).
data
(
unionOrderRspBO
).
build
();
}
catch
(
Exception
e
){
log
.
warn
(
"queryUnionShareOrders error exception is {}"
,
e
);
return
new
ApiResponse
.
ApiResponseBuilder
().
code
(
500
).
message
(
"失败"
).
build
();
}
}
}
...
...
server/src/main/java/com/yoho/unions/server/service/IUnionShareService.java
View file @
6331585
...
...
@@ -3,6 +3,8 @@ package com.yoho.unions.server.service;
import
com.yoho.service.model.union.bo.ShareOrderBo
;
import
com.yoho.service.model.union.bo.ShareSettlementBo
;
import
com.yoho.service.model.union.bo.ShareUserSettlementInfoBo
;
import
com.yoho.service.model.union.request.UnionShareOrderReqBO
;
import
com.yoho.service.model.union.response.PageUnionShareOrderRspBO
;
/**
* 联盟红人推广返利
...
...
@@ -15,6 +17,7 @@ public interface IUnionShareService {
*/
void
saveOrUpdateOrder
(
ShareOrderBo
bo
);
PageUnionShareOrderRspBO
queryUnionShareOrders
(
UnionShareOrderReqBO
reqBO
);
/**
* 提现结算单状态变更
* */
...
...
server/src/main/java/com/yoho/unions/server/service/impl/UnionShareServiceImpl.java
View file @
6331585
package
com
.
yoho
.
unions
.
server
.
service
.
impl
;
import
com.google.common.base.Function
;
import
com.google.common.collect.Maps
;
import
com.yoho.core.config.ConfigReader
;
import
com.yoho.core.rabbitmq.YhProducer
;
import
com.yoho.service.model.union.bo.ShareOrderBo
;
import
com.yoho.service.model.union.bo.ShareSettlementBo
;
import
com.yoho.service.model.union.bo.ShareUserSettlementInfoBo
;
import
com.yoho.unions.common.enums.NewUserEnum
;
import
com.yoho.unions.common.enums.OrderStatusEnum
;
import
com.yoho.unions.common.enums.ShareOrdersKeyEnum
;
import
com.yoho.unions.common.enums.ShareOrdersStatusEnum
;
import
com.yoho.unions.common.redis.RedisHashCache
;
import
com.yoho.unions.common.redis.RedisValueCache
;
import
com.yoho.unions.common.utils.DateUtil
;
import
com.yoho.unions.common.utils.RandomUtil
;
import
com.yoho.unions.dal.*
;
import
com.yoho.unions.dal.model.UnionShareOrders
;
import
com.yoho.unions.dal.model.UnionShareOrdersProduct
;
import
com.yoho.unions.dal.model.UnionShareSettlement
;
import
com.yoho.unions.dal.model.*
;
import
com.yoho.unions.server.service.IUnionShareService
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeanUtils
;
...
...
@@ -45,10 +49,12 @@ public class UnionShareServiceImpl implements IUnionShareService {
private
UnionShareSettlementMapper
unionShareSettlementMapper
;
@Autowired
private
UnionShareUserMapper
unionShareUserMapper
;
@Autowired
IMktMarketingUrlDAO
mktMarketingUrlDAO
;
@Resource
RedisValueCache
redisValueCache
;
@Resource
(
name
=
"yhProducer"
)
private
YhProducer
yhProducer
;
@Resource
(
name
=
"core-config-reader"
)
private
ConfigReader
configReader
;
...
...
@@ -86,6 +92,88 @@ public class UnionShareServiceImpl implements IUnionShareService {
return
result
;
}
@Override
public
PageUnionShareOrderRspBO
queryUnionShareOrders
(
UnionShareOrderSearchReqBO
reqBO
){
logger
.
info
(
"queryUnionShareOrders param is {}"
,
reqBO
);
int
beginTime
=
StringUtils
.
isBlank
(
reqBO
.
getBeginTime
())
?
0
:
Integer
.
parseInt
(
reqBO
.
getBeginTime
());
int
endTime
=
StringUtils
.
isBlank
(
reqBO
.
getEndTime
())
?
0
:
Integer
.
parseInt
(
reqBO
.
getEndTime
());
long
orderCode
=
StringUtils
.
isBlank
(
reqBO
.
getOrderCode
())
?
0
:
Long
.
parseLong
(
reqBO
.
getOrderCode
());
Long
unionType
=
StringUtils
.
isBlank
(
reqBO
.
getUnionId
())
?
null
:
Long
.
valueOf
(
reqBO
.
getUnionId
());
String
unionName
=
StringUtils
.
isBlank
(
reqBO
.
getUnionType
())
?
null
:
reqBO
.
getUnionType
();
String
channelType
=
reqBO
.
getChannelType
();
List
<
String
>
idList
=
reqBO
.
getIdsList
();
List
<
Long
>
unionTypes
=
null
;
if
(
unionType
!=
null
||
unionName
!=
null
||
channelType
!=
null
){
unionTypes
=
mktMarketingUrlDAO
.
selectUnionTypes
(
unionType
,
unionName
,
channelType
);
if
(
unionTypes
.
isEmpty
()){
return
null
;
}
}
List
<
Integer
>
uids
=
unionTypes
==
null
?
null
:
this
.
unionShareUserMapper
.
selectUids
(
unionTypes
);
//查询总数
int
count
=
unionShareOrdersMapper
.
selectCountByUids
(
beginTime
,
endTime
,
uids
);
logger
.
info
(
"userOrdersDAO.selectCount: size is {}"
,
count
);
if
(
count
<
1
)
{
return
null
;
}
Map
<
String
,
UnionShareOrders
>
ordersDOMap
=
this
.
unionShareOrdersMapper
.
selectListByUids
(
beginTime
,
endTime
,
uids
,
reqBO
.
getStart
(),
reqBO
.
getSize
());
Map
<
Long
,
UserOrderDatailBO
>
userOrderDatailBOMap
=
initUserShareOrderDatails
(
ordersDOMap
);
List
<
UnionShareOrderRspBO
>
unionOrderRspBOList
=
new
ArrayList
<>(
ordersDOMap
.
size
());
for
(
UnionShareOrders
orders
:
ordersDOMap
.
values
())
{
UnionShareOrderRspBO
bo
=
initShareUnionOrderRspBO
(
orders
,
userOrderDatailBOMap
);
bo
.
setChannelType
(
Integer
.
valueOf
(
channelType
));
unionOrderRspBOList
.
add
(
bo
);
}
PageUnionShareOrderRspBO
pageUnionOrderRspBO
=
new
PageUnionShareOrderRspBO
();
pageUnionOrderRspBO
.
setList
(
unionOrderRspBOList
);
pageUnionOrderRspBO
.
setTotal
(
count
);
pageUnionOrderRspBO
.
setSize
(
reqBO
.
getSize
());
pageUnionOrderRspBO
.
setPage
(
reqBO
.
getPage
());
return
pageUnionOrderRspBO
;
}
private
UnionShareOrderRspBO
initShareUnionOrderRspBO
(
UnionShareOrders
orders
,
Map
<
Long
,
UserOrderDatailBO
>
userOrderDatailBOMap
){
UnionShareOrderRspBO
orderRspBO
=
new
UnionShareOrderRspBO
();
orderRspBO
.
setOrderAmount
(
orders
.
getAmount
());
orderRspBO
.
setOrderStatus
(
OrderStatusEnum
.
getNameByCode
(
orders
.
getStatus
()));
Byte
isNew
=
orders
.
getIsNew
();
orderRspBO
.
setIsNew
(
isNew
==
null
||
isNew
.
equals
(
2
)?
"N"
:
"Y"
);
orderRspBO
.
setUid
(
orders
.
getPromoteUid
());
orderRspBO
.
setOrderCode
(
Long
.
parseLong
(
orders
.
getOrderCode
()));
orderRspBO
.
setId
(
orders
.
getId
());
orderRspBO
.
setOrderTime
(
DateUtil
.
long2DateStr
(
Long
.
valueOf
(
orders
.
getCreateTime
())
*
Long
.
valueOf
(
1000
),
"yyyy-MM-dd HH:mm:ss"
));
UserOrderDatailBO
userOrderDatailBO
=
userOrderDatailBOMap
.
get
(
orders
.
getOrderCode
());
orderRspBO
.
setUnionId
(
userOrderDatailBO
.
getUnionId
());
orderRspBO
.
setUnionType
(
userOrderDatailBO
.
getUnionName
());
return
orderRspBO
;
}
private
List
<
Integer
>
getUids
(
Map
<
String
,
UnionShareOrders
>
ordersDOMap
){
List
<
Integer
>
uids
=
new
ArrayList
<>(
ordersDOMap
.
size
());
for
(
UnionShareOrders
order:
ordersDOMap
.
values
()){
uids
.
add
(
order
.
getPromoteUid
());
}
return
uids
;
}
private
Map
<
Long
,
UserOrderDatailBO
>
initUserShareOrderDatails
(
Map
<
String
,
UnionShareOrders
>
ordersDOMap
){
Map
<
Long
,
UserOrderDatailBO
>
userOrderDatailBOMap
=
new
HashMap
<>(
ordersDOMap
.
size
());
Map
<
Integer
,
UnionShareUser
>
userMap
=
unionShareUserMapper
.
selectByUids
(
getUids
(
ordersDOMap
));
for
(
UnionShareOrders
userOrders
:
ordersDOMap
.
values
())
{
String
unionType
=
userMap
.
get
(
userOrders
.
getPromoteUid
()).
getUnionType
();
UserOrderDatailBO
userOrderDatailBO
=
new
UserOrderDatailBO
();
userOrderDatailBO
.
setUnionId
(
unionType
);
MktMarketingUrl
mktMarketingUrl
=
redisValueCache
.
get
(
"yh:union:uniontype:"
+
unionType
,
MktMarketingUrl
.
class
);
if
(
mktMarketingUrl
==
null
)
{
mktMarketingUrl
=
mktMarketingUrlDAO
.
selectByPrimaryKey
(
Long
.
valueOf
(
unionType
));
redisValueCache
.
set
(
"yh:union:uniontype:"
+
unionType
,
mktMarketingUrl
,
1
,
TimeUnit
.
HOURS
);
}
if
(
mktMarketingUrl
!=
null
)
{
userOrderDatailBO
.
setUnionName
(
mktMarketingUrl
.
getName
());
}
userOrderDatailBO
.
setOrderCode
(
Long
.
valueOf
(
userOrders
.
getOrderCode
()));
userOrderDatailBOMap
.
put
(
userOrderDatailBO
.
getOrderCode
(),
userOrderDatailBO
);
}
return
userOrderDatailBOMap
;
}
/**
* 订单插入或更新
*/
...
...
server/src/main/java/com/yoho/unions/server/service/impl/UserOrdersServiceImpl.java
View file @
6331585
...
...
@@ -26,7 +26,10 @@ import org.springframework.stereotype.Service;
import
javax.annotation.Resource
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
/**
...
...
@@ -55,41 +58,8 @@ public class UserOrdersServiceImpl implements IUserOrdersService,IBusinessExport
@Resource
RedisValueCache
redisValueCache
;
public
PageUnionOrderRspBO
queryUnionOrders
(
UnionOrderReqBO
reqBO
)
{
logger
.
info
(
"queryUnionOrders param is {}"
,
reqBO
);
int
beginTime
=
StringUtils
.
isBlank
(
reqBO
.
getBeginTime
())
?
0
:
Integer
.
valueOf
(
reqBO
.
getBeginTime
());
int
endTime
=
StringUtils
.
isBlank
(
reqBO
.
getEndTime
())
?
0
:
Integer
.
valueOf
(
reqBO
.
getEndTime
());
long
orderCode
=
StringUtils
.
isBlank
(
reqBO
.
getOrderCode
())
?
0
:
Long
.
valueOf
(
reqBO
.
getOrderCode
());
String
unionId
=
StringUtils
.
isBlank
(
reqBO
.
getUnionId
())
?
null
:
reqBO
.
getUnionId
();
String
unionType
=
StringUtils
.
isBlank
(
reqBO
.
getUnionType
())
?
null
:
reqBO
.
getUnionType
();
String
channelType
=
StringUtils
.
isBlank
(
reqBO
.
getChannelType
())
?
null
:
reqBO
.
getChannelType
();
List
<
String
>
idList
=
new
ArrayList
<>();
if
(
StringUtils
.
isNotBlank
(
reqBO
.
getIds
()))
{
String
[]
ids
=
StringUtils
.
isBlank
(
reqBO
.
getIds
())
?
null
:
reqBO
.
getIds
().
split
(
","
);
idList
=
Arrays
.
asList
(
ids
);
}
List
<
Long
>
unionTypes
=
null
;
if
(
unionId
!=
null
||
unionType
!=
null
||
channelType
!=
null
){
unionTypes
=
this
.
mktMarketingUrlDAO
.
listUnionTypes
(
unionId
,
unionType
,
channelType
);
if
(
unionTypes
.
isEmpty
())
{
return
null
;
}
}
//查询总数
int
count
=
userOrdersDAO
.
selectCount
(
beginTime
,
endTime
,
String
.
valueOf
(
orderCode
),
unionTypes
,
idList
);
logger
.
info
(
"userOrdersDAO.selectCount: size is {}"
,
count
);
List
<
UserOrders
>
userOrdersList
=
new
ArrayList
<>();
List
<
UnionOrderRspBO
>
unionOrderRspBOList
=
new
ArrayList
<>();
if
(
count
<
1
)
{
return
null
;
}
if
(
count
>
0
)
{
userOrdersList
=
userOrdersDAO
.
selectUserOrderList
(
beginTime
,
endTime
,
String
.
valueOf
(
orderCode
),
unionTypes
,
idList
,
reqBO
.
getStart
(),
reqBO
.
getSize
());
}
List
<
OrdersDetailBO
>
ordersDetailBOList
=
new
ArrayList
<>();
List
<
Long
>
orderCodeList
=
new
ArrayList
<>();
List
<
UserOrderDatailBO
>
userOrderDatailBOList
=
new
ArrayList
<>();
private
List
<
UserOrderDatailBO
>
initUserOrderDatails
(
List
<
UserOrders
>
userOrdersList
){
List
<
UserOrderDatailBO
>
userOrderDatailBOList
=
new
ArrayList
<>(
userOrdersList
.
size
());
for
(
UserOrders
userOrders
:
userOrdersList
)
{
//根据查询出来的uid,ordercode,查询ERP_ORDERS.Orders
UserOrderDatailBO
userOrderDatailBO
=
new
UserOrderDatailBO
();
...
...
@@ -101,12 +71,54 @@ public class UserOrdersServiceImpl implements IUserOrdersService,IBusinessExport
}
if
(
mktMarketingUrl
!=
null
)
{
userOrderDatailBO
.
setUnionName
(
mktMarketingUrl
.
getName
());
userOrderDatailBO
.
setChannelType
(
mktMarketingUrl
.
getChannelType
());
}
userOrderDatailBO
.
setOrderCode
(
Long
.
valueOf
(
userOrders
.
getOrderCode
()));
userOrderDatailBOList
.
add
(
userOrderDatailBO
);
orderCodeList
.
add
(
Long
.
valueOf
(
userOrders
.
getOrderCode
()));
}
return
userOrderDatailBOList
;
}
private
Map
<
Long
,
OrdersCoupons
>
initOrdersCoupons
(
Long
[]
subOrderCodeArr
){
List
<
OrdersCoupons
>
ordersCouponsList
=
ordersCouponsMapper
.
selectByOrderCodeList
(
subOrderCodeArr
);
Map
<
Long
,
OrdersCoupons
>
couponsMap
=
new
HashMap
<
Long
,
OrdersCoupons
>(
ordersCouponsList
.
size
());
for
(
OrdersCoupons
coupon
:
ordersCouponsList
)
{
try
{
OrdersCoupons
c
=
couponsMap
.
get
(
coupon
.
getOrderCode
());
if
(
c
==
null
)
{
couponsMap
.
put
(
coupon
.
getOrderCode
(),
coupon
);
}
else
{
c
.
setCouponAmount
(
c
.
getCouponAmount
().
add
(
coupon
.
getCouponAmount
()));
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"set OrdersCoupons error :"
,
e
);
}
}
return
couponsMap
;
}
public
PageUnionOrderRspBO
queryUnionOrders
(
UnionOrderReqBO
reqBO
)
{
logger
.
info
(
"queryUnionOrders param is {}"
,
reqBO
);
int
beginTime
=
StringUtils
.
isBlank
(
reqBO
.
getBeginTime
())
?
0
:
Integer
.
parseInt
(
reqBO
.
getBeginTime
());
int
endTime
=
StringUtils
.
isBlank
(
reqBO
.
getEndTime
())
?
0
:
Integer
.
parseInt
(
reqBO
.
getEndTime
());
long
orderCode
=
StringUtils
.
isBlank
(
reqBO
.
getOrderCode
())
?
0
:
Long
.
parseLong
(
reqBO
.
getOrderCode
());
Long
unionType
=
StringUtils
.
isBlank
(
reqBO
.
getUnionId
())
?
null
:
Long
.
valueOf
(
reqBO
.
getUnionId
());
String
unionName
=
StringUtils
.
isBlank
(
reqBO
.
getUnionType
())
?
null
:
reqBO
.
getUnionType
();
List
<
String
>
idList
=
reqBO
.
getIdsList
();
if
(
unionType
!=
null
||
unionName
!=
null
){
unionType
=
mktMarketingUrlDAO
.
selectByNameAndUnionType
(
unionName
,
unionType
);
if
(
unionType
==
null
){
return
null
;
}
}
//查询总数
int
count
=
userOrdersDAO
.
selectCount
(
beginTime
,
endTime
,
String
.
valueOf
(
orderCode
),
null
==
unionType
?
null
:
unionType
.
toString
(),
idList
);
logger
.
info
(
"userOrdersDAO.selectCount: size is {}"
,
count
);
if
(
count
<
1
)
{
return
null
;
}
List
<
UserOrders
>
userOrdersList
=
userOrdersDAO
.
selectUserOrderList
(
beginTime
,
endTime
,
String
.
valueOf
(
orderCode
),
null
==
unionType
?
null
:
unionType
.
toString
(),
idList
,
reqBO
.
getStart
(),
reqBO
.
getSize
());
List
<
UserOrderDatailBO
>
userOrderDatailBOList
=
initUserOrderDatails
(
userOrdersList
);
Map
<
Long
,
UserOrderDatailBO
>
userOrderDatailBOMap
=
Maps
.
uniqueIndex
(
userOrderDatailBOList
,
new
Function
<
UserOrderDatailBO
,
Long
>()
{
@Override
public
Long
apply
(
UserOrderDatailBO
userOrderDatailBO
)
{
...
...
@@ -114,44 +126,17 @@ public class UserOrdersServiceImpl implements IUserOrdersService,IBusinessExport
}
});
//批量查询erp_orders.orders表
List
<
Orders
>
ordersList
=
ordersMapper
.
selectByOrderCodeList
(
orderCodeList
);
Long
[]
orderCodes
=
userOrderDatailBOMap
.
keySet
().
toArray
(
new
Long
[
0
]);
List
<
Orders
>
ordersList
=
ordersMapper
.
selectByOrderCodeList
(
orderCodes
);
Map
<
Long
,
Orders
>
ordersMap
=
Maps
.
uniqueIndex
(
ordersList
,
new
Function
<
Orders
,
Long
>()
{
@Override
public
Long
apply
(
Orders
orders
)
{
return
orders
.
getOrderCode
();
}
});
List
<
Long
>
subOrderCodeList
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
Long
,
Orders
>
map
:
ordersMap
.
entrySet
())
{
OrdersDetailBO
ordersDetailBO
=
new
OrdersDetailBO
();
Orders
orders
=
map
.
getValue
();
ordersDetailBO
.
setOrders
(
orders
);
subOrderCodeList
.
add
(
map
.
getKey
());
ordersDetailBOList
.
add
(
ordersDetailBO
);
}
Long
[]
subOrderCodeList
=
ordersMap
.
keySet
().
toArray
(
new
Long
[
0
]);
//批量查询优惠券金额
List
<
OrdersCoupons
>
ordersCouponsList
=
ordersCouponsMapper
.
selectByOrderCodeList
(
subOrderCodeList
);
/*Map<Long, OrdersCoupons> couponsMap = Maps.uniqueIndex(ordersCouponsList, new Function<OrdersCoupons, Long>() {
@Override
public Long apply(OrdersCoupons ordersCoupons) {
return ordersCoupons.getOrderCode();
}
});*/
Map
<
Long
,
OrdersCoupons
>
couponsMap
=
new
HashMap
<
Long
,
OrdersCoupons
>();
for
(
OrdersCoupons
coupon
:
ordersCouponsList
)
{
try
{
OrdersCoupons
c
=
couponsMap
.
get
(
coupon
.
getOrderCode
());
if
(
c
==
null
)
{
couponsMap
.
put
(
coupon
.
getOrderCode
(),
coupon
);
}
else
{
c
.
setCouponAmount
(
c
.
getCouponAmount
().
add
(
coupon
.
getCouponAmount
()));
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"set OrdersCoupons error :"
,
e
);
}
}
Map
<
Long
,
OrdersCoupons
>
couponsMap
=
initOrdersCoupons
(
subOrderCodeList
);
//批量查询是否新客
List
<
OrdersAccessOry
>
ordersAccessOryList
=
ordersAccessOryMapper
.
selectByOrderCodeList
(
subOrderCodeList
);
Map
<
Long
,
OrdersAccessOry
>
ordersAccessOryMap
=
Maps
.
uniqueIndex
(
ordersAccessOryList
,
new
Function
<
OrdersAccessOry
,
Long
>()
{
...
...
@@ -160,56 +145,9 @@ public class UserOrdersServiceImpl implements IUserOrdersService,IBusinessExport
return
ordersAccessOry
.
getOrderCode
();
}
});
for
(
OrdersDetailBO
ordersDetailBO
:
ordersDetailBOList
)
{
Orders
orders
=
ordersDetailBO
.
getOrders
();
UnionOrderRspBO
orderRspBO
=
new
UnionOrderRspBO
();
//优惠券金额
OrdersCoupons
ordersCoupons
=
couponsMap
.
get
(
orders
.
getOrderCode
());
if
(
null
!=
ordersCoupons
)
{
orderRspBO
.
setCouponAmount
(
ordersCoupons
.
getCouponAmount
());
}
else
{
orderRspBO
.
setCouponAmount
(
new
BigDecimal
(
0
));
}
//防止订单数据没有在ERP中
//订单金额
orderRspBO
.
setOrderAmount
(
orders
.
getOrderAmount
());
orderRspBO
.
setYohoCoinNum
(
orders
.
getYohoCoinNum
());
//礼品卡抵运费--数据较少,暂时就用单个查询把
BigDecimal
pay_shipping_amount
=
ordersGiftCardMapper
.
selectPayShippingAmount
(
Long
.
valueOf
(
orders
.
getOrderCode
()));
// 免邮券--数据较少,暂时就用单个查询把
BigDecimal
coupon_amount
=
ordersFreightCouponsMapper
.
selectCouponAmount
(
Long
.
valueOf
(
orders
.
getOrderCode
()));
//运费
BigDecimal
realShipmentAmount
=
orders
.
getShippingCost
().
subtract
(
pay_shipping_amount
).
subtract
(
coupon_amount
);
orderRspBO
.
setShipmentAmount
(
realShipmentAmount
);
//实际支付金额
orderRspBO
.
setRealPayAmount
(
orders
.
getLastOrderAmount
().
subtract
(
realShipmentAmount
));
//订单状态
orderRspBO
.
setOrderStatus
(
OrderStatusEnum
.
getNameByCode
(
String
.
valueOf
(
orders
.
getOrderStatus
())));
//附加信息
orderRspBO
.
setExetInfmoation
(
orders
.
getRemark
());
//支付方式
orderRspBO
.
setPayChannel
(
PaymentTypeEnum
.
getNameByCode
(
String
.
valueOf
(
orders
.
getPaymentType
())));
//是否新客---从新的表中获取
OrdersAccessOry
ordersAccessOry
=
ordersAccessOryMap
.
get
(
orders
.
getOrderCode
());
if
(
null
!=
ordersAccessOry
)
{
orderRspBO
.
setIsNew
(
NewUserEnum
.
getNameByCode
(
ordersAccessOry
.
getIsNew
()
==
null
?
"N"
:
ordersAccessOry
.
getIsNew
()));
}
else
{
orderRspBO
.
setIsNew
(
NewUserEnum
.
getNameByCode
(
"N"
));
}
orderRspBO
.
setUid
(
orders
.
getUid
());
orderRspBO
.
setOrderCode
(
orders
.
getOrderCode
());
orderRspBO
.
setId
(
orders
.
getId
());
orderRspBO
.
setOrderTime
(
DateUtil
.
long2DateStr
(
Long
.
valueOf
(
orders
.
getCreateTime
())
*
Long
.
valueOf
(
1000
),
"yyyy-MM-dd HH:mm:ss"
));
//
UserOrderDatailBO
userOrderDatailBO
=
userOrderDatailBOMap
.
get
(
orders
.
getParentOrderCode
());
orderRspBO
.
setUnionId
(
userOrderDatailBO
.
getUnionId
());
orderRspBO
.
setUnionType
(
userOrderDatailBO
.
getUnionName
());
orderRspBO
.
setChannelType
(
userOrderDatailBO
.
getChannelType
());
unionOrderRspBOList
.
add
(
orderRspBO
);
List
<
UnionOrderRspBO
>
unionOrderRspBOList
=
new
ArrayList
<>(
ordersMap
.
size
());
for
(
Orders
orders
:
ordersMap
.
values
())
{
unionOrderRspBOList
.
add
(
initUnionOrderRspBO
(
orders
,
couponsMap
,
ordersAccessOryMap
,
userOrderDatailBOMap
));
}
PageUnionOrderRspBO
pageUnionOrderRspBO
=
new
PageUnionOrderRspBO
();
pageUnionOrderRspBO
.
setList
(
unionOrderRspBOList
);
...
...
@@ -219,6 +157,46 @@ public class UserOrdersServiceImpl implements IUserOrdersService,IBusinessExport
return
pageUnionOrderRspBO
;
}
private
UnionOrderRspBO
initUnionOrderRspBO
(
Orders
orders
,
Map
<
Long
,
OrdersCoupons
>
couponsMap
,
Map
<
Long
,
OrdersAccessOry
>
ordersAccessOryMap
,
Map
<
Long
,
UserOrderDatailBO
>
userOrderDatailBOMap
){
UnionOrderRspBO
orderRspBO
=
new
UnionOrderRspBO
();
//优惠券金额
OrdersCoupons
ordersCoupons
=
couponsMap
.
get
(
orders
.
getOrderCode
());
orderRspBO
.
setCouponAmount
(
null
!=
ordersCoupons
?
ordersCoupons
.
getCouponAmount
():
new
BigDecimal
(
0
));
//防止订单数据没有在ERP中
//订单金额
orderRspBO
.
setOrderAmount
(
orders
.
getAmount
());
//礼品卡抵运费--数据较少,暂时就用单个查询把
BigDecimal
pay_shipping_amount
=
ordersGiftCardMapper
.
selectPayShippingAmount
(
Long
.
valueOf
(
orders
.
getOrderCode
()));
// 免邮券--数据较少,暂时就用单个查询把
BigDecimal
coupon_amount
=
ordersFreightCouponsMapper
.
selectCouponAmount
(
Long
.
valueOf
(
orders
.
getOrderCode
()));
//运费
BigDecimal
realShipmentAmount
=
orders
.
getShippingCost
().
subtract
(
pay_shipping_amount
).
subtract
(
coupon_amount
);
orderRspBO
.
setShipmentAmount
(
realShipmentAmount
);
//实际支付金额
orderRspBO
.
setRealPayAmount
(
orders
.
getLastOrderAmount
().
subtract
(
realShipmentAmount
));
//订单状态
orderRspBO
.
setOrderStatus
(
OrderStatusEnum
.
getNameByCode
(
String
.
valueOf
(
orders
.
getOrderStatus
())));
//附加信息
orderRspBO
.
setExetInfmoation
(
orders
.
getRemark
());
//支付方式
orderRspBO
.
setPayChannel
(
PaymentTypeEnum
.
getNameByCode
(
String
.
valueOf
(
orders
.
getPaymentType
())));
//是否新客---从新的表中获取
OrdersAccessOry
ordersAccessOry
=
ordersAccessOryMap
.
get
(
orders
.
getOrderCode
());
if
(
null
!=
ordersAccessOry
)
{
orderRspBO
.
setIsNew
(
NewUserEnum
.
getNameByCode
(
ordersAccessOry
.
getIsNew
()
==
null
?
"N"
:
ordersAccessOry
.
getIsNew
()));
}
else
{
orderRspBO
.
setIsNew
(
NewUserEnum
.
getNameByCode
(
"N"
));
}
orderRspBO
.
setUid
(
orders
.
getUid
());
orderRspBO
.
setOrderCode
(
orders
.
getOrderCode
());
orderRspBO
.
setId
(
orders
.
getId
());
orderRspBO
.
setOrderTime
(
DateUtil
.
long2DateStr
(
Long
.
valueOf
(
orders
.
getCreateTime
())
*
Long
.
valueOf
(
1000
),
"yyyy-MM-dd HH:mm:ss"
));
UserOrderDatailBO
userOrderDatailBO
=
userOrderDatailBOMap
.
get
(
orders
.
getParentOrderCode
());
orderRspBO
.
setUnionId
(
userOrderDatailBO
.
getUnionId
());
orderRspBO
.
setUnionType
(
userOrderDatailBO
.
getUnionName
());
return
orderRspBO
;
}
@Override
public
Class
getDataClass
()
{
return
UnionOrderRspBO
.
class
;
...
...
@@ -243,4 +221,9 @@ public class UserOrdersServiceImpl implements IUserOrdersService,IBusinessExport
throw
new
ServiceException
(
e
.
getCode
(),
e
.
getErrorMessage
());
}
}
}
...
...
web/src/main/webapp/html/reportform/shareUserOrders.html
0 → 100644
View file @
6331585
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"UTF-8"
>
<title>
Yoho!Buy运营平台
</title>
<script
src=
"/union/js/include.js"
></script>
<script
src=
"/union/js/ajaxfileupload.js"
></script>
</head>
<body
class=
"easyui-layout"
fit=
"true"
>
<div
region=
"north"
style=
"padding-bottom: 35px; height: auto;"
>
<script>
document
.
write
(
addHead
(
'市场报表管理'
,
'联盟订单管理'
));
</script>
<form
id=
"searchForm"
method=
"post"
accept-charset=
"utf-8"
>
<div
style=
"margin-left: 10px;margin-top: 10px"
>
<label>
开始时间:
</label>
<input
class=
"easyui-datetimebox"
id=
"beginTime"
name=
"beginTime"
>
</input>
<label>
结束时间:
</label>
<input
class=
"easyui-datetimebox"
id=
"endTime"
name=
"endTime"
>
</input>
<label>
订单号:
</label>
<input
class=
"easyui-textbox"
id=
"orderCode"
name=
"orderCode"
>
</input>
<label>
联盟用户ID:
</label>
<input
class=
"easyui-textbox"
id=
"unionId"
name=
"unionId"
>
</input>
<label>
渠道:
</label>
<input
class=
"easyui-textbox"
id=
"unionType"
name=
"unionType"
>
</input>
<label>
渠道号类型:
</label>
<input
class=
"easyui-combobox"
id=
"channelType"
name=
"channelType"
>
</input>
<a
id=
"searchBtn"
style=
"margin-left: 20px"
class=
"easyui-linkbutton btn-primary"
data-options=
"iconCls:'icon-more'"
>
查询
</a>
<a
id=
"exportButton"
style=
"margin-left: 20px"
class=
"easyui-linkbutton btn-primary"
data-options=
"iconCls:'icon-more'"
>
导出
</a>
<a
id=
"exportAllButton"
style=
"margin-left: 20px"
class=
"easyui-linkbutton btn-primary"
data-options=
"iconCls:'icon-more'"
>
全部导出
</a>
</div>
</form>
</div>
<div
region=
"center"
>
<div
style=
"margin-left: 30px;margin-top: 20px; height: 500px;"
>
<table
id=
"userOrdersTable"
></table>
</div>
</div>
<script
type=
"text/javascript"
>
var
checkedItems
=
[];
$
(
function
()
{
$
(
"#userOrdersTable"
).
myDatagrid
({
fit
:
true
,
fitColumns
:
true
,
<!--
idField
:
"id"
,
-->
view
:
fileview
,
nowrap
:
false
,
onCheckAll
:
addcheckItem
,
onCheck
:
addcheckItem
,
onUncheckAll
:
removeAllItem
,
onUncheck
:
removeSingleItem
,
url
:
contextPath
+
"/UnionShareRest/queryUnionShareOrders"
,
method
:
'POST'
,
loadFilter
:
function
(
data
)
{
var
temp
=
defaultLoadFilter
(
data
);
temp
.
rows
=
temp
.
list
;
return
temp
;
},
columns
:
[[{
title
:
"ID"
,
field
:
"id"
,
idField
:
"id"
,
width
:
170
,
align
:
"center"
,
checkbox
:
true
},
{
title
:
"联盟用户ID"
,
field
:
"unionId"
,
width
:
170
,
align
:
"center"
},
{
title
:
"下单时间"
,
field
:
"orderTime"
,
width
:
170
,
align
:
"center"
},
{
title
:
"订单号"
,
field
:
"orderCode"
,
width
:
170
,
align
:
"center"
},
{
title
:
"订单用户ID"
,
field
:
"uid"
,
width
:
170
,
align
:
"center"
},
{
title
:
"订单金额"
,
field
:
"orderAmount"
,
width
:
170
,
align
:
"center"
},
{
title
:
"优惠券金额"
,
field
:
"couponAmount"
,
width
:
170
,
align
:
"center"
},
{
title
:
"YOHO币"
,
field
:
"yohoCoinNum"
,
width
:
170
,
align
:
"center"
},
{
title
:
"运费"
,
field
:
"shipmentAmount"
,
width
:
90
,
align
:
"center"
},
{
title
:
"实付金额"
,
field
:
"realPayAmount"
,
width
:
170
,
align
:
"center"
},
{
title
:
"订单状态"
,
field
:
"orderStatus"
,
width
:
170
,
align
:
"center"
},
{
title
:
"渠道"
,
field
:
"unionType"
,
width
:
170
,
align
:
"center"
},
{
title
:
"渠道号类型"
,
field
:
"channelType"
,
width
:
120
,
align
:
"center"
,
formatter
:
function
(
value
,
rowData
,
rowIndex
)
{
return
value
==
null
?
""
:
value
==
0
?
"机构"
:
"个人"
;
}
},
{
title
:
"附加信息"
,
field
:
"exetInfmoation"
,
width
:
140
,
align
:
"center"
},
{
title
:
"支付方式"
,
field
:
"payChannel"
,
width
:
170
,
align
:
"center"
},
{
title
:
"是否新客"
,
field
:
"isNew"
,
width
:
170
,
align
:
"center"
}
]],
cache
:
false
,
pagination
:
true
,
pageSize
:
10
,
pageList
:
[
10
],
idField
:
"id"
,
singleSelect
:
false
,
checkOnSelect
:
false
,
onLoadSuccess
:
function
(
data
)
{
$
(
this
).
myDatagrid
(
"getPanel"
).
find
(
"a[role='delete']"
).
linkbutton
({
iconCls
:
"icon-more"
,
onClick
:
function
()
{
deleteBlack
(
$
(
this
).
attr
(
"dataId"
));
}
});
}
});
$
(
"#channelType"
).
combobox
({
valueField
:
"channelType"
,
textField
:
"channelTypeDesc"
,
data
:[{
channelTypeDesc
:
"个人"
,
channelType
:
"1"
},{
channelTypeDesc
:
"机构"
,
channelType
:
"0"
}]
});
$
(
"#channelType"
).
combobox
(
"clear"
);
function
getParam
(
table
)
{
var
paramsArray
=
$
(
"#"
+
table
+
""
).
serializeArray
();
var
params
=
{};
for
(
var
i
=
0
;
i
<
paramsArray
.
length
;
i
++
)
{
params
[
paramsArray
[
i
].
name
]
=
paramsArray
[
i
].
value
;
}
return
params
;
}
$
(
"#searchBtn"
).
linkbutton
({
iconCls
:
"icon-search"
,
onClick
:
function
()
{
var
param
=
{};
if
(
$
(
"#beginTime"
).
datetimebox
(
'getValue'
)
!=
''
)
{
param
.
beginTime
=
parseInt
(
new
Date
(
$
(
"#beginTime"
).
datetimebox
(
'getValue'
)).
getTime
()
/
1000
)
}
if
(
$
(
"#endTime"
).
datetimebox
(
'getValue'
)
!=
''
){
param
.
endTime
=
parseInt
(
new
Date
(
$
(
"#endTime"
).
datetimebox
(
'getValue'
)).
getTime
()
/
1000
)
}
param
.
orderCode
=
$
(
"#orderCode"
).
val
(),
param
.
unionId
=
$
(
"#unionId"
).
val
(),
param
.
unionType
=
$
(
"#unionType"
).
val
(),
param
.
channelType
=
$
(
"#channelType"
).
combobox
(
"getValue"
),
$
(
"#userOrdersTable"
).
myDatagrid
(
"load"
,
param
);
}
});
function
addcheckItem
()
{
$
(
"input[type='checkbox'][name='id']:checked"
).
each
(
function
()
{
var
k
=
findCheckedItem
(
$
(
this
).
val
());
if
(
k
==
-
1
)
{
checkedItems
.
push
(
$
(
this
).
val
());
}
});
}
var
fileview
=
$
.
extend
({},
$
.
fn
.
datagrid
.
defaults
.
view
,
{
onAfterRender
:
function
(
target
)
{
isCheckItem
();
}
});
function
isCheckItem
()
{
for
(
var
i
=
0
;
i
<
checkedItems
.
length
;
i
++
)
{
$
(
"input[type='checkbox'][name='id'][value='"
+
checkedItems
[
i
]
+
"']"
).
attr
(
"checked"
,
"checked"
);
}
}
function
findCheckedItem
(
ID
)
{
for
(
var
i
=
0
;
i
<
checkedItems
.
length
;
i
++
)
{
if
(
checkedItems
[
i
]
==
ID
)
return
i
;
}
return
-
1
;
}
function
findCheckedItem
(
ID
)
{
for
(
var
i
=
0
;
i
<
checkedItems
.
length
;
i
++
)
{
if
(
checkedItems
[
i
]
==
ID
)
return
i
;
}
return
-
1
;
}
function
removeAllItem
(
rows
)
{
$
(
"input[type='checkbox'][name='id']"
).
each
(
function
()
{
if
(
!
this
.
checked
)
{
var
k
=
findCheckedItem
(
$
(
this
).
val
());
if
(
k
!=
-
1
)
{
checkedItems
.
splice
(
k
,
1
);
}
}
});
}
function
removeSingleItem
(
rowIndex
,
rowData
)
{
var
k
=
findCheckedItem
(
rowData
.
id
);
if
(
k
!=
-
1
)
{
checkedItems
.
splice
(
k
,
1
);
}
}
$
(
"#exportButton"
).
linkbutton
({
onClick
:
function
()
{
if
(
checkedItems
.
length
==
0
)
{
$
.
messager
.
alert
(
'提示'
,
'请选择要导出的数据'
);
return
;
}
var
params
=
{
"ids"
:
checkedItems
.
toString
()
};
window
.
open
(
contextPath
+
"/batch/export.do?type=userOrdersServiceImpl&queryConf="
+
JSON
.
stringify
(
params
));
}
});
$
(
"#exportAllButton"
).
linkbutton
({
onClick
:
function
()
{
window
.
open
(
contextPath
+
"/batch/export.do?type=userOrdersServiceImpl&queryConf="
+
JSON
.
stringify
(
getParams
()));
}
});
function
getParams
()
{
var
paramsArray
=
$
(
"#searchForm"
).
serializeArray
();
var
params
=
{};
var
orderCode
=
""
;
var
beginTime
=
""
;
var
endTime
=
""
;
for
(
var
i
=
0
;
i
<
paramsArray
.
length
;
i
++
)
{
if
(
paramsArray
[
i
].
name
==
"orderCode"
)
{
orderCode
+=
paramsArray
[
i
].
value
+
","
;
}
else
if
(
paramsArray
[
i
].
name
==
"beginTime"
){
beginTime
+=
paramsArray
[
i
].
value
+
","
;
}
else
if
(
paramsArray
[
i
].
name
==
"endTime"
){
endTime
+=
paramsArray
[
i
].
value
+
","
;
}
else
{
params
[
paramsArray
[
i
].
name
]
=
paramsArray
[
i
].
value
;
}
}
if
(
orderCode
.
length
!=
0
)
{
params
[
"orderCode"
]
=
orderCode
.
substring
(
0
,
orderCode
.
length
-
1
);
}
if
(
beginTime
.
length
!=
0
){
params
[
"beginTime"
]
=
parseInt
(
new
Date
(
$
(
"#beginTime"
).
datetimebox
(
'getValue'
)).
getTime
()
/
1000
)
}
if
(
endTime
.
length
!=
0
){
params
[
"endTime"
]
=
parseInt
(
new
Date
(
$
(
"#endTime"
).
datetimebox
(
'getValue'
)).
getTime
()
/
1000
)
}
return
params
;
}
});
</script>
</body>
</html>
\ No newline at end of file
...
...
web/src/main/webapp/html/reportform/userOrders.html
View file @
6331585
...
...
@@ -34,10 +34,6 @@
<input
class=
"easyui-textbox"
id=
"unionType"
name=
"unionType"
>
</input>
<label>
渠道号类型:
</label>
<input
class=
"easyui-combobox"
id=
"channelType"
name=
"channelType"
>
</input>
<a
id=
"searchBtn"
style=
"margin-left: 20px"
class=
"easyui-linkbutton btn-primary"
data-options=
"iconCls:'icon-more'"
>
查询
</a>
<a
id=
"exportButton"
style=
"margin-left: 20px"
class=
"easyui-linkbutton btn-primary"
data-options=
"iconCls:'icon-more'"
>
导出
</a>
<a
id=
"exportAllButton"
style=
"margin-left: 20px"
class=
"easyui-linkbutton btn-primary"
data-options=
"iconCls:'icon-more'"
>
全部导出
</a>
...
...
@@ -114,7 +110,7 @@
},
{
title
:
"运费"
,
field
:
"shipmentAmount"
,
width
:
9
0
,
width
:
17
0
,
align
:
"center"
},
{
title
:
"实付金额"
,
...
...
@@ -132,17 +128,9 @@
width
:
170
,
align
:
"center"
},
{
title
:
"渠道号类型"
,
field
:
"channelType"
,
width
:
120
,
align
:
"center"
,
formatter
:
function
(
value
,
rowData
,
rowIndex
)
{
return
value
==
null
?
""
:
value
==
0
?
"机构"
:
"个人"
;
}
},
{
title
:
"附加信息"
,
field
:
"exetInfmoation"
,
width
:
1
4
0
,
width
:
1
7
0
,
align
:
"center"
},
{
title
:
"支付方式"
,
...
...
@@ -173,12 +161,6 @@
});
}
});
$
(
"#channelType"
).
combobox
({
valueField
:
"channelType"
,
textField
:
"channelTypeDesc"
,
data
:[{
channelTypeDesc
:
"个人"
,
channelType
:
"1"
},{
channelTypeDesc
:
"机构"
,
channelType
:
"0"
}]
});
$
(
"#channelType"
).
combobox
(
"clear"
);
function
getParam
(
table
)
{
var
paramsArray
=
$
(
"#"
+
table
+
""
).
serializeArray
();
...
...
@@ -204,7 +186,6 @@
param
.
orderCode
=
$
(
"#orderCode"
).
val
(),
param
.
unionId
=
$
(
"#unionId"
).
val
(),
param
.
unionType
=
$
(
"#unionType"
).
val
(),
param
.
channelType
=
$
(
"#channelType"
).
combobox
(
"getValue"
),
$
(
"#userOrdersTable"
).
myDatagrid
(
"load"
,
param
);
}
});
...
...
Please
register
or
login
to post a comment