master
wangning 8 years ago
parent cf425c44dc
commit 29ee5e46f7

@ -278,20 +278,23 @@ public class RetailAppServiceImp implements RetailAppService {
public void changeSurchargeEnable(JSONObject device, UpdateSurchargeDTO updateSurchargeDTO) { public void changeSurchargeEnable(JSONObject device, UpdateSurchargeDTO updateSurchargeDTO) {
JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id")); JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id"));
JSONObject account = clientAccountMapper.findById(device.getString("account_id")); JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
if(PartnerRole.getRole(account.getIntValue("role")) != PartnerRole.ADMIN){ if (PartnerRole.getRole(account.getIntValue("role")) != PartnerRole.ADMIN) {
throw new ForbiddenException("You have no permission"); throw new ForbiddenException("You have no permission");
} }
if (client == null) { if (client == null) {
throw new NotFoundException("Client not found, please check"); throw new NotFoundException("Client not found, please check");
} }
if (updateSurchargeDTO.getApiSurcharge() != null) { if (updateSurchargeDTO.getApiSurcharge() != null) {
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,client.getString("client_moniker"),"api_surcharge",updateSurchargeDTO.getApiSurcharge())); clientModifySupport.processClientConfigModify(
new SwitchPermissionModify(account, client.getString("client_moniker"), "api_surcharge", updateSurchargeDTO.getApiSurcharge()));
} }
if (updateSurchargeDTO.getQrcodeSurcharge() != null) { if (updateSurchargeDTO.getQrcodeSurcharge() != null) {
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,client.getString("client_moniker"),"qrcode_surcharge",updateSurchargeDTO.getQrcodeSurcharge())); clientModifySupport.processClientConfigModify(
new SwitchPermissionModify(account, client.getString("client_moniker"), "qrcode_surcharge", updateSurchargeDTO.getQrcodeSurcharge()));
} }
if (updateSurchargeDTO.getRetailSurcharge() != null) { if (updateSurchargeDTO.getRetailSurcharge() != null) {
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,client.getString("client_moniker"),"retail_surcharge",updateSurchargeDTO.getRetailSurcharge())); clientModifySupport.processClientConfigModify(
new SwitchPermissionModify(account, client.getString("client_moniker"), "retail_surcharge", updateSurchargeDTO.getRetailSurcharge()));
} }
} }
@ -341,7 +344,7 @@ public class RetailAppServiceImp implements RetailAppService {
public JSONObject getAuthFiles(JSONObject device) { public JSONObject getAuthFiles(JSONObject device) {
JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id")); JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id"));
JSONObject account = clientAccountMapper.findById(device.getString("account_id")); JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
return clientManager.getAuthFiles(account,client.getString("client_moniker")); return clientManager.getAuthFiles(account, client.getString("client_moniker"));
} }
@Override @Override
@ -351,24 +354,24 @@ public class RetailAppServiceImp implements RetailAppService {
clientAuthFilesInfo.setFile_id_info(null); clientAuthFilesInfo.setFile_id_info(null);
clientAuthFilesInfo.setAuthStatus(0); clientAuthFilesInfo.setAuthStatus(0);
clientAuthFilesInfo.setFile_agreement_info(null); clientAuthFilesInfo.setFile_agreement_info(null);
clientManager.uploadAuthFiles(account,client.getString("client_moniker"),clientAuthFilesInfo); clientManager.uploadAuthFiles(account, client.getString("client_moniker"), clientAuthFilesInfo);
} }
@Override @Override
public void updateMerchantInfo(JSONObject device, ClientUpdateInfo clientRegisterInfo) { public void updateMerchantInfo(JSONObject device, ClientUpdateInfo clientRegisterInfo) {
JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id")); JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id"));
JSONObject account = clientAccountMapper.findById(device.getString("account_id")); JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
if(PartnerRole.getRole(account.getIntValue("role")) != PartnerRole.ADMIN){ if (PartnerRole.getRole(account.getIntValue("role")) != PartnerRole.ADMIN) {
throw new ForbiddenException("You have no permission"); throw new ForbiddenException("You have no permission");
} }
if (client == null) { if (client == null) {
throw new NotFoundException("Client not found, please check"); throw new NotFoundException("Client not found, please check");
} }
if (client.getIntValue("approve_result") != 1 && client.getIntValue("source") == 4){ if (client.getIntValue("approve_result") != 1 && client.getIntValue("source") == 4) {
JSONObject record = clientRegisterInfo.appClientInfo(); JSONObject record = clientRegisterInfo.appClientInfo();
record.put("client_moniker",client.getString("client_moniker")); record.put("client_moniker", client.getString("client_moniker"));
clientManager.updateClientRegisterInfoV2(null,client.getString("client_moniker"),record); clientManager.updateClientRegisterInfoV2(null, client.getString("client_moniker"), record);
}else { } else {
throw new BadRequestException("已通过审核,暂不能提交和修改"); throw new BadRequestException("已通过审核,暂不能提交和修改");
} }
} }
@ -377,13 +380,13 @@ public class RetailAppServiceImp implements RetailAppService {
public void applyToCompliance(JSONObject device) { public void applyToCompliance(JSONObject device) {
JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id")); JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id"));
JSONObject account = clientAccountMapper.findById(device.getString("account_id")); JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
if(client==null){ if (client == null) {
throw new NotFoundException("Merchant Not Found"); throw new NotFoundException("Merchant Not Found");
} }
if(account==null){ if (account == null) {
throw new NotFoundException("Account Not Found"); throw new NotFoundException("Account Not Found");
} }
clientManager.applyToCompliance(client.getString("client_moniker"),account); clientManager.applyToCompliance(client.getString("client_moniker"), account);
} }
@ -391,15 +394,15 @@ public class RetailAppServiceImp implements RetailAppService {
public JSONObject sendVerifyEmail(JSONObject device) { public JSONObject sendVerifyEmail(JSONObject device) {
JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id")); JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id"));
JSONObject account = clientAccountMapper.findById(device.getString("account_id")); JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
if(client==null){ if (client == null) {
throw new NotFoundException("Merchant Not Found"); throw new NotFoundException("Merchant Not Found");
} }
if(account==null){ if (account == null) {
throw new NotFoundException("Account Not Found"); throw new NotFoundException("Account Not Found");
} }
clientManager.sendVerifyEmail(client,account.getString("account_id")); clientManager.sendVerifyEmail(client, account.getString("account_id"));
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
result.put("email",client.getString("contact_email")); result.put("email", client.getString("contact_email"));
return result; return result;
} }
@ -440,9 +443,14 @@ public class RetailAppServiceImp implements RetailAppService {
public JSONObject getClientInfoMe(JSONObject device) { public JSONObject getClientInfoMe(JSONObject device) {
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
JSONObject client = clientMapper.findClient(device.getIntValue("client_id")); JSONObject client = clientMapper.findClient(device.getIntValue("client_id"));
if(StringUtils.isEmpty(client.getString("business_structure"))||
if (StringUtils.isEmpty(client.getString("store_photo"))|| StringUtils.isEmpty(client.getString("logo_url"))|| StringUtils.isEmpty(client.getString("company_photo"))) { StringUtils.isEmpty(client.getString("logo_url"))||
StringUtils.isEmpty(client.getString("description")) ||
("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")))) {
result.put("base_info_lack", true); result.put("base_info_lack", true);
} }
JSONObject file = clientManager.getAuthFiles(null, client.getString("client_moniker")); JSONObject file = clientManager.getAuthFiles(null, client.getString("client_moniker"));
for (String s : fileName) { for (String s : fileName) {
@ -670,10 +678,10 @@ public class RetailAppServiceImp implements RetailAppService {
} }
break; break;
case "Wechat": case "Wechat":
JSONObject weUser = new JSONObject(); JSONObject weUser = new JSONObject();
if (customer_id.startsWith("olH")){ if (customer_id.startsWith("olH")) {
weUser = customerMapper.findCustomerGlobalpayByOpenId(customer_id); weUser = customerMapper.findCustomerGlobalpayByOpenId(customer_id);
}else { } else {
weUser = customerMapper.findCustomerByOpenId(customer_id); weUser = customerMapper.findCustomerByOpenId(customer_id);
} }
if (weUser != null && !weUser.isEmpty()) { if (weUser != null && !weUser.isEmpty()) {

Loading…
Cancel
Save