master
wangning 7 years ago
parent 5db7294880
commit 863b7794e3

@ -110,5 +110,4 @@ public interface RetailAppService {
JSONObject getAdDetail(JSONObject device, String article_id); JSONObject getAdDetail(JSONObject device, String article_id);
JSONObject getClientContractExpire(int client_id);
} }

@ -1331,35 +1331,6 @@ public class RetailAppServiceImp implements RetailAppService {
return res; return res;
} }
@Override
public JSONObject getClientContractExpire(int client_id) {
JSONObject client = clientManager.getClientInfo(client_id);
if (client == null) {
throw new NotFoundException("merchant not found please check ID");
}
List<JSONObject> rateInfo = clientRateMapper.minExpiryTime(client_id, null);
JSONObject result = new JSONObject();
result.put("rate_expire", false);
result.put("rate_waring", false);
Date now = new Date();
JSONObject contract = clientsContractMapper.findByClientId(client_id);
if(contract!=null && contract.getDate("expiry_date").compareTo(now)>0 && contract.getBoolean("has_sign")){
return result;
}
if (CollectionUtils.isEmpty(rateInfo)) {
return result;
}
rateInfo.forEach((p)->{
if (now.compareTo(p.getDate("expiry_time")) > -1) {
result.put("rate_expire", true);
}
if (DateUtils.addDays(now, 10).compareTo(p.getDate("expiry_time")) > -1) {
result.put("rate_waring", true);
}
});
return result;
}
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);

