add file interface

master
wangning 6 years ago
parent fe8f851731
commit a9c50800b0

@ -2,19 +2,20 @@ 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.notice.beans.NoticeInfo;
import au.com.royalpay.payment.manage.signin.beans.ChangePwdBean;
import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery;
import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig;
import au.com.royalpay.payment.tools.merchants.beans.UpdateSurchargeDTO;
import com.alibaba.fastjson.JSONObject;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
/**
* Created by yishuqian on 28/03/2017.
@ -86,6 +87,10 @@ public interface RetailAppService {
JSONObject getClientInfo(JSONObject device);
JSONObject getClientInfoRealtime(JSONObject device);
JSONObject getClientInfoMe(JSONObject device);
JSONObject updateRetailConfig(JSONObject device, boolean paySurcharge);
JSONObject setRequireRemarkConfig(JSONObject device, boolean enabled);
@ -133,4 +138,8 @@ public interface RetailAppService {
void getInvoiceFile(JSONObject device, AppQueryBean appQueryBean, HttpServletResponse httpResponse) throws Exception;
Map<String,JSONObject> channelAndDayOfAnalysis(int client_id, String clearingDetailId, String channel, JSONObject device);
JSONObject getAuthFiles(JSONObject device);
void uploadAuthFiles(JSONObject device,ClientAuthFilesInfo clientAuthFilesInfo);
}

@ -20,9 +20,11 @@ import au.com.royalpay.payment.manage.mappers.payment.OrderMapper;
import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientDeviceTokenMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
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.core.ClientConfigService;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.notice.beans.NoticeInfo;
@ -156,8 +158,13 @@ public class RetailAppServiceImp implements RetailAppService {
private CleanService cleanService;
@Resource
private ClientConfigService clientConfigService;
@Resource
private ClientMapper clientMapper;
private Map<String, AppMsgSender> senderMap = new HashMap<>();
private final String fileName[] = { "source_agree_file", "client_bank_file", "client_id_file", "client_agree_file", "client_company_file",
"client_apply_file" };
@Resource
public void setAppMsgSenders(AppMsgSender[] senders) {
Arrays.stream(senders).forEach(appMsgSender -> senderMap.put(appMsgSender.devType(), appMsgSender));
@ -255,7 +262,8 @@ public class RetailAppServiceImp implements RetailAppService {
JSONObject res = new JSONObject();
res.put("url", url);
res.put("qrcode", QRCodeUtils.qrcodeImageCode(url, 250, false));
// res.put("qrcode_board", merchantInfoProvider.getQrCodeBoard(client, config,clientAccountMapper.findById(device.getString("account_id")),"APP"));
// res.put("qrcode_board", merchantInfoProvider.getQrCodeBoard(client,
// config,clientAccountMapper.findById(device.getString("account_id")),"APP"));
res.put("qrcode_board", merchantInfoProvider.getQrCodeBoard(client, config));
return res;
}
@ -308,6 +316,20 @@ public class RetailAppServiceImp implements RetailAppService {
return cleanService.channelAndDayOfAnalysis(client_id, clearingDetailId, channel, device.getJSONObject("client"));
}
@Override
public JSONObject getAuthFiles(JSONObject device) {
JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id"));
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
return clientManager.getAuthFiles(account,client.getString("client_moniker"));
}
@Override
public void uploadAuthFiles(JSONObject device, ClientAuthFilesInfo clientAuthFilesInfo) {
JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id"));
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
clientManager.uploadAuthFiles(account,client.getString("client_moniker"),clientAuthFilesInfo);
}
@Override
public void updateClient(JSONObject device, AppClientBean appClientBean) {
String clientType = device.getString("client_type");
@ -334,6 +356,27 @@ public class RetailAppServiceImp implements RetailAppService {
return res;
}
@Override
public JSONObject getClientInfoRealtime(JSONObject device) {
return clientMapper.findClient(device.getIntValue("client_id"));
}
@Override
public JSONObject getClientInfoMe(JSONObject device) {
JSONObject result = new JSONObject();
JSONObject client = clientMapper.findClient(device.getIntValue("client_id"));
if (client.getString("store_photo") == null || client.getString("logo_url") == null || client.getString("company_photo") == null) {
result.put("base_info_lack", true);
}
JSONObject file = clientManager.getAuthFiles(null, client.getString("client_moniker"));
for (String s : fileName) {
if (file.getString(s) == null) {
result.put("compliance_info_lack", true);
}
}
return result;
}
@Override
public JSONObject updateRetailConfig(JSONObject device, boolean clientPaySurcharge) {
JSONObject user = userInfo(device);
@ -1175,8 +1218,6 @@ public class RetailAppServiceImp implements RetailAppService {
JSONObject res = new JSONObject();
res.put("transactions", transactions);
JSONObject analysis = transactionMapper.analysisRetailDailyReport(date, to, devId, device.getIntValue("client_id"), param_client_ids);
analysis.put("date", TimeZoneUtils.formatTime(date, "dd/MMM/yyyy", timezone));
analysis.put("display_amount", display_amount);
@ -1544,10 +1585,10 @@ public class RetailAppServiceImp implements RetailAppService {
@Override
public void changeManualSettle(JSONObject device, boolean manual_settle) {
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
clientManager.changeManualSettle(account,device.getIntValue("client_id"), manual_settle, device.getString("account_id"), 1, "商户"+(manual_settle?"打开":"关闭")+"手动清算");
clientManager.changeManualSettle(account, device.getIntValue("client_id"), manual_settle, device.getString("account_id"), 1,
"商户" + (manual_settle ? "打开" : "关闭") + "手动清算");
}
private static boolean mathchLetterorNum(String str) {
String regex = "[A-Za-z0-9]{8}";
return str.matches(regex);

@ -11,11 +11,14 @@ import au.com.royalpay.payment.manage.bill.bean.QueryBillBean;
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.core.ClientManager;
import au.com.royalpay.payment.manage.settlement.core.ManualSettleSupport;
import au.com.royalpay.payment.manage.signin.beans.ChangePwdBean;
import au.com.royalpay.payment.manage.signin.core.SignInStatusManager;
import au.com.royalpay.payment.manage.system.core.ClientContractService;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.connections.attachment.core.AttachmentClient;
import au.com.royalpay.payment.tools.device.advise.AppClientController;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
@ -35,6 +38,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import java.math.BigDecimal;
@ -71,6 +75,11 @@ public class RetailAppController {
private ClientContractService clientContractService;
@Resource
private ManualSettleSupport manualSettleSupport;
@Resource
private AttachmentClient attachmentClient;
@Resource
private ClientManager clientManager;
@RequestMapping(value = "/token", method = RequestMethod.PUT)
public void updateDevToken(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @RequestBody JSONObject token) {
@ -235,6 +244,16 @@ public class RetailAppController {
return retailAppService.getClientInfo(device);
}
@RequestMapping(value = "/client/realtime", method = RequestMethod.GET)
public JSONObject getClientInfoRealtime(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
return retailAppService.getClientInfo(device);
}
@RequestMapping(value = "/client/me", method = RequestMethod.GET)
public JSONObject getClientMyInfoRealtime(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
return retailAppService.getClientInfoMe(device);
}
@RequestMapping(value = "/client/check", method = RequestMethod.GET)
public JSONObject getCheckClientInfo(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
JSONObject defaultResult = new JSONObject();
@ -258,6 +277,16 @@ public class RetailAppController {
retailAppService.updateClient(device, appClientBean);
}
@RequestMapping(value = "/client/file", method = RequestMethod.GET)
public JSONObject getAuthFiles(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
return retailAppService.getAuthFiles(device);
}
@RequestMapping(value = "/client/file", method = RequestMethod.PUT)
public void uploadAuthFiles(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @RequestBody ClientAuthFilesInfo filesInfo) {
retailAppService.uploadAuthFiles(device, filesInfo);
}
@RequestMapping(value = "/daily_transactions/date/{dateStr}", method = RequestMethod.GET)
public JSONObject listDailyTransactions(@PathVariable String dateStr, @RequestParam(defaultValue = "Australia/Melbourne") String timezone,@RequestParam(required = false) String app_client_ids,
@RequestParam(defaultValue = "false") boolean thisdevice, @ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
@ -485,4 +514,14 @@ public class RetailAppController {
result.put("require_remark", client.getBooleanValue("require_remark"));
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);
}
}

Loading…
Cancel
Save