add 自助进件优化

master
luoyang 6 years ago
parent e27155f776
commit 515fc8ca91

@ -72,6 +72,7 @@ public class ClientPreApplyBean {
private String alipayindustry;
private String wechatindustry;
private String store_photo;
private String contract_url;
public JSONObject insertObject() {
JSONObject res = (JSONObject) JSON.toJSON(this);
@ -389,4 +390,12 @@ public class ClientPreApplyBean {
public void setWechatindustry(String wechatindustry) {
this.wechatindustry = wechatindustry;
}
public void setContract_url(String contract_url) {
this.contract_url = contract_url;
}
public String getContract_url() {
return contract_url;
}
}

@ -42,7 +42,7 @@ public interface SimpleClientApplyService {
JSONObject getSourceAggregateFile(String username ,String clean_days);
JSONObject getClientAggregateFile(String username, MultipartFile file,String clean_days) throws IOException;
JSONObject getClientAggregateFile(String username, MultipartFile file,String clean_days, JSONObject signInfo) throws IOException;
JSONObject getPreApplyInfoForAggree(String username ,String clean_days);

@ -49,6 +49,7 @@ import java.awt.image.BufferedImage;
import java.io.*;
import java.math.BigDecimal;
import java.net.URISyntaxException;
import java.net.URLDecoder;
import java.util.*;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
@ -405,10 +406,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
applyInfo.put("update_time", new Date());
sysClientPreMapperMapper.update(applyInfo);
if (applyInfo.getBooleanValue("agree")) {
if(apply.getString("contract_url")==null|| !(StringUtils.equals(apply.getString("clean_days"),applyInfo.getString("clean_days"))) ) {
throw new BadRequestException("The date of liquidation has changed and the contract needs to be renewed");
}
applyerToClient(username);
applyerToClient(username, null);
}
}
}
@ -518,10 +516,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
apply.put("clean_days", clean_days);
JSONObject sysConfig = sysConfigManager.getSysConfig();
JSONObject test = JSONObject.parseObject(sysConfig.getString("sys_apply_rates"));
JSONObject rate = test.getJSONObject("t"+clean_days.trim());
apply.put("wechat_rate",rate.getString("Wechat"));
apply.put("alipay_rate",rate.getString("Alipay"));
apply.put("alipay_online_rate",rate.getString("AlipayOnline"));
@ -551,18 +546,18 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
@Override
public JSONObject getClientAggregateFile(String username, MultipartFile file ,String clean_days) throws IOException{
public JSONObject getClientAggregateFile(String username, MultipartFile file ,String clean_days, JSONObject signInfo) throws IOException{
JSONObject apply = getPreApplyInfoForAggree(username ,clean_days);
apply.put("full_name", file.getOriginalFilename());
apply.put("full_name", URLDecoder.decode(file.getOriginalFilename(),"UTF-8"));
BufferedImage img = ImageIO.read(file.getInputStream());
ByteArrayOutputStream out = new ByteArrayOutputStream();
ImageIO.write(img, "png", out);
apply.put("img","data:image/png;base64," + Base64.encodeBase64String(out.toByteArray()));
return exportImgAggregateFile(username, apply);
return exportImgAggregateFile(username, apply, signInfo);
}
private JSONObject exportImgAggregateFile(String username, JSONObject apply) throws IOException{
private JSONObject exportImgAggregateFile(String username, JSONObject apply, JSONObject signInfo) throws IOException {
InputStream stream = null;
JSONObject contractInfo = new JSONObject();
try {
@ -570,30 +565,36 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
pdu.setTemplatePdfPath(IMG_AGGREGATE_FILE);
pdu.setPdfTemplate(apply);
File file = new File(username + "_agreement.pdf");
ByteArrayOutputStream bos = pdu.templetPdfBos(file,"STSong-Light","UniGB-UCS2-H");
ByteArrayOutputStream bos = pdu.templetPdfBos(file, "STSong-Light", "UniGB-UCS2-H");
stream = new ByteArrayInputStream(bos.toByteArray());
JSONObject fileInfo = attachmentClient.uploadFile(stream, username + "_" + System.currentTimeMillis() + "_agreement.pdf", false);
contractInfo.put("contract_url",fileInfo.getString("url"));
contractInfo.put("contract_url", fileInfo.getString("url"));
apply.put("contract_url", contractInfo.getString("contract_url"));
signInfo.put("contract_url", contractInfo.getString("contract_url"));
apply.put("agree", true);
apply.put("update_time", new Date());
sysClientPreMapperMapper.update(apply);
} catch (Exception e) {
logger.error("合同制作出现问题:", e);
throw new BadRequestException("合同制作出现问题:" + e.getMessage());
} finally {
stream.close();
}
applyerToClient(apply.getString("username"), signInfo);
return contractInfo;
}
//todo
private void applyerToClient(String username) {
private void applyerToClient(String username, JSONObject signInfo) {
JSONObject sysConfig = sysConfigManager.getSysConfig();
String arr[] = sysConfig.getString("temp_sub_mch_id").split(",");
List<String> availableMerchants = WechatPayEnvironment.getEnv().getWechatMerchantConfigs().stream()
.filter(mch->StringUtils.equals(mch.getMpId(),"globalpay"))
.filter(mch -> StringUtils.equals(mch.getMpId(), "globalpay"))
.map(WeChatPayConfig.Merchant::getMerchantId)
.collect(Collectors.toList());
JSONObject subMerchant = pmtSubMerchantIdMapper.randomOne(availableMerchants);
if(subMerchant==null){
if (subMerchant == null) {
throw new BadRequestException("System is busy Please try again");
}
Date now = new Date();
@ -612,9 +613,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
throw new ForbiddenException("The user name has been registered");
}
String clientMoniker = generateClientMoniker();
JSONObject sysClient = new JSONObject();
JSONObject followBd = managerMapper.findByLoginId("customerservice");
sysClient.put("bd_user", followBd.getString("manager_id"));
@ -626,16 +625,17 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
sysClient.put("suburb", apply.getString("suburb"));
sysClient.put("state", apply.getString("state"));
sysClient.put("postcode", apply.getString("postcode"));
sysClient.put("royalpayindustry", apply.getString("royalpayindustry"));
sysClient.put("royalpayindustry", apply.getString("industry"));
sysClient.put("alipayindustry", apply.getString("alipayindustry"));
sysClient.put("industry", apply.getString("industry"));//微信支付行业
sysClient.put("industry", apply.getString("wechatindustry"));
sysClient.put("contact_person", apply.getString("contact_person"));
sysClient.put("contact_job", apply.getString("contact_job"));
sysClient.put("logo_url", apply.getString("logo_url"));
sysClient.put("company_website", apply.getString("company_website"));
sysClient.put("company_photo", apply.getString("company_photo"));
sysClient.put("store_photo", apply.getString("store_photo"));
sysClient.put("contact_email", apply.getString("contact_email"));
sysClient.put("contact_phone", "+61"+apply.getString("contact_phone"));
sysClient.put("contact_phone", "+61" + apply.getString("contact_phone"));
sysClient.put("company_phone", apply.getString("company_phone"));
sysClient.put("client_moniker", clientMoniker);
sysClient.put("create_time", new Date());
@ -654,19 +654,9 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
sysClient.put("country", "AUS");
sysClient.put("credential_code", RandomStringUtils.random(32, true, true));
sysClient.put("ali_sub_merchant_id", clientMoniker);
sysClient.put("enable_wechat", 1);
clientMapper.save(sysClient);
JSONObject fileJson = new JSONObject();
fileJson.put("client_id", sysClient.getString("client_id"));
fileJson.put("last_update_date", new Date());
//fileJson.put("last_update_by", manager.getString("display_name"));
fileJson.put("file_name", CLIENT_AGREE_FILE);
fileJson.put("file_value", apply.getString("contract_url"));
fileJson.put("status", 0);
fileJson.put("is_valid", 1);
clientFilesMapper.save(fileJson);
JSONObject representativeInfo = new JSONObject();
representativeInfo.put("client_id", sysClient.getIntValue("client_id"));
representativeInfo.put("representative_person", apply.getString("representative_person"));
@ -684,7 +674,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
clientBd.put("bd_id", followBd.getString("manager_id"));
clientBd.put("bd_name", followBd.getString("display_name"));
clientBd.put("create_time", new Date());
clientBd.put("create_id","0");
clientBd.put("create_id", "0");
clientBd.put("start_date", new Date());
clientBd.put("proportion", 1);
clientBDMapper.saveBD(clientBd);
@ -706,6 +696,22 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
sysAccount.put("nation_code", "+61");
clientAccountMapper.save(sysAccount);
if (signInfo != null) {
JSONObject fileJson = new JSONObject();
fileJson.put("client_id", sysClient.getString("client_id"));
fileJson.put("last_update_date", new Date());
//fileJson.put("last_update_by", manager.getString("display_name"));
fileJson.put("file_name", CLIENT_AGREE_FILE);
fileJson.put("file_value", signInfo.getString("contract_url"));
fileJson.put("status", 1);
fileJson.put("signature_time", new Date());
fileJson.put("signature_ip", signInfo.getString("signature_ip"));
fileJson.put("user_agent", signInfo.getString("user_agent"));
fileJson.put("signature_account_id", sysAccount.getString("account_id"));
fileJson.put("is_valid", 1);
clientFilesMapper.save(fileJson);
}
JSONObject sysBank = new JSONObject();
sysBank.put("client_id", clientId);
sysBank.put("account_no", apply.getString("bank_no"));
@ -724,6 +730,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
JSONObject clientConfig = new JSONObject();
clientConfig.put("client_id", clientId);
clientConfig.put("skip_clearing", 1);
clientConfig.put("enable_wechat", 1);
clientConfig.put("client_moniker", clientMoniker);
clientConfig.put("clean_days", apply.getIntValue("clean_days"));
clientConfig.put("common_sub_merchant_id", 1);
@ -736,7 +743,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
apply.put("client_moniker", clientMoniker);
sysClientPreMapperMapper.update(apply);
permissionPartnerManager.permissionClientModuleSave(clientId,clientMoniker);
permissionPartnerManager.permissionClientModuleSave(clientId, clientMoniker);
JSONObject sysRate = new JSONObject();
sysRate.put("client_id", clientId);
@ -765,10 +772,16 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
configNewClientRate(sysRate, clientId, "AlipayOnline", "AlipayOnline");
configNewClientRate(sysRate, clientId, "Bestpay", "Bestpay");
configNewClientRate(sysRate, clientId, "jd", "JDpay");
configNewClientRate(sysRate, clientId, "CB_BankPay", "CB_Bankpay");
Runnable task2 = () -> {
try {
if (signInfo != null) {
clientManager.registerClientApplyGMS(clientMoniker, sysAccount.getString("account_id"));
}else {
clientManager.getNewAggregateAgreeFile(clientMoniker, null, true);
}
} catch (Exception ignore) {
logger.error("{}自助申请成功,支付宝报备失败:{}",clientMoniker,ignore);
}
};
pool.execute(task2);

@ -45,7 +45,6 @@ public class ContentController {
model.addAttribute("bestpay_rate", contractInfo.getString("bestpay_rate"));
model.addAttribute("alipay_rate", contractInfo.getString("alipay_rate"));
model.addAttribute("jd_rate", contractInfo.getString("jd_rate"));
return "contract_for_compliance";
}

@ -5,6 +5,7 @@ import au.com.royalpay.payment.manage.application.beans.ClientPreApplyStep1Bean;
import au.com.royalpay.payment.manage.application.core.SimpleClientApplyService;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.connections.attachment.core.AttachmentClient;
import au.com.royalpay.payment.tools.env.RequestEnvironment;
import au.com.royalpay.payment.tools.env.SysConfigManager;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
@ -82,9 +83,12 @@ public class SimpleClientApplyController {
@PostMapping(value = "/clientCompliance/commit_aggregate_file")
@ResponseBody
public JSONObject getClientArregateFile(@RequestParam MultipartFile file, @RequestParam String username, @RequestParam String clean_days) throws IOException {
public JSONObject getClientArregateFile(@RequestHeader("User-Agent") String userAgent,@RequestParam MultipartFile file, @RequestParam(value = "username") String username, @RequestParam(value = "clean_days") String clean_days) throws IOException {
//这个是上传合同的接口现在为了测试方便返回一个带合同url的JSONObject需要传入usernameclean_days签名图片
return simpleClientApplyService.getClientAggregateFile(username, file, clean_days);
JSONObject signInfo = new JSONObject();
signInfo.put("signature_ip", RequestEnvironment.getClientIp());
signInfo.put("user_agent", userAgent);
return simpleClientApplyService.getClientAggregateFile(username, file, clean_days, signInfo);
}
@GetMapping("/client/source_aggregate_file")

@ -370,6 +370,8 @@ public interface ClientManager {
void registerAlipayOnlineGms(String clientMoniker, JSONObject manager);
void registerClientApplyGMS(String clientMoniker, String account_id);
String queryAlipayGmsStatus(String clientMoniker, JSONObject manager);
JSONObject queryAlipayGmsJson(String clientMoniker, JSONObject manager);

@ -121,6 +121,7 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLDecoder;
import java.security.*;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
@ -330,7 +331,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
@Override
@Cacheable(value = ":app_client_info:", key = "''+#clientId", unless="#result == null")
@Cacheable(value = ":app_client_info:", key = "''+#clientId", unless = "#result == null")
public JSONObject getClientInfo(int clientId) {
return clientMapper.findClient(clientId);
}
@ -768,15 +769,15 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
try {
JSONObject representativeInfo = new JSONObject();
representativeInfo.put("client_id",partner.getIntValue("client_id"));
representativeInfo.put("representative_person",partner.getString("legal_representative_person"));
representativeInfo.put("phone",partner.getString("legal_representative_phone"));
representativeInfo.put("email",partner.getString("legal_representative_email"));
representativeInfo.put("job_title",partner.getString("legal_representative_job"));
representativeInfo.put("address",partner.getString("registered_address"));
representativeInfo.put("suburb",partner.getString("registered_suburb"));
representativeInfo.put("postcode",partner.getString("registered_postcode"));
representativeInfo.put("state",partner.getString("registered_state"));
representativeInfo.put("client_id", partner.getIntValue("client_id"));
representativeInfo.put("representative_person", partner.getString("legal_representative_person"));
representativeInfo.put("phone", partner.getString("legal_representative_phone"));
representativeInfo.put("email", partner.getString("legal_representative_email"));
representativeInfo.put("job_title", partner.getString("legal_representative_job"));
representativeInfo.put("address", partner.getString("registered_address"));
representativeInfo.put("suburb", partner.getString("registered_suburb"));
representativeInfo.put("postcode", partner.getString("registered_postcode"));
representativeInfo.put("state", partner.getString("registered_state"));
sysClientLegalPersonMapper.save(representativeInfo);
} catch (Exception e) {
throw new BadRequestException("error.partner.valid.dumplicate_client_moniker");
@ -833,19 +834,19 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
updateInfo.put("client_id", clientId);
JSONObject representativeInfo = new JSONObject();
representativeInfo.put("client_id",clientId);
representativeInfo.put("representative_person",info.getRepresentativePerson());
representativeInfo.put("phone",info.getRepresentativePhone());
representativeInfo.put("email",info.getRepresentativeEmail());
representativeInfo.put("job_title",info.getRepresentativeJobTitle());
representativeInfo.put("address",info.getRegisteredAddress());
representativeInfo.put("suburb",info.getRegisteredSuburb());
representativeInfo.put("postcode",info.getRegisteredPostcode());
representativeInfo.put("state",info.getRegisteredState());
if(sysClientLegalPersonMapper.findRepresentativeInfo(clientId) != null){
representativeInfo.put("client_id", clientId);
representativeInfo.put("representative_person", info.getRepresentativePerson());
representativeInfo.put("phone", info.getRepresentativePhone());
representativeInfo.put("email", info.getRepresentativeEmail());
representativeInfo.put("job_title", info.getRepresentativeJobTitle());
representativeInfo.put("address", info.getRegisteredAddress());
representativeInfo.put("suburb", info.getRegisteredSuburb());
representativeInfo.put("postcode", info.getRegisteredPostcode());
representativeInfo.put("state", info.getRegisteredState());
if (sysClientLegalPersonMapper.findRepresentativeInfo(clientId) != null) {
sysClientLegalPersonMapper.update(representativeInfo);
}else{
} else {
sysClientLegalPersonMapper.save(representativeInfo);
}
@ -1231,7 +1232,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override
public void run() {
try {
String emailId = mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", StringUtils.join(mailTos,","), "", content);
String emailId = mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", StringUtils.join(mailTos, ","), "", content);
mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", emails.isEmpty() ? "" : StringUtils.join(emails, ","),
"", contentBd);
JSONObject clientUpdate = new JSONObject();
@ -1296,7 +1297,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override
public void run() {
try {
String emailId = mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", StringUtils.join(mailTos,","), "", content);
String emailId = mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", StringUtils.join(mailTos, ","), "", content);
mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", emails.isEmpty() ? "" : StringUtils.join(emails, ","),
"", contentBd);
JSONObject clientUpdate = new JSONObject();
@ -1563,10 +1564,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return accountJson;
}
private void checkPhoneAndWechatExist(NewAccountBean account){
if(clientAccountMapper.findByPhone(account.getContactPhone(),"+"+account.getNation_code())!=null){
private void checkPhoneAndWechatExist(NewAccountBean account) {
if (clientAccountMapper.findByPhone(account.getContactPhone(), "+" + account.getNation_code()) != null) {
throw new BadRequestException("Mobile phone number has been bound to other accounts");
};
}
;
}
@Override
@ -1637,7 +1639,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (account == null) {
throw new BadRequestException("account not exists");
}
if(clientAccountMapper.findByWechatOpenId(user.getString("openid"))!=null || clientAccountMapper.findByWxUnioinId(user.getString("unioinid"))!=null){
if (clientAccountMapper.findByWechatOpenId(user.getString("openid")) != null || clientAccountMapper.findByWxUnioinId(user.getString("unioinid")) != null) {
throw new BadRequestException("The WeChat has been linked to other accounts");
}
JSONObject res = new JSONObject();
@ -3462,8 +3464,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
JSONObject client = getClientInfoByMoniker(clientMoniker);
String clientPayType = "";
String companyPhoto = "";
String storePhoto= "";
String webSite= "";
String storePhoto = "";
String webSite = "";
int sourceEnum = 2;
if (client == null) {
throw new InvalidShortIdException();
@ -3479,7 +3481,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (clientAllAuthFiles.stream().noneMatch(fileJson -> fileKey.equals(fileJson.getString("file_name")))) {
if ("client_agree_file".equals(fileKey)) {
throw new BadRequestException("Please check that the agreement has been signed");
}else {
} else {
throw new BadRequestException("Please check the " + fileNames[i] + " is uploaded completely");
}
}
@ -3524,7 +3526,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
@Override
public JSONObject getClientAggregateFile(JSONObject account, MultipartFile file) throws IOException{
public JSONObject getClientAggregateFile(JSONObject account, MultipartFile file) throws IOException {
if (StringUtils.isBlank(file.getOriginalFilename())) {
throw new BadRequestException("Please Enter Full Name");
}
@ -3600,11 +3602,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
Date endDate = TimeZoneUtils.nextYearByCurrDay();
String end_date = DateFormatUtils.format(endDate, "dd/MM/yyyy");
client.put("end_date", end_date);
client.put("full_name", file.getOriginalFilename());
client.put("full_name", URLDecoder.decode(file.getOriginalFilename(),"UTF-8"));
BufferedImage img = ImageIO.read(file.getInputStream());
ByteArrayOutputStream out = new ByteArrayOutputStream();
ImageIO.write(img, "png", out);
client.put("img","data:image/png;base64," + Base64.encodeBase64String(out.toByteArray()));
client.put("img", "data:image/png;base64," + Base64.encodeBase64String(out.toByteArray()));
JSONObject clientLegal = sysClientLegalPersonMapper.findRepresentativeInfo(client.getIntValue("client_id"));
if (clientLegal != null) {
client.put("legal_person", clientLegal.getString("representative_person"));
@ -3699,7 +3701,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (aggregateFiles != null && aggregateFiles.size() > 0) {
clientFilesMapper.deleteAggreeByClientId(clientId);
}
String signatureAccountId = StringUtils.isNotBlank("account_id")?manager.getString("account_id"):manager.getString("manager_id");
String signatureAccountId = StringUtils.isNotBlank("account_id") ? manager.getString("account_id") : manager.getString("manager_id");
JSONObject fileJson = new JSONObject();
fileJson.put("client_id", clientId);
fileJson.put("last_update_date", new Date());
@ -3713,7 +3715,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
fileJson.put("status", 0);
fileJson.put("is_valid", 1);
clientFilesMapper.save(fileJson);
logger.info("{}合同文件上传成功IP:{},us-agent:{},signature_id:{}",clientId,manager.getString("signature_ip"),manager.getString("user_agent"),signatureAccountId);
logger.info("{}合同文件上传成功IP:{},us-agent:{},signature_id:{}", clientId, manager.getString("signature_ip"), manager.getString("user_agent"), signatureAccountId);
JSONObject file = new JSONObject();
file.put("file_id", fileJson.getString("file_id"));
file.put("file_value", fileJson.getString("file_value"));
@ -4209,7 +4211,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
JSONObject oldClienetLegal = sysClientLegalPersonMapper.findRepresentativeInfo(client_id);
if (oldClienetLegal == null) {
sysClientLegalPersonMapper.save(clientLegal);
}else {
} else {
sysClientLegalPersonMapper.update(clientLegal);
}
}
@ -4795,18 +4797,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) {
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
if (!client.containsKey("store_photo") || !client.containsKey("company_photo")) {
throw new InvalidParameterException("store photo cannot be empty ");
}
JSONObject client_bank = getBankAccountByClientId(client.getIntValue("client_id"));
if (client_bank == null || client_bank.size() <= 0) {
throw new BadRequestException("The Partner's Account is not config!");
}
client.put("bank_id", client_bank.getString("account_no"));
if (StringUtils.isBlank(client.getString("business_structure"))) {
throw new BadRequestException("Business Structure can't be null");
client.put("business_structure", "Registered body(Sole Trader)");
}
if (StringUtils.isBlank(client.getString("alipayindustry"))) {
@ -4926,24 +4922,17 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) {
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
if (!client.containsKey("company_website")) {
throw new InvalidParameterException("Website cannot be empty ");
}
if (StringUtils.isBlank(client.getString("business_structure"))) {
throw new BadRequestException("Business Structure can't be null");
client.put("business_structure", "Registered body(Sole Trader)");
}
if (StringUtils.isBlank(client.getString("alipayindustry"))) {
throw new BadRequestException("Alipay Industry can't be null");
}
JSONObject client_bank = getBankAccountByClientId(client.getIntValue("client_id"));
if (client_bank == null || client_bank.size() <= 0) {
throw new BadRequestException("The Partner's Account is not config!");
}
client.put("bank_id", client_bank.getString("account_no"));
AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayOnlineMerchant();
Element resultElement = alipayClient.registerOnlineGmsPortal(mch.getPid(), client);
if (!StringUtils.equalsIgnoreCase("T", resultElement.elementText("is_success"))) {
@ -4960,12 +4949,36 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
@Override
public void registerClientApplyGMS(String clientMoniker, String accountId) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
JSONObject clientConfig = merchantInfoProvider.getClientConfigInfoByMoniker(clientMoniker);
JSONObject account = clientAccountMapper.findById(accountId);
if (clientConfig == null) {
throw new InvalidShortIdException();
}
if (StringUtils.isNotBlank(clientConfig.getString("client_pay_type"))) {
String[] payType = clientConfig.getString("client_pay_type").split(",");
if (Arrays.asList(payType).contains("1")) {
registerAlipayOnlineGms(clientMoniker, null);
switchChannelPermission(account, clientMoniker, "Alipay", true);
}
if (Arrays.asList(payType).contains("2")) {
registerAlipayGms(clientMoniker, null);
enableGatewayAlipayOnline(account, clientMoniker, true);
}
}
}
@Override
public String queryAlipayOnlineGmsStatus(String clientMoniker, JSONObject manager) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayOnlineMerchant();
Element resultElement = alipayClient.queryOnlineGmsPortalStatus(mch.getPid(), client);
if (!StringUtils.equalsIgnoreCase("T", resultElement.elementText("is_success"))) {
@ -5758,7 +5771,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
clientMapper.update(updateClient);
}
private JSONObject exportImgAggregateFile(JSONObject account, JSONObject client) throws IOException{
private JSONObject exportImgAggregateFile(JSONObject account, JSONObject client) throws IOException {
JSONObject result = new JSONObject();
InputStream stream = null;
try {
@ -5766,7 +5779,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
pdu.setTemplatePdfPath(IMG_AGGREGATE_FILE);
pdu.setPdfTemplate(client);
File file = new File(client.getString("client_moniker") + "_agreement.pdf");
ByteArrayOutputStream bos = pdu.templetPdfBos(file,"STSong-Light","UniGB-UCS2-H");
ByteArrayOutputStream bos = pdu.templetPdfBos(file, "STSong-Light", "UniGB-UCS2-H");
stream = new ByteArrayInputStream(bos.toByteArray());
JSONObject fileInfo = attachmentClient.uploadFile(stream, client.getString("client_moniker") + "_" + System.currentTimeMillis() + "_agreement.pdf", false);
ClientAuthFilesInfo clientAuthFilesInfo = new ClientAuthFilesInfo();

@ -370,22 +370,6 @@
placeholder="Company Name" required maxlength="80">
</div>
<div class="form-group">
<label class="control-label col-sm-2">* Logo</label>
<div class="col-sm-8">
<div class="form-control-static">
<button class="btn btn-success" type="button"
ngf-select="uploadLogo($file)"
accept="image/*">
<i class="fa fa-upload"></i> Upload Logo
</button>
</div>
<uib-progressbar value="logoProgress.value"
ng-if="logoProgress"></uib-progressbar>
<img ng-src="{{partner.logo_url}}" ng-if="partner.logo_url" style="height: 100px;">
</div>
</div>
<div class="form-group has-feedback"
ng-class="{'has-error':companyForm.abn.$invalid && companyForm.abn.$dirty}">
<input class="form-control" ng-model="partner.abn" placeholder="ABN"
@ -426,78 +410,6 @@
<input class="form-control" ng-model="partner.postcode" placeholder="Postcode" required
maxlength="10" name="postcode">
</div>
<div class="form-group has-feedback"
ng-class="{'has-error':companyForm.contact_job.$invalid && companyForm.contact_job.$dirty}">
<input class="form-control" ng-model="partner.contact_job" placeholder="Your Job Title"
required maxlength="50" name="contact_job">
</div>
<div class="panel panel-default">
<div class="panel-heading">Legal person information</div>
<div class="panel-body">
<div class="form-group has-feedback"
ng-class="{'has-error':companyForm.representative_person.$invalid && companyForm.representative_person.$dirty}">
<input class="form-control" ng-model="partner.representative_person" placeholder="Representative Person Name"
required maxlength="50" name="contact_person">
</div>
<div class="form-group col-xs-12"
ng-class="{'has-error':companyForm.representative_phone.$invalid && companyForm.representative_phone.$dirty}">
<div class="input-group">
<span class="input-group-addon">{{partner.nation_code}}</span>
<input type="text" name="representative_phone" required ng-model="partner.representative_phone"
class="form-control" style="display: inline" onkeyup="value=value.replace(/[^\d]/g,'')"
placeholder="Representative Person Phone" maxlength="11">
</div>
</div>
<div class="form-group has-feedback"
ng-class="{'has-error':companyForm.representative_email.$invalid && companyForm.representative_email.$dirty}">
<input type="email" class="form-control" ng-model="partner.representative_email" placeholder="Representative Email address"
required maxlength="50" name="contact_email" ng-mouseleave="checkParams()" ng-mousedown="trueEmail =false">
<div style="text-align: left" ng-if="trueEmail">
<p style="text-align: left;font-size: 12px;color: red">The mailbox is incorrect</p>
</div>
</div>
<div class="form-group has-feedback"
ng-class="{'has-error':companyForm.representative_job_title.$invalid && companyForm.representative_job_title.$dirty}">
<input class="form-control" ng-model="partner.representative_job_title" placeholder="Representative Person Job Title"
required maxlength="50" name="representative_job_title">
</div>
<label><input type="checkbox" ng-click="samePerson()">I'm the legal person.</label>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">Registered Address</div>
<div class="panel-body">
<div class="form-group has-feedback"
ng-class="{'has-error':companyForm.registered_address.$invalid && companyForm.registered_address.$dirty}">
<textarea class="form-control" ng-model="partner.registered_address" placeholder="Registered Address"
name="registered_address" required maxlength="200"></textarea>
</div>
<div class="form-group has-feedback"
ng-class="{'has-error':companyForm.registered_suburb.$invalid && companyForm.registered_suburb.$dirty}">
<input class="form-control" ng-model="partner.registered_suburb" placeholder="Registered Suburb" required
maxlength="50" name="registered_suburb">
</div>
<div class="form-group has-feedback"
ng-class="{'has-error':companyForm.registered_state.$invalid && companyForm.registered_state.$dirty}">
<select class="form-control" name="registered_state"
ng-model="partner.registered_state" maxlength="20"
id="registered_state-input" required
ng-options="state.value as state.label for state in states">
<option value="">Registered State</option>
</select>
</div>
<div class="form-group has-feedback"
ng-class="{'has-error':companyForm.registered_postcode.$invalid && companyForm.registered_postcode.$dirty}">
<input class="form-control" ng-model="partner.registered_postcode" placeholder="Registered Postcode" required
maxlength="10" name="registered_postcode">
</div>
<label><input type="checkbox" ng-click="sameAddress()"> Registered Office Address Same As Trading Address.</label>
</div>
</div>
<div class="row">
<div class="col-xs-12 margin-bottom">
<div class="form-group has-feedback" ng-class="{'has-error':companyForm.royalpayindustry.$invalid && companyForm.royalpayindustry.$dirty}">
@ -933,7 +845,6 @@
</div>
</div>
</div>
</div>
<section class="section section-six fp-auto-height footer">
<div class="container">

Loading…
Cancel
Save