Merge remote-tracking branch 'origin/develop' into develop

master
yixian 6 years ago
commit ecbeff7ef8

@ -33,6 +33,7 @@ import au.com.royalpay.payment.manage.notice.core.NoticePartner;
import au.com.royalpay.payment.manage.openim.core.CustomerServiceService;
import au.com.royalpay.payment.manage.pushMessage.APNSMessageHelper;
import au.com.royalpay.payment.manage.pushMessage.bean.AppManagerMessageBuilder;
import au.com.royalpay.payment.manage.riskbusiness.core.RiskBusinessService;
import au.com.royalpay.payment.manage.riskbusiness.core.RiskProcessLogService;
import au.com.royalpay.payment.manage.riskbusiness.core.RiskUploadService;
import au.com.royalpay.payment.manage.riskbusiness.enums.RiskResultTypeEnum;
@ -182,6 +183,8 @@ public class RetailAppServiceImp implements RetailAppService {
@Resource
private RiskProcessLogService riskProcessLogService;
@Resource
private RiskBusinessService riskBusinessService;
@Resource
private RiskUploadService riskUploadService;
private Map<String, AppMsgSender> senderMap = new HashMap<>();
@ -1871,6 +1874,11 @@ public class RetailAppServiceImp implements RetailAppService {
@Override
public void submitMaterial(JSONObject material, JSONObject device) {
riskUploadService.submitMaterial(material);
JSONObject event = riskBusinessService.getRiskEventDetail(material.getString("risk_id"));
//材料审核通过后可以重新提交
if(event.getIntValue("result_type")==3){
return;
}
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
if (account == null)
account = new JSONObject();

@ -420,6 +420,7 @@ public class BDPrizeServiceImpl implements BDPrizeService {
config.put("manager_id", bdId);
config.put("bd_name", bdUser.getString("display_name"));
config.put("bd_level", info.getIntValue("bd_level"));
config.put("bd_type", info.getIntValue("bd_type"));
config.put("city", info.getString("city"));
config.put("get_prize", info.getBooleanValue("get_prize"));
config.put("bd_group", info.getString("bd_group"));
@ -431,6 +432,7 @@ public class BDPrizeServiceImpl implements BDPrizeService {
config.put("city", info.getString("city"));
config.put("get_prize", info.getBooleanValue("get_prize"));
config.put("bd_group", info.getString("bd_group"));
config.put("bd_type", info.getIntValue("bd_type"));
config.put("last_update_by", manager.getString("display_name"));
config.put("last_update_date", new Date());
financialBDConfigMapper.updateBDConfig(config);

@ -2,12 +2,12 @@ package au.com.royalpay.payment.manage.dev.web;
import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
import au.com.royalpay.payment.manage.support.wechatclients.RedpackWechatApiImpl;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.connections.mpsupport.beans.WxOauthType;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.permission.wechat.WechatMapping;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.globalfreepay.payment.tools.CommonConsts;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@ -0,0 +1,27 @@
package au.com.royalpay.payment.manage.mappers.system;
import cn.yixblog.support.mybatis.autosql.annotations.AdvanceSelect;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
@AutoMapper(tablename = "log_clearing_distributed_surcharge", pkName = "log_id")
public interface ClearingDistributedSurchargeMapper {
List<JSONObject> findTransactions(@Param("client_id") int clientId);
@AutoSql(type = SqlType.INSERT)
void save(JSONObject transactions);
List<JSONObject> getMonthDetailByClientId(@Param("datefrom") Date datefrom, @Param("dateto") Date dateto);
List<JSONObject> findTransactionsByDate(JSONObject params);
}

@ -78,4 +78,8 @@ public interface ClientAccountMapper {
List<JSONObject> query(JSONObject params);
List<JSONObject> partnerAndSubPartnerAccounts(@Param("client_id") int clientId);
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid=1 and (role=1 or role=2) and wechat_openid is not null", excludeColumns = {"salt", "password_hash"})
List<JSONObject> listRiskNoticeAccounts(@Param("client_id") int clientId);
}

@ -0,0 +1,25 @@
package au.com.royalpay.payment.manage.mappers.system;
import cn.yixblog.support.mybatis.autosql.annotations.AdvanceSelect;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@AutoMapper(tablename = "sys_clients_surcharge_accounts", pkName = "client_id")
public interface ClientsSurchargeAccountsMapper {
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid=1")
JSONObject find(@Param("client_id") int clientId);
@AutoSql(type = SqlType.INSERT)
void save(JSONObject surchargeAccount);
@AutoSql(type = SqlType.UPDATE)
void update(JSONObject surchargeAccount);
}

@ -0,0 +1,28 @@
package au.com.royalpay.payment.manage.mappers.system;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
@AutoMapper(tablename = "financial_surcharge_account_detail", pkName = "detail_id")
public interface FinancialSurchargeAccountDetailMapper {
List<JSONObject> findDetailsByMonth(@Param("settle_month") String settle_month);
List<JSONObject> findDetailsByClientId(@Param("client_id") int client_id);
@AutoSql(type = SqlType.INSERT)
void save(JSONObject detail);
List<JSONObject> listSettlementDatesInMonth(@Param("month") String month);
}

@ -65,9 +65,9 @@ public interface ManagerMapper {
List<JSONObject> listServants(@Param("mask") int mask);
@Select("select email from sys_managers where is_valid=1 AND (role & 256 > 0 OR role & 4 > 0) AND email IS NOT NULL")
@Select("select email from sys_managers where is_valid=1 AND (role & 256 > 0 OR role & 4 > 0) AND (org_id = 1 or org_id is null) AND email IS NOT NULL")
List<String> listDevAndBdManager();
@Select("select wx_openid from sys_managers where is_valid=1 AND (role & 256 > 0 OR role & 4 > 0) AND wx_openid IS NOT NULL")
@Select("select wx_openid from sys_managers where is_valid=1 AND (role & 256 > 0 OR role & 4 > 0) AND (org_id = 1 or org_id is null) AND wx_openid IS NOT NULL")
List<String> listDevAndBdOpenId();
}

@ -273,6 +273,20 @@ public interface ClientManager {
void setSkipClearing(JSONObject account,String clientMoniker, Boolean skip_clearing,String remark);
void setSurchargeMode(JSONObject account, String clientMoniker, String surcharge_mode);
JSONObject surchargeAccount(JSONObject account, String clientMoniker);
void setAllowSurchargeCredit(JSONObject account,String clientMoniker, Boolean allow_surcharge_credit);
List<JSONObject> getAccountTransactions(JSONObject account,String clientMoniker);
List<JSONObject> getAccountTransactionsByDate(JSONObject account,String clientMoniker, String date);
List<JSONObject> getAccountMonthDetails(JSONObject account,String clientMoniker);
void saveAccountTransaction(JSONObject account,String clientMoniker, JSONObject transaction);
void enableGatewayUpgrade(JSONObject account,String clientMoniker, boolean gatewayUpgrade);
void enableGatewayAlipayOnline(JSONObject account,String clientMoniker, boolean gatewayAlipayOnline);

@ -45,25 +45,7 @@ import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
import au.com.royalpay.payment.manage.merchants.core.ClientInfoCacheSupport;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.merchants.core.ClientModifySupport;
import au.com.royalpay.payment.manage.merchants.entity.impls.ApproveEmailModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.AuditModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.BDUserModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.ClearDaysModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.CredentialCodeModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.CustomerSurchargeRateModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.DisableModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.EmailModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.GreenChannelModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.MaxOrderAmountModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.OpenStatusModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.OrderExpiryModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.ParentIdModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.PaypadVersionModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.RefundAuditModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.RefundPWDModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.SettleHourModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.SwitchPermissionModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.TimeZoneModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.*;
import au.com.royalpay.payment.manage.notice.core.MailService;
import au.com.royalpay.payment.manage.signin.beans.TodoNotice;
import au.com.royalpay.payment.manage.signin.core.ManagerTodoNoticeProvider;
@ -85,6 +67,7 @@ import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
import au.com.royalpay.payment.tools.exceptions.event.WechatExceptionEvent;
import au.com.royalpay.payment.tools.locale.LocaleSupport;
import au.com.royalpay.payment.tools.lock.Locker;
import au.com.royalpay.payment.tools.mail.SendMail;
import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig;
import au.com.royalpay.payment.tools.merchants.beans.UpdateSurchargeDTO;
@ -149,14 +132,10 @@ import java.math.RoundingMode;
import java.net.URISyntaxException;
import java.net.URL;
import java.security.InvalidParameterException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.TimeZone;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
@ -305,6 +284,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
private RiskAttentionMerchantsMapper riskAttentionMerchantsMapper;
@Resource
private SysChannelConfigMapper sysChannelConfigMapper;
@Resource
private ClientsSurchargeAccountsMapper clientsSurchargeAccountsMapper;
@Resource
private ClearingDistributedSurchargeMapper clearingDistributedSurchargeMapper;
@Resource
private FinancialSurchargeAccountDetailMapper financialSurchargeAccountDetailMapper;
@Resource
private Locker locker;
@Resource
@ -3257,6 +3244,131 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
}
@Override
@Transactional
public void setSurchargeMode(JSONObject account, String clientMoniker, String surcharge_mode) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
clientModifySupport.processClientModify(new SurchargeModeModify(account, clientMoniker, surcharge_mode));
if ("distributed".equals(surcharge_mode)) {
JSONObject surchargeAccount = clientsSurchargeAccountsMapper.find(client.getIntValue("client_id"));
if (surchargeAccount == null) {
JSONObject params = new JSONObject();
params.put("client_id", client.getIntValue("client_id"));
params.put("create_time", new Date());
params.put("is_valid", 1);
params.put("balance", 0);
clientsSurchargeAccountsMapper.save(params);
}
}
}
@Override
public JSONObject surchargeAccount(JSONObject account, String clientMoniker) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
return clientsSurchargeAccountsMapper.find(client.getIntValue("client_id"));
}
@Override
@Transactional
public void setAllowSurchargeCredit(JSONObject account, String clientMoniker, Boolean allow_surcharge_credit) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
clientModifySupport.processClientModify(new SwitchAllowSurchargeCreditModify(account, clientMoniker, "allow_surcharge_credit", allow_surcharge_credit));
}
@Override
public List<JSONObject> getAccountTransactions(JSONObject account, String clientMoniker) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
List<JSONObject> transactions = clearingDistributedSurchargeMapper.findTransactions(client.getIntValue("client_id"));
transactions.forEach(e->{
if ("Credit".equals(e.getString("type"))) {
JSONObject manager = managerMapper.findDetail(e.getString("operation"));
e.put("operator_displayname", manager.getString("display_name"));
}
});
return transactions;
}
@Override
public List<JSONObject> getAccountTransactionsByDate(JSONObject account, String clientMoniker, String date) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
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()));
List<JSONObject> transactions = clearingDistributedSurchargeMapper.findTransactionsByDate(params);
transactions.forEach(e->{
if ("Credit".equals(e.getString("type"))) {
JSONObject manager = managerMapper.findDetail(e.getString("operation"));
e.put("operator_displayname", manager.getString("display_name"));
}
});
return transactions;
}
@Override
public List<JSONObject> getAccountMonthDetails(JSONObject account, String clientMoniker) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
List<JSONObject> details = financialSurchargeAccountDetailMapper.findDetailsByClientId(client.getIntValue("client_id"));
return details;
}
@Override
@Transactional
public void saveAccountTransaction(JSONObject account, String clientMoniker, JSONObject transaction) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
if (!(ManagerRole.ADMIN.hasRole(account.getIntValue("role")) || ManagerRole.OPERATOR.hasRole(account.getIntValue("role")) || ManagerRole.FINANCIAL_STAFF.hasRole(account.getIntValue("role")))) {
throw new ForbiddenException("无法增加充值记录,权限不足");
}
if (!locker.lock(clientMoniker + "_surcharge_account_save", 120_000)) {
throw new ServerErrorException("Processing task, wait for a moment");
}
try {
JSONObject surcharge_account = clientsSurchargeAccountsMapper.find(client.getIntValue("client_id"));
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());
clearingDistributedSurchargeMapper.save(transaction);
surcharge_account.put("balance", surcharge_account.getBigDecimal("balance").add(transaction.getBigDecimal("amount")));
clientsSurchargeAccountsMapper.update(surcharge_account);
} finally {
locker.unlock(clientMoniker + "_surcharge_account_save");
}
}
@Override
public void enableGatewayUpgrade(JSONObject account, String clientMoniker, boolean gatewayUpgrade) {
JSONObject client = getClientInfoByMoniker(clientMoniker);

@ -0,0 +1,30 @@
package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify;
import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import com.alibaba.fastjson.JSONObject;
/**
* Create by yixian at 2018-04-12 16:43
*/
public class SurchargeModeModify extends ClientModify {
private String surcharge_mode;
public SurchargeModeModify(JSONObject account, String clientMoniker, String surcharge_mode) {
super(account, clientMoniker);
this.surcharge_mode = surcharge_mode;
}
@Override
protected String business() {
return "切换商户清算模式(surcharge_mode)";
}
@Override
protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject();
modify.put("surcharge_mode", surcharge_mode);
return modify;
}
}

