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.AppClientBean;
import au.com.royalpay.payment.manage.appclient.beans.AppQueryBean; 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.notice.beans.NoticeInfo;
import au.com.royalpay.payment.manage.signin.beans.ChangePwdBean; 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.QRCodeConfig;
import au.com.royalpay.payment.tools.merchants.beans.UpdateSurchargeDTO; import au.com.royalpay.payment.tools.merchants.beans.UpdateSurchargeDTO;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.servlet.http.HttpServletResponse;
/** /**
* Created by yishuqian on 28/03/2017. * Created by yishuqian on 28/03/2017.
@ -86,6 +87,10 @@ public interface RetailAppService {
JSONObject getClientInfo(JSONObject device); JSONObject getClientInfo(JSONObject device);
JSONObject getClientInfoRealtime(JSONObject device);
JSONObject getClientInfoMe(JSONObject device);
JSONObject updateRetailConfig(JSONObject device, boolean paySurcharge); JSONObject updateRetailConfig(JSONObject device, boolean paySurcharge);
JSONObject setRequireRemarkConfig(JSONObject device, boolean enabled); JSONObject setRequireRemarkConfig(JSONObject device, boolean enabled);
@ -133,4 +138,8 @@ public interface RetailAppService {
void getInvoiceFile(JSONObject device, AppQueryBean appQueryBean, HttpServletResponse httpResponse) throws Exception; void getInvoiceFile(JSONObject device, AppQueryBean appQueryBean, HttpServletResponse httpResponse) throws Exception;
Map<String,JSONObject> channelAndDayOfAnalysis(int client_id, String clearingDetailId, String channel, JSONObject device); 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.payment.TransactionMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper; 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.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.ClientSettleDelayConfMapper;
import au.com.royalpay.payment.manage.mappers.system.CustomerMapper; import au.com.royalpay.payment.manage.mappers.system.CustomerMapper;
import au.com.royalpay.payment.manage.mappers.system.ManagerCustomerRelationAlipayMapper; 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.ClientConfigService;
import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.notice.beans.NoticeInfo; import au.com.royalpay.payment.manage.notice.beans.NoticeInfo;
@ -156,8 +158,13 @@ public class RetailAppServiceImp implements RetailAppService {
private CleanService cleanService; private CleanService cleanService;
@Resource @Resource
private ClientConfigService clientConfigService; private ClientConfigService clientConfigService;
@Resource
private ClientMapper clientMapper;
private Map<String, AppMsgSender> senderMap = new HashMap<>(); 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 @Resource
public void setAppMsgSenders(AppMsgSender[] senders) { public void setAppMsgSenders(AppMsgSender[] senders) {
Arrays.stream(senders).forEach(appMsgSender -> senderMap.put(appMsgSender.devType(), appMsgSender)); Arrays.stream(senders).forEach(appMsgSender -> senderMap.put(appMsgSender.devType(), appMsgSender));
@ -245,7 +252,7 @@ public class RetailAppServiceImp implements RetailAppService {
} }
@Override @Override
public JSONObject getQrcode(JSONObject device, QRCodeConfig config,int client_id) { public JSONObject getQrcode(JSONObject device, QRCodeConfig config, int client_id) {
JSONObject client = merchantInfoProvider.getClientInfo(client_id); JSONObject client = merchantInfoProvider.getClientInfo(client_id);
String url = PlatformEnvironment.getEnv().concatUrl("/api/payment/v1.0/partners/" + client.getString("client_moniker")); String url = PlatformEnvironment.getEnv().concatUrl("/api/payment/v1.0/partners/" + client.getString("client_moniker"));
if (config.isCNY()) { if (config.isCNY()) {
@ -255,7 +262,8 @@ public class RetailAppServiceImp implements RetailAppService {
JSONObject res = new JSONObject(); JSONObject res = new JSONObject();
res.put("url", url); res.put("url", url);
res.put("qrcode", QRCodeUtils.qrcodeImageCode(url, 250, false)); 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)); res.put("qrcode_board", merchantInfoProvider.getQrCodeBoard(client, config));
return res; return res;
} }
@ -263,14 +271,14 @@ public class RetailAppServiceImp implements RetailAppService {
@Override @Override
public void changeSurchargeEnable(JSONObject device, UpdateSurchargeDTO updateSurchargeDTO) { public void changeSurchargeEnable(JSONObject device, UpdateSurchargeDTO updateSurchargeDTO) {
merchantInfoProvider.changeSurchargeEnable(device,updateSurchargeDTO); merchantInfoProvider.changeSurchargeEnable(device, updateSurchargeDTO);
} }
@Override @Override
public JSONObject getInvoiceData(JSONObject device, AppQueryBean appQueryBean) throws Exception { public JSONObject getInvoiceData(JSONObject device, AppQueryBean appQueryBean) throws Exception {
String clientType = device.getString("client_type"); String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType); deviceSupport.findRegister(clientType);
int client_id = device.getIntValue("client_id") ; int client_id = device.getIntValue("client_id");
JSONObject client = clientManager.getClientInfo(client_id); JSONObject client = clientManager.getClientInfo(client_id);
String timezone = client.getString("timezone"); String timezone = client.getString("timezone");
appQueryBean.setTimezone(timezone); appQueryBean.setTimezone(timezone);
@ -280,7 +288,7 @@ public class RetailAppServiceImp implements RetailAppService {
params.put("client_id", client_id); params.put("client_id", client_id);
JSONObject analysis = transactionMapper.analysisTransFlow(params); JSONObject analysis = transactionMapper.analysisTransFlow(params);
BigDecimal total_surcharge = analysis.getBigDecimal("total_surcharge").add(analysis.getBigDecimal("tax_amount")); BigDecimal total_surcharge = analysis.getBigDecimal("total_surcharge").add(analysis.getBigDecimal("tax_amount"));
analysis.put("total_surcharge",total_surcharge); analysis.put("total_surcharge", total_surcharge);
return analysis; return analysis;
} }
@ -288,24 +296,38 @@ public class RetailAppServiceImp implements RetailAppService {
public void getInvoiceFile(JSONObject device, AppQueryBean appQueryBean, HttpServletResponse httpResponse) throws Exception { public void getInvoiceFile(JSONObject device, AppQueryBean appQueryBean, HttpServletResponse httpResponse) throws Exception {
String clientType = device.getString("client_type"); String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType); deviceSupport.findRegister(clientType);
int client_id = device.getIntValue("client_id") ; int client_id = device.getIntValue("client_id");
JSONObject client = clientManager.getClientInfo(client_id); JSONObject client = clientManager.getClientInfo(client_id);
device.put("client_moniker",client.getString("client_moniker")); device.put("client_moniker", client.getString("client_moniker"));
TradeLogQuery tradeLogQuery = new TradeLogQuery(); TradeLogQuery tradeLogQuery = new TradeLogQuery();
tradeLogQuery.setDatefrom(appQueryBean.getBegin()); tradeLogQuery.setDatefrom(appQueryBean.getBegin());
tradeLogQuery.setDateto(appQueryBean.getEnd()); tradeLogQuery.setDateto(appQueryBean.getEnd());
if (appQueryBean.getApp_client_ids()==null){ if (appQueryBean.getApp_client_ids() == null) {
appQueryBean.setApp_client_ids(String.valueOf(client_id)); appQueryBean.setApp_client_ids(String.valueOf(client_id));
} }
tradeLogQuery.setClient_ids(appQueryBean.getApp_client_ids().split(",")); tradeLogQuery.setClient_ids(appQueryBean.getApp_client_ids().split(","));
tradeLogService.exportTransFlow(tradeLogQuery,device,httpResponse); tradeLogService.exportTransFlow(tradeLogQuery, device, httpResponse);
} }
@Override @Override
public Map<String, JSONObject> channelAndDayOfAnalysis(int client_id, String clearingDetailId, String channel, JSONObject device) { public Map<String, JSONObject> channelAndDayOfAnalysis(int client_id, String clearingDetailId, String channel, JSONObject device) {
String clientType = device.getString("client_type"); String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType); deviceSupport.findRegister(clientType);
return cleanService.channelAndDayOfAnalysis(client_id, clearingDetailId,channel,device.getJSONObject("client")); 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 @Override
@ -316,7 +338,7 @@ public class RetailAppServiceImp implements RetailAppService {
if (device.getIntValue("client_id") != account.getIntValue("client_id") || PartnerRole.getRole(account.getIntValue("role")) == PartnerRole.CASHIER) { if (device.getIntValue("client_id") != account.getIntValue("client_id") || PartnerRole.getRole(account.getIntValue("role")) == PartnerRole.CASHIER) {
throw new ForbiddenException("You have no permission"); throw new ForbiddenException("You have no permission");
} }
clientManager.updateAppClient(account,device.getIntValue("client_id"), appClientBean); clientManager.updateAppClient(account, device.getIntValue("client_id"), appClientBean);
} }
@ -334,6 +356,27 @@ public class RetailAppServiceImp implements RetailAppService {
return res; 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 @Override
public JSONObject updateRetailConfig(JSONObject device, boolean clientPaySurcharge) { public JSONObject updateRetailConfig(JSONObject device, boolean clientPaySurcharge) {
JSONObject user = userInfo(device); JSONObject user = userInfo(device);
@ -369,7 +412,7 @@ public class RetailAppServiceImp implements RetailAppService {
user = JSON.parseObject(user.toJSONString()); user = JSON.parseObject(user.toJSONString());
return user; return user;
} else { } else {
JSONObject clientWithConfig =clientManager.getClientInfo(device.getIntValue("client_id")); JSONObject clientWithConfig = clientManager.getClientInfo(device.getIntValue("client_id"));
clientWithConfig.putAll(clientConfigService.find(device.getIntValue("client_id"))); clientWithConfig.putAll(clientConfigService.find(device.getIntValue("client_id")));
clientWithConfig = SignInAccountServiceImpl.clientInfoWithNoSecretInfo(clientWithConfig); clientWithConfig = SignInAccountServiceImpl.clientInfoWithNoSecretInfo(clientWithConfig);
clientWithConfig.put("terminal_id", device.getString("client_dev_id")); clientWithConfig.put("terminal_id", device.getString("client_dev_id"));
@ -394,16 +437,16 @@ public class RetailAppServiceImp implements RetailAppService {
params.put("client_id", client_id); params.put("client_id", client_id);
PageList<JSONObject> logs = clearingDetailMapper.listClientSettlementLog(params, PageList<JSONObject> logs = clearingDetailMapper.listClientSettlementLog(params,
new PageBounds(appQueryBean.getPage(), appQueryBean.getLimit(), Order.formString("report_date.desc"))); new PageBounds(appQueryBean.getPage(), appQueryBean.getLimit(), Order.formString("report_date.desc")));
logs.forEach(log -> log.put("total_charge",log.getBigDecimal("total_charge").add(log.getBigDecimal("tax_amount")))); logs.forEach(log -> log.put("total_charge", log.getBigDecimal("total_charge").add(log.getBigDecimal("tax_amount"))));
JSONObject result = PageListUtils.buildPageListResult(logs); JSONObject result = PageListUtils.buildPageListResult(logs);
if (appQueryBean.getPage()==1){ if (appQueryBean.getPage() == 1) {
if (!logs.isEmpty() && logs.size()>0){ if (!logs.isEmpty() && logs.size() > 0) {
JSONObject sendMailLog = logSettleMailMapper.findByDate(logs.get(0).getDate("report_date")); JSONObject sendMailLog = logSettleMailMapper.findByDate(logs.get(0).getDate("report_date"));
if (sendMailLog == null) { if (sendMailLog == null) {
result.put("padding",true); result.put("padding", true);
} }
if (sendMailLog!=null && sendMailLog.getIntValue("mail_status") != 1) { if (sendMailLog != null && sendMailLog.getIntValue("mail_status") != 1) {
result.put("padding",true); result.put("padding", true);
} }
} }
} }
@ -427,7 +470,7 @@ public class RetailAppServiceImp implements RetailAppService {
List<JSONObject> channels = clearingDetailAnalysisMapper.listReportChannels(String.valueOf(clearing_detail_id)); List<JSONObject> channels = clearingDetailAnalysisMapper.listReportChannels(String.valueOf(clearing_detail_id));
JSONObject channelsObj = new JSONObject(); JSONObject channelsObj = new JSONObject();
for (JSONObject channel : channels) { for (JSONObject channel : channels) {
channel.put("total_charge",channel.getBigDecimal("total_charge").add(channel.getBigDecimal("tax_amount"))); channel.put("total_charge", channel.getBigDecimal("total_charge").add(channel.getBigDecimal("tax_amount")));
channelsObj.put(channel.getString("channel"), channel); channelsObj.put(channel.getString("channel"), channel);
} }
List<JSONObject> credit = new ArrayList<>(); List<JSONObject> credit = new ArrayList<>();
@ -1131,7 +1174,7 @@ public class RetailAppServiceImp implements RetailAppService {
} }
@Override @Override
public JSONObject listDailyTransactions(String dateStr, String timezone, boolean thisDevOnly, JSONObject device,String app_client_ids) { public JSONObject listDailyTransactions(String dateStr, String timezone, boolean thisDevOnly, JSONObject device, String app_client_ids) {
try { try {
JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id")); JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id"));
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd"); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
@ -1144,30 +1187,30 @@ public class RetailAppServiceImp implements RetailAppService {
devId = device.getString("dev_id"); devId = device.getString("dev_id");
} }
Date to = DateUtils.addDays(date, 1); Date to = DateUtils.addDays(date, 1);
String [] param_client_ids = null; String[] param_client_ids = null;
if(StringUtils.isEmpty(app_client_ids)) { if (StringUtils.isEmpty(app_client_ids)) {
JSONArray client_ids = clientManager.getAllClientIds(device.getIntValue("client_id")); JSONArray client_ids = clientManager.getAllClientIds(device.getIntValue("client_id"));
if (client_ids.size() > 1) { if (client_ids.size() > 1) {
param_client_ids = new String[client_ids.size()]; param_client_ids = new String[client_ids.size()];
client_ids.toArray(param_client_ids); client_ids.toArray(param_client_ids);
} }
}else { } else {
param_client_ids = app_client_ids.split(","); param_client_ids = app_client_ids.split(",");
} }
List<JSONObject> transactions = transactionMapper.listDailyTransactions(date, to, devId, device.getIntValue("client_id"),param_client_ids); List<JSONObject> transactions = transactionMapper.listDailyTransactions(date, to, devId, device.getIntValue("client_id"), param_client_ids);
if (transactions.isEmpty()) { if (transactions.isEmpty()) {
throw new BadRequestException("No Transactions in date " + dateStr + " at " + timezone); throw new BadRequestException("No Transactions in date " + dateStr + " at " + timezone);
} }
TimeZoneUtils.switchTimeZoneToString(transactions, timezone, "HH:mm:ss", Collections.singletonList("transaction_time")); TimeZoneUtils.switchTimeZoneToString(transactions, timezone, "HH:mm:ss", Collections.singletonList("transaction_time"));
BigDecimal display_amount = BigDecimal.ZERO; BigDecimal display_amount = BigDecimal.ZERO;
BigDecimal cny_display_amount = BigDecimal.ZERO; BigDecimal cny_display_amount = BigDecimal.ZERO;
for (JSONObject transaction:transactions){ for (JSONObject transaction : transactions) {
if (PlatformEnvironment.getEnv().getForeignCurrency().equals(transaction.getString("currency"))){ if (PlatformEnvironment.getEnv().getForeignCurrency().equals(transaction.getString("currency"))) {
if ("Credit".equals(transaction.getString("transaction_type"))){ if ("Credit".equals(transaction.getString("transaction_type"))) {
display_amount = display_amount.add(transaction.getBigDecimal("display_amount")); display_amount = display_amount.add(transaction.getBigDecimal("display_amount"));
} }
}else { } else {
if ("Credit".equals(transaction.getString("transaction_type"))){ if ("Credit".equals(transaction.getString("transaction_type"))) {
cny_display_amount = cny_display_amount.add(transaction.getBigDecimal("display_amount")); cny_display_amount = cny_display_amount.add(transaction.getBigDecimal("display_amount"));
} }
} }
@ -1175,12 +1218,10 @@ public class RetailAppServiceImp implements RetailAppService {
JSONObject res = new JSONObject(); JSONObject res = new JSONObject();
res.put("transactions", transactions); res.put("transactions", transactions);
JSONObject analysis = transactionMapper.analysisRetailDailyReport(date, to, devId, device.getIntValue("client_id"), param_client_ids);
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("date", TimeZoneUtils.formatTime(date, "dd/MMM/yyyy", timezone));
analysis.put("display_amount",display_amount); analysis.put("display_amount", display_amount);
analysis.put("cny_display_amount",cny_display_amount); analysis.put("cny_display_amount", cny_display_amount);
res.put("analysis", analysis); res.put("analysis", analysis);
return res; return res;
} catch (ParseException e) { } catch (ParseException e) {
@ -1238,19 +1279,19 @@ public class RetailAppServiceImp implements RetailAppService {
Boolean isUpdate = PlatformEnvironment.getEnv().isAppUpdate(clientType); Boolean isUpdate = PlatformEnvironment.getEnv().isAppUpdate(clientType);
String updateContent = PlatformEnvironment.getEnv().getAppUpdateContent(clientType); String updateContent = PlatformEnvironment.getEnv().getAppUpdateContent(clientType);
int update_type = 0;// 0:不更新 1更新 2强制更新 int update_type = 0;// 0:不更新 1更新 2强制更新
String [] oldVersion = version.split("\\."); String[] oldVersion = version.split("\\.");
String [] newVersion = newAppVersion.split("\\."); String[] newVersion = newAppVersion.split("\\.");
JSONObject res = new JSONObject(); JSONObject res = new JSONObject();
res.put("update_content", updateContent); res.put("update_content", updateContent);
for (int i = 0; i < newVersion.length; i++) { for (int i = 0; i < newVersion.length; i++) {
if(Integer.valueOf(newVersion[i])>Integer.valueOf(oldVersion[i])){ if (Integer.valueOf(newVersion[i]) > Integer.valueOf(oldVersion[i])) {
update_type = 1; update_type = 1;
if (isUpdate) { if (isUpdate) {
update_type = 2; update_type = 2;
} }
res.put("update_type", update_type); res.put("update_type", update_type);
return res; return res;
}else if(Integer.valueOf(newVersion[i])<Integer.valueOf(oldVersion[i])){ } else if (Integer.valueOf(newVersion[i]) < Integer.valueOf(oldVersion[i])) {
res.put("update_type", update_type); res.put("update_type", update_type);
return res; return res;
} }
@ -1538,16 +1579,16 @@ public class RetailAppServiceImp implements RetailAppService {
@Override @Override
public JSONObject getCheckClientInfo(JSONObject device) { public JSONObject getCheckClientInfo(JSONObject device) {
return clientManager.getCheckClientInfo(device.getIntValue("client_id"), device.getString("account_id"),"App"); return clientManager.getCheckClientInfo(device.getIntValue("client_id"), device.getString("account_id"), "App");
} }
@Override @Override
public void changeManualSettle(JSONObject device, boolean manual_settle) { public void changeManualSettle(JSONObject device, boolean manual_settle) {
JSONObject account = clientAccountMapper.findById(device.getString("account_id")); 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) { private static boolean mathchLetterorNum(String str) {
String regex = "[A-Za-z0-9]{8}"; String regex = "[A-Za-z0-9]{8}";
return str.matches(regex); 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.bean.QueryBillOrderBean;
import au.com.royalpay.payment.manage.bill.core.BillOrderService; import au.com.royalpay.payment.manage.bill.core.BillOrderService;
import au.com.royalpay.payment.manage.bill.core.BillService; 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.settlement.core.ManualSettleSupport;
import au.com.royalpay.payment.manage.signin.beans.ChangePwdBean; import au.com.royalpay.payment.manage.signin.beans.ChangePwdBean;
import au.com.royalpay.payment.manage.signin.core.SignInStatusManager; import au.com.royalpay.payment.manage.signin.core.SignInStatusManager;
import au.com.royalpay.payment.manage.system.core.ClientContractService; import au.com.royalpay.payment.manage.system.core.ClientContractService;
import au.com.royalpay.payment.tools.CommonConsts; 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.device.advise.AppClientController;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException; 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.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -71,6 +75,11 @@ public class RetailAppController {
private ClientContractService clientContractService; private ClientContractService clientContractService;
@Resource @Resource
private ManualSettleSupport manualSettleSupport; private ManualSettleSupport manualSettleSupport;
@Resource
private AttachmentClient attachmentClient;
@Resource
private ClientManager clientManager;
@RequestMapping(value = "/token", method = RequestMethod.PUT) @RequestMapping(value = "/token", method = RequestMethod.PUT)
public void updateDevToken(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @RequestBody JSONObject token) { public void updateDevToken(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @RequestBody JSONObject token) {
@ -235,6 +244,16 @@ public class RetailAppController {
return retailAppService.getClientInfo(device); 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) @RequestMapping(value = "/client/check", method = RequestMethod.GET)
public JSONObject getCheckClientInfo(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { public JSONObject getCheckClientInfo(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
JSONObject defaultResult = new JSONObject(); JSONObject defaultResult = new JSONObject();
@ -258,6 +277,16 @@ public class RetailAppController {
retailAppService.updateClient(device, appClientBean); 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) @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, 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) { @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")); result.put("require_remark", client.getBooleanValue("require_remark"));
return result; 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