Merge branch 'develop_manual_settle' into develop

# Conflicts:
#	src/db/modify.sql
master
wangning 7 years ago
commit 3cf45ef0cc

@ -315,4 +315,22 @@ 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 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是否弹框'

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

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

@ -1385,6 +1385,11 @@ public class RetailAppServiceImp implements RetailAppService {
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) {
String regex = "[A-Za-z0-9]{8}";
return str.matches(regex);

@ -406,4 +406,11 @@ public class RetailAppController {
throw new ParamInvalidException("settle_to", "error.payment.valid.invalid_time");
}
}
@RequestMapping(value = "/manual_settle", method = RequestMethod.PUT)
public void confirmSourceAgreeFile(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device,@RequestParam boolean manual_settle) {
retailAppService.changeManualSettle(device,manual_settle);
}
}

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

@ -231,6 +231,7 @@ public interface ClientManager {
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);

@ -13,6 +13,7 @@ import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper
import au.com.royalpay.payment.manage.appclient.beans.AppClientBean;
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.log.ClientsOperationLogMapper;
import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
import au.com.royalpay.payment.manage.mappers.redpack.ActClientInvitationCodeMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
@ -219,6 +220,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
private ClientContractService clientContractService;
@Resource
private MessageSource messageSource;
@Resource
private ClientsOperationLogMapper clientsOperationLogMapper;
private static final String SOURCE_AGREE_FILE = "source_agree_file";
private static final String CLIENT_BANK_FILE = "client_bank_file";
@ -2607,6 +2610,28 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
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);
}
@Override
public void changeQRCodePaySurcharge(JSONObject account, boolean paySurcharge) {
int clientId = account.getIntValue("client_id");

@ -524,6 +524,12 @@ public class PartnerManageController {
return clientManager.listMerchantIds(clientMoniker,manager);
}
@ManagerMapping(value = "/{clientMoniker}/manual_settle",method = RequestMethod.PUT,role = {ManagerRole.OPERATOR,ManagerRole.ADMIN})
public void manualSettle(@PathVariable String clientMoniker, @RequestParam boolean manual_settle, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker);
clientManager.changeManualSettle(client.getIntValue("client_id"),manual_settle,manager.getString("manager_id"),2,"运营人员修改手动清算配置");
}
@PartnerMapping(value = "/check", method = RequestMethod.GET)
public JSONObject getCheckClientInfo(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account) {
return clientManager.getCheckClientInfo(account.getIntValue("client_id"),account.getString("account_id"));

@ -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.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.ClientSignEventSupport;
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.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.core.TradeLogService;
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.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.PartnerRole;
import au.com.royalpay.payment.tools.permission.wechat.WechatMapping;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
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.OutputStream;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
/**
* view for partner client
* Created by yixian on 2016-07-03.
@ -348,4 +357,12 @@ public class PartnerViewController {
public void fullReleasePreAuthorization(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account, @RequestBody TradeLogQuery query) throws Exception {
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) {
}
}

@ -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.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.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.waring=尊敬的商户您与ROYALPAY的服务合同还有{0}天到期,为了不影响您的正常使用,请查看最新服务协议进行续约。
sys.contract.info=尊敬的商户您与ROYALPAY的服务合同已到期为了不影响您的正常使用请查看最新服务协议进行续约。
sys.mondelay.cancel.waring=商户取消活动警告

@ -111,6 +111,8 @@
<script type="text/javascript" data-th-inline="javascript">
$(document).ready(function () {
var operation_pause= /*[[${operation_pause}]]*/false;
var cancel_waring= /*[[${cancel_waring}]]*/'';
function is_weixin() {
var ua = navigator.userAgent.toLowerCase();
@ -141,7 +143,7 @@
if(is_weixin()){
return;
} 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)) {
android.appCmd('{\"type\":\"cmd_cancel_mondelay\"}');
} else {

@ -1339,6 +1339,11 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
})
};
$scope.manualSettle = function (manualSettle) {
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/manual_settle?'+'manual_settle='+manualSettle).then(function (resp) {
})
};
$scope.settleHours = [{value: undefined, label: 'Default(24:00, GMT+10)'}];
for (var h = 24; h > 0; h--) {
$scope.settleHours.push({value: h, label: ('00' + h).substr(-2) + ':00, ' + $scope.partner.timezone});

@ -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();
}]);
app.controller('clientSubPartnersCtrl', ['$scope', '$http', function ($scope, $http) {

@ -1,4 +1,11 @@
<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">
<h3>Bank Account</h3>
<div class="form-horizontal">

@ -5,6 +5,14 @@
}
</style>
<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">
<h3>Bank Account
<a class="small" role="button" ng-click="bankCtrl.edit=true"

Loading…
Cancel
Save