@ -0,0 +1,32 @@
package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify;
import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import com.alibaba.fastjson.JSONObject;
/**
* Create by yixian at 2018-04-12 16:43
*/
public class SwitchAllowSurchargeCreditModify extends ClientModify {
private String key;
private boolean value;
public SwitchAllowSurchargeCreditModify(JSONObject account, String clientMoniker, String key, boolean value) {
super(account, clientMoniker);
this.key = key;
this.value = value;
}
@Override
protected String business() {
return (value?"开启 ":"关闭 ")+key;
}
@Override
protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject();
modify.put(key, value);
return modify;
}
}

@ -370,6 +370,40 @@ public class PartnerManageController {
clientManager.setSkipClearing(manager,clientMoniker, skip_clearing.getBooleanValue("skip_clearing"),skip_clearing.getString("remark"));
}
@ManagerMapping(value = "/{clientMoniker}/surcharge_mode", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR})
public void updateSurchargeMode(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker, @RequestBody JSONObject surcharge_mode) {
clientManager.setSurchargeMode(manager, clientMoniker, surcharge_mode.getString("surcharge_mode"));
}
@ManagerMapping(value = "/{clientMoniker}/surcharge_account", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR})
public JSONObject surchargeAccount(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker) {
return clientManager.surchargeAccount(manager, clientMoniker);
}
@ManagerMapping(value = "/{clientMoniker}/allow_surcharge_credit", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR})
public void allowSurchargeCredit(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker, @RequestBody JSONObject allow_surcharge_credit) {
clientManager.setAllowSurchargeCredit(manager, clientMoniker, allow_surcharge_credit.getBooleanValue("allow_surcharge_credit"));
}
@ManagerMapping(value = "/{clientMoniker}/account/transactions", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR})
public List<JSONObject> accountTransactions(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker) {
return clientManager.getAccountTransactions(manager, clientMoniker);
}
@ManagerMapping(value = "/{clientMoniker}/account/transactions/date", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR})
public List<JSONObject> accountTransactionsByDate(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker,@RequestParam String date) {
return clientManager.getAccountTransactionsByDate(manager, clientMoniker, date);
}
@ManagerMapping(value = "/{clientMoniker}/account/save", method = RequestMethod.POST, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR})
public void saveAccountTransaction(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker, @RequestBody JSONObject transaction) {
clientManager.saveAccountTransaction(manager, clientMoniker, transaction);
}
@ManagerMapping(value = "/{clientMoniker}/surcharge_account/month_detail", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR})
public List<JSONObject> surchargeAccountMonthDetail(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker) {
return clientManager.getAccountMonthDetails(manager, clientMoniker);
}
@ManagerMapping(value = "/{clientMoniker}/settle_hour", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.SERVANT, ManagerRole.FINANCIAL_STAFF})
public void configSettleHour(@PathVariable String clientMoniker, @RequestBody JSONObject config, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.configSettleHour(manager, clientMoniker, config.getInteger("hour"));

@ -7,6 +7,7 @@ import au.com.royalpay.payment.manage.merchants.beans.ClientRegisterInfo;
import au.com.royalpay.payment.manage.merchants.beans.NewAccountBean;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.merchants.core.ClientSignEventSupport;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.manage.permission.manager.PartnerMapping;
import au.com.royalpay.payment.manage.permission.manager.RequirePartner;
import au.com.royalpay.payment.manage.support.wechatclients.KangaLandWechatApiImpl;
@ -20,6 +21,7 @@ import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.http.HttpUtils;
import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
import au.com.royalpay.payment.tools.permission.wechat.WechatMapping;
@ -164,6 +166,26 @@ public class PartnerViewController {
clientManager.toggleAccountReceiveNotice(account.getString("client_moniker"), account.getString("account_id"), enable.getBooleanValue("enable"));
}
@PartnerMapping(value = "/{clientMoniker}/order_expiry_config", method = RequestMethod.PUT)
@ResponseBody
public void setOrderExpiryConfig(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account,@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setOrderExpiryConfig(account,clientMoniker, config.getString("order_expiry_config"));
}
@PartnerMapping(value = "/{clientMoniker}/surcharge_account", method = RequestMethod.GET, roles = {PartnerRole.ADMIN, PartnerRole.MANAGER})
@ResponseBody
public JSONObject surchargeAccount(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject manager, @PathVariable String clientMoniker) {
return clientManager.surchargeAccount(manager, clientMoniker);
}
@PartnerMapping(value = "/{clientMoniker}/account/transactions", method = RequestMethod.GET, roles = {PartnerRole.ADMIN, PartnerRole.MANAGER})
@ResponseBody
public List<JSONObject> accountTransactions(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject manager, @PathVariable String clientMoniker) {
return clientManager.getAccountTransactions(manager, clientMoniker);
}
@PartnerMapping(value = "/accounts/{accountId}/audit_refund", method = RequestMethod.PUT, roles = PartnerRole.ADMIN)
@ResponseBody
public void toggleAccountAuditRefund(@PathVariable String accountId, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account, @RequestBody JSONObject enable) {

@ -65,7 +65,14 @@ public interface RiskBusinessService {
*
* @param params
*/
void updateRiskEvent(JSONObject params);
void updateRiskEvent(JSONObject params,JSONObject manager);
/**
*
* @param params
* @param channel
*/
void sendWxMess(JSONObject params, String channel, int result_type);
/**
* zip

@ -11,9 +11,7 @@ import au.com.royalpay.payment.manage.mappers.riskbusiness.RiskEventMapper;
import au.com.royalpay.payment.manage.mappers.riskbusiness.RiskFileMapper;
import au.com.royalpay.payment.manage.mappers.riskbusiness.RiskMaterialMapper;
import au.com.royalpay.payment.manage.mappers.riskbusiness.RiskOrdersMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientDeviceTokenMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientBDMapper;
import au.com.royalpay.payment.manage.mappers.system.*;
import au.com.royalpay.payment.manage.notice.core.MailService;
import au.com.royalpay.payment.manage.pushMessage.APNSMessageHelper;
import au.com.royalpay.payment.manage.pushMessage.bean.AppManagerMessageBuilder;
@ -26,10 +24,15 @@ import au.com.royalpay.payment.manage.signin.beans.TodoNotice;
import au.com.royalpay.payment.manage.signin.core.ManagerTodoNoticeProvider;
import au.com.royalpay.payment.manage.tradelog.core.TradeLogService;
import au.com.royalpay.payment.manage.riskbusiness.enums.RiskOrderTypeEnum;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider;
import au.com.royalpay.payment.tools.connections.mpsupport.beans.TemplateMessage;
import au.com.royalpay.payment.tools.connections.mpsupport.exceptions.WechatException;
import au.com.royalpay.payment.tools.device.message.AppMessage;
import au.com.royalpay.payment.tools.device.message.AppMsgSender;
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.event.WechatExceptionEvent;
import au.com.royalpay.payment.tools.locale.LocaleSupport;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
@ -49,6 +52,8 @@ import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -72,7 +77,7 @@ import java.util.concurrent.TimeUnit;
* @Date 2018/10/10 10:30
*/
@Service
public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodoNoticeProvider {
public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodoNoticeProvider, ApplicationEventPublisherAware {
private Logger logger = LoggerFactory.getLogger(RiskBusinessServiceImpl.class);
@ -118,6 +123,14 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
@Resource
private APNSMessageHelper apnsMessageHelper;
@Resource
private ManagerMapper managerMapper;
@Resource
private ClientAccountMapper clientAccountMapper;
@Resource
private MpWechatApiProvider mpWechatApiProvider;
private ApplicationEventPublisher publisher;
@Resource
public void setAppMsgSenders(AppMsgSender[] senders) {
@ -138,13 +151,14 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
if (manager != null && ManagerRole.BD_USER.hasRole(manager.getIntValue("role"))) {
params.put("bd_id", manager.getString("manager_id"));
List<Integer> orderTypes = Arrays.asList(RiskOrderTypeEnum.WECHAT_ORDER.getOrderType(),
RiskOrderTypeEnum.ALIPAY_ORDER.getOrderType());
RiskOrderTypeEnum.ALIPAY_ORDER.getOrderType(),RiskOrderTypeEnum.ROYALPAY_ORDER.getOrderType());
params.put("order_types", orderTypes);
List<Integer> resultTypes = Arrays.asList(RiskResultTypeEnum.SEND_EMAIL_TO_BD.getResultType(),
RiskResultTypeEnum.WAIT_FOR_AUDIT.getResultType(),
RiskResultTypeEnum.MATERIAL_AUDIT_PASS.getResultType(),
RiskResultTypeEnum.MATERIAL_NOT_PASS.getResultType());
RiskResultTypeEnum.MATERIAL_NOT_PASS.getResultType(),
RiskResultTypeEnum.ALREADY_HANDLED.getResultType());
params.put("result_types", resultTypes);
}
@ -276,7 +290,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
JSONObject client = null;
String clientMoniker = params.getString("client_moniker");
if (clientMoniker != null) {
client = clientMapper.findClientByMoniker(clientMoniker);
client = clientMapper.findClientByMonikerAll(clientMoniker);
if(client == null){
throw new InvalidShortIdException();
}
@ -361,11 +375,127 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
}
@Override
public void updateRiskEvent(JSONObject params) {
public void updateRiskEvent(JSONObject params,JSONObject manager) {
if(StringUtils.isNotBlank(params.getString("channel_result"))){
JSONObject risk = riskEventMapper.findById(params.getString("risk_id"));
//填写渠道处理结果时候,支付宝、微信和内部调单在材料审核通过前无法填写渠道处理结果
if(params.getIntValue("result_type") < RiskResultTypeEnum.MATERIAL_AUDIT_PASS.getResultType() && params.getIntValue("order_type") < RiskOrderTypeEnum.WARNING_ORDER.getOrderType()){
throw new BadRequestException("请先提交渠道方材料进行审核!");
}
//渠道处理结果不一样,才会记录操作并更改事件单状态为渠道方处理结果
if(risk.getString("channel_result")==null || !risk.getString("channel_result").equals(params.getString("channel_result"))){
params.put("result_type",RiskResultTypeEnum.ALREADY_HANDLED.getResultType());
riskProcessLogService.addRiskProcessLog(params.getString("risk_id"),
manager.getString("manager_id"),
manager.getString("display_name"),
RiskResultTypeEnum.ALREADY_HANDLED.getRemark() + ":"+ params.getString("channel_result"),
params.getIntValue("result_type"),
RiskResultTypeEnum.ALREADY_HANDLED.getResultType());
}
}
params = getEvent(params);
riskEventMapper.update(params);
riskOrdersMapper.clearOrders(params.getString("risk_id"));
setRiskOrders(params);
}
@Override
public void sendWxMess(JSONObject params, String channel, int result_type) {
String type = "禁用";
if (params.get("temporary_close_merchant") != null) {
if (params.getBoolean("temporary_close_merchant")) {
type = "临时禁用";
}
}
if (params.get("temporary_close_channel") != null) {
if (params.getBoolean("temporary_close_channel")) {
type = "临时禁用";
}
}
String clientMoniker = params.getString("client_moniker");
if (clientMoniker == null) {
return;
}
JSONObject client = clientMapper.findClientByMonikerAll(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
client.put("close_type", type);
client.put("result_type", result_type);
client.put("channel", channel);
String bd_id = client.getString("bd_user");
String[] bdIdArray = bd_id.split(",");
for (String bdId : bdIdArray) {
JSONObject bd = managerMapper.findById(bdId);
if (bd != null) {
if (bd.get("wx_openid")!=null){
if (StringUtils.isNotBlank(bd.getString("wx_openid"))) {
try {
MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi();
TemplateMessage msg = initSendBDCloseChannelAndPartnerTemplate(bd.getString("wx_openid"), paymentApi.getTemplateId("risk-forbidden-channelAndPartner"),client);
paymentApi.sendTemplateMessage(msg);
} catch (WechatException e) {
logger.error("Wechat Message Error,风控关闭通道" + e.getMessage());
publisher.publishEvent(new WechatExceptionEvent(this, e, "风控关闭通道"));
}
}
}
}
}
List<JSONObject> accounts = clientAccountMapper.listRiskNoticeAccounts(client.getIntValue("client_id"));
if (accounts != null) {
for (JSONObject account : accounts) {
if (account.get("wechat_openid")!=null){
if (StringUtils.isNotBlank(account.getString("wechat_openid"))) {
try {
MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi();
TemplateMessage msg = initSendPartnerCloseChannelAndPartnerTemplate(account.getString("wechat_openid"), paymentApi.getTemplateId("risk-forbidden-channelAndPartner"),client);
paymentApi.sendTemplateMessage(msg);
} catch (WechatException e) {
logger.error("Wechat Message Error,风控关闭通道" + e.getMessage());
publisher.publishEvent(new WechatExceptionEvent(this, e, "风控关闭通道"));
}
}
}
}
}
}
private TemplateMessage initSendBDCloseChannelAndPartnerTemplate(String wxopenid, String templateId,JSONObject client) {
TemplateMessage msg = new TemplateMessage(wxopenid, templateId,null);
//1:关闭渠道;2:关闭商户
if (client.getIntValue("result_type") == 1) {
msg.put("first", "您的商户("+client.getString("client_moniker")+")" + client.getString("channel") + "支付渠道已"+client.getString("close_type"), "#000000");
}else {
msg.put("first", "您的商户("+client.getString("client_moniker")+")已"+client.getString("close_type"), "#000000");
}
msg.put("keyword1", client.getString("channel") + "风控调单", "#0000ff");
msg.put("keyword2", DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"), "#000000");
msg.put("remark", "请联系商户尽快配合风控部门上传相应资料,以免影响支付", "#0000FF");
return msg;
}
private TemplateMessage initSendPartnerCloseChannelAndPartnerTemplate(String wxopenid, String templateId,JSONObject client) {
TemplateMessage msg = new TemplateMessage(wxopenid, templateId,null);
//1:关闭渠道;2:关闭商户
if (client.getIntValue("result_type") == 1) {
msg.put("first", "您的商户" + client.getString("channel") + "支付渠道已"+client.getString("close_type"), "#000000");
}else {
msg.put("first", "您的商户("+client.getString("client_moniker")+")已"+client.getString("close_type"), "#000000");
}
msg.put("keyword1", client.getString("channel") + "风控调单", "#0000ff");
msg.put("keyword2", DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"), "#000000");
msg.put("remark", "请尽快配合风控部门上传相应资料,以免影响支付", "#0000FF");
return msg;
}
@Override
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
this.publisher = applicationEventPublisher;
}
/**
@ -1104,7 +1234,8 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
@Override
public JSONObject riskEventMaterialPass(JSONObject params, JSONObject manager) {
Integer resultType = params.getInteger("result_type");
if (!resultType.equals(RiskResultTypeEnum.WAIT_FOR_AUDIT.getResultType())) {
//有些商户会直接回复邮件,未通过平台渠道
if (!resultType.equals(RiskResultTypeEnum.WAIT_FOR_AUDIT.getResultType()) && !resultType.equals(RiskResultTypeEnum.SEND_EMAIL_TO_BD.getResultType())) {
throw new BadRequestException("Can't Pass");
}
params.put("result_type", RiskResultTypeEnum.MATERIAL_AUDIT_PASS.getResultType());

@ -47,7 +47,7 @@ public class RiskUploadServiceIpml implements RiskUploadService {
String riskId = material.getString("risk_id");
JSONObject event = riskEventMapper.findById(riskId);
Integer resultType = event.getInteger("result_type");
if (!resultType.equals(RiskResultTypeEnum.SEND_EMAIL_TO_BD.getResultType()) && !resultType.equals(RiskResultTypeEnum.MATERIAL_NOT_PASS.getResultType())) {
if (!resultType.equals(RiskResultTypeEnum.SEND_EMAIL_TO_BD.getResultType()) && !resultType.equals(RiskResultTypeEnum.MATERIAL_NOT_PASS.getResultType()) && !resultType.equals(RiskResultTypeEnum.MATERIAL_AUDIT_PASS.getResultType())) {
throw new BadRequestException("Committed Already");
}
material.put("update_time", DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
@ -67,8 +67,15 @@ public class RiskUploadServiceIpml implements RiskUploadService {
}
}
}
event.put("result_type", RiskResultTypeEnum.WAIT_FOR_AUDIT.getResultType());
riskEventMapper.update(event);
if(event.getIntValue("result_type")!= RiskResultTypeEnum.MATERIAL_AUDIT_PASS.getResultType()){
event.put("result_type", RiskResultTypeEnum.WAIT_FOR_AUDIT.getResultType());
riskEventMapper.update(event);
}
//材料审核通过的保持原状态
// if(event.getIntValue("result_type")== RiskResultTypeEnum.MATERIAL_AUDIT_PASS.getResultType()){
// event.put("result_type", RiskResultTypeEnum.MATERIAL_AUDIT_PASS.getResultType());
// riskEventMapper.update(event);
// }
}
@Override

@ -19,9 +19,9 @@ public enum RiskResultTypeEnum {
"风控事件已创建",
"已发送邮件,资料完善中",
"资料已提交,等待审核",
"材料审核通过",
"风控初审完成,已提交渠道方审核",
"材料打回",
"已处理"
"渠道方处理结果"
};
RiskResultTypeEnum(Integer resultType) {

@ -86,8 +86,8 @@ public class RiskBusinessController {
}
@PutMapping(value = "events")
public void UpdateRiskEvent(@RequestBody JSONObject params) {
riskBusinessService.updateRiskEvent(params);
public void UpdateRiskEvent(@RequestBody JSONObject params,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
riskBusinessService.updateRiskEvent(params,manager);
}
@PutMapping(value = "events/pass")
@ -131,9 +131,13 @@ public class RiskBusinessController {
@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.switchChannelPermission(manager, params.getString("client_moniker"), channel, channelFlag);
if (channelFlag)
if (channelFlag) {
params.put("result_type", RiskResultTypeEnum.ALREADY_HANDLED.getResultType());
riskBusinessService.updateRiskEvent(params);
} else {
//1:禁用渠道;2:禁用商户
riskBusinessService.sendWxMess(params, channel, 1);
}
riskBusinessService.updateRiskEvent(params,manager);
}
@PutMapping(value = "/partner/{isValid}")
@ -143,6 +147,7 @@ public class RiskBusinessController {
String clientMoniker = params.getString("client_moniker");
if (isValid) {
clientManager.disableClient(clientMoniker, manager);
riskBusinessService.sendWxMess(params, "-", 2);
Integer temporaryCloseMerchant = params.getInteger("temporary_close_merchant");
if (temporaryCloseMerchant != 1) {
params.put("result_type", RiskResultTypeEnum.ALREADY_HANDLED.getResultType());
@ -152,7 +157,7 @@ public class RiskBusinessController {
clientManager.revertClient(clientMoniker, manager);
params.put("result_type", RiskResultTypeEnum.ALREADY_HANDLED.getResultType());
}
riskBusinessService.updateRiskEvent(params);
riskBusinessService.updateRiskEvent(params,manager);
}
@RequestMapping(value = "/{risk_id}/urge",method = RequestMethod.PUT)

@ -51,6 +51,11 @@ public class RiskFileUploadController {
@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
// riskUploadService.checkUploadMailKey(codeKey, material.getString("risk_id"));
riskUploadService.submitMaterial(material);
JSONObject event = riskBusinessService.getRiskEventDetail(material.getString("risk_id"));
//材料可以重新提交
if(event.getIntValue("result_type")==3){
return;
}
riskProcessLogService.addRiskProcessLog(material.getString("risk_id"),
manager.getString("manager_id"),
manager.getString("display_name"),

@ -32,6 +32,7 @@ public class WepayWechatApiImpl extends AbstractMpWechatClientApi implements MpW
registerTemplateId("daily-green-channel", "vjeNnggHnnRHvBP80lkEEtPk8ouf7JnvrQYDCyxqx4g");
registerTemplateId("client-postpone", "5eNJ5ZTKWitC1TJClb2coymtNCmOC7d86h0zCrxmGig");
registerTemplateId("test-merchant-password","cF_zIhB4VmjdOaDS2_RNVFforyywsKcfjS1yNNgYmWw");
registerTemplateId("risk-forbidden-channelAndPartner","g79Sf5FOQT6PoCvRVzm7YlgtzbZ_EUD1z6E4Xp2Jwp4");
}
@Override

@ -0,0 +1,14 @@
package au.com.royalpay.payment.manage.surchargeAccount.core;
import com.alibaba.fastjson.JSONObject;
import java.util.Date;
import java.util.List;
public interface SurchargeAccountService {
void generatorMonthDetail();
List<JSONObject> listSettledDatesInMonth(String mon);
}

@ -0,0 +1,66 @@
package au.com.royalpay.payment.manage.surchargeAccount.core.impl;
import au.com.royalpay.payment.manage.mappers.system.ClearingDistributedSurchargeMapper;
import au.com.royalpay.payment.manage.mappers.system.FinancialSurchargeAccountDetailMapper;
import au.com.royalpay.payment.manage.surchargeAccount.core.SurchargeAccountService;
import au.com.royalpay.payment.manage.system.core.impl.ClientContractServiceImpl;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@Service
public class SurchargeAccountServiceImpl implements SurchargeAccountService{
@Resource
private ClearingDistributedSurchargeMapper clearingDistributedSurchargeMapper;
@Resource
private FinancialSurchargeAccountDetailMapper financialSurchargeAccountDetailMapper;
Logger logger = LoggerFactory.getLogger(ClientContractServiceImpl.class);
@Override
@Transactional
public void generatorMonthDetail(){
Calendar monthCal = Calendar.getInstance();
monthCal.setTime(new Date());
monthCal.set(Calendar.DAY_OF_MONTH, 1);
monthCal.set(Calendar.HOUR_OF_DAY, 0);
monthCal.set(Calendar.MINUTE, 0);
monthCal.set(Calendar.SECOND, 0);
Date dateto = monthCal.getTime();
monthCal.set(Calendar.MONTH, (monthCal.get(Calendar.MONTH) - 1));
Date datefrom = monthCal.getTime();
logger.info("===============Start generator surcharge account month detail===============" + new Date());
List<JSONObject> thisMonthDetail = clearingDistributedSurchargeMapper.getMonthDetailByClientId(datefrom, dateto);
logger.info("this month details : " + thisMonthDetail.toString());
for (JSONObject detail : thisMonthDetail) {
detail.put("send_mail", 0);
detail.put("wx_send", 0);
detail.put("settle_month", DateFormatUtils.format(datefrom, "yyyy-MM"));
detail.put("create_time", new Date());
financialSurchargeAccountDetailMapper.save(detail);
}
logger.info("===============generator OVER===============" + new Date());
}
@Override
public List<JSONObject> listSettledDatesInMonth(String mon) {
List<JSONObject> settledDates = financialSurchargeAccountDetailMapper.listSettlementDatesInMonth(mon);
return settledDates;
}
}

@ -0,0 +1,30 @@
package au.com.royalpay.payment.manage.surchargeAccount.web;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.manage.surchargeAccount.core.SurchargeAccountService;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@RequestMapping("/sys/surcharge_account")
@RestController
public class SurchargeAccountController {
@Resource
private SurchargeAccountService surchargeAccountService;
@ManagerMapping(value = "/month/{month}/settled_dates", role = {ManagerRole.ADMIN,ManagerRole.OPERATOR}, method = RequestMethod.GET)
public List<JSONObject> surchargeAccountSettledDates(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String month) {
return surchargeAccountService.listSettledDatesInMonth(month);
}
}

@ -0,0 +1,27 @@
package au.com.royalpay.payment.manage.task;
import au.com.royalpay.payment.manage.surchargeAccount.core.SurchargeAccountService;
import au.com.royalpay.payment.tools.scheduler.SynchronizedScheduler;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@Component
@ConditionalOnProperty(value = "app.run-tasks", havingValue = "true")
public class SurchargeAccountMonthTask {
@Resource
private SynchronizedScheduler synchronizedScheduler;
@Resource
private SurchargeAccountService surchargeAccountService;
@Scheduled(cron = "0 30 6 1 * ?")
public void generateSurchargeAccountDetail() {
synchronizedScheduler.executeProcess("manage_task:generateSurchargeAccountMonth", 120_000, () ->
surchargeAccountService.generatorMonthDetail());
}
}

@ -11,6 +11,7 @@
c.get_prize,
c.bd_group,
c.kpi_amount,
c.bd_type,
m.is_valid
FROM sys_managers m
LEFT JOIN financial_bd_config c ON c.manager_id = m.manager_id

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="au.com.royalpay.payment.manage.mappers.system.ClearingDistributedSurchargeMapper">
<select id="getMonthDetailByClientId" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT d.client_id,c.client_moniker,c.company_name,
SUM(IF(d.type='Credit',amount,0)) credit_amount,
SUM(IF(d.type='Debit',amount,0)) debit_amount
FROM log_clearing_distributed_surcharge d INNER JOIN sys_clients c ON c.client_id=d.client_id
WHERE d.create_time >=#{datefrom} AND d.create_time < #{dateto}
AND c.is_valid= 1
GROUP BY d.client_id
]]>
</select>
<select id="findTransactions" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT * FROM log_clearing_distributed_surcharge WHERE client_id = #{client_id}
ORDER BY create_time DESC
]]>
</select>
<select id="findTransactionsByDate" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT * FROM log_clearing_distributed_surcharge WHERE client_id = #{client_id}
AND year(create_time) = #{year}
AND month(create_time) = #{month}
ORDER BY create_time DESC
]]>
</select>
</mapper>

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="au.com.royalpay.payment.manage.mappers.system.FinancialSurchargeAccountDetailMapper">
<select id="findDetailsByMonth" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT d.*,c.client_moniker,c.short_name,c.company_name
FROM financial_surcharge_account_detail d INNER JOIN sys_clients c ON c.client_id=d.client_id
WHERE d.settle_month = #{settle_month}
]]>
</select>
<select id="findDetailsByClientId" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT d.*,c.client_moniker,c.short_name,c.company_name
FROM financial_surcharge_account_detail d INNER JOIN sys_clients c ON c.client_id=d.client_id
WHERE d.client_id = #{client_id} ORDER BY create_time desc
]]>
</select>
<select id="listSettlementDatesInMonth" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT d.*,c.client_moniker,c.short_name,c.company_name,s.balance
FROM financial_surcharge_account_detail d INNER JOIN sys_clients c ON c.client_id=d.client_id
LEFT JOIN sys_clients_surcharge_accounts s ON s.client_id = d.client_id
WHERE d.settle_month= #{month}
ORDER BY s.balance ASC
]]>
</select>
</mapper>

@ -132,7 +132,7 @@
<li class="user-footer">
<!--Customer Service: <br/>-->
<i class="fa fa-phone" aria-hidden="true"></i> 1300-10-77-50 <br/>
<i class="fa fa-envelope-o" aria-hidden="true"></i> support@royalpay.com.au<br/>
<i class="fa fa-envelope-o" aria-hidden="true"></i> info@royalpay.com.au<br/>
<i class="fa fa-clock-o" aria-hidden="true"></i> Mon-Fri (9:00am-5:30pm)
</li>
</ul>
@ -202,7 +202,7 @@
}
</style>
<span style="font-size: smaller"> ( <i class="fa fa-phone" aria-hidden="true"></i> 1300-10-77-50 |
<i class="fa fa-envelope-o" aria-hidden="true"></i> support@royalpay.com.au |
<i class="fa fa-envelope-o" aria-hidden="true"></i> info@royalpay.com.au |
WeChat <i class="fa fa-qrcode" aria-hidden="true" tooltip-class="customClass" uib-tooltip-html="'<img src=static/images/customer_service.jpg>'"></i> )
</span>
</footer>

@ -208,7 +208,7 @@ margin-bottom: 10%;"/>
<li class="user-footer">
&lt;!&ndash;Customer Service: <br/>&ndash;&gt;
<i class="fa fa-phone" aria-hidden="true"></i> 1300-10-77-50 <br/>
<i class="fa fa-envelope-o" aria-hidden="true"></i> support@royalpay.com.au<br/>
<i class="fa fa-envelope-o" aria-hidden="true"></i> info@royalpay.com.au<br/>
<i class="fa fa-clock-o" aria-hidden="true"></i> Mon-Fri (9:00am-5:30pm)
</li>
</ul>
@ -456,7 +456,7 @@ margin-bottom: 10%;"/>
}
</style>
<span style="font-size: smaller"> ( <i class="fa fa-phone" aria-hidden="true"></i> 1300-10-77-50 |
<i class="fa fa-envelope-o" aria-hidden="true"></i> support@royalpay.com.au |
<i class="fa fa-envelope-o" aria-hidden="true"></i> info@royalpay.com.au |
WeChat <i class="fa fa-qrcode" aria-hidden="true" tooltip-class="customClass" uib-tooltip-html="'<img src=static/images/customer_service.jpg>'"></i> )
</span>
</footer>
@ -683,7 +683,7 @@ margin-bottom: 10%;"/>
<li class="user-footer">
&lt;!&ndash;Customer Service: <br/>&ndash;&gt;
<i class="fa fa-phone" aria-hidden="true"></i> 1300-10-77-50 <br/>
<i class="fa fa-envelope-o" aria-hidden="true"></i> support@royalpay.com.au<br/>
<i class="fa fa-envelope-o" aria-hidden="true"></i> info@royalpay.com.au<br/>
<i class="fa fa-clock-o" aria-hidden="true"></i> Mon-Fri (9:00am-5:30pm)
</li>
</ul>
@ -796,7 +796,7 @@ margin-bottom: 10%;"/>
<li class="user-footer">
<!--Customer Service: <br/>-->
<i class="fa fa-phone" aria-hidden="true"></i> 1300-10-77-50 <br/>
<i class="fa fa-envelope-o" aria-hidden="true"></i> support@royalpay.com.au<br/>
<i class="fa fa-envelope-o" aria-hidden="true"></i> info@royalpay.com.au<br/>
<i class="fa fa-clock-o" aria-hidden="true"></i> Mon-Fri (9:00am-5:30pm)
</li>
</ul>
@ -899,6 +899,15 @@ margin-bottom: 10%;"/>
</li>
</ul>
</li>
<li ng-if="([1,2]|withRole)">
<ul>
<li>
<a ui-sref="surcharge_account">
<!--<i class="fa fa-users" aria-hidden="true"></i> -->Surcharge Account
</a>
</li>
</ul>
</li>
<li ng-if="([1]|withRole)">
<ul>
<li>
@ -1063,7 +1072,7 @@ margin-bottom: 10%;"/>
}
</style>
<span style="font-size: smaller"> ( <i class="fa fa-phone" aria-hidden="true"></i> 1300-10-77-50 |
<i class="fa fa-envelope-o" aria-hidden="true"></i> support@royalpay.com.au |
<i class="fa fa-envelope-o" aria-hidden="true"></i> info@royalpay.com.au |
WeChat <i class="fa fa-qrcode" aria-hidden="true" tooltip-class="customClass" uib-tooltip-html="'<img src=static/images/customer_service2.jpg>'"></i> )
</span>
</footer>

@ -603,6 +603,11 @@ margin-bottom: 10%;"/>
<i class="fa fa-tv"></i> <span>商户欠款|Pre Refund</span>
</a>
</li>
<li ui-sref-active="active">
<a ui-sref="surcharge_account_month">
<i class="fa fa-bell"></i> <span>手续费账户月度统计</span>
</a>
</li>
</ul>
</li>

@ -14,7 +14,8 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
var orderTypesMapForBD = {
"1": "微信调单",
"2": "支付宝调单"
"2": "支付宝调单",
"3": "RoyalPay调单"
};
var royalpayOrderTypesMap = {
@ -31,7 +32,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
"0": "未处理",
"1": "已发送邮件",
"2": "已提交材料,等待审核",
"3": "材料审核通过",
"3": "风控初审完成,已提交渠道方审核",
"4": "材料审核不通过,已打回",
"5": "已处理"
};
@ -40,7 +41,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
"0": "未处理",
"1": "资料完善中",
"2": "等待风控",
"3": "材料通过",
"3": "风控初审完成,已提交渠道方审核",
"4": "材料打回",
"5": "已处理"
};
@ -48,7 +49,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
var resultTypeSearchMapForBD = {
"1": "材料待上传",
"2": "材料已提交",
"3": "材料通过",
"3": "风控初审完成,已提交渠道方审核",
"4": "材料打回",
"5": "已处理"
};
@ -517,7 +518,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
};
// BD是否可上传
$scope.uploadShowFlag = ($scope.riskEvent.result_type == 1 || $scope.riskEvent.result_type == 4) ? true : false;
$scope.uploadShowFlag = ($scope.riskEvent.result_type == 1 || $scope.riskEvent.result_type == 3 || $scope.riskEvent.result_type == 4) ? true : false;
//if (!$scope.uploadShowFlag)
$scope.loadRiskMaterial();
}
@ -557,7 +558,8 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
};
$scope.loadRiskMaterial();
$scope.uploadShowFlag = ($scope.riskEvent.result_type == 1 || $scope.riskEvent.result_type == 4) ? true : false;
//审核通过也要可以传图片
$scope.uploadShowFlag = ($scope.riskEvent.result_type == 1 || $scope.riskEvent.result_type == 3 || $scope.riskEvent.result_type == 4) ? true : false;
// 材料上传
$scope.uploadFile = function(files, index) {

@ -15,7 +15,7 @@
<i class="fa fa-cloud-download">一键下载</i>
</a>
<a class="btn-group btn btn-success pull-right"
ng-if="riskEvent.result_type == 2"
ng-if="riskEvent.result_type == 2 || riskEvent.result_type == 1"
ng-click="auditMaterial(3)">通过
</a>
<a class="btn-group btn btn-warning pull-right"

@ -538,20 +538,20 @@
for="channel-result-input">Channel Handle Result
</label>
<div class="col-sm-8">
<!--
<input class="form-control"
<textarea class="form-control"
ng-model="riskEventEdit.channel_result"
type="text"
name="description"
id="channel-result-input">
-->
<select class="form-control"
name="channel_result"
ng-model="riskEventEdit.channel_result"
id="channel-result-input"
ng-options="item for item in channelResults">
<option value="">Please Choose</option>
</select>
name="channel_result"
id="channel-result-input"/>
<!--<select class="form-control"-->
<!--name="channel_result"-->
<!--ng-model="riskEventEdit.channel_result"-->
<!--id="channel-result-input"-->
<!--ng-options="item for item in channelResults">-->
<!--<option value="">Please Choose</option>-->
<!--</select>-->
</div>
</div>
</div>

@ -1,6 +1,15 @@
<div class="content">
<div class="row">
<div class="col-sm-12">
<div class="box-body table-responsive pad">
<small ng-repeat="log in riskEvent.process_logs">
<div class="btn-group-vertical" style="margin-top: 5px">
<button type="button" class="btn btn-xs btn-primary" ng-class="{'btn-danger': log.result_type_to == 4, 'btn-success': log.result_type_to == 3, 'btn-warning': log.result_type_to == 1}">{{log.remark}}</button>
<button type="button" class="btn btn-xs btn-primary" ng-class="{'btn-danger': log.result_type_to == 4, 'btn-success': log.result_type_to == 3, 'btn-warning': log.result_type_to == 1}">{{log.operator}} | {{log.create_time}}</button>
</div>
<i class="fa fa-arrow-right" aria-hidden="true" style="margin-top: 5px" ng-if="riskEvent.process_logs.length > ($index + 1)"></i>
</small>
</div>
<!-- 调单信息 -->
<div class="box">
<div class="box-header">

@ -75,6 +75,7 @@ var modules = [
{path: 'static/payment/cashiers/cashier-manage', module: 'cashierManagement', roles: [1, 2, 3]},
{path: 'static/application/clientAuthentication', module: 'clientAuthentication', roles: [1]},
{path: 'static/cashback/partner-cashback', module: 'cashbackApp', roles: [1,2,3]},
{path: 'static/payment/surchargeaccount/partner-surcharge-account', module: 'surchargeAccountApp', roles: [1,2,3]},
{path: 'static/integralmall/coupon_cancellation', module: 'couponCancellation', roles: [1,2]},
{path: 'static/invoice/invoice_assistant', module: 'partnerInvoice', roles: [1]},
{path: 'static/payment/billqrcode/bill-qrcode-manage', module: 'billQrCodeManagement', roles: [1,2,3]}

@ -432,9 +432,9 @@ define(['angular', 'angularSanitize', 'angularAnimate', 'angularMessages', 'uiRo
return function (gateway) {
switch (gateway + '') {
case '0':
return '线下码';
return '线下C端付款码';
case '1':
return '线下码';
return '线下B端二维码';
case '2':
return '商户静态码';
case '3':
@ -442,9 +442,9 @@ define(['angular', 'angularSanitize', 'angularAnimate', 'angularMessages', 'uiRo
case '4':
return 'WeChat HTML5';
case '5':
return '线下网关';
return '线下网关(C端付款码)';
case '6':
return '线下网关';
return '线下网关(B端二维码)';
case '7':
return '商户静态码';
case '8':

@ -449,9 +449,9 @@ define(['angular', 'angularSanitize', 'angularAnimate', 'angularMessages', 'uiRo
return function (gateway) {
switch (gateway + '') {
case '0':
return '线下码';
return '线下C端付款码';
case '1':
return '线下码';
return '线下B端二维码';
case '2':
return '商户静态码';
case '3':
@ -459,9 +459,9 @@ define(['angular', 'angularSanitize', 'angularAnimate', 'angularMessages', 'uiRo
case '4':
return 'WeChat HTML5';
case '5':
return '线下网关';
return '线下网关(C端付款码)';
case '6':
return '线下网关';
return '线下网关(B端二维码)';
case '7':
return '商户静态码';
case '8':

@ -127,6 +127,7 @@ define(['angular', '../../analysis/bd/analysis-bd'], function (angular) {
$scope.editBDLevels = function () {
$uibModal.open({
templateUrl: '/static/config/bdprize/templates/bd_level_config_dialog.html',
size: 'lg',
controller: 'bdLevelConfigCtrl'
})
};
@ -194,7 +195,7 @@ define(['angular', '../../analysis/bd/analysis-bd'], function (angular) {
}
}]);
app.controller('bdLevelConfigCtrl', ['$scope', '$http', function ($scope, $http) {
$scope.bdtypes = [{id: 1, label: 'BD Manager(Sydney)'}, {id: 2, label: 'KA Manager(Sydney)'},{id: 6, label: 'BD Manager(Melbourne)'}, {id: 7, label: 'KA Manager(Melbourne)'}];
$scope.getBDGroups = function () {
$http.get('/sys/manager_accounts/roles/bd_leader').then(function (resp) {
$scope.bdgroups = resp.data;
@ -220,7 +221,7 @@ define(['angular', '../../analysis/bd/analysis-bd'], function (angular) {
app.controller('bdCommissionConfigCtrl', ['$scope', '$state', '$http', '$filter', 'monModal', function ($scope, $state, $http, $filter, monModal) {
$scope.monModal = monModal;
$scope.params = {year: new Date().getFullYear()};
$scope.bdtypes = [{id: 1, label: 'BD Manager'}, {id: 2, label: 'KA Manager'}, {id: 3, label: 'Sydney GM'},{id: 4, label: 'COO'},{id: 5, label: 'NJ Department'}];
$scope.bdtypes = [{id: 1, label: 'BD Manager(Sydney)'}, {id: 2, label: 'KA Manager(Sydney)'}, {id: 6, label: 'BD Manager(Melbourne)'}, {id: 7, label: 'KA Manager(Melbourne)'}];//, {id: 3, label: 'Sydney GM'},{id: 4, label: 'COO'},{id: 5, label: 'NJ Department'}];
// $scope.bdmon;
// $scope.newSwitch;
$scope.initMonth = function (year) {

@ -82,7 +82,7 @@
<li>未完成月度指标,当月部门提成为该部门总流水的 0.005%</li>
</ul>
</div>
<div class="box-header with-border">
<!--<div class="box-header with-border">
<h6 class="intro_color">悉尼分公司总经理</h6>
</div>
<div class="box-body">
@ -107,7 +107,7 @@
<ul class="small">
<li>完成 KPI 按照 0.03%提取;未完成 KPI 按照 0.02%提取</li>
</ul>
</div>
</div>-->
</div>
</div>

@ -10,6 +10,7 @@
<th>BD Level</th>
<th>Get Prize</th>
<th>BD Group</th>
<th>BD Type</th>
</tr>
</thead>
<tbody>
@ -32,6 +33,9 @@
<select class="form-control" ng-options="bdleader.manager_id as bdleader.display_name for bdleader in bdgroups" ng-model="bd.bd_group"
ng-change="updateBDLevel(bd)"></select>
</td>
<td ng-if="bdleader.manager_id == bd.manager_id" ng-repeat="bdleader in bdgroups">
<select class="form-control"ng-options="bdtype.id as bdtype.label for bdtype in bdtypes" ng-model="bd.bd_type" ng-change="updateBDLevel(bd)"></select>
</td>
</tr>
</tbody>
</table>

@ -209,45 +209,45 @@
</div>
</div>
</div>-->
<div class="box box-success">
<div class="box-header">Sydney GM Commission</div>
<div class="box-body">
<div class="row">
<div class="col-xs-6 col-sm-6">
Transaction Amount: <span ng-bind="report.sydneyPrizeLog.total_amount|currency:'AUD '"></span>
</div>
<div class="col-xs-6 col-sm-6">
Total Commission: <span ng-bind="report.sydneyPrizeLog.total_prize|currency:'AUD '"></span>
</div>
</div>
</div>
</div>
<div class="box box-success">
<div class="box-header">NJ Department Commission</div>
<div class="box-body">
<div class="row">
<div class="col-xs-6 col-sm-6">
Transaction Amount: <span ng-bind="report.ngDepartmentPrizeLog.total_amount|currency:'AUD '"></span>
</div>
<div class="col-xs-6 col-sm-6">
Total Commission: <span ng-bind="report.ngDepartmentPrizeLog.total_prize|currency:'AUD '"></span>
</div>
</div>
</div>
</div>
<div class="box box-success">
<div class="box-header">COO Commission</div>
<div class="box-body">
<div class="row">
<div class="col-xs-6 col-sm-6">
Transaction Amount: <span ng-bind="report.directPrizeLogs.total_amount|currency:'AUD '"></span>
</div>
<div class="col-xs-6 col-sm-6">
Total Commission: <span ng-bind="report.directPrizeLogs.total_prize|currency:'AUD '"></span>
</div>
</div>
</div>
</div>
<!--<div class="box box-success">-->
<!--<div class="box-header">Sydney GM Commission</div>-->
<!--<div class="box-body">-->
<!--<div class="row">-->
<!--<div class="col-xs-6 col-sm-6">-->
<!--Transaction Amount: <span ng-bind="report.sydneyPrizeLog.total_amount|currency:'AUD '"></span>-->
<!--</div>-->
<!--<div class="col-xs-6 col-sm-6">-->
<!--Total Commission: <span ng-bind="report.sydneyPrizeLog.total_prize|currency:'AUD '"></span>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--<div class="box box-success">-->
<!--<div class="box-header">NJ Department Commission</div>-->
<!--<div class="box-body">-->
<!--<div class="row">-->
<!--<div class="col-xs-6 col-sm-6">-->
<!--Transaction Amount: <span ng-bind="report.ngDepartmentPrizeLog.total_amount|currency:'AUD '"></span>-->
<!--</div>-->
<!--<div class="col-xs-6 col-sm-6">-->
<!--Total Commission: <span ng-bind="report.ngDepartmentPrizeLog.total_prize|currency:'AUD '"></span>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--<div class="box box-success">-->
<!--<div class="box-header">COO Commission</div>-->
<!--<div class="box-body">-->
<!--<div class="row">-->
<!--<div class="col-xs-6 col-sm-6">-->
<!--Transaction Amount: <span ng-bind="report.directPrizeLogs.total_amount|currency:'AUD '"></span>-->
<!--</div>-->
<!--<div class="col-xs-6 col-sm-6">-->
<!--Total Commission: <span ng-bind="report.directPrizeLogs.total_prize|currency:'AUD '"></span>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--<div class="box-header">Manager Commission</div>-->
<!--<div class="box-body table-responsive">-->
<!--<table class="table table-bordered table-hover table-striped">-->

@ -12,14 +12,14 @@
<div class="box box-default">
<div class="box-body">
<div class="form-inline">
<div class="form-group">
<input type="text" class="form-control" uib-datepicker-popup="yyyy-MM" ng-model="generate.month"
is-open="ctrl.genmonth" datepicker-options="{minMode: 'month'}"
ng-click="ctrl.genmonth=true" placeholder="Select Month"/>
</div>
<button class="btn btn-primary" ng-click="generateReport()" ng-disabled="!generate.month">
Generate Report
</button>
<!--<div class="form-group">-->
<!--<input type="text" class="form-control" uib-datepicker-popup="yyyy-MM" ng-model="generate.month"-->
<!--is-open="ctrl.genmonth" datepicker-options="{minMode: 'month'}"-->
<!--ng-click="ctrl.genmonth=true" placeholder="Select Month"/>-->
<!--</div>-->
<!--<button class="btn btn-primary" ng-click="generateReport()" ng-disabled="!generate.month">-->
<!--Generate Report-->
<!--</button>-->
<button class="btn btn-primary" ng-click="editRateConfig()"><i class="fa fa-cog"></i> Edit Rate Config</button>
<button class="btn btn-primary" ng-click="editBDLevels()"><i class="fa fa-user"></i> Edit BD Level</button>
<loadingbar ng-if="generate.status"></loadingbar>

@ -2,7 +2,7 @@
<img src="static/images/customer_service2.jpg">
<div class="caption" style="padding-left: 20px">
<i class="fa fa-phone" aria-hidden="true"></i> 1300-10-77-50 <br/>
<i class="fa fa-envelope-o" aria-hidden="true"></i> support@royalpay.com.au<br/>
<i class="fa fa-envelope-o" aria-hidden="true"></i> info@royalpay.com.au<br/>
<i class="fa fa-clock-o" aria-hidden="true"></i> Mon-Fri (9:00am-5:30pm)
</div>
</div>

@ -334,6 +334,7 @@
</div>
</div>
<div class="col-sm-2 col-xs-6">
<a ui-sref="rate_warnings" ui-sref-opts="{reload:true}">
<div class="description-block">
@ -810,6 +811,16 @@
</div>
</a>
</div>
<div class="col-sm-2 col-xs-6">
<a ui-sref="surcharge_account_month" ui-sref-opts="{reload:true}">
<div class="description-block">
<img src="/static/images/main_menu/transaction_arrears_green.png"/>
<div class="description-text">
<span>手续费账户月度统计</span>
</div>
</div>
</a>
</div>
</div>
</div>
<div class="list-group" ng-if="role=='accountant' || role=='director' || ('1000000000'|withRole)">

@ -163,6 +163,15 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
return $stateParams.clientMoniker;
}]
}
}).state('partners.detail.surcharge_account', {
url: '/surcharge_account',
templateUrl: '/static/payment/partner/templates/partner_surcharge_account.html',
controller: 'partnerSurchargeAccountCtrl',
resolve: {
clientMoniker: ['$stateParams', function ($stateParams) {
return $stateParams.clientMoniker;
}]
}
}).state('partners.detail.product', {
url: '/partner_product',
templateUrl: 'static/payment/product/templates/product.html',
@ -1957,13 +1966,54 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}]);
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};
$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;
$scope.bankCtrl.edit = false;
});
};
$scope.switchSurchargeMode = function () {
if ($scope.partner.surcharge_mode == "balance") {
commonDialog.confirm({
title: 'Warning',
content: '启用收支分离模式清算将使消费者支付手续费模式失效,请确认是否切换?'
}).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();
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
})
})
}else {
commonDialog.confirm({
title: 'Warning',
content: '请确认是否切换成净值清算模式?'
}).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) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
})
})
}
}
$scope.getBalance = function () {
$scope.surcharge = {};
if ($scope.partner.surcharge_mode != undefined && $scope.partner.surcharge_mode == "distributed") {
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/surcharge_account').then(function (resp) {
$scope.surcharge = resp.data;
})
}
};
$scope.getBalance();
$scope.getBankAccount();
$scope.getRates = function () {
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/rates').then(function (resp) {
@ -2005,8 +2055,38 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
});
})
}
};
$scope.surchargeAccountDetail = function () {
$uibModal.open({
templateUrl: '/static/payment/surchargeaccount/templates/partner_surcharge_account_dialog.html',
controller: 'surchargeAccountDetailCtrl',
size: 'lg',
resolve: {
balance: function () {
return $scope.surcharge;
},
partner: function () {
return $scope.partner;
},
transactions: ['$http', function ($http) {
return $http.get('/sys/partners/' + $scope.partner.client_moniker + '/account/transactions');
}]
}
}).result.then(function () {
$scope.getBalance();
}, function () {
$scope.getBalance();
});
};
$scope.allowSurchargeCredit = function (allowSurchargeCredit) {
if (!$scope.init.allow_surcharge_credit) {
$scope.init.allow_surcharge_credit = true;
return;
}
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/allow_surcharge_credit', {allow_surcharge_credit: allowSurchargeCredit}).then(function (resp) {
})
};
$scope.taxInSurcharge = function (taxInSurcharge) {
if (!$scope.init.tax_in_surcharge) {
@ -2120,6 +2200,51 @@ 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) {
$scope.surcharge = angular.copy(balance);
$scope.transactions = angular.copy(transactions.data);
$scope.partner = angular.copy(partner);
$scope.canAddDetail = false;
$scope.params = {};
$scope.getBalance = function () {
if ($scope.partner.surcharge_mode != undefined && $scope.partner.surcharge_mode == "distributed") {
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/surcharge_account').then(function (resp) {
$scope.surcharge = resp.data;
})
}
};
$scope.getTransactions = function () {
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/account/transactions').then(function (resp) {
$scope.transactions = resp.data;
});
}
$scope.addDetail = function () {
$scope.canAddDetail = true;
};
$scope.cancel = function () {
$scope.canAddDetail = false;
$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) {
$scope.getTransactions();
$scope.getBalance();
$scope.canAddDetail = false;
$scope.params = {};
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
});
}
}]);
app.controller('newRateDialogCtrl', ['$scope', '$http', 'rate', 'sys_common_rate', 'clientMoniker', function ($scope, $http, rate, sys_common_rate, clientMoniker) {
$scope.rate = angular.copy(rate);
$scope.sysRateConfig = angular.copy(sys_common_rate.data);
@ -3222,6 +3347,75 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
};
$scope.chooseLast7Days();
}]);
app.controller('partnerSurchargeAccountCtrl', ['$scope', '$uibModal', '$http', 'clientMoniker', '$filter', function ($scope, $uibModal, $http, clientMoniker, $filter) {
$scope.params = {};
$scope.pagination = {};
$scope.today = new Date();
$scope.chooseToday = function () {
$scope.params.datefrom = $scope.params.dateto = new Date();
$scope.loadSettlementLogs(1);
};
$scope.chooseYesterday = function () {
var yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
$scope.params.datefrom = $scope.params.dateto = yesterday;
$scope.loadSettlementLogs(1);
};
$scope.chooseLast7Days = function () {
$scope.params.dateto = new Date();
var day = new Date();
day.setDate(day.getDate() - 7);
$scope.params.datefrom = day;
$scope.loadSettlementLogs(1);
};
$scope.thisMonth = function () {
$scope.params.dateto = new Date();
var monthBegin = new Date();
monthBegin.setDate(1);
$scope.params.datefrom = monthBegin;
$scope.loadSettlementLogs(1);
};
$scope.lastMonth = function () {
var monthFinish = new Date();
monthFinish.setDate(0);
$scope.params.dateto = monthFinish;
var monthBegin = new Date();
monthBegin.setDate(0);
monthBegin.setDate(1);
$scope.params.datefrom = monthBegin;
$scope.loadSettlementLogs(1);
};
$scope.loadSettlementLogs = function (page) {
var params = angular.copy($scope.params);
if (params.datefrom) {
params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd');
}
if (params.dateto) {
params.dateto = $filter('date')(params.dateto, 'yyyyMMdd');
}
params.page = page || $scope.pagination.page || 1;
params.limit = 10;
$http.get('/sys/partners/' + clientMoniker + '/surcharge_account/month_detail').then(function (resp) {
$scope.details = resp.data;
});
};
$scope.getClearingTransactions = function (client_id, detail_id) {
$uibModal.open({
templateUrl: '/static/analysis/templates/settlement_transactions.html',
controller: 'managerSettlementDetailCtrl',
resolve: {
detail: ['$http', '$stateParams', function ($http) {
return $http.get('/analysis/partner_card/' + client_id + '/settlement_logs/' + detail_id);
}],
detail_id:detail_id
},
size: 'lg'
});
};
$scope.chooseLast7Days();
}]);
app.controller('managerSettlementDetailCtrl', ['$scope', 'detail','detail_id','$http', function ($scope, detail,detail_id,$http) {
$scope.ctrl = {channel: null};
$scope.show = true;

@ -576,8 +576,8 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload'], funct
}
};
$scope.clientCopyYeepayLink = function() {
var e=document.getElementById("c-cpyeepay");
$scope.clientCopyCBBannkPayLink = function() {
var e=document.getElementById("c-cpcbbankpay");
e.select();
var successful = document.execCommand("Copy");
if (successful) {
@ -594,6 +594,13 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload'], funct
};
$scope.ctrl = {};
$scope.reloadQRCode();
$scope.clientSaveOrderExpiryConfig = function (config) {
$http.put('/client/partner_info/' + $scope.partner.client_moniker + '/order_expiry_config', {order_expiry_config: config}).then(function () {
$scope.ctrl.editOrderExpiryConfig = false;
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
})
};
$scope.changePaymentPage = function () {
if (!$scope.paymentInfo) {
return;

@ -84,6 +84,31 @@
</div>
<div class="panel-body">
<div class="form-horizontal">
<div class="form-group">
<label class="control-label col-sm-2">Order Expiry Config</label>
<div class="col-sm-10">
<p ng-if="!ctrl.editOrderExpiryConfig" class="form-control-static">
{{paymentInfo.order_expiry_config||'Not Configure'}}
<a role="button" ng-click="ctrl.editOrderExpiryConfig=true" ng-if="'01'|withRole"><i
class="fa fa-edit"></i></a> <span style="font-size:9px;padding-left: 40px">示例5m(5分钟,最大支持1440m) / 1h(1小时,最大24小时)</span>
</p>
<div class="input-group" ng-if="ctrl.editOrderExpiryConfig">
<input type="text" class="form-control" ng-model="paymentInfo.order_expiry_config"
title="Prevent not enough refund">
<div class="input-group-btn">
<button class="btn btn-success"
ng-click="clientSaveOrderExpiryConfig(paymentInfo.order_expiry_config)">
<i class="fa fa-check"></i>
</button>
</div>
<div class="input-group-btn">
<button class="btn btn-danger" ng-click="ctrl.editOrderExpiryConfig=false">
<i class="fa fa-remove"></i>
</button>
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">Gateway Credential</label>
<div class="col-sm-10">
@ -188,26 +213,26 @@
</div>
</div>
<div class="panel panel-default" ng-if="partner.enable_yeepay&&partner.yeepay_pay_url">
<div class="panel-heading">Yeepay Link
<div class="panel panel-default" ng-if="partner.enable_cb_bankpay&&partner.enable_cb_bankpay_link">
<div class="panel-heading">CB Bank Pay
</div>
<div class="panel-body">
<div class="form-horizontal">
<div class="form-group">
<label class="control-label col-sm-2">Yeepay Link</label>
<label class="control-label col-sm-2">CB Bank Pay Link</label>
<div class="col-sm-10">
<a href={{partner.yeepay_pay_url}} target="_Blank">
<span class="form-control-static">{{partner.yeepay_pay_url}}
<span class="form-control-static">{{partner.cb_bankpay_url}}
</span>
</a>
<i class="fa fa-clipboard margin-r-5" style="cursor: pointer" ng-click="clientCopyYeepayLink()"></i>
<input style="opacity: 0" id="c-cpyeepay" value={{partner.yeepay_pay_url}} readonly>
<i class="fa fa-clipboard margin-r-5" style="cursor: pointer" ng-click="clientCopyCBBannkPayLink()"></i>
<input style="opacity: 0" id="c-cpcbbankpay" value={{partner.cb_bankpay_url}} readonly>
</div>
</div>
<div class="form-group" style="display: flex">
<label class="col-sm-2 control-label">Yeepay QR Code</label>
<label class="col-sm-2 control-label">CB Bank Pay QR Code</label>
<div style="text-align: center">
<img ng-src="{{partner.yeepayQrcodeUrl}}" class="img-responsive" />
<img ng-src="{{partner.cbBankPayQrcodeUrl}}" class="img-responsive" />
<span style="font-size:9px;">仅支持微信客户端扫描</span>
</div>

@ -13,6 +13,37 @@
</a>
</h3>
<div class="form-horizontal">
<div class="form-group" ng-if="partner.surcharge_mode=='distributed'">
<label class="col-sm-4">手续费账户余额</label>
<div class="col-sm-6" style="font-size: 25px">
<p>{{surcharge.balance|currency:'AUD'}}<i class="fa fa-bars" style="font-size: 15px;color: #3c8dbc;cursor: pointer;padding-left: 15px" ng-click="surchargeAccountDetail()"></i></p>
</div>
</div>
<div class="form-group" ng-if="partner.surcharge_mode=='distributed'">
<label class="col-sm-4">允许手续费账户欠款</label>
<div class="col-sm-6">
<input type="checkbox" ng-model="partner.allow_surcharge_credit" bs-switch
switch-change="allowSurchargeCredit(partner.allow_surcharge_credit)">
</div>
</div>
<div class="form-group">
<label class="col-sm-4">Surcharge Mode</label>
<div class="col-sm-6">
<p>
<span ng-if="partner.surcharge_mode=='balance'">balance
<i class="fa fa-sort" style="color: #3c8dbc;cursor: pointer" ng-click="switchSurchargeMode()"></i>
</span>
<span ng-if="partner.surcharge_mode=='distributed'">distributed
<i class="fa fa-sort" style="color: #3c8dbc;cursor: pointer" ng-click="switchSurchargeMode()"></i>
</span>
<p class="text-info">
<i class="fa fa-info"></i>启用到收支分离(distributed)模式,将使消费者支付手续费模式失效<br>
</p>
</p>
</div>
</div>
<div class="form-group" ng-if="'modify_tax_in_surcharge'|withFunc">
<label class="col-sm-4">RoyalPay Pay GST</label>
<div class="col-sm-6">

@ -256,6 +256,11 @@
<li ui-sref-active="active" ng-if="partner.show_all_permission && partner.is_valid==1">
<a ui-sref=".settlement({clientMoniker:partner.client_moniker})">Settlement</a>
</li>
<li ui-sref-active="active" ng-if="partner.show_all_permission && partner.is_valid==1 && partner.surcharge_mode=='distributed'">
<a ui-sref=".surcharge_account({clientMoniker:partner.client_moniker})">Surcharge Account</a>
</li>
<li ui-sref-active="active" ng-if="partner.show_all_permission && partner.is_valid==1">
<a ui-sref=".product">Product</a>
</li>

@ -156,7 +156,7 @@
</div>
</div>
<div class="form-group" ng-if="('100000000'|withRole)">
<div class="form-group">
<label class="col-sm-3 control-label">Order Expiry Config</label>
<div class="col-sm-9">
<p ng-if="!ctrl.editOrderExpiryConfig" class="form-control-static">

@ -0,0 +1,111 @@
<div class="content">
<div class="row">
<div class="col-md-12">
<div class="box-solid">
<!--<div class="box box-warning">-->
<!--<div class="box-header">-->
<!--<div class="row">-->
<!--<div class="col-sm-12">-->
<!--&lt;!&ndash;<div class="form-horizontal">&ndash;&gt;-->
<!--&lt;!&ndash;<div class="form-group col-xs-12">&ndash;&gt;-->
<!--&lt;!&ndash;<label class="control-label col-xs-4 col-sm-2">Date Range</label>&ndash;&gt;-->
<!--&lt;!&ndash;<div class="col-sm-10 col-xs-8">&ndash;&gt;-->
<!--&lt;!&ndash;<div class="form-control-static form-inline">&ndash;&gt;-->
<!--&lt;!&ndash;<div style="display: inline-block">&ndash;&gt;-->
<!--&lt;!&ndash;<input class="form-control" id="date-from-input"&ndash;&gt;-->
<!--&lt;!&ndash;ng-model="params.datefrom"&ndash;&gt;-->
<!--&lt;!&ndash;uib-datepicker-popup size="10" placeholder="From"&ndash;&gt;-->
<!--&lt;!&ndash;is-open="dateBegin.open" ng-click="dateBegin.open=true"&ndash;&gt;-->
<!--&lt;!&ndash;datepicker-options="{maxDate:params.dateto||today}">&ndash;&gt;-->
<!--&lt;!&ndash;</div>&ndash;&gt;-->
<!--&lt;!&ndash;~&ndash;&gt;-->
<!--&lt;!&ndash;<div style="display: inline-block">&ndash;&gt;-->
<!--&lt;!&ndash;<input class="form-control" id="date-to-input"&ndash;&gt;-->
<!--&lt;!&ndash;ng-model="params.dateto"&ndash;&gt;-->
<!--&lt;!&ndash;uib-datepicker-popup size="10" placeholder="To"&ndash;&gt;-->
<!--&lt;!&ndash;is-open="dateTo.open" ng-click="dateTo.open=true"&ndash;&gt;-->
<!--&lt;!&ndash;datepicker-options="{minDate:params.datefrom,maxDate:today}">&ndash;&gt;-->
<!--&lt;!&ndash;</div>&ndash;&gt;-->
<!--&lt;!&ndash;<div class="btn-group">&ndash;&gt;-->
<!--&lt;!&ndash;<a role="button" class="btn btn-default btn-sm"&ndash;&gt;-->
<!--&lt;!&ndash;ng-click="chooseToday()">Today</a>&ndash;&gt;-->
<!--&lt;!&ndash;</div>&ndash;&gt;-->
<!--&lt;!&ndash;<div class="btn-group">&ndash;&gt;-->
<!--&lt;!&ndash;<a role="button" class="btn btn-default btn-sm"&ndash;&gt;-->
<!--&lt;!&ndash;ng-click="chooseYesterday()">Yesterday</a>&ndash;&gt;-->
<!--&lt;!&ndash;</div>&ndash;&gt;-->
<!--&lt;!&ndash;<div class="btn-group">&ndash;&gt;-->
<!--&lt;!&ndash;<a role="button" class="btn btn-default btn-sm"&ndash;&gt;-->
<!--&lt;!&ndash;ng-click="chooseLast7Days()">Last 7 Days</a>&ndash;&gt;-->
<!--&lt;!&ndash;</div>&ndash;&gt;-->
<!--&lt;!&ndash;<div class="btn-group">&ndash;&gt;-->
<!--&lt;!&ndash;<a role="button" class="btn btn-default btn-sm"&ndash;&gt;-->
<!--&lt;!&ndash;ng-click="thisMonth()">This Month</a>&ndash;&gt;-->
<!--&lt;!&ndash;</div>&ndash;&gt;-->
<!--&lt;!&ndash;<div class="btn-group">&ndash;&gt;-->
<!--&lt;!&ndash;<a role="button" class="btn btn-default btn-sm"&ndash;&gt;-->
<!--&lt;!&ndash;ng-click="lastMonth()">Last Month</a>&ndash;&gt;-->
<!--&lt;!&ndash;</div>&ndash;&gt;-->
<!--&lt;!&ndash;</div>&ndash;&gt;-->
<!--&lt;!&ndash;</div>&ndash;&gt;-->
<!--&lt;!&ndash;</div>&ndash;&gt;-->
<!--&lt;!&ndash;<button class="btn btn-success" type="button" ng-click="loadSettlementLogs(1)">&ndash;&gt;-->
<!--&lt;!&ndash;<i class="fa fa-search"></i> Search&ndash;&gt;-->
<!--&lt;!&ndash;</button>&ndash;&gt;-->
<!--&lt;!&ndash;</div>&ndash;&gt;-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<div class="box box-warning">
<div class="box-header">
<h3 class="box-title">Surcharge Account Details</h3>
</div>
<div class="box-body table-responsive">
<table class="table table-bordered table-hover table-striped">
<thead>
<tr>
<th>Client Moniker</th>
<th>Settle Date</th>
<th>Credit Amount</th>
<th>Debit Amount</th>
<th>Create_time</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="log in details">
<td ng-bind="log.client_moniker"></td>
<td ng-bind="log.settle_month"></td>
<td ng-bind="log.credit_amount|currency:'AUD'"></td>
<td ng-bind="log.debit_amount|currency:'AUD'"></td>
<td ng-bind="log.create_time"></td>
</tr>
</tbody>
</table>
</div>
<div class="panel-footer" ng-if="settlementLogs.length">
<uib-pagination class="pagination"
total-items="pagination.totalCount"
boundary-links="true"
ng-model="pagination.page"
items-per-page="pagination.limit"
max-size="10"
ng-change="loadSettlementLogs()"
previous-text="&lsaquo;"
next-text="&rsaquo;"
first-text="&laquo;"
last-text="&raquo;"></uib-pagination>
<div class="row">
<div class="col-xs-12">Total Records:{{pagination.totalCount}};Total
Pages:{{pagination.totalPages}}
</div>
</div>
</div>
<!-- /.box-footer -->
</div>
</div>
</div>
</div>
</div>

@ -0,0 +1,149 @@
/**
* Created by yishuqian on 01/06/2017.
*/
define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], function (angular) {
'use strict';
var colors = ['#00c0ef', '#00a65a', '#ff851b', '#f39c12', '#d81b60', '#605ca8', '#dd4b39', '#008080', '#8B008B', '#D2691E', '#708090'];
var app = angular.module('surchargeAccountApp', ['ui.bootstrap', 'ui.router', 'ngEcharts']);
app.config(['$stateProvider', function ($stateProvider) {
$stateProvider.state('surcharge_account', {
url: '/surcharge_account',
templateUrl: '/static/payment/surchargeaccount/templates/client_surcharge_account.html',
resolve: {
partner: ['$http', function ($http) {
return $http.get('/client/partner_info');
}]
},
controller: 'clientSurchargeAccountCtrl'
}).state('surcharge_account_month', {
url: '/surcharge_account_month',
templateUrl: '/static/payment/surchargeaccount/templates/account_month_logs.html',
controller: 'surchargeAccountMonthCtrl'
})
}]);
app.controller('clientSurchargeAccountCtrl', ['$scope', '$http','$state','$filter', 'commonDialog','partner', function ($scope, $http,$state,$filter, commonDialog, partner) {
$scope.partner = angular.copy(partner.data);
$scope.getBalance = function () {
$scope.surcharge = {};
if ($scope.partner.surcharge_mode != undefined && $scope.partner.surcharge_mode == "distributed") {
$http.get('/client/partner_info/' + $scope.partner.client_moniker + '/surcharge_account').then(function (resp) {
$scope.surcharge = resp.data;
})
}
};
$scope.getTransactions = function () {
$http.get('/client/partner_info/' + $scope.partner.client_moniker + '/account/transactions').then(function (resp) {
$scope.transactions = resp.data;
})
}
$scope.getBalance();
$scope.getTransactions();
}]);
app.controller('surchargeAccountMonthCtrl', ['$scope', '$http', '$filter', '$timeout', '$uibModal', 'commonDialog', 'chartParser',
function ($scope, $http, $filter, $timeout, $uibModal, commonDialog, chartParser) {
$scope.params = {year: new Date().getFullYear()};
$scope.availableYears = [new Date().getFullYear() - 1, new Date().getFullYear()];
$scope.initMonth = function (year) {
$scope.params.year = year;
$scope.months = [];
for (var i = 1; i < 13; i++) {
var mon = '00' + i;
mon = mon.substr(mon.length - 2, 2);
$scope.months.push(year + '-' + mon);
}
};
$scope.initMonth(new Date().getFullYear());
$scope.hasReport = function (mon) {
var start = '2017-02';//todo modify in different country
var end = $filter('date')(new Date().setMonth(new Date().getMonth()-1), 'yyyy-MM');
return start <= mon && end >= mon
};
$scope.loadReport = function (mon) {
$http.get('/sys/surcharge_account/month/' + mon + '/settled_dates').then(function (resp) {
$scope.report = {
month: mon,
details: resp.data
};
})
};
$scope.surchargeAccountDetail = function (client_moniker,mon) {
$uibModal.open({
templateUrl: '/static/payment/surchargeaccount/templates/partner_surcharge_account_dialog.html',
controller: 'accountDetailCtrl',
size: 'lg',
resolve: {
client_moniker: function () {
return client_moniker;
},
month: function () {
return mon;
},
transactions: ['$http', function ($http) {
return $http.get('/sys/partners/' + client_moniker + '/account/transactions/date?date='+mon);
}]
}
}).result.then(function () {
$scope.loadReport($scope.report.month);
}, function () {
$scope.loadReport($scope.report.month);
});
};
}]);
app.controller('accountDetailCtrl', ['$scope','$http','transactions','client_moniker','commonDialog','month', function ($scope, $http, transactions,client_moniker,commonDialog,month) {
$scope.transactions = angular.copy(transactions.data);
$scope.canAddDetail = false;
$scope.params = {};
$scope.month = angular.copy(month);
$scope.getBalance = function () {
$http.get('/sys/partners/' + client_moniker + '/surcharge_account').then(function (resp) {
$scope.surcharge = resp.data;
})
};
$scope.getBalance();
$scope.getTransactions = function () {
$http.get('/sys/partners/' + client_moniker + '/account/transactions/date?date=' + $scope.month).then(function (resp) {
$scope.transactions = resp.data;
});
}
$scope.addDetail = function () {
$scope.canAddDetail = true;
};
$scope.cancel = function () {
$scope.canAddDetail = false;
$scope.params = {};
}
$scope.save = function () {
$http.post('/sys/partners/' + client_moniker + '/account/save', {amount:$scope.params.amount,remark:$scope.params.remark}).then(function (resp) {
$scope.getTransactions();
$scope.getBalance();
$scope.canAddDetail = false;
$scope.params = {};
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
});
}
}]);
return app;
});

@ -0,0 +1,76 @@
<section class="content-header">
<h1>Surcharge Account Detail</h1>
<ol class="breadcrumb">
<li>
<i class="fa fa-sitemap"></i> Compliance
</li>
<li class="active">Surcharge Account Detail</li>
</ol>
</section>
<section class="content">
<div class="box box-default">
<div class="box-header">
<!-- <div uib-dropdown>
<button class="btn btn-primary" uib-dropdown-toggle type="button" ng-bind="params.year"></button>
<ul class="dropdown-menu" uib-dropdown-menu role="menu">
<li ng-repeat="year in availableYears" role="menuitem"><a role="button" ng-click="initMonth(year)" ng-bind="year"></a></li>
</ul>
</div>-->
<div ng-repeat="year in availableYears" style="display: inline">
<button class="btn btn-info"
ng-click="initMonth(year)"
ng-bind="year"
ng-class="{'active':year == params.year}"
></button>
</div>
</div>
<div class="box-body">
<div class="row">
<div class="col-xs-3" ng-repeat="mon in months">
<a class="text-success" role="button" ng-click="loadReport(mon)" ng-if="hasReport(mon)">
<h2 ng-bind="mon.substring(5,7)"></h2>
</a>
<h2 class="text-gray" ng-bind="mon.substring(5,7)" ng-if="!hasReport(mon)"></h2>
</div>
</div>
</div>
</div>
<div class="box box-warning" ng-if="report">
<div class="box-header">
<span ng-bind="report.month"></span>
</div>
<div class="box-body table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>商户编号</th>
<th>Short Name</th>
<th>充值总额</th>
<th>支出总额</th>
<th>余额</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="details in report.details">
<td ng-bind="details.client_moniker"></td>
<td ng-bind="details.short_name"></td>
<td ng-bind="details.credit_amount|currency:'$'" style="color: green"></td>
<td ng-bind="details.debit_amount|currency:'$'" style="color: red"></td>
<td>
<span ng-if="details.balance>=0" style="color: green">{{details.balance|currency:'$'}}</span>
<span ng-if="details.balance<0" style="color: red">{{details.balance|currency:'$'}}</span>
</td>
<td>
<!-- 等待邮件和微信推送模板 -->
<!--<a style="cursor: pointer" > 催款</a>-->
<!--<a style="cursor: pointer" ng-click="showDetail()">充值</a>-->
<i class="fa fa-bars" style="font-size: 15px;color: #3c8dbc;cursor: pointer;padding-left: 15px" ng-click="surchargeAccountDetail(details.client_moniker,details.settle_month)"></i>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</section>

@ -0,0 +1,114 @@
<section class="content-header">
<h1>
Client Surcharge Account
</h1>
<ol class="breadcrumb">
<li class="active"><i class="fa fa-dashboard"></i> Surcharge Account</li>
</ol>
</section>
<div class="content">
<div class="row">
<div class="col-sm-12">
<div class="box-solid">
<div class="box box-warning">
<div class="box-header">
<div class="form-horizontal col-sm-8" style="margin-top: 30px">
<div class="form-group" ng-if="partner.surcharge_mode=='distributed'">
<label class="control-label col-xs-4 col-sm-3">手续费账户余额</label>
<div class="col-sm-6" style="font-size: 25px">
<p>{{surcharge.balance|currency:'AUD'}}</p>
</div>
</div>
<div class="form-group" ng-if="partner.surcharge_mode=='distributed'">
<label class="control-label col-xs-4 col-sm-3">允许手续费账户欠款</label>
<div class="col-sm-6">
<input type="checkbox" ng-model="partner.allow_surcharge_credit" bs-switch
switch-change="allowSurchargeCredit(partner.allow_surcharge_credit)" switch-readonly="true">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-4 col-sm-3" style="padding-top:0px">Surcharge Mode:</label>
<div class="col-xs-8 col-sm-6">
<span class="control-label" ng-bind="partner.surcharge_mode"></span>
<p class="text-info">
<i class="fa fa-info"></i>启用到收支分离(distributed)模式,将使消费者支付手续费模式失效
</p>
</div>
</div>
</div>
<div class="col-sm-4" style="text-align: center" ng-if="code_url">
<a class="thumbnail" download ng-href="{{code_url}}" uib-tooltip="Download">
<img ng-src="{{code_url}}">
</a>
<p>
<a ng-href="{{code_url}}" download><i class="fa fa-download"></i> Download Bill QR
Code Image</a>
</p>
</div>
</div>
</div>
<div class="box">
<div class="box box-default">
<div class="box-header">Credits</div>
<div class="box-body">
<div class="table-responsive col-sm-12">
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th>Num</th>
<th>Create Time</th>
<th>Amount</th>
<th>Remark</th>
<th>Operator</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="tr in transactions|propsFilter:{type:'Credit',create_time:ctrl.day}:true">
<td>{{$index+1}}</td>
<td ng-bind="tr.create_time|date:'yyyy-MM-dd HH:mm:ss'"></td>
<td ng-bind="tr.amount|currency:'AUD'"></td>
<td ng-bind="tr.remark"></td>
<td ng-bind="tr.operator_displayname"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="box box-default">
<div class="box-header">Debits</div>
<div class="box-body">
<div class="table-responsive col-sm-12">
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th>Num</th>
<th>Settle Date</th>
<th>Amount</th>
<th>Total Surcharge</th>
<th>Tax Amount</th>
<th>Remark</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="tr in transactions|propsFilter:{type:'Debit',create_time:ctrl.day}:true">
<td>{{$index+1}}</td>
<td ng-bind="tr.settle_date|date:'yyyy-MM-dd'"></td>
<td ng-bind="tr.amount|currency:'AUD'"></td>
<td ng-bind="tr.total_surcharge|currency:'AUD'"></td>
<td ng-bind="tr.tax_amount|currency:'AUD'"></td>
<td ng-bind="tr.remark"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

@ -0,0 +1,88 @@
<div class="modal-header">
<h4>Surcharge Account Detail{{partner.client_moniker?'('+partner.client_moniker+')':''}}</h4>
</div>
<div class="modal-body">
<div class="box box-warning">
<div class="box-body" style="font-size: 35px;text-align: right">
{{surcharge.balance|currency:'AUD'}}<i class="fa fa-plus-square-o" style="font-size: 15px;padding-left: 15px;cursor: pointer" ng-click="addDetail()"></i>
</div>
</div>
<div class="box box-warning" ng-if="canAddDetail">
<div class="box-body">
<div class="row" style="margin-left: 20px;">
<div class="form-group">
<label>
Amount:
</label>
<input type="number" ng-model="params.amount">
<label>
remark:
</label>
<input type="text" ng-model="params.remark">
<div class="btn-group">
<a class="btn btn-success" role="button" ng-click="save()">Submit</a>
</div>
<div class="btn-group">
<a class="btn btn-danger" ng-click="cancel()" >Cancel</a>
</div>
</div>
</div>
</div>
</div>
<div class="box box-default">
<div class="box-header">Credits</div>
<div class="box-body">
<div class="table-responsive col-sm-12">
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th>Num</th>
<th>Create Time</th>
<th>Amount</th>
<th>Remark</th>
<th>Operator</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="tr in transactions|propsFilter:{type:'Credit'}:true">
<td>{{$index+1}}</td>
<td ng-bind="tr.create_time|date:'yyyy-MM-dd HH:mm:ss'"></td>
<td ng-bind="tr.amount|currency:'AUD'"></td>
<td ng-bind="tr.remark"></td>
<td ng-bind="tr.operator_displayname"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="box box-default">
<div class="box-header">Debits</div>
<div class="box-body">
<div class="table-responsive col-sm-12">
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th>Num</th>
<th>Settle Date</th>
<th>Amount</th>
<th>Total Surcharge</th>
<th>Tax Amount</th>
<th>Remark</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="tr in transactions|propsFilter:{type:'Debit'}:true">
<td>{{$index+1}}</td>
<td ng-bind="tr.settle_date|date:'yyyy-MM-dd'"></td>
<td ng-bind="tr.amount|currency:'AUD'"></td>
<td ng-bind="tr.total_surcharge|currency:'AUD'"></td>
<td ng-bind="tr.tax_amount|currency:'AUD'"></td>
<td ng-bind="tr.remark"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
Loading…
Cancel
Save