Merge branch 'hotfix' into develop

# Conflicts:
#	src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java
master
kira 6 years ago
commit 43c020d4e3

@ -4,7 +4,6 @@ import au.com.royalpay.payment.manage.citypartner.core.CityPartnerRegisterServic
import au.com.royalpay.payment.manage.merchants.core.ClientApply;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.http.HttpUtils;
import au.com.royalpay.payment.tools.secure.ApplyRequest;
import org.springframework.validation.Errors;
import org.springframework.web.bind.annotation.*;
@ -24,8 +23,18 @@ public class CityPartnerRegisterController {
private ClientApply clientApply;
@RequestMapping(method = RequestMethod.POST)
@ApplyRequest
public void register(@RequestBody @Valid CityPartnerBean partner, Errors errors) {
public void register(@CookieValue(CommonConsts.CODE_KEY) String codeKey, HttpServletResponse response,
@RequestBody @Valid CityPartnerBean partner, Errors errors) throws Exception{
String codeValue = clientApply.getVerifyCode(codeKey);
if (codeValue == null) {
throw new Exception("Verification code has expired");
}
if (!codeValue.equals(partner.getCaptcha())){
throw new Exception("Verification code is not correct");
}else {
clientApply.deleteVerifyCodeKey(codeKey);
HttpUtils.dropCookie(response, CommonConsts.CODE_KEY);
}
HttpUtils.handleValidErrors(errors);
cityPartnerRegisterService.saveRegistry(partner);
}

@ -943,9 +943,6 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
model.put("date", DateFormatUtils.format(date, "dd-MM-yyyy"));
// todo themeleaf
Context ctx = new Context();
ctx.setVariable("date", DateFormatUtils.format(date, "dd-MM-yyyy"));
final String content = thymeleaf.process("mail/settlement_mail", ctx);
// final String content = VelocityEngineUtils.mergeTemplateIntoString(velocityEngine,
// "mail/settlement_mail.vm", "utf-8", model);
@ -984,6 +981,11 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
}
attach2.put("name", fileName2);
attachList.add(attach2);
Context ctx = new Context();
ctx.setVariable("date", DateFormatUtils.format(date, "dd-MM-yyyy"));
ctx.setVariable("abaFiles", abaFileList);
final String content = thymeleaf.process("mail/settlement_mail", ctx);
// 测试用地址
// String mailId = mailService.sendEmail(title, "164851225@qq.com", "1029811920@qq.com", content,
// attachList);

@ -87,6 +87,7 @@ import au.com.royalpay.payment.manage.mappers.log.LogClientSubMerchantIdMapper;
import au.com.royalpay.payment.manage.mappers.log.LogSettleMailMapper;
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.risk.RiskAttentionMerchantsMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientApplyMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientAuditProcessMapper;
@ -1015,7 +1016,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
* mailTo = client.getString("contact_email"); if (StringUtils.isEmpty(mailTo)) { throw new EmailException("Client
* Contact Email is invalid"); } final Set<String> emails = new HashSet<>(); for (JSONObject bd : bds) { String
* email = bd.getString("email"); if (StringUtils.isNotEmpty(email)) { emails.add(email); } } new Thread() {
*
*
* @Override public void run() { try { SendMail sendMail = new SendMail(); Set<String> to = new HashSet<>();
* to.add(mailTo); sendMail.setFrom("info@mail.royalpay.com.au"); sendMail.setMailTos(to);
* sendMail.setMailCcs(emails); sendMail.setTitle("Your RoyalPay Cross-border Payment has been set up");
@ -1024,7 +1025,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
* client.getString("client_moniker"), 3, mailResult.getString("mail_id"))); } catch (Exception e) {
* clientModifySupport.processClientModify(new EmailModify(account, client.getString("client_moniker"), 0,
* null)); throw new EmailException("Email Sending Failed", e); } } }.start(); }
*
*
*/
public void sendAuthInitEmail(JSONObject account, final JSONObject client) {

@ -9,6 +9,7 @@ import org.springframework.util.Assert;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -56,6 +57,11 @@ public class ABAFile {
return out.toString().getBytes();
}
public String getTotalSettleAmountStr() {
DecimalFormat format = new DecimalFormat("#.##0.00");
return format.format(totalSettleAmount);
}
private String generateFinalLine() {
StringBuilder lineBuilder = new StringBuilder(baseLine);
lineBuilder.replace(0, 1, "7");

@ -1,22 +1,29 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="zh">
<div style="color: #000000">
<p>Dear Flexewallet,</p>
<br>
<br>
<p>Please find the attached settlement files data up to <span th:text="${date}"></span></p>
<br>
<br>
<p>Best Regards,</p>
<p style="border-bottom: 45px; font-weight: 900;">RoyalPay Finance team</p>
<p style="margin: initial;">Tunnel Show Pty Ltd trading as RoyalPay</p>
<p style="margin: initial;">Representative of AFS Licensee 448066</p>
<p style="margin: initial;">------------------------------</p>
<p style="margin: initial;">Lv.11,15 William Street Melbourne 3000 </p>
<p style="margin: initial;">Lv.14, 383 Kent Street, Sydney, NSW 2000 </p>
<p style="margin: initial;">P: 1300 1077 50</p>
<p style="margin: initial;">E: settlement@royalpay.com.au</p>
<p style="margin: initial;">www.royalpay.com.au</p>
<p>Dear Flexewallet,</p>
<br>
<br>
<p>Please find the attached settlement files data up to <span th:text="${date}"></span></p>
<p></p>
<p>File Validation:</p>
<p>
<ul>
<li th:each="aba : ${abaFiles}" th:text="|${aba.filename()} : ${aba.getTotalSettleAmountStr()}|"></li>
</ul>
</p>
<br>
<br>
<p>Best Regards,</p>
<p style="border-bottom: 45px; font-weight: 900;">RoyalPay Finance team</p>
<p style="margin: initial;">Tunnel Show Pty Ltd trading as RoyalPay</p>
<p style="margin: initial;">Representative of AFS Licensee 448066</p>
<p style="margin: initial;">------------------------------</p>
<p style="margin: initial;">Lv.11,15 William Street Melbourne 3000 </p>
<p style="margin: initial;">Lv.14, 383 Kent Street, Sydney, NSW 2000 </p>
<p style="margin: initial;">P: 1300 1077 50</p>
<p style="margin: initial;">E: settlement@royalpay.com.au</p>
<p style="margin: initial;">www.royalpay.com.au</p>
</div>
</html>

@ -162,9 +162,6 @@
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
html {
height: 100%
}
body {
height: 100%;

@ -0,0 +1,94 @@
package au.com.royalpay.payment.manage.process.alipay;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.Optional;
/**
* Create by yixian at 2018-08-14 21:41
*/
@SpringBootTest
@ActiveProfiles({"proxy"})
@RunWith(SpringRunner.class)
public class FixAlipayData {
@Resource
private JdbcTemplate jdbcTemplate;
private String fileLocation = "C:\\Users\\yixian\\Documents\\royalpay\\2018\\alipayfix\\2088721525235246_20180815110000000032102003900557154_result - 副本.xls";
private String fileTarget = "C:\\Users\\yixian\\Documents\\royalpay\\2018\\alipayfix\\fixed_2088721525235246_20180815110000000032102003900557154_result.xls";
private Logger logger = LoggerFactory.getLogger(getClass());
@Test
public void fix() throws IOException, InvalidFormatException {
Workbook wb = WorkbookFactory.create(new File(fileLocation));
Sheet sheet = wb.getSheetAt(0);
final int startRow = 6;
int rowNum = startRow;
String compName;
while ((compName = mchCompName(sheet, rowNum)) != null) {
logger.info("row:" + rowNum + ",company name=" + compName);
final String corpName = compName;
Row row = sheet.getRow(rowNum++);
String shortName = row.getCell(2).getStringCellValue();
List<Map<String, Object>> clients = jdbcTemplate.queryForList("select c.company_name,c.short_name,c.ali_sub_merchant_id,c.alipayindustry,c.country,c.address,c.state,l.latitude,l.longitude from sys_clients c" +
" left join sys_clients_locations l on l.client_id=c.client_id where c.short_name=?", shortName);
if (clients.isEmpty()) {
clients = jdbcTemplate.queryForList("select c.company_name,c.short_name,c.ali_sub_merchant_id,c.alipayindustry,c.country,c.address,c.state,l.latitude,l.longitude from sys_clients c" +
" left join sys_clients_locations l on l.client_id=c.client_id where c.company_name=?", corpName);
if (clients.isEmpty()) {
continue;
}
}
Optional<Map<String, Object>> cliOpts = clients.stream()
.filter(cli -> new JSONObject(cli).getString("company_name").equals(corpName))
.findFirst();
JSONObject client = new JSONObject(cliOpts.isPresent() ? cliOpts.get() : clients.get(0));
String moniker = client.getString("ali_sub_merchant_id");
logger.info("updating to xlsx:" + moniker);
row.getCell(4).setCellValue(moniker);
row.getCell(5).setCellValue(moniker);
String mcc = client.getString("alipayindustry");
row.getCell(7).setCellValue(StringUtils.isEmpty(mcc) ? "5311" : mcc);
row.getCell(8).setCellValue("Australia");
if (StringUtils.isNoneEmpty(client.getString("address"), client.getString("state"))) {
row.getCell(9).setCellValue(client.getString("address") + "," + client.getString("state"));
}
if (client.getString("latitude") != null) {
row.getCell(29).setCellValue(client.getBigDecimal("latitude").setScale(8, BigDecimal.ROUND_DOWN).toPlainString());
row.getCell(30).setCellValue(client.getBigDecimal("longitude").setScale(8, BigDecimal.ROUND_DOWN).toPlainString());
}
logger.info("finished update row:" + (rowNum - 1));
}
wb.write(new FileOutputStream(fileTarget));
}
private String mchCompName(Sheet sheet, int rowNum) {
Row row = sheet.getRow(rowNum);
if (row == null) {
return null;
}
Cell cell = row.getCell(1);
if (cell == null) {
return null;
}
return cell.getStringCellValue();
}
}

@ -0,0 +1,54 @@
package au.com.royalpay.payment.manage.process.custom;
import au.com.royalpay.payment.channels.alipay.runtime.impls.AlipayCustomDeclaringTaskProcessor;
import au.com.royalpay.payment.core.mappers.PmtCustomReportsDetailMapper;
import au.com.royalpay.payment.core.mappers.PmtCustomReportsMapper;
import au.com.royalpay.payment.core.mappers.PmtOrderMapper;
import au.com.royalpay.payment.manage.mappers.custom.CustomReportDetailsMapper;
import au.com.royalpay.payment.manage.mappers.custom.CustomReportsMapper;
import com.alibaba.fastjson.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
import java.util.List;
/**
* Create by yixian at 2018-08-14 20:28
*/
@SpringBootTest
@ActiveProfiles({"proxy", "alipay"})
@TestPropertySource(properties = {"spring.datasource.username=root", "spring.datasource.password=ZOIBhellor0yalpay"})
@RunWith(SpringRunner.class)
public class ManualReportCustom {
@Autowired
private AlipayCustomDeclaringTaskProcessor processor;
@Resource
private PmtCustomReportsMapper pmtCustomReportsMapper;
@Resource
private PmtOrderMapper pmtOrderMapper;
@Resource
private PmtCustomReportsDetailMapper pmtCustomReportsDetailMapper;
@Test
public void test() {
String reportId = "05482201808142036430702208";
List<JSONObject> customs = pmtCustomReportsMapper.findReport(reportId);
List<JSONObject> sub = pmtCustomReportsDetailMapper.listSubReports(reportId);
JSONObject order = pmtOrderMapper.find(reportId);
JSONObject task = new JSONObject();
task.put("channel", order.getString("channel"));
task.put("merchant_id", order.getString("merchant_id"));
task.put("sub_orders", sub);
task.put("report", customs.stream().filter(rep -> rep.getIntValue("report_status") == 2)
.findFirst().orElseThrow(() -> new RuntimeException("No Failure Reports")));
processor.process(task);
}
}
Loading…
Cancel
Save