add 三级商户、报备信息不足提示、报备json显示

master
luoyang 6 years ago
parent a2971575e1
commit a3a786d821

@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.Date;
import java.util.List;
@ -114,5 +115,6 @@ public interface ClientMapper {
JSONObject countBdApproveClients(@Param("manager_id") String manager_id);
@Select("select client_id from sys_clients where parent_client_id=#{parent_client_id}")
List<Integer> childClientId(@Param("parent_client_id") int parent_client_id);
}

@ -173,10 +173,8 @@ public interface ClientManager {
List<JSONObject> listSubClients(JSONObject manager, String clientMoniker);
List<JSONObject> listSubClients(int clientId);
// void newSubClient(String clientMoniker, SubClientRegistry registry, JSONObject manager);
void validateClients(int client_id, JSONObject params) throws Exception;
@ -341,6 +339,10 @@ public interface ClientManager {
String queryAlipayGmsStatus(String clientMoniker, JSONObject manager);
JSONObject queryAlipayGmsJson(String clientMoniker, JSONObject manager);
JSONObject queryAlipayOnlineGmsJson(String clientMoniker, JSONObject manager);
String queryAlipayOnlineGmsStatus(String clientMoniker, JSONObject manager);
List<JSONObject> listMerchantIds(String clientMoniker,JSONObject manager);
@ -428,4 +430,6 @@ public interface ClientManager {
void resetRefundPassword(JSONObject account, JSONObject json);
void resetRefundPasswordByManage(String clientMoniker,JSONObject manage, JSONObject json);
List<Integer> listLevel3Client(int client_id);
}

@ -388,7 +388,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
client.put("contact_email", "******");
}
} else {
client.put("rate_editable",ManagerRole.OPERATOR.hasRole(role));
client.put("rate_editable", ManagerRole.OPERATOR.hasRole(role));
}
}
List<JSONObject> children = clientMapper.listChildClients(client.getIntValue("client_id"));
@ -884,14 +884,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
if(client.getString("yeepay_sub_merchant_id").equals(yeepaySubMerchantInfo.getString("yeepay_sub_merchant_id"))){
if (client.getString("yeepay_sub_merchant_id").equals(yeepaySubMerchantInfo.getString("yeepay_sub_merchant_id"))) {
throw new BadRequestException("The sub merchant Id is in use");
}
JSONObject yeepayConfigValid =yeePayClientConfigMapper.findMerchantConfig(client.getIntValue("client_id"));
yeePayClientConfigMapper.updateSubMerchantIdValid(yeepayConfigValid.getString("yeepay_config_id"),0);
JSONObject yeepayConfigValid = yeePayClientConfigMapper.findMerchantConfig(client.getIntValue("client_id"));
yeePayClientConfigMapper.updateSubMerchantIdValid(yeepayConfigValid.getString("yeepay_config_id"), 0);
JSONObject yeepayConfig = yeePayClientConfigMapper.findMerchantConfigBySub(client.getIntValue("client_id"), yeepaySubMerchantInfo.getString("yeepay_sub_merchant_id"));
yeePayClientConfigMapper.updateSubMerchantIdValid(yeepayConfig.getString("yeepay_config_id"),1);
client.put("yeepay_sub_merchant_id",yeepaySubMerchantInfo.getString("yeepay_sub_merchant_id"));
yeePayClientConfigMapper.updateSubMerchantIdValid(yeepayConfig.getString("yeepay_config_id"), 1);
client.put("yeepay_sub_merchant_id", yeepaySubMerchantInfo.getString("yeepay_sub_merchant_id"));
clientMapper.update(client);
}
@ -1156,14 +1156,13 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
* email = bd.getString("email"); if (StringUtils.isNotEmpty(email)) { emails.add(email); } } new Thread() {
*
* @Override public void run() { try { SendMail sendMail = new SendMail(); Set<String> to = new HashSet<>();
* to.add(mailTo); sendMail.setFrom("info@mail.royalpay.com.au"); sendMail.setMailTos(to);
* sendMail.setMailCcs(emails); sendMail.setTitle("Your RoyalPay Cross-border Payment has been set up");
* sendMail.setContent(content); sendMail.setTags(tags); JSONObject mailResult =
* mailGunService.sendMail(sendMail); clientModifySupport.processClientModify(new EmailModify(account,
* client.getString("client_moniker"), 3, mailResult.getString("mail_id"))); } catch (Exception e) {
* clientModifySupport.processClientModify(new EmailModify(account, client.getString("client_moniker"), 0,
* null)); throw new EmailException("Email Sending Failed", e); } } }.start(); }
*
* to.add(mailTo); sendMail.setFrom("info@mail.royalpay.com.au"); sendMail.setMailTos(to);
* sendMail.setMailCcs(emails); sendMail.setTitle("Your RoyalPay Cross-border Payment has been set up");
* sendMail.setContent(content); sendMail.setTags(tags); JSONObject mailResult =
* mailGunService.sendMail(sendMail); clientModifySupport.processClientModify(new EmailModify(account,
* client.getString("client_moniker"), 3, mailResult.getString("mail_id"))); } catch (Exception e) {
* clientModifySupport.processClientModify(new EmailModify(account, client.getString("client_moniker"), 0,
* null)); throw new EmailException("Email Sending Failed", e); } } }.start(); }
*/
public void sendAuthInitEmail(JSONObject account, final JSONObject client) {
@ -1351,7 +1350,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
if(!client.containsKey("parent_client_id") && client.getBoolean("sub_manage")){
if (!client.containsKey("parent_client_id") && client.getBoolean("sub_manage")) {
return clientAccountMapper.partnerAndSubPartnerAccounts(client.getIntValue("client_id"));
}
return clientAccountMapper.listPartnerAccounts(client.getIntValue("client_id"));
@ -1374,7 +1373,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
accountJson.put("salt", salt);
accountJson.put("password_hash", PasswordUtils.hashPwd(account.getPwd(), salt));
accountJson.put("password_aes", PasswordUtils.encryptAESPwd(account.getPwd()));
accountJson.put("client_id", account.getClientId()==0?client.getIntValue("client_id"):account.getClientId());
accountJson.put("client_id", account.getClientId() == 0 ? client.getIntValue("client_id") : account.getClientId());
accountJson.put("creator", managerType == 1 ? manager.getString("manager_id") : manager.getString("account_id"));
accountJson.put("creator_type", managerType);
accountJson.put("create_time", new Date());
@ -1409,8 +1408,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (account.getIntValue("client_id") != client.getIntValue("client_id")) {
//登录用户所属商户
JSONObject clientLogin = getClientInfo(account.getIntValue("client_id"));
if(!(client.getBoolean("sub_manage") &&
clientLogin.containsKey("parent_client_id")?clientLogin.getIntValue("parent_client_id")==client.getIntValue("client_id"):false)){
Boolean validChildClients = clientLogin.containsKey("parent_client_id") ? clientLogin.getIntValue("parent_client_id") == client.getIntValue("client_id") : false;
Boolean validLevel3Clients = listLevel3Client(client.getIntValue("client_id")).contains(clientLogin.getIntValue("parent_client_id"));
if (!(client.getBoolean("sub_manage") && (validChildClients || validLevel3Clients))) {
throw new BadRequestException("error.partner.valid.account_not_match");
}
}
@ -1805,7 +1805,18 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
return clientMapper.listChildClients(client.getIntValue("client_id"));
JSONObject listSubClients = new JSONObject();
List<JSONObject> listChildClients = clientMapper.listChildClients(client.getIntValue("client_id"));
for (JSONObject partner : listChildClients) {
List<JSONObject> clients = clientMapper.listChildClients(partner.getIntValue("client_id"));
if (clients.size() > 0) {
partner.put("level3Clients", clients);
clients.forEach(e->{
e.put("parent_client_moniker", partner.getString("client_moniker"));
});
}
}
return listChildClients;
}
@Override
@ -1884,7 +1895,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
for (String currentClientId : client_ids) {
JSONObject clientInfo = getClientInfo(Integer.parseInt(currentClientId));
if (clientInfo.containsKey("parent_client_id")) {
if (clientInfo.getIntValue("parent_client_id") != client_id) {
int parentClientId = clientInfo.getIntValue("parent_client_id");
if (parentClientId != client_id && !listLevel3Client(client_id).contains(parentClientId)) {
throw new Exception("partner has no permission");
}
}
@ -1893,6 +1905,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
}
@Override
public List<Integer> listLevel3Client(int clientId) {
return clientMapper.childClientId(clientId);
}
@Override
@Transactional
public void updateClientBDUsers(JSONObject manager, String clientMoniker, JSONObject data) throws Exception {
@ -2243,7 +2260,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
@Override
public void resetRefundPasswordByManage(String clientMoniker,JSONObject manage, JSONObject json) {
public void resetRefundPasswordByManage(String clientMoniker, JSONObject manage, JSONObject json) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
@ -3420,7 +3437,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override
@Transactional
public void setSkipClearing(JSONObject account, String clientMoniker, Boolean skip_clearing,String remark) {
public void setSkipClearing(JSONObject account, String clientMoniker, Boolean skip_clearing, String remark) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
@ -3428,7 +3445,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account, clientMoniker, "skip_clearing", skip_clearing));
if (!skip_clearing) {
if ("".equals(remark) || remark==null){
if ("".equals(remark) || remark == null) {
throw new ServerErrorException("请填写关闭清算原因");
}
JSONObject clientConfig = clientConfigMapper.find(client.getIntValue("client_id"));
@ -3492,7 +3509,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException();
}
List<JSONObject> transactions = clearingDistributedSurchargeMapper.findTransactions(client.getIntValue("client_id"));
transactions.forEach(e->{
transactions.forEach(e -> {
if ("Credit".equals(e.getString("type"))) {
JSONObject manager = managerMapper.findDetail(e.getString("operation"));
e.put("operator_displayname", manager.getString("display_name"));
@ -3519,10 +3536,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
JSONObject params = new JSONObject();
params.put("client_id", client.getIntValue("client_id"));
params.put("year", date.substring(0, 4));
params.put("month", date.substring(date.length()-2, date.length()));
params.put("month", date.substring(date.length() - 2, date.length()));
List<JSONObject> transactions = clearingDistributedSurchargeMapper.findTransactionsByDate(params);
transactions.forEach(e->{
transactions.forEach(e -> {
if ("Credit".equals(e.getString("type"))) {
JSONObject manager = managerMapper.findDetail(e.getString("operation"));
e.put("operator_displayname", manager.getString("display_name"));
@ -3561,10 +3578,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
transaction.put("client_id", client.getIntValue("client_id"));
transaction.put("type", "Credit");
transaction.put("total_surcharge", BigDecimal.ZERO);
transaction.put("tax_amount", BigDecimal.ZERO);
transaction.put("post_balance", surcharge_account.getBigDecimal("balance").add(transaction.getBigDecimal("amount")));
transaction.put("operation", account.getString("manager_id"));
transaction.put("create_time", new Date());
transaction.put("tax_amount", BigDecimal.ZERO);
transaction.put("post_balance", surcharge_account.getBigDecimal("balance").add(transaction.getBigDecimal("amount")));
transaction.put("operation", account.getString("manager_id"));
transaction.put("create_time", new Date());
clearingDistributedSurchargeMapper.save(transaction);
surcharge_account.put("balance", surcharge_account.getBigDecimal("balance").add(transaction.getBigDecimal("amount")));
@ -3741,8 +3758,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
}
private TemplateMessage initSendToComplianceGreenChannelTemplate(String loginUrl, String wxopenid, String templateId2, String bd_user_name,
JSONObject client) {
private TemplateMessage initSendToComplianceGreenChannelTemplate(String loginUrl, String wxopenid, String templateId2, String bd_user_name, JSONObject client) {
TemplateMessage msg = new TemplateMessage(wxopenid, templateId2, loginUrl);
msg.put("first", bd_user_name + " 提交了新商户绿色通道申请,请审核", "#ff0000");
msg.put("keyword1", client.getString("client_moniker") + "申请绿色通道", "#0000ff");
@ -4007,6 +4023,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
client.put("bank_id", client_bank.getString("account_no"));
if (StringUtils.isBlank(client.getString("business_structure"))) {
throw new BadRequestException("Business Structure can't be null");
}
if (StringUtils.isBlank(client.getString("alipayindustry"))) {
throw new BadRequestException("Alipay Industry can't be null");
}
if (!"Company".equals(client.getString("business_structure"))) {
if (StringUtils.isBlank(representative_id.getString("representative_id"))) {
throw new BadRequestException("ID or passport number can't be null");
@ -4045,6 +4069,82 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return "查询成功:" + responseElement.elementText("secondary_merchant_id") + "报备状态 : " + responseElement.elementText("status");
}
@Override
public JSONObject queryAlipayGmsJson(String clientMoniker, JSONObject manager) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayRetailMerchant();
JSONObject queryGMSJson = new JSONObject(new LinkedHashMap());
queryGMSJson.put("service", "alipay.overseas.secmerchant.offline.maintain");
queryGMSJson.put("partner", mch.getPid());
queryGMSJson.put("sign_type", "MD5");
queryGMSJson.put("_input_charset", "utf-8");
queryGMSJson.put("timestamp", DateFormatUtils.format(System.currentTimeMillis(),"yyyy-MM-dd HH:mm:ss"));
queryGMSJson.put("secondary_merchant_name", client.getString("company_name"));
queryGMSJson.put("secondary_merchant_id", client.getString("client_moniker"));
queryGMSJson.put("store_id", client.getString("client_moniker"));
queryGMSJson.put("store_name", client.getString("short_name"));
queryGMSJson.put("store_country", client.getString("country").substring(0,2));
queryGMSJson.put("store_address", client.getString("country") + " "+client.getString("state") + " "+client.getString("suburb") + " "+client.getString("address"));
queryGMSJson.put("store_industry", client.getString("alipayindustry"));
queryGMSJson.put("internal_store_photo", client.getString("company_photo"));
queryGMSJson.put("external_storefront_photo", client.getString("store_photo"));
queryGMSJson.put("register_country", client.getString("country").substring(0,2));
queryGMSJson.put("register_address", client.getString("country") + " "+client.getString("state") + " "+client.getString("suburb") + " "+client.getString("address"));
if ("Company".equals(client.getString("business_structure"))) {
queryGMSJson.put("secondary_merchant_type", "ENTERPRISE");
queryGMSJson.put("registration_no", client.getString("acn"));
}else {
queryGMSJson.put("secondary_merchant_type", "INDIVIDUAL");
queryGMSJson.put("representative_name", client.getString("contact_person"));
}
queryGMSJson.put("contact_no",client.getString("contact_phone"));
queryGMSJson.put("contact_email",client.getString("contact_email"));
return queryGMSJson;
}
@Override
public JSONObject queryAlipayOnlineGmsJson(String clientMoniker, JSONObject manager) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
JSONObject queryGMSJson = new JSONObject(new LinkedHashMap());
AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayOnlineMerchant();
queryGMSJson.put("service", "alipay.overseas.secmerchant.online.maintain");
queryGMSJson.put("partner", mch.getPid());
queryGMSJson.put("sign_type", "MD5");
queryGMSJson.put("_input_charset", "utf-8");
queryGMSJson.put("timestamp", DateFormatUtils.format(System.currentTimeMillis(),"yyyy-MM-dd HH:mm:ss"));
queryGMSJson.put("secondary_merchant_name", client.getString("company_name"));
queryGMSJson.put("secondary_merchant_id", client.getString("client_moniker"));
queryGMSJson.put("secondary_merchant_industry", client.getString("alipayindustry"));
queryGMSJson.put("register_country", client.getString("country").substring(0,2));
queryGMSJson.put("register_address", client.getString("country") + " "+client.getString("state") + " "+client.getString("suburb") + " "+client.getString("address"));
JSONObject website = new JSONObject();
List<JSONObject> websites = new ArrayList<>();
website.put("site_type", "WEB");
website.put("site_url", client.getString("company_website"));
website.put("site_name", client.getString("company_name") + " Website");
websites.add(website);
queryGMSJson.put("site_infos", websites.toString());
if ("Company".equals(client.getString("business_structure"))) {
queryGMSJson.put("secondary_merchant_type", "ENTERPRISE");
queryGMSJson.put("registration_no", client.getString("acn"));
queryGMSJson.put("shareholder_name", client.getString("contact_person"));
}else {
queryGMSJson.put("secondary_merchant_type", "INDIVIDUAL");
queryGMSJson.put("representative_name", client.getString("contact_person"));
}
queryGMSJson.put("contact_no",client.getString("contact_phone"));
queryGMSJson.put("contact_email",client.getString("contact_email"));
return queryGMSJson;
}
@Override
public void registerAlipayOnlineGms(String clientMoniker, JSONObject representative_id, JSONObject manager) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
@ -4055,6 +4155,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (!client.containsKey("company_website")) {
throw new InvalidParameterException("Website cannot be empty ");
}
if (StringUtils.isBlank(client.getString("business_structure"))) {
throw new BadRequestException("Business Structure can't be null");
}
if (StringUtils.isBlank(client.getString("alipayindustry"))) {
throw new BadRequestException("Alipay Industry can't be null");
}
JSONObject client_bank = getBankAccountByClientId(client.getIntValue("client_id"));
if (client_bank == null || client_bank.size() <= 0) {
throw new BadRequestException("The Partner's Account is not config!");
@ -4098,7 +4206,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
@Override
public void subRpayMerchantApplication(String clientMoniker, JSONObject merchantInfo,JSONObject manager) {
public void subRpayMerchantApplication(String clientMoniker, JSONObject merchantInfo, JSONObject manager) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
@ -4107,7 +4215,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
List<JSONObject> listByshortName = sysRpayMerchantApplyMapper.listByShortName(merchantInfo.getString("company_shortname"));
if (listByshortName.size()>0) {
if (listByshortName.size() > 0) {
throw new BadRequestException("请修改【" + clientMoniker + "】的Company shortName信息Short Name 已被使用)");
}
if (client.getString("rpay_enterprise_id") != null) {
@ -4128,7 +4236,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
merchantInfo.put("merchant_shortname", merchantInfo.getString("company_shortname"));
sysRpayMerchantApplyMapper.insertRpayMerchantApply(merchantInfo);
clientMapper.updateRpayEnterpriseId(client.getIntValue("client_id"), rpayMerchantInfo.getString("merchantId"));
}else {
} else {
throw new BadRequestException("请求失败");
}
}
@ -4143,41 +4251,41 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
checkOrgPermission(manager, client);
List<JSONObject> yeepayClientConfigs = yeePayClientConfigMapper.findAllMerchantConfig(client.getIntValue("client_id"));
if(yeepayClientConfigs!=null){
for(JSONObject yeepayClientConfig:yeepayClientConfigs){
if(yeepayClientConfig.getIntValue("is_valid")==1){
yeePayClientConfigMapper.updateSubMerchantIdValid(yeepayClientConfig.getString("yeepay_config_id"),0);
if (yeepayClientConfigs != null) {
for (JSONObject yeepayClientConfig : yeepayClientConfigs) {
if (yeepayClientConfig.getIntValue("is_valid") == 1) {
yeePayClientConfigMapper.updateSubMerchantIdValid(yeepayClientConfig.getString("yeepay_config_id"), 0);
}
}
}
merchantInfo.put("create_time",new Date());
merchantInfo.put("operator",manager.getString("display_name"));
merchantInfo.put("client_id",client.getIntValue("client_id"));
merchantInfo.put("client_id",merchantInfo.getString("client_id"));
merchantInfo.put("create_time", new Date());
merchantInfo.put("operator", manager.getString("display_name"));
merchantInfo.put("client_id", client.getIntValue("client_id"));
merchantInfo.put("client_id", merchantInfo.getString("client_id"));
// merchantInfo.put("vouchers",merchantInfo.getJSONObject("vouchers").toJSONString());
List<JSONObject> directorsAll = new ArrayList<>();
List<JSONObject> executivesAll = new ArrayList<>();
directorsAll.add(merchantInfo.getJSONObject("directors"));
executivesAll.add(merchantInfo.getJSONObject("executives"));
JSONObject extInfo = new JSONObject();
extInfo.put("directors",directorsAll);
extInfo.put("executives",executivesAll);
merchantInfo.put("extinfo",extInfo.toJSONString());
extInfo.put("directors", directorsAll);
extInfo.put("executives", executivesAll);
merchantInfo.put("extinfo", extInfo.toJSONString());
yeePayClientConfigMapper.saveMerchantConfig(merchantInfo);
JSONObject yeepayConfig = yeePayClientConfigMapper.findMerchantConfig(client.getIntValue("client_id"));
yeepayConfig.put("company_website",merchantInfo.getString("company_website"));
yeepayConfig.put("abn",merchantInfo.getString("abn"));
yeepayConfig.put("company_name",merchantInfo.getString("company_name"));
yeepayConfig.put("contact_phone",merchantInfo.getString("contact_phone"));
yeepayConfig.put("contact_email",merchantInfo.getString("contact_email"));
yeepayConfig.put("contact_person",merchantInfo.getString("contact_person"));
SubmerchantRegisterResult result = yeePayClient.registerMerchant(client,yeepayConfig);
if(result.getStatus().equals("FAILED")){
yeepayConfig.put("company_website", merchantInfo.getString("company_website"));
yeepayConfig.put("abn", merchantInfo.getString("abn"));
yeepayConfig.put("company_name", merchantInfo.getString("company_name"));
yeepayConfig.put("contact_phone", merchantInfo.getString("contact_phone"));
yeepayConfig.put("contact_email", merchantInfo.getString("contact_email"));
yeepayConfig.put("contact_person", merchantInfo.getString("contact_person"));
SubmerchantRegisterResult result = yeePayClient.registerMerchant(client, yeepayConfig);
if (result.getStatus().equals("FAILED")) {
throw new BadRequestException(result.getErrorMsg());
}
yeepayConfig.put("sub_merchant_id",result.getSubMerchantId());
yeePayClientConfigMapper.updateSubMerchantId(yeepayConfig.getString("yeepay_config_id"),result.getMerchantId(),result.getSubMerchantId());
client.put("yeepay_sub_merchant_id",result.getSubMerchantId());
yeepayConfig.put("sub_merchant_id", result.getSubMerchantId());
yeePayClientConfigMapper.updateSubMerchantId(yeepayConfig.getString("yeepay_config_id"), result.getMerchantId(), result.getSubMerchantId());
client.put("yeepay_sub_merchant_id", result.getSubMerchantId());
clientMapper.update(client);
}
@ -4188,25 +4296,25 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
JSONObject config = yeePayClientConfigMapper.findMerchantConfigBySub(client.getIntValue("client_id"),merchantInfo.getString("sub_merchant_id"));
if(config != null){
JSONObject config = yeePayClientConfigMapper.findMerchantConfigBySub(client.getIntValue("client_id"), merchantInfo.getString("sub_merchant_id"));
if (config != null) {
throw new BadRequestException("You had add the sub merchant id");
}
List<JSONObject> yeepayClientConfigs = yeePayClientConfigMapper.findAllMerchantConfig(client.getIntValue("client_id"));
if(yeepayClientConfigs!=null){
for(JSONObject yeepayClientConfig:yeepayClientConfigs){
if(yeepayClientConfig.getIntValue("is_valid")==1){
yeePayClientConfigMapper.updateSubMerchantIdValid(yeepayClientConfig.getString("yeepay_config_id"),0);
if (yeepayClientConfigs != null) {
for (JSONObject yeepayClientConfig : yeepayClientConfigs) {
if (yeepayClientConfig.getIntValue("is_valid") == 1) {
yeePayClientConfigMapper.updateSubMerchantIdValid(yeepayClientConfig.getString("yeepay_config_id"), 0);
}
}
}
merchantInfo.put("client_id",client.getIntValue("client_id"));
merchantInfo.put("merchant_id",yeePayConfig.getAppKey().split("_")[1]);
merchantInfo.put("create_time",new Date());
merchantInfo.put("is_valid",1);
merchantInfo.put("operator",manager.getString("display_name"));
merchantInfo.put("client_id", client.getIntValue("client_id"));
merchantInfo.put("merchant_id", yeePayConfig.getAppKey().split("_")[1]);
merchantInfo.put("create_time", new Date());
merchantInfo.put("is_valid", 1);
merchantInfo.put("operator", manager.getString("display_name"));
yeePayClientConfigMapper.saveMerchantConfig(merchantInfo);
client.put("yeepay_sub_merchant_id",merchantInfo.getString("sub_merchant_id"));
client.put("yeepay_sub_merchant_id", merchantInfo.getString("sub_merchant_id"));
clientMapper.update(client);
}
@ -4217,28 +4325,28 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
JSONObject yeepayConfig = yeePayClientConfigMapper.findMerchantConfigBySub(client.getIntValue("client_id"),merchantInfo.getString("subMerchantId"));
JSONObject yeepayConfig = yeePayClientConfigMapper.findMerchantConfigBySub(client.getIntValue("client_id"), merchantInfo.getString("subMerchantId"));
List<JSONObject> directorsAll = new ArrayList<>();
List<JSONObject> executivesAll = new ArrayList<>();
directorsAll.add(merchantInfo.getJSONObject("directors"));
executivesAll.add(merchantInfo.getJSONObject("executives"));
JSONObject extInfo = new JSONObject();
extInfo.put("directors",directorsAll);
extInfo.put("executives",executivesAll);
yeepayConfig.put("extinfo",extInfo.toJSONString());
yeepayConfig.put("industry",merchantInfo.getString("industry"));
yeepayConfig.put("business_content",merchantInfo.getString("business_content"));
yeepayConfig.put("business_licence",merchantInfo.getString("business_licence"));
extInfo.put("directors", directorsAll);
extInfo.put("executives", executivesAll);
yeepayConfig.put("extinfo", extInfo.toJSONString());
yeepayConfig.put("industry", merchantInfo.getString("industry"));
yeepayConfig.put("business_content", merchantInfo.getString("business_content"));
yeepayConfig.put("business_licence", merchantInfo.getString("business_licence"));
yeePayClientConfigMapper.update(yeepayConfig);
yeepayConfig.put("company_website",merchantInfo.getString("company_website"));
yeepayConfig.put("abn",merchantInfo.getString("abn"));
yeepayConfig.put("company_name",merchantInfo.getString("company_name"));
yeepayConfig.put("contact_phone",merchantInfo.getString("contact_phone"));
yeepayConfig.put("contact_email",merchantInfo.getString("contact_email"));
yeepayConfig.put("contact_person",merchantInfo.getString("contact_person"));
yeepayConfig.put("mode","UPDATE");
SubmerchantRegisterResult result = yeePayClient.registerMerchant(client,yeepayConfig);
if(result.getStatus().equals("FAILED")){
yeepayConfig.put("company_website", merchantInfo.getString("company_website"));
yeepayConfig.put("abn", merchantInfo.getString("abn"));
yeepayConfig.put("company_name", merchantInfo.getString("company_name"));
yeepayConfig.put("contact_phone", merchantInfo.getString("contact_phone"));
yeepayConfig.put("contact_email", merchantInfo.getString("contact_email"));
yeepayConfig.put("contact_person", merchantInfo.getString("contact_person"));
yeepayConfig.put("mode", "UPDATE");
SubmerchantRegisterResult result = yeePayClient.registerMerchant(client, yeepayConfig);
if (result.getStatus().equals("FAILED")) {
throw new BadRequestException(result.getErrorMsg());
}
}
@ -4487,7 +4595,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
@Override
public void switchGatewayLink(JSONObject manager, String clientMoniker,String channel, boolean allow) {
public void switchGatewayLink(JSONObject manager, String clientMoniker, String channel, boolean allow) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
@ -4495,18 +4603,18 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
checkOrgPermission(manager, client);
if (allow) {
if (StringUtils.isEmpty(client.getString(channel+"_pay_url"))) {
String channel_pay_url = getGatewayShortLink(clientMoniker,channel.toLowerCase());
client.put(channel+"_pay_url", channel_pay_url);
if (StringUtils.isEmpty(client.getString(channel + "_pay_url"))) {
String channel_pay_url = getGatewayShortLink(clientMoniker, channel.toLowerCase());
client.put(channel + "_pay_url", channel_pay_url);
JSONObject clientConfig = new JSONObject();
clientConfig.put(channel+"_pay_url", channel_pay_url);
clientConfig.put(channel + "_pay_url", channel_pay_url);
clientConfig.put("client_id", client.getIntValue("client_id"));
clientConfigMapper.update(clientConfig);
clientMapper.update(client);
}
}
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "enable_"+channel+"_link", allow));
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "enable_"+channel, allow));
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "enable_" + channel + "_link", allow));
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "enable_" + channel, allow));
}
@ -4535,7 +4643,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
create_time = DateFormatUtils.format(order.getDate("create_time"), "yyyy-MM-dd HH:mm:ss");
}
ctx.setVariable("time", create_time);
final String content = thymeleaf.process( "mail/hf_email_notice", ctx);
final String content = thymeleaf.process("mail/hf_email_notice", ctx);
final String mailTo = client.getString("contact_email");
if (StringUtils.isEmpty(mailTo)) {
throw new EmailException("Client Contact Email is invalid");
@ -4557,7 +4665,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return;
}
if (client.getString("contact_email") == null ||
!clientConfig.getBoolean("enable_"+order.getString("channel").toLowerCase()+"_email_notice")) {
!clientConfig.getBoolean("enable_" + order.getString("channel").toLowerCase() + "_email_notice")) {
return;
}
Context ctx = new Context();
@ -4575,7 +4683,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
create_time = DateFormatUtils.format(order.getDate("create_time"), "yyyy-MM-dd HH:mm:ss");
}
ctx.setVariable("time", create_time);
final String content = thymeleaf.process( "mail/gateway_email_notice", ctx);
final String content = thymeleaf.process("mail/gateway_email_notice", ctx);
final String mailTo = client.getString("contact_email");
if (StringUtils.isEmpty(mailTo)) {
throw new EmailException("Client Contact Email is invalid");
@ -4589,8 +4697,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}).start();
}
private String getOrderChannel(String channel){
switch(channel){
private String getOrderChannel(String channel) {
switch (channel) {
case "hf":
return "汇付";
case "Yeepay":
@ -4598,6 +4706,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
return "";
}
@Override
@Transactional
public void updateAllPartnerPassword(String clientMoniker) {
@ -4639,7 +4748,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override
public String getGatewayShortLink(String clientMoniker, String channel) {
String longUrl = PlatformEnvironment.getEnv().concatUrl("/api/v1.0/"+channel+"/partners/" + clientMoniker + "/jump/pc");
String longUrl = PlatformEnvironment.getEnv().concatUrl("/api/v1.0/" + channel + "/partners/" + clientMoniker + "/jump/pc");
MpWechatApi api = mpWechatApiProvider.getNewPaymentApi();
return api.registerShortUrl(longUrl);
}
@ -4666,7 +4775,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
infoStr.append("ABN = " + riskInfo.getString("abn") + ",ACN = " + riskInfo.getString("acn") + ",contact_phone = " + riskInfo.getString("contact_phone") + ",contact_person = " + riskInfo.getString("contact_person") + ",bank_account_no = " + riskInfo.getString("bank_account_no"));
});
appendStr.deleteCharAt(appendStr.length() - 1);
throw new BadRequestException("该商户信息已经进入系统黑名单,关联商户为【" + appendStr.toString().toUpperCase() + "】【" + infoStr.toString() + "】");
throw new BadRequestException("该商户信息已经进入系统黑名单,关联商户为【" + appendStr.toString().toUpperCase() + "】【" + infoStr.toString() + "】");
}
}
@ -4735,6 +4844,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
return null;
}
@Override
@Transactional
public boolean postponeClientRate(int clientId, String clientMoniker, String nextYearExipryDate) {
@ -4854,7 +4964,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
}
String path = paymentConfig.getString("path");
path = path.replaceAll("app","pc");
path = path.replaceAll("app", "pc");
response.sendRedirect(String.format(PlatformEnvironment.getEnv().concatUrl(path), clientMoniker));
}
@ -4906,7 +5016,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
List<String> needNotifyUsers = royalPayUsers.stream().filter(user -> StringUtils.isNotEmpty(user.getString("wx_openid"))).map(user -> user.getString("wx_openid")).collect(Collectors.toList());
needNotifyUsers.forEach(userOpenId -> {
try {
String signStr = "?sign=" + AESencrypt(accounts.toString(),userOpenId);
String signStr = "?sign=" + AESencrypt(accounts.toString(), userOpenId);
MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi();
TemplateMessage msg = initSendTestPasswordTemplate(userOpenId, paymentApi.getTemplateId("test-merchant-password"), signStr.replace("+", "%2B"));
paymentApi.sendTemplateMessage(msg);

@ -654,6 +654,16 @@ public class PartnerManageController {
return clientManager.queryAlipayOnlineGmsStatus(clientMoniker, manager);
}
@ManagerMapping(value = "/{clientMoniker}/query/alipay_gms_json", method = RequestMethod.GET, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
public JSONObject queryAlipayGmsJson(@PathVariable String clientMoniker,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return clientManager.queryAlipayGmsJson(clientMoniker, manager);
}
@ManagerMapping(value = "/{clientMoniker}/query/alipayOnline_gms_json", method = RequestMethod.GET, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
public JSONObject queryAlipayOnlineGmsJson(@PathVariable String clientMoniker,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return clientManager.queryAlipayOnlineGmsJson(clientMoniker, manager);
}
@ManagerMapping(value = "/{clientMoniker}/get_merchant_ids",method = RequestMethod.GET,role = {ManagerRole.OPERATOR,ManagerRole.ADMIN})
public List<JSONObject> getMerchantIds(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return clientManager.listMerchantIds(clientMoniker,manager);

@ -79,7 +79,7 @@ public class RefundServiceImpl implements RefundService, ApplicationEventPublish
JSONObject client = clientMapper.findClient(account.getIntValue("client_id"));
////父商户全局管理子商户时候,跳过
JSONObject orderTargetClient = clientMapper.findClient(order.getIntValue("client_id"));
if (orderTargetClient.getIntValue("parent_client_id") != account.getIntValue("client_id")) {
if (orderTargetClient.getIntValue("parent_client_id") != account.getIntValue("client_id") && !clientManager.listLevel3Client(account.getIntValue("client_id")).contains(orderTargetClient.getIntValue("parent_client_id"))) {
throw new ForbiddenException("Order is not belong to your shop/merchant");
} else if (!client.getBooleanValue("sub_manage")) {
throw new ForbiddenException("Order is not belong to your shop/merchant");

@ -3,7 +3,8 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper">
<select id="query" resultType="com.alibaba.fastjson.JSONObject">
SELECT a.*,c.client_moniker client_moniker FROM sys_accounts a left join sys_clients c on c.client_id = a.client_id
SELECT a.*,c.client_moniker client_moniker FROM sys_accounts a left join sys_clients c on c.client_id =
a.client_id
<where>
<if test="clientId!=null">
and a.client_id = #{clientId}
@ -22,6 +23,9 @@
sa.wx_unionid,sa.wechat_headimg,sa.payment_notice,sa.refund_authorised,sa.display_name
FROM sys_clients sc
INNER JOIN sys_accounts sa ON sc.client_id = sa.client_id AND sa.is_valid = 1
WHERE sc.client_id = #{client_id} OR sc.parent_client_id = #{client_id} AND sc.is_valid = 1
WHERE sc.is_valid=1 AND
(sc.client_id IN (select client_id from sys_clients where client_id =#{client_id} or parent_client_id=#{client_id})
OR
sc.parent_client_id IN (select client_id from sys_clients where client_id =#{client_id} or parent_client_id=#{client_id}));
</select>
</mapper>

@ -20,6 +20,11 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts'], function (angul
var clientList = resp.data;
clientList.forEach(function (client) {
$scope.clients.push(client);
if (client.level3Clients) {
client.level3Clients.forEach(function (level3Client) {
$scope.clients.push(level3Client);
});
}
});
$scope.clients.forEach(function (client) {
$scope.params.client_ids.push(client.client_id);

@ -20,6 +20,11 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts'], function (angul
var clientList = resp.data;
clientList.forEach(function (client) {
$scope.clients.push(client);
if (client.level3Clients) {
client.level3Clients.forEach(function (level3Client) {
$scope.clients.push(level3Client);
});
}
});
$scope.clients.forEach(function (client) {
$scope.params.client_ids.push(client.client_id);

@ -59,6 +59,11 @@ define(['angular'], function (angular) {
var clientList = resp.data;
clientList.forEach(function (client) {
$scope.clients.push(client);
if (client.level3Clients) {
client.level3Clients.forEach(function (level3Client) {
$scope.clients.push(level3Client);
});
}
});
$scope.clients.forEach(function (client) {
$scope.params.client_ids.push(client.client_id);

@ -37,6 +37,7 @@ define(['../app', 'angular'], function (app, angular) {
title: cfg.title,
content: cfg.content,
contentHtml: cfg.contentHtml,
json:cfg.json,
backdrop: cfg.backdrop,
size: cfg.size,
choises: cfg.choises || choises
@ -121,6 +122,7 @@ define(['../app', 'angular'], function (app, angular) {
$scope.title = cfg.title;
$scope.content = cfg.content;
$scope.contentHtml = cfg.contentHtml;
$scope.jsonData = cfg.json;
$scope.bgClass = bgClasses[cfg.type];
$scope.glyIcon = glyIcons[cfg.type];
$scope.choises = cfg.choises;

@ -1,5 +1,8 @@
<div class="modal-header" ng-class="bgClass">
<h4><i class="glyphicon" ng-class="glyIcon"></i> {{title}}</h4>
<a role="button" class="text-bold text-info pull-right" jsonview="jsonData" title="JSON View" ng-if="jsonData">
<i class="fa fa-code"></i>
</a>
</div>
<div class="modal-body" ng-bind-html="contentHtml" ng-if="contentHtml">
</div>

@ -618,6 +618,11 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct
var clientList = resp.data;
clientList.forEach(function (client) {
$scope.clients.push(client);
if (client.level3Clients) {
client.level3Clients.forEach(function (level3Client) {
$scope.clients.push(level3Client);
});
}
});
$scope.clients.forEach(function (client) {
$scope.params.client_ids.push(client.client_id);

@ -22,6 +22,11 @@ define(['angular','decimal'], function (angular,decimal) {
var clientList = resp.data;
clientList.forEach(function (client) {
$scope.clients.push(client);
if (client.level3Clients) {
client.level3Clients.forEach(function (level3Client) {
$scope.clients.push(level3Client);
});
}
});
})
};

@ -106,6 +106,13 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
$scope.loadSubPartners = function () {
$http.get('/client/partner_info/sub_partners').then(function (resp) {
$scope.subPartners = resp.data;
$scope.subPartners.forEach(function (client) {
if (client.level3Clients) {
client.level3Clients.forEach(function (level3Client) {
$scope.subPartners.push(level3Client);
});
}
})
})
};
$scope.partner = partner.data;

@ -399,6 +399,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}
return arr;
}
$scope.loadOfflineDesc = function () {
$http.get('/static/data/client_offline_desc.json').then(function (resp) {
$scope.client_offline_select = resp.data;
@ -537,7 +538,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
alert("Logo is necessary!");
return;
}
if($scope.partner.partner_type == 'photo'){
if ($scope.partner.partner_type == 'photo') {
if (!$scope.partner.company_photo) {
alert('Shop Photo1 is necessary');
return;
@ -566,7 +567,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
// alert("Please Locate Merchant's Location");
// return;
// }
if ($scope.params.client_pay_type==''){
if ($scope.params.client_pay_type == '') {
alert('请选择商户支付场景')
}
@ -661,15 +662,15 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.isComplianceOfShortName = false;
$scope.isComplianceOfBusinessStructure = false;
var website = partner.data.company_website;
if (website!=null){
if (website.indexOf('http')!=0){
$scope.partner.company_website= 'http://'+angular.copy(website);
if (website != null) {
if (website.indexOf('http') != 0) {
$scope.partner.company_website = 'http://' + angular.copy(website);
}
}
$scope.decideCompliance = function (name) {
var keywords = ['education','financial' ,'train','immigrant','invest',
'律师咨询','会计事务所', '移民', '留学','娱乐','金融','地产','投资'];
for(var i = 0; i < keywords.length; i++){
var keywords = ['education', 'financial', 'train', 'immigrant', 'invest',
'律师咨询', '会计事务所', '移民', '留学', '娱乐', '金融', '地产', '投资'];
for (var i = 0; i < keywords.length; i++) {
if (name.indexOf(keywords[i]) != -1) {
return true;
}
@ -698,12 +699,12 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
};
$scope.showFile();
$scope.passClient = function () {
if(!$scope.partner.wechat_institution_merchant_id){
if (!$scope.partner.wechat_institution_merchant_id) {
commonDialog.alert({title: 'info', content: 'HF Institution Merchant Id not Refresh', type: 'info'});
return;
}
if ($scope.partner.enable_hf) {
if($scope.partner.hfindustry == null){
if ($scope.partner.hfindustry == null) {
alert("已开启HF支付通道HF行业不可为空!");
return;
}
@ -741,7 +742,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
info.push('Business Structure');
}
title = 'Warning';
contentHtml = $sce.trustAsHtml('本次提交的商户[' + $scope.partner.company_name + '],<span style="color: red">'+ info.toString() +'</span>存在微信渠道不合规信息');
contentHtml = $sce.trustAsHtml('本次提交的商户[' + $scope.partner.company_name + '],<span style="color: red">' + info.toString() + '</span>存在微信渠道不合规信息');
choises = [{label: '取消', className: 'btn-danger', key: '2', dismiss: true},
{label: '确认提交', className: 'btn-success', key: '1'}];
content = '';
@ -774,8 +775,12 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
});
};
$scope.pass2GreenChannel = function () {
if(!$scope.partner.wechat_institution_merchant_id){
commonDialog.alert({title: 'info', content: 'Wechat Institution Merchant Id not Refresh', type: 'info'});
if (!$scope.partner.wechat_institution_merchant_id) {
commonDialog.alert({
title: 'info',
content: 'Wechat Institution Merchant Id not Refresh',
type: 'info'
});
return;
}
commonDialog.confirm({
@ -830,7 +835,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
};
$scope.Export = function () {
var url = '/dev/' + $scope.partner.client_moniker +'/export/aggregate/agreepdf' ;
var url = '/dev/' + $scope.partner.client_moniker + '/export/aggregate/agreepdf';
return url;
}
$scope.uploadAgreeFile = function (file) {
@ -1080,7 +1085,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
if (!$scope.partner) {
return;
}
if(!$state.is('partners.detail')){
if (!$state.is('partners.detail')) {
$scope.init.wechat_compliance = false;
return;
}
@ -1102,7 +1107,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
if (!$scope.partner) {
return;
}
if(!$state.is('partners.detail')){
if (!$state.is('partners.detail')) {
$scope.init.local_merchant = false;
return;
}
@ -1246,7 +1251,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
alert('suburb can not contain two and more continuous space characters');
return;
}
if($scope.partner.partner_type == 'photo'){
if ($scope.partner.partner_type == 'photo') {
if (!$scope.partner.company_photo) {
alert('Shop Photo1 is necessary');
return;
@ -1284,7 +1289,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
// alert("Please Locate Merchant Location!");
// return;
// }
if ($scope.params.client_pay_type==''){
if ($scope.params.client_pay_type == '') {
alert('请选择商户支付场景')
}
$http.put('/sys/partners/' + $scope.partner.client_moniker, $scope.partner).then(function () {
@ -1390,34 +1395,34 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}
}
}]);
app.controller('partnerPaymentInfoCtrl', ['$scope', '$http', '$state', 'commonDialog','$uibModal', '$sce', function ($scope, $http, $state, commonDialog,$uibModal, $sce) {
$scope.copyHfLink = function() {
var e=document.getElementById("cpbt");
app.controller('partnerPaymentInfoCtrl', ['$scope', '$http', '$state', 'commonDialog', '$uibModal', '$sce', function ($scope, $http, $state, commonDialog, $uibModal, $sce) {
$scope.copyHfLink = function () {
var e = document.getElementById("cpbt");
e.select();
var successful = document.execCommand("Copy");
if (successful) {
commonDialog.alert({title: 'Success', content: '已复制到剪切板!', type: 'success'});
}else {
} else {
commonDialog.alert({title: 'Error', content: '您的浏览器不支持!', type: 'error'});
}
};
$scope.copyYeepayLink = function() {
var e=document.getElementById("cpyeepay");
$scope.copyYeepayLink = function () {
var e = document.getElementById("cpyeepay");
e.select();
var successful = document.execCommand("Copy");
if (successful) {
commonDialog.alert({title: 'Success', content: '已复制到剪切板!', type: 'success'});
}else {
} else {
commonDialog.alert({title: 'Error', content: '您的浏览器不支持!', type: 'error'});
}
};
$scope.copyCBBankPayLink = function() {
var e=document.getElementById("cpcbbankpay");
$scope.copyCBBankPayLink = function () {
var e = document.getElementById("cpcbbankpay");
e.select();
var successful = document.execCommand("Copy");
if (successful) {
commonDialog.alert({title: 'Success', content: '已复制到剪切板!', type: 'success'});
}else {
} else {
commonDialog.alert({title: 'Error', content: '您的浏览器不支持!', type: 'error'});
}
};
@ -1448,7 +1453,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
size: 'lg',
resolve: {
logs: ['$http', function ($http) {
return $http.get('/sys/partners/'+$scope.partner.client_moniker+'/get_sub_merchant_id_logs');
return $http.get('/sys/partners/' + $scope.partner.client_moniker + '/get_sub_merchant_id_logs');
}]
}
}).result.then(function () {
@ -1598,19 +1603,22 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
});
};
$scope.submitAlipaySubId = function () {
commonDialog.confirm({
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipay_gms_json').then(function (resp) {
$scope.alipay_gms_json = resp.data;
commonDialog.confirm({
title: 'Warning',
content: '是否使用该商户的现有信息进件?'
}).then(function () {
if ($scope.partner.business_structure == "Company"){
$http.post('/sys/partners/' + $scope.partner.client_moniker + '/register/alipay_gms',{representative_id:""}).then(function () {
content: '是否使用该商户的现有信息进件?',
json:$scope.alipay_gms_json
}).then(function () {
if ($scope.partner.business_structure == "Company") {
$http.post('/sys/partners/' + $scope.partner.client_moniker + '/register/alipay_gms', {representative_id: ""}).then(function () {
commonDialog.alert({title: 'Success', content: 'Alipay进件成功', type: 'success'});
}, function (resp) {
commonDialog.alert({title: 'Error', content: "进件失败:" + resp.data.message, type: 'error'});
})
}else {
} else {
commonDialog.inputText({title: '请输入商户身份证或护照号码'}).then(function (text) {
$http.post('/sys/partners/' + $scope.partner.client_moniker + '/register/alipay_gms',{representative_id:text}).then(function () {
$http.post('/sys/partners/' + $scope.partner.client_moniker + '/register/alipay_gms', {representative_id: text}).then(function () {
commonDialog.alert({title: 'Success', content: '提示Alipay进件成功', type: 'success'});
}, function (resp) {
commonDialog.alert({title: 'Error', content: "进件失败:" + resp.data.message, type: 'error'});
@ -1618,6 +1626,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
});
}
})
})
};
$scope.queryAlipayGms = function () {
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipay_gms').then(function (resp) {
@ -1627,19 +1636,23 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
})
}
$scope.submitAlipayOnlineSubId = function () {
commonDialog.confirm({
title: 'Warning',
content: '是否使用该商户的现有信息进件?'
}).then(function () {
commonDialog.inputText({title: '请输入商户身份证或护照号码'}).then(function (text) {
$http.post('/sys/partners/' + $scope.partner.client_moniker + '/register/alipayOnline_gms',{representative_id:text}).then(function () {
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipayOnline_gms_json').then(function (resp) {
$scope.alipayOnline_gms_json = resp.data;
commonDialog.confirm({
title: 'Warning',
content: '是否使用该商户的现有信息进件?',
json:$scope.alipayOnline_gms_json
}).then(function () {
commonDialog.inputText({title: '请输入商户身份证或护照号码'}).then(function (text) {
$http.post('/sys/partners/' + $scope.partner.client_moniker + '/register/alipayOnline_gms', {representative_id: text}).then(function () {
commonDialog.alert({title: 'Success', content: '提示AlipayOnline进件成功', type: 'success'});
}, function (resp) {
}, function (resp) {
commonDialog.alert({title: 'Error', content: "进件失败:" + resp.data.message, type: 'error'});
})
});
})
});
})
})
});
};
$scope.queryAlipayOnlineGms = function () {
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipayOnline_gms').then(function (resp) {
@ -1660,7 +1673,19 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
})
})
};
$scope.init = {jsapi: false, gateway: false, offline: false, refund: false,common_sub_merchant_id:false, channel: {},gateway_alipay_online:false,hf_Link:false,enable_hf_email_notice:false,enable_yeepay_link:false,enable_yeepay_email_notice:false};
$scope.init = {
jsapi: false,
gateway: false,
offline: false,
refund: false,
common_sub_merchant_id: false,
channel: {},
gateway_alipay_online: false,
hf_Link: false,
enable_hf_email_notice: false,
enable_yeepay_link: false,
enable_yeepay_email_notice: false
};
$scope.switchCommonSubMerchantId = function () {
if (!$scope.paymentInfo) {
return;
@ -1701,9 +1726,9 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
var info = [];
$scope.decideCompliance = function (name) {
var keywords = ['education','financial' ,'train','immigrant','invest',
'律师咨询','会计事务所', '移民', '留学','娱乐','金融','地产','投资'];
for(var i = 0; i < keywords.length; i++){
var keywords = ['education', 'financial', 'train', 'immigrant', 'invest',
'律师咨询', '会计事务所', '移民', '留学', '娱乐', '金融', '地产', '投资'];
for (var i = 0; i < keywords.length; i++) {
if (name.indexOf(keywords[i]) != -1) {
return true;
}
@ -1712,17 +1737,17 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
};
$scope.getComplianceInfo = function () {
if ($scope.paymentInfo.company_name != null) {
if($scope.decideCompliance($scope.paymentInfo.company_name)) {
if ($scope.decideCompliance($scope.paymentInfo.company_name)) {
info.push('Company Name');
}
}
if ($scope.paymentInfo.short_name != null) {
if($scope.decideCompliance($scope.paymentInfo.short_name)) {
info.push('Short Name');
if ($scope.decideCompliance($scope.paymentInfo.short_name)) {
info.push('Short Name');
}
}
if ($scope.paymentInfo.business_structure != null) {
if($scope.decideCompliance($scope.paymentInfo.business_structure)) {
if ($scope.decideCompliance($scope.paymentInfo.business_structure)) {
info.push('Business Structure');
}
}
@ -1743,7 +1768,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
&& $scope.paymentInfo.open_status == 5 && info.length > 0) {
commonDialog.confirm({
title: "Warning",
contentHtml: $sce.trustAsHtml('本次提交的商户[' + $scope.partner.company_name + '],<span style="color: red">'+ info.toString() +'</span>存在微信渠道不合规信息')
contentHtml: $sce.trustAsHtml('本次提交的商户[' + $scope.partner.company_name + '],<span style="color: red">' + info.toString() + '</span>存在微信渠道不合规信息')
}).then(function () {
$scope.saveChannel(channel);
})
@ -1792,16 +1817,16 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
if (!$scope.paymentInfo) {
return;
}
var channelLink = 'enable_'+channel+'_link';
var channelLink = 'enable_' + channel + '_link';
if (!$scope.init[channelLink]) {
$scope.init[channelLink] = true;
return;
}
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/'+channel, {allow: $scope.paymentInfo[channelLink]}).then(function () {
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/' + channel, {allow: $scope.paymentInfo[channelLink]}).then(function () {
$scope.loadPartnerPaymentInfo();
}, function (resp) {
commonDialog.alert({
title: 'Failed to change '+channelLink+' permission status',
title: 'Failed to change ' + channelLink + ' permission status',
content: resp.data.message,
type: 'error'
});
@ -1844,7 +1869,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
title: 'Confirm',
content: content
}).then(function () {
$http.put('/sys/partners/'+ $scope.partner.client_moniker + '/cb_bankpay/'+ key +'/channel_id', {channel_id: channel}).then(function (resp) {
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/cb_bankpay/' + key + '/channel_id', {channel_id: channel}).then(function (resp) {
commonDialog.alert({type: 'success', title: 'Success', content: '修改成功'});
$scope.loadPartnerPaymentInfo();
}, function (resp) {
@ -1857,16 +1882,16 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
if (!$scope.paymentInfo) {
return;
}
var channelNotice = 'enable_'+channel+'_email_notice';
var channelNotice = 'enable_' + channel + '_email_notice';
if (!$scope.init[channelNotice]) {
$scope.init[channelNotice] = true;
return;
}
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/'+channel+'/email_notice', {allow: $scope.paymentInfo[channelNotice]}).then(function () {
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/' + channel + '/email_notice', {allow: $scope.paymentInfo[channelNotice]}).then(function () {
$scope.loadPartnerPaymentInfo();
}, function (resp) {
commonDialog.alert({
title: 'Failed to change '+channelNotice+' permission status',
title: 'Failed to change ' + channelNotice + ' permission status',
content: resp.data.message,
type: 'error'
});
@ -2090,9 +2115,10 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}]);
app.controller('clientSubMerchantIdLogCtrl', ['$scope', '$http', 'logs', function ($scope, $http, logs) {
$scope.logs = logs.data;
$scope.logs = logs.data;
}]);
app.controller('partnerSubCtrl', ['$scope', '$http', '$uibModal', function ($scope, $http, $uibModal) {
$scope.toShow = false;
$scope.newSubClient = function () {
$uibModal.open({
templateUrl: '/static/payment/partner/templates/add_sub_partner_dialog.html',
@ -2142,11 +2168,24 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
})
};
$scope.showClient = function (sub_client) {
if ($scope.sub_client_id == sub_client.client_id) {
return;
}
$scope.client_monikers = sub_client.level3Clients;
$scope.sub_client_id = sub_client.client_id;
};
}]);
app.controller('partnerRatesCtrl', ['$scope', '$rootScope', '$http', '$uibModal', 'commonDialog','$sce', function ($scope, $rootScope, $http, $uibModal, commonDialog,$sce) {
app.controller('partnerRatesCtrl', ['$scope', '$rootScope', '$http', '$uibModal', 'commonDialog', '$sce', function ($scope, $rootScope, $http, $uibModal, commonDialog, $sce) {
$scope.bankCtrl = {edit: true, rate_name: 'Wechat'};
$scope.init = {skip_clearing:false,tax_in_surcharge:false,customer_tax_free:false,allow_surcharge_credit:false};
$scope.init = {
skip_clearing: false,
tax_in_surcharge: false,
customer_tax_free: false,
allow_surcharge_credit: false
};
$scope.getBankAccount = function () {
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/bank_account').then(function (resp) {
$scope.bankaccount = resp.data;
@ -2159,7 +2198,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
title: 'Warning',
content: '启用收支分离模式清算将使消费者支付手续费模式失效,请确认是否切换?'
}).then(function () {
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/surcharge_mode', {surcharge_mode:'distributed'}).then(function () {
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/surcharge_mode', {surcharge_mode: 'distributed'}).then(function () {
commonDialog.alert({title: 'Success', content: '已切换为收支分离模式', type: 'success'});
$scope.partner.surcharge_mode = 'distributed';
$scope.getBalance();
@ -2167,12 +2206,12 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
})
})
}else {
} else {
commonDialog.confirm({
title: 'Warning',
content: '请确认是否切换成净值清算模式?'
}).then(function () {
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/surcharge_mode', {surcharge_mode:'balance'}).then(function () {
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/surcharge_mode', {surcharge_mode: 'balance'}).then(function () {
commonDialog.alert({title: 'Success', content: '已切换为净值清算模式', type: 'success'});
$scope.partner.surcharge_mode = 'balance';
}, function (resp) {
@ -2213,7 +2252,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
if (!skipClearing) {
commonDialog.confirm({
title: 'Warning',
content: 'This operation will switch skip clearing status. Are you sure?'
content: 'This operation will switch skip clearing status. Are you sure?'
}).then(function () {
commonDialog.inputText({title: '请输入关闭跳过清算的原因'}).then(function (text) {
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/skip_clearing', {
@ -2224,7 +2263,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
});
});
})
}else{
} else {
commonDialog.confirm({
title: 'Warning',
content: 'This operation will switch skip clearing status. Are you sure?',
@ -2317,10 +2356,11 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
};
$scope.getRates();
$scope.saveBankAccount = function () {
if(isNaN($scope.bankaccount.account_no)){
if (isNaN($scope.bankaccount.account_no)) {
alert("Account No应输入数字!");
return;
};
}
;
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/bank_account', $scope.bankaccount).then(function () {
$scope.getBankAccount();
}, function (resp) {
@ -2380,7 +2420,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
};
$scope.complianceChangeCheck();
}]);
app.controller('surchargeAccountDetailCtrl', ['$scope','$http','balance','partner','transactions','commonDialog', function ($scope, $http, balance, partner, transactions,commonDialog) {
app.controller('surchargeAccountDetailCtrl', ['$scope', '$http', 'balance', 'partner', 'transactions', 'commonDialog', function ($scope, $http, balance, partner, transactions, commonDialog) {
$scope.surcharge = angular.copy(balance);
$scope.transactions = angular.copy(transactions.data);
$scope.partner = angular.copy(partner);
@ -2412,7 +2452,10 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.params = {};
}
$scope.save = function () {
$http.post('/sys/partners/' + $scope.partner.client_moniker + '/account/save', {amount:$scope.params.amount,remark:$scope.params.remark}).then(function (resp) {
$http.post('/sys/partners/' + $scope.partner.client_moniker + '/account/save', {
amount: $scope.params.amount,
remark: $scope.params.remark
}).then(function (resp) {
$scope.getTransactions();
$scope.getBalance();
$scope.canAddDetail = false;
@ -2751,7 +2794,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
alert("Logo is necessary!");
return;
}
if($scope.partner.partner_type == 'photo'){
if ($scope.partner.partner_type == 'photo') {
if (!$scope.partner.company_photo) {
alert('Shop Photo1 is necessary');
return;
@ -2765,7 +2808,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
// alert("Please Locate Merchant Location!");
// return;
// }
if ($scope.partner.client_pay_type==''){
if ($scope.partner.client_pay_type == '') {
alert('请选择商户支付场景')
}
$http.post('/sys/partners/' + clientMoniker + '/sub_clients', $scope.partner).then(function () {
@ -2853,7 +2896,9 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.params = {status: 'PAID', channel: 'ALL', textType: 'all', datefrom: new Date(), dateto: new Date()};
$scope.pagination = {};
$scope.isAll = true;
$scope.isLevel3All = true;
$scope.clients = [$scope.partner];
$scope.showLevel3Clients = false;
$scope.today = new Date();
$scope.chooseToday = function () {
@ -2926,15 +2971,41 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.$on('order_refunded', function () {
$scope.loadTradeLogs();
});
$scope.chooseClient = function (clientId) {
if (clientId == 'all') {
$scope.chooseClient = function (client) {
if (client == 'all') {
$scope.params.client_ids = angular.copy($scope.clientIds);
$scope.isAll = true;
$scope.chooseClientId = '';
$scope.showLevel3Clients = false;
} else if (client.level3Clients) {
$scope.chooseClientId = client.client_id;
$scope.showLevel3Clients = true;
$scope.level3Clients = client.level3Clients;
$scope.isAll = false;
$scope.level3ClientIds = [];
$scope.level3ClientIds.push(client.client_id);
client.level3Clients.forEach(function (client) {
$scope.level3ClientIds.push(client.client_id);
});
$scope.chooseLevel3Client("all");
return;
} else {
$scope.chooseClientId = clientId;
$scope.params.client_ids = [clientId];
$scope.chooseClientId = client.client_id;
$scope.params.client_ids = [client.client_id];
$scope.isAll = false;
$scope.showLevel3Clients = false;
}
$scope.loadTradeLogs();
};
$scope.chooseLevel3Client = function (client) {
if (client == 'all') {
$scope.params.client_ids = angular.copy($scope.level3ClientIds);
$scope.isLevel3All = true;
$scope.chooseLevel3ClientId = '';
} else {
$scope.chooseLevel3ClientId = client.client_id;
$scope.params.client_ids = [client.client_id];
$scope.isLevel3All = false;
}
$scope.loadTradeLogs();
};
@ -2947,6 +3018,11 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.clientIds = [];
$scope.clients.forEach(function (client) {
$scope.clientIds.push(client.client_id);
if (client.level3Clients) {
client.level3Clients.forEach(function (level3Client) {
$scope.clientIds.push(level3Client.client_id);
});
}
});
$scope.params.client_ids = angular.copy($scope.clientIds);
//console.log($rootScope.currentUser.client.clientList);
@ -2985,9 +3061,9 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
})
}
}]);
app.controller('partnerDeviceCtrl', ['$scope', '$http', 'orderService', 'commonDialog', 'refunder','$uibModal', function ($scope,$http, orderService, commonDialog, refunder,$uibModal) {
app.controller('partnerDeviceCtrl', ['$scope', '$http', 'orderService', 'commonDialog', 'refunder', '$uibModal', function ($scope, $http, orderService, commonDialog, refunder, $uibModal) {
$scope.pagination = {};
$scope.pagination = {};
/**
* 查看设备
* @param page
@ -3155,7 +3231,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}
}]);
app.controller('newDeviceDialogCtrl', ['$scope', '$http', 'clientMoniker', function ($scope, $http,clientMoniker) {
app.controller('newDeviceDialogCtrl', ['$scope', '$http', 'clientMoniker', function ($scope, $http, clientMoniker) {
$scope.save = function (form) {
$scope.errmsg = null;
if (form.$invalid) {
@ -3247,11 +3323,9 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
if ($scope.data.users.length == 0) {
$scope.errmsg = "请选择至少一位BD";
}
else if ($scope.data.start_date == undefined) {
} else if ($scope.data.start_date == undefined) {
$scope.errmsg = "执行开始日期不能为空";
}
else {
} else {
var isValid = true;
var total = 0;
$scope.data.users.forEach(function (e) {
@ -3591,7 +3665,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
detail: ['$http', '$stateParams', function ($http) {
return $http.get('/analysis/partner_card/' + client_id + '/settlement_logs/' + detail_id);
}],
detail_id:detail_id
detail_id: detail_id
},
size: 'lg'
});
@ -3659,7 +3733,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
detail: ['$http', '$stateParams', function ($http) {
return $http.get('/analysis/partner_card/' + client_id + '/settlement_logs/' + detail_id);
}],
detail_id:detail_id
detail_id: detail_id
},
size: 'lg'
});
@ -3667,17 +3741,17 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.chooseLast7Days();
}]);
app.controller('managerSettlementDetailCtrl', ['$scope', 'detail','detail_id','$http', function ($scope, detail,detail_id,$http) {
app.controller('managerSettlementDetailCtrl', ['$scope', 'detail', 'detail_id', '$http', function ($scope, detail, detail_id, $http) {
$scope.ctrl = {channel: null};
$scope.show = true;
$scope.report = detail.data;
$scope.report.total_charge = Decimal.add($scope.report.total_charge,$scope.report.tax_amount).toFixed(2);
angular.forEach($scope.report.channels,function (e) {
e.total_charge = Decimal.add(e.tax_amount,e.total_charge).toFixed(2);
$scope.report.total_charge = Decimal.add($scope.report.total_charge, $scope.report.tax_amount).toFixed(2);
angular.forEach($scope.report.channels, function (e) {
e.total_charge = Decimal.add(e.tax_amount, e.total_charge).toFixed(2);
});
$scope.channelAndDayOfAnalysis = function () {
$http.get('/analysis/partner_card/settlement_logs/' + detail_id+'/analysis/'+$scope.ctrl.channel).then(function (resp) {
$http.get('/analysis/partner_card/settlement_logs/' + detail_id + '/analysis/' + $scope.ctrl.channel).then(function (resp) {
$scope.channelAndDayMap = resp.data;
$scope.index = 0;
})
@ -3969,7 +4043,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}
}]);
app.controller('applyRpaySubMerchantIdCtrl', ['$scope', '$http', '$uibModal', '$state', 'subMerchantInfo', 'businessStructuresMap','$filter', 'commonDialog','timezone', function ($scope, $http, $uibModal, $state, subMerchantInfo, businessStructuresMap,$filter, commonDialog,timezone) {
app.controller('applyRpaySubMerchantIdCtrl', ['$scope', '$http', '$uibModal', '$state', 'subMerchantInfo', 'businessStructuresMap', '$filter', 'commonDialog', 'timezone', function ($scope, $http, $uibModal, $state, subMerchantInfo, businessStructuresMap, $filter, commonDialog, timezone) {
$scope.subMerchantInfo = angular.copy(subMerchantInfo);
$scope.business_structures = businessStructuresMap.configs();
$scope.timezone = timezone.configs();
@ -3977,7 +4051,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.saveRpayAppliy = function (form) {
var merchantInfo = {};
$scope.errmsg = null;
$scope.errmsg = null;
if (form.$invalid) {
angular.forEach(form, function (item, key) {
if (key.indexOf('$') < 0) {
@ -3986,13 +4060,13 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
});
return;
}
angular.forEach(form, function (item, key) {
if(item !=null) {
if(item.$name !=null) {
merchantInfo[key] = item.$modelValue;
}
}
});
angular.forEach(form, function (item, key) {
if (item != null) {
if (item.$name != null) {
merchantInfo[key] = item.$modelValue;
}
}
});
$http.post('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/registRpaySubMerchantId', merchantInfo).then(function (resp) {
$scope.apply_sub_merchant_id = resp.data;
@ -4015,17 +4089,17 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}
}]);
app.controller('applyYeepaySubMerchantIdCtrl', ['$scope', '$http', '$uibModal', '$state','subMerchantInfo','yeepayIndustryMap','yeepayBusinessContentMap','$filter', 'commonDialog','Upload', function ($scope, $http, $uibModal, $state,subMerchantInfo,yeepayIndustryMap,yeepayBusinessContentMap,$filter, commonDialog,Upload) {
app.controller('applyYeepaySubMerchantIdCtrl', ['$scope', '$http', '$uibModal', '$state', 'subMerchantInfo', 'yeepayIndustryMap', 'yeepayBusinessContentMap', '$filter', 'commonDialog', 'Upload', function ($scope, $http, $uibModal, $state, subMerchantInfo, yeepayIndustryMap, yeepayBusinessContentMap, $filter, commonDialog, Upload) {
$scope.yeepay_industries = yeepayIndustryMap.configs();
$scope.yeepay_business_contents = yeepayBusinessContentMap.configs();
$scope.subMerchantInfo = angular.copy(subMerchantInfo);
if(!$scope.subMerchantInfo.abn){
if (!$scope.subMerchantInfo.abn) {
$scope.subMerchantInfo.abn = $scope.subMerchantInfo.acn;
}
var vouchers={};
var vouchers = {};
$scope.directors={};
$scope.executives={};
$scope.directors = {};
$scope.executives = {};
$scope.industry = '';
$scope.business_content = '';
var merchantInfo = {};
@ -4332,7 +4406,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}
}]);
app.controller('addYeepaySubMerchantIdCtrl', ['$scope', '$http', '$uibModal', '$state','subMerchantInfo','yeepayIndustryMap','yeepayBusinessContentMap','$filter', 'commonDialog','Upload', function ($scope, $http, $uibModal, $state,subMerchantInfo,yeepayIndustryMap,yeepayBusinessContentMap,$filter, commonDialog,Upload) {
app.controller('addYeepaySubMerchantIdCtrl', ['$scope', '$http', '$uibModal', '$state', 'subMerchantInfo', 'yeepayIndustryMap', 'yeepayBusinessContentMap', '$filter', 'commonDialog', 'Upload', function ($scope, $http, $uibModal, $state, subMerchantInfo, yeepayIndustryMap, yeepayBusinessContentMap, $filter, commonDialog, Upload) {
$scope.yeepay_industries = yeepayIndustryMap.configs();
$scope.yeepay_business_contents = yeepayBusinessContentMap.configs();
$scope.subMerchantInfo = angular.copy(subMerchantInfo);
@ -4340,7 +4414,6 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
var merchantInfo = {};
$scope.saveYeepayAdd = function (form) {
$scope.errmsg = null;
if (form.$invalid) {
@ -4380,17 +4453,17 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}
}]);
app.controller('updateYeepaySubMerchantIdCtrl', ['$scope', '$http', '$uibModal', '$state','subMerchantInfo','yeepayIndustryMap','yeepayBusinessContentMap','$filter', 'commonDialog','Upload','subMerchantId', function ($scope, $http, $uibModal, $state,subMerchantInfo,yeepayIndustryMap,yeepayBusinessContentMap,$filter, commonDialog,Upload,subMerchantId) {
app.controller('updateYeepaySubMerchantIdCtrl', ['$scope', '$http', '$uibModal', '$state', 'subMerchantInfo', 'yeepayIndustryMap', 'yeepayBusinessContentMap', '$filter', 'commonDialog', 'Upload', 'subMerchantId', function ($scope, $http, $uibModal, $state, subMerchantInfo, yeepayIndustryMap, yeepayBusinessContentMap, $filter, commonDialog, Upload, subMerchantId) {
$scope.yeepay_industries = yeepayIndustryMap.configs();
$scope.yeepay_business_contents = yeepayBusinessContentMap.configs();
$scope.subMerchantInfo = angular.copy(subMerchantInfo);
if(!$scope.subMerchantInfo.abn){
if (!$scope.subMerchantInfo.abn) {
$scope.subMerchantInfo.abn = $scope.subMerchantInfo.acn;
}
var vouchers={};
var vouchers = {};
$scope.directors={};
$scope.executives={};
$scope.directors = {};
$scope.executives = {};
$scope.industry = '';
$scope.business_content = '';
var merchantInfo = {};
@ -4700,10 +4773,10 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
app.controller('permissionClientCtrl', ['$scope', '$http', '$uibModal', '$state', '$filter', 'commonDialog', function ($scope, $http, $uibModal, $state, $filter, commonDialog) {
$scope.clientPermission = {client_moniker:$scope.partner.client_moniker};
$scope.clientPermission = {client_moniker: $scope.partner.client_moniker};
$scope.loadPermissionList = function () {
var params = angular.copy($scope.clientPermission);
$http.get('/sys/permission/list',{params:params}).then(function (resp) {
$http.get('/sys/permission/list', {params: params}).then(function (resp) {
$scope.permissionList = resp.data;
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
@ -4713,16 +4786,16 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.switchValid = function (permission) {
$scope.clientPermission.isValid = permission.is_valid;
var params = angular.copy($scope.clientPermission);
$http.post('/sys/permission/'+permission.id,params).then(function (resp) {
},function (resp) {
$http.post('/sys/permission/' + permission.id, params).then(function (resp) {
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
})
};
$scope.init = function () {
var params = {client_moniker:$scope.partner.client_moniker};
$http.post('/sys/permission/init',params).then(function (resp) {
},function (resp) {
var params = {client_moniker: $scope.partner.client_moniker};
$http.post('/sys/permission/init', params).then(function (resp) {
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
})
};

@ -48,7 +48,12 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload','uiBoot
}).state('sub_partners', {
url: '/sub_partners',
templateUrl: '/static/payment/partner/templates/client_sub_partners.html',
controller: 'clientSubPartnersCtrl'
controller: 'clientSubPartnersCtrl',
resolve: {
partner: ['$http', function ($http) {
return $http.get('/client/partner_info');
}]
}
}).state('devices', {
url: '/devices',
templateUrl: '/static/payment/partner/templates/client_devices.html',
@ -968,10 +973,18 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload','uiBoot
};
$scope.getRates();
}]);
app.controller('clientSubPartnersCtrl', ['$scope', '$http', function ($scope, $http) {
app.controller('clientSubPartnersCtrl', ['$scope', '$http','partner', function ($scope, $http,partner) {
$scope.partner = partner.data;
$scope.loadSubPartners = function () {
$http.get('/client/partner_info/sub_partners').then(function (resp) {
$scope.subPartners = resp.data;
$scope.subPartners.forEach(function (client) {
if (client.level3Clients) {
client.level3Clients.forEach(function (level3Client) {
$scope.subPartners.push(level3Client);
});
}
})
})
};
$scope.loadSubPartners();

@ -22,7 +22,11 @@
</thead>
<tbody>
<tr ng-repeat="subPartner in subPartners">
<td ng-bind="subPartner.client_moniker"></td>
<td>
{{subPartner.client_moniker}}
<i class="fa fa-sitemap" ng-if="subPartner.parent_client_id != partner.client_id"
title="{{subPartner.parent_client_moniker}}"></i>
</td>
<td ng-bind="subPartner.short_name"></td>
<td ng-bind="subPartner.address"></td>
<td>{{subPartner.contact_person}}({{subPartner.contact_phone}})</td>

@ -146,7 +146,20 @@
<a role="button" ng-class="{'bg-primary':isAll}" ng-click="chooseClient('all')">All</a>
<label ng-repeat="sub in clients">
|&nbsp;<a role="button" ng-class="{'bg-primary':sub.client_id==chooseClientId}"
ng-click="chooseClient(sub.client_id)">{{sub.short_name}}</a>&nbsp;
ng-click="chooseClient(sub)">{{sub.short_name}}</a>&nbsp;
</label>
</p>
</div>
</div>
<div class="form-group col-xs-12" ng-if="level3Clients && showLevel3Clients">
<label class="control-label col-xs-4 col-sm-2">Sub-Partner of sub-partners</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':isLevel3All}" ng-click="chooseLevel3Client('all')">All</a>
<label ng-repeat="sub in level3Clients">
|&nbsp;
<a role="button" ng-class="{'bg-primary':sub.client_id==chooseLevel3ClientId}" ng-click="chooseLevel3Client(sub)">{{sub.short_name}}</a>
&nbsp;
</label>
</p>
</div>

@ -1,3 +1,54 @@
<style>
.cursor {
cursor: pointer;
}
.div-display {
display: none;
}
.i-rotate_90 {
animation: rotate_90 1s forwards;
-webkit-animation: rotate_90 1s forwards; /* Safari and Chrome */
}
@keyframes rotate_90 {
from {
transform: rotate(0deg);
}
to {
transform: rotate(90deg);
}
}
@-webkit-keyframes rotate_90 /* Safari and Chrome */
{
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(90deg);
}
}
.popover-color{
background-color: #f7f7f7;
border-bottom: 1px solid #ebebeb;
color: black;
}
.popover-content button{
display: inline-block;
}
.position_re{
position: relative;
}
.position_re .position_ab{
position: absolute;
top: 90%;
left: 90%;
}
</style>
<div class="panel panel-default" ng-if="'111'|withRole">
<div class="panel-body pull-right" ng-if="('10'|withRole) && partner.parent_client_id==null">
@ -29,7 +80,35 @@
</thead>
<tbody>
<tr ng-repeat="subPartner in subPartners">
<td ng-bind="subPartner.client_moniker"></td>
<td ng-click="showClient(subPartner); toShow = !toShow" style="cursor:pointer">
{{subPartner.client_moniker}}
&nbsp;
<span class="badge pull-right position_re" ng-if="subPartner.level3Clients">
{{subPartner.level3Clients.length}}
<div ng-if="sub_client_id==subPartner.client_id&&toShow"
class="popover fade in position_ab"
role="tooltip" style="display: block;">
<div class="arrow"></div>
<h3 class="popover-title popover-color">Sub Clients</h3>
<div class="popover-content" style="width: 250px">
<button type="button" class="btn btn-link"
ng-repeat="client_moniker in client_monikers"
ng-show="$index<client_monikers.length-1"
ui-sref="partners.detail({clientMoniker:client_moniker.client_moniker})">
{{client_moniker.client_moniker}}
<span class="text-black">,</span>&nbsp;
</button>
<button type="button" class="btn btn-link"
ng-repeat="client_moniker in client_monikers"
ng-if="$last"
ui-sref="partners.detail({clientMoniker:client_moniker.client_moniker})">
{{client_moniker.client_moniker}}
</button>
</div>
</div>
</span>
</td>
<td ng-bind="subPartner.short_name"></td>
<td ng-bind="subPartner.address"></td>
<td>{{subPartner.contact_person}}({{subPartner.contact_phone}})</td>

@ -23,6 +23,9 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
'</div>');
$scope.isAll = true;
$scope.clients = [$scope.currentUser.client];
$scope.showLevel3Clients = false;
$scope.isLevel3All = true;
if ($scope.currentUser.client.has_children) {
$scope.params.client_ids = [$scope.currentUser.client.client_id];
$http.get('/client/partner_info/sub_partners').then(function (resp) {
@ -33,6 +36,11 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
$scope.clientIds = [];
$scope.clients.forEach(function (client) {
$scope.clientIds.push(client.client_id);
if (client.level3Clients) {
client.level3Clients.forEach(function (level3Client) {
$scope.clientIds.push(level3Client.client_id);
});
}
});
$scope.params.client_ids = angular.copy($scope.clientIds);
$scope.loadSettlementLogs(1);
@ -125,15 +133,42 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
};
getClientUnClearedAmount();
$scope.chooseClient = function (clientId) {
if (clientId == 'all') {
$scope.chooseClient = function (client) {
if (client == 'all') {
$scope.params.client_ids = angular.copy($scope.clientIds);
$scope.isAll = true;
$scope.chooseClientId = '';
$scope.showLevel3Clients = false;
} else if (client.level3Clients) {
$scope.chooseClientId = client.client_id;
$scope.showLevel3Clients = true;
$scope.level3Clients = client.level3Clients;
$scope.isAll = false;
$scope.level3ClientIds = [];
$scope.level3ClientIds.push(client.client_id);
client.level3Clients.forEach(function (client) {
$scope.level3ClientIds.push(client.client_id);
});
$scope.chooseLevel3Client("all");
return;
} else {
$scope.chooseClientId = clientId;
$scope.params.client_ids = [clientId];
$scope.chooseClientId = client.client_id;
$scope.params.client_ids = [client.client_id];
$scope.isAll = false;
$scope.showLevel3Clients = false;
}
$scope.loadSettlementLogs();
};
$scope.chooseLevel3Client = function (client) {
if (client == 'all') {
$scope.params.client_ids = angular.copy($scope.level3ClientIds);
$scope.isLevel3All = true;
$scope.chooseLevel3ClientId = '';
} else {
$scope.chooseLevel3ClientId = client.client_id;
$scope.params.client_ids = [client.client_id];
$scope.isLevel3All = false;
}
$scope.loadSettlementLogs();
};

@ -170,7 +170,20 @@
<label ng-repeat="sub in clients">
|&nbsp;<a role="button"
ng-class="{'bg-primary':sub.client_id==chooseClientId}"
ng-click="chooseClient(sub.client_id)">{{sub.short_name}}</a>&nbsp;
ng-click="chooseClient(sub)">{{sub.short_name}}</a>&nbsp;
</label>
</p>
</div>
</div>
<div class="form-group col-xs-12" ng-if="level3Clients && showLevel3Clients">
<label class="control-label col-xs-4 col-sm-2">Sub-Partner of sub-partners</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':isLevel3All}" ng-click="chooseLevel3Client('all')">All</a>
<label ng-repeat="sub in level3Clients">
|&nbsp;
<a role="button" ng-class="{'bg-primary':sub.client_id==chooseLevel3ClientId}" ng-click="chooseLevel3Client(sub)">{{sub.short_name}}</a>
&nbsp;
</label>
</p>
</div>

@ -80,7 +80,20 @@
<label ng-repeat="sub in clients">
|&nbsp;<a role="button"
ng-class="{'bg-primary':sub.client_id==chooseClientId}"
ng-click="chooseClient(sub.client_id)">{{sub.short_name}}</a>&nbsp;
ng-click="chooseClient(sub)">{{sub.short_name}}</a>&nbsp;
</label>
</p>
</div>
</div>
<div class="form-group col-xs-12" ng-if="level3Clients && showLevel3Clients">
<label class="control-label col-xs-4 col-sm-2">Sub-Partner of sub-partners</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':isLevel3All}" ng-click="chooseLevel3Client('all')">All</a>
<label ng-repeat="sub in level3Clients">
|&nbsp;
<a role="button" ng-class="{'bg-primary':sub.client_id==chooseLevel3ClientId}" ng-click="chooseLevel3Client(sub)">{{sub.short_name}}</a>
&nbsp;
</label>
</p>
</div>

@ -1,5 +1,53 @@
<style>
.box-icon_small{
.cursor {
cursor: pointer;
}
.div-display {
display: none;
}
.i-rotate_90 {
animation: rotate_90 1s forwards;
-webkit-animation: rotate_90 1s forwards; /* Safari and Chrome */
}
@keyframes rotate_90 {
from {
transform: rotate(0deg);
}
to {
transform: rotate(90deg);
}
}
@-webkit-keyframes rotate_90 /* Safari and Chrome */
{
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(90deg);
}
}
.popover-color{
background-color: #f7f7f7;
border-bottom: 1px solid #ebebeb;
color: black;
}
.popover-content button{
display: inline-block;
}
.position_re{
position: relative;
}
.position_re .position_ab{
position: absolute;
top: 90%;
left: 90%;
}
.box-icon_small{
width: 70px;
height: 70px;
font-size: 30px;
@ -189,11 +237,26 @@
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':isAll}" ng-click="chooseClient('all')">All</a>
<label ng-repeat="sub in clients">
|&nbsp;<a role="button" ng-class="{'bg-primary':sub.client_id==chooseClientId}" ng-click="chooseClient(sub.client_id)">{{sub.short_name}}</a>&nbsp;
|&nbsp;
<a role="button" ng-class="{'bg-primary':sub.client_id==chooseClientId}" ng-click="chooseClient(sub)">{{sub.short_name}}</a>
&nbsp;
</label>
</p>
</div>
</div>
<div class="form-group col-xs-12" ng-if="level3Clients && showLevel3Clients">
<label class="control-label col-xs-4 col-sm-2">Sub-Partner of sub-partners</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':isLevel3All}" ng-click="chooseLevel3Client('all')">All</a>
<label ng-repeat="sub in level3Clients">
|&nbsp;
<a role="button" ng-class="{'bg-primary':sub.client_id==chooseLevel3ClientId}" ng-click="chooseLevel3Client(sub)">{{sub.short_name}}</a>
&nbsp;
</label>
</p>
</div>
</div>
<div class="form-group col-xs-12" ng-if="devices.length">
<label class="control-label col-xs-4 col-sm-2">Devices</label>
<div class="col-sm-10 col-xs-8">

@ -18,9 +18,12 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
$scope.pagination = {};
$scope.today = new Date();
$scope.isAll = true;
$scope.isLevel3All = true;
$scope.device_isAll = true;
$scope.dev_params = {client_type:'sunmi',limit:100};
$scope.clients = [$scope.currentUser.client];
$scope.showLevel3Clients = false;
$scope.chooseToday = function () {
$scope.params.datefrom = $scope.params.dateto = new Date();
@ -109,23 +112,54 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
}, 10000);
$scope.loadTradeLogs();
});
$scope.chooseClient = function (clientId) {
if (clientId == 'all') {
$scope.chooseClient = function (client) {
if (client == 'all') {
$scope.params.client_ids = angular.copy($scope.clientIds);
$scope.isAll = true;
$scope.chooseClientId = '';
$scope.dev_params.client_ids = angular.copy($scope.clientIds);
$scope.showLevel3Clients = false;
$scope.listDevices();
} else if (client.level3Clients) {
$scope.chooseClientId = client.client_id;
$scope.showLevel3Clients = true;
$scope.level3Clients = client.level3Clients;
$scope.isAll = false;
$scope.level3ClientIds = [];
$scope.level3ClientIds.push(client.client_id);
client.level3Clients.forEach(function (client) {
$scope.level3ClientIds.push(client.client_id);
});
$scope.chooseLevel3Client("all");
return;
} else {
$scope.chooseClientId = clientId;
$scope.params.client_ids = [clientId];
$scope.chooseClientId = client.client_id;
$scope.params.client_ids = [client.client_id];
$scope.isAll = false;
$scope.dev_params.client_ids = [clientId];
$scope.dev_params.client_ids = [client.client_id];
$scope.showLevel3Clients = false;
$scope.listDevices();
}
$scope.loadTradeLogs();
};
$scope.chooseLevel3Client = function (client) {
if (client == 'all') {
$scope.params.client_ids = angular.copy($scope.level3ClientIds);
$scope.isLevel3All = true;
$scope.chooseLevel3ClientId = '';
$scope.dev_params.client_ids = angular.copy($scope.level3ClientIds);
$scope.listDevices();
} else {
$scope.chooseLevel3ClientId = client.client_id;
$scope.params.client_ids = [client.client_id];
$scope.isLevel3All = false;
$scope.dev_params.client_ids = [client.client_id];
$scope.listDevices();
}
$scope.loadTradeLogs();
};
$scope.listDevices = function () {
var params = angular.copy($scope.dev_params)
$http.get('/client/partner_info/devices', {params: params}).then(function (resp) {
@ -156,6 +190,11 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
$scope.clientIds = [];
$scope.clients.forEach(function (client) {
$scope.clientIds.push(client.client_id);
if (client.level3Clients) {
client.level3Clients.forEach(function (level3Client) {
$scope.clientIds.push(level3Client.client_id);
});
}
});
$scope.params.client_ids = angular.copy($scope.clientIds);

@ -23,6 +23,8 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
$scope.isAll = true;
$scope.clients = [$scope.currentUser.client];
$scope.params.client_ids = [$scope.currentUser.client.client_id];
$scope.showLevel3Clients = false;
if ($scope.currentUser.client.has_children) {
$http.get('/client/partner_info/sub_partners').then(function (resp) {
var clientList = resp.data;
@ -32,6 +34,11 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
$scope.clientIds = [];
$scope.clients.forEach(function (client) {
$scope.clientIds.push(client.client_id);
if (client.level3Clients) {
client.level3Clients.forEach(function (level3Client) {
$scope.clientIds.push(level3Client.client_id);
});
}
});
$scope.params.client_ids = angular.copy($scope.clientIds);
})
@ -108,19 +115,52 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
});
};
$scope.chooseLast7Days();
$scope.chooseClient = function (clientId) {
if (clientId == 'all') {
$scope.chooseClient = function (client) {
if (client == 'all') {
$scope.params.client_ids = angular.copy($scope.clientIds);
$scope.isAll = true;
$scope.chooseClientId = '';
$scope.dev_params.client_ids = angular.copy($scope.clientIds);
$scope.showLevel3Clients = false;
$scope.listDevices();
} else if (client.level3Clients) {
$scope.chooseClientId = client.client_id;
$scope.showLevel3Clients = true;
$scope.level3Clients = client.level3Clients;
$scope.isAll = false;
$scope.level3ClientIds = [];
$scope.level3ClientIds.push(client.client_id);
client.level3Clients.forEach(function (client) {
$scope.level3ClientIds.push(client.client_id);
});
$scope.chooseLevel3Client("all");
return;
} else {
$scope.chooseClientId = clientId;
$scope.params.client_ids = [clientId];
$scope.chooseClientId = client.client_id;
$scope.params.client_ids = [client.client_id];
$scope.isAll = false;
$scope.dev_params.client_ids = [client.client_id];
$scope.showLevel3Clients = false;
$scope.listDevices();
}
$scope.loadTradeLogs();
};
$scope.chooseLevel3Client = function (client) {
if (client == 'all') {
$scope.params.client_ids = angular.copy($scope.level3ClientIds);
$scope.isLevel3All = true;
$scope.chooseLevel3ClientId = '';
$scope.dev_params.client_ids = angular.copy($scope.level3ClientIds);
$scope.listDevices();
} else {
$scope.chooseLevel3ClientId = client.client_id;
$scope.params.client_ids = [client.client_id];
$scope.isLevel3All = false;
$scope.dev_params.client_ids = [client.client_id];
$scope.listDevices();
}
$scope.loadTradeLogs();
};
$scope.export = function (type,page) {
var url='/client/trans_flow/report/pdf';
if (type=='pdf'){

Loading…
Cancel
Save