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

# Conflicts:
#	src/main/java/au/com/royalpay/payment/manage/settlement/core/impls/ManualSettleSupportImpl.java
master
yixian 7 years ago
commit ba6e50ab5c

@ -315,4 +315,25 @@ ADD COLUMN `globalpay_openid` varchar(100) NULL AFTER `kanga_openid`;
ALTER TABLE act_app_list ADD banner_img VARCHAR(200) NULL COMMENT 'App首页banner图片'; ALTER TABLE act_app_list ADD banner_img VARCHAR(200) NULL COMMENT 'App首页banner图片';
alter table act_app_list add column `msg_start_date` date DEFAULT NULL;
alter table act_app_list add column `msg_end_date` date DEFAULT NULL;
alter table act_app_list add column `msg_interval` smallint(3) DEFAULT NULL;
alter table sys_clients add column `manual_settle` tinyint(1) DEFAULT 0;
create table log_clients_operation(
id varchar(50) not null,
client_id int(11) not null,
operator_id varchar(50) not null comment '操作人者 账户ID',
operator_type SMALLINT (2) not null comment '操作人者类型',
create_time datetime not null,
operation varchar(50) DEFAULT NULL,
PRIMARY key(`id`)
);
alter table act_app_list MODIFY column is_show_window tinyint(1) DEFAULT 0 COMMENT 'app是否弹框' alter table act_app_list MODIFY column is_show_window tinyint(1) DEFAULT 0 COMMENT 'app是否弹框'
alter table sys_clients_contract add column confirm_time datetime DEFAULT null comment '合同确认时间';

