|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package au.com.royalpay.payment.manage.apps.core.impls;
|
|
|
|
|
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.payment.OrderMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientConfigMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.OrgMapper;
|
|
|
|
|
import au.com.royalpay.payment.tools.mail.MailGunClient;
|
|
|
|
@ -9,6 +10,7 @@ import au.com.royalpay.payment.tools.mail.SendMail;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.codec.binary.Base64;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.apache.commons.lang3.time.DateUtils;
|
|
|
|
|
import org.junit.Test;
|
|
|
|
|
import org.junit.runner.RunWith;
|
|
|
|
@ -21,8 +23,12 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.net.URISyntaxException;
|
|
|
|
|
import java.nio.charset.Charset;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.HashSet;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
@ -34,7 +40,7 @@ import cn.yixblog.platform.http.HttpRequestResult;
|
|
|
|
|
* Created by wangning on 05/01/2018.
|
|
|
|
|
*/
|
|
|
|
|
@SpringBootTest
|
|
|
|
|
@ActiveProfiles({ "local", "alipay", "wechat", "jd", "bestpay" })
|
|
|
|
|
@ActiveProfiles({ "proxy", "alipay", "wechat", "jd", "bestpay" })
|
|
|
|
|
@RunWith(SpringRunner.class)
|
|
|
|
|
public class CustomerImpressionImplTest {
|
|
|
|
|
@Resource
|
|
|
|
@ -48,7 +54,8 @@ public class CustomerImpressionImplTest {
|
|
|
|
|
private OrgMapper orgMapper;
|
|
|
|
|
@Resource
|
|
|
|
|
private MailGunClient mailGunClient;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private ClientConfigMapper clientConfigMapper;
|
|
|
|
|
|
|
|
|
|
// @Test
|
|
|
|
|
// public void redisQueue() {
|
|
|
|
@ -60,40 +67,39 @@ public class CustomerImpressionImplTest {
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// @Test
|
|
|
|
|
// public void excel() {
|
|
|
|
|
// try {
|
|
|
|
|
// XSSFWorkbook workbook = new XSSFWorkbook(new FileInputStream(new File("/Users/wangning/Desktop/asd.xlsx")));
|
|
|
|
|
// XSSFSheet sheet = workbook.getSheetAt(0);
|
|
|
|
|
// Iterator<Row> rowIterator = sheet.rowIterator();
|
|
|
|
|
// Row row = null;
|
|
|
|
|
// Cell cell = null;
|
|
|
|
|
// while (rowIterator.hasNext()) {
|
|
|
|
|
// row = rowIterator.next();
|
|
|
|
|
// cell = row.getCell(3);
|
|
|
|
|
// cell.setCellType(HSSFCell.CELL_TYPE_STRING);
|
|
|
|
|
//
|
|
|
|
|
// JSONObject client = clientMapper.findClientByMoniker(cell.getStringCellValue().trim());
|
|
|
|
|
// if(client==null){
|
|
|
|
|
// System.out.println();
|
|
|
|
|
// continue;
|
|
|
|
|
// }
|
|
|
|
|
// JSONObject org = orgMapper.findOne(client.getIntValue("org_id"));
|
|
|
|
|
// if(org==null){
|
|
|
|
|
// continue;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// row.createCell(5).setCellValue(org.getString("name"));
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// OutputStream out = new FileOutputStream("/Users/wangning/Desktop/春节活动报名结果通知(包含BD名称).xlsx");
|
|
|
|
|
// workbook.write(out);
|
|
|
|
|
// workbook.close();
|
|
|
|
|
// } catch (IOException e) {
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// @Test
|
|
|
|
|
// public void excel() {
|
|
|
|
|
// try {
|
|
|
|
|
// XSSFWorkbook workbook = new XSSFWorkbook(new FileInputStream(new File("/Users/wangning/Desktop/asd.xlsx")));
|
|
|
|
|
// XSSFSheet sheet = workbook.getSheetAt(0);
|
|
|
|
|
// Iterator<Row> rowIterator = sheet.rowIterator();
|
|
|
|
|
// Row row = null;
|
|
|
|
|
// Cell cell = null;
|
|
|
|
|
// while (rowIterator.hasNext()) {
|
|
|
|
|
// row = rowIterator.next();
|
|
|
|
|
// cell = row.getCell(3);
|
|
|
|
|
// cell.setCellType(HSSFCell.CELL_TYPE_STRING);
|
|
|
|
|
//
|
|
|
|
|
// JSONObject client = clientMapper.findClientByMoniker(cell.getStringCellValue().trim());
|
|
|
|
|
// if(client==null){
|
|
|
|
|
// System.out.println();
|
|
|
|
|
// continue;
|
|
|
|
|
// }
|
|
|
|
|
// JSONObject org = orgMapper.findOne(client.getIntValue("org_id"));
|
|
|
|
|
// if(org==null){
|
|
|
|
|
// continue;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// row.createCell(5).setCellValue(org.getString("name"));
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// OutputStream out = new FileOutputStream("/Users/wangning/Desktop/春节活动报名结果通知(包含BD名称).xlsx");
|
|
|
|
|
// workbook.write(out);
|
|
|
|
|
// workbook.close();
|
|
|
|
|
// } catch (IOException e) {
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void sendSimpleMessage() throws Exception {
|
|
|
|
@ -126,7 +132,7 @@ public class CustomerImpressionImplTest {
|
|
|
|
|
generator.addQueryString("ascending", "yes");
|
|
|
|
|
generator.addQueryString("v:my-custom-data", "123456789");
|
|
|
|
|
generator.addQueryString("limit", "12");
|
|
|
|
|
System.out.println(String.valueOf(DateUtils.addDays(new Date(),1)));
|
|
|
|
|
System.out.println(String.valueOf(DateUtils.addDays(new Date(), 1)));
|
|
|
|
|
HttpRequestResult res = null;
|
|
|
|
|
try {
|
|
|
|
|
res = generator.execute();
|
|
|
|
@ -154,14 +160,16 @@ public class CustomerImpressionImplTest {
|
|
|
|
|
@Test
|
|
|
|
|
public void sendSimpleMessages() throws Exception {
|
|
|
|
|
SendMail sendMail = new SendMail();
|
|
|
|
|
sendMail.setFrom("postmaster@mail.royalpay.com.au");
|
|
|
|
|
sendMail.setContent("<html><p>Hi kira</p ></html>");
|
|
|
|
|
sendMail.setFrom("info@mail.royalpay.com.au");
|
|
|
|
|
sendMail.setContent("<html><p>Hi</p ></html>");
|
|
|
|
|
List<String> list = new ArrayList<>();
|
|
|
|
|
list.add("testTag");
|
|
|
|
|
// sendMail.setTags(list);
|
|
|
|
|
Set<String> mailCCs = new HashSet<>();
|
|
|
|
|
mailCCs.add("asd1159111@163.com");
|
|
|
|
|
sendMail.setMailCcs(mailCCs);
|
|
|
|
|
Set<String> mailtos = new HashSet<>();
|
|
|
|
|
mailtos.add("1029811920@qq.com");
|
|
|
|
|
mailtos.add("164851225@qq.com");
|
|
|
|
|
mailtos.add("eason.qian@royalpay.com.au");
|
|
|
|
|
sendMail.setMailTos(mailtos);
|
|
|
|
|
sendMail.setTitle("Final Test");
|
|
|
|
|
|
|
|
|
@ -171,4 +179,43 @@ public class CustomerImpressionImplTest {
|
|
|
|
|
System.out.println(result.toJSONString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void asd() {
|
|
|
|
|
JSONObject client = clientMapper.findClient(9);
|
|
|
|
|
JSONObject var = new JSONObject();
|
|
|
|
|
var.put("client_moniker", client.getString("client_moniker"));
|
|
|
|
|
var.put("short_name", client.getString("short_name"));
|
|
|
|
|
JSONObject result = mailGunClient.addListMember(client.getString("contact_email"), "merchants@mail.royalpay.com.au", client.getString("contact_person"),
|
|
|
|
|
var);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void qwe() {
|
|
|
|
|
List<JSONObject> clients = clientMapper.AllClients();
|
|
|
|
|
List<JSONObject> clientConfigs = clientConfigMapper.getAll();
|
|
|
|
|
Map<String, JSONObject> clientConfigMap = new HashMap<>();
|
|
|
|
|
Map<String, JSONObject> clientMap = new HashMap<>();
|
|
|
|
|
clientConfigs.forEach(p -> {
|
|
|
|
|
clientConfigMap.put(p.getString("client_moniker"), p);
|
|
|
|
|
});
|
|
|
|
|
clients.forEach(p -> {
|
|
|
|
|
clientMap.put(p.getString("client_moniker"), p);
|
|
|
|
|
});
|
|
|
|
|
String split = "--";
|
|
|
|
|
String cc = "cc:";
|
|
|
|
|
String c = "c";
|
|
|
|
|
clientConfigMap.values().forEach(p -> {
|
|
|
|
|
String clientMoniker = p.getString("client_moniker");
|
|
|
|
|
JSONObject tmpClient = clientMap.get(clientMoniker);
|
|
|
|
|
tmpClient.keySet().forEach(o->{
|
|
|
|
|
if(StringUtils.isNotEmpty(p.getString(o))){
|
|
|
|
|
if(!tmpClient.getString(o).equals(p.getString(o))){
|
|
|
|
|
System.out.println(clientMoniker+split+o+split+cc+p.getString(o)+split+c+tmpClient.getString(o));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|