@ -4,7 +4,7 @@ import au.com.royalpay.payment.core.exceptions.ParamInvalidException;
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.appclient.core.RetailAppService; import au.com.royalpay.payment.manage.appclient.core.RetailAppService;
import au.com.royalpay.payment.manage.apps.core.AppFileService; import au.com.royalpay.payment.manage.system.core.ClientContractService;
import au.com.royalpay.payment.manage.bill.bean.NewBillBean; import au.com.royalpay.payment.manage.bill.bean.NewBillBean;
import au.com.royalpay.payment.manage.bill.bean.QueryBillBean; 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;
@ -51,7 +51,7 @@ public class RetailAppController {
@Resource @Resource
private BillService billService; private BillService billService;
@Resource @Resource
private AppFileService appFileService; private ClientContractService clientContractService;
@Resource @Resource
private SysConfigManager sysConfigManager; private SysConfigManager sysConfigManager;
@ -200,8 +200,8 @@ public class RetailAppController {
@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 result = retailAppService.getClientContractExpire(device.getIntValue("client_id")); JSONObject result = clientContractService.getClientContractExpire(device.getIntValue("client_id"));
JSONObject file = appFileService.getOrGenerateSourceAgreement(device.getIntValue("client_id")); JSONObject file = clientContractService.getOrGenerateSourceAgreement(device.getIntValue("client_id"));
result.put("file_url", file.getString("file_value")); result.put("file_url", file.getString("file_value"));
result.put("contract_info",sysConfigManager.getSysConfig().getString("sys_contract_info")); result.put("contract_info",sysConfigManager.getSysConfig().getString("sys_contract_info"));
return result; return result;
@ -341,7 +341,7 @@ public class RetailAppController {
@RequestMapping(value = "/file/agree", method = RequestMethod.GET) @RequestMapping(value = "/file/agree", method = RequestMethod.GET)
public JSONObject generateSourceAgreeFile(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { public JSONObject generateSourceAgreeFile(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
JSONObject file = appFileService.getSourceAgreement(device.getIntValue("client_id")); JSONObject file = clientContractService.getSourceAgreement(device.getIntValue("client_id"));
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
result.put("file_url",file.getString("file_value")); result.put("file_url",file.getString("file_value"));
return result; return result;
@ -349,6 +349,6 @@ public class RetailAppController {
@RequestMapping(value = "/file/agree/confirm", method = RequestMethod.POST) @RequestMapping(value = "/file/agree/confirm", method = RequestMethod.POST)
public void confirmSourceAgreeFile(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { public void confirmSourceAgreeFile(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
appFileService.confirmSourceAgreement(device.getIntValue("client_id")); clientContractService.confirmSourceAgreement(device.getIntValue("client_id"));
} }
} }

@ -10,10 +10,13 @@ import au.com.royalpay.payment.manage.merchants.beans.PartnerQuery;
import au.com.royalpay.payment.manage.merchants.beans.SubMerchantIdApply; import au.com.royalpay.payment.manage.merchants.beans.SubMerchantIdApply;
import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.manage.permission.manager.PartnerMapping;
import au.com.royalpay.payment.manage.permission.manager.RequireManager; import au.com.royalpay.payment.manage.permission.manager.RequireManager;
import au.com.royalpay.payment.manage.system.core.ClientContractService;
import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery; import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery;
import au.com.royalpay.payment.manage.tradelog.core.TradeLogService; import au.com.royalpay.payment.manage.tradelog.core.TradeLogService;
import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.env.SysConfigManager;
import au.com.royalpay.payment.tools.http.HttpUtils; import au.com.royalpay.payment.tools.http.HttpUtils;
import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig; import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
@ -50,7 +53,10 @@ public class PartnerManageController {
private TradeLogService tradeLogService; private TradeLogService tradeLogService;
@Resource @Resource
private MerchantLocationService merchantLocationService; private MerchantLocationService merchantLocationService;
@Resource
private ClientContractService clientContractService;
@Resource
private SysConfigManager sysConfigManager;
@RequestMapping(method = RequestMethod.GET) @RequestMapping(method = RequestMethod.GET)
@RequireManager(role = {ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.OPERATOR, ManagerRole.SERVANT, ManagerRole.FINANCIAL_STAFF, ManagerRole.DIRECTOR}) @RequireManager(role = {ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.OPERATOR, ManagerRole.SERVANT, ManagerRole.FINANCIAL_STAFF, ManagerRole.DIRECTOR})
public JSONObject listClients(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, PartnerQuery query) { public JSONObject listClients(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, PartnerQuery query) {
@ -517,4 +523,18 @@ public class PartnerManageController {
public List<JSONObject> getMerchantIds(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { public List<JSONObject> getMerchantIds(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return clientManager.listMerchantIds(clientMoniker,manager); return clientManager.listMerchantIds(clientMoniker,manager);
} }
@PartnerMapping(value = "/check", method = RequestMethod.GET)
public JSONObject getCheckClientInfo(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account) {
JSONObject result = clientContractService.getClientContractExpire(account.getIntValue("client_id"));
JSONObject file = clientContractService.getOrGenerateSourceAgreement(account.getIntValue("client_id"));
result.put("file_url", file.getString("file_value"));
result.put("contract_info",sysConfigManager.getSysConfig().getString("sys_contract_info"));
return result;
}
@PartnerMapping(value = "/agree/confirm", method = RequestMethod.POST)
public void confirmSourceAgreeFile(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account) {
clientContractService.confirmSourceAgreement(account.getIntValue("client_id"));
}
} }

@ -1,12 +1,15 @@
package au.com.royalpay.payment.manage.apps.core; package au.com.royalpay.payment.manage.system.core;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
public interface AppFileService { public interface ClientContractService {
JSONObject getOrGenerateSourceAgreement(int client_id); JSONObject getOrGenerateSourceAgreement(int client_id);
void confirmSourceAgreement(int client_id); void confirmSourceAgreement(int client_id);
JSONObject getSourceAgreement(int client_id); JSONObject getSourceAgreement(int client_id);
JSONObject getClientContractExpire(int client_id);
} }

@ -1,10 +1,11 @@
package au.com.royalpay.payment.manage.apps.core.impls; package au.com.royalpay.payment.manage.system.core.impl;
import au.com.royalpay.payment.manage.appclient.core.RetailAppService; import au.com.royalpay.payment.manage.appclient.core.RetailAppService;
import au.com.royalpay.payment.manage.apps.core.AppFileService;
import au.com.royalpay.payment.manage.mappers.system.ClientFilesMapper; import au.com.royalpay.payment.manage.mappers.system.ClientFilesMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientRateMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientsContractMapper; import au.com.royalpay.payment.manage.mappers.system.ClientsContractMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.system.core.ClientContractService;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.exceptions.ServerErrorException; import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
@ -24,9 +25,9 @@ import java.util.List;
import javax.annotation.Resource; import javax.annotation.Resource;
@Service @Service
public class AppFileServiceImpl implements AppFileService { public class ClientContractServiceImpl implements ClientContractService {
Logger logger = LoggerFactory.getLogger(AppFileServiceImpl.class); Logger logger = LoggerFactory.getLogger(ClientContractServiceImpl.class);
@Resource @Resource
private ClientFilesMapper clientFilesMapper; private ClientFilesMapper clientFilesMapper;
@Resource @Resource
@ -35,6 +36,8 @@ public class AppFileServiceImpl implements AppFileService {
private ClientsContractMapper clientsContractMapper; private ClientsContractMapper clientsContractMapper;
@Resource @Resource
private RetailAppService retailAppService; private RetailAppService retailAppService;
@Resource
private ClientRateMapper clientRateMapper;
@Override @Override
@Transactional @Transactional
@ -56,7 +59,7 @@ public class AppFileServiceImpl implements AppFileService {
saveContract(client_id, now); saveContract(client_id, now);
return files.get(0); return files.get(0);
} else { } else {
JSONObject expireInfo = retailAppService.getClientContractExpire(client_id); JSONObject expireInfo = getClientContractExpire(client_id);
List<JSONObject> files = clientFilesMapper.findFileByClientAndType(client_id, "source_agree_file"); List<JSONObject> files = clientFilesMapper.findFileByClientAndType(client_id, "source_agree_file");
JSONObject file = files.get(0); JSONObject file = files.get(0);
if (expireInfo.getBoolean("rate_expire")) { if (expireInfo.getBoolean("rate_expire")) {
@ -98,4 +101,32 @@ public class AppFileServiceImpl implements AppFileService {
return files.get(0); return files.get(0);
} }
@Override
public JSONObject getClientContractExpire(int client_id) {
JSONObject client = clientManager.getClientInfo(client_id);
if (client == null) {
throw new NotFoundException("merchant not found please check ID");
}
List<JSONObject> rateInfo = clientRateMapper.minExpiryTime(client_id, null);
JSONObject result = new JSONObject();
result.put("rate_expire", false);
result.put("rate_waring", false);
Date now = new Date();
JSONObject contract = clientsContractMapper.findByClientId(client_id);
if(contract!=null && contract.getDate("expiry_date").compareTo(now)>0 && contract.getBoolean("has_sign")){
return result;
}
if (CollectionUtils.isEmpty(rateInfo)) {
return result;
}
rateInfo.forEach((p)->{
if (now.compareTo(p.getDate("expiry_time")) > -1) {
result.put("rate_expire", true);
}
if (DateUtils.addDays(now, 10).compareTo(p.getDate("expiry_time")) > -1) {
result.put("rate_waring", true);
}
});
return result;
}
} }

@ -0,0 +1 @@
package au.com.royalpay.payment.manage.system;
Loading…
Cancel
Save