fix upay补充字段表增加合规相关信息

master
luoyang 5 years ago
parent 4d4ad058b1
commit de5f731309

@ -1,31 +0,0 @@
package au.com.royalpay.payment.manage.mappers.system;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import com.yixsoft.support.mybatis.autosql.annotations.AdvanceSelect;
import com.yixsoft.support.mybatis.autosql.annotations.AutoMapper;
import com.yixsoft.support.mybatis.autosql.annotations.AutoSql;
import com.yixsoft.support.mybatis.autosql.annotations.SqlType;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator;
import java.util.Date;
import java.util.List;
/**
* Created by dulingling on 2020-04-26.
*/
@AutoMapper(tablename = "sys_clients_card_flow", pkName = "client_id", keyGenerator = Jdbc3KeyGenerator.class)
public interface ClientCardFlowMapper {
@AutoSql(SqlType.SELECT)
JSONObject findClient(@Param("client_id") int clientId);
@AutoSql(SqlType.INSERT)
void save(JSONObject partner);
@AutoSql(SqlType.UPDATE)
int update(JSONObject partner);
}

@ -333,8 +333,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
private RPayMerchantMapper rPayMerchantMapper;
@Resource
private SysClientUpayProfileMapper sysClientUpayProfileMapper;
@Resource
private ClientCardFlowMapper clientCardFlowMapper;
@Resource
@ -519,12 +517,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
client.put("audit_card_logs", audit_card_logs);
}
//插入卡支付审核状态
JSONObject cardFlowInfo = clientCardFlowMapper.findClient(client.getInteger("client_id"));
if(null != cardFlowInfo){
client.put("card_flow_info",cardFlowInfo);
}
//HF支付链接二维码
if (client.getString("hf_pay_url") != null) {
String hfQrcodeUrl = PlatformEnvironment.getEnv().concatUrl("/api/v1.0/hf_gateway/partners/" + client.getString("client_moniker") + "/jump/app");
@ -598,10 +590,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
partner.put("expiry_time", DateUtils.addDays(partner.getDate("approve_time"), authDays));
partner.put("pass_timeout", DateUtils.addDays(partner.getDate("approve_time"), authDays).compareTo(new Date()) < 0);
}
JSONObject cardFlowInfo = clientCardFlowMapper.findClient(partner.getInteger("client_id"));
if(null != cardFlowInfo){
partner.put("card_approve_flow_info",cardFlowInfo);
}
}
return PageListUtils.buildPageListResult(partners);
}
@ -1200,7 +1188,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client.getIntValue("source") == 4 || client.getIntValue("source") == 5) {
List<JSONObject> accounts = clientAccountMapper.listAdminAccounts(client.getIntValue("client_id"));
JSONObject account = accounts.get(0);
sendInitEmail(client, account.getString("username"), "*****");
sendInitEmail(client, account.getString("username"), "*****", false);
// sendInitEmail(manager, client, account.getString("username"), "*****");
saveClientAuditProcess(client.getIntValue("client_id"), open_status, 5, "合规通过", manager,1);
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "skip_clearing", false));
@ -1211,7 +1199,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
logger.info("PASS 绿色通道:" + clientMoniker);
saveClientAuditProcess(client.getIntValue("client_id"), open_status, 5, "合规通过", manager,1);
} else {
initAdminUserAndSendEmail(manager, clientMoniker, client);
initAdminUserAndSendEmail(manager, clientMoniker, client, false);
saveClientAuditProcess(client.getIntValue("client_id"), open_status, 5, "合规通过", manager,1);
}
}
@ -1228,21 +1216,21 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
int clientId = client.getIntValue("client_id");
isRiskyMerchant(client, clientBankAccountMapper.clientBankAccounts(clientId).get(0));
JSONObject cardFlowInfo = clientCardFlowMapper.findClient(clientId);
JSONObject cardFlowInfo = sysClientUpayProfileMapper.findInfo(clientId);
client.putAll(clientConfigService.find(client.getIntValue("client_id")));
Integer open_status_to = cardFlowInfo != null? cardFlowInfo.getIntValue("open_status") : null;
cardFlowInfo.put("open_status",5);
cardFlowInfo.put("approve_result",1);
clientCardFlowMapper.update(cardFlowInfo);
Integer open_status_to = cardFlowInfo != null? cardFlowInfo.getIntValue("upay_open_status") : null;
cardFlowInfo.put("upay_open_status",5);
cardFlowInfo.put("upay_approve_result",1);
sysClientUpayProfileMapper.update(cardFlowInfo);
sendCardCommissionWechatMessage(client);// wxMessage
if (pass == 1) {
createKycAuthStatus(manager, client);
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "skip_clearing", false));
List<JSONObject> accounts = clientAccountMapper.listAdminAccounts(clientId);
if (accounts != null && accounts.size() > 0) {
sendInitEmail(client, accounts.get(0).getString("username"), "*******");
sendInitEmail(client, accounts.get(0).getString("username"), "*******", true);
}else {
initAdminUserAndSendEmail(manager, clientMoniker, client);
initAdminUserAndSendEmail(manager, clientMoniker, client, true);
}
saveClientAuditProcess(client.getIntValue("client_id"), open_status_to, 5, "合规通过", manager,2);
}
@ -1294,10 +1282,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
clientModifySupport.processClientModify(new GreenChannelModify(manager, clientMoniker, manager.getString("manager_id")));
saveClientAuditProcess(client.getIntValue("client_id"), 10, 1, "绿色通道申请通过", manager,1);
sendCommissionWechatMessage(client);
initAdminUserAndSendEmail(manager, clientMoniker, client);
initAdminUserAndSendEmail(manager, clientMoniker, client, false);
}
private void initAdminUserAndSendEmail(JSONObject manager, String clientMoniker, JSONObject client) {
private void initAdminUserAndSendEmail(JSONObject manager, String clientMoniker, JSONObject client,boolean isUpayEmail) {
String username = clientMoniker;
boolean duplicated = true;
String pwd = RandomStringUtils.random(8, true, true);
@ -1314,7 +1302,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
username += "0";
}
}
sendInitEmail(client, username.toLowerCase(), pwd);
sendInitEmail(client, username.toLowerCase(), pwd, isUpayEmail);
// sendInitEmail(manager, client, username, pwd);
}
@ -1340,16 +1328,16 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client.getIntValue("source") == 4) {
JSONObject account = accounts.get(0);
// sendInitEmail(manager, client, account.getString("username"), "*****");
sendInitEmail(client, account.getString("username"), "*****");
sendInitEmail(client, account.getString("username"), "*****", false);
} else {
if (accounts.size() == 0) {
initAdminUserAndSendEmail(manager, clientMoniker, client);
initAdminUserAndSendEmail(manager, clientMoniker, client, false);
} else {
JSONObject account = accounts.get(0);
String pwd = RandomStringUtils.random(8, true, true);
resetAccountPwd(manager, clientMoniker, account.getString("account_id"), pwd);
// sendInitEmail(manager, client, account.getString("username"), pwd);
sendInitEmail(client, account.getString("username"), pwd);
sendInitEmail(client, account.getString("username"), pwd, false);
}
}
}
@ -1421,7 +1409,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}.start();
}
public void sendInitEmail(final JSONObject client, String username, String pwd) {
public void sendInitEmail(final JSONObject client, String username, String pwd,boolean isUpayAuditPass) {
logger.debug("sending email after comply");
JSONObject model = new JSONObject();
model.put("username", username);
@ -1471,16 +1459,30 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", emails.isEmpty() ? "" : StringUtils.join(emails, ","),
"", contentBd);
JSONObject clientUpdate = new JSONObject();
if (isUpayAuditPass) {
clientUpdate.put("client_id", client.getIntValue("client_id"));
clientUpdate.put("upay_approve_email_send", 3);
clientUpdate.put("upay_approve_email_id", emailId);
sysClientUpayProfileMapper.update(clientUpdate);
}else {
clientUpdate.put("client_id", client.getIntValue("client_id"));
clientUpdate.put("approve_email_send", 3);
clientUpdate.put("approve_email_id", emailId);
clientMapper.update(clientUpdate);
}
} catch (Exception e) {
JSONObject clientUpdate = new JSONObject();
if (isUpayAuditPass) {
clientUpdate.put("client_id", client.getIntValue("client_id"));
clientUpdate.put("upay_approve_email_send", 0);
clientUpdate.put("upay_approve_email_id", null);
sysClientUpayProfileMapper.update(clientUpdate);
}else {
clientUpdate.put("client_id", client.getIntValue("client_id"));
clientUpdate.put("approve_email_send", 0);
clientUpdate.put("approve_email_id", null);
clientMapper.update(clientUpdate);
}
throw new EmailException("Email Sending Failed", e);
}
}
@ -3182,9 +3184,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
exportTermsConditionsPDF(clientMoniker,manager);
if (!renewal) {
JSONObject cardFlow = clientCardFlowMapper.findClient(client.getInteger("client_id"));
cardFlow.put("open_status",2);
clientCardFlowMapper.update(cardFlow);
JSONObject cardFlow = sysClientUpayProfileMapper.findInfo(client.getInteger("client_id"));
cardFlow.put("upay_open_status",2);
sysClientUpayProfileMapper.update(cardFlow);
}
if (manager != null) {
saveClientAuditProcess(client.getIntValue("client_id"), 1, 2, "Compliance合同制作中", manager,2);
@ -3430,9 +3432,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (CollectionUtils.isEmpty(existLeffterFiles) && CollectionUtils.isEmpty(existConditionsFiles)) {
throw new BadRequestException("The Agree File is not Complete!");
}
JSONObject cardFlowInfo = clientCardFlowMapper.findClient(client.getInteger("client_id"));
cardFlowInfo.put("open_status", 3);
clientCardFlowMapper.update(cardFlowInfo);
JSONObject cardFlowInfo = sysClientUpayProfileMapper.findInfo(client.getInteger("client_id"));
cardFlowInfo.put("upay_open_status", 3);
sysClientUpayProfileMapper.update(cardFlowInfo);
saveClientAuditProcess(client.getIntValue("client_id"), 2, 3, "合同制作完成等待BD处理", manager,2);
sendCardCommissionWechatMessage(client);
}
@ -4689,12 +4691,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (account == null) {
throw new BadRequestException("The Partner's Bank Account is not config!");
}
JSONObject cardFlowInfo = clientCardFlowMapper.findClient(client.getInteger("client_id"));
int open_status_from = cardFlowInfo.getIntValue("open_status");
cardFlowInfo.put("approve_time",new Date());
cardFlowInfo.put("approve_result",4);
cardFlowInfo.put("open_status", 4);
clientCardFlowMapper.update(cardFlowInfo);
JSONObject cardFlowInfo = sysClientUpayProfileMapper.findInfo(client.getInteger("client_id"));
int open_status_from = cardFlowInfo.getIntValue("upay_open_status");
cardFlowInfo.put("upay_approve_time",new Date());
cardFlowInfo.put("upay_approve_result",4);
cardFlowInfo.put("upay_open_status", 4);
sysClientUpayProfileMapper.update(cardFlowInfo);
saveClientAuditProcess(client.getIntValue("client_id"), open_status_from, 4, "BD完成签字提交compliance审核", manager,2);
if (manager != null) {
sendCardCommissionWechatMessage(client);
@ -4758,23 +4760,23 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new BadRequestException("The Partner's Rpaypmt Card Rate is not config!");
}
JSONObject cardFlowInfo = clientCardFlowMapper.findClient(clientId);
JSONObject cardFlowInfo = sysClientUpayProfileMapper.findInfo(clientId);
if(null != cardFlowInfo){
JSONObject cardFlow = new JSONObject(){{
put("client_id",clientId);
put("approve_result",4);
put("open_status",1);
put("approve_time",new Date());
put("upay_approve_result",4);
put("upay_open_status",1);
put("upay_approve_time",new Date());
}};
clientCardFlowMapper.update(cardFlow);
sysClientUpayProfileMapper.save(cardFlow);
}else{
JSONObject cardFlow = new JSONObject(){{
put("client_id",clientId);
put("open_status",1);
put("approve_result",4);
put("approve_time",new Date());
put("upay_open_status",1);
put("upay_approve_result",4);
put("upay_approve_time",new Date());
}};
clientCardFlowMapper.save(cardFlow);
sysClientUpayProfileMapper.save(cardFlow);
}
saveClientAuditProcess(client.getIntValue("client_id"), null, 1, "提交Compliance制作合同", manager,2);
@ -5150,26 +5152,26 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException();
}
Integer clientId = client.getInteger("client_id");
JSONObject cardFlowInfo = clientCardFlowMapper.findClient(clientId);
JSONObject cardFlowInfo = sysClientUpayProfileMapper.findInfo(clientId);
Integer open_status = null;
if(null != cardFlowInfo){
open_status = cardFlowInfo.getIntValue("open_status");
open_status = cardFlowInfo.getIntValue("upay_open_status");
if (open_status == 1) {
cardFlowInfo.put("open_status",null);
cardFlowInfo.put("upay_open_status",null);
} else {
cardFlowInfo.put("open_status",open_status - 1);
cardFlowInfo.put("upay_open_status",open_status - 1);
}
if ( cardFlowInfo.getIntValue("approve_result") == 4 || client.getIntValue("source") == 4) {
cardFlowInfo.put("approve_result",5);
if ( cardFlowInfo.getIntValue("upay_approve_result") == 4 || client.getIntValue("source") == 4) {
cardFlowInfo.put("upay_approve_result",5);
}
if (refuse_remark != null && !refuse_remark.isEmpty()) {
cardFlowInfo.put("refuse_remark",refuse_remark);
cardFlowInfo.put("upay_refuse_remark",refuse_remark);
}
}else{
cardFlowInfo.put("open_status",null);
cardFlowInfo.put("upay_open_status",null);
}
saveClientAuditProcess(client.getIntValue("client_id"), open_status, cardFlowInfo.getIntValue("open_status"), "打回," + refuse_remark, manager,2);
clientCardFlowMapper.update(cardFlowInfo);
sysClientUpayProfileMapper.update(cardFlowInfo);
try {
if (client.getIntValue("source") == 4) {
@ -5713,11 +5715,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
String bd_user_name = client.getString("bd_user_name");
String client_moniker = "[" + client.getString("client_moniker") + "]";
String short_name = client.getString("short_name");
JSONObject cardFlowInfo = clientCardFlowMapper.findClient(client.getInteger("client_id"));
JSONObject cardFlowInfo = sysClientUpayProfileMapper.findInfo(client.getInteger("client_id"));
if(null == cardFlowInfo){
return;
}
if (cardFlowInfo.getIntValue("open_status") == 1) {
if (cardFlowInfo.getIntValue("upay_open_status") == 1) {
List<JSONObject> complianceList = managerMapper.getOnlyCompliance();
if (complianceList != null && complianceList.size() > 0) {
for (JSONObject compliance : complianceList) {
@ -5735,7 +5737,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
return;
}
if (cardFlowInfo.getIntValue("open_status") == 3) {
if (cardFlowInfo.getIntValue("upay_open_status") == 3) {
List<JSONObject> bds = clientBDMapper.listClientBDInfoAvailable(client.getIntValue("client_id"), new Date());
for (JSONObject bd : bds) {
String wxopenid = bd.getString("wx_openid");
@ -5755,7 +5757,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
return;
}
if (cardFlowInfo.getIntValue("open_status") == 4) {
if (cardFlowInfo.getIntValue("upay_open_status") == 4) {
if (client.getIntValue("source") == 4 && !StringUtils.isNotEmpty(bd_user_name)) {
bd_user_name = "自助开通商户";
}
@ -5778,7 +5780,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
return;
}
if (cardFlowInfo.getIntValue("open_status") == 5) {
if (cardFlowInfo.getIntValue("upay_open_status") == 5) {
List<JSONObject> bds = clientBDMapper.listClientBDInfoAvailable(client.getIntValue("client_id"), new Date());
for (JSONObject bd : bds) {
String wxopenid = bd.getString("wx_openid");

@ -38,11 +38,17 @@
order by display_name
</select>
<select id="listPartners" resultType="com.alibaba.fastjson.JSONObject">
SELECT DISTINCT c.*,o.name org_name
SELECT DISTINCT c.*,o.name org_name,
scup.upay_open_status,
scup.upay_approve_result,
scup.upay_approve_time,
scup.upay_refuse_remark,
scup.upay_approve_email_send,
scup.upay_approve_email_id
FROM sys_clients c
inner join sys_client_config cc on cc.client_id = c.client_id
inner join sys_org o
on o.org_id=c.org_id
inner join sys_org o on o.org_id=c.org_id
left join sys_client_upay_profile scup on scup.client_id = c.client_id
<if test="bd_user!=null">
INNER JOIN sys_client_bd d ON c.client_id = d.client_id AND d.bd_id = #{bd_user} and
date(d.start_date)&lt;= date(now()) and (d.end_date is null or date(d.end_date)&gt;= date(now())) and

@ -502,20 +502,20 @@
<span ng-if="partner.open_status==10">绿色通道申请中</span>
<span ng-if="partner.approve_result==4 && !partner.open_status"><i ng-if="partner.refuse_remark.length>0" class="fa fa-reply" aria-hidden="true" title="被打回重新提交"></i>等待合规</span>
</div>
<div ng-if="!partner.card_approve_flow_info" class="col-xs-5">
<div ng-if="!partner.upay_approve_result" class="col-xs-5">
<img height="20px" src="/static/images/card_payment_sign.png"><span> 资料完善中</span>
</div>
<div ng-if="partner.card_approve_flow_info" class="col-xs-5" style="margin-left: 2px" ng-class="{'bg-green':(partner.card_approve_flow_info.approve_result==2 && (partner.source==1 || partner.source==2)),'bg-red':((partner.card_approve_flow_info.open_status==1||partner.card_approve_flow_info.open_status==2||partner.card_approve_flow_info.open_status==4) && partner.card_approve_flow_info.approve_result!=3)||(partner.card_approve_flow_info.approve_result==3 && (!partner.card_approve_flow_info.open_status || partner.card_approve_flow_info.open_status==1 || partner.card_approve_flow_info.open_status == 4))||(partner.card_approve_flow_info.approve_result==4 && !partner.card_approve_flow_info.open_status)}">
<div ng-if="partner.upay_approve_result" class="col-xs-5" style="margin-left: 2px" ng-class="{'bg-green':(partner.upay_approve_result==2 && (partner.source==1 || partner.source==2)),'bg-red':((partner.upay_open_status==1||partner.upay_open_status==2||partner.upay_open_status==4) && partner.upay_approve_result!=3)||(partner.upay_approve_result==3 && (!partner.upay_open_status || partner.upay_open_status==1 || partner.upay_open_status == 4))||(partner.upay_approve_result==4 && !partner.upay_open_status)}">
<img height="20px" src="/static/images/card_payment_sign.png">
<span ng-if="partner.card_approve_flow_info.approve_result==1 && partner.card_approve_flow_info.approve_time">通过({{partner.card_approve_flow_info.approve_time}})</span>
<span ng-if="!partner.card_approve_flow_info.open_status && !partner.card_approve_flow_info.approve_result && partner.card_approve_flow_info.approve_result!=5 && partner.source!=4">资料完善中</span>
<span ng-if="!partner.card_approve_flow_info.open_status && !partner.card_approve_flow_info.approve_result && partner.card_approve_flow_info.approve_result!=5 && partner.source==4">(自助开通)资料完善中</span>
<span ng-if="partner.card_approve_flow_info.approve_result==0 && partner.card_approve_flow_info.approve_time">不通过({{partner.card_approve_flow_info.approve_time}})</span>
<span ng-if="partner.card_approve_flow_info.approve_result==5">申请打回({{partner.card_approve_flow_info.refuse_remark|limitTo:15}})</span>
<span ng-if="(partner.card_approve_flow_info.open_status==1||partner.card_approve_flow_info.open_status==4)"><i ng-if="partner.card_approve_flow_info.refuse_remark.length>0" class="fa fa-reply" aria-hidden="true" title="被打回重新提交"></i>等待合规</span>
<span ng-if="partner.card_approve_flow_info.open_status==2">合同制作完成</span>
<span ng-if="partner.card_approve_flow_info.open_status==3 && partner.card_approve_flow_info.approve_result!=5">等待BD上传材料审核</span>
<span ng-if="partner.card_approve_flow_info.approve_result==4 && !partner.card_approve_flow_info.open_status"><i ng-if="partner.card_approve_flow_info.refuse_remark.length>0" class="fa fa-reply" aria-hidden="true" title="被打回重新提交"></i>等待合规</span>
<span ng-if="partner.upay_approve_result==1 && partner.upay_approve_time">通过({{partner.upay_approve_time}})</span>
<span ng-if="!partner.upay_open_status && !partner.upay_approve_result && partner.upay_approve_result!=5 && partner.source!=4">资料完善中</span>
<span ng-if="!partner.upay_open_status && !partner.upay_approve_result && partner.upay_approve_result!=5 && partner.source==4">(自助开通)资料完善中</span>
<span ng-if="partner.upay_approve_result==0 && partner.upay_approve_time">不通过({{partner.upay_approve_time}})</span>
<span ng-if="partner.upay_approve_result==5">申请打回({{partner.upay_refuse_remark|limitTo:15}})</span>
<span ng-if="(partner.upay_open_status==1||partner.upay_open_status==4)"><i ng-if="partner.upay_refuse_remark.length>0" class="fa fa-reply" aria-hidden="true" title="被打回重新提交"></i>等待合规</span>
<span ng-if="partner.upay_open_status==2">合同制作完成</span>
<span ng-if="partner.upay_open_status==3 && partner.upay_approve_result!=5">等待BD上传材料审核</span>
<span ng-if="partner.upay_approve_result==4 && !partner.upay_open_status"><i ng-if="partner.upay_refuse_remark.length>0" class="fa fa-reply" aria-hidden="true" title="被打回重新提交"></i>等待合规</span>
</div>
</td>
<td ng-bind="partner.org_name"></td>

Loading…
Cancel
Save