diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientCardFlowMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientCardFlowMapper.java deleted file mode 100644 index 485ef152c..000000000 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientCardFlowMapper.java +++ /dev/null @@ -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); - -} diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index 1a557da70..b6a5dba47 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -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 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 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(); - clientUpdate.put("client_id", client.getIntValue("client_id")); - clientUpdate.put("approve_email_send", 3); - clientUpdate.put("approve_email_id", emailId); - clientMapper.update(clientUpdate); + 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(); - clientUpdate.put("client_id", client.getIntValue("client_id")); - clientUpdate.put("approve_email_send", 0); - clientUpdate.put("approve_email_id", null); - clientMapper.update(clientUpdate); + 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); } @@ -4683,18 +4685,18 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } List clientFiles = clientFilesMapper.findClientFile(client.getIntValue("client_id")); if (clientFiles == null || clientFiles.equals("")) { - throw new BadRequestException("The Compliance File Must Be Uploaded!"); + throw new BadRequestException("The Compliance File Must Be Uploaded!"); } JSONObject account = getBankAccountByClientId(client.getIntValue("client_id")); 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 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 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 bds = clientBDMapper.listClientBDInfoAvailable(client.getIntValue("client_id"), new Date()); for (JSONObject bd : bds) { String wxopenid = bd.getString("wx_openid"); diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml index 086d71004..3e964120b 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml @@ -38,11 +38,17 @@ order by display_name