@ -4,9 +4,12 @@ import au.com.royalpay.payment.manage.activities.monsettledelay.core.ActMonDelay
import au.com.royalpay.payment.manage.mappers.act.ActAppMapper; import au.com.royalpay.payment.manage.mappers.act.ActAppMapper;
import au.com.royalpay.payment.manage.mappers.act.ActMonDelaySettleMapper; import au.com.royalpay.payment.manage.mappers.act.ActMonDelaySettleMapper;
import au.com.royalpay.payment.manage.mappers.act.ActMonDelaySettleRedPackMapper; import au.com.royalpay.payment.manage.mappers.act.ActMonDelaySettleRedPackMapper;
import au.com.royalpay.payment.manage.mappers.log.ClientsOperationLogMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper; import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.tools.device.DeviceSupport; import au.com.royalpay.payment.tools.device.DeviceSupport;
import au.com.royalpay.payment.tools.env.PlatformEnvironment; import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.env.RequestEnvironment;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException; import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.permission.enums.PartnerRole; import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
@ -17,7 +20,9 @@ import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.springframework.context.MessageSource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -40,12 +45,15 @@ public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService {
private ClientAccountMapper clientAccountMapper; private ClientAccountMapper clientAccountMapper;
@Resource @Resource
private ActAppMapper actAppMapper; private ActAppMapper actAppMapper;
@Resource
private ClientsOperationLogMapper clientsOperationLogMapper;
@Resource
private ClientManager clientManager;
@Resource
private MessageSource messageSource;
@Override @Override
public JSONObject getActNotice(JSONObject device) { public JSONObject getActNotice(JSONObject device) {
String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType);
int client_id = device.getIntValue("client_id"); int client_id = device.getIntValue("client_id");
BigDecimal total_redpack = actMonDelaySettleRedPackMapper.getTotalRedPack(client_id); BigDecimal total_redpack = actMonDelaySettleRedPackMapper.getTotalRedPack(client_id);
JSONObject res = new JSONObject(); JSONObject res = new JSONObject();
@ -62,15 +70,14 @@ public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService {
if (!act.getBoolean("is_valid")) { if (!act.getBoolean("is_valid")) {
throw new BadRequestException("Activity is not valid"); throw new BadRequestException("Activity is not valid");
} }
String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType);
int client_id = device.getIntValue("client_id"); int client_id = device.getIntValue("client_id");
List<JSONObject> clientLogs = actMonDelaySettleMapper.clientLog(client_id); List<JSONObject> clientLogs = actMonDelaySettleMapper.clientLog(client_id);
JSONObject res = new JSONObject(); JSONObject res = new JSONObject();
res.put("operation_pause",false); res.put("operation_pause",false);
Boolean apply = false; Boolean apply = true;
if (!clientLogs.isEmpty()) { if (clientLogs.isEmpty()) {
apply = true; apply = false;
res.put("cancel_waring",messageSource.getMessage("sys.mondelay.cancel.waring", null, RequestEnvironment.getLocale()));
} }
if (new Date().compareTo(act.getDate("active_date")) < 0) { if (new Date().compareTo(act.getDate("active_date")) < 0) {
res.put("active", false); res.put("active", false);
@ -92,10 +99,12 @@ public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService {
res.put("apply", apply); res.put("apply", apply);
res.put("total_redpack", total_redpack); res.put("total_redpack", total_redpack);
res.put("list", list); res.put("list", list);
return res; return res;
} }
@Override @Override
@Transactional
public void actApply(JSONObject device) { public void actApply(JSONObject device) {
LocalDateTime dt = LocalDateTime.now(); LocalDateTime dt = LocalDateTime.now();
if(dt.getDayOfWeek()== DayOfWeek.MONDAY && dt.getHour()<18){ if(dt.getDayOfWeek()== DayOfWeek.MONDAY && dt.getHour()<18){
@ -112,8 +121,6 @@ public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService {
if (new Date().compareTo(act.getDate("expire_date")) > 0) { if (new Date().compareTo(act.getDate("expire_date")) > 0) {
throw new BadRequestException("The activity has expired"); throw new BadRequestException("The activity has expired");
} }
String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType);
int client_id = device.getIntValue("client_id"); int client_id = device.getIntValue("client_id");
List<JSONObject> clientLogs = actMonDelaySettleMapper.clientLog(client_id); List<JSONObject> clientLogs = actMonDelaySettleMapper.clientLog(client_id);
if (!clientLogs.isEmpty()) { if (!clientLogs.isEmpty()) {
@ -129,16 +136,19 @@ public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService {
device.put("rate", params.getBigDecimal("rate") == null ? new BigDecimal(0.15) : params.getBigDecimal("rate")); device.put("rate", params.getBigDecimal("rate") == null ? new BigDecimal(0.15) : params.getBigDecimal("rate"));
device.put("expire_time", act.getDate("expire_date")); device.put("expire_time", act.getDate("expire_date"));
actMonDelaySettleMapper.save(device); actMonDelaySettleMapper.save(device);
clientManager.changeManualSettle(client_id,true,device.getString("account_id"),1,"参加活动打开手动清算");
} }
@Override @Override
@Transactional
public void cancelAct(JSONObject device) { public void cancelAct(JSONObject device) {
LocalDateTime dt = LocalDateTime.now(); LocalDateTime dt = LocalDateTime.now();
if(dt.getDayOfWeek()== DayOfWeek.MONDAY && dt.getHour()<18){ if(dt.getDayOfWeek()== DayOfWeek.MONDAY && dt.getHour()<18){
throw new BadRequestException("每周一0点至18点为收益计算时间,暂停退出活动操作"); throw new BadRequestException("每周一0点至18点为收益计算时间,暂停退出活动操作");
} }
String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType);
int client_id = device.getIntValue("client_id"); int client_id = device.getIntValue("client_id");
List<JSONObject> clientLogs = actMonDelaySettleMapper.clientLog(client_id); List<JSONObject> clientLogs = actMonDelaySettleMapper.clientLog(client_id);
if (clientLogs.isEmpty()) { if (clientLogs.isEmpty()) {
@ -148,6 +158,8 @@ public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService {
clientLog.put("is_valid", 0); clientLog.put("is_valid", 0);
clientLog.put("expire_time", new Date()); clientLog.put("expire_time", new Date());
actMonDelaySettleMapper.update(clientLog); actMonDelaySettleMapper.update(clientLog);
clientManager.changeManualSettle(client_id,false,device.getString("account_id"),1,"退出活动关闭手动清算");
} }
} }

@ -1,5 +1,28 @@
package au.com.royalpay.payment.manage.analysis.core.impls; package au.com.royalpay.payment.manage.analysis.core.impls;
import au.com.royalpay.payment.core.exceptions.ParamInvalidException;
import au.com.royalpay.payment.manage.analysis.beans.AnalysisBean;
import au.com.royalpay.payment.manage.analysis.core.DashboardAnalysisTask;
import au.com.royalpay.payment.manage.analysis.core.DashboardService;
import au.com.royalpay.payment.manage.analysis.mappers.ClientAnalysisMapper;
import au.com.royalpay.payment.manage.analysis.mappers.CustomerAndOrdersStatisticsMapper;
import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.mappers.system.ExchangeRateMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.tools.defines.TradeType;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import org.apache.commons.lang3.time.DateUtils;
import org.apache.commons.lang3.time.DurationFormatUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -12,28 +35,6 @@ import java.util.TreeMap;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.apache.commons.lang3.time.DateUtils;
import org.apache.commons.lang3.time.DurationFormatUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import au.com.royalpay.payment.core.exceptions.ParamInvalidException;
import au.com.royalpay.payment.manage.analysis.beans.AnalysisBean;
import au.com.royalpay.payment.manage.analysis.core.DashboardAnalysisTask;
import au.com.royalpay.payment.manage.analysis.core.DashboardService;
import au.com.royalpay.payment.manage.analysis.mappers.ClientAnalysisMapper;
import au.com.royalpay.payment.manage.analysis.mappers.CustomerAndOrdersStatisticsMapper;
import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.tools.defines.TradeType;
/** /**
* Created by davep on 2016-07-28. * Created by davep on 2016-07-28.
*/ */
@ -50,6 +51,8 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
private ClientMapper clientMapper; private ClientMapper clientMapper;
@Resource @Resource
private CustomerAndOrdersStatisticsMapper customerAndOrdersStatisticsMapper; private CustomerAndOrdersStatisticsMapper customerAndOrdersStatisticsMapper;
@Resource
private ExchangeRateMapper exchangeRateMapper;
@Override @Override
public JSONObject getCommonAnalysis1(JSONObject params) { public JSONObject getCommonAnalysis1(JSONObject params) {
@ -323,7 +326,8 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
} }
public void channelsExchangeRate(Date beginDate,Date endDate,Map<Date, JSONObject> exchangeRateMap, String channel){ public void channelsExchangeRate(Date beginDate,Date endDate,Map<Date, JSONObject> exchangeRateMap, String channel){
List<JSONObject> channelRates = transactionAnalysisMapper.listExchangeRates(beginDate, endDate,channel);
List<JSONObject> channelRates = exchangeRateMapper.listExchangeRates(beginDate, endDate,channel);
for (JSONObject analysisItem:channelRates){ for (JSONObject analysisItem:channelRates){
Date date = analysisItem.getDate("date"); Date date = analysisItem.getDate("date");
JSONObject dataItem = exchangeRateMap.get(date); JSONObject dataItem = exchangeRateMap.get(date);

@ -115,4 +115,6 @@ public interface RetailAppService {
JSONObject getCheckClientInfo(JSONObject device); JSONObject getCheckClientInfo(JSONObject device);
void changeManualSettle(JSONObject device,boolean manual_settle);
} }

@ -438,8 +438,8 @@ public class RetailAppServiceImp implements RetailAppService {
break; break;
} }
Calendar calendar = (Calendar) order.get("transaction_time"); Calendar calendar = (Calendar) order.get("transaction_time");
String trade_date = DateFormatUtils.format(calendar, "yyyy-MM-dd"); String trade_date = DateFormatUtils.format(calendar, "yyyy-MM-dd",calendar.getTimeZone());
String trade_time = DateFormatUtils.format(calendar, "HH:mm:ss"); String trade_time = DateFormatUtils.format(calendar, "HH:mm:ss",calendar.getTimeZone());
order.put("trade_date", trade_date); order.put("trade_date", trade_date);
order.put("trade_time", trade_time); order.put("trade_time", trade_time);
// todo // todo
@ -1385,6 +1385,11 @@ public class RetailAppServiceImp implements RetailAppService {
return clientManager.getCheckClientInfo(device.getIntValue("client_id"), device.getString("account_id")); return clientManager.getCheckClientInfo(device.getIntValue("client_id"), device.getString("account_id"));
} }
@Override
public void changeManualSettle(JSONObject device,boolean manual_settle) {
clientManager.changeManualSettle(device.getIntValue("client_id"),manual_settle,device.getString("account_id"),1,"商户修改手动清算配置");
}
private static boolean mathchLetterorNum(String str) { private static boolean mathchLetterorNum(String str) {
String regex = "[A-Za-z0-9]{8}"; String regex = "[A-Za-z0-9]{8}";
return str.matches(regex); return str.matches(regex);

@ -31,6 +31,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -406,4 +407,11 @@ public class RetailAppController {
throw new ParamInvalidException("settle_to", "error.payment.valid.invalid_time"); throw new ParamInvalidException("settle_to", "error.payment.valid.invalid_time");
} }
} }
@RequestMapping(value = "/client/manual_settle", method = RequestMethod.PUT)
@ResponseBody
public void confirmSourceAgreeFile(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device,@RequestBody JSONObject data) {
retailAppService.changeManualSettle(device,data.getBoolean("manual_settle"));
}
} }

@ -4,7 +4,12 @@ import au.com.royalpay.payment.manage.management.clearing.core.CleanService;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.CommonConsts;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -18,13 +23,14 @@ public class ClearingConfigController {
@Resource @Resource
private CleanService cleanService; private CleanService cleanService;
@ManagerMapping(value = "/rate_warnings",method = RequestMethod.GET,role = {ManagerRole.ADMIN,ManagerRole.OPERATOR, ManagerRole.FINANCIAL_STAFF}) @ManagerMapping(value = "/rate_warnings", method = RequestMethod.GET, role = { ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.FINANCIAL_STAFF })
public JSONObject getRateWarnings(){ public JSONObject getRateWarnings() {
return cleanService.rateWarnings(); return cleanService.rateWarnings();
} }
@ManagerMapping(value = "/clients/{clientMoniker}/auto_rate",method = RequestMethod.PUT,role = {ManagerRole.ADMIN,ManagerRole.OPERATOR}) @ManagerMapping(value = "/clients/{clientMoniker}/auto_rate", method = RequestMethod.PUT, role = { ManagerRole.ADMIN, ManagerRole.OPERATOR })
public JSONObject generateRateAutomatically(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager){ public JSONObject generateRateAutomatically(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return cleanService.autoGenerateRate(clientMoniker,manager); return cleanService.autoGenerateRate(clientMoniker, manager);
} }
} }

@ -0,0 +1,16 @@
package au.com.royalpay.payment.manage.mappers.log;
import com.alibaba.fastjson.JSONObject;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
/**
* Created by yixian on 2017-04-18.
*/
@AutoMapper(tablename = "log_clients_operation",pkName = "id")
public interface ClientsOperationLogMapper {
@AutoSql(type = SqlType.INSERT)
void save(JSONObject review);
}

@ -1,5 +1,6 @@
package au.com.royalpay.payment.manage.mappers.system; package au.com.royalpay.payment.manage.mappers.system;
import java.sql.SQLType;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -23,4 +24,9 @@ public interface ClientsContractMapper {
JSONObject findByClientId(@Param("client_id") int clientId); JSONObject findByClientId(@Param("client_id") int clientId);
@AutoSql(type = SqlType.SELECT)
List<JSONObject> list();
List<JSONObject> listWithClientInfo();
} }

@ -0,0 +1,29 @@
package au.com.royalpay.payment.manage.mappers.system;
import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.alibaba.fastjson.JSONObject;
import 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;
/**
* Create by yixian at 2017-12-19 19:09
*/
@AutoMapper(tablename = "sys_exchange_rate", pkName = "id")
public interface ExchangeRateMapper {
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "type = 1")
JSONObject findMaxRate(@Param("create_date") Date create_time);
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "type = 2")
JSONObject findMinRate(@Param("create_date") Date create_time);
List<JSONObject> listExchangeRates(@Param("begin") Date begin, @Param("end") Date end, @Param("channel") String channel);
}

@ -0,0 +1,9 @@
package au.com.royalpay.payment.manage.merchants.core;
public interface ClientInfoCacheSupport {
void clearClientCache(int clientId);
void clearClientMonikerCache(String clientMoniker);
}

@ -36,10 +36,6 @@ public interface ClientManager {
JSONObject getClientInfo(int clientId); JSONObject getClientInfo(int clientId);
void clearClientCache(int clientId);
void clearClientMonikerCache(String clientMoniker);
JSONObject getClientInfoIgnoreInvalid(int clientId); JSONObject getClientInfoIgnoreInvalid(int clientId);
JSONObject getClientInfoByMoniker(String clientMoniker); JSONObject getClientInfoByMoniker(String clientMoniker);
@ -231,6 +227,7 @@ public interface ClientManager {
void changePaymentPage(JSONObject account, String paypad_version); void changePaymentPage(JSONObject account, String paypad_version);
void changeManualSettle(int client_id, boolean manual_settle,String operator_id,int type,String operation);
void changeQRCodePaySurcharge(JSONObject account, boolean paySurcharge); void changeQRCodePaySurcharge(JSONObject account, boolean paySurcharge);

@ -0,0 +1,40 @@
package au.com.royalpay.payment.manage.merchants.core.impls;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientInfoCacheSupport;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.signin.core.SignInAccountService;
import com.alibaba.fastjson.JSONObject;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class ClientInfoCacheSupportImpl implements ClientInfoCacheSupport{
@Resource
private ClientAccountMapper clientAccountMapper;
@Resource
private SignInAccountService signInAccountService;
@Resource
private ClientManager clientManager;
@Resource
private ClientInfoCacheSupport clientInfoCacheSupport;
@Override
@CacheEvict(value = ":app_client_info:", key = "''+#clientId")
public void clearClientCache(int clientId) {
List<JSONObject> accounts = clientAccountMapper.listPartnerAccounts(clientId);
for (JSONObject acc : accounts) {
signInAccountService.clearAccountCache(acc.getString("account_id"));
}
JSONObject client = clientManager.getClientInfo(clientId);
clientInfoCacheSupport.clearClientMonikerCache(client.getString("client_moniker"));
}
@Override
@CacheEvict(value = ":app_client_info_moniker:", key = "#clientMoniker")
public void clearClientMonikerCache(String clientMoniker) {
}
}

@ -13,31 +13,13 @@ import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper
import au.com.royalpay.payment.manage.appclient.beans.AppClientBean; import au.com.royalpay.payment.manage.appclient.beans.AppClientBean;
import au.com.royalpay.payment.manage.device.core.DeviceManager; import au.com.royalpay.payment.manage.device.core.DeviceManager;
import au.com.royalpay.payment.manage.mappers.financial.FinancialBDConfigMapper; import au.com.royalpay.payment.manage.mappers.financial.FinancialBDConfigMapper;
import au.com.royalpay.payment.manage.mappers.log.ClientsOperationLogMapper;
import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper; import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
import au.com.royalpay.payment.manage.mappers.redpack.ActClientInvitationCodeMapper; import au.com.royalpay.payment.manage.mappers.redpack.ActClientInvitationCodeMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper; import au.com.royalpay.payment.manage.mappers.system.*;
import au.com.royalpay.payment.manage.mappers.system.ClientApplyMapper; import au.com.royalpay.payment.manage.merchants.beans.*;
import au.com.royalpay.payment.manage.mappers.system.ClientAuditProcessMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientBDMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientBankAccountMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientDeviceMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientFilesMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientRateMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientsContractMapper;
import au.com.royalpay.payment.manage.mappers.system.CommoditiesMapper;
import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
import au.com.royalpay.payment.manage.mappers.system.OrgMapper;
import au.com.royalpay.payment.manage.mappers.system.SysWxMerchantApplyMapper;
import au.com.royalpay.payment.manage.merchants.beans.ActivityPosterBuilder;
import au.com.royalpay.payment.manage.merchants.beans.BankAccountInfo;
import au.com.royalpay.payment.manage.merchants.beans.ClientAuthFilesInfo;
import au.com.royalpay.payment.manage.merchants.beans.ClientRateConfig;
import au.com.royalpay.payment.manage.merchants.beans.ClientRegisterInfo;
import au.com.royalpay.payment.manage.merchants.beans.NewAccountBean;
import au.com.royalpay.payment.manage.merchants.beans.PartnerQuery;
import au.com.royalpay.payment.manage.merchants.beans.SubMerchantIdApply;
import au.com.royalpay.payment.manage.merchants.core.ClientComplyValidator; import au.com.royalpay.payment.manage.merchants.core.ClientComplyValidator;
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.ClientManager;
import au.com.royalpay.payment.manage.notice.core.MailService; 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.beans.TodoNotice;
@ -66,21 +48,16 @@ import au.com.royalpay.payment.tools.merchants.qrboard.QRBoard;
import au.com.royalpay.payment.tools.merchants.qrboard.QRBoardProvider; import au.com.royalpay.payment.tools.merchants.qrboard.QRBoardProvider;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole; 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.enums.PartnerRole;
import au.com.royalpay.payment.tools.utils.ImageUtils; import au.com.royalpay.payment.tools.utils.*;
import au.com.royalpay.payment.tools.utils.PageListUtils;
import au.com.royalpay.payment.tools.utils.PasswordUtils;
import au.com.royalpay.payment.tools.utils.PdfUtils;
import au.com.royalpay.payment.tools.utils.QRCodeUtils;
import au.com.royalpay.payment.tools.utils.TimeZoneUtils;
import au.com.royalpay.payment.tools.websocket.notify.PartnerPageEvent; import au.com.royalpay.payment.tools.websocket.notify.PartnerPageEvent;
import cn.yixblog.platform.http.HttpRequestGenerator;
import cn.yixblog.platform.http.HttpRequestResult;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.RandomStringUtils;
@ -106,35 +83,23 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.thymeleaf.context.Context; import org.thymeleaf.context.Context;
import org.thymeleaf.spring4.SpringTemplateEngine; import org.thymeleaf.spring4.SpringTemplateEngine;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.awt.*; import java.awt.*;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream; import java.io.*;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import cn.yixblog.platform.http.HttpRequestGenerator;
import cn.yixblog.platform.http.HttpRequestResult;
import static au.com.royalpay.payment.manage.permission.utils.OrgCheckUtils.checkOrgPermission; import static au.com.royalpay.payment.manage.permission.utils.OrgCheckUtils.checkOrgPermission;
/** /**
@ -219,6 +184,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
private ClientContractService clientContractService; private ClientContractService clientContractService;
@Resource @Resource
private MessageSource messageSource; private MessageSource messageSource;
@Resource
private ClientsOperationLogMapper clientsOperationLogMapper;
@Resource
private ClientInfoCacheSupport clientInfoCacheSupport;
private static final String SOURCE_AGREE_FILE = "source_agree_file"; private static final String SOURCE_AGREE_FILE = "source_agree_file";
private static final String CLIENT_BANK_FILE = "client_bank_file"; private static final String CLIENT_BANK_FILE = "client_bank_file";
@ -247,22 +216,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return clientMapper.findClient(clientId); return clientMapper.findClient(clientId);
} }
@Override
@CacheEvict(value = ":app_client_info:", key = "''+#clientId")
public void clearClientCache(int clientId) {
List<JSONObject> accounts = clientAccountMapper.listPartnerAccounts(clientId);
for (JSONObject acc : accounts) {
signInAccountService.clearAccountCache(acc.getString("account_id"));
}
JSONObject client = getClientInfo(clientId);
clearClientMonikerCache(client.getString("client_moniker"));
}
@Override
@CacheEvict(value = ":app_client_info_moniker:", key = "#clientMoniker")
public void clearClientMonikerCache(String clientMoniker) {
}
@Override @Override
public JSONObject getClientInfoIgnoreInvalid(int clientId) { public JSONObject getClientInfoIgnoreInvalid(int clientId) {
return clientMapper.findClientIgnoreInvalid(clientId); return clientMapper.findClientIgnoreInvalid(clientId);
@ -571,7 +524,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} }
} }
clientMapper.update(updateInfo); clientMapper.update(updateInfo);
clearClientCache(clientId); clientInfoCacheSupport.clearClientCache(clientId);
} }
@Override @Override
@ -597,7 +550,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
clientMapper.update(update); clientMapper.update(update);
} }
} }
clearClientCache(clientId); clientInfoCacheSupport.clearClientCache(clientId);
} }
@Override @Override
@ -634,7 +587,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
saveClientAuditProcess(client.getIntValue("client_id"), open_status, 5, "合规通过", manager); saveClientAuditProcess(client.getIntValue("client_id"), open_status, 5, "合规通过", manager);
} }
} }
clearClientCache(client.getIntValue("client_id")); clientInfoCacheSupport.clearClientCache(client.getIntValue("client_id"));
} }
@Override @Override
@ -655,7 +608,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
saveClientAuditProcess(client.getIntValue("client_id"), 10, 1, "绿色通道申请通过", manager); saveClientAuditProcess(client.getIntValue("client_id"), 10, 1, "绿色通道申请通过", manager);
sendCommissionWechatMessage(client); sendCommissionWechatMessage(client);
initAdminUserAndSendEmail(manager, clientMoniker, client); initAdminUserAndSendEmail(manager, clientMoniker, client);
clearClientCache(client.getIntValue("client_id")); clientInfoCacheSupport.clearClientCache(client.getIntValue("client_id"));
} }
private void initAdminUserAndSendEmail(JSONObject manager, String clientMoniker, JSONObject client) { private void initAdminUserAndSendEmail(JSONObject manager, String clientMoniker, JSONObject client) {
@ -713,7 +666,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
sendInitEmail(client, account.getString("username"), pwd); sendInitEmail(client, account.getString("username"), pwd);
} }
} }
clearClientCache(clientId); clientInfoCacheSupport.clearClientCache(clientId);
} }
@Override @Override
@ -833,7 +786,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} }
int clientId = client.getIntValue("client_id"); int clientId = client.getIntValue("client_id");
updateClientApproveEmailStatus(clientId, 1); updateClientApproveEmailStatus(clientId, 1);
clearClientCache(clientId); clientInfoCacheSupport.clearClientCache(clientId);
} }
private void updateClientApproveEmailStatus(int clientId, int status) { private void updateClientApproveEmailStatus(int clientId, int status) {
@ -884,7 +837,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
checkOrgPermission(manager, client); checkOrgPermission(manager, client);
client.put(permissionKey, allow); client.put(permissionKey, allow);
clientMapper.update(client); clientMapper.update(client);
clearClientCache(client.getIntValue("client_id")); clientInfoCacheSupport.clearClientCache(client.getIntValue("client_id"));
} }
@Override @Override
@ -1071,7 +1024,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
Assert.notNull(partner); Assert.notNull(partner);
partner.put("enable_pay_notice", enable); partner.put("enable_pay_notice", enable);
clientMapper.update(partner); clientMapper.update(partner);
clearClientCache(partner.getIntValue("client_id")); clientInfoCacheSupport.clearClientCache(partner.getIntValue("client_id"));
} }
@Override @Override
@ -1099,7 +1052,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
Assert.notNull(partner, "Merchant is null"); Assert.notNull(partner, "Merchant is null");
partner.put("enable_refund_auth", enable); partner.put("enable_refund_auth", enable);
clientMapper.update(partner); clientMapper.update(partner);
clearClientCache(partner.getIntValue("client_id")); clientInfoCacheSupport.clearClientCache(partner.getIntValue("client_id"));
} }
@Override @Override
@ -1134,7 +1087,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
subClient.put("bd_user", managerId); subClient.put("bd_user", managerId);
clientMapper.update(subClient); clientMapper.update(subClient);
} }
clearClientCache(client.getIntValue("client_id")); clientInfoCacheSupport.clearClientCache(client.getIntValue("client_id"));
} }
@Override @Override
@ -1146,7 +1099,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
checkOrgPermission(manager, client); checkOrgPermission(manager, client);
client.put("credential_code", RandomStringUtils.random(32, true, true)); client.put("credential_code", RandomStringUtils.random(32, true, true));
clientMapper.update(client); clientMapper.update(client);
clearClientCache(client.getIntValue("client_id")); clientInfoCacheSupport.clearClientCache(client.getIntValue("client_id"));
} }
@Override @Override
@ -1217,7 +1170,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
update.put("client_id", client.getIntValue("client_id")); update.put("client_id", client.getIntValue("client_id"));
update.put("settle_hour", hour); update.put("settle_hour", hour);
clientMapper.update(update); clientMapper.update(update);
clearClientCache(client.getIntValue("client_id")); clientInfoCacheSupport.clearClientCache(client.getIntValue("client_id"));
} }
@Override @Override
@ -1689,7 +1642,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
partner.put("client_id", clientId); partner.put("client_id", clientId);
partner.put("timezone", timezone); partner.put("timezone", timezone);
clientMapper.update(partner); clientMapper.update(partner);
clearClientCache(clientId); clientInfoCacheSupport.clearClientCache(clientId);
} }
@Override @Override
@ -2191,8 +2144,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
client.put("refund_pwd", pwdHash); client.put("refund_pwd", pwdHash);
client.put("refund_pwd_salt", salt); client.put("refund_pwd_salt", salt);
clientMapper.update(client); clientMapper.update(client);
clearClientCache(client.getIntValue("client_id")); clientInfoCacheSupport.clearClientCache(client.getIntValue("client_id"));
clearClientMonikerCache(client.getString("client_moniker"));
} }
@Override @Override
@ -2224,7 +2176,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
update.put("client_id", clientId); update.put("client_id", clientId);
update.put("qrcode_surcharge", paySurcharge); update.put("qrcode_surcharge", paySurcharge);
clientMapper.update(update); clientMapper.update(update);
clearClientCache(clientId); clientInfoCacheSupport.clearClientCache(clientId);
} }
@Override @Override
@ -2238,7 +2190,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
update.put("client_id", clientId); update.put("client_id", clientId);
update.put("api_surcharge", enableApiSurcharge); update.put("api_surcharge", enableApiSurcharge);
clientMapper.update(update); clientMapper.update(update);
clearClientCache(clientId); clientInfoCacheSupport.clearClientCache(clientId);
} }
@Override @Override
@ -2252,7 +2204,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
update.put("client_id", clientId); update.put("client_id", clientId);
update.put("retail_surcharge", paySurcharge); update.put("retail_surcharge", paySurcharge);
clientMapper.update(update); clientMapper.update(update);
clearClientCache(clientId); clientInfoCacheSupport.clearClientCache(clientId);
} }
@Override @Override
@ -2266,7 +2218,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
update.put("client_id", clientId); update.put("client_id", clientId);
update.put("tax_in_surcharge", taxInSurcharge); update.put("tax_in_surcharge", taxInSurcharge);
clientMapper.update(update); clientMapper.update(update);
clearClientCache(clientId); clientInfoCacheSupport.clearClientCache(clientId);
} }
@Override @Override
@ -2282,13 +2234,13 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override @Override
public void updateClientCleanDays(int clientId, int cleanDays) { public void updateClientCleanDays(int clientId, int cleanDays) {
clientMapper.updateCleanDays(clientId, cleanDays); clientMapper.updateCleanDays(clientId, cleanDays);
clearClientCache(clientId); clientInfoCacheSupport.clearClientCache(clientId);
} }
@Override @Override
public void updateClientEmail(int clientId, String contact_email) { public void updateClientEmail(int clientId, String contact_email) {
clientMapper.updateClientEmail(clientId, contact_email); clientMapper.updateClientEmail(clientId, contact_email);
clearClientCache(clientId); clientInfoCacheSupport.clearClientCache(clientId);
} }
@Override @Override
@ -2296,7 +2248,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
JSONObject client = clientDetail(manager, clientMoniker); JSONObject client = clientDetail(manager, clientMoniker);
int clientId = client.getIntValue("client_id"); int clientId = client.getIntValue("client_id");
clientMapper.disableClient(clientId); clientMapper.disableClient(clientId);
clearClientCache(clientId); clientInfoCacheSupport.clearClientCache(clientId);
} }
@Override @Override
@ -2590,7 +2542,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
checkOrgPermission(manager, client); checkOrgPermission(manager, client);
client.put("paypad_version", paypad_version); client.put("paypad_version", paypad_version);
clientMapper.update(client); clientMapper.update(client);
clearClientCache(client.getIntValue("client_id")); clientInfoCacheSupport.clearClientCache(client.getIntValue("client_id"));
} }
@Override @Override
@ -2604,7 +2556,31 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
updateObj.put("client_id", client.getIntValue("client_id")); updateObj.put("client_id", client.getIntValue("client_id"));
updateObj.put("paypad_version", paypad_version); updateObj.put("paypad_version", paypad_version);
clientMapper.update(updateObj); clientMapper.update(updateObj);
clearClientCache(clientId); clientInfoCacheSupport.clearClientCache(clientId);
}
@Override
@Transactional
public void changeManualSettle(int client_id, boolean manual_settle,String operator_id,int type,String operation) {
JSONObject client = getClientInfo(client_id);
if(client==null){
throw new BadRequestException("merchant not found");
}
JSONObject record = new JSONObject();
record.put("client_id",client_id);
record.put("manual_settle",manual_settle);
clientMapper.update(record);
JSONObject actClientLog = new JSONObject();
actClientLog.put("client_id",client_id);
actClientLog.put("operator_id",operator_id);
actClientLog.put("operation",operation);
actClientLog.put("create_time",new Date());
actClientLog.put("operator_type",type);
clientsOperationLogMapper.save(actClientLog);
clientInfoCacheSupport.clearClientCache(client_id);
} }
@Override @Override
@ -2618,7 +2594,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
updateObj.put("client_id", client.getIntValue("client_id")); updateObj.put("client_id", client.getIntValue("client_id"));
updateObj.put("qrcode_surcharge", paySurcharge); updateObj.put("qrcode_surcharge", paySurcharge);
clientMapper.update(updateObj); clientMapper.update(updateObj);
clearClientCache(clientId); clientInfoCacheSupport.clearClientCache(clientId);
} }
@Override @Override
@ -2632,7 +2608,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
updateObj.put("client_id", client.getIntValue("client_id")); updateObj.put("client_id", client.getIntValue("client_id"));
updateObj.put("api_surcharge", enableApiSurcharge); updateObj.put("api_surcharge", enableApiSurcharge);
clientMapper.update(updateObj); clientMapper.update(updateObj);
clearClientCache(clientId); clientInfoCacheSupport.clearClientCache(clientId);
} }
@Override @Override
@ -2650,7 +2626,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
updateObj.put("client_id", client.getIntValue("client_id")); updateObj.put("client_id", client.getIntValue("client_id"));
updateObj.put("retail_surcharge", paySurcharge); updateObj.put("retail_surcharge", paySurcharge);
clientMapper.update(updateObj); clientMapper.update(updateObj);
clearClientCache(clientId); clientInfoCacheSupport.clearClientCache(clientId);
} }
@Override @Override
@ -2678,7 +2654,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
updateObj.put("retail_surcharge", updateSurchargeDTO.getRetailSurcharge()); updateObj.put("retail_surcharge", updateSurchargeDTO.getRetailSurcharge());
clientMapper.update(updateObj); clientMapper.update(updateObj);
} }
clearClientCache(clientId); clientInfoCacheSupport.clearClientCache(clientId);
} }
@Override @Override
@ -2709,7 +2685,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} catch (Exception e) { } catch (Exception e) {
logger.error("RefusePartnerError=======:" + clientMoniker + "," + e.getMessage()); logger.error("RefusePartnerError=======:" + clientMoniker + "," + e.getMessage());
} }
clearClientCache(client.getIntValue("client_id")); clientInfoCacheSupport.clearClientCache(client.getIntValue("client_id"));
} }
@Override @Override
@ -2742,7 +2718,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
BigDecimal customerSurchargeRate = new BigDecimal(appClientBean.getCustomerSurchargeRate()).setScale(2, BigDecimal.ROUND_HALF_DOWN); BigDecimal customerSurchargeRate = new BigDecimal(appClientBean.getCustomerSurchargeRate()).setScale(2, BigDecimal.ROUND_HALF_DOWN);
setCustomerSurchargeRate(client.getString("client_moniker"), customerSurchargeRate); setCustomerSurchargeRate(client.getString("client_moniker"), customerSurchargeRate);
} }
clearClientCache(client_id); clientInfoCacheSupport.clearClientCache(client_id);
} }
@Override @Override
@ -2756,7 +2732,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
update.put("client_id", clientId); update.put("client_id", clientId);
update.put("skip_clearing", skip_clearing); update.put("skip_clearing", skip_clearing);
clientMapper.update(update); clientMapper.update(update);
clearClientCache(clientId); clientInfoCacheSupport.clearClientCache(clientId);
} }
@Override @Override
@ -2770,7 +2746,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
update.put("client_id", clientId); update.put("client_id", clientId);
update.put("gateway_upgrade", gatewayUpgrade); update.put("gateway_upgrade", gatewayUpgrade);
clientMapper.update(update); clientMapper.update(update);
clearClientCache(clientId); clientInfoCacheSupport.clearClientCache(clientId);
} }
private void sendMessagetoCompliance(JSONObject client, String bd_user_name) { private void sendMessagetoCompliance(JSONObject client, String bd_user_name) {

@ -2,14 +2,12 @@ package au.com.royalpay.payment.manage.merchants.web;
import au.com.royalpay.payment.core.exceptions.ParamInvalidException; import au.com.royalpay.payment.core.exceptions.ParamInvalidException;
import au.com.royalpay.payment.manage.merchants.beans.NewAccountBean; import au.com.royalpay.payment.manage.merchants.beans.NewAccountBean;
import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig;
import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.merchants.core.ClientSignEventSupport; import au.com.royalpay.payment.manage.merchants.core.ClientSignEventSupport;
import au.com.royalpay.payment.manage.permission.manager.PartnerMapping; 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; import au.com.royalpay.payment.manage.support.wechatclients.KangaLandWechatApiImpl;
import au.com.royalpay.payment.manage.support.wechatclients.RedpackWechatApiImpl; import au.com.royalpay.payment.manage.support.wechatclients.RedpackWechatApiImpl;
import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
import au.com.royalpay.payment.manage.permission.manager.RequirePartner;
import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery; import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery;
import au.com.royalpay.payment.manage.tradelog.core.TradeLogService; import au.com.royalpay.payment.manage.tradelog.core.TradeLogService;
import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.CommonConsts;
@ -17,20 +15,31 @@ import au.com.royalpay.payment.tools.connections.mpsupport.beans.WxOauthType;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException; import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.http.HttpUtils; 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.PartnerRole;
import au.com.royalpay.payment.tools.permission.wechat.WechatMapping; import au.com.royalpay.payment.tools.permission.wechat.WechatMapping;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.validation.Errors; import org.springframework.validation.Errors;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.List; import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
/** /**
* view for partner client * view for partner client
* Created by yixian on 2016-07-03. * Created by yixian on 2016-07-03.
@ -348,4 +357,13 @@ public class PartnerViewController {
public void fullReleasePreAuthorization(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account, @RequestBody TradeLogQuery query) throws Exception { public void fullReleasePreAuthorization(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account, @RequestBody TradeLogQuery query) throws Exception {
tradeLogService.fullReleasePreAuthorization(account, query); tradeLogService.fullReleasePreAuthorization(account, query);
} }
@PartnerMapping(value = "/manual_settle", method = RequestMethod.PUT, roles = PartnerRole.ADMIN)
@ResponseBody
public void manualSettle(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account, @RequestParam boolean manual_settle) {
clientManager.changeManualSettle(account.getIntValue("client_id"),manual_settle,account.getString("account_id"),1,"商户"+(manual_settle?"打开":"关闭")+"手动清算");
}
} }

@ -88,7 +88,7 @@ public class ManualSettleSupportImpl implements ManualSettleSupport {
todayTask.put("unsettle", unsettleReports); todayTask.put("unsettle", unsettleReports);
BigDecimal totalClearing = unsettleReports.stream().map(report -> report.getBigDecimal("clearing_amount")).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); BigDecimal totalClearing = unsettleReports.stream().map(report -> report.getBigDecimal("clearing_amount")).reduce(BigDecimal::add).orElse(BigDecimal.ZERO);
todayTask.put("total_clearing_amount", CurrencyAmountUtils.scalePlatformCurrency(totalClearing)); todayTask.put("total_clearing_amount", CurrencyAmountUtils.scalePlatformCurrency(totalClearing));
BigDecimal totalSettle = unsettleReports.stream().map(report -> report.getBigDecimal("settle_amount")).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); BigDecimal totalSettle = unsettleReports.stream().map(report -> report.getBigDecimal("settle_amount") == null ? BigDecimal.ZERO : report.getBigDecimal("settle_amount")).reduce(BigDecimal::add).orElse(BigDecimal.ZERO);
todayTask.put("total_settle_amount", CurrencyAmountUtils.scalePlatformCurrency(totalSettle)); todayTask.put("total_settle_amount", CurrencyAmountUtils.scalePlatformCurrency(totalSettle));
todayTask.put("desc", LocaleSupport.localeMessage("manual_settle.notice")); todayTask.put("desc", LocaleSupport.localeMessage("manual_settle.notice"));
} }

@ -320,7 +320,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
"company_name", "address","business_name","business_structure", "abn","acn","company_phone","suburb","postcode","state","contact_person","contact_phone","contact_email", "company_name", "address","business_name","business_structure", "abn","acn","company_phone","suburb","postcode","state","contact_person","contact_phone","contact_email",
"short_name", "logo_url", "enable_refund", "enable_refund_auth", "retail_surcharge", "require_custinfo", "require_remark", "short_name", "logo_url", "enable_refund", "enable_refund_auth", "retail_surcharge", "require_custinfo", "require_remark",
"logo_thumbnail", "creator", "create_time", "approver", "approve_result", "approve_time", "timezone", "logo_thumbnail", "creator", "create_time", "approver", "approve_result", "approve_time", "timezone",
"has_children", "source", "customer_surcharge_rate", "enable_alipay", "enable_wechat", "enable_bestpay"}; "has_children", "source", "customer_surcharge_rate", "enable_alipay", "enable_wechat", "enable_bestpay","manual_settle"};
for (String col : columns) { for (String col : columns) {
simpleClient.put(col, client.get(col)); simpleClient.put(col, client.get(col));
} }

@ -2,6 +2,8 @@ package au.com.royalpay.payment.manage.system.core;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import java.util.List;
public interface ClientContractService { public interface ClientContractService {
JSONObject getOrGenerateSourceAgreement(int client_id,String channel); JSONObject getOrGenerateSourceAgreement(int client_id,String channel);
@ -12,4 +14,5 @@ public interface ClientContractService {
JSONObject getClientContractExpire(int client_id); JSONObject getClientContractExpire(int client_id);
List<JSONObject> list();
} }

@ -107,14 +107,15 @@ public class ClientContractServiceImpl implements ClientContractService {
if(contract.getBoolean("has_sign")){ if(contract.getBoolean("has_sign")){
return; return;
} }
Date now = new Date();
JSONObject account = clientAccountMapper.findById(account_id); JSONObject account = clientAccountMapper.findById(account_id);
contract.put("has_sign", 1); contract.put("has_sign", 1);
contract.put("sign_account_id",account_id); contract.put("sign_account_id",account_id);
contract.put("sign_channel",channel); contract.put("sign_channel",channel);
contract.put("confirm_time",now);
contract.put("signatory",account.getString("display_name")); contract.put("signatory",account.getString("display_name"));
clientsContractMapper.update(contract); clientsContractMapper.update(contract);
Date now = new Date();
List<JSONObject> rateInfo = clientRateMapper.minExpiryTime(client_id, null); List<JSONObject> rateInfo = clientRateMapper.minExpiryTime(client_id, null);
if(expire){ if(expire){
rateInfo.forEach((p)->{ rateInfo.forEach((p)->{
@ -214,4 +215,9 @@ public class ClientContractServiceImpl implements ClientContractService {
return result; return result;
} }
@Override
public List<JSONObject> list() {
return clientsContractMapper.listWithClientInfo();
}
} }

@ -0,0 +1,26 @@
package au.com.royalpay.payment.manage.system.web;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.manage.system.core.ClientContractService;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import javax.annotation.Resource;
@RestController
@RequestMapping(value = "/manage/contract")
public class contractController {
@Resource
private ClientContractService clientContractService;
@ManagerMapping(value = "/list",method = RequestMethod.GET)
public List<JSONObject> list(){
return clientContractService.list();
}
}

@ -7,4 +7,10 @@
order by create_time desc order by create_time desc
limit 1 limit 1
</select> </select>
<select id="listWithClientInfo" resultType="com.alibaba.fastjson.JSONObject">
select c.client_moniker client_moniker,cc.create_time create_time,cc.confirm_time confirm_time,a.display_name display_name from
sys_clients_contract cc left join sys_clients c on c.client_id = cc.client_id
left join sys_accounts a on a.account_id = cc.sign_account_id
</select>
</mapper> </mapper>

@ -0,0 +1,19 @@
<?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.ExchangeRateMapper">
<select id="listExchangeRates" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT
create_date mx ,
rate exchange_rate ,
create_date `date`
FROM sys_exchange_rate
WHERE create_date >= #{begin} And create_date <= #{end} AND channel = #{channel} and type = 1
GROUP BY
create_date
ORDER BY
`date` ASC
]]>
</select>
</mapper>

@ -105,3 +105,6 @@ sys.contract.ordinary.info=Dear merchant, your service contract with ROYALPAY ha
sys.contract.ordinary.waring=Dear merchant, your service contract with ROYALPAY expires in {0} days. In order not to affect your normal use, please contact your supervisor or use your administrator account as soon as possible in order to renew your service contract. sys.contract.ordinary.waring=Dear merchant, your service contract with ROYALPAY expires in {0} days. In order not to affect your normal use, please contact your supervisor or use your administrator account as soon as possible in order to renew your service contract.
sys.contract.waring=Dear merchant, your service contract with ROYALPAY is due to expire in {0} days. In order not to affect your normal use, please see the latest service agreement for renewal. sys.contract.waring=Dear merchant, your service contract with ROYALPAY is due to expire in {0} days. In order not to affect your normal use, please see the latest service agreement for renewal.
sys.contract.info=Dear merchant, your service contract with ROYALPAY has expired. Please check the latest service agreement to renew your contract so as not to affect your normal use. sys.contract.info=Dear merchant, your service contract with ROYALPAY has expired. Please check the latest service agreement to renew your contract so as not to affect your normal use.
sys.mondelay.cancel.waring=this is mondelay cancel waring

@ -99,3 +99,5 @@ sys.contract.ordinary.info=尊敬的商户您与ROYALPAY的服务合同已到
sys.contract.ordinary.waring=尊敬的商户您与ROYALPAY的服务合同还有{0}天到期,为了不影响您的正常使用,请尽快联系您的主管或使用管理员账户登录以便进行服务续约 sys.contract.ordinary.waring=尊敬的商户您与ROYALPAY的服务合同还有{0}天到期,为了不影响您的正常使用,请尽快联系您的主管或使用管理员账户登录以便进行服务续约
sys.contract.waring=尊敬的商户您与ROYALPAY的服务合同还有{0}天到期,为了不影响您的正常使用,请查看最新服务协议进行续约。 sys.contract.waring=尊敬的商户您与ROYALPAY的服务合同还有{0}天到期,为了不影响您的正常使用,请查看最新服务协议进行续约。
sys.contract.info=尊敬的商户您与ROYALPAY的服务合同已到期为了不影响您的正常使用请查看最新服务协议进行续约。 sys.contract.info=尊敬的商户您与ROYALPAY的服务合同已到期为了不影响您的正常使用请查看最新服务协议进行续约。
sys.mondelay.cancel.waring=商户取消活动警告

@ -111,6 +111,8 @@
<script type="text/javascript" data-th-inline="javascript"> <script type="text/javascript" data-th-inline="javascript">
$(document).ready(function () { $(document).ready(function () {
var operation_pause= /*[[${operation_pause}]]*/false; var operation_pause= /*[[${operation_pause}]]*/false;
var cancel_waring= /*[[${cancel_waring}]]*/'';
function is_weixin() { function is_weixin() {
var ua = navigator.userAgent.toLowerCase(); var ua = navigator.userAgent.toLowerCase();
@ -141,7 +143,7 @@
if(is_weixin()){ if(is_weixin()){
return; return;
} else if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) { } else if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
window.webkit.messageHandlers.appCmd.postMessage({type:'cmd_cancel_mondelay'}); window.webkit.messageHandlers.appCmd.postMessage({type:'cmd_cancel_mondelay',cancel_waring:cancel_waring});
} else if (/(Android)/i.test(navigator.userAgent)) { } else if (/(Android)/i.test(navigator.userAgent)) {
android.appCmd('{\"type\":\"cmd_cancel_mondelay\"}'); android.appCmd('{\"type\":\"cmd_cancel_mondelay\"}');
} else { } else {

@ -338,6 +338,12 @@ margin-bottom: 10%;"/>
<i class="fa fa-users"></i> <span>余额增值活动</span> <i class="fa fa-users"></i> <span>余额增值活动</span>
</a> </a>
</li> </li>
<li ui-sref-active="active" ng-if="('1000000000000'|withRole)">
<a ui-sref="contract">
<i class="fa fa-money"></i> <span>合同签约情况</span>
</a>
</li>
<li class="header nav-header" ng-if="('1000000000000'|withRole)">机构|Agent</li> <li class="header nav-header" ng-if="('1000000000000'|withRole)">机构|Agent</li>
<li ui-sref-active="active" ng-if="('1000000000000'|withRole)"> <li ui-sref-active="active" ng-if="('1000000000000'|withRole)">
<a ui-sref="analysis_agent" ui-sref-opts="{reload:true}"> <a ui-sref="analysis_agent" ui-sref-opts="{reload:true}">
@ -417,7 +423,6 @@ margin-bottom: 10%;"/>
<i class="fa fa-file-text-o"></i> <span>网站管理|Site Manage</span> <i class="fa fa-file-text-o"></i> <span>网站管理|Site Manage</span>
</a> </a>
</li> </li>
<li ui-sref-active="active" ng-if="('10'|withRole)||('1000000'|withRole)||('10000000'|withRole)"> <li ui-sref-active="active" ng-if="('10'|withRole)||('1000000'|withRole)||('10000000'|withRole)">
<a href="https://customer.royalpay.com.au/manage/sign_in" target="_blank"> <a href="https://customer.royalpay.com.au/manage/sign_in" target="_blank">
<i class="fa fa-file-text-o"></i> <span>积分商城|Integral Mall</span> <i class="fa fa-file-text-o"></i> <span>积分商城|Integral Mall</span>

@ -220,6 +220,11 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload'], funct
}) })
}); });
}; };
$scope.manualSettle = function (manualSettle) {
$http.put('/client/partner_info/manual_settle?'+'manual_settle='+manualSettle).then(function (resp) {
})
};
$scope.getRates(); $scope.getRates();
}]); }]);
app.controller('clientSubPartnersCtrl', ['$scope', '$http', function ($scope, $http) { app.controller('clientSubPartnersCtrl', ['$scope', '$http', function ($scope, $http) {

@ -1,4 +1,11 @@
<div class="row"> <div class="row">
<div class="form-group">
<label class="col-sm-4">Manual Settle</label>
<div class="col-sm-6">
<input type="checkbox" ng-model="partner.manual_settle" bs-switch
switch-change="manualSettle(partner.manual_settle)">
</div>
</div>
<div class="col-sm-12"> <div class="col-sm-12">
<h3>Bank Account</h3> <h3>Bank Account</h3>
<div class="form-horizontal"> <div class="form-horizontal">

@ -0,0 +1,54 @@
/**
* Created by yishuqian on 01/06/2017.
*/
define(['angular'], function (angular) {
'use strict';
var app = angular.module('contractApp', ['ui.router']);
app.config(['$stateProvider', function ($stateProvider) {
$stateProvider.state('contract', {
url: '/contract',
templateUrl: '/static/sys/templates/contract_sign.html',
controller: 'contractAnalysisCtrl'
}).state('rate_warnings', {
url: '/rate_warnings',
templateUrl: '/static/analysis/templates/settle_warnings.html',
controller: 'settleWarningsCtrl'
})
}]);
app.controller('contractAnalysisCtrl', ['$scope', '$http', '$state', '$filter', 'commonDialog', function ($scope, $http, $state, $filter, commonDialog) {
$scope.getContractAnalysis = function () {
$http.get('/manage/contract/list').then(function (resp) {
$scope.contract_analysis = resp.data;
});
};
$scope.getContractAnalysis();
}]);
app.controller('settleWarningsCtrl', ['$scope', '$http', '$filter', 'commonDialog', function ($scope, $http, $filter, commonDialog) {
$scope.loadWarnings = function () {
$http.get('/manage/clearing/rate_warnings').then(function (resp) {
$scope.warning = resp.data;
})
};
$scope.loadWarnings();
$scope.generateRate = function (client) {
commonDialog.confirm({title: 'Confirm Required', content: '根据上季度总交易额自动计算下周期费率,确定执行?'}).then(function () {
$http.put('/manage/clearing/clients/' + client.client_moniker + '/auto_rate').then(function (resp) {
var content = 'New Rate value=' + resp.data.rate_value + '; expiry_time=' + $filter('date')(resp.data.expiry_time, 'dd/MMM/yyyy');
commonDialog.alert({
type: 'success',
title: 'New Rate Generated',
content: content
}).then(function () {
$scope.loadWarnings();
});
}, function (resp) {
commonDialog.alert({type: 'error', title: 'Error', content: resp.data.message});
})
})
}
}]);
return app;
});

@ -0,0 +1,35 @@
<div class="modal-header">Contract</div>
<ul class="nav nav-tabs">
<li ui-sref-active-eq="active" class="active">
<a ui-sref="contract">Contract</a>
</li>
<li ui-sref-active="active">
<a ui-sref="rate_warnings">Rate Warings</a>
</li>
</ul>
<div class="modal-body">
<div class="box box-danger">
<div class="box-header">商户合同情况</div>
<div class="box-body table-responsive">
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th>Client Moniker</th>
<th>Create Time</th>
<th>Confirm Time</th>
<th>Account Name</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="contract in contract_analysis">
<td ng-bind="contract.client_moniker"></td>
<td ng-bind="contract.create_time|date:'dd/MMM/yyyy'"></td>
<td ng-bind="contract.confirm_time|date:'dd/MMM/yyyy'"></td>
<td ng-bind="contract.display_name"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
Loading…
Cancel
Save