Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yd-backend
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
AutogeneralShanghai
yd-backend
Commits
36736f06
Commit
36736f06
authored
Nov 17, 2020
by
yao.xiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
关账导出CSV
parent
74bca627
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
387 additions
and
25 deletions
+387
-25
yd-api/src/main/java/com/yd/api/agms/AgmsController.java
+14
-0
yd-api/src/main/java/com/yd/api/agms/service/AgmsFortuneService.java
+8
-2
yd-api/src/main/java/com/yd/api/agms/service/impl/AgmsFortuneServiceImpl.java
+83
-1
yd-api/src/main/java/com/yd/api/agms/vo/fortune/ExportFortunePayRequestVO.java
+156
-0
yd-api/src/main/java/com/yd/api/agms/vo/fortune/ExportFortunePayResponseVO.java
+25
-0
yd-api/src/main/java/com/yd/dal/entity/agms/fortune/FortunePayToOrderInfo.java
+50
-0
yd-api/src/main/java/com/yd/dal/mapper/agms/AgmsFortuneMapper.java
+2
-2
yd-api/src/main/java/com/yd/dal/service/agms/AgmsFortuneDALService.java
+1
-2
yd-api/src/main/java/com/yd/dal/service/agms/impl/AgmsFortuneDALServiceImpl.java
+10
-2
yd-api/src/main/resources/mapper/agms/AgmsFortuneMapper.xml
+38
-16
No files found.
yd-api/src/main/java/com/yd/api/agms/AgmsController.java
View file @
36736f06
...
...
@@ -196,4 +196,18 @@ public class AgmsController {
result
.
addResult
(
responseVO
);
return
result
;
}
/**
* AGMS -- 导出财富文档
* @param requestVO 请求数据
* @return 响应数据
*/
@RequestMapping
(
value
=
"/exportFortunePay"
)
public
Object
exportFortunePay
(
@RequestBody
ExportFortunePayRequestVO
requestVO
,
HttpServletResponse
response
)
{
JsonResult
result
=
new
JsonResult
();
ExportFortunePayResponseVO
responseVO
=
agmsFortuneService
.
exportFortunePay
(
requestVO
,
response
);
result
.
setData
(
responseVO
);
result
.
addResult
(
responseVO
);
return
result
;
}
}
yd-api/src/main/java/com/yd/api/agms/service/AgmsFortuneService.java
View file @
36736f06
...
...
@@ -5,6 +5,7 @@ import com.yd.api.order.vo.SurrenderFortuneRequestVO;
import
com.yd.api.order.vo.SurrenderFortuneResponseVO
;
import
com.yd.dal.entity.customer.AclCustomerFortune
;
import
javax.servlet.http.HttpServletResponse
;
import
java.lang.reflect.InvocationTargetException
;
import
java.util.List
;
...
...
@@ -23,8 +24,6 @@ public interface AgmsFortuneService {
* AGMS -- 修改佣金发放状态
* @param requestVO 请求数据
* @return 响应数据
* @throws InvocationTargetException InvocationTargetException
* @throws IllegalAccessException IllegalAccessException
*/
CommissionPayoutStatusQueryResponseVO
commissionPayoutStatusQuery
(
CommissionPayoutStatusQueryRequestVO
requestVO
);
...
...
@@ -53,4 +52,11 @@ public interface AgmsFortuneService {
public
void
canPaymentUpDate
(
String
paymentStatus
,
Long
payoutBatchId
,
Long
loginId
,
List
<
AclCustomerFortune
>
customerFortunes
);
/**
* AGMS -- 导出财富文档
* @param requestVO 请求数据
* @param response response
* @return 响应数据
*/
ExportFortunePayResponseVO
exportFortunePay
(
ExportFortunePayRequestVO
requestVO
,
HttpServletResponse
response
);
}
yd-api/src/main/java/com/yd/api/agms/service/impl/AgmsFortuneServiceImpl.java
View file @
36736f06
...
...
@@ -2,6 +2,7 @@ package com.yd.api.agms.service.impl;
import
com.yd.api.agms.service.AgmsFortuneService
;
import
com.yd.api.agms.vo.fortune.*
;
import
com.yd.api.agms.vo.statistics.statementData
;
import
com.yd.api.order.vo.SurrenderFortuneRequestVO
;
import
com.yd.api.order.vo.SurrenderFortuneResponseVO
;
import
com.yd.api.result.CommonResult
;
...
...
@@ -29,6 +30,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.lang.reflect.Method
;
import
java.math.BigDecimal
;
import
java.util.*
;
...
...
@@ -549,7 +553,7 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
FortunePayToOrderResponseVO
responseVO
=
new
FortunePayToOrderResponseVO
();
Long
payId
=
requestVO
.
getPayId
();
//查询所有订单,并根据支付id标记本次提现订单
List
<
FortunePayToOrderInfo
>
fortunePayToOrderInfos
=
agmsFortuneDalService
.
fortunePayToOrder
(
payId
);
List
<
FortunePayToOrderInfo
>
fortunePayToOrderInfos
=
agmsFortuneDalService
.
fortunePayToOrder
(
new
Long
[]{
payId
}
);
BigDecimal
totalOrderPrice
=
fortunePayToOrderInfos
.
stream
()
.
map
(
f
->
f
.
getOrderPrice
()
==
null
?
BigDecimal
.
ZERO
:
f
.
getOrderPrice
())
.
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
...
...
@@ -737,4 +741,82 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
return
resp
;
}
@Override
public
ExportFortunePayResponseVO
exportFortunePay
(
ExportFortunePayRequestVO
requestVO
,
HttpServletResponse
response
)
{
ExportFortunePayResponseVO
responseVO
=
new
ExportFortunePayResponseVO
();
WithdrawQueryInfo
info
=
new
WithdrawQueryInfo
();
BeanUtils
.
copyProperties
(
requestVO
,
info
);
List
<
WithdrawLabelInfo
>
withdraws
=
agmsFortuneDalService
.
transformForWithdrawLabel
(
info
);
Long
[]
payIds
=
new
Long
[
withdraws
.
size
()];
for
(
int
i
=
0
;
i
<
withdraws
.
size
();
i
++){
payIds
[
i
]
=
withdraws
.
get
(
i
).
getPayId
();
}
List
<
FortunePayToOrderInfo
>
fortunePayToOrderInfos
=
agmsFortuneDalService
.
fortunePayToOrder
(
payIds
);
createCSV
(
fortunePayToOrderInfos
,
response
);
responseVO
.
setCommonResult
(
new
CommonResult
(
true
,
ZHBErrorConfig
.
getErrorInfo
(
"800000"
)));
return
responseVO
;
}
private
void
createCSV
(
List
<
FortunePayToOrderInfo
>
fortunePayToOrderInfos
,
HttpServletResponse
response
)
{
String
charset
=
"UTF-8"
;
// 读取字符编码
String
[]
columnName
=
new
String
[]{
"序号"
,
"预计发佣年月"
,
"经纪人"
,
"佣金"
,
"保单号"
,
"保费"
,
"佣金率"
,
"发佣状态"
,
"佣金类型"
,
"手机号"
,
"职级"
,
"分公司"
,
"营业部"
,
"体系"
,
"购买方案"
};
String
tableName
=
"YD_Export_Fortune_Pay"
;
String
CSV_COLUMN_SEPARATOR
=
","
;
//CSV文件列分隔符
String
CSV_ROW_SEPARATOR
=
"\r\n"
;
//CSV文件行分隔符
// 保证线程安全
StringBuilder
buf
=
new
StringBuilder
();
// 组装表头
for
(
String
title
:
columnName
)
{
buf
.
append
(
title
).
append
(
CSV_COLUMN_SEPARATOR
);
}
buf
.
append
(
CSV_ROW_SEPARATOR
);
// 组装数据
if
(
CollectionUtils
.
isNotEmpty
(
fortunePayToOrderInfos
))
{
for
(
int
i
=
0
;
i
<
fortunePayToOrderInfos
.
size
();
i
++)
{
FortunePayToOrderInfo
info
=
fortunePayToOrderInfos
.
get
(
i
);
//遍历每个对象
buf
.
append
(
i
+
1
).
append
(
CSV_COLUMN_SEPARATOR
);
buf
.
append
(
info
.
getPayoutYearmonth
()).
append
(
CSV_COLUMN_SEPARATOR
);
buf
.
append
(
info
.
getPractitionerName
()).
append
(
CSV_COLUMN_SEPARATOR
);
buf
.
append
(
info
.
getCommissionAmount
()).
append
(
CSV_COLUMN_SEPARATOR
);
buf
.
append
(
info
.
getPolicyNo
()).
append
(
CSV_COLUMN_SEPARATOR
);
buf
.
append
(
info
.
getOrderPrice
()).
append
(
CSV_COLUMN_SEPARATOR
);
buf
.
append
(
info
.
getCommissionRate
()).
append
(
CSV_COLUMN_SEPARATOR
);
buf
.
append
(
info
.
getCommissionPayoutStatus
()).
append
(
CSV_COLUMN_SEPARATOR
);
buf
.
append
(
info
.
getCommissionType
()).
append
(
CSV_COLUMN_SEPARATOR
);
buf
.
append
(
info
.
getMobileNo
()).
append
(
CSV_COLUMN_SEPARATOR
);
buf
.
append
(
info
.
getPractitionerLevel
()).
append
(
CSV_COLUMN_SEPARATOR
);
buf
.
append
(
info
.
getInsurerBranchName
()).
append
(
CSV_COLUMN_SEPARATOR
);
buf
.
append
(
info
.
getInsurerBranchDeptName
()).
append
(
CSV_COLUMN_SEPARATOR
);
buf
.
append
(
info
.
getSubordinateSystemName
()).
append
(
CSV_COLUMN_SEPARATOR
);
buf
.
append
(
info
.
getProductName
()).
append
(
CSV_COLUMN_SEPARATOR
);
buf
.
append
(
CSV_ROW_SEPARATOR
);
}
}
// 设置文件后缀
String
fn
=
tableName
+
System
.
currentTimeMillis
()
+
".csv"
;
String
headStr
=
"attachment; filename=\""
+
fn
+
"\""
;
// 设置响应
response
.
setContentType
(
"APPLICATION/ms-csv.numberformat"
);
response
.
setCharacterEncoding
(
charset
);
response
.
setHeader
(
"Content-Disposition"
,
headStr
);
response
.
setHeader
(
"Cache-Control"
,
"max-age=30"
);
response
.
setHeader
(
"Access-Control-Expose-Headers"
,
"Content-Disposition"
);
response
.
setHeader
(
"Pragma"
,
"public"
);
OutputStream
os
=
null
;
try
{
os
=
response
.
getOutputStream
();
os
.
write
(
buf
.
toString
().
getBytes
(
"GBK"
));
os
.
flush
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
os
!=
null
){
try
{
os
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
}
}
yd-api/src/main/java/com/yd/api/agms/vo/fortune/ExportFortunePayRequestVO.java
0 → 100644
View file @
36736f06
package
com
.
yd
.
api
.
agms
.
vo
.
fortune
;
/**
* @author xxy
*/
public
class
ExportFortunePayRequestVO
{
/**
* 预计发佣年月
*/
private
String
payoutYearmonth
;
/**
* 分公司
*/
private
Long
insurerBranchId
;
/**
* 营业部
*/
private
Long
insurerBranchDeptId
;
/**
* 体系
*/
private
Long
subordinateSystemId
;
/**
* 经纪人
*/
private
Long
practitionerId
;
/**
* 发佣状态 暂不开放 可发 保留 已发并关账
*/
private
Long
commissionPayoutStatus
;
/**
* 获取 预计发佣年月
*
* @return payoutYearmonth 预计发佣年月
*/
public
String
getPayoutYearmonth
()
{
return
this
.
payoutYearmonth
;
}
/**
* 设置 预计发佣年月
*
* @param payoutYearmonth 预计发佣年月
*/
public
void
setPayoutYearmonth
(
String
payoutYearmonth
)
{
this
.
payoutYearmonth
=
payoutYearmonth
;
}
/**
* 获取 分公司
*
* @return insurerBranchId 分公司
*/
public
Long
getInsurerBranchId
()
{
return
this
.
insurerBranchId
;
}
/**
* 设置 分公司
*
* @param insurerBranchId 分公司
*/
public
void
setInsurerBranchId
(
Long
insurerBranchId
)
{
this
.
insurerBranchId
=
insurerBranchId
;
}
/**
* 获取 营业部
*
* @return insurerBranchDeptId 营业部
*/
public
Long
getInsurerBranchDeptId
()
{
return
this
.
insurerBranchDeptId
;
}
/**
* 设置 营业部
*
* @param insurerBranchDeptId 营业部
*/
public
void
setInsurerBranchDeptId
(
Long
insurerBranchDeptId
)
{
this
.
insurerBranchDeptId
=
insurerBranchDeptId
;
}
/**
* 获取 体系
*
* @return subordinateSystemId 体系
*/
public
Long
getSubordinateSystemId
()
{
return
this
.
subordinateSystemId
;
}
/**
* 设置 体系
*
* @param subordinateSystemId 体系
*/
public
void
setSubordinateSystemId
(
Long
subordinateSystemId
)
{
this
.
subordinateSystemId
=
subordinateSystemId
;
}
/**
* 获取 经纪人
*
* @return practitionerId 经纪人
*/
public
Long
getPractitionerId
()
{
return
this
.
practitionerId
;
}
/**
* 设置 经纪人
*
* @param practitionerId 经纪人
*/
public
void
setPractitionerId
(
Long
practitionerId
)
{
this
.
practitionerId
=
practitionerId
;
}
/**
* 获取 发佣状态 暂不开放 可发 保留 已发并关账
*
* @return commissionPayoutStatus 发佣状态 暂不开放 可发 保留 已发并关账
*/
public
Long
getCommissionPayoutStatus
()
{
return
this
.
commissionPayoutStatus
;
}
/**
* 设置 发佣状态 暂不开放 可发 保留 已发并关账
*
* @param commissionPayoutStatus 发佣状态 暂不开放 可发 保留 已发并关账
*/
public
void
setCommissionPayoutStatus
(
Long
commissionPayoutStatus
)
{
this
.
commissionPayoutStatus
=
commissionPayoutStatus
;
}
@Override
public
String
toString
()
{
return
"ExportFortunePayRequestVO{"
+
"payoutYearmonth='"
+
payoutYearmonth
+
'\''
+
", insurerBranchId="
+
insurerBranchId
+
", insurerBranchDeptId="
+
insurerBranchDeptId
+
", subordinateSystemId="
+
subordinateSystemId
+
", practitionerId="
+
practitionerId
+
", commissionPayoutStatus="
+
commissionPayoutStatus
+
'}'
;
}
}
yd-api/src/main/java/com/yd/api/agms/vo/fortune/ExportFortunePayResponseVO.java
0 → 100644
View file @
36736f06
package
com
.
yd
.
api
.
agms
.
vo
.
fortune
;
import
com.yd.api.result.CommonResult
;
/**
* @author xxy
*/
public
class
ExportFortunePayResponseVO
{
private
CommonResult
commonResult
;
public
CommonResult
getCommonResult
()
{
return
commonResult
;
}
public
void
setCommonResult
(
CommonResult
commonResult
)
{
this
.
commonResult
=
commonResult
;
}
@Override
public
String
toString
()
{
return
"ExportFortunePayResponseVO{"
+
"commonResult="
+
commonResult
+
'}'
;
}
}
yd-api/src/main/java/com/yd/dal/entity/agms/fortune/FortunePayToOrderInfo.java
View file @
36736f06
...
...
@@ -43,5 +43,55 @@ public class FortunePayToOrderInfo {
* 购买方案
*/
private
String
productName
;
/**
* 预计发佣年月
*/
private
String
payoutYearmonth
;
/**
* 经纪人
*/
private
String
practitionerName
;
/**
* 佣金
*/
private
BigDecimal
commissionAmount
;
/**
* 佣金率
*/
private
BigDecimal
commissionRate
;
/**
* 发佣状态
*/
private
String
commissionPayoutStatus
;
/**
* 手机号
*/
private
String
mobileNo
;
/**
* 经纪人职级
*/
private
String
practitionerLevel
;
/**
* 分公司
*/
private
String
insurerBranchName
;
/**
* 营业部
*/
private
String
insurerBranchDeptName
;
/**
* 体系
*/
private
String
subordinateSystemName
;
}
yd-api/src/main/java/com/yd/dal/mapper/agms/AgmsFortuneMapper.java
View file @
36736f06
...
...
@@ -26,10 +26,10 @@ public interface AgmsFortuneMapper {
/**
* 通过customerId 和 payId 查询 fortune 信息
* @param payId
payId
* @param payId
s payIds
* @return FortunePayToOrderInfo
*/
List
<
FortunePayToOrderInfo
>
fortunePayToOrder
(
@Param
(
"payId"
)
Long
payId
);
List
<
FortunePayToOrderInfo
>
fortunePayToOrder
(
Long
[]
payIds
);
/**
* 经纪人支付列表
...
...
yd-api/src/main/java/com/yd/dal/service/agms/AgmsFortuneDALService.java
View file @
36736f06
...
...
@@ -34,11 +34,10 @@ public interface AgmsFortuneDALService {
/**
* 通过customerId和payId查询fortune记录
* @param customerId customerId
* @param payId payId
* @return FortunePayToOrderInfo
*/
List
<
FortunePayToOrderInfo
>
fortunePayToOrder
(
Long
payId
);
List
<
FortunePayToOrderInfo
>
fortunePayToOrder
(
Long
[]
payId
);
/**
* 支付列表插叙
...
...
yd-api/src/main/java/com/yd/dal/service/agms/impl/AgmsFortuneDALServiceImpl.java
View file @
36736f06
...
...
@@ -4,6 +4,7 @@ import com.yd.dal.entity.agms.fortune.*;
import
com.yd.dal.entity.customer.AclCustomerFortune
;
import
com.yd.dal.mapper.agms.AgmsFortuneMapper
;
import
com.yd.dal.service.agms.AgmsFortuneDALService
;
import
com.yd.util.deshandler.DESTypeHandler
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -62,8 +63,15 @@ public class AgmsFortuneDALServiceImpl implements AgmsFortuneDALService {
}
@Override
public
List
<
FortunePayToOrderInfo
>
fortunePayToOrder
(
Long
payId
)
{
return
agmsFortuneMapper
.
fortunePayToOrder
(
payId
);
public
List
<
FortunePayToOrderInfo
>
fortunePayToOrder
(
Long
[]
payIds
)
{
DESTypeHandler
desTypeHandler
=
new
DESTypeHandler
();
List
<
FortunePayToOrderInfo
>
fortunePayToOrderInfos
=
agmsFortuneMapper
.
fortunePayToOrder
(
payIds
);
for
(
FortunePayToOrderInfo
fortunePayToOrderInfo:
fortunePayToOrderInfos
){
String
mobileNo
=
fortunePayToOrderInfo
.
getMobileNo
();
mobileNo
=
desTypeHandler
.
decode
(
mobileNo
);
fortunePayToOrderInfo
.
setMobileNo
(
mobileNo
);
}
return
fortunePayToOrderInfos
;
}
@Override
...
...
yd-api/src/main/resources/mapper/agms/AgmsFortuneMapper.xml
View file @
36736f06
...
...
@@ -88,23 +88,45 @@
</select>
<select
id=
"fortunePayToOrder"
resultType=
"com.yd.dal.entity.agms.fortune.FortunePayToOrderInfo"
>
select
i.name insurerName,
o.policy_no policyNo,
o.order_price orderPrice,
f.commission_type commissionType,
f.referral_rate referralRate,
f.referral_amount referralAmount,
if(o.config_level = 2,p.name,pp.name) productName
select i.name insurerName,
o.policy_no policyNo,
o.order_price orderPrice,
f.commission_type commissionType,
f.referral_rate referralRate,
f.referral_amount referralAmount,
if(o.config_level = 2, p.name, pp.name) productName,
pb.payout_yearmonth payoutYearmonth,
pra.name practitionerName,
f.commission_amount commissionAmount,
f.commission_rate commissionRate,
op.drop_option_name commissionPayoutStatus,
pra.mobile_no mobileNo,
f.practitioner_level practitionerLevel,
dept.name insurerBranchDeptName,
sub.name subordinateSystemName,
ib.branch_name insurerBranchName
from ag_acl_customer_fortune f
left join ag_po_order o
left join ag_product_plan pp on pp.id = o.plan_id
left join ag_product p on p.id = o.product_id
left join ag_acl_insurer i on o.insurer_id = i.id
on o.id = f.order_id
where (o.status = 3 or o.status = 4)
and f.order_price != 0
and f.fortune_payed_id = #{payId,jdbcType=BIGINT}
left join ag_po_order o
left join ag_product_plan pp on pp.id = o.plan_id
left join ag_product p on p.id = o.product_id
left join ag_acl_insurer i on o.insurer_id = i.id
on o.id = f.order_id
left join ag_acl_customer_fortune_payout_batch pb on pb.id = f.payout_batch_id
LEFT JOIN ag_acl_practitioner pra
LEFT JOIN ag_acl_insurer_branch ib on ib.id = pra.insurer_branch_id
LEFT JOIN ag_acl_insurer_branch_dept dept ON pra.dept_id = dept.id
LEFT JOIN ag_acl_practitioner_subordinate_system sub ON sub.id = pra.subordinate_system_id
ON pra.customer_id = f.customer_id
LEFT JOIN ag_md_drop_options op
LEFT JOIN ag_md_drop_master mas ON mas.id = op.drop_master_id
ON op.drop_option_code = f.commission_payout_status
where (o.status = 3 or o.status = 4)
AND mas.drop_code like 'Commission_Payout_Status'
and f.order_price != 0
and f.fortune_payed_id in
<foreach
collection=
"array"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item,jdbcType=BIGINT}
</foreach>
</select>
<resultMap
id=
"WithdrawLabelInfo"
type=
"com.yd.dal.entity.agms.fortune.WithdrawLabelInfo"
>
...
...
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