wangning 7 years ago
parent a02314e294
commit 3bbdd7968a

@ -549,6 +549,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
@Override
public JSONObject getAgentPrizeDetail(String monthStr, String orgId) {
Date monthDate = parseMonth(monthStr);
Calendar monthCal = Calendar.getInstance();
monthCal.setTime(monthDate);
@ -560,17 +561,11 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
if (CollectionUtils.isEmpty(total)) {
return null;
}
List<String> recordIds = new ArrayList<>();
for (JSONObject jsonObject : total) {
result.put("name", jsonObject.getString("name"));
recordIds.add(jsonObject.getString("record_id"));
}
BigDecimal royalpay_charge = BigDecimal.ZERO;
List<JSONObject> partnerPrizeDetailList = financialPartnerCommissionDetailMapper.listDetailByMonth(year,month);
List<JSONObject> partnerPrizeList = getCityPartnerPrizeInfoList(monthStr);
Map<Integer, JSONObject> countPartnerPrizeMap = new HashMap<>();
for (JSONObject p : partnerPrizeDetailList) {
for (JSONObject p : partnerPrizeList) {
royalpay_charge = royalpay_charge.add(p.getBigDecimal("royalpay_charge"));
Integer key = p.getInteger("client_id");
JSONObject partnerTmp = countPartnerPrizeMap.get(key);
@ -583,9 +578,34 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
}
}
String tableColumn[] = { "gross_amount", "total_charge", "org_charge", "org_net_charge" };
List<String> recordIds = new ArrayList<>();
Map<String, BigDecimal> chargeResultMap = new HashMap<>();
for (JSONObject jsonObject : total) {
result.put("name", jsonObject.getString("name"));
recordIds.add(jsonObject.getString("record_id"));
for (String s : tableColumn) {
String key = jsonObject.getString("channel") + "_" + s;
if (chargeResultMap.containsKey(key)) {
chargeResultMap.put(key, chargeResultMap.get(key).add(jsonObject.getBigDecimal(s)));
} else {
chargeResultMap.put(key, jsonObject.getBigDecimal(s));
}
}
}
List<JSONObject> details = financialAgentCommissionDetailMapper.listDetailsByRecordIds(recordIds);
Map<String, List<JSONObject>> detailMap = new HashMap<>();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
for (JSONObject detail : details) {
detail.put("date_from", format.format(detail.get("date_from")));
detail.put("date_to", format.format(detail.get("date_to")));
String key = detail.getString("client_id");
if (detailMap.containsKey(key)) {
detailMap.get(key).add(detail);
@ -598,36 +618,53 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
List<JSONObject> partnerClientInfos = new ArrayList<>();
BigDecimal resultGrossAmount = BigDecimal.ZERO;
BigDecimal resultTotalCharge = BigDecimal.ZERO;
BigDecimal resultRoyalpayCharge = BigDecimal.ZERO;
BigDecimal resultOrgCharge = BigDecimal.ZERO;
BigDecimal resultOrgNetCharge = BigDecimal.ZERO;
BigDecimal resultNetCharge = BigDecimal.ZERO;
for (Map.Entry<String, List<JSONObject>> entry : detailMap.entrySet()) {
JSONObject sumResult = new JSONObject();
BigDecimal grossAmount = BigDecimal.ZERO;
BigDecimal totalCharge = BigDecimal.ZERO;
BigDecimal royalpayCharge = BigDecimal.ZERO;
BigDecimal netCharge = BigDecimal.ZERO;
BigDecimal orgCharge = BigDecimal.ZERO;
BigDecimal orgNetCharge = BigDecimal.ZERO;
String clientMoniker = "";
int client_id = 0;
for (JSONObject jsonObject : entry.getValue()) {
grossAmount = grossAmount.add(jsonObject.getBigDecimal("gross_amount"));
totalCharge = totalCharge.add(jsonObject.getBigDecimal("total_charge"));
// royalpayCharge = royalpayCharge.add(jsonObject.getBigDecimal("royalpay_charge"));
orgCharge = orgCharge.add(jsonObject.getBigDecimal("org_charge"));
orgNetCharge = orgNetCharge.add(jsonObject.getBigDecimal("org_net_charge"));
if (jsonObject.getBigDecimal("net_charge") != null) {
netCharge = netCharge.add(jsonObject.getBigDecimal("org_net_charge"));
}
clientMoniker = jsonObject.getString("client_moniker");
}
resultGrossAmount = resultGrossAmount.add(grossAmount);
resultTotalCharge = resultTotalCharge.add(totalCharge);
resultRoyalpayCharge = resultRoyalpayCharge.add(royalpayCharge);
resultOrgCharge = resultOrgCharge.add(orgCharge);
resultOrgNetCharge = resultOrgNetCharge.add(orgNetCharge);
resultNetCharge = resultNetCharge.add(netCharge);
sumResult.put("gross_amount", grossAmount);
sumResult.put("total_charge", totalCharge);
sumResult.put("royalpay_charge", royalpayCharge);
sumResult.put("org_charge", orgCharge);
sumResult.put("org_net_charge", netCharge);
sumResult.put("client_moniker", clientMoniker);
sumResult.put("org_net_charge",orgNetCharge);
sumResult.put("royalpay_charge",countPartnerPrizeMap.get(client_id)==null?BigDecimal.ZERO:countPartnerPrizeMap.get(client_id).getBigDecimal("royalpay_charge"));
sumResult.put("channel_detail", entry.getValue());
partnerClientInfos.add(sumResult);
}
result.put("partner_client_infos", partnerClientInfos);
for (Map.Entry<String, BigDecimal> entry : chargeResultMap.entrySet()) {
result.put(entry.getKey(), entry.getValue());
}
result.put("monthstr", monthStr);
result.put("gross_amount", resultGrossAmount);
result.put("org_charge", resultOrgCharge);
result.put("org_net_charge", resultOrgNetCharge);
result.put("total_transaction", resultGrossAmount);
result.put("total_charge", resultTotalCharge);
result.put("royalPay_charge", resultRoyalpayCharge);
result.put("org_net_charge", resultNetCharge);
result.put("city_partner_charge", resultOrgCharge);
return result;
}

@ -26,7 +26,7 @@
RoyalPay Charge:{{detail.royalPay_charge}}
</div>
<div class="col-xs-3 col-sm-3 nowrap">
Net Charge:{{detail.net_charge}}
Org Net Charge:{{detail.org_net_charge}}
</div>
<div class="col-xs-6 col-sm-6 nowrap">
City Partner Charge:{{detail.city_partner_charge}}
@ -45,8 +45,8 @@
ng-bind="detail.Alipay_total_charge|currency:'AUD'"></span></h5>
<h5 class="ng-binding">RoyalPay Charge:<span
ng-bind="detail.Alipay_royalpay_charge|currency:'AUD'"></span></h5>
<h5 class="ng-binding">Net Charge:<span
ng-bind="detail.Alipay_net_charge|currency:'AUD'"></span></h5>
<h5 class="ng-binding">Org Net Charge:<span
ng-bind="detail.Alipay_org_net_charge|currency:'AUD'"></span></h5>
<h5 class="ng-binding">City Partner Charge:<span
ng-bind="detail.Alipay_org_charge|currency:'AUD'"></span></h5>
</div>
@ -66,8 +66,8 @@
ng-bind="detail.Bestpay_total_charge|currency:'AUD'"></span></h5>
<h5 class="ng-binding">RoyalPay Charge:<span
ng-bind="detail.Bestpay_royalpay_charge|currency:'AUD'"></span></h5>
<h5 class="ng-binding">Net Charge:<span
ng-bind="detail.Bestpay_net_charge|currency:'AUD'"></span></h5>
<h5 class="ng-binding">Org Net Charge:<span
ng-bind="detail.Bestpay_org_net_charge|currency:'AUD'"></span></h5>
<h5 class="ng-binding">City Partner Charge:<span
ng-bind="detail.Bestpay_org_charge|currency:'AUD'"></span></h5>
</div>
@ -87,8 +87,8 @@
ng-bind="detail.Wechat_total_charge|currency:'AUD'"></span></h5>
<h5 class="ng-binding"> RoyalPay Charge:<span
ng-bind="detail.Wechat_royalpay_charge|currency:'AUD'"></span></h5>
<h5 class="ng-binding">Net Charge:<span
ng-bind="detail.Wechat_net_charge|currency:'AUD'"></span></h5>
<h5 class="ng-binding">Org Net Charge:<span
ng-bind="detail.Wechat_org_net_charge|currency:'AUD'"></span></h5>
<h5 class="ng-binding">City Partner Charge:<span
ng-bind="detail.Wechat_org_charge|currency:'AUD'"></span></h5>
</div>
@ -108,8 +108,8 @@
ng-bind="detail.jd_total_charge|currency:'AUD'"></span></h5>
<h5 class="ng-binding"> RoyalPay Charge:<span
ng-bind="detail.jd_royalpay_charge|currency:'AUD'"></span></h5>
<h5 class="ng-binding">Net Charge:<span
ng-bind="detail.jd_net_charge|currency:'AUD'"></span></h5>
<h5 class="ng-binding">Org Net Charge:<span
ng-bind="detail.jd_org_net_charge|currency:'AUD'"></span></h5>
<h5 class="ng-binding">City Partner Charge:<span
ng-bind="detail.jd_org_charge|currency:'AUD'"></span></h5>
</div>
@ -127,7 +127,7 @@
<th>Transaction</th>
<th>Total Charge</th>
<th>RoyalPay Charge</th>
<th>Net Charge</th>
<th>Org Net Charge</th>
<th>City Partner Charge</th>
<th>Details</th>
</tr>
@ -138,7 +138,7 @@
<td ng-bind="log.gross_amount|currency:'AUD'"></td>
<td ng-bind="log.total_charge|currency:'AUD'"></td>
<td ng-bind="log.royalpay_charge|currency:'AUD'"></td>
<td ng-bind="log.net_charge|currency:'AUD'"></td>
<td ng-bind="log.org_net_charge|currency:'AUD'"></td>
<td ng-bind="log.org_charge|currency:'AUD'"></td>
<td>
@ -157,7 +157,7 @@
<th>Transaction Amount</th>
<th>Total Charge</th>
<th>RoyalPay Charge</th>
<th>Net Charge</th>
<th>Org Net Charge</th>
<th>City Partner Charge</th>
<th>channel</th>
</tr>
@ -171,7 +171,7 @@
<td ng-bind="detail.gross_amount"></td>
<td ng-bind="detail.total_charge"></td>
<td ng-bind="detail.royalpay_charge"></td>
<td ng-bind="detail.net_charge"></td>
<td ng-bind="detail.org_net_charge"></td>
<td ng-bind="detail.org_charge"></td>
<td ng-bind="detail.channel"></td>
</tr>

@ -17,7 +17,7 @@
Month:<span ng-bind="detail.monthstr"></span>
</div>
<div class="col-xs-3 col-sm-3 nowrap">
Total Transaction:{{detail.gross_amount}}
Total Transaction:{{detail.total_transaction}}
</div>
<div class="col-xs-3 col-sm-3 nowrap">
Total Charge:{{detail.total_charge}}
@ -26,10 +26,10 @@
RoyalPay Charge:{{detail.royalPay_charge}}
</div>
<div class="col-xs-3 col-sm-3 nowrap">
Org Net Charge:{{detail.org_net_charge}}
Net Charge:{{detail.net_charge}}
</div>
<div class="col-xs-6 col-sm-6 nowrap">
City Partner Charge:{{detail.org_charge}}
City Partner Charge:{{detail.city_partner_charge}}
</div>
<div class="col-xs-3 ng-scope"
@ -45,8 +45,8 @@
ng-bind="detail.Alipay_total_charge|currency:'AUD'"></span></h5>
<h5 class="ng-binding">RoyalPay Charge:<span
ng-bind="detail.Alipay_royalpay_charge|currency:'AUD'"></span></h5>
<h5 class="ng-binding">Org Net Charge:<span
ng-bind="detail.Alipay_org_net_charge|currency:'AUD'"></span></h5>
<h5 class="ng-binding">Net Charge:<span
ng-bind="detail.Alipay_net_charge|currency:'AUD'"></span></h5>
<h5 class="ng-binding">City Partner Charge:<span
ng-bind="detail.Alipay_org_charge|currency:'AUD'"></span></h5>
</div>
@ -66,8 +66,8 @@
ng-bind="detail.Bestpay_total_charge|currency:'AUD'"></span></h5>
<h5 class="ng-binding">RoyalPay Charge:<span
ng-bind="detail.Bestpay_royalpay_charge|currency:'AUD'"></span></h5>
<h5 class="ng-binding">Org Net Charge:<span
ng-bind="detail.Bestpay_org_net_charge|currency:'AUD'"></span></h5>
<h5 class="ng-binding">Net Charge:<span
ng-bind="detail.Bestpay_net_charge|currency:'AUD'"></span></h5>
<h5 class="ng-binding">City Partner Charge:<span
ng-bind="detail.Bestpay_org_charge|currency:'AUD'"></span></h5>
</div>
@ -87,8 +87,8 @@
ng-bind="detail.Wechat_total_charge|currency:'AUD'"></span></h5>
<h5 class="ng-binding"> RoyalPay Charge:<span
ng-bind="detail.Wechat_royalpay_charge|currency:'AUD'"></span></h5>
<h5 class="ng-binding">Org Net Charge:<span
ng-bind="detail.Wechat_org_net_charge|currency:'AUD'"></span></h5>
<h5 class="ng-binding">Net Charge:<span
ng-bind="detail.Wechat_net_charge|currency:'AUD'"></span></h5>
<h5 class="ng-binding">City Partner Charge:<span
ng-bind="detail.Wechat_org_charge|currency:'AUD'"></span></h5>
</div>
@ -108,8 +108,8 @@
ng-bind="detail.jd_total_charge|currency:'AUD'"></span></h5>
<h5 class="ng-binding"> RoyalPay Charge:<span
ng-bind="detail.jd_royalpay_charge|currency:'AUD'"></span></h5>
<h5 class="ng-binding">Org Net Charge:<span
ng-bind="detail.jd_org_net_charge|currency:'AUD'"></span></h5>
<h5 class="ng-binding">Net Charge:<span
ng-bind="detail.jd_net_charge|currency:'AUD'"></span></h5>
<h5 class="ng-binding">City Partner Charge:<span
ng-bind="detail.jd_org_charge|currency:'AUD'"></span></h5>
</div>
@ -127,7 +127,7 @@
<th>Transaction</th>
<th>Total Charge</th>
<th>RoyalPay Charge</th>
<th>Org Net Charge</th>
<th>Net Charge</th>
<th>City Partner Charge</th>
<th>Details</th>
</tr>
@ -138,7 +138,7 @@
<td ng-bind="log.gross_amount|currency:'AUD'"></td>
<td ng-bind="log.total_charge|currency:'AUD'"></td>
<td ng-bind="log.royalpay_charge|currency:'AUD'"></td>
<td ng-bind="log.org_net_charge|currency:'AUD'"></td>
<td ng-bind="log.net_charge|currency:'AUD'"></td>
<td ng-bind="log.org_charge|currency:'AUD'"></td>
<td>
@ -157,7 +157,7 @@
<th>Transaction Amount</th>
<th>Total Charge</th>
<th>RoyalPay Charge</th>
<th>Org Net Charge</th>
<th>Net Charge</th>
<th>City Partner Charge</th>
<th>channel</th>
</tr>
@ -171,7 +171,7 @@
<td ng-bind="detail.gross_amount"></td>
<td ng-bind="detail.total_charge"></td>
<td ng-bind="detail.royalpay_charge"></td>
<td ng-bind="detail.org_net_charge"></td>
<td ng-bind="detail.net_charge"></td>
<td ng-bind="detail.org_charge"></td>
<td ng-bind="detail.channel"></td>
</tr>

Loading…
Cancel
Save