Merge branch 'develop'

master
eason.qian 7 years ago
commit 69120fb7cc

@ -132,6 +132,21 @@
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
</dependency>
<!--jpush start -->
<dependency>
<groupId>cn.jpush.api</groupId>
<artifactId>jpush-client</artifactId>
<version>3.3.3</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.4</version>
</dependency>
<!--jpush end -->
</dependencies>
<build>
<plugins>

@ -106,7 +106,7 @@ ALTER TABLE `sys_accounts`
MODIFY COLUMN `creator` varchar(50) NOT NULL COMMENT '开户者';
ALTER TABLE `sys_clients_audit_process`
MODIFY COLUMN `operator_id` varchar(50) NOT NULL ;
MODIFY COLUMN `operator_id` tinyint(1) NOT NULL ;
ALTER TABLE `pmt_refunds`
MODIFY COLUMN `operator_id` varchar(50) DEFAULT NULL COMMENT '退款操作者账号';
@ -117,5 +117,26 @@ ALTER TABLE `sys_clients_apply`
ALTER TABLE `cashback_draw_deposits`
MODIFY COLUMN `operator_id` varchar(50) NOT NULL ;
ALTER TABLE `sys_clients`
ADD COLUMN `local_merchant` tinyint(1) DEFAULT 0;
--
ALTER TABLE sys_clients_customers ADD COLUMN headimg VARCHAR(200) DEFAULT NULL COMMENT '头像地址';
ALTER TABLE sys_clients_customers ADD COLUMN nick_name VARCHAR(80) DEFAULT NULL COMMENT '昵称';
ALTER TABLE sys_clients_customers ADD COLUMN tag VARCHAR(100) DEFAULT NULL COMMENT '标签';
ALTER TABLE sys_clients_customers ADD COLUMN payment_times INT DEFAULT 1 COMMENT '消费次数';
ALTER TABLE sys_clients_customers ADD COLUMN total_amount decimal(10 , 2) DEFAULT NULL COMMENT '消费总金额';
ALTER TABLE sys_clients_customers ADD COLUMN update_time datetime default NULL COMMENT '创建时间';
ALTER TABLE sys_clients_customers ADD COLUMN channel varchar(15) not NULL ;
ALTER TABLE sys_clients_customers ADD COLUMN last_payment_time datetime DEFAULT NULL COMMENT '最后一次付款时间';
ALTER TABLE sys_org ADD COLUMN parent_org_id int(11) DEFAULT NULL;

@ -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);
}
}

