添加修改商户基本信息接口

master
wangning 7 years ago
parent fe9d052c09
commit 7a55463794

@ -3,6 +3,7 @@ package au.com.royalpay.payment.manage.appclient.core;
import au.com.royalpay.payment.manage.appclient.beans.AppClientBean;
import au.com.royalpay.payment.manage.appclient.beans.AppQueryBean;
import au.com.royalpay.payment.manage.merchants.beans.ClientAuthFilesInfo;
import au.com.royalpay.payment.manage.merchants.beans.ClientUpdateInfo;
import au.com.royalpay.payment.manage.notice.beans.NoticeInfo;
import au.com.royalpay.payment.manage.signin.beans.ChangePwdBean;
import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig;
@ -142,4 +143,6 @@ public interface RetailAppService {
JSONObject getAuthFiles(JSONObject device);
void uploadAuthFiles(JSONObject device,ClientAuthFilesInfo clientAuthFilesInfo);
void updateMerchantInfo(JSONObject device, ClientUpdateInfo clientUpdateInfo);
}

@ -25,6 +25,7 @@ import au.com.royalpay.payment.manage.mappers.system.ClientSettleDelayConfMapper
import au.com.royalpay.payment.manage.mappers.system.CustomerMapper;
import au.com.royalpay.payment.manage.mappers.system.ManagerCustomerRelationAlipayMapper;
import au.com.royalpay.payment.manage.merchants.beans.ClientAuthFilesInfo;
import au.com.royalpay.payment.manage.merchants.beans.ClientUpdateInfo;
import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.merchants.core.ClientModifySupport;
@ -350,6 +351,25 @@ public class RetailAppServiceImp implements RetailAppService {
clientManager.uploadAuthFiles(account,client.getString("client_moniker"),clientAuthFilesInfo);
}
@Override
public void updateMerchantInfo(JSONObject device, ClientUpdateInfo clientRegisterInfo) {
JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id"));
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
if(PartnerRole.getRole(account.getIntValue("role")) != PartnerRole.ADMIN){
throw new ForbiddenException("You have no permission");
}
if (client == null) {
throw new NotFoundException("Client not found, please check");
}
if (client.getIntValue("approve_result") != 1 && client.getIntValue("source") == 4){
JSONObject record = clientRegisterInfo.appClientInfo();
record.put("client_moniker",client.getString("client_moniker"));
clientManager.updateClientRegisterInfoV2(null,client.getString("client_moniker"),record);
}else {
throw new BadRequestException("已通过审核,暂不能提交和修改");
}
}
@Override
public void updateClient(JSONObject device, AppClientBean appClientBean) {
String clientType = device.getString("client_type");

@ -12,6 +12,7 @@ import au.com.royalpay.payment.manage.bill.bean.QueryBillOrderBean;
import au.com.royalpay.payment.manage.bill.core.BillOrderService;
import au.com.royalpay.payment.manage.bill.core.BillService;
import au.com.royalpay.payment.manage.merchants.beans.ClientAuthFilesInfo;
import au.com.royalpay.payment.manage.merchants.beans.ClientUpdateInfo;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.settlement.core.ManualSettleSupport;
import au.com.royalpay.payment.manage.signin.beans.ChangePwdBean;
@ -244,6 +245,12 @@ public class RetailAppController {
return retailAppService.getClientInfo(device);
}
@RequestMapping(value = "/client/partnerInfo", method = RequestMethod.PUT)
@ResponseBody
public void updatePartnerInfo(@ModelAttribute(RETAIL_DEVICE) JSONObject device,@RequestBody ClientUpdateInfo info) {
retailAppService.updateMerchantInfo(device,info);
}
@RequestMapping(value = "/client/realtime", method = RequestMethod.GET)
public JSONObject getClientInfoRealtime(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
return retailAppService.getClientInfoRealtime(device);
@ -515,13 +522,10 @@ public class RetailAppController {
return result;
}
@RequestMapping(value = "/attachment/files",method = RequestMethod.POST)
public JSONObject uploadImage(@ModelAttribute(RETAIL_DEVICE) JSONObject device,@RequestParam MultipartFile file) throws Exception {
return attachmentClient.uploadFile(file,false);
}
}

@ -0,0 +1,379 @@
package au.com.royalpay.payment.manage.merchants.beans;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONField;
import javax.validation.constraints.Pattern;
/**
* Created by yixian on 2016-06-29.
*/
public class ClientUpdateInfo {
@JSONField(name = "client_moniker")
@Pattern(regexp = "^[a-zA-Z0-9]{4}$", message = "Parameter error(partner code):Only letters or numbers are allowed")
private String clientMoniker;
@JSONField(name = "company_name")
private String companyName;
@JSONField(name = "short_name")
private String shortName;
@JSONField(name = "business_name")
private String businessName;
@JSONField(name = "business_structure")
private String businessStructure;
private String abn;
private String acn;
private String industry;
@JSONField(name = "alipayindustry")
private String alipayIndustry;
@JSONField(name = "company_photo")
private String companyPhoto;
@JSONField(name = "store_photo")
private String storePhoto;
@JSONField(name = "company_website")
private String companyWebsite;
@JSONField(name = "company_phone")
private String companyPhone;
private String description;
private String remark;
private String sector;
@JSONField(name = "logo_id")
private String logoId;
@JSONField(name = "contact_person")
private String contactPerson;
@JSONField(name = "contact_phone")
private String contactPhone;
@JSONField(name = "contact_email")
private String contactEmail;
private String address;
private String suburb;
private String postcode;
private String state;
private String country;
@Pattern(regexp = "^((Australia/West)|(Australia/Eucla)|(Australia/North)|(Australia/South)|(Australia/Brisbane)|(Australia/Melbourne)|(Australia/LHI))$", message = "error.payment.valid.invalid_timezone")
private String timezone;
private String jdindustry;
private String royalpayindustry;
private String referrer_id;
private String referrer_name;
private String client_apply_id;
private String business_hours;
private String merchant_introduction;
private String merchant_tag;
private String merchant_video_url;
public JSONObject insertObject() {
JSONObject res = (JSONObject) JSON.toJSON(this);
if (client_apply_id==null){
res.remove("client_apply_id");
}
return res;
}
public JSONObject updateObject() {
JSONObject obj = insertObject();
obj.remove("client_moniker");
return obj;
}
public JSONObject appClientInfo(){
JSONObject obj = insertObject();
obj.remove("client_moniker");
obj.remove("client_id");
obj.remove("merchant_video_url");
obj.remove("merchant_tag");
obj.remove("merchant_introduction");
obj.remove("business_hours");
obj.remove("client_apply_id");
obj.remove("referrer_id");
obj.remove("referrer_name");
obj.remove("jdindustry");
obj.remove("royalpayindustry");
obj.remove("industry");
obj.remove("alipayIndustry");
obj.remove("country");
return obj;
}
public String getClientMoniker() {
return clientMoniker.toUpperCase();
}
public void setClientMoniker(String clientMoniker) {
this.clientMoniker = clientMoniker;
}
public String getCompanyName() {
return companyName;
}
public void setCompanyName(String companyName) {
this.companyName = companyName;
}
public String getShortName() {
return shortName;
}
public void setShortName(String shortName) {
this.shortName = shortName;
}
public String getBusinessName() {
return businessName;
}
public void setBusinessName(String businessName) {
this.businessName = businessName;
}
public String getAbn() {
return abn;
}
public void setAbn(String abn) {
this.abn = abn;
}
public String getAcn() {
return acn;
}
public void setAcn(String acn) {
this.acn = acn;
}
public String getIndustry() {
return industry;
}
public void setIndustry(String industry) {
this.industry = industry;
}
public String getCompanyPhoto() {
return companyPhoto;
}
public void setCompanyPhoto(String companyPhoto) {
this.companyPhoto = companyPhoto;
}
public String getStorePhoto() {
return storePhoto;
}
public void setStorePhoto(String storePhoto) {
this.storePhoto = storePhoto;
}
public String getCompanyWebsite() {
return companyWebsite;
}
public void setCompanyWebsite(String companyWebsite) {
this.companyWebsite = companyWebsite;
}
public String getCompanyPhone() {
return companyPhone;
}
public void setCompanyPhone(String companyPhone) {
this.companyPhone = companyPhone;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getSector() {
return sector;
}
public void setSector(String sector) {
this.sector = sector;
}
public String getLogoId() {
return logoId;
}
public void setLogoId(String logoId) {
this.logoId = logoId;
}
public String getContactPerson() {
return contactPerson;
}
public void setContactPerson(String contactPerson) {
this.contactPerson = contactPerson;
}
public String getContactPhone() {
return contactPhone;
}
public void setContactPhone(String contactPhone) {
this.contactPhone = contactPhone;
}
public String getContactEmail() {
return contactEmail;
}
public void setContactEmail(String contactEmail) {
this.contactEmail = contactEmail;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getSuburb() {
return suburb;
}
public void setSuburb(String suburb) {
this.suburb = suburb;
}
public String getPostcode() {
return postcode;
}
public void setPostcode(String postcode) {
this.postcode = postcode;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getTimezone() {
return timezone;
}
public void setTimezone(String timezone) {
this.timezone = timezone;
}
public String getClient_apply_id() {
return client_apply_id;
}
public void setClient_apply_id(String client_apply_id) {
this.client_apply_id = client_apply_id;
}
public String getBusinessStructure() {
return businessStructure;
}
public void setBusinessStructure(String businessStructure) {
this.businessStructure = businessStructure;
}
public String getReferrer_id() {
return referrer_id;
}
public void setReferrer_id(String referrer_id) {
this.referrer_id = referrer_id;
}
public String getReferrer_name() {
return referrer_name;
}
public void setReferrer_name(String referrer_name) {
this.referrer_name = referrer_name;
}
public String getAlipayIndustry() {
return alipayIndustry;
}
public void setAlipayIndustry(String alipayIndustry) {
this.alipayIndustry = alipayIndustry;
}
public String getJdindustry() {
return jdindustry;
}
public void setJdindustry(String jdindustry) {
this.jdindustry = jdindustry;
}
public String getRoyalpayindustry() {
return royalpayindustry;
}
public void setRoyalpayindustry(String royalpayindustry) {
this.royalpayindustry = royalpayindustry;
}
public String getBusiness_hours() {
return business_hours;
}
public void setBusiness_hours(String business_hours) {
this.business_hours = business_hours;
}
public String getMerchant_introduction() {
return merchant_introduction;
}
public void setMerchant_introduction(String merchant_introduction) {
this.merchant_introduction = merchant_introduction;
}
public String getMerchant_tag() {
return merchant_tag;
}
public void setMerchant_tag(String merchant_tag) {
this.merchant_tag = merchant_tag;
}
public String getMerchant_video_url() {
return merchant_video_url;
}
public void setMerchant_video_url(String merchant_video_url) {
this.merchant_video_url = merchant_video_url;
}
}

@ -54,6 +54,9 @@ public interface ClientManager {
@Transactional
void updateClientRegisterInfo(JSONObject manager, String clientMoniker, ClientRegisterInfo info);
@Transactional
void updateClientRegisterInfoV2(JSONObject manager, String clientMoniker, JSONObject info);
@Transactional
void updateClientPaymentConfig(JSONObject manager, String clientMoniker, JSONObject subMerchantInfo);

@ -638,6 +638,44 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
clientInfoCacheSupport.clearClientCache(clientId);
}
@Override
public void updateClientRegisterInfoV2(JSONObject manager, String clientMoniker, JSONObject info) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
Assert.notNull(client);
checkOrgPermission(manager, client);
int clientId = client.getIntValue("client_id");
List<JSONObject> clients = clientMapper.listChildClients(clientId);
String logoId= info.getString("logoId");
if (StringUtils.isNotEmpty(logoId)) {
String fileUrl = attachmentClient.getFileUrl(logoId);
info.put("logo_url", fileUrl);
String thumbnail = attachmentClient.getThumbnail(logoId, 600).getString("url");
info.put("logo_thumbnail", thumbnail);
for (JSONObject subClient : clients) {
subClient.put("logo_url", fileUrl);
subClient.put("logo_thumbnail", thumbnail);
}
}
info.put("client_id", clientId);
int originReferrerId = client.getIntValue("referrer_id");
int updateReferrerId = Integer.parseInt(info.getString("referrer_id") == null ? "0" : info.getString("referrer_id"));
if (originReferrerId == 0 && updateReferrerId != 0) {
List<JSONObject> bds = clientBDMapper.listClientBDAvailable(clientId, new Date());
if (bds.size() == 1 && bds.get(0).getIntValue("proportion") == 1) {
JSONObject clientBDInfo = bds.get(0);
clientBDInfo.put("proportion", 0.5);
clientBDMapper.update(clientBDInfo);
}
}
clientMapper.update(info);
if(client.getString("contact_email").equals(info.getString("contact_email"))){
mailGunService.updateClientOfMailList(info,client);
}
clientInfoCacheSupport.clearClientCache(clientId);
}
@Override
public void updateClientPaymentConfig(JSONObject manager, String clientMoniker, JSONObject subMerchantInfo) {
JSONObject client = getClientInfoByMoniker(clientMoniker);

Loading…
Cancel
Save