Merge branch 'develop'

master
yixian 4 years ago
commit 970136d27a

@ -9,7 +9,7 @@
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId> <artifactId>manage</artifactId>
<version>2.3.46</version> <version>2.3.47</version>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jib-maven-plugin.version>2.4.0</jib-maven-plugin.version> <jib-maven-plugin.version>2.4.0</jib-maven-plugin.version>

@ -9,6 +9,8 @@ import au.com.royalpay.payment.manage.mappers.log.GatewayClientApplyNotifyLogMap
import au.com.royalpay.payment.manage.mappers.system.*; import au.com.royalpay.payment.manage.mappers.system.*;
import au.com.royalpay.payment.manage.merchants.beans.ClientAuthFilesInfo; import au.com.royalpay.payment.manage.merchants.beans.ClientAuthFilesInfo;
import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.organizations.beans.DefaultClientProfile;
import au.com.royalpay.payment.manage.organizations.core.OrgClientProfileUtils;
import au.com.royalpay.payment.manage.system.core.impl.ClientContractServiceImpl; import au.com.royalpay.payment.manage.system.core.impl.ClientContractServiceImpl;
import au.com.royalpay.payment.tools.env.SysConfigManager; import au.com.royalpay.payment.tools.env.SysConfigManager;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
@ -16,6 +18,7 @@ import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
import au.com.royalpay.payment.tools.threadpool.RoyalThreadPoolExecutor; import au.com.royalpay.payment.tools.threadpool.RoyalThreadPoolExecutor;
import cn.yixblog.platform.http.HttpRequestGenerator; import cn.yixblog.platform.http.HttpRequestGenerator;
import cn.yixblog.platform.http.HttpRequestResult; import cn.yixblog.platform.http.HttpRequestResult;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature; import com.alibaba.fastjson.serializer.SerializerFeature;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
@ -80,27 +83,31 @@ public class GatewayMerchantApplyImpl implements GatewayMerchantApply {
@Override @Override
@Transactional @Transactional
public JSONObject applicationMerchant(JSONObject org, JSONObject registerInfo) { public JSONObject applicationMerchant(JSONObject org, JSONObject registerInfo) {
ClientRegisterInfo registerBean = JSONObject.toJavaObject(registerInfo, ClientRegisterInfo.class); ClientRegisterInfo registerBean = JSON.toJavaObject(registerInfo, ClientRegisterInfo.class);
registerBean.checkParamsInvalid(); registerBean.checkParamsInvalid();
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
JSONObject manager = managerMapper.findAvailableByLoginIdAndOrgId(registerBean.getApplyId(), org.getString("org_id")); JSONObject manager = managerMapper.findAvailableByLoginIdAndOrgId(registerBean.getApplyId(), org.getString("org_id"));
if (manager == null) { if (manager == null) {
throw new ParamInvalidException("applyId","applyId is invalid"); throw new ParamInvalidException("applyId", "applyId is invalid");
} }
boolean hasParentBoolean = StringUtils.isNotBlank(registerBean.getParentPartnerCode()); boolean hasParentBoolean = StringUtils.isNotBlank(registerBean.getParentPartnerCode());
int parentClientId = 0; int parentClientId = 0;
if (hasParentBoolean) { if (hasParentBoolean) {
JSONObject parentClient = clientMapper.findClientByMoniker(registerBean.getParentPartnerCode()); JSONObject parentClient = clientMapper.findClientByMoniker(registerBean.getParentPartnerCode());
if (parentClient == null) { if (parentClient == null) {
throw new ParamInvalidException("parentPartnerCode","parentPartnerCode is invalid"); throw new ParamInvalidException("parentPartnerCode", "parentPartnerCode is invalid");
} }
parentClientId = parentClient.getIntValue("client_id"); parentClientId = parentClient.getIntValue("client_id");
} }
try { try {
JSONObject client = registerBean.insertClientInfo(clientManager.initMerchantCode(), manager.getString("display_name"), hasParentBoolean, parentClientId); JSONObject client = registerBean.insertClientInfo(clientManager.initMerchantCode(), manager.getString("display_name"), hasParentBoolean, parentClientId);
client.put("org_id", org.getString("org_id")); client.put("org_id", org.getString("org_id"));
DefaultClientProfile defaultProfile = OrgClientProfileUtils.getOrgProfile(org);
defaultProfile.applyToClientConfig(client);
clientMapper.save(client); clientMapper.save(client);
clientConfigMapper.save(registerBean.insertClientConfigInfo(client.getIntValue("client_id"), client.getString("client_moniker"))); JSONObject clientConfig = registerBean.insertClientConfigInfo(client.getIntValue("client_id"), client.getString("client_moniker"));
defaultProfile.applyToClientConfig(clientConfig);
clientConfigMapper.save(clientConfig);
sysClientLegalPersonMapper.save(registerBean.insertClientLegalInfo(client.getIntValue("client_id"))); sysClientLegalPersonMapper.save(registerBean.insertClientLegalInfo(client.getIntValue("client_id")));
permissionPartnerManagerImpl.permissionClientModuleSave(client.getIntValue("client_id"), client.getString("client_moniker")); permissionPartnerManagerImpl.permissionClientModuleSave(client.getIntValue("client_id"), client.getString("client_moniker"));
JSONObject clientBd = new JSONObject(); JSONObject clientBd = new JSONObject();
@ -168,7 +175,7 @@ public class GatewayMerchantApplyImpl implements GatewayMerchantApply {
break; break;
} }
result.put("partner_status", clientStatus); result.put("partner_status", clientStatus);
if ( approveResult == 1 || approveResult == 5) { if (approveResult == 1 || approveResult == 5) {
result.put("approve_time", DateFormatUtils.format(client.getDate("approve_time"), "yyyy-MM-dd HH:mm:ss")); result.put("approve_time", DateFormatUtils.format(client.getDate("approve_time"), "yyyy-MM-dd HH:mm:ss"));
if (approveResult == 5) { if (approveResult == 5) {
result.put("refuse_description", client.getString("refuse_remark")); result.put("refuse_description", client.getString("refuse_remark"));
@ -212,7 +219,7 @@ public class GatewayMerchantApplyImpl implements GatewayMerchantApply {
log.put("updatetime", new Date()); log.put("updatetime", new Date());
gatewayClientApplyNotifyLogMapper.update(log); gatewayClientApplyNotifyLogMapper.update(log);
logger.debug("商户状态[{}]异步通知[{}]推送完成:[{}]", clientMoniker, notifyUrl, result.getStatusCode()); logger.debug("商户状态[{}]异步通知[{}]推送完成:[{}]", clientMoniker, notifyUrl, result.getStatusCode());
}else { } else {
Throwable exp = result.getException(); Throwable exp = result.getException();
log.put("success", false); log.put("success", false);
log.put("http_code", result.getStatusCode()); log.put("http_code", result.getStatusCode());
@ -225,7 +232,7 @@ public class GatewayMerchantApplyImpl implements GatewayMerchantApply {
} }
private JSONObject preInsertServerNotifyLog(JSONObject client,String notifyUrl) { private JSONObject preInsertServerNotifyLog(JSONObject client, String notifyUrl) {
int clientId = client.getIntValue("client_id"); int clientId = client.getIntValue("client_id");
JSONObject log = gatewayClientApplyNotifyLogMapper.findHistoryByClientId(clientId); JSONObject log = gatewayClientApplyNotifyLogMapper.findHistoryByClientId(clientId);
if (log == null) { if (log == null) {

@ -1,18 +1,10 @@
package au.com.royalpay.payment.manage.mappers.system; package au.com.royalpay.payment.manage.mappers.system;
import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import com.yixsoft.support.mybatis.autosql.annotations.AdvanceSelect;
import com.yixsoft.support.mybatis.autosql.annotations.AutoMapper; import com.yixsoft.support.mybatis.autosql.annotations.AutoMapper;
import com.yixsoft.support.mybatis.autosql.annotations.AutoSql; import com.yixsoft.support.mybatis.autosql.annotations.AutoSql;
import com.yixsoft.support.mybatis.autosql.annotations.SqlType; import com.yixsoft.support.mybatis.autosql.annotations.SqlType;
import org.apache.ibatis.annotations.Param;
/** /**
* Created by wangning on 2018-04-08. * Created by wangning on 2018-04-08.

@ -1,12 +1,13 @@
package au.com.royalpay.payment.manage.mappers.system; package au.com.royalpay.payment.manage.mappers.system;
import au.com.royalpay.payment.manage.organizations.core.OrgClientProfileUtils;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import com.yixsoft.support.mybatis.autosql.annotations.AdvanceSelect; import com.yixsoft.support.mybatis.autosql.annotations.AdvanceSelect;
import com.yixsoft.support.mybatis.autosql.annotations.AutoMapper; import com.yixsoft.support.mybatis.autosql.annotations.AutoMapper;
import com.yixsoft.support.mybatis.autosql.annotations.AutoSql; import com.yixsoft.support.mybatis.autosql.annotations.AutoSql;
import com.yixsoft.support.mybatis.autosql.annotations.SqlType; import com.yixsoft.support.mybatis.autosql.annotations.SqlType;
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.Param;
import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator; import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator;
@ -17,7 +18,6 @@ import java.util.List;
*/ */
@AutoMapper(tablename = "sys_org", pkName = "org_id", keyGenerator = Jdbc3KeyGenerator.class) @AutoMapper(tablename = "sys_org", pkName = "org_id", keyGenerator = Jdbc3KeyGenerator.class)
public interface OrgMapper { public interface OrgMapper {
@AutoSql(SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "type != 1") @AdvanceSelect(addonWhereClause = "type != 1")
List<JSONObject> listOrgsWithDetail(PageBounds order); List<JSONObject> listOrgsWithDetail(PageBounds order);
@ -39,11 +39,9 @@ public interface OrgMapper {
@AutoSql(SqlType.UPDATE) @AutoSql(SqlType.UPDATE)
void updateOrg(JSONObject org); void updateOrg(JSONObject org);
@AutoSql(SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid=1 AND parent_org_id is null") @AdvanceSelect(addonWhereClause = "is_valid=1 AND parent_org_id is null")
List<JSONObject> listAllOrgs(); List<JSONObject> listAllOrgs();
@AutoSql(SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid=1 AND senior_parent_org_id=0") @AdvanceSelect(addonWhereClause = "is_valid=1 AND senior_parent_org_id=0")
List<JSONObject> listSeniorOrgs(); List<JSONObject> listSeniorOrgs();
@ -54,4 +52,7 @@ public interface OrgMapper {
List<JSONObject> listOrgAndChild(@Param("org_id") int org_id); List<JSONObject> listOrgAndChild(@Param("org_id") int org_id);
List<String> listSeniorOrgId(@Param("senior_parent_org_id") int senior_parent_org_id); List<String> listSeniorOrgId(@Param("senior_parent_org_id") int senior_parent_org_id);
@AutoSql(SqlType.UPDATE)
void updateOrgClientProfile(@Param("org_id") int orgId, @Param(OrgClientProfileUtils.PROFILE_KEY) String clientDefaultProfile);
} }

@ -1,10 +1,9 @@
package au.com.royalpay.payment.manage.mappers.system; package au.com.royalpay.payment.manage.mappers.system;
import com.yixsoft.support.mybatis.autosql.annotations.AdvanceSelect; import com.alibaba.fastjson.JSONObject;
import com.yixsoft.support.mybatis.autosql.annotations.AutoMapper; import com.yixsoft.support.mybatis.autosql.annotations.AutoMapper;
import com.yixsoft.support.mybatis.autosql.annotations.AutoSql; import com.yixsoft.support.mybatis.autosql.annotations.AutoSql;
import com.yixsoft.support.mybatis.autosql.annotations.SqlType; import com.yixsoft.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@AutoMapper(tablename = "sys_client_legal_person", pkName = "client_id") @AutoMapper(tablename = "sys_client_legal_person", pkName = "client_id")

@ -50,6 +50,8 @@ import au.com.royalpay.payment.manage.merchants.core.ClientModifySupport;
import au.com.royalpay.payment.manage.merchants.entity.impls.*; import au.com.royalpay.payment.manage.merchants.entity.impls.*;
import au.com.royalpay.payment.manage.merchants.enums.UPayAuthFileEnum; import au.com.royalpay.payment.manage.merchants.enums.UPayAuthFileEnum;
import au.com.royalpay.payment.manage.notice.core.MailService; import au.com.royalpay.payment.manage.notice.core.MailService;
import au.com.royalpay.payment.manage.organizations.beans.DefaultClientProfile;
import au.com.royalpay.payment.manage.organizations.core.OrgClientProfileUtils;
import au.com.royalpay.payment.manage.permission.utils.OrgCheckUtils; import au.com.royalpay.payment.manage.permission.utils.OrgCheckUtils;
import au.com.royalpay.payment.manage.rservices.core.RServicesApplyService; import au.com.royalpay.payment.manage.rservices.core.RServicesApplyService;
import au.com.royalpay.payment.manage.signin.beans.TodoNotice; import au.com.royalpay.payment.manage.signin.beans.TodoNotice;
@ -96,6 +98,7 @@ import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.github.miemiedev.mybatis.paginator.domain.PageList;
import io.jsonwebtoken.lang.Assert;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
@ -786,7 +789,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
partner.put("ali_sub_merchant_id", registery.getClientMoniker()); partner.put("ali_sub_merchant_id", registery.getClientMoniker());
partner.put("credential_code", RandomStringUtils.random(32, true, true)); partner.put("credential_code", RandomStringUtils.random(32, true, true));
partner.put("creator", manager.getString("manager_id")); partner.put("creator", manager.getString("manager_id"));
partner.put("org_id", manager.getIntValue("org_id")); int orgId = manager.getIntValue("org_id");
partner.put("org_id", orgId);
JSONObject org = orgMapper.findOne(orgId);
Assert.notNull(orgId, "Merchant Org shall not be null");
if (StringUtils.isNotEmpty(registery.getLogoId())) { if (StringUtils.isNotEmpty(registery.getLogoId())) {
partner.put("logo_url", attachmentClient.getFileUrl(registery.getLogoId())); partner.put("logo_url", attachmentClient.getFileUrl(registery.getLogoId()));
partner.put("logo_thumbnail", attachmentClient.getThumbnail(registery.getLogoId(), 600).getString("url")); partner.put("logo_thumbnail", attachmentClient.getThumbnail(registery.getLogoId(), 600).getString("url"));
@ -803,6 +809,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (clientMapper.findClientByMoniker(registery.getClientMoniker()) != null) { if (clientMapper.findClientByMoniker(registery.getClientMoniker()) != null) {
throw new BadRequestException("error.partner.valid.dumplicate_client_moniker"); throw new BadRequestException("error.partner.valid.dumplicate_client_moniker");
} }
DefaultClientProfile profile = OrgClientProfileUtils.getOrgProfile(org);
profile.applyToClientConfig(partner);
clientMapper.save(partner); clientMapper.save(partner);
try { try {
@ -813,6 +821,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
clientConfig.put("client_pay_desc", partner.get("client_pay_desc")); clientConfig.put("client_pay_desc", partner.get("client_pay_desc"));
clientConfig.put("enable_cross_payment", partner.get("enable_cross_payment")); clientConfig.put("enable_cross_payment", partner.get("enable_cross_payment"));
clientConfig.put("enable_card_payment", partner.get("enable_card_payment")); clientConfig.put("enable_card_payment", partner.get("enable_card_payment"));
profile.applyToClientConfig(clientConfig);
clientConfigService.save(clientConfig); clientConfigService.save(clientConfig);
permissionPartnerManagerImpl.permissionClientModuleSave(partner.getIntValue("client_id"), partner.getString("client_moniker")); permissionPartnerManagerImpl.permissionClientModuleSave(partner.getIntValue("client_id"), partner.getString("client_moniker"));
} catch (Exception e) { } catch (Exception e) {

@ -0,0 +1,127 @@
package au.com.royalpay.payment.manage.organizations.beans;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.PropertyNamingStrategy;
import com.alibaba.fastjson.annotation.JSONType;
import com.google.common.base.CaseFormat;
import com.yixsoft.support.mybatis.utils.ClassFieldsDescription;
import com.yixsoft.support.mybatis.utils.FieldDescription;
import org.apache.commons.lang3.ObjectUtils;
import org.hibernate.validator.constraints.Range;
import org.springframework.core.annotation.AnnotatedElementUtils;
import java.util.List;
import java.util.stream.Collectors;
@JSONType(naming = PropertyNamingStrategy.SnakeCase)
public class DefaultClientProfile {
@ProfileDesc(value = "周末延迟清算", detail = "周末交易延迟到周二清算")
private boolean weekendDelay = true;
@ProfileDesc("手续费包含GST")
private boolean taxInSurcharge = false;
@ProfileDesc("允许退款")
private boolean enableRefund = true;
@ProfileDesc(value = "每日清算截止时间", detail = "默认基于GMT+10的0点有效范围0-24时区为商户时区")
@Range(max = 24)
private Integer settleHour;
@ProfileDesc("自动获取消费者信息")
private boolean requireCustinfo = true;
@ProfileDesc(value = "交易备注必填", detail = "仅限于商户静态码")
private boolean requireRemark = false;
public List<JSONObject> desc() {
return new ClassFieldsDescription<>(getClass()).getFields().stream()
.map(this::convertFieldInfo)
.collect(Collectors.toList());
}
private JSONObject convertFieldInfo(FieldDescription field) {
Object value = field.readField(this);
String fieldName = CaseFormat.LOWER_CAMEL.converterTo(CaseFormat.LOWER_UNDERSCORE).convert(field.getFieldName());
JSONObject info = new JSONObject();
info.put("field", fieldName);
info.put("value", value);
Class<?> fieldType = field.getMethod().getReturnType();
if (fieldType.isPrimitive()) {
if (fieldType.equals(Boolean.class)) {
info.put("type", "checkbox");
} else {
info.put("type", "number");
}
} else {
info.put("type", "text");
}
ProfileDesc getterDesc = AnnotatedElementUtils.findMergedAnnotation(field.getMethod(), ProfileDesc.class);
try {
ProfileDesc fieldDesc = AnnotatedElementUtils.findMergedAnnotation(getClass().getDeclaredField(field.getFieldName()), ProfileDesc.class);
ProfileDesc desc = ObjectUtils.defaultIfNull(getterDesc, fieldDesc);
if (desc != null) {
info.put("title", desc.value());
info.put("detail", desc.detail());
}
} catch (NoSuchFieldException e) {
}
return info;
}
public void applyToClientConfig(JSONObject client) {
JSONObject profile = (JSONObject) JSON.toJSON(this);
profile.forEach(client::putIfAbsent);
}
public boolean isWeekendDelay() {
return weekendDelay;
}
public DefaultClientProfile setWeekendDelay(boolean weekendDelay) {
this.weekendDelay = weekendDelay;
return this;
}
public boolean isTaxInSurcharge() {
return taxInSurcharge;
}
public DefaultClientProfile setTaxInSurcharge(boolean taxInSurcharge) {
this.taxInSurcharge = taxInSurcharge;
return this;
}
public boolean isEnableRefund() {
return enableRefund;
}
public DefaultClientProfile setEnableRefund(boolean enableRefund) {
this.enableRefund = enableRefund;
return this;
}
public Integer getSettleHour() {
return settleHour;
}
public DefaultClientProfile setSettleHour(Integer settleHour) {
this.settleHour = settleHour;
return this;
}
public boolean isRequireCustinfo() {
return requireCustinfo;
}
public DefaultClientProfile setRequireCustinfo(boolean requireCustinfo) {
this.requireCustinfo = requireCustinfo;
return this;
}
public boolean isRequireRemark() {
return requireRemark;
}
public DefaultClientProfile setRequireRemark(boolean requireRemark) {
this.requireRemark = requireRemark;
return this;
}
}

@ -0,0 +1,17 @@
package au.com.royalpay.payment.manage.organizations.beans;
import org.springframework.data.mongodb.core.mapping.Document;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Document
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.METHOD})
public @interface ProfileDesc {
String value();
String detail() default "";
}

@ -0,0 +1,30 @@
package au.com.royalpay.payment.manage.organizations.core;
import au.com.royalpay.payment.manage.organizations.beans.DefaultClientProfile;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject;
public final class OrgClientProfileUtils {
public static final String PROFILE_KEY = "default_client_profile";
private OrgClientProfileUtils() {
}
public static DefaultClientProfile getOrgProfile(JSONObject org) {
String profile = org.getString(PROFILE_KEY);
if (profile == null) {
return new DefaultClientProfile();
}
try {
return JSON.parseObject(profile).toJavaObject(DefaultClientProfile.class);
} catch (JSONException e) {
return new DefaultClientProfile();
}
}
public static void applyOrgClientDefaultProfile(JSONObject org, JSONObject client) {
DefaultClientProfile profile = getOrgProfile(org);
profile.applyToClientConfig(client);
}
}

@ -1,5 +1,6 @@
package au.com.royalpay.payment.manage.organizations.core; package au.com.royalpay.payment.manage.organizations.core;
import au.com.royalpay.payment.manage.organizations.beans.DefaultClientProfile;
import au.com.royalpay.payment.manage.organizations.beans.OrgInfo; import au.com.royalpay.payment.manage.organizations.beans.OrgInfo;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
@ -46,4 +47,6 @@ public interface OrgManager {
JSONObject checkOrg(JSONObject manager, JSONObject params); JSONObject checkOrg(JSONObject manager, JSONObject params);
JSONObject checkOrgIds(JSONObject manager, JSONObject params); JSONObject checkOrgIds(JSONObject manager, JSONObject params);
void updateDefaultClientProfile(int orgId, JSONObject manager, DefaultClientProfile profile);
} }

@ -3,11 +3,13 @@ package au.com.royalpay.payment.manage.organizations.core.impls;
import au.com.royalpay.payment.manage.mappers.financial.FinancialPartnerCommissionMapper; import au.com.royalpay.payment.manage.mappers.financial.FinancialPartnerCommissionMapper;
import au.com.royalpay.payment.manage.mappers.system.OrgMapper; import au.com.royalpay.payment.manage.mappers.system.OrgMapper;
import au.com.royalpay.payment.manage.mappers.system.OrgSignInfoMapper; import au.com.royalpay.payment.manage.mappers.system.OrgSignInfoMapper;
import au.com.royalpay.payment.manage.organizations.beans.DefaultClientProfile;
import au.com.royalpay.payment.manage.organizations.beans.OrgInfo; import au.com.royalpay.payment.manage.organizations.beans.OrgInfo;
import au.com.royalpay.payment.manage.organizations.core.OrgManager; import au.com.royalpay.payment.manage.organizations.core.OrgManager;
import au.com.royalpay.payment.tools.codec.RSACrypt; import au.com.royalpay.payment.tools.codec.RSACrypt;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException; import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.Order;
@ -91,8 +93,8 @@ public class OrgManagerImpl implements OrgManager {
children.add(child); children.add(child);
} }
} }
if(children.size()> 0){ if (!children.isEmpty()) {
org.put("children",children); org.put("children", children);
} }
} }
return listOrgs; return listOrgs;
@ -312,24 +314,31 @@ public class OrgManagerImpl implements OrgManager {
if (manager.getInteger("org_id")!=null){ if (manager.getInteger("org_id")!=null){
List<JSONObject> orgs = orgMapper.listOrgAndChild(manager.getIntValue("org_id")); List<JSONObject> orgs = orgMapper.listOrgAndChild(manager.getIntValue("org_id"));
List<Integer> orgIds = orgs.stream().map(org->org.getIntValue("org_id")).collect(Collectors.toList()); List<Integer> orgIds = orgs.stream().map(org->org.getIntValue("org_id")).collect(Collectors.toList());
if (!orgIds.contains(params.getString("org_id2"))){ if (!orgIds.contains(params.getString("org_id2"))) {
throw new ForbiddenException("You have no permission to query the org"); throw new ForbiddenException("You have no permission to query the org");
} }
} }
params.put("org_id",params.getString("org_id2")); params.put("org_id", params.getString("org_id2"));
params.remove("org_id2"); params.remove("org_id2");
} }
} }
return params; return params;
} }
private void orgIds(JSONObject params,JSONObject manager){
@Override
public void updateDefaultClientProfile(int orgId, JSONObject manager, DefaultClientProfile profile) {
getOrgDetail(orgId, manager);
orgMapper.updateOrgClientProfile(orgId, JSON.toJSONString(profile));
}
private void orgIds(JSONObject params, JSONObject manager) {
List<JSONObject> orgs = orgMapper.listOrgAndChild(Integer.parseInt(params.getString("org_id"))); List<JSONObject> orgs = orgMapper.listOrgAndChild(Integer.parseInt(params.getString("org_id")));
if (orgs.size()>1){ if (orgs.size() > 1) {
List<Integer> orgIds = orgs.stream().map(org->org.getIntValue("org_id")).collect(Collectors.toList()); List<Integer> orgIds = orgs.stream().map(org -> org.getIntValue("org_id")).collect(Collectors.toList());
params.put("org_ids",orgIds); params.put("org_ids", orgIds);
params.remove("org_id"); params.remove("org_id");
}else { } else {
params.put("org_id",params.getString("org_id")); params.put("org_id", params.getString("org_id"));
} }
} }
private void checkOrgRate(JSONObject json){ private void checkOrgRate(JSONObject json){

@ -1,6 +1,8 @@
package au.com.royalpay.payment.manage.organizations.web; package au.com.royalpay.payment.manage.organizations.web;
import au.com.royalpay.payment.manage.organizations.beans.DefaultClientProfile;
import au.com.royalpay.payment.manage.organizations.beans.OrgInfo; import au.com.royalpay.payment.manage.organizations.beans.OrgInfo;
import au.com.royalpay.payment.manage.organizations.core.OrgClientProfileUtils;
import au.com.royalpay.payment.manage.organizations.core.OrgManager; import au.com.royalpay.payment.manage.organizations.core.OrgManager;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.manage.permission.manager.RequireManager; import au.com.royalpay.payment.manage.permission.manager.RequireManager;
@ -38,20 +40,20 @@ public class OrgManageController {
@GetMapping(value = "/orgChild") @GetMapping(value = "/orgChild")
@RequireManager @RequireManager
public List<JSONObject> listOrgsWithChid(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,OrgInfo orgInfo) { public List<JSONObject> listOrgsWithChid(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, OrgInfo orgInfo) {
return orgManager.listOrgsWithChid(manager,orgInfo); return orgManager.listOrgsWithChid(manager, orgInfo);
} }
@GetMapping(value = "/child") @GetMapping(value = "/child")
@RequireManager @RequireManager
public List<JSONObject> listOrgAndChild(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,OrgInfo orgInfo) { public List<JSONObject> listOrgAndChild(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, OrgInfo orgInfo) {
return orgManager.listOrgAndChild(manager); return orgManager.listOrgAndChild(manager);
} }
@GetMapping("/listsOrg") @GetMapping("/listsOrg")
@RequireManager @RequireManager
public JSONObject listsOrg(OrgInfo orgInfo,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { public JSONObject listsOrg(OrgInfo orgInfo, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return orgManager.listAllOrgs(orgInfo,manager); return orgManager.listAllOrgs(orgInfo, manager);
} }
@GetMapping("/list_all_Org") @GetMapping("/list_all_Org")
@ -67,8 +69,10 @@ public class OrgManageController {
} }
@ManagerMapping(value = "/{orgId}", method = RequestMethod.GET, role = {ManagerRole.ADMIN}) @ManagerMapping(value = "/{orgId}", method = RequestMethod.GET, role = {ManagerRole.ADMIN})
public JSONObject getOrgDetail(@PathVariable int orgId,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { public JSONObject getOrgDetail(@PathVariable int orgId, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return orgManager.getOrgDetail(orgId,manager); JSONObject org = orgManager.getOrgDetail(orgId, manager);
org.remove(OrgClientProfileUtils.PROFILE_KEY);
return org;
} }
@ManagerMapping(value = "/{orgId}", method = RequestMethod.PUT) @ManagerMapping(value = "/{orgId}", method = RequestMethod.PUT)
@ -77,6 +81,18 @@ public class OrgManageController {
orgManager.updateOrg(orgId, org, manager); orgManager.updateOrg(orgId, org, manager);
} }
@ManagerMapping(value = "/{orgId}/default_client_profile", method = RequestMethod.GET, role = ManagerRole.ADMIN)
public List<JSONObject> getOrgDefaultClientProfile(@PathVariable int orgId, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
JSONObject org = orgManager.getOrgDetail(orgId, manager);
return OrgClientProfileUtils.getOrgProfile(org).desc();
}
@ManagerMapping(value = "/{orgId}/default_client_profile", method = RequestMethod.PUT, role = ManagerRole.ADMIN)
public void updateOrgProfile(@PathVariable int orgId, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @RequestBody @Valid DefaultClientProfile profile, Errors errors) {
HttpUtils.handleValidErrors(errors);
orgManager.updateDefaultClientProfile(orgId, manager, profile);
}
@ManagerMapping(value = "/{orgId}/partner_public_key", method = RequestMethod.PUT) @ManagerMapping(value = "/{orgId}/partner_public_key", method = RequestMethod.PUT)
public void setPartnerPublicKeyConfig(@PathVariable int orgId, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @RequestBody JSONObject config) { public void setPartnerPublicKeyConfig(@PathVariable int orgId, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @RequestBody JSONObject config) {
orgManager.setPartnerPublicKeyConfig(orgId, manager, config.getString("partner_public_key")); orgManager.setPartnerPublicKeyConfig(orgId, manager, config.getString("partner_public_key"));
@ -87,14 +103,14 @@ public class OrgManageController {
orgManager.refreshPlatformPublicKeyConfig(orgId, manager); orgManager.refreshPlatformPublicKeyConfig(orgId, manager);
} }
@ManagerMapping(value = "/{orgId}/enable_change_rate",method = RequestMethod.PUT,role = {ManagerRole.ADMIN}) @ManagerMapping(value = "/{orgId}/enable_change_rate", method = RequestMethod.PUT, role = {ManagerRole.ADMIN})
public void switchEnableChangeRate(@PathVariable int orgId, @RequestBody JSONObject enable){ public void switchEnableChangeRate(@PathVariable int orgId, @RequestBody JSONObject enable) {
boolean enabled = enable.getBooleanValue("enabled"); boolean enabled = enable.getBooleanValue("enabled");
orgManager.switchPermission(orgId,"rate_editable",enabled); orgManager.switchPermission(orgId, "rate_editable", enabled);
} }
@ManagerMapping(value = "/referrer",method = RequestMethod.GET) @ManagerMapping(value = "/referrer", method = RequestMethod.GET)
public List<JSONObject> getReferrers(){ public List<JSONObject> getReferrers() {
return orgManager.getReferrers(); return orgManager.getReferrers();
} }
@ -102,7 +118,7 @@ public class OrgManageController {
public JSONObject getCityPartnerPrizeInfoAllList(@PathVariable int orgId, public JSONObject getCityPartnerPrizeInfoAllList(@PathVariable int orgId,
@RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "1") int page,
@RequestParam(defaultValue = "20") int limit, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { @RequestParam(defaultValue = "20") int limit, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return orgManager.getCityPartnerPrizeInfoList(page, limit,orgId,manager); return orgManager.getCityPartnerPrizeInfoList(page, limit, orgId, manager);
} }
@RequestMapping(value = "/{orgId}/init/merchant_code", method = RequestMethod.GET, produces = "application/json") @RequestMapping(value = "/{orgId}/init/merchant_code", method = RequestMethod.GET, produces = "application/json")

@ -139,7 +139,8 @@
INSERT sys_client_rates (manager_id, client_id, rate_name, rate_value, transaction_fee, active_time, expiry_time, create_time, update_time, manager_name, clean_days, remark) INSERT sys_client_rates (manager_id, client_id, rate_name, rate_value, transaction_fee, active_time, expiry_time, create_time, update_time, manager_name, clean_days, remark)
SELECT CONCAT('System-', CURRENT_DATE()),r.client_id,r.rate_name,r.rate_value,r.transaction_fee,DATE_ADD(r.expiry_time, INTERVAL 1 day),DATE_ADD(r.expiry_time, INTERVAL 1 year),NOW(), NOW(), SELECT CONCAT('System-', CURRENT_DATE()),r.client_id,r.rate_name,r.rate_value,r.transaction_fee,DATE_ADD(r.expiry_time, INTERVAL 1 day),
IF(DATE_ADD( r.expiry_time, INTERVAL 1 YEAR )<=NOW(),DATE_ADD( r.expiry_time, INTERVAL 2 YEAR ),DATE_ADD( r.expiry_time, INTERVAL 1 YEAR )) expiry_time,NOW(), NOW(),
CONCAT('System-', CURRENT_DATE()),r.clean_days,'费率自动延期一年' CONCAT('System-', CURRENT_DATE()),r.clean_days,'费率自动延期一年'
FROM (select rr.* from sys_client_rates rr FROM (select rr.* from sys_client_rates rr
WHERE rr.client_id = #{clientId} WHERE rr.client_id = #{clientId}

@ -26,6 +26,7 @@ define(['./app',
'./directives/royalCalendar', './directives/royalCalendar',
'./directives/multiLevelSelect', './directives/multiLevelSelect',
'./directives/jsonview', './directives/jsonview',
'./directives/ngInputName',
'./filters/propsFilter', './filters/propsFilter',
'./filters/inverseColor', './filters/inverseColor',
'./filters/limitToWithEllipsis', './filters/limitToWithEllipsis',

@ -0,0 +1,55 @@
define(['../app', 'angular'], function (app, angular) {
'use strict';
app.directive('ngInputName', function () {
let myNameError = "myName directive error: "
return {
restrict: 'A', // Declares an Attributes Directive.
require: 'ngModel', // ngModelController.
link: function (scope, elem, attrs, ngModel) {
if (!ngModel) {
return
} // no ngModel exists for this element
// check myName input for proper formatting ex. something/something
checkInputFormat(attrs);
let inputName = attrs.myName.match('^\\w+').pop(); // match upto '/'
assignInputNameToInputModel(inputName, ngModel);
let formName = attrs.myName.match('\\w+$').pop(); // match after '/'
findForm(formName, ngModel, scope);
} // end link
} // end return
function checkInputFormat(attrs) {
if (!/\w\/\w/.test(attrs.rsName)) {
throw myNameError + "Formatting should be \"inputName/formName\" but is " + attrs.rsName
}
}
function assignInputNameToInputModel(inputName, ngModel) {
ngModel.$name = inputName
}
function addInputNameToForm(formName, ngModel, scope) {
scope[formName][ngModel.$name] = ngModel;
return
}
function findForm(formName, ngModel, scope) {
if (!scope) { // ran out of scope before finding scope[formName]
throw myNameError + "<Form> element named " + formName + " could not be found."
}
if (formName in scope) { // found scope[formName]
addInputNameToForm(formName, ngModel, scope)
return
}
findForm(formName, ngModel, scope.$parent) // recursively search through $parent scopes
}
})
});

@ -49,17 +49,17 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
controller: 'newOrgCtrl' controller: 'newOrgCtrl'
}) })
}]); }]);
app.controller('orgsCtrl', ['$scope', '$http','commonDialog', function ($scope, $http,commonDialog ) { app.controller('orgsCtrl', ['$scope', '$http', 'commonDialog', function ($scope, $http, commonDialog) {
$scope.params = {}; $scope.params = {};
if(($scope.currentUser.role & parseInt('1000000000000', 2)) > 0 && $scope.currentUser.org_id) { if (($scope.currentUser.role & parseInt('1000000000000', 2)) > 0 && $scope.currentUser.org_id) {
$scope.params.org_id = $scope.currentUser.org_id; $scope.params.org_id = $scope.currentUser.org_id;
} }
$scope.pagination = {}; $scope.pagination = {};
$scope.types = angular.copy(types); $scope.types = angular.copy(types);
$scope.listOrgs = function (page) { $scope.listOrgs = function (page) {
var params = angular.copy( $scope.params); var params = angular.copy($scope.params);
params.page = page || $scope.pagination.page || 1; params.page = page || $scope.pagination.page || 1;
$http.get('/sys/orgs/listsOrg',{params:params}).then(function (resp) { $http.get('/sys/orgs/listsOrg', {params: params}).then(function (resp) {
$scope.orgs_detail = resp.data.data; $scope.orgs_detail = resp.data.data;
$scope.pagination = resp.data.pagination; $scope.pagination = resp.data.pagination;
}) })
@ -71,7 +71,7 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
}); });
} }
$scope.disableOrg = function (org) { $scope.disableOrg = function (org) {
$scope.org =angular.copy(org); $scope.org = angular.copy(org);
$scope.org.is_valid = 0; $scope.org.is_valid = 0;
commonDialog.confirm({ commonDialog.confirm({
title: 'Confirm!', title: 'Confirm!',
@ -86,7 +86,7 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
}; };
$scope.listOrgs(1); $scope.listOrgs(1);
}]); }]);
app.controller('orgDetailCtrl', ['$scope', '$http', '$state', 'Upload', '$filter','$uibModal','commonDialog','chartParser', 'org','stateMap', function ($scope, $http, $state, Upload,$filter,$uibModal,commonDialog, chartParser,org,stateMap) { app.controller('orgDetailCtrl', ['$scope', '$http', '$state', 'Upload', '$filter', '$uibModal', 'commonDialog', 'chartParser', 'org', 'stateMap', function ($scope, $http, $state, Upload, $filter, $uibModal, commonDialog, chartParser, org, stateMap) {
$scope.analysis = {}; $scope.analysis = {};
$scope.today = new Date(); $scope.today = new Date();
$scope.chooseToday = function () { $scope.chooseToday = function () {
@ -130,6 +130,24 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
$scope.params.begin = currentYearFirstDate; $scope.params.begin = currentYearFirstDate;
$scope.loadTransactionAmountInOrg(); $scope.loadTransactionAmountInOrg();
}; };
$scope.loadClientProfile = function () {
$http.get('/sys/orgs/' + $scope.org.org_id + '/default_client_profile').then(function (res) {
$scope.clientProfileFields = res.data;
})
};
$scope.loadClientProfile();
$scope.submitClientProfile = function () {
let profile = {};
for (let field of $scope.clientProfileFields) {
profile[field.field] = field.value;
}
$http.put('/sys/orgs/' + $scope.org.org_id + '/default_client_profile').then(function () {
commonDialog.alert({type: 'success', title: 'Success', content: 'Modify Success'});
$scope.loadClientProfile();
}, function (res) {
commonDialog.alert({type: 'error', title: 'Error', content: res.data.message});
})
};
$scope.scales = [ $scope.scales = [
{ {
key: 'today', key: 'today',
@ -186,8 +204,8 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
params: function () { params: function () {
var date = new Date(); var date = new Date();
date = date.setDate(1); date = date.setDate(1);
var oneDay=1000*60*60*24; var oneDay = 1000 * 60 * 60 * 24;
var end = $filter('date')(date-oneDay, 'yyyyMMdd'); var end = $filter('date')(date - oneDay, 'yyyyMMdd');
var date2 = new Date(); var date2 = new Date();
date2.setDate(1); date2.setDate(1);
@ -211,8 +229,8 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
$scope.loadSeniorOrg = function () { $scope.loadSeniorOrg = function () {
$http.get('/sys/orgs/senior').then(function (resp) { $http.get('/sys/orgs/senior').then(function (resp) {
$scope.seniorOrgs = resp.data; $scope.seniorOrgs = resp.data;
var senior = {org_id:0,name:'I\'m Senior'} var senior = {org_id: 0, name: 'I\'m Senior'}
var noop = {org_id:-1,name:'noop'} var noop = {org_id: -1, name: 'noop'}
$scope.seniorOrgs.unshift(noop); $scope.seniorOrgs.unshift(noop);
$scope.seniorOrgs.unshift(senior); $scope.seniorOrgs.unshift(senior);
}) })
@ -249,13 +267,14 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
for (var i = 0; i < resp.data.length; i++) { for (var i = 0; i < resp.data.length; i++) {
$scope.legends[i] = resp.data[i].org_name; $scope.legends[i] = resp.data[i].org_name;
} }
if($scope.orgAmounts.length >= 1){ if ($scope.orgAmounts.length >= 1) {
$scope.chooseOrg = resp.data[0].org_name; $scope.chooseOrg = resp.data[0].org_name;
loadPartnersByOrgId(resp.data[0].org_id); loadPartnersByOrgId(resp.data[0].org_id);
} }
$scope.future_loading = false; $scope.future_loading = false;
}); });
}; };
function loadPartnersByOrgId(org_id) { function loadPartnersByOrgId(org_id) {
var params = angular.copy($scope.params); var params = angular.copy($scope.params);
if (params.begin) { if (params.begin) {
@ -268,7 +287,7 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
} else { } else {
params.end = $filter('date')(new Date(), 'yyyyMMdd'); params.end = $filter('date')(new Date(), 'yyyyMMdd');
} }
$http.get('/analysis/org/'+org_id+'/partners', {params: params}).then(function (resp) { $http.get('/analysis/org/' + org_id + '/partners', {params: params}).then(function (resp) {
$scope.salespartners = resp.data; $scope.salespartners = resp.data;
$scope.partnerSales1 = []; $scope.partnerSales1 = [];
$scope.partnerSales2 = []; $scope.partnerSales2 = [];
@ -298,6 +317,7 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
}; };
$scope.chooseLast7Days(); $scope.chooseLast7Days();
//$scope.loadTransactionAmountInOrg(); //$scope.loadTransactionAmountInOrg();
function loadFeeAnalysis(params) { function loadFeeAnalysis(params) {
@ -426,7 +446,7 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
var params = {}; var params = {};
params.page = $scope.paginationc.page || 1; params.page = $scope.paginationc.page || 1;
params.org_id = $scope.org.org_id; params.org_id = $scope.org.org_id;
$http.get('/sys/orgs/'+$scope.org.org_id + '/extract/search', {params: params}).then(function (resp) { $http.get('/sys/orgs/' + $scope.org.org_id + '/extract/search', {params: params}).then(function (resp) {
$scope.client_extarct = resp.data.data; $scope.client_extarct = resp.data.data;
$scope.paginationc = resp.data.pagination; $scope.paginationc = resp.data.pagination;
@ -436,8 +456,6 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
$scope.loadCommission(); $scope.loadCommission();
$scope.uploadLogo = function (file) { $scope.uploadLogo = function (file) {
if (file == null) { if (file == null) {
return; return;
@ -469,7 +487,7 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
}); });
return; return;
} }
if($scope.org.type == 1){ if ($scope.org.type == 1) {
$scope.org.commission_type = 2; $scope.org.commission_type = 2;
} }
$http.put('/sys/orgs/' + $scope.org.org_id, $scope.org).then(function () { $http.put('/sys/orgs/' + $scope.org.org_id, $scope.org).then(function () {
@ -481,23 +499,23 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
}; };
$scope.toggleRateEditable = function () { $scope.toggleRateEditable = function () {
if($scope.org.rate_editable==org.data.rate_editable){ if ($scope.org.rate_editable == org.data.rate_editable) {
return; return;
} }
$http.put('/sys/orgs/'+$scope.org.org_id+'/enable_change_rate',{enabled:$scope.org.rate_editable}).then(function () { $http.put('/sys/orgs/' + $scope.org.org_id + '/enable_change_rate', {enabled: $scope.org.rate_editable}).then(function () {
},function (resp) { }, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
}) })
}; };
$scope.params = {role:'1111111',org_id:$scope.org.org_id}; $scope.params = {role: '1111111', org_id: $scope.org.org_id};
$scope.paginationa = {}; $scope.paginationa = {};
$scope.listManagers = function (page) { $scope.listManagers = function (page) {
var params = angular.copy($scope.params); var params = angular.copy($scope.params);
params.page = page || $scope.paginationa.page || 1; params.page = page || $scope.paginationa.page || 1;
$http.get('/sys/manager_accounts',{params:params}).then(function (resp) { $http.get('/sys/manager_accounts', {params: params}).then(function (resp) {
$scope.managers = resp.data.data; $scope.managers = resp.data.data;
$scope.paginationa = resp.data.pagination; $scope.paginationa = resp.data.pagination;
}) })
@ -593,7 +611,11 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
content: 'This operation will refresh the gateway short id, Are you sure?' content: 'This operation will refresh the gateway short id, Are you sure?'
}).then(function () { }).then(function () {
$http.get('/sys/orgs/' + $scope.org.org_id + '/init/merchant_code').then(function (response) { $http.get('/sys/orgs/' + $scope.org.org_id + '/init/merchant_code').then(function (response) {
commonDialog.alert({title: 'Success', content: "Gateway Short Id Refresh Successfully", type: 'success'}) commonDialog.alert({
title: 'Success',
content: "Gateway Short Id Refresh Successfully",
type: 'success'
})
$scope.org.gateway_short_id = response.data.partner_code; $scope.org.gateway_short_id = response.data.partner_code;
}, function (resp) { }, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
@ -601,7 +623,7 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
}) })
}; };
}]); }]);
app.controller('orgDetailParentCtrl', ['$scope', '$http', '$state', 'Upload', '$uibModal','commonDialog', 'org','stateMap', function ($scope, $http, $state, Upload,$uibModal,commonDialog, org,stateMap) { app.controller('orgDetailParentCtrl', ['$scope', '$http', '$state', 'Upload', '$uibModal', 'commonDialog', 'org', 'stateMap', function ($scope, $http, $state, Upload, $uibModal, commonDialog, org, stateMap) {
$scope.merchantCodeChecked = true; $scope.merchantCodeChecked = true;
$scope.merchantIsValid = true; $scope.merchantIsValid = true;
$scope.types = angular.copy(types); $scope.types = angular.copy(types);
@ -658,7 +680,7 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
var params = {}; var params = {};
params.page = $scope.paginationc.page || 1; params.page = $scope.paginationc.page || 1;
params.org_id = $scope.org.org_id; params.org_id = $scope.org.org_id;
$http.get('/sys/orgs/'+$scope.org.org_id + '/extract/search', {params: params}).then(function (resp) { $http.get('/sys/orgs/' + $scope.org.org_id + '/extract/search', {params: params}).then(function (resp) {
$scope.client_extarct = resp.data.data; $scope.client_extarct = resp.data.data;
$scope.paginationc = resp.data.pagination; $scope.paginationc = resp.data.pagination;
@ -713,7 +735,11 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
content: 'This operation will refresh the gateway short id, Are you sure?' content: 'This operation will refresh the gateway short id, Are you sure?'
}).then(function () { }).then(function () {
$http.get('/sys/orgs/' + $scope.org.org_id + '/init/merchant_code').then(function (response) { $http.get('/sys/orgs/' + $scope.org.org_id + '/init/merchant_code').then(function (response) {
commonDialog.alert({title: 'Success', content: "Gateway Short Id Refresh Successfully", type: 'success'}) commonDialog.alert({
title: 'Success',
content: "Gateway Short Id Refresh Successfully",
type: 'success'
})
$scope.org.gateway_short_id = response.data.partner_code; $scope.org.gateway_short_id = response.data.partner_code;
}, function (resp) { }, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
@ -753,14 +779,14 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
}) })
} }
}]); }]);
app.controller('newOrgCtrl', ['$scope', '$http', '$state', 'Upload', 'commonDialog','stateMap', function ($scope, $http, $state, Upload, commonDialog,stateMap) { app.controller('newOrgCtrl', ['$scope', '$http', '$state', 'Upload', 'commonDialog', 'stateMap', function ($scope, $http, $state, Upload, commonDialog, stateMap) {
$scope.types = angular.copy(types); $scope.types = angular.copy(types);
$scope.commission_types = angular.copy(commission_types); $scope.commission_types = angular.copy(commission_types);
$scope.loadSeniorOrg = function () { $scope.loadSeniorOrg = function () {
$http.get('/sys/orgs/senior').then(function (resp) { $http.get('/sys/orgs/senior').then(function (resp) {
$scope.seniorOrgs = resp.data; $scope.seniorOrgs = resp.data;
var senior = {org_id:0,name:'I\'m Senior'} var senior = {org_id: 0, name: 'I\'m Senior'}
var noop = {org_id:-1,name:'noop'} var noop = {org_id: -1, name: 'noop'}
$scope.seniorOrgs.unshift(noop); $scope.seniorOrgs.unshift(noop);
$scope.seniorOrgs.unshift(senior); $scope.seniorOrgs.unshift(senior);
}) })
@ -799,10 +825,10 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
}); });
return; return;
} }
if($scope.org.type == 1){ if ($scope.org.type == 1) {
$scope.org.commission_type = 2; $scope.org.commission_type = 2;
} }
if(($scope.currentUser.role & parseInt('1000000000000', 2)) > 0 && $scope.currentUser.org_id) { if (($scope.currentUser.role & parseInt('1000000000000', 2)) > 0 && $scope.currentUser.org_id) {
$scope.org.parent_org_id = angular.copy($scope.currentUser.org.org_id); $scope.org.parent_org_id = angular.copy($scope.currentUser.org.org_id);
$scope.org.type = '0'; $scope.org.type = '0';
} }
@ -812,8 +838,8 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
content: 'Creation of new organization succeeded', content: 'Creation of new organization succeeded',
type: 'success' type: 'success'
}); });
$state.go('organizations.detail',{orgId:resp.data.org_id},{reload:true}); $state.go('organizations.detail', {orgId: resp.data.org_id}, {reload: true});
},function (resp) { }, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
}) })
}; };
@ -869,7 +895,7 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
}; };
$scope.loadOrgs(); $scope.loadOrgs();
}]); }]);
app.controller('newManagerCtrl', ['$scope', '$http','org',function ($scope, $http,org) { app.controller('newManagerCtrl', ['$scope', '$http', 'org', function ($scope, $http, org) {
$scope.isOrg = true; $scope.isOrg = true;
$scope.org = angular.copy(org); $scope.org = angular.copy(org);
$scope.save = function (form) { $scope.save = function (form) {
@ -883,7 +909,7 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
}); });
return; return;
} }
if(($scope.currentUser.role & parseInt('1000000000000', 2)) > 0 && $scope.currentUser.org_id){ if (($scope.currentUser.role & parseInt('1000000000000', 2)) > 0 && $scope.currentUser.org_id) {
$scope.manager.bd = true; $scope.manager.bd = true;
/* if($scope.manager.org_id2 != "null") { /* if($scope.manager.org_id2 != "null") {
$scope.manager.org_id = $scope.manager.org_id2; $scope.manager.org_id = $scope.manager.org_id2;
@ -905,7 +931,7 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
return arr; return arr;
} }
return arr.filter(function (item) { return arr.filter(function (item) {
return (filterObj.username==null || item.username.indexOf(filterObj.username) >= 0) && (item.role & parseInt(filterObj.role, 2)) > 0 && (!filterObj.org_id || item.org_id==filterObj.org_id) return (filterObj.username == null || item.username.indexOf(filterObj.username) >= 0) && (item.role & parseInt(filterObj.role, 2)) > 0 && (!filterObj.org_id || item.org_id == filterObj.org_id)
}) })
} }
}]); }]);

@ -757,7 +757,21 @@
</div> </div>
</div> </div>
</uib-tab> </uib-tab>
<uib-tab heading="Default Client Profile">
<form name="profileForm" class="form-horizontal">
<div class="form-group" ng-repeat="field in clientProfileFields">
<label class="control-label col-md-3" ng-bind="field.title"></label>
<div class="col-md-7" ng-class="{'checkbox-inline':field.type=='checkbox'}">
<input ng-class="{'checkbox':field.type=='checkbox','form-control':field.type!='checkbox'}"
ng-model="field.value" ng-input-name="{{field.field}}" type="{{field.type}}">
<p ng-if="field.detail" ng-bind="field.detail" class="text-success text-sm"></p>
</div>
</div>
</form>
<button class="btn btn-warning"><i class="fa fa-refresh"></i> Reset</button>
<button class="btn btn-success"><i class="fa fa-check"></i> Submit</button>
</uib-tab>
</uib-tabset> </uib-tabset>
</div> </div>
</div> </div>

Loading…
Cancel
Save