@ -32,8 +32,6 @@ public interface RetailAppService {
void sign_out(JSONObject device);
void sendAppMessage();
void sendOrderAppMessage(JSONObject order, int client_id);
void sendRefundAppMessage(String refundAmount, JSONObject order);

@ -1,5 +1,42 @@
package au.com.royalpay.payment.manage.appclient.core.impls;
import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.slf4j.LoggerFactory;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import au.com.royalpay.payment.core.PaymentApi;
import au.com.royalpay.payment.manage.analysis.mappers.CustomerAndOrdersStatisticsMapper;
import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper;
@ -14,17 +51,27 @@ import au.com.royalpay.payment.manage.mappers.log.ClearingDetailAnalysisMapper;
import au.com.royalpay.payment.manage.mappers.log.ClearingDetailMapper;
import au.com.royalpay.payment.manage.mappers.payment.OrderMapper;
import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
import au.com.royalpay.payment.manage.mappers.system.*;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientDeviceTokenMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientSettleDelayConfMapper;
import au.com.royalpay.payment.manage.mappers.system.CustomerMapper;
import au.com.royalpay.payment.manage.mappers.system.CustomerRelationAlipayMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.notice.beans.NoticeInfo;
import au.com.royalpay.payment.manage.notice.core.NoticeManage;
import au.com.royalpay.payment.manage.notice.core.NoticePartner;
import au.com.royalpay.payment.manage.pushMessage.APNSMessageHelper;
import au.com.royalpay.payment.manage.pushMessage.JpushMessageHelper;
import au.com.royalpay.payment.manage.pushMessage.bean.AppManagerMessageBuilder;
import au.com.royalpay.payment.manage.pushMessage.bean.JpushMessage;
import au.com.royalpay.payment.manage.signin.beans.ChangePwdBean;
import au.com.royalpay.payment.manage.signin.core.SignInAccountService;
import au.com.royalpay.payment.manage.signin.core.impls.SignInAccountServiceImpl;
import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery;
import au.com.royalpay.payment.tools.cms.RoyalPayCMSSupport;
import au.com.royalpay.payment.tools.device.DeviceSupport;
import au.com.royalpay.payment.tools.device.message.AppMessage;
import au.com.royalpay.payment.tools.device.message.AppMsgSender;
import au.com.royalpay.payment.tools.device.support.DeviceRegister;
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
@ -35,37 +82,6 @@ import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
import au.com.royalpay.payment.tools.utils.PageListUtils;
import au.com.royalpay.payment.tools.utils.TimeZoneUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import com.notnoop.apns.APNS;
import com.notnoop.apns.ApnsService;
import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import javax.annotation.Resource;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
* Created by yishuqian on 28/03/2017.
@ -77,77 +93,64 @@ public class RetailAppServiceImp implements RetailAppService {
private TransactionAnalysisMapper transactionAnalysisMapper;
@Resource
private TransactionMapper transactionMapper;
@Resource
private ClientManager clientManager;
@Resource
private NoticeManage noticeManage;
@Resource
private NoticePartner noticePartner;
@Resource
private CustomerAndOrdersStatisticsMapper customerAndOrdersStatisticsMapper;
@Resource
private ClearingDetailMapper clearingDetailMapper;
@Resource
private OrderMapper orderMapper;
@Resource
private ClientAccountMapper clientAccountMapper;
@Resource
private AppMessageLogMapper appMessageLogMapper;
@Resource
private SignInAccountService signInAccountService;
@Resource
private CashbackService cashbackService;
@Resource
private ClearingDetailAnalysisMapper clearingDetailAnalysisMapper;
@Resource
private ClientSettleDelayConfMapper clientSettleDelayConfMapper;
@Resource
private XPlanFundConfigServiceImpl xPlanFundConfigService;
@Resource
private MerchantInfoProvider merchantInfoProvider;
@Resource
private RoyalPayCMSSupport royalPayCMSSupport;
@Resource
private PaymentApi paymentApi;
@Resource
private DeviceSupport deviceSupport;
@Resource
private CustomerRelationAlipayMapper customerRelationAlipayMapper;
@Resource
private CustomerMapper customerMapper;
@Value("classpath:apple_message_cert_dev.p12")
private org.springframework.core.io.Resource appleMessageFileDev;
@Value("classpath:apple_message_cert_product.p12")
private org.springframework.core.io.Resource appleMessageFileProduct;
@Value("${apple.message.apns.password}")
private String appleMessagePassword;
@Resource
private APNSMessageHelper apnsMessageHelper;
@Resource
private ClientDeviceTokenMapper clientDeviceTokenMapper;
@Resource
private JpushMessageHelper jpushMessageHelper;
private ThreadPoolExecutor sendingAppleMsgPool = new ThreadPoolExecutor(10, 30, 5, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
private Map<String, AppMsgSender> senderMap = new HashMap<>();
@Resource
public void setAppMsgSenders(AppMsgSender[] senders) {
Arrays.stream(senders).forEach(appMsgSender -> senderMap.put(appMsgSender.devType(), appMsgSender));
}
private ThreadPoolExecutor sendingAppleMsgPool = new ThreadPoolExecutor(10, 30, 5, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
@Resource
private CouponValidateService couponVerificationService;
//若app未传client_ids,检测是否包含子商户,若包含查询全部
// 若app未传client_ids,检测是否包含子商户,若包含查询全部
private void setAllClientIds(JSONObject params, int clientId) {
if (params.containsKey("client_ids")) {
return;
@ -175,10 +178,10 @@ public class RetailAppServiceImp implements RetailAppService {
params.put("client_id", client_id);
res.put("trade_amount", transactionAnalysisMapper.analysisTotalAmount(params));
res.put("trade_count", transactionAnalysisMapper.analysisTotalCount(params));
// res.put("refund_amount", transactionAnalysisMapper.analysisRefundAmount(params));
// res.put("refund_amount", transactionAnalysisMapper.analysisRefundAmount(params));
res.put("not_settled", transactionAnalysisMapper.analysisNotSettled(params));
res.put("old_customers", transactionAnalysisMapper.countOldCustomers(params));
//微信小程序不查询汇率
// 微信小程序不查询汇率
if (!StringUtils.equals(device.getString("client_type"), "wxapp")) {
res.put("rate", paymentApi.channelApi("Wechat").queryExchangeRateDecimal(client_id));
}
@ -266,7 +269,6 @@ public class RetailAppServiceImp implements RetailAppService {
}
}
@Override
public JSONObject getClientSettlementLog(JSONObject device, AppQueryBean appQueryBean) {
String clientType = device.getString("client_type");
@ -280,7 +282,8 @@ public class RetailAppServiceImp implements RetailAppService {
JSONObject params = appQueryBean.toParams();
setAllClientIds(params, client_id);
params.put("client_id", client_id);
PageList<JSONObject> logs = clearingDetailMapper.listClientSettlementLog(params, new PageBounds(appQueryBean.getPage(), appQueryBean.getLimit(), Order.formString("report_date.desc")));
PageList<JSONObject> logs = clearingDetailMapper.listClientSettlementLog(params,
new PageBounds(appQueryBean.getPage(), appQueryBean.getLimit(), Order.formString("report_date.desc")));
return PageListUtils.buildPageListResult(logs);
}
@ -354,11 +357,13 @@ public class RetailAppServiceImp implements RetailAppService {
params.put("dev_id", device.getString("dev_id"));
}
params.put("client_id", client_id);
PageList<JSONObject> orders = orderMapper.listOrdersByClients(params, new PageBounds(query.getPage(), query.getLimit(), Order.formString("create_time.desc")));
PageList<JSONObject> orders = orderMapper.listOrdersByClients(params,
new PageBounds(query.getPage(), query.getLimit(), Order.formString("create_time.desc")));
TimeZoneUtils.switchTimeZone(orders, query.getTimezone(), "create_time", "transaction_time", "confirm_time");
ArrayList<String> date_contains = new ArrayList<>();
for (JSONObject order : orders) {
// Date tradeDate = order.getDate("confirm_time") == null ? (order.getDate("transaction_time") == null ? order.getDate("create_time") : order.getDate("transaction_time")) : order.getDate("confirm_time");
// Date tradeDate = order.getDate("confirm_time") == null ? (order.getDate("transaction_time") == null ?
// order.getDate("create_time") : order.getDate("transaction_time")) : order.getDate("confirm_time");
Calendar calendar = (Calendar) order.get("create_time");
String trade_date = DateFormatUtils.format(calendar, "yyyy-MM-dd");
String trade_time = DateFormatUtils.format(calendar, "HH:mm:ss");
@ -369,7 +374,7 @@ public class RetailAppServiceImp implements RetailAppService {
TradeLogQuery date_query = new TradeLogQuery();
date_query.setDatefrom(re_date);
date_query.setDateto(re_date);
// date_query.setStatus(OrderStatus.ALL);
// date_query.setStatus(OrderStatus.ALL);
if (params.containsKey("client_ids")) {
date_query.setClient_ids((String[]) params.get("client_ids"));
}
@ -388,7 +393,7 @@ public class RetailAppServiceImp implements RetailAppService {
query.setGateway_app("11");
String clientType = device.getString("client_type");
DeviceRegister register = deviceSupport.findRegister(clientType);
Assert.notNull(register,"Device is not registered");
Assert.notNull(register, "Device is not registered");
int client_id = device.getIntValue("client_id");
JSONObject client = clientManager.getClientInfo(client_id);
String timezone = client.getString("timezone");
@ -455,31 +460,6 @@ public class RetailAppServiceImp implements RetailAppService {
}
@Override
public void sendAppMessage() {
// String p12Path = "D:/MbaikeDevCertificates.p12";
// InputStream keyIns = appleMessageFile.getInputStream();
// String password = "F1b5*ChJPp73";
String pushToken = "719e4b7a7ed8b9000188440228437714d9dc67785f1791fae01234dae6a1570c";
JSONObject order = new JSONObject();
order.put("clearing_amount", 0.01);
order.put("client_id", 9);
order.put("client_moniker", "PINE");
order.put("order_id", "9201704110348156694986");
try {
/**设置参数,发送数据**/
InputStream keyIns = appleMessageFileProduct.getInputStream();
ApnsService service = APNS.newService().withCert(keyIns, appleMessagePassword).withProductionDestination().build();
String payload = APNS.newPayload().alertTitle("到账通知").alertBody("Hello,0.01AUD").badge(1).sound("default").customField("data", order).build();
service.push(pushToken, payload);
System.out.println("推送信息已发送!");
} catch (Exception e) {
logger.error("出错了:" + e.getMessage());
}
}
@Override
public void sendOrderAppMessage(final JSONObject order, int client_id) {
logger.debug("sendOrderAppMessage-" + client_id + "-" + order.getString("order_id"));
@ -491,21 +471,32 @@ public class RetailAppServiceImp implements RetailAppService {
return;
}
System.out.println("Device Token" + token);
//todo 抽象发送信息接口,根据设备类型选择不同实现类
JSONObject log = saveAppMessageLog(devToken.getString("dev_id"), devToken.getIntValue("client_id"), "payment", token, order.getString("order_id"));
JSONObject log = saveAppMessageLog(devToken.getString("dev_id"), devToken.getIntValue("client_id"), "payment", token,
order.getString("order_id"));
try {
order.put("send_type", "payment");
JSONObject type = new JSONObject();
type.put("send_type", "payment");
type.put("id", order.getString("order_id"));
sendAppleMessage(LocaleSupport.localeMessage("app.message.title.payment"),
LocaleSupport.localeMessage("app.message.body.payment") + order.getString("currency") + order.getDoubleValue("total_amount"), token, order, type);
AppMsgSender sender = senderMap.get(devToken.getString("client_type"));
if (token == null || sender == null) {
return;
}
JSONObject managerMsg = new JSONObject();
managerMsg.put("title", LocaleSupport.localeMessage("app.message.title.payment"));
managerMsg.put("body",
LocaleSupport.localeMessage("app.message.body.payment") + order.getString("currency") + order.getDoubleValue("total_amount"));
managerMsg.put("type", type);
managerMsg.put("data", order);
managerMsg.put("msgType", "payment");
AppMessage appMessage = new AppManagerMessageBuilder(managerMsg).buildMessage();
sender.sendMessage(appMessage, devToken);
log.put("status", 2);
appMessageLogMapper.update(log);
} catch (Exception e) {
logger.error("出错了:" + e.getMessage());
appMessageLogMapper.updateStatus(log.getString("send_id"), 1, e.getMessage());
throw new ServerErrorException("Send App Message Failed", e);
throw new ServerErrorException("Send App "+devToken.getString("client_type")+" Failed", e);
}
};
sendingAppleMsgPool.execute(task);
@ -536,14 +527,26 @@ public class RetailAppServiceImp implements RetailAppService {
return;
}
System.out.println("Device Token" + token);
JSONObject log = saveAppMessageLog(devToken.getString("dev_id"), devToken.getIntValue("client_id"), "refund", token, order.getString("order_id"));
JSONObject log = saveAppMessageLog(devToken.getString("dev_id"), devToken.getIntValue("client_id"), "refund", token,
order.getString("order_id"));
try {
order.put("send_type", "refund");
JSONObject type = new JSONObject();
type.put("send_type", "refund");
type.put("id", order.getString("order_id"));
sendAppleMessage("Refund Message",
LocaleSupport.localeMessage("app.message.body.refund") + refundAmount, token, order, type);
AppMsgSender sender = senderMap.get(devToken.getString("client_type"));
if (token == null || sender == null) {
return;
}
JSONObject managerMsg = new JSONObject();
managerMsg.put("title", "Refund "+devToken.getString("client_type")+"");
managerMsg.put("body", LocaleSupport.localeMessage("app.message.body.refund") + refundAmount);
managerMsg.put("type", type);
managerMsg.put("data", order);
managerMsg.put("msgType", "refund");
AppMessage appMessage = new AppManagerMessageBuilder(managerMsg).buildMessage();
sender.sendMessage(appMessage, devToken);
log.put("status", 2);
appMessageLogMapper.update(log);
} catch (Exception e) {
@ -567,7 +570,8 @@ public class RetailAppServiceImp implements RetailAppService {
if (token == null) {
continue;
}
JSONObject log = saveAppMessageLog(devToken.getString("dev_id"), devToken.getIntValue("client_id"), "notice", token, "notice_id:" + notice.getNotice_id());
JSONObject log = saveAppMessageLog(devToken.getString("dev_id"), devToken.getIntValue("client_id"), "notice", token,
"notice_id:" + notice.getNotice_id());
try {
notice.setContent(null);
JSONObject noticeObj = notice.toJson();
@ -575,7 +579,19 @@ public class RetailAppServiceImp implements RetailAppService {
JSONObject type = new JSONObject();
type.put("send_type", "notice");
type.put("id", notice.getNotice_id());
sendAppleMessage(LocaleSupport.localeMessage("app.message.title.notice"), notice.getTitle(), token, noticeObj, type);
AppMsgSender sender = senderMap.get(devToken.getString("client_type"));
if (token == null || sender == null) {
return;
}
JSONObject managerMsg = new JSONObject();
managerMsg.put("title", LocaleSupport.localeMessage("app.message.title.notice"));
managerMsg.put("body", notice.getTitle());
managerMsg.put("type", type);
managerMsg.put("data", noticeObj);
managerMsg.put("msgType", "notice");
AppMessage appMessage = new AppManagerMessageBuilder(managerMsg).buildMessage();
sender.sendMessage(appMessage, devToken);
log.put("status", 2);
appMessageLogMapper.update(log);
} catch (Exception e) {
@ -600,19 +616,32 @@ public class RetailAppServiceImp implements RetailAppService {
if (token == null) {
return;
}
JSONObject log = saveAppMessageLog(devToken.getString("dev_id"), devToken.getIntValue("client_id"), "cashback", token, order.getString("order_id") + "返现" + cashbackAmount);
JSONObject log = saveAppMessageLog(devToken.getString("dev_id"), devToken.getIntValue("client_id"), "cashback", token,
order.getString("order_id") + "返现" + cashbackAmount);
try {
JSONObject type = new JSONObject();
type.put("send_type", "cashback");
type.put("id", order.getString("order_id"));
sendAppleMessage(LocaleSupport.localeMessage("app.message.title.notice"),
LocaleSupport.localeMessage("app.message.body.cashback") + PlatformEnvironment.getEnv().getForeignCurrency() + " " + cashbackAmount, token, order, type);
AppMsgSender sender = senderMap.get(devToken.getString("client_type"));
if (token == null || sender == null) {
return;
}
JSONObject managerMsg = new JSONObject();
managerMsg.put("title", LocaleSupport.localeMessage("app.message.title.notice"));
managerMsg.put("body", LocaleSupport.localeMessage("app.message.body.cashback") + PlatformEnvironment.getEnv().getForeignCurrency()
+ " " + cashbackAmount);
managerMsg.put("type", type);
managerMsg.put("data", order);
managerMsg.put("msgType", "cashback");
AppMessage appMessage = new AppManagerMessageBuilder(managerMsg).buildMessage();
sender.sendMessage(appMessage, devToken);
log.put("status", 2);
appMessageLogMapper.update(log);
} catch (Exception e) {
logger.error("出错了:" + e.getMessage());
appMessageLogMapper.updateStatus(log.getString("send_id"), 1, e.getMessage());
throw new ServerErrorException("Send App Message Failed", e);
throw new ServerErrorException("Send App "+devToken.getString("client_type")+" Failed", e);
}
}
});
@ -625,7 +654,8 @@ public class RetailAppServiceImp implements RetailAppService {
String clearing_amount = log_clearing_detail.getBigDecimal("clearing_amount").setScale(2, BigDecimal.ROUND_HALF_DOWN).toString();
String settle_date_from = DateFormatUtils.format(log_clearing_detail.getDate("settle_date_from"), "MM/dd/yyyy");
String settle_date_to = DateFormatUtils.format(log_clearing_detail.getDate("settle_date_to"), "MM/dd/yyyy");
logger.debug("sendCleanMessage-" + log_clearing_detail.getString("client_moniker") + "- " + PlatformEnvironment.getEnv().getForeignCurrency() + " " + clearing_amount + "(" + settle_date_from + "-" + settle_date_to + ")");
logger.debug("sendCleanMessage-" + log_clearing_detail.getString("client_moniker") + "- " + PlatformEnvironment.getEnv().getForeignCurrency() + " "
+ clearing_amount + "(" + settle_date_from + "-" + settle_date_to + ")");
List<JSONObject> tokens = clientDeviceTokenMapper.listTokensByClient_id(client_id);
for (JSONObject devToken : tokens) {
String token = devToken.getString("token");
@ -633,24 +663,36 @@ public class RetailAppServiceImp implements RetailAppService {
continue;
}
String log_clearing_detail_id = log_clearing_detail.getString("clear_detail_id");
JSONObject log = saveAppMessageLog(devToken.getString("dev_id"), devToken.getIntValue("client_id"), "clean", token, "本次清算" + log_clearing_detail_id + ",$" + clearing_amount + "(" + settle_date_from + "-" + settle_date_to + ")");
JSONObject log = saveAppMessageLog(devToken.getString("dev_id"), devToken.getIntValue("client_id"), "clean", token,
"本次清算" + log_clearing_detail_id + ",$" + clearing_amount + "(" + settle_date_from + "-" + settle_date_to + ")");
try {
JSONObject type = new JSONObject();
type.put("send_type", "clean");
type.put("id", log_clearing_detail_id);
sendAppleMessage(LocaleSupport.localeMessage("app.message.title.clean"),
LocaleSupport.localeMessage("app.message.body.clean") + PlatformEnvironment.getEnv().getForeignCurrency() + " " + clearing_amount + " (" + settle_date_from + "-" + settle_date_to + ")", token, log_clearing_detail, type);
AppMsgSender sender = senderMap.get(devToken.getString("client_type"));
if (token == null || sender == null) {
return;
}
JSONObject managerMsg = new JSONObject();
managerMsg.put("title", LocaleSupport.localeMessage("app.message.title.clean"));
managerMsg.put("body", LocaleSupport.localeMessage("app.message.body.clean") + PlatformEnvironment.getEnv().getForeignCurrency() + " "
+ clearing_amount + " (" + settle_date_from + "-" + settle_date_to + ")");
managerMsg.put("type", type);
managerMsg.put("data", log_clearing_detail);
managerMsg.put("msgType", "clean");
AppMessage appMessage = new AppManagerMessageBuilder(managerMsg).buildMessage();
sender.sendMessage(appMessage, devToken);
log.put("status", 2);
appMessageLogMapper.update(log);
} catch (Exception e) {
logger.error("出错了:" + e.getMessage());
appMessageLogMapper.updateStatus(log.getString("send_id"), 1, e.getMessage());
throw new ServerErrorException("Send App Message Failed", e);
throw new ServerErrorException("Send App "+devToken.getString("client_type")+" Failed", e);
}
}
}
@Override
public void sendTransactionDailyMessage(JSONObject tradeInfo, int client_id) {
String trade_date = tradeInfo.getString("trade_date");
@ -663,51 +705,43 @@ public class RetailAppServiceImp implements RetailAppService {
if (token == null) {
continue;
}
JSONObject log = saveAppMessageLog(devToken.getString("dev_id"), devToken.getIntValue("client_id"), "daily_notice", token, "Trade Date:" + trade_date);
JSONObject log = saveAppMessageLog(devToken.getString("dev_id"), devToken.getIntValue("client_id"), "daily_notice", token,
"Trade Date:" + trade_date);
try {
JSONObject type = new JSONObject();
type.put("send_type", "daily_notice");
type.put("id", trade_date);
sendAppleMessageDetail(LocaleSupport.localeMessage("app.message.title.daily_notice"),
trade_date + ": 总交易额 " + PlatformEnvironment.getEnv().getForeignCurrency() + total_amount + ", 订单数:" + total_orders + ", 付款人数:" + customers, token, tradeInfo, type);
apnsMessageHelper.sendAppleMessageDetail(
LocaleSupport.localeMessage("app.message.title.daily_notice"), trade_date + ": 总交易额 "
+ PlatformEnvironment.getEnv().getForeignCurrency() + total_amount + ", 订单数:" + total_orders + ", 付款人数:" + customers,
token, tradeInfo, type);
AppMsgSender sender = senderMap.get(devToken.getString("client_type"));
if (token == null || sender == null) {
return;
}
JSONObject managerMsg = new JSONObject();
managerMsg.put("title", LocaleSupport.localeMessage("app.message.title.daily_notice"));
managerMsg.put("body", trade_date + ": 总交易额 "
+ PlatformEnvironment.getEnv().getForeignCurrency() + total_amount + ", 订单数:" + total_orders + ", 付款人数:" + customers);
managerMsg.put("type", type);
managerMsg.put("data", tradeInfo);
managerMsg.put("msgType", "daily_notice");
AppMessage appMessage = new AppManagerMessageBuilder(managerMsg).buildMessage();
sender.sendMessage(appMessage, devToken);
log.put("status", 2);
appMessageLogMapper.update(log);
} catch (Exception e) {
logger.error("出错了:" + e.getMessage());
appMessageLogMapper.updateStatus(log.getString("send_id"), 1, e.getMessage());
throw new ServerErrorException("Send App Message Failed", e);
throw new ServerErrorException("Send App "+devToken.getString("client_type")+" Failed", e);
}
}
}
private void sendAppleMessage(String title, String body, String token, JSONObject data, JSONObject type) throws IOException {
/**设置参数,发送数据**/
InputStream keyIns = appleMessageFileProduct.getInputStream();
ApnsService service = APNS.newService().withCert(keyIns, appleMessagePassword).withProductionDestination().build();
String payload = APNS.newPayload().alertTitle(title).alertBody(body).badge(1).sound("default").customField("data", data).customField("type", type).build();
service.push(token, payload);
System.out.println("推送信息已发送!");
}
/**
*
*
* @param title
* @param body
* @param token
* @param data
* @param type
* @throws IOException
*/
private void sendAppleMessageDetail(String title, String body, String token, JSONObject data, JSONObject type) throws IOException {
/**设置参数,发送数据**/
InputStream keyIns = appleMessageFileProduct.getInputStream();
ApnsService service = APNS.newService().withCert(keyIns, appleMessagePassword).withProductionDestination().build();
String payload = APNS.newPayload().alertTitle(title).alertBody(body).category("myNotificationCategory").badge(1).sound("default").customField("data", data).customField("type", type).build();
service.push(token, payload);
System.out.println("推送信息已发送!");
}
@Override
public void updateReadStatus(JSONObject device, String noticeId) {
String clientType = device.getString("client_type");
@ -747,7 +781,7 @@ public class RetailAppServiceImp implements RetailAppService {
Document doc = Jsoup.parse(res.getString("content"));
String father = "<div style=\"padding:0 10px\"></div>";
String html = doc.body().children().wrap(father).html();
// logger.debug("wrapped html---->"+html);
// logger.debug("wrapped html---->"+html);
res.put("content", doc.html());
return res;
}
@ -756,7 +790,7 @@ public class RetailAppServiceImp implements RetailAppService {
public void changeAccountPassword(JSONObject device, ChangePwdBean change, String account_id) {
String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType);
//JSONObject client = signInAccountService.getClient(account_id);
// JSONObject client = signInAccountService.getClient(account_id);
if (!account_id.equals(device.getString("account_id"))) {
throw new ForbiddenException("You have no permission");
}
@ -779,7 +813,7 @@ public class RetailAppServiceImp implements RetailAppService {
Date now = new Date();
JSONObject res = merchantInfoProvider.clientCurrentRate(clientId, now, "Wechat");
JSONObject client = clientManager.getClientInfo(clientId);
Assert.notNull(client,"Client is null");
Assert.notNull(client, "Client is null");
JSONObject[] channels = new JSONObject[3];
@ -804,7 +838,7 @@ public class RetailAppServiceImp implements RetailAppService {
Date now = new Date();
JSONObject res = merchantInfoProvider.clientCurrentRate(clientId, now, "Wechat");
JSONObject client = clientManager.getClientInfo(clientId);
Assert.notNull(client,"Client is null");
Assert.notNull(client, "Client is null");
ArrayList<JSONObject> channels = new ArrayList<>();
if (client.getBigDecimal("customer_surcharge_rate") != null) {
@ -889,7 +923,7 @@ public class RetailAppServiceImp implements RetailAppService {
}
res.put("data", new_acts);
}
//手续费返还活动
// 手续费返还活动
List<JSONObject> acts = (List<JSONObject>) res.get("data");
for (JSONObject act : acts) {
if (StringUtils.isNotBlank(act.getString("page_keywords")) && act.getString("page_keywords").equalsIgnoreCase("native")) {
@ -923,7 +957,7 @@ public class RetailAppServiceImp implements RetailAppService {
String newAppVersion = PlatformEnvironment.getEnv().getNewVersion();
Boolean isUpdate = PlatformEnvironment.getEnv().isAppUpdate();
String updateContent = PlatformEnvironment.getEnv().getAppUpdateContent();
int update_type = 0;//0:不更新 1更新 2强制更新
int update_type = 0;// 0:不更新 1更新 2强制更新
if (newAppVersion.compareToIgnoreCase(version) > 0) {
update_type = 1;
if (isUpdate) {
@ -943,7 +977,6 @@ public class RetailAppServiceImp implements RetailAppService {
return clientManager.listSubClients(device.getIntValue("client_id"));
}
private JSONObject saveAppMessageLog(String dev_id, int client_id, String messageType, String dev_token, String remark) {
JSONObject log = new JSONObject();
log.put("dev_id", dev_id);
@ -1078,7 +1111,7 @@ public class RetailAppServiceImp implements RetailAppService {
if (clientRate.getIntValue("clean_days") == 1) {
JSONObject config = clientSettleDelayConfMapper.findClientConf(device.getIntValue("client_id"));
if (config == null) {
// res.put("show", true);
// res.put("show", true);
res.put("interest_rate", xPlanFundConfigService.configuration().getInterestRate().setScale(2, BigDecimal.ROUND_DOWN));
}
@ -1086,7 +1119,6 @@ public class RetailAppServiceImp implements RetailAppService {
return res;
}
@Override
public void sendMassageByCode(final JSONObject params) {
try {
@ -1095,7 +1127,7 @@ public class RetailAppServiceImp implements RetailAppService {
if (params.getString("type").equals("Merchant")) {
for (String partner_code : codes) {
JSONObject client = clientManager.getClientInfoByMoniker(partner_code);
Assert.notNull(client,"Client is null");
Assert.notNull(client, "Client is null");
List<JSONObject> tokens = clientDeviceTokenMapper.listTokensByClient_id(client.getInteger("client_id"));
if (null != tokens && tokens.size() > 0) {
for (final JSONObject devToken : tokens) {
@ -1103,7 +1135,8 @@ public class RetailAppServiceImp implements RetailAppService {
sendingAppleMsgPool.execute(new Runnable() {
@Override
public void run() {
JSONObject log = saveAppMessageLog(devToken.getString("dev_id"), devToken.getIntValue("client_id"), "dev", token, "Parampartner_code自定义推送消息");
JSONObject log = saveAppMessageLog(devToken.getString("dev_id"), devToken.getIntValue("client_id"), "dev", token,
"Parampartner_code自定义推送消息");
sending(token, params, log);
}
});
@ -1135,19 +1168,30 @@ public class RetailAppServiceImp implements RetailAppService {
}
public void sending(String devToken, JSONObject params, JSONObject log) {
try {
sendAppleMessage(params.getString("title"), params.getString("content"), devToken, new JSONObject(), new JSONObject());
JSONObject devTokenJson = new JSONObject();
devTokenJson.put("token", devToken);
AppMsgSender sender = senderMap.get(params.getString("client_type"));
if (devToken == null || sender == null) {
return;
}
JSONObject managerMsg = new JSONObject();
managerMsg.put("title", params.getString("title"));
managerMsg.put("body", params.getString("content"));
managerMsg.put("type", new JSONObject());
managerMsg.put("data", new JSONObject());
managerMsg.put("msgType", "payment");
AppMessage appMessage = new AppManagerMessageBuilder(managerMsg).buildMessage();
sender.sendMessage(appMessage, devTokenJson);
log.put("status", 2);
appMessageLogMapper.update(log);
} catch (Exception e) {
logger.error("出错了:" + e.getMessage());
appMessageLogMapper.updateStatus(log.getString("send_id"), 1, e.getMessage());
throw new ServerErrorException("Send App Message Failed", e);
throw new ServerErrorException("Send App "+params.getString("client_type")+" Failed", e);
}
}
@Override
public JSONObject getCoupons(JSONObject device, int page, int limit) {
String clientType = device.getString("client_type");
@ -1207,4 +1251,5 @@ public class RetailAppServiceImp implements RetailAppService {
String regex = "[A-Za-z0-9]{8}";
return str.matches(regex);
}
}

@ -16,7 +16,7 @@ public class Message {
public String title;
@NotEmpty(message = "content can not be null")
public String content;
public String client_type;
public JSONObject insertObject() {
JSONObject res = (JSONObject) JSON.toJSON(this);
return res;
@ -53,4 +53,12 @@ public class Message {
public void setContent(String content) {
this.content = content;
}
public String getClient_type() {
return client_type;
}
public void setClient_type(String client_type) {
this.client_type = client_type;
}
}

@ -24,6 +24,7 @@ public class SendWechatMessage {
private boolean bdleader;
private boolean riskmanager;
private boolean guest;
private boolean orgmanager;
public JSONObject insertObject() {
JSONObject res = (JSONObject) JSON.toJSON(this);
@ -157,4 +158,12 @@ public class SendWechatMessage {
public void setGuest(boolean guest) {
this.guest = guest;
}
public boolean isOrgmanager() {
return orgmanager;
}
public void setOrgmanager(boolean orgmanager) {
this.orgmanager = orgmanager;
}
}

@ -117,6 +117,9 @@ public class WechatMessageServiceImpl implements WechatMessageService {
if(sendWechatMessage.isDirector()){
set = getOpenIdSet(set, ManagerRole.DIRECTOR.getMask());
}
if(sendWechatMessage.isOrgmanager()){
set = getOpenIdSet(set, ManagerRole.ORG_MANAGER.getMask());
}
for(String open_id : set){
object.put("open_id",open_id);
sendWecharMessageByOpenId(object);

@ -25,6 +25,10 @@ public interface OrgMapper {
List<JSONObject> listOrgs(@Param("type") int type, PageBounds order);
List<JSONObject> listOrgsWithParent(JSONObject params);
List<JSONObject> listOrgsWithChid(JSONObject params);
@AutoSql(type = SqlType.INSERT)
void saveOrg(JSONObject org);
@ -41,4 +45,6 @@ public interface OrgMapper {
JSONObject findOrgByBDId(@Param("bd_id") int bd_id);
PageList<JSONObject> listOrgWithPages(JSONObject paraams, PageBounds order);
List<JSONObject> listOrgAndChild(@Param("org_id") int org_id);
}

@ -22,6 +22,7 @@ public class PartnerQuery {
private String short_name;
private String sub_merchant_id;
private String org_id;
private String org_ids;
private Integer bd;
private String business_structure;
private String industry;
@ -117,6 +118,9 @@ public class PartnerQuery {
if (org_id != null) {
param.put("org_id", org_id);
}
if (org_ids != null) {
param.put("org_ids", org_ids);
}
if (bd != null) {
param.put("bd_user", bd);
}
@ -440,4 +444,12 @@ public class PartnerQuery {
public boolean isIs_valid() {
return is_valid;
}
public String getOrg_ids() {
return org_ids;
}
public void setOrg_ids(String org_ids) {
this.org_ids = org_ids;
}
}

@ -10,25 +10,8 @@ import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper
import au.com.royalpay.payment.manage.appclient.beans.AppClientBean;
import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
import au.com.royalpay.payment.manage.mappers.redpack.ActClientInvitationCodeMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientApplyMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientAuditProcessMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientBDMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientBankAccountMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientDeviceMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientFilesMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientRateMapper;
import au.com.royalpay.payment.manage.mappers.system.CommoditiesMapper;
import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
import au.com.royalpay.payment.manage.mappers.system.OrgMapper;
import au.com.royalpay.payment.manage.merchants.beans.ActivityPosterBuilder;
import au.com.royalpay.payment.manage.merchants.beans.BankAccountInfo;
import au.com.royalpay.payment.manage.merchants.beans.ClientAuthFilesInfo;
import au.com.royalpay.payment.manage.merchants.beans.ClientRateConfig;
import au.com.royalpay.payment.manage.merchants.beans.ClientRegisterInfo;
import au.com.royalpay.payment.manage.merchants.beans.NewAccountBean;
import au.com.royalpay.payment.manage.merchants.beans.PartnerQuery;
import au.com.royalpay.payment.manage.mappers.system.*;
import au.com.royalpay.payment.manage.merchants.beans.*;
import au.com.royalpay.payment.manage.merchants.core.ClientComplyValidator;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.notice.core.MailService;
@ -56,22 +39,16 @@ import au.com.royalpay.payment.tools.merchants.qrboard.QRBoard;
import au.com.royalpay.payment.tools.merchants.qrboard.QRBoardProvider;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
import au.com.royalpay.payment.tools.utils.ImageUtils;
import au.com.royalpay.payment.tools.utils.PageListUtils;
import au.com.royalpay.payment.tools.utils.PasswordUtils;
import au.com.royalpay.payment.tools.utils.PdfUtils;
import au.com.royalpay.payment.tools.utils.QRCodeUtils;
import au.com.royalpay.payment.tools.utils.TimeZoneUtils;
import au.com.royalpay.payment.tools.utils.*;
import au.com.royalpay.payment.tools.websocket.notify.PartnerPageEvent;
import cn.yixblog.platform.http.HttpRequestGenerator;
import cn.yixblog.platform.http.HttpRequestResult;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
@ -93,34 +70,22 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.thymeleaf.context.Context;
import org.thymeleaf.spring4.SpringTemplateEngine;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.*;
import java.math.BigDecimal;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.*;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import cn.yixblog.platform.http.HttpRequestGenerator;
import cn.yixblog.platform.http.HttpRequestResult;
import static au.com.royalpay.payment.manage.permission.utils.OrgCheckUtils.checkOrgPermission;
/**
@ -249,7 +214,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) {
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
checkClientOrg(manager, client);
client.put("show_all_permission", true);
int role = manager != null ? manager.getIntValue("role") : 0;
if (manager != null) {
@ -309,6 +274,19 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return client;
}
private void checkClientOrg(JSONObject manager, JSONObject client) {
if (manager.getInteger("org_id")!=null){
JSONObject org = orgMapper.findOne(client.getIntValue("org_id"));
if (org.getInteger("parent_org_id")!=null){
if (org.getIntValue("parent_org_id")!=manager.getIntValue("org_id")){
throw new ForbiddenException("The org of client is not belong to you");
}
}else {
checkOrgPermission(manager, client);
}
}
}
@Override
public JSONObject getClientDetailById(int clientId) {
JSONObject client = getClientInfo(clientId);
@ -327,8 +305,18 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
params.put("bd_user", manager.getString("manager_id"));
}
}
if(params.getString("org_id") != null){
if(params.getString("org_ids") == null){
orgIds(params,Integer.parseInt(params.getString("org_id")));
}else {
params.put("org_id",params.getString("org_ids"));
params.remove("org_ids");
}
}
JSONObject org = null;
if (params.getString("org_id") != null) {
JSONObject org = orgMapper.findOne(params.getIntValue("org_id"));
org = orgMapper.findOne(params.getIntValue("org_id"));
if (org.getIntValue("type") == 1) {
params.put("referrer_id", org.getString("org_id"));
params.remove("org_id");
@ -336,7 +324,18 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
int orgId = manager.getIntValue("org_id");
if (orgId > 0) {
params.put("org_id", orgId);
if(params.getString("org_ids") == null){
JSONObject org2 = orgMapper.findOne(orgId);
if(org2.getString("parent_org_id") != null){
params.put("org_id",orgId);
}else {
params.put("org_id",orgId);
orgIds(params,orgId);
}
}else {
params.put("org_id", params.getIntValue("org_ids"));
params.remove("org_ids");
}
}
String tempSubMchId = sysConfigManager.getSysConfig().getString("temp_sub_mch_id");
String tempSubMchSource = sysConfigManager.getSysConfig().getString("temp_sub_mch_id_source");
@ -361,6 +360,21 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
return PageListUtils.buildPageListResult(partners);
}
private void orgIds(JSONObject params,int orgId){
JSONObject param = new JSONObject();
param.put("parent_org_id",params.getString("org_id"));
param.put("type",0);
List<Integer> orgIds = new ArrayList<>();
List<JSONObject> childOrgs = orgMapper.listOrgsWithChid(param);
if(childOrgs.size() > 0){
for(JSONObject object : childOrgs ){
orgIds.add(object.getIntValue("org_id"));
}
orgIds.add(orgId);
params.put("org_ids",orgIds);
params.remove("org_id");
}
}
@Override
public List<JSONObject> listPartners(JSONObject manager, PartnerQuery query) {
@ -1387,7 +1401,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) {
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
checkClientOrg(manager,client);
JSONObject params = new JSONObject();
params.put("client_id", client.getIntValue("client_id"));
params.put("is_valid", "1");

@ -477,4 +477,9 @@ public class PartnerManageController {
public void wechatCcompliancePermission(@PathVariable String clientMoniker, @RequestBody JSONObject pass, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.switchPermission(manager, clientMoniker, "wechat_compliance", pass.getBooleanValue("allow"));
}
@ManagerMapping(value = "/{clientMoniker}/local_merchant_permission",method = RequestMethod.PUT,role = {ManagerRole.OPERATOR,ManagerRole.ADMIN})
public void localMerchantPermission(@PathVariable String clientMoniker, @RequestBody JSONObject pass, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.switchPermission(manager, clientMoniker, "local_merchant", pass.getBooleanValue("allow"));
}
}

@ -10,7 +10,7 @@ import org.hibernate.validator.constraints.NotEmpty;
public class OrgInfo {
@NotEmpty
private String name;
private int type = 0;
private String type;
private String logo;
@NotEmpty
private String location;
@ -32,6 +32,8 @@ public class OrgInfo {
private String search_text;
private int page = 1;
private int limit = 10;
private String parent_org_id;
private String org_id;
public JSONObject toJsonParam() {
JSONObject param = new JSONObject();
@ -44,9 +46,15 @@ public class OrgInfo {
if (StringUtils.isNotBlank(search_text)) {
param.put("search_text", search_text);
}
if (StringUtils.isNotBlank(String.valueOf(type))){
if (type != null){
param.put("type", type);
}
if (StringUtils.isNotBlank(parent_org_id)){
param.put("parent_org_id", parent_org_id);
}
if (StringUtils.isNotBlank(org_id)){
param.put("org_id", org_id);
}
return param;
}
@ -126,11 +134,11 @@ public class OrgInfo {
this.rate_value = rate_value;
}
public int getType() {
public String getType() {
return type;
}
public void setType(int type) {
public void setType(String type) {
this.type = type;
}
@ -205,4 +213,20 @@ public class OrgInfo {
public void setLimit(int limit) {
this.limit = limit;
}
public String getParent_org_id() {
return parent_org_id;
}
public void setParent_org_id(String parent_org_id) {
this.parent_org_id = parent_org_id;
}
public String getOrg_id() {
return org_id;
}
public void setOrg_id(String org_id) {
this.org_id = org_id;
}
}

@ -11,9 +11,11 @@ import java.util.List;
public interface OrgManager {
List<JSONObject> listOrgs(boolean detail);
JSONObject listAllOrgs(OrgInfo orgInfo);
List<JSONObject> listOrgsWithChid(JSONObject manager,OrgInfo orgInfo);
JSONObject getOrgDetail(int orgId);
JSONObject listAllOrgs(OrgInfo orgInfo,JSONObject manager);
JSONObject getOrgDetail(int orgId,JSONObject manager);
JSONObject saveNewOrg(OrgInfo org);
@ -25,4 +27,5 @@ public interface OrgManager {
List<JSONObject> listAllOrg();
JSONObject checkOrg(JSONObject manager, JSONObject params);
}

@ -3,16 +3,23 @@ package au.com.royalpay.payment.manage.organizations.core.impls;
import au.com.royalpay.payment.manage.mappers.system.OrgMapper;
import au.com.royalpay.payment.manage.organizations.beans.OrgInfo;
import au.com.royalpay.payment.manage.organizations.core.OrgManager;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* Created by yixian on 2016-10-18.
@ -29,7 +36,36 @@ public class OrgManagerImpl implements OrgManager {
}
@Override
public JSONObject listAllOrgs(OrgInfo orgInfo) {
public List<JSONObject> listOrgsWithChid(JSONObject manager,OrgInfo orgInfo) {
JSONObject params = new JSONObject();
params.put("type",0);
List<JSONObject> listOrgsByChild = orgMapper.listOrgsWithChid(params);
if(orgInfo.getOrg_id() != null){
params.put("org_id", orgInfo.getOrg_id());
}else {
if (manager.getInteger("org_id") != null) {
params.put("org_id", manager.getIntValue("org_id"));
}
}
List<JSONObject> listOrgs = orgMapper.listOrgsWithParent(params);
List<JSONObject> orgs = new ArrayList<>();
for(JSONObject org : listOrgs){
org.put("type",org.getString("name"));
orgs.add(org);
for(JSONObject orgChild : listOrgsByChild){
if(org.getIntValue("org_id") == orgChild.getIntValue("parent_org_id")){
orgChild.put("type",org.getString("name"));
orgs.add(orgChild);
}
}
}
return orgs;
}
@Override
public JSONObject listAllOrgs(OrgInfo orgInfo,JSONObject manager) {
/* PageBounds sort = new PageBounds(Order.formString("sort_no.asc"));
return orgMapper.listsOrgWithDetail(sort);*/
JSONObject params = orgInfo.toJsonParam();
@ -38,7 +74,7 @@ public class OrgManagerImpl implements OrgManager {
}
@Override
public JSONObject getOrgDetail(int orgId) {
public JSONObject getOrgDetail(int orgId,JSONObject manager) {
return orgMapper.findOne(orgId);
}
@ -86,4 +122,30 @@ public class OrgManagerImpl implements OrgManager {
return listAllOrgs;
}
@Override
public JSONObject checkOrg(JSONObject manager, JSONObject params){
if (params.getString("org_id")==null){
if (manager.getInteger("org_id")!=null){
List<JSONObject> orgs = orgMapper.listOrgAndChild(manager.getIntValue("org_id"));
if (orgs.size()>1){
List<Integer> orgIds = orgs.stream().map(org->org.getIntValue("org_id")).collect(Collectors.toList());
params.put("org_ids",orgIds);
}else {
params.put("org_id",manager.getIntValue("org_id"));
}
}
}else {
if (manager.getInteger("org_id")!=null){
List<JSONObject> orgs = orgMapper.listOrgAndChild(manager.getIntValue("org_id"));
List<Integer> orgIds = orgs.stream().map(org->org.getIntValue("org_id")).collect(Collectors.toList());
if (!orgIds.contains(params.getString("org_id"))){
throw new ForbiddenException("You have no permission to query the org");
}
}
}
return params;
}
}

@ -3,9 +3,11 @@ package au.com.royalpay.payment.manage.organizations.web;
import au.com.royalpay.payment.manage.organizations.beans.OrgInfo;
import au.com.royalpay.payment.manage.organizations.core.OrgManager;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.manage.permission.manager.RequireManager;
import au.com.royalpay.payment.tools.http.HttpUtils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.springframework.validation.Errors;
import org.springframework.web.bind.annotation.*;
@ -29,10 +31,16 @@ public class OrgManageController {
return orgManager.listOrgs(detail);
}
@RequestMapping(value = "/orgChild",method = RequestMethod.GET)
@RequireManager
public List<JSONObject> listOrgsWithChid(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,OrgInfo orgInfo) {
return orgManager.listOrgsWithChid(manager,orgInfo);
}
@RequestMapping(value = "/listsOrg", method = RequestMethod.GET)
@RequireManager
public JSONObject listsOrg(OrgInfo orgInfo) {
return orgManager.listAllOrgs(orgInfo);
public JSONObject listsOrg(OrgInfo orgInfo,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return orgManager.listAllOrgs(orgInfo,manager);
}
@RequestMapping(value = "/list_all_Org", method = RequestMethod.GET)
@ -41,15 +49,15 @@ public class OrgManageController {
return orgManager.listAllOrg();
}
@ManagerMapping(method = RequestMethod.POST, role = ManagerRole.ADMIN)
@ManagerMapping(method = RequestMethod.POST, role = {ManagerRole.ADMIN})
public JSONObject saveOrg(@RequestBody @Valid OrgInfo org, Errors errors) {
HttpUtils.handleValidErrors(errors);
return orgManager.saveNewOrg(org);
}
@ManagerMapping(value = "/{orgId}", method = RequestMethod.GET, role = ManagerRole.ADMIN)
public JSONObject getOrgDetail(@PathVariable int orgId) {
return orgManager.getOrgDetail(orgId);
@ManagerMapping(value = "/{orgId}", method = RequestMethod.GET, role = {ManagerRole.ADMIN})
public JSONObject getOrgDetail(@PathVariable int orgId,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return orgManager.getOrgDetail(orgId,manager);
}
@ManagerMapping(value = "/{orgId}", method = RequestMethod.PUT)

@ -0,0 +1,46 @@
package au.com.royalpay.payment.manage.pushMessage;
import com.alibaba.fastjson.JSONObject;
import com.notnoop.apns.APNS;
import com.notnoop.apns.ApnsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.io.InputStream;
/**
* Created by wangning on 2018/1/3.
*/
@Service
public class APNSMessageHelper {
private Logger logger = LoggerFactory.getLogger(getClass());
@Value("classpath:apple_message_cert_dev.p12")
private org.springframework.core.io.Resource appleMessageFileDev;
@Value("classpath:apple_message_cert_product.p12")
private org.springframework.core.io.Resource appleMessageFileProduct;
@Value("${apple.message.apns.password}")
private String appleMessagePassword;
public void sendAppleMessage(String title, String body, String token, JSONObject data, JSONObject type) throws IOException {
/**设置参数,发送数据**/
InputStream keyIns = appleMessageFileProduct.getInputStream();
ApnsService service = APNS.newService().withCert(keyIns, appleMessagePassword).withProductionDestination().build();
String payload = APNS.newPayload().alertTitle(title).alertBody(body).badge(1).sound("default").customField("data", data).customField("type", type).build();
service.push(token, payload);
logger.debug("推送信息已发送!");
}
public void sendAppleMessageDetail(String title, String body, String token, JSONObject data, JSONObject type) throws IOException {
/**设置参数,发送数据**/
InputStream keyIns = appleMessageFileProduct.getInputStream();
ApnsService service = APNS.newService().withCert(keyIns, appleMessagePassword).withProductionDestination().build();
String payload = APNS.newPayload().alertTitle(title).alertBody(body).category("myNotificationCategory").badge(1).sound("default").customField("data", data).customField("type", type).build();
service.push(token, payload);
logger.debug("推送信息已发送!");
}
}

@ -0,0 +1,97 @@
package au.com.royalpay.payment.manage.pushMessage;
import au.com.royalpay.payment.manage.pushMessage.bean.JpushMessage;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.util.Map;
import cn.jiguang.common.resp.APIConnectionException;
import cn.jiguang.common.resp.APIRequestException;
import cn.jpush.api.JPushClient;
import cn.jpush.api.push.model.Options;
import cn.jpush.api.push.model.Platform;
import cn.jpush.api.push.model.PushPayload;
import cn.jpush.api.push.model.audience.Audience;
import cn.jpush.api.push.model.notification.AndroidNotification;
import cn.jpush.api.push.model.notification.Notification;
/**
* Created by wangning on 2018/1/3.
*/
@Service
public class JpushMessageHelper {
Logger logger = LoggerFactory.getLogger(getClass());
// 推送文本最大长度
private final Integer NOTIFICATION_MAX_LENGTH = 54;
private static JPushClient client = null;
private JPushClient getPush() {
if (client == null) {
client = new JPushClient("c235e93f6b91abd72ca5d74e", "c235e93f6b91abd72ca5d74e");
}
return client;
}
public void sendAppleMessage(String title, String body, String token, JSONObject data, JSONObject type) throws IOException, APIConnectionException, APIRequestException {
JPushClient jPushClient= getPush();
JpushMessage jpushMessage = new JpushMessage();
jpushMessage.setTitle(title);
jpushMessage.setText(body);
JSONObject param = new JSONObject();
param.put("data",data);
param.put("type",type);
jpushMessage.setParams(param);
PushPayload pushPayload = generateSinglePayload(token,jpushMessage);
jPushClient.sendPush(pushPayload);
}
private PushPayload generateSinglePayload(String alias, JpushMessage pushMessage) {
Notification notify = getNotify(pushMessage);
return PushPayload.newBuilder().setPlatform(Platform.android()).setAudience(Audience.alias(alias)).setNotification(notify)
// 设置离线时长
.setOptions(Options.newBuilder().setTimeToLive(60 * 60 * 4).build()).build();
}
private Notification getNotify(JpushMessage pushMessage) {
String alert = getText(pushMessage);
return Notification.newBuilder().addPlatformNotification(
AndroidNotification.newBuilder().setTitle(pushMessage.getTitle()).setAlert(alert).addExtras(getExtra(pushMessage)).build()).build();
}
private String getText(JpushMessage pushMessage) {
String text = pushMessage.getText();
int length = text.length();
int trueLength = 0;
String cutString = "";
for (int i = 0; i < length; i++) {
char c = text.charAt(i);
if (c < 0 || c > 128) {
// 汉字 3个字符
trueLength += 3;
} else {
// 英文等 1个字符
trueLength++;
}
cutString += c;
if (trueLength >= NOTIFICATION_MAX_LENGTH) {
cutString += "...";
break;
}
}
return cutString;
}
private Map<String, String> getExtra(JpushMessage message) {
Map map = message.getParams();
return map;
}
}

@ -0,0 +1,22 @@
package au.com.royalpay.payment.manage.pushMessage.bean;
import au.com.royalpay.payment.tools.device.message.AppMessage;
import au.com.royalpay.payment.tools.device.message.AppMessageBuilder;
import com.alibaba.fastjson.JSONObject;
/**
* Created by wangning on 08/01/2018.
*/
public class AppManagerMessageBuilder implements AppMessageBuilder {
private JSONObject managerMsg;
public AppManagerMessageBuilder(JSONObject managerMsg) {
this.managerMsg = managerMsg;
}
@Override
public AppMessage buildMessage() {
return new AppMessage(managerMsg.getString("msgType"), managerMsg.getString("title"), managerMsg.getString("body")).setTypeData(managerMsg.getJSONObject("type")).setData(managerMsg.getJSONObject("data"));
}
}

@ -0,0 +1,44 @@
package au.com.royalpay.payment.manage.pushMessage.bean;
import com.alibaba.fastjson.JSONObject;
public class JpushMessage implements java.io.Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
private String title;
/**
*
*/
private String text;
private JSONObject params;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public JSONObject getParams() {
return params;
}
public void setParams(JSONObject params) {
this.params = params;
}
}

@ -37,6 +37,7 @@ public class ManagerInfo {
private boolean bdleader;
private boolean riskmanager;
private boolean guest;
private boolean orgmanager;
@JSONField(name = "org_id")
private Integer orgId;
@ -101,6 +102,9 @@ public class ManagerInfo {
if (guest){
role |= ManagerRole.GUEST.getMask();
}
if (orgmanager){
role |= ManagerRole.ORG_MANAGER.getMask();
}
account.put("role", role);
if (insert) {
account.put("username", getUsername());
@ -260,4 +264,12 @@ public class ManagerInfo {
public void setGuest(boolean guest) {
this.guest = guest;
}
public boolean isOrgmanager() {
return orgmanager;
}
public void setOrgmanager(boolean orgmanager) {
this.orgmanager = orgmanager;
}
}

@ -2,6 +2,7 @@ package au.com.royalpay.payment.manage.signin.core.impls;
import au.com.royalpay.payment.manage.mappers.financial.FinancialBDConfigMapper;
import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
import au.com.royalpay.payment.manage.mappers.system.OrgMapper;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.manage.signin.beans.ManagerInfo;
import au.com.royalpay.payment.manage.signin.core.ManagerAccountsService;
@ -22,6 +23,9 @@ import java.util.List;
public class ManagerAccountServiceImpl implements ManagerAccountsService {
@Resource
private ManagerMapper managerMapper;
@Resource
private OrgMapper orgMapper;
@Resource
private FinancialBDConfigMapper financialBDConfigMapper;
@ -46,6 +50,7 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService {
manager.put("bdleader", ManagerRole.BD_LEADER.hasRole(role));
manager.put("riskmanager", ManagerRole.RISK_MANAGER.hasRole(role));
manager.put("guest", ManagerRole.GUEST.hasRole(role));
manager.put("orgmanager", ManagerRole.ORG_MANAGER.hasRole(role));
}
return managers;
}
@ -88,7 +93,7 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService {
@Override
public void disable(String userId, JSONObject loginManager) {
JSONObject manager = managerMapper.findById(userId);
if (!ManagerRole.ADMIN.hasRole(loginManager.getIntValue("role"))) {
if (!ManagerRole.ADMIN.hasRole(loginManager.getIntValue("role"))){
if (manager.getIntValue("org_id") != loginManager.getIntValue("org_id")) {
throw new BadRequestException("You cannot disable accounts belong to other organizations");
}
@ -117,4 +122,5 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService {
public JSONObject getBDConfig(String bd_id){
return financialBDConfigMapper.getBdConfig(bd_id);
}
}

@ -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})

@ -36,6 +36,7 @@ public class TradeLogQuery {
private int trans_type;
private boolean onlyGroup = false;
private int group_bd;
private String org_id;
public JSONObject toParams(String timezone) {
JSONObject params = new JSONObject();
@ -91,6 +92,9 @@ public class TradeLogQuery {
if (getDev_id() != null) {
params.put("dev_id", getDev_id());
}
if (org_id != null && org_id != "ALL") {
params.put("org_id", org_id);
}
return params;
}
@ -214,4 +218,12 @@ public class TradeLogQuery {
public void setChannel(PayChannel channel) {
this.channel = channel;
}
public String getOrg_id() {
return org_id;
}
public void setOrg_id(String org_id) {
this.org_id = org_id;
}
}

@ -18,7 +18,9 @@ import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
import au.com.royalpay.payment.manage.mappers.system.CustomerMapper;
import au.com.royalpay.payment.manage.mappers.system.CustomerRelationAlipayMapper;
import au.com.royalpay.payment.manage.mappers.system.OrgMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.organizations.core.OrgManager;
import au.com.royalpay.payment.manage.tradelog.beans.PreRefundQueryBean;
import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery;
import au.com.royalpay.payment.manage.tradelog.core.TradeLogService;
@ -119,6 +121,9 @@ public class TradeLogServiceImpl implements TradeLogService {
@Resource
private ClientCustomersMapper clientCustomersMapper;
@Resource
private OrgManager orgManager;
// @Value("classpath:/jasper/trans_flow.jasper")
// @Value("classpath:/jasper/trans_flow_new.jasper")
@Value("classpath:/jasper/partner_invoice.jasper")
@ -175,9 +180,7 @@ public class TradeLogServiceImpl implements TradeLogService {
params.put("bd_group_bd", query.getGroup_bd());
}
}
if (manager.getInteger("org_id") != null) {
params.put("org_id", manager.getIntValue("org_id"));
}
orgManager.checkOrg(manager,params);
PageList<JSONObject> logs = orderMapper.listOrders(params, new PageBounds(query.getPage(), query.getLimit(), Order.formString("create_time.desc")));
JSONObject result = PageListUtils.buildPageListResult(logs);
JSONObject analysis = orderMapper.analysisOrders(params);
@ -185,6 +188,8 @@ public class TradeLogServiceImpl implements TradeLogService {
return result;
}
@Override
public List<JSONObject> listOrderRefunds(String orderId, String timezone) {
List<JSONObject> refunds = refundMapper.listOrderRefunds(orderId, new PageBounds(Order.formString("create_time.desc")));

@ -77,7 +77,7 @@ app.settlement.email-cc=leo.huang@royalpay.com.au
app.mpsupport.appid=royalpay
app.mpsupport.auth_code=W3xucYnbmbE6rZDmA2V9BsKmagTrVIny
app.run-tasks=true
app.run-tasks=false
app.allow-clearing-generation=false
app.mail.appid=1
@ -95,4 +95,7 @@ app.foreign-currency=AUD
app.ofei.md5-key=Khjx6wejblaJzmG0JBWFlPFKAUxhFIXQ
app.ofei.pwd=aomi@8888
app.ofei.sp-code=A1407200
app.ofei.sp-code=A1407200
android.message.secret=2b96d9bc6169c9554218aab1
android.message.appkey=3f33a10d0a7d4ac94d8f2431

@ -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

@ -52,8 +52,8 @@
<select id="listPaymentManagerByCus" resultType="java.lang.String">
<![CDATA[
SELECT c.kanga_openid
from cus_membership c, sys_managers s where c.payment_openid = s.wx_openid AND s.role & 1 >0
SELECT DISTINCT c.kanga_openid
from cus_membership c, sys_managers s where c.payment_openid = s.wx_openid AND (s.role & 1 >0 or s.role & 10000000 >0)
]]>
</select>
</mapper>

@ -172,10 +172,12 @@
</if>
</if>
<if test="order_id!=null">and o.order_id=#{order_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="trade_type!=null">and o.gateway in
<foreach collection="trade_type" item="gateway" open="(" close=")" separator=",">#{gateway}</foreach>
</if>
<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="from!=null">and o.create_time &gt;= #{from}</if>
<if test="to!=null">and o.create_time &lt; #{to}</if>
<if test="date!=null">and date(o.create_time)=date(#{date})</if>
@ -357,11 +359,13 @@
and t.system_transaction_id =#{search_text}
</if>
</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="order_id!=null">and o.order_id=#{order_id}</if>
<if test="trade_type!=null">and o.gateway in
<foreach collection="trade_type" item="gateway" open="(" close=")" separator=",">#{gateway}</foreach>
</if>
<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="from!=null">and o.create_time &gt;= #{from}</if>
<if test="to!=null">and o.create_time &lt; #{to}</if>
<if test="date!=null">and date(o.create_time)=date(#{date})</if>

@ -1,10 +1,31 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="au.com.royalpay.payment.manage.mappers.system.ClientDeviceTokenMapper">
<select id="listTokensByClient_id" resultType="com.alibaba.fastjson.JSONObject">
SELECT * FROM sys_clients_devices_token where client_id=#{client_id} and is_valid=1 group by token
SELECT
t.*, d.client_type
FROM
sys_clients_devices_token t
LEFT JOIN sys_clients_devices d ON t.dev_id = d.dev_id
WHERE
t.client_id = #{client_id}
AND t.is_valid = 1
GROUP BY
token
</select>
<select id="listAllTokensByClient_id" resultType="com.alibaba.fastjson.JSONObject">
SELECT
t.*, d.client_type
FROM
sys_clients_devices_token t
LEFT JOIN sys_clients_devices d ON t.dev_id = d.dev_id
WHERE
t.client_id = #{client_id}
GROUP BY
token
</select>
<select id="findByDevId" resultType="com.alibaba.fastjson.JSONObject">
SELECT * FROM sys_clients_devices_token where dev_id=#{dev_id} limit 1
</select>

@ -150,6 +150,8 @@
</if>
</if>
<if test="org_id!=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="referrer_id!=null">and c.referrer_id=#{referrer_id}</if>
<if test="is_valid">and c.is_valid=1</if>
</where>

@ -3,7 +3,7 @@
<mapper namespace="au.com.royalpay.payment.manage.mappers.system.ManagerMapper">
<select id="listByRole" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT manager_id,display_name,role,m.org_id,o.name org_name,m.wx_openid wx_openid FROM sys_managers m
SELECT manager_id,display_name,role,m.org_id,o.name org_name,m.wx_openid wx_openid,o.parent_org_id FROM sys_managers m
LEFT JOIN sys_org o ON o.org_id=m.org_id
WHERE role & #{mask} >0 and m.is_valid=1
AND o.type = 0

@ -8,6 +8,33 @@
</if>
</select>
<select id="listOrgsWithParent" resultType="com.alibaba.fastjson.JSONObject">
SELECT * FROM sys_org WHERE is_valid=1 AND parent_org_id is NULL
<if test="type!=null">
and type=#{type}
</if>
<if test="org_id!=null">
and org_id=#{org_id}
</if>
</select>
<select id="listOrgsWithChid" resultType="com.alibaba.fastjson.JSONObject">
SELECT * FROM sys_org WHERE is_valid=1 AND parent_org_id is NOT NULL
<if test="type!=null">
and type=#{type}
</if>
<if test="org_id!=null">
and org_id=#{org_id}
</if>
<if test="parent_org_id!=null">
and parent_org_id=#{parent_org_id}
</if>
</select>
<select id="listOrgAndChild" resultType="com.alibaba.fastjson.JSONObject">
select * FROM sys_org where is_valid=1 and type=0 and (org_id=#{org_id} or parent_org_id=#{org_id})
</select>
<!--<select id="getReferres" resultType="com.alibaba.fastjson.JSONObject">-->
<!--SELECT m.manager_id,m.display_name,o.org_id,o.name org_name FROM sys_managers m-->
<!--RIGHT JOIN sys_org o on o.org_id = m.org_id-->
@ -37,6 +64,13 @@
<if test="name!=null">
and org.name=#{name}
</if>
<if test="parent_org_id!=null">
and org.parent_org_id=#{parent_org_id}
</if>
<if test="org_id!=null">
and (org.org_id=#{org_id} or org.parent_org_id=#{org_id})
</if>
</where>
</select>
</mapper>

@ -8,7 +8,7 @@
<li ui-sref-active-eq="active" ng-if="('monitor'|withModule)&&(currentUser.org_id==null||currentUser.org_id==1)">
<a ui-sref="analysis_monitoring.monitor"><i class="fa fa-tv"></i> <span>交易监控|Trade Monitor</span></a>
</li>
<li ui-sref-active-eq="active">
<li ui-sref-active-eq="active" ng-if="('monitor'|withModule)&&(currentUser.org_id==null)">
<a ui-sref="analysis_monitoring.cheat"><i class="fa fa-tv"></i> <span>警告监控|Risk Monitor</span></a>
</li>
@ -16,7 +16,7 @@
<a ui-sref="analysis_monitoring.cheat_monitor"><i class="fa fa-tv"></i> <span>风控配置|Cheat Monitor</span></a>
</li>
<li ui-sref-active-eq="active">
<li ui-sref-active-eq="active" ng-if="('monitor'|withModule)&&(currentUser.org_id==null)">
<a ui-sref="analysis_monitoring.pre_refund"><i class="fa fa-tv"></i> <span>欠款|Pre Refund</span></a>
</li>
</ul>

@ -31,6 +31,13 @@
<label>DevToken</label>
<input ng-model="params.code" class="form-control" type="text" />
</div>
<div class="form-group" ng-if="params.type=='Personal'">
<label>Client Type</label>
<select ng-model="params.client_type">
<option value="iphone">iphone</option>
<option value="android">android</option>
</select>
</div>
<div class="form-group">
<label>Title</label>
<input ng-model="params.title" class="form-control" type="text" />

@ -83,6 +83,9 @@
<div class="checkbox-inline">
<label><input type="checkbox" ng-model="params.guest" name="params.guest">GUEST:观察员</label>
</div>
<div class="checkbox-inline">
<label><input type="checkbox" ng-model="params.orgmanager" name="params.orgmanager">ORG_MANAGER:代理商管理</label>
</div>
<div class="form-group">
<label>Title</label>
<input ng-model="params.r_title" class="form-control" type="text" required/>

@ -20,9 +20,9 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
};
if($filter('withRole')('1')){
$scope.listOrgs = function () {
$http.get('/sys/orgs',{params:{detail:true}}).then(function (resp) {
$http.get('/sys/orgs/list_all_Org', {params: {}}).then(function (resp) {
$scope.orgs = resp.data;
})
});
};
$scope.listOrgs();
}

@ -33,14 +33,21 @@
<option value="1000000000">BD Leader</option>
<option value="10000000000">Risk Manager</option>
<option value="100000000000">Guest</option>
<option value="1000000000000">Org Manager</option>
</select>
</div>
<div class="form-group" ng-if="'1'|withRole">
<select id="org-select" class="form-control" ng-model="search.org_id"
ng-options="org.org_id as org.name group by org.org_type for org in orgs">
<option value="">All Organizations</option>
</select>
</div>
<!--<div class="form-group" ng-if="'1'|withRole">
<label class="control-label" for="org-select">Organizations</label>
<select class="form-control" id="org-select" ng-model="search.org_id" ng-options="o.org_id as o.name for o in orgs">
<option value="">All</option>
</select>
</div>
</div>-->
</form>
<div class="navbar-form navbar-right">
<button class="btn btn-success" type="button" ng-click="newManager()">
@ -89,6 +96,7 @@
<i class="fa fa-male" title="BD Leader" ng-class="{'text-green':manager.bdleader,'text-gray':!manager.bdleader}"></i>
<i class="fa fa-user" title="Risk Manager" ng-class="{'text-green':manager.riskmanager,'text-gray':!manager.riskmanager}"></i>
<i class="fa fa-tripadvisor" title="GUEST" ng-class="{'text-green':manager.guest,'text-gray':!manager.guest}"></i>
<i class="fa fa-user-plus" title="Org Manager" ng-class="{'text-green':manager.orgmanager,'text-gray':!manager.orgmanager}"></i>
</td>
<td>
<a role="button" class="text-bold text-primary" ng-click="modifyManager(manager)">Modify</a>

@ -81,6 +81,9 @@
<label ng-if="('00001'|withRole)">
<input type="checkbox" ng-model="manager.riskmanager" name="riskmanager">Risk Manager
</label>
<label ng-if="('00001'|withRole)">
<input type="checkbox" ng-model="manager.orgmanager" name="orgmanager">Org Manager
</label>
</p>
</div>
<div class="form-group" ng-if="('1'|withRole) && !manager.admin && !manager.operator && !manager.sitemanager && orgs!=null">

@ -36,22 +36,22 @@
</div>
<div class="alert alert-danger" ng-if="errmsg" ng-bind="errmsg"></div>
</div>
<div class="form-group">
<div class="form-group" ng-class="{'has-error':accountForm.email.$invalid && accountForm.email.$dirty}">
<label class="control-label" for="email-input">Email</label>
<input class="form-control" type="email" id="email-input" name="email"
ng-model="manager.email">
</div>
<div class="form-group">
<div class="form-group" ng-class="{'has-error':accountForm.phone.$invalid && accountForm.phone.$dirty}">
<label class="control-label" for="phone-input">Phone</label>
<input class="form-control" type="text" id="phone-input" name="phone"
ng-model="manager.phone">
</div>
<div class="form-group">
<div class="form-group" ng-class="{'has-error':accountForm.wechat.$invalid && accountForm.wechat.$dirty}">
<label class="control-label" for="wechat-input">WeChat Account</label>
<input class="form-control" type="text" id="wechat-input" name="wechat"
ng-model="manager.wechat">
</div>
<div class="form-group">
<div class="form-group" ng-if="!currentUser.org_id">
<label class="control-label">Roles</label>
<p class="checkbox checkbox-inline">
<label ng-if="('00001'|withRole)">
@ -90,6 +90,9 @@
<label ng-if="('00001'|withRole)">
<input type="checkbox" ng-model="manager.guest" name="guest">Guest
</label>
<label ng-if="('00001'|withRole)">
<input type="checkbox" ng-model="manager.orgmanager" name="guest">Org Manager
</label>
</p>
</div>
<div class="form-group" ng-if="('1'|withRole) && !manager.admin && !manager.operator && orgs != null">

@ -26,6 +26,15 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
return $http.get('/sys/orgs/' + $stateParams.orgId);
}]
}
}).state('organizations.detail_parent', {
url: '/{orgId}/detail_parent',
templateUrl: '/static/config/organizations/templates/org_detail_parent.html',
controller: 'orgDetailParentCtrl',
resolve: {
org: ['$http', '$stateParams', function ($http, $stateParams) {
return $http.get('/sys/orgs/' + $stateParams.orgId);
}]
}
}).state('organizations.new', {
url: '/new_org',
templateUrl: '/static/config/organizations/templates/new_org.html',
@ -33,17 +42,26 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
})
}]);
app.controller('orgsCtrl', ['$scope', '$http','commonDialog', function ($scope, $http,commonDialog ) {
$scope.params = {type:0};
$scope.params = {};
if($scope.currentUser.org_id !=null && !angular.equals({}, $scope.currentUser.org_id)) {
$scope.params.org_id = $scope.currentUser.org_id;
}
$scope.pagination = {};
$scope.types = angular.copy(types);
$scope.listOrgs = function (page) {
var params = angular.copy( $scope.params);
params.page = page || $scope.pagination.page || 1;
$http.get('/sys/orgs/listsOrg',{params:params}).then(function (resp) {
$scope.orgs = resp.data.data;
$scope.orgs_detail = resp.data.data;
$scope.pagination = resp.data.pagination;
})
};
if (($scope.currentUser.role & parseInt('1000011', 2)) > 0 && !$scope.currentUser.org_id) {
$scope.showOrg = 'Organization';
$http.get('/sys/orgs/list_all_Org', {params: {}}).then(function (resp) {
$scope.orgs = resp.data;
});
}
$scope.disableOrg = function (org) {
$scope.org =angular.copy(org);
$scope.org.is_valid = 0;
@ -63,6 +81,9 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
app.controller('orgDetailCtrl', ['$scope', '$http', '$state', 'Upload', '$uibModal','commonDialog', 'org', function ($scope, $http, $state, Upload,$uibModal,commonDialog, org) {
$scope.types = angular.copy(types);
$scope.org = angular.copy(org.data);
if ($scope.currentUser.org_id != null) {
$scope.org.type = 0;
}
$scope.uploadLogo = function (file) {
if (file == null) {
return;
@ -154,6 +175,103 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
})
}
}]);
app.controller('orgDetailParentCtrl', ['$scope', '$http', '$state', 'Upload', '$uibModal','commonDialog', 'org', function ($scope, $http, $state, Upload,$uibModal,commonDialog, org) {
$scope.types = angular.copy(types);
$scope.org = angular.copy(org.data);
if ($scope.currentUser.org_id != null) {
$scope.org.type = 0;
}
$scope.uploadLogo = function (file) {
if (file == null) {
return;
}
$scope.logoProgress = {value: 0};
Upload.upload({
url: '/attachment/files',
data: {file: file}
}).then(function (resp) {
delete $scope.logoProgress;
$scope.org.logo = resp.data.url;
}, function (resp) {
delete $scope.logoProgress;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total);
})
};
$scope.update = function (form) {
if (form.$invalid) {
angular.forEach(form, function (item, key) {
if (key.indexOf('$') < 0) {
item.$dirty = true;
}
});
return;
}
$http.put('/sys/orgs/' + $scope.org.org_id, $scope.org).then(function () {
commonDialog.alert({title: 'Succeed', content: 'Organization update succeeded', type: 'success'});
$state.reload();
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
})
};
/*
$scope.toggleRateEditable = function () {
if($scope.org.rate_editable==org.data.rate_editable){
return;
}
$http.put('/sys/orgs/'+$scope.org.org_id+'/enable_change_rate',{enabled:$scope.org.rate_editable}).then(function () {
},function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
})
};
$scope.search = {role:'1111111'};
$scope.listManagers = function () {
$http.get('/sys/manager_accounts',{params:{org_id:$scope.org.org_id}}).then(function (resp) {
$scope.managers = resp.data;
})
};
$scope.listManagers();
$scope.modifyManager = function (manager) {
$uibModal.open({
templateUrl: '/static/config/managers/templates/modify.html',
controller: 'modifyManagerCtrl',
resolve: {
manager: function () {
return angular.copy(manager);
}
}
}).result.then(function () {
$scope.listManagers();
})
};
$scope.disableManager = function (manager) {
commonDialog.confirm({
title: 'Confirm!',
content: 'You are setting manager ' + manager.display_name + ' disabled.Are you sure?'
}).then(function () {
$http.delete('/sys/manager_accounts/' + manager.manager_id).then(function () {
$scope.listManagers();
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
})
})
};
$scope.newManager = function () {
$uibModal.open({
templateUrl: '/static/config/managers/templates/new_manager.html',
controller: 'newManagerCtrl',
resolve: {
org: angular.copy($scope.org)
}
}).result.then(function () {
$scope.listManagers();
})
}*/
}]);
app.controller('newOrgCtrl', ['$scope', '$http', '$state', 'Upload', 'commonDialog', function ($scope, $http, $state, Upload, commonDialog) {
$scope.types = angular.copy(types);
$scope.uploadLogo = function (file) {
@ -183,6 +301,10 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
});
return;
}
if($scope.currentUser.org_id !=null && !angular.equals({}, $scope.currentUser.org_id)) {
$scope.org.parent_org_id = angular.copy($scope.currentUser.org.org_id);
$scope.org.type = '0';
}
$http.post('/sys/orgs', $scope.org).then(function (resp) {
commonDialog.alert({
title: 'Succeed',
@ -226,6 +348,10 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
});
return;
}
if(currentUser.org_id != null && !currentUser.parent_org_id){
$scope.manager.bd=true;
}
$http.post('/sys/manager_accounts', $scope.manager).then(function () {
$scope.$close();
}, function (resp) {

@ -64,7 +64,8 @@
required>
</div>
</div>
<div class="form-group" ng-class="{'has-error':org_form.type.$invalid && org_form.type.$dirty}">
<div class="form-group" ng-class="{'has-error':org_form.type.$invalid && org_form.type.$dirty}"
ng-show="!currentUser.org_id">
<label class="control-label col-sm-2" for="org_type_input">Type *</label>
<div class="col-sm-8">
<!--<select class="form-control" ng-model="org.type" ng-init="org.type=0" id="org_type_input">-->
@ -88,7 +89,7 @@
</div>
</div>
</div>
<div ng-if="org.type == 0">
<div ng-if="org.type == 0 || currentUser.org_id !=null">
<div class="form-group"
ng-class="{'has-error':org_form.alipay_rate_value.$invalid && org_form.alipay_rate_value.$dirty}">
<label class="control-label col-sm-2" for="alipay_rate_value_input">Alipay rate *</label>

@ -50,7 +50,8 @@
<input class="form-control" ng-model="org.location" id="org_location_input" name="location" required>
</div>
</div>
<div class="form-group" ng-class="{'has-error':org_form.type.$invalid && org_form.type.$dirty}">
<div class="form-group" ng-class="{'has-error':org_form.type.$invalid && org_form.type.$dirty}"
ng-if="!currentUser.org_id">
<label class="control-label col-sm-2" for="org_type_input">Type *</label>
<div class="col-sm-8">
<!--<select class="form-control" ng-model="org.type" ng-init="org.type=0" id="org_type_input">-->
@ -191,6 +192,7 @@
<option value="1000000">Director</option>
<option value="10000000">Site Manager</option>
<option value="100000000">Developer</option>
<option value="1000000000000">Org Manager</option>
</select>
</div>
</form>
@ -236,6 +238,7 @@
<i class="fa fa-line-chart" title="Director" ng-class="{'text-green':manager.director,'text-gray':!manager.director}"></i>
<i class="fa fa-map-o" title="Site Manager" ng-class="{'text-green':manager.sitemanager,'text-gray':!manager.sitemanager}"></i>
<i class="fa fa-code" title="Developer" ng-class="{'text-green':manager.developer,'text-gray':!manager.developer}"></i>
<i class="fa fa-user-plus" title="Org Manager" ng-class="{'text-green':manager.orgmanager,'text-gray':!manager.orgmanager}"></i>
</td>
<td>
<a role="button" class="text-bold text-primary" ng-click="modifyManager(manager)">Modify</a>

@ -0,0 +1,255 @@
<style>
.form-control-float {
float: left;
width: 93%; !important;
}
.form-control-span{
height: 34px;
}
</style>
<section class="content-header">
<h1 ng-bind="org.name"></h1>
<ol class="breadcrumb">
<li><i class="fa fa-users"></i> Basic Config</li>
<li>
<a ui-sref="^" ui-sref-opts="{reload:true}">Organizations</a>
</li>
<li class="active" ng-bind="org.name"></li>
</ol>
</section>
<section class="content">
<div class="box box-warning">
<div class="box-body">
<uib-tabset>
<uib-tab heading="Basic Info">
<form class="form-horizontal margin-top" name="org_form" novalidate>
<div class="panel">
<div class="form-group" ng-class="{'has-error':org_form.name.$invalid && org_form.name.$dirty}">
<label class="control-label col-sm-2" for="org_name_input">Name *</label>
<div class="col-sm-8">
<input class="form-control" ng-model="org.name" id="org_name_input" name="name" required>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">Logo</label>
<div class="col-sm-8">
<p class="form-control-static">
<button class="btn btn-primary" type="button" ngf-select="uploadLogo($file)"
accept="image/*" ngf-max-size="1MB">
<i class="fa fa-upload"></i> Upload
</button>
<uib-progressbar value="logoProgress.value" ng-if="logoProgress"></uib-progressbar>
<img ng-src="{{org.logo}}" class="col-sm-3" ng-if="org.logo">
</p>
</div>
</div>
<div class="form-group" ng-class="{'has-error':org_form.location.$invalid && org_form.location.$dirty}">
<label class="control-label col-sm-2" for="org_location_input">Location *</label>
<div class="col-sm-8">
<input class="form-control" ng-model="org.location" id="org_location_input" name="location" required>
</div>
</div>
<div class="form-group" ng-class="{'has-error':org_form.type.$invalid && org_form.type.$dirty}"
ng-if="!currentUser.org_id">
<label class="control-label col-sm-2" for="org_type_input">Type *</label>
<div class="col-sm-8">
<!--<select class="form-control" ng-model="org.type" ng-init="org.type=0" id="org_type_input">-->
<!--<option value="0">代理人</option>-->
<!--<option value="1">推荐人</option>-->
<!--</select>-->
<select class="form-control" name="type" required ng-model="org.type"
id="org_type_input"
ng-options="type.value as type.label for type in types">
<!--<option value="">Please Choose</option>-->
</select>
</div>
</div>
<div ng-if="org.type == 1">
<div class="form-group" ng-class="{'has-error':org_form.rate_value.$invalid && org_form.rate_value.$dirty}">
<label class="control-label col-sm-2" for="rate_value_input">Rate *</label>
<div class="col-sm-8">
<input class="form-control form-control-float" type="number" ng-model="org.rate_value" id="rate_value_input" name="rate_value" max="100">
<span class="input-group-addon form-control-span">%</span>
</div>
</div>
</div>
<div ng-if="org.type == 0">
<div class="form-group" ng-class="{'has-error':org_form.alipay_rate_value.$invalid && org_form.alipay_rate_value.$dirty}">
<label class="control-label col-sm-2" for="alipay_rate_value_input">Alipay Rate *</label>
<div class="col-sm-8">
<input class="form-control form-control-float" type="number" ng-model="org.alipay_rate_value" id="alipay_rate_value_input" name="alipay_rate_value" max="100" readonly>
<span class="input-group-addon form-control-span">%</span>
</div>
</div>
<div class="form-group" ng-class="{'has-error':org_form.wechat_rate_value.$invalid && org_form.wechat_rate_value.$dirty}">
<label class="control-label col-sm-2" for="wechat_rate_value_input">Wechat Rate *</label>
<div class="col-sm-8">
<input class="form-control form-control-float" type="number" ng-model="org.wechat_rate_value" id="wechat_rate_value_input" name="wechat_rate_value" max="100" readonly>
<span class="input-group-addon form-control-span">%</span>
</div>
</div>
<div class="form-group" ng-class="{'has-error':org_form.bestpay_rate_value.$invalid && org_form.bestpay_rate_value.$dirty}">
<label class="control-label col-sm-2" for="bestpay_rate_value_input">Bestpay Rate *</label>
<div class="col-sm-8">
<input class="form-control form-control-float" type="number" ng-model="org.bestpay_rate_value" id="bestpay_rate_value_input" name="bestpay_rate_value" max="100" readonly>
<span class="input-group-addon form-control-span">%</span>
</div>
</div>
<div class="form-group" ng-class="{'has-error':org_form.jd_rate_value.$invalid && org_form.jd_rate_value.$dirty}">
<label class="control-label col-sm-2" for="jd_rate_value_input">JD Pay Rate *</label>
<div class="col-sm-8">
<input class="form-control form-control-float" type="number" ng-model="org.jd_rate_value" id="jd_rate_value_input" name="jd_rate_value" max="100" readonly>
<span class="input-group-addon form-control-span">%</span>
</div>
</div>
<div class="form-group" ng-class="{'has-error':org_form.alipayonline_rate_value.$invalid && org_form.alipayonline_rate_value.$dirty}">
<label class="control-label col-sm-2" for="alipayonline_rate_value_input">AlipayOnline Rate *</label>
<div class="col-sm-8">
<input class="form-control form-control-float" type="number" ng-model="org.alipayonline_rate_value" id="alipayonline_rate_value_input" name="alipayonline_rate_value" max="100" readonly>
<span class="input-group-addon form-control-span">%</span>
</div>
</div>
</div>
<div class="form-group" ng-class="{'has-error':org_form.contact_person.$invalid && org_form.contact_person.$dirty}">
<label class="control-label col-sm-2" for="org_contact_person_input">Contact Person *</label>
<div class="col-sm-8">
<input class="form-control" ng-model="org.contact_person" id="org_contact_person_input" name="contact_person" required>
</div>
</div>
<div class="form-group" ng-class="{'has-error':org_form.contact_phone.$invalid && org_form.contact_phone.$dirty}">
<label class="control-label col-sm-2" for="org_contact_phone_input">Phone *</label>
<div class="col-sm-8">
<input class="form-control" ng-model="org.contact_phone" id="org_contact_phone_input" name="contact_phone" required>
</div>
</div>
<div class="form-group" ng-class="{'has-error':org_form.contact_mail.$invalid && org_form.contact_mail.$dirty}">
<label class="control-label col-sm-2" for="org_contact_mail_input">Mail *</label>
<div class="col-sm-8">
<input class="form-control" ng-model="org.contact_mail" id="org_contact_mail_input" name="contact_mail" required>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="commission_checkbox">Enable Commission</label>
<div class="col-sm-8">
<input id="commission_checkbox" type="checkbox" class="checkbox-inline checkbox" ng-model="org.commission" readonly
onclick="return false">
</div>
</div>
<div class="form-group"
ng-class="{'has-error':org_form.remark.$invalid && org_form.remark.$dirty}">
<label class="control-label col-sm-2" for="remark-input">Remark</label>
<div class="col-sm-8">
<textarea class="form-control" ng-model="org.remark" name="remark"
id="remark-input" maxlength="500"></textarea>
</div>
</div>
</div>
<div class="btn-group margin-bottom margin-top">
<button class="btn btn-success" type="button" ng-click="update(org_form)">Save
</button>
<a class="btn btn-danger" role="button" ui-sref="^" ui-sref-opts="{reload:true}">Back</a>
</div>
<!--<button class="btn btn-success col-sm-offset-2" ng-click="update()"><i class="fa fa-save"></i> Update</button>-->
</form>
</uib-tab>
<!-- <uib-tab heading="Permission" ng-if="org.type == 0">
<form class="form-horizontal margin-top" name="org_permission_form">
<div class="form-group">
<label class="col-xs-4 col-sm-2 control-label">Client Rate Editable</label>
<div class="col-xs-8 col-sm-8">
<input type="checkbox" ng-model="org.rate_editable" bs-switch switch-change="toggleRateEditable()">
</div>
</div>
</form>
</uib-tab>-->
</uib-tabset>
</div>
</div>
<!-- <div class="box-solid" ng-if="org.type == 0">
<div class="box box-warning">
<div class="box-header">
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-2">
<form class="navbar-form navbar-left" role="search">
<div class="form-group">
<label class="control-label" for="username-filter-input">Username</label>
<input type="text" class="form-control" ng-model="search.username" placeholder="Username" id="username-filter-input">
</div>
<div class="form-group" ng-if="'1'|withRole">
<label class="control-label" for="role-filter-select">Role</label>
<select class="form-control" id="role-filter-select" ng-model="search.role">
<option value="1111111">All</option>
<option value="1">Administrator</option>
<option value="10">Compliance</option>
<option value="100">BD User</option>
<option value="1000">Accountant</option>
<option value="10000">Service</option>
<option value="100000">Account Manager</option>
<option value="1000000">Director</option>
<option value="10000000">Site Manager</option>
<option value="100000000">Developer</option>
</select>
</div>
</form>
<div class="navbar-form navbar-right">
<button class="btn btn-success" type="button" ng-click="newManager()">
<i class="fa fa-plus"></i> New Manager Account
</button>
</div>
</div>
</div>
</div>
<div class="box">
<div class="box-body">
<div class="row">
<div class="col-sm-12 table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Username</th>
<th>Display Name</th>
<th>Wechat</th>
<th>Create Time</th>
<th>Email</th>
<th>Roles</th>
<th>Operation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="manager in managers|managersFilter:search">
<td ng-bind="manager.username"></td>
<td ng-bind="manager.display_name"></td>
<td style="white-space: nowrap;overflow: hidden;text-overflow:ellipsis;"><img ng-src="{{manager.headimg}}" style="height: 30px;width:30px;" class="img-circle" ng-if="manager.headimg"> {{manager.nickname}}</td>
<td ng-bind="manager.create_time|date:'yyyy-MM-dd'"></td>
<td ng-bind="manager.email"></td>
<td>
<i class="fa fa-user-secret" title="Administrator" ng-class="{'text-green':manager.admin,'text-gray':!manager.admin}"></i>
<i class="fa fa-eye" title="Compliance" ng-class="{'text-green':manager.operator,'text-gray':!manager.operator}"></i>
<i class="fa fa-crosshairs" title="BD User" ng-class="{'text-green':manager.bd,'text-gray':!manager.bd}"></i>
<i class="fa fa-balance-scale" title="Accountant" ng-class="{'text-green':manager.finacial,'text-gray':!manager.finacial}"></i>
<i class="fa fa-tty" title="Service" ng-class="{'text-green':manager.sevant,'text-gray':!manager.servant}"></i>
<i class="fa fa-university" title="Account Manager" ng-class="{'text-green':manager.accountmanager,'text-gray':!manager.accountmanager}"></i>
<i class="fa fa-line-chart" title="Director" ng-class="{'text-green':manager.director,'text-gray':!manager.director}"></i>
<i class="fa fa-map-o" title="Site Manager" ng-class="{'text-green':manager.sitemanager,'text-gray':!manager.sitemanager}"></i>
<i class="fa fa-code" title="Developer" ng-class="{'text-green':manager.developer,'text-gray':!manager.developer}"></i>
</td>
<td>
<a role="button" class="text-bold text-primary" ng-click="modifyManager(manager)">Modify</a>
|
<a class="text-bold text-danger" role="button" ng-click="disableManager(manager)">Disable</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>-->
</section>

@ -86,15 +86,22 @@
<div class="form-horizontal">
<div class="form-group ">
<div class="col-sm-6">
<div>
<!-- <div ng-if="currentUser.org_id==null">
<label class="col-xs-4 col-sm-5">
<select class="form-control" name="type" required ng-model="params.type"
id="org_type_input"
ng-options="type.value as type.label for type in types"
ng-change="listOrgs(1)">
<!--<option value="">Please Choose</option>-->
&lt;!&ndash;<option value="">Please Choose</option>&ndash;&gt;
</select>
</label>
</div>-->
<div class="form-group col-sm-5" ng-if="orgs">
<select id="org-select" class="form-control" ng-model="params.org_id"
ng-options="org.org_id as org.name group by org.org_type for org in orgs"
ng-change="listOrgs();">
<option value="">All Organizations</option>
</select>
</div>
<div class="col-xs-4 col-sm-6">
<input class="form-control" type="text" placeholder="请输入姓名或联系人"
@ -135,7 +142,7 @@
</tr>
</thead>
<tbody>
<tr ng-repeat="org in orgs"
<tr ng-repeat="org in orgs_detail"
ng-class="{'delete':org.is_valid==0}">
<td ng-if="org.logo">
<img ng-src="{{org.logo}}" style="height: 30px;width: 30px;">
@ -144,7 +151,8 @@
<img src="/static/images/r_logo.svg"
style="height: 30px;width:30px">
</td>
<td>{{org.name}}</td>
<td>{{org.name}} <i class="fa fa-sitemap" ng-if="org.parent_org_id"
title="Sub Partner"></i></td>
<td>{{org.location}}</td>
<td>{{org.contact_person}}</td>
<td>{{org.contact_phone}}</td>
@ -153,11 +161,15 @@
<td>
<div ng-if="org.is_valid==1">
<a role="button" class="text-bold text-primary"
ui-sref=".detail({orgId:org.org_id})"><i
class="fa fa-edit"></i> Edit</a>
|
ui-sref=".detail({orgId:org.org_id})" ng-if="(currentUser.org_id == null) || (org.parent_org_id == currentUser.org_id)"><i
class="fa fa-edit"></i> Edit |</a>
<a role="button" class="text-bold text-danger"
ng-click="disableOrg(org)">Disable</a>
ng-click="disableOrg(org)" ng-if="(currentUser.org_id == null)||(org.parent_org_id == currentUser.org_id)">Disable</a>
<a role="button" class="text-bold text-primary"
ui-sref=".detail_parent({orgId:org.org_id})" ng-if="org.org_id==currentUser.org_id"><i
class="fa fa-edit"></i> Edit</a>
</div>
</td>
</tr>

@ -67,6 +67,10 @@
<i class="fa fa-tripadvisor"></i>
GUEST
</a>
<a class="btn btn-app" role="button" ng-click="authorizeRole('1000000000000')">
<i class="fa fa-user-plus"></i>
Org Manager
</a>
</div>
</div>
</div>

@ -122,7 +122,6 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
if ($scope.currentUser.org_id == 1 || $scope.currentUser.org_id == null) {
$scope.analysisClients();
}
$scope.pagination = {};
$scope.industries = industryMap.configs();
$scope.states = stateMap.configs();
@ -131,7 +130,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.business_structures = businessStructuresMap.configs();
$scope.clean_days = angular.copy(clean_days_map);
$scope.bd_citys = angular.copy(bd_city_map);
$scope.params = {textType: 'all'};
$scope.params = {textType: 'all',org_name:'ALL'};
$scope.loadPartners = function (page) {
var params = angular.copy($scope.params);
@ -165,6 +164,21 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
});
}
$scope.loadOrgs = function () {
var params = angular.copy($scope.params);
$http.get('/sys/orgs/orgChild',{params: params}).then(function (resp) {
$scope.orgs_child = resp.data;
})
};
$scope.loadOrgs();
/* $scope.onOrgsSelect = function (selectedItem) {
$scope.params.org_id = selectedItem.org_id;
$scope.params.org_name = selectedItem.label;
$scope.loadPartners();
};
*/
/* $scope.chooseOrg = function (org) {
if (org == 'all') {
delete $scope.params.org_id;
@ -378,7 +392,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}
}]);
app.controller('partnerDetailCtrl', ['$scope', '$http', '$state', '$uibModal', '$rootScope', 'Upload', 'commonDialog', 'partner', function ($scope, $http, $state, $uibModal, $rootScope, Upload, commonDialog, partner) {
$scope.init = {wechatcompliance: false};
$scope.init = {wechat_compliance: false,local_merchant:false};
$scope.partner = partner.data;
$scope.showDBUsers = function () {
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/bd_user').then(function (resp) {
@ -730,6 +744,24 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
})
})
};
$scope.changeLocalMerchant = function () {
if (!$scope.partner) {
return;
}
if (!$scope.init.local_merchant) {
$scope.init.local_merchant = true;
return;
}
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/local_merchant_permission', {allow: $scope.partner.local_merchant}).then(function () {
}, function (resp) {
commonDialog.alert({
title: 'failed to change local_merchant permission status',
content: resp.data.message,
type: 'error'
})
})
};
}]);
app.controller('partnerEditCtrl', ['$scope', '$http', '$state', 'Upload', 'commonDialog', 'timezone', 'partner',
function ($scope, $http, $state, Upload, commonDialog, timezone, partner) {
@ -2487,5 +2519,32 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
return bdUsers;
}
});
app.filter('bdOrgSelect', function () {
return function (bdUsers, params) {
var org_id;
org_id = params.org_ids ||params.org_id || currentUser.org_id;
if (org_id) {
var bdUserByOrg = {};
var count = 0;
angular.forEach(bdUsers, function (bdUser) {
if(params.org_ids){
if (bdUser.org_id == org_id) {
bdUserByOrg[count] = bdUser;
count++;
}
}else {
if (bdUser.org_id == org_id || bdUser.parent_org_id == org_id) {
bdUserByOrg[count] = bdUser;
count++;
}
}
});
return bdUserByOrg;
}
return bdUsers;
}
});
return app;
});

@ -357,6 +357,13 @@
<p class="form-control-static" ng-bind="partner.company_phone||'-'"></p>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">Local Merchant</label>
<div class="col-sm-10">
<input type="checkbox" ng-model="partner.local_merchant" bs-switch
switch-change="changeLocalMerchant()">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">Description</label>

@ -142,11 +142,34 @@
<div class="col-xs-6 col-sm-6">
<select id="org-select" class="form-control" ng-model="params.org_id"
ng-options="org.org_id as org.name group by org.org_type for org in orgs"
ng-change="params.bd = '';loadPartners()">
ng-change="params.bd = '';params.org_ids = null;loadPartners();loadOrgs();">
<option value="">All</option>
</select>
</div>
</div>
<div class="form-group col-sm-6" ng-if="(params.org_id && orgs_child.length>1) || (currentUser.org_id && !currentUser.parent_org_id && orgs_child.length>1)">
<label class="control-label col-xs-4 col-sm-4" for="org-clild" ng-if="!currentUser.org_id">Sub Organization</label>
<label class="control-label col-xs-4 col-sm-4" for="org-clild" ng-if="currentUser.org_id">Organization</label>
<div class="col-xs-6 col-sm-6">
<select id="org-clild" class="form-control" ng-model="params.org_ids"
ng-options="org.org_id as org.name group by org.type for org in orgs_child"
ng-change="params.bd = '';loadPartners();">
<option value="">All</option>
</select>
</div>
</div>
<!-- <div class="form-group col-sm-6">
<label class="control-label col-xs-4 col-sm-4" for="bd-select">Org
Child</label>
<div class="col-xs-6 col-sm-6">
<input class="form-control" id="org_id"
name="params.org_name"
ng-model="params.org_name"
multi-level-select-popup="orgs_child"
on-select="onOrgsSelect($selected)">
</div>
</div>-->
<!-- <div class="form-group col-sm-6" ng-if="orgs">
<label class="control-label col-xs-4 col-sm-4">Organization</label>
<div class="col-xs-6">
@ -214,12 +237,12 @@
</div>
</div>
</div>
<div class="form-group col-sm-6" ng-if="!('100'|withRole)">
<div class="form-group col-sm-6" ng-if="!('100'|withRole) || (currentUser.org_id && !currentUser.parent_org_id)">
<label class="control-label col-xs-4 col-sm-4" for="bd-select">BD
User</label>
<div class="col-xs-6 col-sm-6">
<select id="bd-select" class="form-control" ng-model="params.bd"
ng-options="bd.manager_id as bd.display_name group by bd.org_name for bd in bdUserSource | bdOrg:params.org_id">
ng-options="bd.manager_id as bd.display_name group by bd.org_name for bd in bdUserSource | bdOrgSelect:params">
<option value="">All</option>
</select>
</div>
@ -313,7 +336,7 @@
</div>
</div>
<!--status-->
<div class="form-group" ng-if="'10'|withRole">
<div class="form-group col-sm-12" ng-if="'10'|withRole">
<label class="control-label col-xs-4 col-sm-2">Status</label>
<!--<div class="col-xs-8 col-sm-4">-->
<span class="col-xs-8 col-sm-10">

@ -56,6 +56,16 @@
<input class="form-control" placeholder="Keyword" ng-enter="loadTradeLogs(1)"
ng-model="params.searchText">
</div>
<div class="col-sm-6 col-xs-8" ng-if="orgs.length>1 && currentUser.org_id">
<label class="control-label col-xs-3 col-sm-4">Organization</label>
<div class="col-xs-9 col-sm-8">
<select id="org-clild" class="form-control" ng-model="params.org_id"
ng-options="org.org_id as org.name group by org.type for org in orgs"
ng-change="loadTradeLogs(1)">
<option value="">All</option>
</select>
</div>
</div>
</div>
<div class="form-group col-xs-12">
<label class="control-label col-xs-4 col-sm-2">Status</label>

@ -17,7 +17,7 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
}]);
app.controller('globalTradeLogCtrl', ['$scope', '$http', '$filter', 'commonDialog', 'refunder', 'orderService',
function ($scope, $http, $filter, commonDialog, refunder, orderService) {
$scope.params = {status: 'PAID',channel:'ALL', textType: 'all', datefrom: new Date(), dateto: new Date()};
$scope.params = {status: 'PAID',channel:'ALL', textType: 'all', datefrom: new Date(), dateto: new Date(),org_name:'ALL'};
$scope.pagination = {};
$scope.today = new Date();
@ -76,6 +76,14 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
$scope.params.datefrom = monthBegin;
$scope.loadTradeLogs(1);
};
$scope.loadOrgs = function () {
$http.get('/sys/orgs/orgChild').then(function (resp) {
$scope.orgs = resp.data;
})
};
$scope.loadOrgs();
$scope.loadTradeLogs = function (page) {
var params = angular.copy($scope.params);
if (params.datefrom) {

@ -0,0 +1,27 @@
package au.com.royalpay.payment.manage.apps.core.impls;
import au.com.royalpay.payment.manage.apps.core.CustomerImpressionService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
/**
* Created by wangning on 05/01/2018.
*/
@SpringBootTest
@ActiveProfiles({"proxy","alipay","wechat","jd","bestpay"})
@RunWith(SpringRunner.class)
public class CustomerImpressionImplTest {
@Resource
private CustomerImpressionService customerImpression;
@Test
public void generate() throws Exception {
customerImpression.generate(9);
}
}

@ -0,0 +1,4 @@
/**
* Created by yishuqian on 05/01/2018.
*/
package au.com.royalpay.payment.manage;
Loading…
Cancel
Save