|
|
|
@ -74,11 +74,11 @@ public class CityPartnerPrizeController {
|
|
|
|
|
String cityPartnerName = "";
|
|
|
|
|
int org_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"));
|
|
|
|
|
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"));
|
|
|
|
|
if(jsonObject.getBigDecimal("net_charge")!=null) {
|
|
|
|
|
if (jsonObject.getBigDecimal("net_charge") != null) {
|
|
|
|
|
netCharge = netCharge.add(jsonObject.getBigDecimal("net_charge"));
|
|
|
|
|
}
|
|
|
|
|
org_id = jsonObject.getIntValue("org_id");
|
|
|
|
@ -90,7 +90,7 @@ public class CityPartnerPrizeController {
|
|
|
|
|
sumResult.put("org_charge", orgCharge);
|
|
|
|
|
sumResult.put("org_name", cityPartnerName);
|
|
|
|
|
sumResult.put("org_id", org_id);
|
|
|
|
|
sumResult.put("net_charge",netCharge);
|
|
|
|
|
sumResult.put("net_charge", netCharge);
|
|
|
|
|
sumResult.put("channel_detail", entry.getValue());
|
|
|
|
|
resultTotalCharge = resultTotalCharge.add(totalCharge);
|
|
|
|
|
resultRoyalpayCharge = resultRoyalpayCharge.add(royalpayCharge);
|
|
|
|
@ -99,11 +99,11 @@ public class CityPartnerPrizeController {
|
|
|
|
|
partnerInfos.add(sumResult);
|
|
|
|
|
}
|
|
|
|
|
result.put("monthstr", monthStr);
|
|
|
|
|
result.put("total_charge",resultTotalCharge);
|
|
|
|
|
result.put("royalpay_charge",resultRoyalpayCharge);
|
|
|
|
|
result.put("net_charge",resultNetCharge);
|
|
|
|
|
result.put("org_charge",resultOrgCharge);
|
|
|
|
|
result.put("partner_info_list",partnerInfos);
|
|
|
|
|
result.put("total_charge", resultTotalCharge);
|
|
|
|
|
result.put("royalpay_charge", resultRoyalpayCharge);
|
|
|
|
|
result.put("net_charge", resultNetCharge);
|
|
|
|
|
result.put("org_charge", resultOrgCharge);
|
|
|
|
|
result.put("partner_info_list", partnerInfos);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -122,10 +122,12 @@ public class CityPartnerPrizeController {
|
|
|
|
|
public JSONObject getreferrerPrizeDetail(@PathVariable String monthStr, @PathVariable String orgId) {
|
|
|
|
|
return cityPartnerPrizeService.getReferrerPrizeDetail(monthStr, orgId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping("/referrer/months")
|
|
|
|
|
public List<JSONObject> listReferrerAvailableMonths(@RequestParam String year) {
|
|
|
|
|
return cityPartnerPrizeService.listReferrerAvailableMonths(year);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/referrer/months/{monthStr}")
|
|
|
|
|
public JSONObject getReferrerPrizeInfo(@PathVariable String monthStr) {
|
|
|
|
|
List<JSONObject> partnerPrizeInfos = cityPartnerPrizeService.getReferrerPrizeInfoList(monthStr);
|
|
|
|
@ -151,7 +153,7 @@ public class CityPartnerPrizeController {
|
|
|
|
|
String cityPartnerName = "";
|
|
|
|
|
int org_id = 0;
|
|
|
|
|
for (JSONObject jsonObject : entry.getValue()) {
|
|
|
|
|
grossAmount = grossAmount.add(jsonObject.getBigDecimal("gross_amount"));
|
|
|
|
|
grossAmount = grossAmount.add(jsonObject.getBigDecimal("gross_amount"));
|
|
|
|
|
orgCharge = orgCharge.add(jsonObject.getBigDecimal("org_charge"));
|
|
|
|
|
org_id = jsonObject.getIntValue("org_id");
|
|
|
|
|
cityPartnerName = jsonObject.getString("name");
|
|
|
|
@ -166,26 +168,28 @@ public class CityPartnerPrizeController {
|
|
|
|
|
partnerInfos.add(sumResult);
|
|
|
|
|
}
|
|
|
|
|
result.put("monthstr", monthStr);
|
|
|
|
|
result.put("gross_amount",resultGrossAmount);
|
|
|
|
|
result.put("org_charge",resultOrgCharge);
|
|
|
|
|
result.put("partner_info_list",partnerInfos);
|
|
|
|
|
result.put("gross_amount", resultGrossAmount);
|
|
|
|
|
result.put("org_charge", resultOrgCharge);
|
|
|
|
|
result.put("partner_info_list", partnerInfos);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/agent/generate", method = RequestMethod.POST)
|
|
|
|
|
public void generateAgent(@RequestBody JSONObject param, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject managerInfo) {
|
|
|
|
|
String month = param.getString("month");
|
|
|
|
|
cityPartnerPrizeService.generateAgent(month,managerInfo.getIntValue("org_id"));
|
|
|
|
|
cityPartnerPrizeService.generateAgent(month, managerInfo.getIntValue("org_id"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ManagerMapping("/agent/months/{monthStr}/orgs/{orgId}")
|
|
|
|
|
public JSONObject getAgentPrizeDetail(@PathVariable String monthStr, @PathVariable String orgId) {
|
|
|
|
|
return cityPartnerPrizeService.getAgentPrizeDetail(monthStr, orgId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping("/agent/months")
|
|
|
|
|
public List<JSONObject> listAgentAvailableMonths(@RequestParam String year) {
|
|
|
|
|
return cityPartnerPrizeService.listAgentAvailableMonths(year);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/agent/months/{monthStr}")
|
|
|
|
|
public JSONObject getAgentPrizeInfo(@PathVariable String monthStr) {
|
|
|
|
|
List<JSONObject> partnerPrizeInfos = cityPartnerPrizeService.getAgentPrizeInfoList(monthStr);
|
|
|
|
@ -200,35 +204,69 @@ public class CityPartnerPrizeController {
|
|
|
|
|
partenerPrizeMap.put(key, tmpList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BigDecimal royalpay_charge = BigDecimal.ZERO;
|
|
|
|
|
|
|
|
|
|
List<JSONObject> partnerPrizeList = cityPartnerPrizeService.getCityPartnerPrizeInfoList(monthStr);
|
|
|
|
|
Map<Integer, JSONObject> countPartnerPrizeMap = new HashMap<>();
|
|
|
|
|
for (JSONObject p : partnerPrizeList) {
|
|
|
|
|
royalpay_charge = royalpay_charge.add(p.getBigDecimal("royalpay_charge"));
|
|
|
|
|
Integer key = p.getInteger("org_id");
|
|
|
|
|
JSONObject partnerTmp = countPartnerPrizeMap.get(key);
|
|
|
|
|
if (partnerTmp == null) {
|
|
|
|
|
JSONObject partner = new JSONObject();
|
|
|
|
|
partner.put("royalpay_charge", p.getBigDecimal("royalpay_charge"));
|
|
|
|
|
countPartnerPrizeMap.put(key, partner);
|
|
|
|
|
} else {
|
|
|
|
|
partnerTmp.put("royalpay_charge", partnerTmp.getBigDecimal("royalpay_charge").add(p.getBigDecimal("royalpay_charge")));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
List<JSONObject> partnerInfos = new ArrayList<>(partenerPrizeMap.size());
|
|
|
|
|
BigDecimal resultGrossAmount = BigDecimal.ZERO;
|
|
|
|
|
BigDecimal resultOrgCharge = BigDecimal.ZERO;
|
|
|
|
|
BigDecimal resultAgentCharge = BigDecimal.ZERO;
|
|
|
|
|
BigDecimal resultOrgNetCharge = BigDecimal.ZERO;
|
|
|
|
|
for (Map.Entry<String, List<JSONObject>> entry : partenerPrizeMap.entrySet()) {
|
|
|
|
|
JSONObject sumResult = new JSONObject();
|
|
|
|
|
BigDecimal grossAmount = BigDecimal.ZERO;
|
|
|
|
|
BigDecimal orgCharge = BigDecimal.ZERO;
|
|
|
|
|
BigDecimal agentCharge = BigDecimal.ZERO;
|
|
|
|
|
BigDecimal orgNetCharge = BigDecimal.ZERO;
|
|
|
|
|
String cityPartnerName = "";
|
|
|
|
|
int org_id = 0;
|
|
|
|
|
for (JSONObject jsonObject : entry.getValue()) {
|
|
|
|
|
grossAmount = grossAmount.add(jsonObject.getBigDecimal("gross_amount"));
|
|
|
|
|
grossAmount = grossAmount.add(jsonObject.getBigDecimal("gross_amount"));
|
|
|
|
|
orgCharge = orgCharge.add(jsonObject.getBigDecimal("org_charge"));
|
|
|
|
|
agentCharge = agentCharge.add(jsonObject.getBigDecimal("total_charge"));
|
|
|
|
|
orgNetCharge = orgNetCharge.add(jsonObject.getBigDecimal("org_net_charge"));
|
|
|
|
|
org_id = jsonObject.getIntValue("org_id");
|
|
|
|
|
cityPartnerName = jsonObject.getString("name");
|
|
|
|
|
}
|
|
|
|
|
sumResult.put("gross_amount", grossAmount);
|
|
|
|
|
sumResult.put("org_charge", orgCharge);
|
|
|
|
|
sumResult.put("org_net_charge",orgNetCharge);
|
|
|
|
|
sumResult.put("org_name", cityPartnerName);
|
|
|
|
|
sumResult.put("org_id", org_id);
|
|
|
|
|
sumResult.put("channel_detail", entry.getValue());
|
|
|
|
|
|
|
|
|
|
sumResult.put("royalpay_charge",countPartnerPrizeMap.get(org_id)==null?0:countPartnerPrizeMap.get(org_id).getBigDecimal("royalpay_charge"));
|
|
|
|
|
resultGrossAmount = resultGrossAmount.add(grossAmount);
|
|
|
|
|
resultOrgCharge = resultOrgCharge.add(orgCharge);
|
|
|
|
|
resultAgentCharge = resultAgentCharge.add(agentCharge);
|
|
|
|
|
resultOrgNetCharge = resultOrgNetCharge.add(orgNetCharge);
|
|
|
|
|
partnerInfos.add(sumResult);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.put("royalpay_charge", royalpay_charge);
|
|
|
|
|
result.put("monthstr", monthStr);
|
|
|
|
|
result.put("gross_amount",resultGrossAmount);
|
|
|
|
|
result.put("org_charge",resultOrgCharge);
|
|
|
|
|
result.put("partner_info_list",partnerInfos);
|
|
|
|
|
result.put("gross_amount", resultGrossAmount);
|
|
|
|
|
result.put("agent_total_charge", resultAgentCharge);
|
|
|
|
|
result.put("org_charge", resultOrgCharge);
|
|
|
|
|
result.put("org_net_charge", resultOrgNetCharge);
|
|
|
|
|
result.put("partner_info_list", partnerInfos);
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|