|
|
|
@ -211,7 +211,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
private final int BIND_PHONE_TEMPLID = 126978;
|
|
|
|
|
private Map<String, AppMsgSender> senderMap = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
private final String fileName[] = { "client_bank_file", "client_id_file", "client_company_file" };
|
|
|
|
|
private final String fileName[] = {"client_bank_file", "client_id_file", "client_company_file"};
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
public void setAppMsgSenders(AppMsgSender[] senders) {
|
|
|
|
@ -262,6 +262,27 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<JSONObject> getTransactionCommonWeekData(JSONObject device, AppQueryBean appQueryBean) {
|
|
|
|
|
String clientType = device.getString("client_type");
|
|
|
|
|
deviceSupport.findRegister(clientType);
|
|
|
|
|
int client_id = device.getIntValue("client_id");
|
|
|
|
|
JSONObject client = clientManager.getClientInfo(client_id);
|
|
|
|
|
String timezone = client.getString("timezone");
|
|
|
|
|
if (timezone != null && !timezone.isEmpty()) {
|
|
|
|
|
appQueryBean.setTimezone(timezone);
|
|
|
|
|
}
|
|
|
|
|
JSONObject params = appQueryBean.toParams();
|
|
|
|
|
setAllClientIds(params, client_id);
|
|
|
|
|
params.put("client_id", client_id);
|
|
|
|
|
List<JSONObject> res = transactionAnalysisMapper.getWeekClientTransaction(params);
|
|
|
|
|
res.forEach(r -> {
|
|
|
|
|
r.put("date",r.getDate("date").toString());
|
|
|
|
|
});
|
|
|
|
|
res.remove(res.size() - 1);
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject getTradeCommonDate(JSONObject device, AppQueryBean appQueryBean) {
|
|
|
|
|
String clientType = device.getString("client_type");
|
|
|
|
@ -302,7 +323,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject getQrcode(JSONObject device, QRCodeConfig config, int client_id) {
|
|
|
|
|
JSONObject client = merchantInfoProvider.getClientInfo(client_id);
|
|
|
|
|
String url = PlatformEnvironment.getEnv().concatUrl("/api/payment/v1.0/partners/" + client.getString("client_moniker"));
|
|
|
|
|
String url = PlatformEnvironment.getEnv().concatUrl("/api/v1.0/payment/partners/" + client.getString("client_moniker"));
|
|
|
|
|
if (config.isCNY()) {
|
|
|
|
|
url += "_CNY";
|
|
|
|
|
}
|
|
|
|
@ -484,7 +505,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject ctripCouponInfo(JSONObject device, String coupon_id) {
|
|
|
|
|
return couponVerificationService.ctripCouponInfo(coupon_id,device.getIntValue("client_id"), true);
|
|
|
|
|
return couponVerificationService.ctripCouponInfo(coupon_id, device.getIntValue("client_id"), true);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -498,7 +519,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
PageList<JSONObject> cusCouponLogs = couponAccuessLogMapper.getCouponAccuessLog(
|
|
|
|
|
client.getIntValue("client_id"), keyword, new PageBounds(appQueryBean.getPage(), appQueryBean.getLimit(), Order.formString("creation_date.desc")));
|
|
|
|
|
HashMap<String, JSONObject> couponMap = new HashMap<>();
|
|
|
|
|
for(JSONObject cusCouponLog : cusCouponLogs) {
|
|
|
|
|
for (JSONObject cusCouponLog : cusCouponLogs) {
|
|
|
|
|
cusCouponLog.put("client_moniker", client_moniker);
|
|
|
|
|
if (couponMap.containsKey(cusCouponLog.getString("coupon_id"))) {
|
|
|
|
|
cusCouponLog.put("coupon", couponMap.get(cusCouponLog.getString("coupon_id")));
|
|
|
|
@ -521,7 +542,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
Date date = new Date();
|
|
|
|
|
couponAccuessLog.put("client_id", client_id);
|
|
|
|
|
couponAccuessLog.put("order_id", "NON_PLATFORM_ORDER");
|
|
|
|
|
couponAccuessLog.put("coupon_id", "CTRIP_"+coupon_id);
|
|
|
|
|
couponAccuessLog.put("coupon_id", "CTRIP_" + coupon_id);
|
|
|
|
|
couponAccuessLog.put("customer_openid", "NON_PLATFORM_ORDER");
|
|
|
|
|
couponAccuessLog.put("coupon_deal_amount", 0);
|
|
|
|
|
couponAccuessLog.put("currency", "AUD");
|
|
|
|
@ -581,7 +602,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
|| ("Company".equals(clientWithConfig.getString("business_structure")) && StringUtils.isEmpty(clientWithConfig.getString("acn")))
|
|
|
|
|
|| (!"Company".equals(clientWithConfig.getString("business_structure")) && StringUtils.isEmpty(clientWithConfig.getString("abn")))
|
|
|
|
|
|| (StringUtils.isEmpty(clientWithConfig.getString("company_website")) && StringUtils.isEmpty(clientWithConfig.getString("company_photo"))
|
|
|
|
|
&& StringUtils.isEmpty(clientWithConfig.getString("store_photo")))) {
|
|
|
|
|
&& StringUtils.isEmpty(clientWithConfig.getString("store_photo")))) {
|
|
|
|
|
res.put("base_info_lack", true);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -613,7 +634,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
|| ("Company".equals(client.getString("business_structure")) && StringUtils.isEmpty(client.getString("acn")))
|
|
|
|
|
|| (!"Company".equals(client.getString("business_structure")) && StringUtils.isEmpty(client.getString("abn")))
|
|
|
|
|
|| (StringUtils.isEmpty(client.getString("company_website")) && StringUtils.isEmpty(client.getString("company_photo"))
|
|
|
|
|
&& StringUtils.isEmpty(client.getString("store_photo")))) {
|
|
|
|
|
&& StringUtils.isEmpty(client.getString("store_photo")))) {
|
|
|
|
|
result.put("base_info_lack", true);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -1288,10 +1309,10 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
String father = "<div style=\"padding:0 10px\"></div>";
|
|
|
|
|
String html = doc.body().children().wrap(father).html();
|
|
|
|
|
// logger.debug("wrapped html---->"+html);
|
|
|
|
|
if (res.getIntValue("type")==2) {
|
|
|
|
|
List<JSONObject> buttons = JSONObject.parseArray(res.getString("buttons"),JSONObject.class);
|
|
|
|
|
if (res.getIntValue("type") == 2) {
|
|
|
|
|
List<JSONObject> buttons = JSONObject.parseArray(res.getString("buttons"), JSONObject.class);
|
|
|
|
|
res.put("buttons", buttons);
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
res.put("content", doc.html());
|
|
|
|
|
}
|
|
|
|
|
return res;
|
|
|
|
@ -1323,14 +1344,14 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
if (latestConfirmNotice != null) {
|
|
|
|
|
latestConfirmNotice.put("id", latestConfirmNotice.getString("notice_id"));
|
|
|
|
|
latestConfirmNotice.remove("notice_id");
|
|
|
|
|
List<JSONObject> buttons = JSONObject.parseArray(latestConfirmNotice.getString("buttons"),JSONObject.class);
|
|
|
|
|
List<JSONObject> buttons = JSONObject.parseArray(latestConfirmNotice.getString("buttons"), JSONObject.class);
|
|
|
|
|
latestConfirmNotice.put("buttons", buttons);
|
|
|
|
|
String content = latestConfirmNotice.getString("content");
|
|
|
|
|
if (content.indexOf("%excharge_rate%")>0) {
|
|
|
|
|
if (content.indexOf("%excharge_rate%") > 0) {
|
|
|
|
|
JSONObject rate = merchantInfoProvider.clientCurrentRate(client_id, new Date(), "CB_BankPay");
|
|
|
|
|
if (rate != null) {
|
|
|
|
|
content = content.replace("%excharge_rate%", (rate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN).toPlainString() + "%"));
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
content = content.replace("%excharge_rate%", "(暂未配置)");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1343,10 +1364,10 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
String EndDate = DateFormatUtils.format(rate.getDate("expiry_date"), "yyyy-MM-dd");
|
|
|
|
|
String[] rateName = {"清算时间", "签约费率", "结束时间"};
|
|
|
|
|
String[] rateKey = {cleanDays, rateValue, EndDate};
|
|
|
|
|
for(int i =0;i<rateName.length;i++){
|
|
|
|
|
for (int i = 0; i < rateName.length; i++) {
|
|
|
|
|
JSONObject b = new JSONObject();
|
|
|
|
|
b.put("name",rateName[i]);
|
|
|
|
|
b.put("value",rateKey[i]);
|
|
|
|
|
b.put("name", rateName[i]);
|
|
|
|
|
b.put("value", rateKey[i]);
|
|
|
|
|
b.put("type", "string");
|
|
|
|
|
rateInfo.add(b);
|
|
|
|
|
}
|
|
|
|
@ -1903,7 +1924,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
getActs.put("ad_cover", getActs.getString("page_desc"));
|
|
|
|
|
getActs.put("ad_mode", getActs.getString("page_keywords"));
|
|
|
|
|
getActs.put("ad_link", getActs.getString("summery"));
|
|
|
|
|
getActs.put("publish_date", DateFormatUtils.format(getActs.getDate("publish_time"),"yyyy/MM/dd HH:mm:ss"));
|
|
|
|
|
getActs.put("publish_date", DateFormatUtils.format(getActs.getDate("publish_time"), "yyyy/MM/dd HH:mm:ss"));
|
|
|
|
|
String reference = getActs.getString("reference");
|
|
|
|
|
JSONObject referenceObj = JSONObject.parseObject(reference);
|
|
|
|
|
if (reference != null) {
|
|
|
|
@ -1916,7 +1937,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
if (referenceObj.getString("duration_time") != null) {
|
|
|
|
|
getActs.put("duration_time", referenceObj.getString("duration_time"));
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
getActs.put("message", "mess : (ad_type && expire_date && duration_time) not set");
|
|
|
|
|
}
|
|
|
|
|
getActs.remove("reference");
|
|
|
|
@ -1971,9 +1992,9 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
@Override
|
|
|
|
|
public void submitMaterial(JSONObject material, JSONObject device) {
|
|
|
|
|
riskUploadService.submitMaterial(material);
|
|
|
|
|
JSONObject event = riskBusinessService.getRiskEventDetail(material.getString("risk_id"));
|
|
|
|
|
JSONObject event = riskBusinessService.getRiskEventDetail(material.getString("risk_id"));
|
|
|
|
|
//材料审核通过后可以重新提交
|
|
|
|
|
if(event.getIntValue("result_type")==3){
|
|
|
|
|
if (event.getIntValue("result_type") == 3) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
|
|
|
|
@ -1991,14 +2012,14 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
public void bindAccountEmail(JSONObject device, JSONObject email) {
|
|
|
|
|
String codeKey = device.getString("account_id");
|
|
|
|
|
String codeKeyValueRedis = stringRedisTemplate.boundValueOps(getUpdateAccountEmailKey(codeKey)).get();
|
|
|
|
|
if(StringUtils.isNotEmpty(codeKeyValueRedis)){
|
|
|
|
|
if (StringUtils.isNotEmpty(codeKeyValueRedis)) {
|
|
|
|
|
throw new BadRequestException("Captcha has been sent.Please check your email or try again in 5 minutes.");
|
|
|
|
|
}
|
|
|
|
|
String codeKeyValue = RandomStringUtils.random(6, false, true);
|
|
|
|
|
Context ctx = new Context();
|
|
|
|
|
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
|
|
|
|
|
ctx.setVariable("account",account);
|
|
|
|
|
ctx.setVariable("captcha",codeKeyValue);
|
|
|
|
|
ctx.setVariable("account", account);
|
|
|
|
|
ctx.setVariable("captcha", codeKeyValue);
|
|
|
|
|
final String content = thymeleaf.process("mail/account_bind_email.html", ctx);
|
|
|
|
|
royalThreadPoolExecutor.execute(() -> {
|
|
|
|
|
try {
|
|
|
|
@ -2008,23 +2029,23 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
throw new EmailException("Email Sending Failed", e);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
stringRedisTemplate.boundValueOps(getUpdateAccountEmailKey(codeKey)).set(codeKeyValue+"&"+email.getString("contact_email"), 5, TimeUnit.MINUTES);
|
|
|
|
|
stringRedisTemplate.boundValueOps(getUpdateAccountEmailKey(codeKey)).set(codeKeyValue + "&" + email.getString("contact_email"), 5, TimeUnit.MINUTES);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void updateAccountEmail(JSONObject device, JSONObject params) {
|
|
|
|
|
String key = stringRedisTemplate.boundValueOps(getUpdateAccountEmailKey(device.getString("account_id"))).get();
|
|
|
|
|
if(key == null){
|
|
|
|
|
if (key == null) {
|
|
|
|
|
throw new BadRequestException("Captcha has expired");
|
|
|
|
|
}
|
|
|
|
|
String captcha = key.split("&")[0];
|
|
|
|
|
String email = key.split("&")[1];
|
|
|
|
|
if(!StringUtils.equals(captcha,params.getString("captcha"))){
|
|
|
|
|
if (!StringUtils.equals(captcha, params.getString("captcha"))) {
|
|
|
|
|
throw new BadRequestException("Verification code is wrong");
|
|
|
|
|
}
|
|
|
|
|
JSONObject account = new JSONObject();
|
|
|
|
|
account.put("account_id",device.getString("account_id"));
|
|
|
|
|
account.put("contact_email",email);
|
|
|
|
|
JSONObject account = new JSONObject();
|
|
|
|
|
account.put("account_id", device.getString("account_id"));
|
|
|
|
|
account.put("contact_email", email);
|
|
|
|
|
clientAccountMapper.update(account);
|
|
|
|
|
deleteAccountEmailKey(device.getString("account_id"));
|
|
|
|
|
}
|
|
|
|
@ -2033,7 +2054,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
public void bindAccountPhone(JSONObject device, JSONObject phone) {
|
|
|
|
|
String codeKey = device.getString("account_id");
|
|
|
|
|
String codeKeyValueRedis = stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(codeKey)).get();
|
|
|
|
|
if(StringUtils.isNotEmpty(codeKeyValueRedis)){
|
|
|
|
|
if (StringUtils.isNotEmpty(codeKeyValueRedis)) {
|
|
|
|
|
throw new BadRequestException("Captcha has been sent.Please check your phone or try again in 5 minutes.");
|
|
|
|
|
}
|
|
|
|
|
String codeKeyValue = RandomStringUtils.random(6, false, true);
|
|
|
|
@ -2050,25 +2071,25 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
throw new ServerErrorException("Phone number is wrong.Please try again.");
|
|
|
|
|
}
|
|
|
|
|
stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(codeKey)).set(codeKeyValue+"&"+nationCode+"&"+phoneNumber, Long.parseLong(expireMin), TimeUnit.MINUTES);
|
|
|
|
|
stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(codeKey)).set(codeKeyValue + "&" + nationCode + "&" + phoneNumber, Long.parseLong(expireMin), TimeUnit.MINUTES);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void updateAccountPhone(JSONObject device, JSONObject params) {
|
|
|
|
|
String key = stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(device.getString("account_id"))).get();
|
|
|
|
|
if(key == null){
|
|
|
|
|
if (key == null) {
|
|
|
|
|
throw new BadRequestException("Captcha has expired");
|
|
|
|
|
}
|
|
|
|
|
String captcha = key.split("&")[0];
|
|
|
|
|
String nation_code = key.split("&")[1];
|
|
|
|
|
String contact_phone = key.split("&")[2];
|
|
|
|
|
if(!StringUtils.equals(captcha,params.getString("captcha"))){
|
|
|
|
|
if (!StringUtils.equals(captcha, params.getString("captcha"))) {
|
|
|
|
|
throw new BadRequestException("Verification code is wrong");
|
|
|
|
|
}
|
|
|
|
|
JSONObject account = new JSONObject();
|
|
|
|
|
account.put("account_id",device.getString("account_id"));
|
|
|
|
|
account.put("contact_phone",contact_phone);
|
|
|
|
|
account.put("nation_code","+" + nation_code);
|
|
|
|
|
JSONObject account = new JSONObject();
|
|
|
|
|
account.put("account_id", device.getString("account_id"));
|
|
|
|
|
account.put("contact_phone", contact_phone);
|
|
|
|
|
account.put("nation_code", "+" + nation_code);
|
|
|
|
|
clientAccountMapper.update(account);
|
|
|
|
|
deleteAccountPhoneKey(device.getString("account_id"));
|
|
|
|
|
}
|
|
|
|
@ -2112,7 +2133,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject toggleCBBankChannel(JSONObject device,String noticeId) {
|
|
|
|
|
public JSONObject toggleCBBankChannel(JSONObject device, String noticeId) {
|
|
|
|
|
String clientType = device.getString("client_type");
|
|
|
|
|
deviceSupport.findRegister(clientType);
|
|
|
|
|
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
|
|
|
|
@ -2135,7 +2156,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject toggleCBBankCustomerSurcharge(JSONObject device,boolean customerSurcharge) {
|
|
|
|
|
public JSONObject toggleCBBankCustomerSurcharge(JSONObject device, boolean customerSurcharge) {
|
|
|
|
|
String clientType = device.getString("client_type");
|
|
|
|
|
deviceSupport.findRegister(clientType);
|
|
|
|
|
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
|
|
|
|
@ -2150,7 +2171,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
result.put("status", "Fail");
|
|
|
|
|
if (customerSurcharge) {
|
|
|
|
|
result.put("message", "开启客户支付手续费失败,失败原因:" + e.getMessage());
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
result.put("message", "关闭客户支付手续费失败,失败原因:" + e.getMessage());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -2160,7 +2181,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
result.put("status", "Success");
|
|
|
|
|
if (customerSurcharge) {
|
|
|
|
|
result.put("message", "开启客户支付手续费成功!");
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
result.put("message", "关闭客户支付手续费成功!");
|
|
|
|
|
}
|
|
|
|
|
result.put("customerSurcharge", String.valueOf(customerSurcharge));
|
|
|
|
@ -2219,20 +2240,20 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void deleteAccountEmailKey(String codeKey){
|
|
|
|
|
private void deleteAccountEmailKey(String codeKey) {
|
|
|
|
|
stringRedisTemplate.delete(getUpdateAccountEmailKey(codeKey));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void deleteAccountPhoneKey(String codeKey){
|
|
|
|
|
private void deleteAccountPhoneKey(String codeKey) {
|
|
|
|
|
stringRedisTemplate.delete(getUpdateAccountPhoneKey(codeKey));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String getUpdateAccountEmailKey(String codeKey){
|
|
|
|
|
return BIND_ACCOUNT_EMAIL_PREFIX+codeKey;
|
|
|
|
|
private String getUpdateAccountEmailKey(String codeKey) {
|
|
|
|
|
return BIND_ACCOUNT_EMAIL_PREFIX + codeKey;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String getUpdateAccountPhoneKey(String codeKey){
|
|
|
|
|
return BIND_ACCOUNT_PHONE_PREFIX+codeKey;
|
|
|
|
|
private String getUpdateAccountPhoneKey(String codeKey) {
|
|
|
|
|
return BIND_ACCOUNT_PHONE_PREFIX + codeKey;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|