|
|
|
@ -68,14 +68,12 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.github.miemiedev.mybatis.paginator.domain.Order;
|
|
|
|
|
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
|
|
|
|
|
import com.github.miemiedev.mybatis.paginator.domain.PageList;
|
|
|
|
|
import org.apache.commons.codec.binary.Base64;
|
|
|
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
|
|
|
import org.apache.commons.lang3.RandomStringUtils;
|
|
|
|
|
import org.apache.commons.lang3.RandomUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
|
|
|
|
import org.apache.commons.lang3.time.DateUtils;
|
|
|
|
|
import org.joda.time.DateTime;
|
|
|
|
|
import org.jsoup.Jsoup;
|
|
|
|
|
import org.jsoup.nodes.Document;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
@ -89,10 +87,8 @@ import org.thymeleaf.context.Context;
|
|
|
|
|
import org.thymeleaf.spring5.SpringTemplateEngine;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.imageio.ImageIO;
|
|
|
|
|
import javax.servlet.ServletOutputStream;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import java.awt.image.BufferedImage;
|
|
|
|
|
import java.io.*;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.math.RoundingMode;
|
|
|
|
@ -676,7 +672,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
res.put("skip_clearing", !res.getBoolean("skip_clearing"));
|
|
|
|
|
}
|
|
|
|
|
sysClientLegalPersonMapper.findRepresentativeInfo(device.getIntValue("client_id"));
|
|
|
|
|
res.put("representative_info",sysClientLegalPersonMapper.findRepresentativeInfo(device.getIntValue("client_id")));
|
|
|
|
|
res.put("representative_info", sysClientLegalPersonMapper.findRepresentativeInfo(device.getIntValue("client_id")));
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -938,7 +934,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
params.put("dev_id", device.getString("dev_id"));
|
|
|
|
|
}
|
|
|
|
|
params.put("client_id", client_id);
|
|
|
|
|
params.put("after_limit", (query.getPage()-1)*query.getLimit());
|
|
|
|
|
params.put("after_limit", (query.getPage() - 1) * query.getLimit());
|
|
|
|
|
params.put("limit", query.getLimit());
|
|
|
|
|
List<JSONObject> orders = orderMapper.listTransactionsForApp(params);
|
|
|
|
|
TimeZoneUtils.switchTimeZone(orders, query.getTimezone(), "create_time", "transaction_time", "confirm_time");
|
|
|
|
@ -2122,14 +2118,11 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject bindAccountPhone(JSONObject device, JSONObject phone) {
|
|
|
|
|
public void bindAccountPhone(JSONObject device, JSONObject phone) {
|
|
|
|
|
String codeKey = device.getString("account_id");
|
|
|
|
|
String codeKeyValueRedis = stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(codeKey)).get();
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
if (StringUtils.isNotEmpty(codeKeyValueRedis)) {
|
|
|
|
|
result.put("status","error");
|
|
|
|
|
result.put("message","Captcha has been sent.Please check your phone or try again in 5 minutes.");
|
|
|
|
|
return result;
|
|
|
|
|
throw new BadRequestException("Captcha has been sent.Please check your phone or try again in 1 minutes.");
|
|
|
|
|
}
|
|
|
|
|
String codeKeyValue = RandomStringUtils.random(6, false, true);
|
|
|
|
|
String nationCode = phone.getString("nation_code");
|
|
|
|
@ -2137,44 +2130,33 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
ArrayList<String> param = new ArrayList<>();
|
|
|
|
|
param.add("绑定手机号");
|
|
|
|
|
param.add(codeKeyValue);
|
|
|
|
|
String expireMin = "5";
|
|
|
|
|
String expireMin = "1";
|
|
|
|
|
param.add(expireMin);
|
|
|
|
|
try {
|
|
|
|
|
// smsSender.getSender().sendWithParam(nationCode.trim(), phoneNumber, BIND_PHONE_TEMPLID, param, "RoyalPay", "", "");
|
|
|
|
|
stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(codeKey)).set(codeKeyValue + "&" + nationCode + "&" + phoneNumber, Long.parseLong(expireMin), TimeUnit.MINUTES);
|
|
|
|
|
result.put("status","success");
|
|
|
|
|
result.put("code_Key_Value",codeKeyValue);
|
|
|
|
|
smsSender.getSender().sendWithParam(nationCode.trim(), phoneNumber, BIND_PHONE_TEMPLID, param, "RoyalPay", "", "");
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
result.put("status","error");
|
|
|
|
|
result.put("message","Phone number is wrong.Please try again.");
|
|
|
|
|
throw new BadRequestException("Phone number is wrong.Please try again.");
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(codeKey)).set(codeKeyValue + "&" + nationCode + "&" + phoneNumber, Long.parseLong(expireMin), TimeUnit.MINUTES);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject updateAccountPhone(JSONObject device, JSONObject params) {
|
|
|
|
|
String key = stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(device.getString("account_id"))).get();
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
if (key == null) {
|
|
|
|
|
result.put("status","error");
|
|
|
|
|
result.put("message","Captcha has expired");
|
|
|
|
|
return result;
|
|
|
|
|
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"))) {
|
|
|
|
|
result.put("status","error");
|
|
|
|
|
result.put("message","Verification code is wrong");
|
|
|
|
|
return result;
|
|
|
|
|
throw new BadRequestException("Verification code is wrong");
|
|
|
|
|
}
|
|
|
|
|
JSONObject account = clientAccountMapper.findByPhone(contact_phone, "+"+nation_code);
|
|
|
|
|
if(account!=null){
|
|
|
|
|
result.put("status","error");
|
|
|
|
|
result.put("message","Mobile phone number has been bound to other users, please unbind it before binding");
|
|
|
|
|
return result;
|
|
|
|
|
JSONObject account = clientAccountMapper.findByPhone(contact_phone, "+" + nation_code);
|
|
|
|
|
if (account != null) {
|
|
|
|
|
throw new BadRequestException("Mobile phone number has been bound to other users, please unbind it before binding");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JSONObject updateAccount = new JSONObject();
|
|
|
|
@ -2183,43 +2165,37 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
updateAccount.put("nation_code", "+" + nation_code);
|
|
|
|
|
clientAccountMapper.update(updateAccount);
|
|
|
|
|
deleteAccountPhoneKey(device.getString("account_id"));
|
|
|
|
|
result.put("status","success");
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
result.put("status", "success");
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void updateLoginClientAccountPhone(JSONObject account, String contactPhone, String nationCode){
|
|
|
|
|
JSONObject updateAccount = new JSONObject();
|
|
|
|
|
updateAccount.put("account_id",account.getString("account_id"));
|
|
|
|
|
updateAccount.put("contact_phone",contactPhone);
|
|
|
|
|
updateAccount.put("nation_code","+" + nationCode);
|
|
|
|
|
public void updateLoginClientAccountPhone(JSONObject account, String contactPhone, String nationCode) {
|
|
|
|
|
JSONObject updateAccount = new JSONObject();
|
|
|
|
|
updateAccount.put("account_id", account.getString("account_id"));
|
|
|
|
|
updateAccount.put("contact_phone", contactPhone);
|
|
|
|
|
updateAccount.put("nation_code", "+" + nationCode);
|
|
|
|
|
clientAccountMapper.update(updateAccount);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void updateLoginClientAccountOpenId(JSONObject account,JSONObject params){
|
|
|
|
|
JSONObject updateAccount = new JSONObject();
|
|
|
|
|
JSONObject queryAccount = account.getJSONObject("account");
|
|
|
|
|
updateAccount.put("account_id",queryAccount.getString("account_id"));
|
|
|
|
|
updateAccount.put("wechat_openid",params.getString("wechat_openid"));
|
|
|
|
|
public void updateLoginClientAccountOpenId(JSONObject account, JSONObject params) {
|
|
|
|
|
JSONObject updateAccount = new JSONObject();
|
|
|
|
|
updateAccount.put("account_id", account.getString("account_id"));
|
|
|
|
|
updateAccount.put("wechat_openid", params.getString("wechat_openid"));
|
|
|
|
|
clientAccountMapper.update(updateAccount);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject unbindAccountPhone(JSONObject device, JSONObject phone) {
|
|
|
|
|
|
|
|
|
|
String codeKeyValueRedis = stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(device.getString("account_id"))).get();
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
if (codeKeyValueRedis == null) {
|
|
|
|
|
result.put("status","error");
|
|
|
|
|
result.put("message","Captcha has expired");
|
|
|
|
|
return result;
|
|
|
|
|
throw new BadRequestException("Captcha has expired");
|
|
|
|
|
}
|
|
|
|
|
String captcha = codeKeyValueRedis.split("&")[0];
|
|
|
|
|
if (!StringUtils.equals(captcha, phone.getString("captcha"))) {
|
|
|
|
|
result.put("status","error");
|
|
|
|
|
result.put("message","Verification code is wrong");
|
|
|
|
|
return result;
|
|
|
|
|
throw new BadRequestException("");
|
|
|
|
|
}
|
|
|
|
|
JSONObject account = new JSONObject();
|
|
|
|
|
account.put("account_id", device.getString("account_id"));
|
|
|
|
@ -2227,39 +2203,53 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
account.put("nation_code", null);
|
|
|
|
|
clientAccountMapper.update(account);
|
|
|
|
|
deleteAccountPhoneKey(device.getString("account_id"));
|
|
|
|
|
result.put("status","success");
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
result.put("status", "success");
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void unbindAccountWechat(JSONObject device) {
|
|
|
|
|
public JSONObject unbindAccountWechat(JSONObject device) {
|
|
|
|
|
JSONObject account = new JSONObject();
|
|
|
|
|
account.put("account_id", device.getString("account_id"));
|
|
|
|
|
account.put("wechat_openid", null);
|
|
|
|
|
clientAccountMapper.update(account);
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
result.put("status", "success");
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject bindAccountWechat(JSONObject device, JSONObject params){
|
|
|
|
|
public JSONObject bindAccountWechat(JSONObject device, JSONObject params) {
|
|
|
|
|
JSONObject user = mpClientAppWechatApiProvider.getApi("merchant-app").appLoginUser(params.getString("code"));
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
if(user==null){
|
|
|
|
|
result.put("status","error");
|
|
|
|
|
result.put("message","WeChat users do not exist");
|
|
|
|
|
return result;
|
|
|
|
|
if (user == null) {
|
|
|
|
|
throw new BadRequestException("WeChat users do not exist");
|
|
|
|
|
}
|
|
|
|
|
String openId = user.getString("openid");
|
|
|
|
|
JSONObject account = clientAccountMapper.findByOpenId(openId);
|
|
|
|
|
if(account!=null){
|
|
|
|
|
result.put("status","error");
|
|
|
|
|
result.put("message","WeChat ID has been bound to other accounts, please unbind it before binding");
|
|
|
|
|
return result;
|
|
|
|
|
if (account != null) {
|
|
|
|
|
throw new BadRequestException("WeChat ID has been bound to other accounts, please unbind it before binding");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JSONObject updateAccount = new JSONObject();
|
|
|
|
|
updateAccount.put("account_id", device.getString("account_id"));
|
|
|
|
|
updateAccount.put("wechat_openid", openId);
|
|
|
|
|
clientAccountMapper.update(updateAccount);
|
|
|
|
|
result.put("status","success");
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
result.put("status", "success");
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject getAccountBindInfos(JSONObject device) {
|
|
|
|
|
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
result.put("phone_bind_status",!account.containsValue("contact_phone"));
|
|
|
|
|
if(!account.containsValue("contact_phone")){
|
|
|
|
|
result.put("contact_phone",account.getString("contact_phone"));
|
|
|
|
|
result.put("naticon_code",account.getString("naticon_code"));
|
|
|
|
|
}
|
|
|
|
|
result.put("wechat_bind_status",!account.containsValue("wechat_openid"));
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2556,7 +2546,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean isSubPartner(JSONObject device,String clientMoniker) {
|
|
|
|
|
public boolean isSubPartner(JSONObject device, String clientMoniker) {
|
|
|
|
|
JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker);
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new NotFoundException("Client not found, please check");
|
|
|
|
@ -2570,7 +2560,6 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void exportCBBankAggregateFile(JSONObject client, HttpServletResponse httpResponse) {
|
|
|
|
|
httpResponse.setContentType("application/pdf");
|
|
|
|
|
httpResponse.setHeader("content-disposition", "attachment;filename=" + client.getString("client_moniker") + "_AGREEMENT_" + new Date() + ".pdf");
|
|
|
|
@ -2707,4 +2696,5 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
res.put("channels", channels);
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|