eason.qian 7 years ago
parent bace0e420e
commit 322c4ea227

@ -2,6 +2,7 @@ package au.com.royalpay.payment.manage.analysis.web;
import au.com.royalpay.payment.manage.analysis.beans.AnalysisBean;
import au.com.royalpay.payment.manage.analysis.core.DashboardService;
import au.com.royalpay.payment.manage.organizations.core.OrgManager;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.manage.permission.manager.RequirePartner;
@ -20,32 +21,28 @@ import java.util.List;
public class DashboardController {
@Resource
private DashboardService dashboardService;
@Resource
private OrgManager orgManager;
@ManagerMapping("/common_analysis_1")
public JSONObject commonAnalysis1(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
JSONObject params = analysis.toParams(null);
if (manager.getInteger("org_id") != null) {
params.put("org_id", manager.getIntValue("org_id"));
}
orgManager.checkOrg(manager,params);
return dashboardService.getCommonAnalysis1(params);
}
@ManagerMapping("/common_analysis_2")
public JSONObject commonAnalysis2(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
JSONObject params = analysis.toParams(null);
if (manager.getInteger("org_id") != null) {
params.put("org_id", manager.getIntValue("org_id"));
}
orgManager.checkOrg(manager,params);
return dashboardService.getCommonAnalysis2(params);
}
@ManagerMapping("/trade_in_types")
public List<JSONObject> tradeInTypes(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
JSONObject params = analysis.toParams(null);
if (manager.getInteger("org_id") != null) {
params.put("org_id", manager.getIntValue("org_id"));
}
orgManager.checkOrg(manager,params);
return dashboardService.getTradeInTypes(params);
}
@ -53,18 +50,14 @@ public class DashboardController {
public List<JSONObject> topTradePartners(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,
@RequestParam(defaultValue = "10") int limit) {
JSONObject params = analysis.toParams(null);
if (manager.getInteger("org_id") != null) {
params.put("org_id", manager.getIntValue("org_id"));
}
orgManager.checkOrg(manager,params);
return dashboardService.getTopTradePartners(params, limit);
}
@ManagerMapping("/rank_trade_partners")
public List<JSONObject> rankTradePartners(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
JSONObject params = analysis.toParams(null);
if (manager.getInteger("org_id") != null) {
params.put("org_id", manager.getIntValue("org_id"));
}
orgManager.checkOrg(manager,params);
if (analysis.isOnlyGroup() && ManagerRole.BD_LEADER.hasRole(manager.getIntValue("role"))) {
params.put("bd_group", manager.getString("manager_id"));
if (analysis.getGroup_bd()>0){
@ -77,9 +70,7 @@ public class DashboardController {
@ManagerMapping("/trade_in_hours")
public List<JSONObject> tradeInHours(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
JSONObject params = analysis.toParams(null);
if (manager.getInteger("org_id") != null) {
params.put("org_id", manager.getIntValue("org_id"));
}
orgManager.checkOrg(manager,params);
if (analysis.isOnlyGroup() && ManagerRole.BD_LEADER.hasRole(manager.getIntValue("role"))) {
params.put("bd_group", manager.getString("manager_id"));
if (analysis.getGroup_bd()>0){
@ -92,18 +83,14 @@ public class DashboardController {
@ManagerMapping("/fee_analysis")
public List<JSONObject> tradeInDays(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
JSONObject params = analysis.toParams(null);
if (manager.getInteger("org_id") != null) {
params.put("org_id", manager.getIntValue("org_id"));
}
orgManager.checkOrg(manager,params);
return dashboardService.getTradeAnalysisInDays(params);
}
@ManagerMapping("/partners_in_types")
public List<JSONObject> partnersInTypes(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
JSONObject params = analysis.toParams(null);
if (manager.getInteger("org_id") != null) {
params.put("org_id", manager.getIntValue("org_id"));
}
orgManager.checkOrg(manager,params);
if (analysis.isOnlyGroup() && ManagerRole.BD_LEADER.hasRole(manager.getIntValue("role"))) {
params.put("bd_group", manager.getString("manager_id"));
if (analysis.getGroup_bd()>0){
@ -118,9 +105,7 @@ public class DashboardController {
@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
JSONObject params = analysis.toParams(null);
params.put("trade_type", trade_type);
if (manager.getInteger("org_id") != null) {
params.put("org_id", manager.getIntValue("org_id"));
}
orgManager.checkOrg(manager,params);
if (analysis.isOnlyGroup() && ManagerRole.BD_LEADER.hasRole(manager.getIntValue("role"))) {
params.put("bd_group", manager.getString("manager_id"));
if (analysis.getGroup_bd()>0){
@ -134,9 +119,7 @@ public class DashboardController {
@ManagerMapping("/trade_in_time")
public List<JSONObject> tradeInTime(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
JSONObject params = analysis.toParams(null);
if (manager.getInteger("org_id") != null) {
params.put("org_id", manager.getIntValue("org_id"));
}
orgManager.checkOrg(manager,params);
return dashboardService.getTradeAnalysisInTime(params);
}
@ -154,9 +137,7 @@ public class DashboardController {
@ManagerMapping("/Total_platform_amount")
public JSONObject getPlatformAmount(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager){
JSONObject params = analysis.toParams(null);
if (manager.getInteger("org_id") != null) {
params.put("org_id", manager.getIntValue("org_id"));
}
orgManager.checkOrg(manager,params);
return dashboardService.getPlatformAmount(params);
}
}

@ -1,5 +1,6 @@
package au.com.royalpay.payment.manage.signin.web;
import au.com.royalpay.payment.manage.organizations.core.OrgManager;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.manage.permission.manager.RequireManager;
@ -25,6 +26,8 @@ import java.util.Map;
public class ManagerAccountsController {
@Resource
private ManagerAccountsService managerAccountsService;
@Resource
private OrgManager orgManager;
// @RequestMapping(method = RequestMethod.GET)
// @RequireManager(role = {ManagerRole.ADMIN, ManagerRole.ACCOUNT_MANAGER})
@ -48,11 +51,14 @@ public class ManagerAccountsController {
@ManagerMapping(value = "/roles/bd_user", method = RequestMethod.GET)
public List<JSONObject> listBDUsers(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager) {
return managerAccountsService.listBDUsers(loginManager);
JSONObject params = new JSONObject();
orgManager.checkOrg(loginManager,params);
return managerAccountsService.listBDUsers(params);
}
@ManagerMapping(value = "/roles/org_bd_user", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.ACCOUNT_MANAGER})
public List<JSONObject> listOrgBDUsers(@RequestParam Map<String, Object> map) {
return managerAccountsService.listBDUsers((JSONObject) JSON.toJSON(map));
public List<JSONObject> listOrgBDUsers(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager,@RequestParam Map<String, Object> map) {
JSONObject params = (JSONObject) JSON.toJSON(map);
return managerAccountsService.listBDUsers(params);
}
@ManagerMapping(value = "/{userId}", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.ACCOUNT_MANAGER,ManagerRole.BD_USER})

@ -8,7 +8,9 @@
WHERE
create_time >= #{begin} AND create_time <= #{end} and is_valid=1 and (approve_result is null or approve_result !=0)
]]>
<if test="org_id!=null">and org_id=#{org_id}</if>
<if test="org_id!=null and org_ids==null">and org_id=#{org_id}</if>
<if test="org_ids!=null">and org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
</select>
<select id="countNewClientsHistory" resultType="com.alibaba.fastjson.JSONObject">
@ -25,7 +27,9 @@
<![CDATA[
where a.datelist>= #{begin} AND a.datelist< #{end} AND c.is_valid=1
]]>
<if test="org_id!=null">and c.org_id=#{org_id}</if>
<if test="org_id!=null and org_ids==null">and c.org_id=#{org_id}</if>
<if test="org_ids!=null">and c.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<if test="bd_group!=null">and c.client_id in
(SELECT b.client_id FROM sys_client_bd b
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
@ -43,7 +47,9 @@
WHERE
create_time <= #{end} AND is_valid=1 and (approve_result is null or approve_result !=0)
]]>
<if test="org_id!=null">and org_id=#{org_id}</if>
<if test="org_id!=null and org_ids==null">and org_id=#{org_id}</if>
<if test="org_ids!=null">and org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
</select>
<select id="countTradedPartners" resultType="java.lang.Integer">
<![CDATA[
@ -52,7 +58,9 @@
INNER JOIN pmt_orders o ON o.client_id = p.client_id AND o.status >4 AND o.confirm_time IS NOT NULL
WHERE o.create_time >= #{begin} AND o.create_time <= #{end}
]]>
<if test="org_id!=null">and p.org_id=#{org_id}</if>
<if test="org_id!=null and org_ids==null">and p.org_id=#{org_id}</if>
<if test="org_ids!=null">and p.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
</select>
<select id="countTradePartnersHistory" resultType="com.alibaba.fastjson.JSONObject">
@ -62,7 +70,9 @@
INNER JOIN pmt_orders o ON o.client_id = p.client_id AND o.status >4 AND o.confirm_time IS NOT NULL
WHERE o.create_time >= #{begin} AND o.create_time <= #{end}
]]>
<if test="org_id!=null">and p.org_id=#{org_id}</if>
<if test="org_id!=null and org_ids==null">and p.org_id=#{org_id}</if>
<if test="org_ids!=null">and p.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<if test="bd_group!=null">and p.client_id in
(SELECT b.client_id FROM sys_client_bd b
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
@ -85,7 +95,9 @@
INNER JOIN pmt_orders o ON t.order_id = o.order_id
WHERE o.create_time >= #{begin} AND o.create_time <= #{end}
]]>
<if test="org_id!=null">and p.org_id=#{org_id}</if>
<if test="org_id!=null and org_ids==null">and p.org_id=#{org_id}</if>
<if test="org_ids!=null">and p.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<if test="bd_group!=null">and p.client_id in
(SELECT b.client_id FROM sys_client_bd b
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
@ -107,7 +119,9 @@
</if>
<where>
is_valid = 1 and industry &lt;'400' AND approve_result=1
<if test="org_id!=null">and org_id=#{org_id}</if>
<if test="org_id!=null and org_ids==null">and org_id=#{org_id}</if>
<if test="org_ids!=null">and org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<if test="bd_group!=null">and c.client_id in
(SELECT b.client_id FROM sys_client_bd b
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id

Loading…
Cancel
Save