add app重复签订合同、web业务优化

master
luoyang 5 years ago
parent 20f6082399
commit 862acb6bc4

@ -206,9 +206,11 @@ public class RetailAppServiceImp implements RetailAppService {
@Resource
private AttachmentClient attachmentClient;
@Resource
private ClientBankAccountMapper clientBankAccountMapper;
@Resource
private StringRedisTemplate stringRedisTemplate;
private final String CBBANK_AGGREGATE_FILE = "https://file.royalpay.com.au/open/2019/08/05/1564972204689_uwZvpTBjtLUMcN8c540xcZvux1Rd3O.pdf";
private final String IMG_AGGREGATE_FILE = "https://file.royalpay.com.au/open/2019/08/16/1565936989217_WDSAGRKhBHTD6s6HGcZPeirOXCyzbn.pdf";
private final String IMG_AGGREGATE_FILE = "https://file.royalpay.com.au/open/2019/08/22/1566440384256_R7Jc3cl5JPZsmVznKffzStwVMELwsl.pdf";
@Resource
private SmsSender smsSender;
@ -2204,7 +2206,7 @@ public class RetailAppServiceImp implements RetailAppService {
client.put("bank_account_number", bankAccount.getString("account_no"));
client.put("bank_account_name", bankAccount.getString("account_name"));
}
exportAggregateFile(client, httpResponse);
exportCBBankAggregateFile(client, httpResponse);
}
@Override
@ -2220,32 +2222,69 @@ public class RetailAppServiceImp implements RetailAppService {
String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType);
JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id"));
client.put("now", DateFormatUtils.format(new Date(), "yyyy-MM-dd"));
String clientName = "";
clientName = client.getString("business_name");
if (StringUtils.isNotBlank(client.getString("acn"))) {
clientName += "(" + client.getString("acn") + ")";
client.put("client_acn", client.getString("acn"));
String address = client.getString("address").trim();
if (address.contains(",")) {
client.put("address", address.substring(0, address.lastIndexOf(",")).trim());
client.put("address_sub", address.substring(address.lastIndexOf(",") + 1).trim());
}
if (client.getString("acn") != null && !client.getString("acn").equals("")) {
client.put("acn_type", "ACN: (" + client.getString("acn") + ")");
client.put("company_name_acn", client.getString("company_name") + " (ACN " + client.getString("acn") + ")");
} else {
client.put("acn_type", "ABN: (" + client.getString("abn") + ")");
client.put("company_name_acn", client.getString("company_name") + " (ABN " + client.getString("abn") + ")");
}
client.put("client_name", clientName);
client.put("bd_name", client.getString("bd_user_name"));
client.put("client_phone", client.getString("contact_phone"));
client.put("client_email", client.getString("contact_email"));
client.put("client_address", (client.getString("address") + "\n" + client.getString("suburb") + ' ' + client.getString("state") + ' ' + client.getString("postcode")));
JSONObject rate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "CB_BankPay");
if (rate != null) {
client.put("client_rate", (rate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN).toPlainString() + "%"));
int cleanDays = rate.getIntValue("clean_days");
client.put("clean_days", ("T+" + cleanDays));
client.put("days", cleanDays);
JSONObject weChatRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Wechat");
if (weChatRate == null) {
throw new BadRequestException("The Partner's Rate is not config!");
}
JSONObject bankAccount = clientManager.getBankAccountByClientId(client.getIntValue("client_id"));
if (bankAccount != null) {
client.put("bank_name", bankAccount.getString("bank"));
client.put("bank_country", bankAccount.getString("city"));
client.put("bank_account_number", bankAccount.getString("account_no"));
client.put("bank_account_name", bankAccount.getString("account_name"));
client.put("wechat_rate", weChatRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
client.put("clean", "T+" + weChatRate.getString("clean_days"));
client.put("clean_days", weChatRate.getString("clean_days"));
try {
JSONObject alipayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Alipay");
if (alipayRate != null) {
client.put("alipay_rate", alipayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
}
JSONObject bestPayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Bestpay");
if (bestPayRate != null) {
client.put("bestpay_rate", bestPayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
}
JSONObject jdRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "jd");
if (jdRate != null) {
client.put("jd_rate", jdRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
}
JSONObject alipayOnlineRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "AlipayOnline");
if (alipayOnlineRate != null) {
client.put("alipay_online_rate", alipayOnlineRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
}
JSONObject cbBankPayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "CB_BankPay");
if (cbBankPayRate != null) {
client.put("cbbank_rate", cbBankPayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
}
} catch (Exception ignored) {
throw new BadRequestException("Merchant Rate Not Configure");
}
JSONObject bankAccount = getBankAccountByClientId(client.getIntValue("client_id"));
if (bankAccount == null || bankAccount.size() <= 0) {
throw new BadRequestException("The Partner's Account is not config!");
}
client.put("bank", bankAccount.getString("bank"));
client.put("bsb_no", bankAccount.getString("bsb_no"));
client.put("account_no", bankAccount.getString("account_no"));
client.put("account_name", bankAccount.getString("account_name"));
String start_date = DateFormatUtils.format(new Date(), "dd/MM/yyyy");
client.put("start_date", start_date);
Date endDate = TimeZoneUtils.nextYearByCurrDay();
String end_date = DateFormatUtils.format(endDate, "dd/MM/yyyy");
client.put("end_date", end_date);
return exportClientAggregateFile(client);
}
@ -2253,34 +2292,75 @@ public class RetailAppServiceImp implements RetailAppService {
public JSONObject getClientAggregateFile(JSONObject device, MultipartFile file) throws IOException{
String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType);
if (StringUtils.isBlank(file.getOriginalFilename())) {
throw new BadRequestException("Please Enter Full Name");
}
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id"));
client.put("now", DateFormatUtils.format(new Date(), "yyyy-MM-dd"));
String clientName = "";
clientName = client.getString("business_name");
if (StringUtils.isNotBlank(client.getString("acn"))) {
clientName += "(" + client.getString("acn") + ")";
client.put("client_acn", client.getString("acn"));
String address = client.getString("address").trim();
if (address.contains(",")) {
client.put("address", address.substring(0, address.lastIndexOf(",")).trim());
client.put("address_sub", address.substring(address.lastIndexOf(",") + 1).trim());
}
if (client.getString("acn") != null && !client.getString("acn").equals("")) {
client.put("acn_type", "ACN: (" + client.getString("acn") + ")");
client.put("company_name_acn", client.getString("company_name") + " (ACN " + client.getString("acn") + ")");
} else {
client.put("acn_type", "ABN: (" + client.getString("abn") + ")");
client.put("company_name_acn", client.getString("company_name") + " (ABN " + client.getString("abn") + ")");
}
client.put("client_name", clientName);
client.put("bd_name", client.getString("bd_user_name"));
client.put("client_phone", client.getString("contact_phone"));
client.put("client_email", client.getString("contact_email"));
client.put("client_address", (client.getString("address") + "\n" + client.getString("suburb") + ' ' + client.getString("state") + ' ' + client.getString("postcode")));
JSONObject rate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "CB_BankPay");
if (rate != null) {
client.put("client_rate", (rate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN).toPlainString() + "%"));
int cleanDays = rate.getIntValue("clean_days");
client.put("clean_days", ("T+" + cleanDays));
client.put("days", cleanDays);
JSONObject weChatRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Wechat");
if (weChatRate == null) {
throw new BadRequestException("The Partner's Rate is not config!");
}
JSONObject bankAccount = clientManager.getBankAccountByClientId(client.getIntValue("client_id"));
if (bankAccount != null) {
client.put("bank_name", bankAccount.getString("bank"));
client.put("bank_country", bankAccount.getString("city"));
client.put("bank_account_number", bankAccount.getString("account_no"));
client.put("bank_account_name", bankAccount.getString("account_name"));
client.put("wechat_rate", weChatRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
client.put("clean", "T+" + weChatRate.getString("clean_days"));
client.put("clean_days", weChatRate.getString("clean_days"));
try {
JSONObject alipayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Alipay");
if (alipayRate != null) {
client.put("alipay_rate", alipayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
}
JSONObject bestPayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Bestpay");
if (bestPayRate != null) {
client.put("bestpay_rate", bestPayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
}
JSONObject jdRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "jd");
if (jdRate != null) {
client.put("jd_rate", jdRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
}
JSONObject alipayOnlineRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "AlipayOnline");
if (alipayOnlineRate != null) {
client.put("alipay_online_rate", alipayOnlineRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
}
JSONObject cbBankPayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "CB_BankPay");
if (cbBankPayRate != null) {
client.put("cbbank_rate", cbBankPayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
}
} catch (Exception ignored) {
throw new BadRequestException("Merchant Rate Not Configure");
}
JSONObject bankAccount = getBankAccountByClientId(client.getIntValue("client_id"));
if (bankAccount == null || bankAccount.size() <= 0) {
throw new BadRequestException("The Partner's Account is not config!");
}
client.put("bank", bankAccount.getString("bank"));
client.put("bsb_no", bankAccount.getString("bsb_no"));
client.put("account_no", bankAccount.getString("account_no"));
client.put("account_name", bankAccount.getString("account_name"));
String start_date = DateFormatUtils.format(new Date(), "dd/MM/yyyy");
client.put("start_date", start_date);
Date endDate = TimeZoneUtils.nextYearByCurrDay();
String end_date = DateFormatUtils.format(endDate, "dd/MM/yyyy");
client.put("end_date", end_date);
client.put("full_name", file.getOriginalFilename());
BufferedImage img = ImageIO.read(file.getInputStream());
ByteArrayOutputStream out = new ByteArrayOutputStream();
ImageIO.write(img, "png", out);
@ -2313,7 +2393,7 @@ public class RetailAppServiceImp implements RetailAppService {
deviceSupport.findRegister(clientType);
JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id"));
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
clientManager.commitAuthFilesToCompliance(client.getString("client_moniker"), account);
clientManager.commitAuthFilesToCompliance(client.getString("client_moniker"), account,"App");
}
private JSONObject exportImgAggregateFile(JSONObject account, JSONObject client) throws IOException{
@ -2324,9 +2404,9 @@ public class RetailAppServiceImp implements RetailAppService {
pdu.setTemplatePdfPath(IMG_AGGREGATE_FILE);
pdu.setPdfTemplate(client);
File file = new File(client.getString("client_moniker") + "_agreement.pdf");
ByteArrayOutputStream bos = pdu.templetPdfBos(file);
ByteArrayOutputStream bos = pdu.templetPdfBos(file,"STSong-Light","UniGB-UCS2-H");
stream = new ByteArrayInputStream(bos.toByteArray());
JSONObject fileInfo = attachmentClient.uploadFile(stream, client.getString("client_moniker") + "_agreement.pdf", false);
JSONObject fileInfo = attachmentClient.uploadFile(stream, client.getString("client_moniker") + "_" + System.currentTimeMillis() + "_agreement.pdf", false);
ClientAuthFilesInfo clientAuthFilesInfo = new ClientAuthFilesInfo();
clientAuthFilesInfo.setFile_agreement_info(fileInfo.getString("url"));
clientAuthFilesInfo.setFile_apply_info(null);
@ -2343,7 +2423,7 @@ public class RetailAppServiceImp implements RetailAppService {
return result;
}
private void exportAggregateFile(JSONObject client, HttpServletResponse httpResponse) {
private void exportCBBankAggregateFile(JSONObject client, HttpServletResponse httpResponse) {
httpResponse.setContentType("application/pdf");
httpResponse.setHeader("content-disposition", "attachment;filename=" + client.getString("client_moniker") + "_AGREEMENT_" + new Date() + ".pdf");
ServletOutputStream sos = null;
@ -2366,12 +2446,12 @@ public class RetailAppServiceImp implements RetailAppService {
JSONObject result = new JSONObject();
try {
PdfUtils pdu = new PdfUtils();
pdu.setTemplatePdfPath(CBBANK_AGGREGATE_FILE);
pdu.setTemplatePdfPath(IMG_AGGREGATE_FILE);
pdu.setPdfTemplate(client);
File file = new File(client.getString("client_moniker") + "_agreement.pdf");
ByteArrayOutputStream bos = pdu.templetPdfBos(file);
stream = new ByteArrayInputStream(bos.toByteArray());
JSONObject fileInfo = attachmentClient.uploadFile(stream, client.getString("client_moniker") + "_agreement_source.pdf", false);
JSONObject fileInfo = attachmentClient.uploadFile(stream, client.getString("client_moniker") + "_" + System.currentTimeMillis() + "_agreement_source.pdf", false);
result.put("file_value", fileInfo.getString("url"));
} catch (Exception e) {
throw new BadRequestException("获取合同文件失败");
@ -2395,4 +2475,8 @@ public class RetailAppServiceImp implements RetailAppService {
return BIND_ACCOUNT_PHONE_PREFIX+codeKey;
}
private JSONObject getBankAccountByClientId(int client_id) {
List<JSONObject> list = clientBankAccountMapper.clientBankAccounts(client_id);
return list.isEmpty() ? new JSONObject() : list.get(0);
}
}

@ -735,7 +735,6 @@ public class RetailAppController {
*/
@RequestMapping(value = "/client/aggregate_file", method = RequestMethod.GET)
public JSONObject getSourceAggregateFile(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
//todo 后面需替换成正式合同
return retailAppService.getSourceAggregateFile(device);
}
@ -744,9 +743,8 @@ public class RetailAppController {
* @param device
* @param file url
*/
@RequestMapping(value = "/client/aggregate_file", method = RequestMethod.PUT)
@RequestMapping(value = "/client/aggregate_file", method = RequestMethod.POST)
public JSONObject getClientAggregateFile(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device,@RequestParam MultipartFile file) throws IOException {
//todo 后面需替换成正式合同
return retailAppService.getClientAggregateFile(device, file);
}

@ -25,8 +25,12 @@ public interface ClientFilesMapper {
List<JSONObject> findClientFile(@Param("client_id") int clientId);
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid = 1 and status = 0")
List<JSONObject> findClientFileCommit(@Param("client_id") int clientId);
@AdvanceSelect(addonWhereClause = "is_valid = 1 and (status = 1 or status = 2) and file_name='client_agree_file'")
List<JSONObject> findClientPassAggreeFile(@Param("client_id") int clientId);
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid = 1 and (status = 0 or status = 3) and file_name='client_agree_file'")
List<JSONObject> findClientAggreeFileCommit(@Param("client_id") int clientId);
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid = 1")
@ -37,7 +41,9 @@ public interface ClientFilesMapper {
List<JSONObject> findFileByClientAndType(@Param("client_id") int client_id, @Param("file_name") String file_name);
void deleteByClientAndType(@Param("file_id") String file_id);
void deleteByClientAndFileId(@Param("file_id") String file_id);
void deleteAggreeByClientId(@Param("client_id") int file_id);
void confirmAgreeFile(@Param("client_id") int client_id);

@ -245,7 +245,7 @@ public interface ClientManager {
List<JSONObject> uploadAuthFilesForWaitCompliance(JSONObject manager, String clientMoniker, ClientAuthFilesInfo filesInfo);
void commitAuthFilesToCompliance(String clientMoniker, JSONObject account);
void commitAuthFilesToCompliance(String clientMoniker, JSONObject account, String source);
JSONObject getClientsAnalysis(JSONObject manager);

@ -1994,22 +1994,21 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) {
throw new InvalidShortIdException();
}
JSONObject file = signInAccountService.checkAuthFileStatusByWEB(client);
file.put("file_company",clientComplianceCompanyMapper.findFileByClientId(account.getIntValue("client_id")));
JSONObject file = signInAccountService.checkAuthFileStatus(client);
file.put("file_company", clientComplianceCompanyMapper.findFileByClientId(account.getIntValue("client_id")));
return file;
}
@Override
public JSONObject getComplianceFilesForBD(JSONObject account)
{
public JSONObject getComplianceFilesForBD(JSONObject account) {
JSONObject client = getClientInfo(account.getIntValue("client_id"));
if (client == null) {
throw new InvalidShortIdException();
}
JSONObject file = clientComplianceApply.complianceAuthFile(client);
file.put("file_company",clientComplianceCompanyMapper.findFileByClientId(account.getIntValue("client_id")));
file.put("client",client);
file.put("file_company", clientComplianceCompanyMapper.findFileByClientId(account.getIntValue("client_id")));
file.put("client", client);
return file;
}
@ -3110,8 +3109,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override
public JSONObject getClientViewAuthFiles(JSONObject manager, String clientMoniker)
{
public JSONObject getClientViewAuthFiles(JSONObject manager, String clientMoniker) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
String[] fileKeys = {"client_bank_file", "client_company_file", "client_id_file", "client_agree_file", "client_apply_file"};
if (client == null) {
@ -3139,12 +3137,17 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
return fileJson;
};
}
;
@Override
public void deleteAuthFiles(String fileId)
{
clientFilesMapper.deleteByClientAndType(fileId);
public void deleteAuthFiles(String fileId) {
JSONObject file = clientFilesMapper.findFileById(fileId);
if (file.getIntValue("status") == 1 || file.getIntValue("status") == 2) {
throw new BadRequestException("The file has passed and cannot be deleted");
}
clientFilesMapper.deleteByClientAndFileId(fileId);
}
@Override
@ -3181,11 +3184,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
int clientId = client.getIntValue("client_id");
try {
updateSysClientFilesForWaitCompliance(manager, clientId, CLIENT_AGREE_FILE, filesInfo.getFile_agreement_info(),fileResult);
updateSysClientFilesForWaitCompliance(manager, clientId, CLIENT_APPLY_FILE, filesInfo.getFile_apply_info(),fileResult);
updateSysClientFilesForWaitCompliance(manager, clientId, CLIENT_BANK_FILE, filesInfo.getFile_bank_info(),fileResult);
updateSysClientFilesForWaitCompliance(manager, clientId, CLIENT_COMPANY_FILE, filesInfo.getFile_company_info(),fileResult);
updateSysClientFilesForWaitCompliance(manager, clientId, CLIENT_ID_FILE, filesInfo.getFile_id_info(),fileResult);
updateAggregateFilesForWaitCompliance(manager, clientId, CLIENT_AGREE_FILE, filesInfo.getFile_agreement_info(), fileResult);
updateSysClientFilesForWaitCompliance(manager, clientId, CLIENT_APPLY_FILE, filesInfo.getFile_apply_info(), fileResult);
updateSysClientFilesForWaitCompliance(manager, clientId, CLIENT_BANK_FILE, filesInfo.getFile_bank_info(), fileResult);
updateSysClientFilesForWaitCompliance(manager, clientId, CLIENT_COMPANY_FILE, filesInfo.getFile_company_info(), fileResult);
updateSysClientFilesForWaitCompliance(manager, clientId, CLIENT_ID_FILE, filesInfo.getFile_id_info(), fileResult);
} catch (Exception e) {
logger.error("上传合规文件失败", e);
}
@ -3199,8 +3202,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override
@Transactional
public void commitAuthFilesToCompliance(String clientMoniker, JSONObject account) {
public void commitAuthFilesToCompliance(String clientMoniker, JSONObject account, String source) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
int sourceEnum = 2;
if (client == null) {
throw new InvalidShortIdException();
}
@ -3214,22 +3218,29 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new BadRequestException("Please check the information is uploaded completely");
}
}
if ("app".equals(source.toLowerCase())) {
sourceEnum = 1;
}
JSONObject fileComp = clientComplianceCompanyMapper.findFileByClientId(client.getIntValue("client_id"));
if(fileComp == null) {
if (fileComp == null) {
fileComp = new JSONObject();
fileComp.put("client_id",client.getIntValue("client_id"));
fileComp.put("submit_time",new Date());
fileComp.put("status",0);
fileComp.put("commit_by_id",account.getString("account_id"));
fileComp.put("client_id", client.getIntValue("client_id"));
fileComp.put("submit_time", new Date());
fileComp.put("status", 0);
fileComp.put("source", sourceEnum);
fileComp.put("commit_by_id", account.getString("account_id"));
clientComplianceCompanyMapper.save(fileComp);
clientFilesMapper.updateBeforeCompliance(client.getIntValue("client_id"));
} else {
fileComp.put("status",0);
fileComp.put("submit_time",new Date());
fileComp.put("commit_by_id",account.getString("account_id"));
} else if (fileComp.getIntValue("status") == 2) {
fileComp.put("status", 0);
fileComp.put("submit_time", new Date());
fileComp.put("source", sourceEnum);
fileComp.put("commit_by_id", account.getString("account_id"));
clientComplianceCompanyMapper.update(fileComp);
clientFilesMapper.updateBeforeCompliance(client.getIntValue("client_id"));
} else {
throw new BadRequestException("please do not repeat submission");
}
}
@ -3285,7 +3296,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
}
public void updateSysClientFilesForWaitCompliance(JSONObject manager, int clientId, String fileType, String fileValue,List<JSONObject> fileResult) {
public void updateSysClientFilesForWaitCompliance(JSONObject manager, int clientId, String fileType, String fileValue, List<JSONObject> fileResult) {
if (fileValue != null) {
String[] values = fileValue.split(",");
for (String value : values) {
@ -3307,6 +3318,33 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
}
public void updateAggregateFilesForWaitCompliance(JSONObject manager, int clientId, String fileType, String fileValue, List<JSONObject> fileResult) {
if (fileValue != null) {
List<JSONObject> passAggregateFiles = clientFilesMapper.findClientPassAggreeFile(clientId);
if (passAggregateFiles != null && passAggregateFiles.size() > 0) {
throw new BadRequestException("合同已提交或审核通过,请勿重复签订合同");
}
List<JSONObject> aggregateFiles = clientFilesMapper.findClientAggreeFileCommit(clientId);
if (aggregateFiles != null && aggregateFiles.size() > 0) {
clientFilesMapper.deleteAggreeByClientId(clientId);
}
JSONObject fileJson = new JSONObject();
fileJson.put("client_id", clientId);
fileJson.put("last_update_date", new Date());
fileJson.put("last_update_by", manager.getString("display_name"));
fileJson.put("file_name", fileType);
fileJson.put("file_value", fileValue);
fileJson.put("status", 0);
fileJson.put("is_valid", 1);
clientFilesMapper.save(fileJson);
logger.info(clientId + "的合同文件上传成功" + fileJson.getString("file_id"));
JSONObject file = new JSONObject();
file.put("file_id", fileJson.getString("file_id"));
file.put("file_value", fileJson.getString("file_value"));
fileResult.add(file);
}
}
@Override

@ -574,7 +574,7 @@ public class PartnerViewController {
@PartnerMapping(value = "/clientCompliance/{clientMoniker}/viewCommit", method = RequestMethod.POST)
@ResponseBody
public void clientComplianceViewCommit(@PathVariable String clientMoniker ,@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account) {
clientManager.commitAuthFilesToCompliance(clientMoniker, account);
clientManager.commitAuthFilesToCompliance(clientMoniker, account, "Web");
}
@PartnerMapping(value = "/auth_file/{fileId}/delete", method = RequestMethod.PUT, roles = {PartnerRole.ADMIN, PartnerRole.MANAGER})

@ -58,7 +58,5 @@ public interface SignInAccountService {
void deleteManagerCodeKey(String codekey);
JSONObject checkAuthFileStatusByWEB(JSONObject client);
JSONObject checkAuthFileStatus(JSONObject client);
}

@ -87,6 +87,9 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
private SmsSender smsSender;
private final String RESET_CLIENT_ACCOUNT_PREFIX = "RESET_CLIENT_ACCOUNT";
private final String RESET_MANAGER_ACCOUNT_PREFIX = "RESET_MANAGER_ACCOUNT";
private final String[] FILE_KEYS = {"client_bank_file", "client_company_file", "client_id_file", "client_agree_file"};
private final String[] PUT_KEYS = {"file_bank_info", "file_company_info", "file_id_info", "file_agreement_info"};
private final String[] FILE_NAMES = {"* bank statement", "* Certificate of Registration", "* ID", "* Agreement"};
private final int RESET_PASSWORD_TEMPLID = 126978;
private ApplicationEventPublisher publisher;
private static final List<String> tags = new ArrayList<>();
@ -632,81 +635,15 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
return RESET_MANAGER_ACCOUNT_PREFIX + codeKey;
}
@Override
public JSONObject checkAuthFileStatusByWEB(JSONObject client) {
JSONObject result = new JSONObject();
result.put("client_less_file", false);
if (client.getIntValue("approve_result") == 2 || client.getIntValue("open_status") == 10) {
List<JSONObject> clientFiles = clientFilesMapper.findAllClientFile(client.getIntValue("client_id"));
String[] fileKeys = {"client_bank_file", "client_company_file", "client_id_file", "client_agree_file"};
String[] putKeys = {"file_bank_info", "file_company_info", "file_id_info", "file_agreement_info"};
String[] fileNames = {"* bank statement", "* Certificate of Registration", "* ID", "* Agreement"};
boolean clientFilesIsLess = false;
JSONObject resultFile = new JSONObject();
for (int i = 0; i < fileKeys.length; i++) {
String fileKey = fileKeys[i];
if (clientFiles != null && clientFiles.size() > 0) {
List<JSONObject> clientFileUrl = clientFiles.stream()
.filter(fileJson -> (fileKey.equals(fileJson.getString("file_name")) && (fileJson.getIntValue("status") == 1 || fileJson.getIntValue("status") == 2)))
.sorted((log1, log2) -> log2.getDate("last_update_date").compareTo(log1.getDate("last_update_date")))
.map(json -> {
JSONObject params = new JSONObject();
params.put("file_id", json.getString("file_id"));
params.put("file_value", json.getString("file_value"));
return params;
})
.collect(Collectors.toList());
if (clientFileUrl != null && clientFileUrl.size() > 0) {
JSONObject fileJson = new JSONObject();
fileJson.put("key", putKeys[i]);
fileJson.put("name", fileNames[i]);
fileJson.put("file_value", clientFileUrl);
fileJson.put("file_write", false);
resultFile.put(fileKey,fileJson);
} else {
List<JSONObject> clientBackToFileUrl = clientFiles.stream()
.filter(fileJson -> (fileKey.equals(fileJson.getString("file_name")) && (fileJson.getIntValue("status") == 0 || fileJson.getIntValue("status") == 3)))
.sorted((log1, log2) -> log2.getDate("last_update_date").compareTo(log1.getDate("last_update_date")))
.map(json -> {
JSONObject params = new JSONObject();
params.put("file_id", json.getString("file_id"));
params.put("file_value", json.getString("file_value"));
return params;
})
.collect(Collectors.toList());
JSONObject fileJson = new JSONObject();
fileJson.put("key", putKeys[i]);
fileJson.put("name", fileNames[i]);
if (clientBackToFileUrl != null && clientBackToFileUrl.size() > 0) {
fileJson.put("file_value", clientBackToFileUrl);
}
fileJson.put("file_write", true);
resultFile.put(fileKey,fileJson);
clientFilesIsLess = true;
}
}
result.put("client_less_file", clientFilesIsLess);
if (clientFilesIsLess) {
result.put("client_files", resultFile);
}
}
}
return result;
}
@Override
public JSONObject checkAuthFileStatus(JSONObject client) {
JSONObject result = new JSONObject();
result.put("client_less_file", false);
if (client.getIntValue("approve_result") == 2 || client.getIntValue("open_status") == 10) {
List<JSONObject> clientFiles = clientFilesMapper.findAllClientFile(client.getIntValue("client_id"));
String[] fileKeys = {"client_bank_file", "client_company_file", "client_id_file", "client_agree_file"};
String[] putKeys = {"file_bank_info", "file_company_info", "file_id_info", "file_agreement_info"};
String[] fileNames = {"* bank statement", "* Certificate of Registration", "* ID", "* Agreement"};
boolean clientFilesIsLess = false;
List<JSONObject> resultFile = new ArrayList<>();
for (int i = 0; i < fileKeys.length; i++) {
String fileKey = fileKeys[i];
for (int i = 0; i < FILE_KEYS.length; i++) {
String fileKey = FILE_KEYS[i];
if (clientFiles != null && clientFiles.size() > 0) {
List<JSONObject> clientFileUrl = clientFiles.stream()
.filter(fileJson -> (fileKey.equals(fileJson.getString("file_name")) && (fileJson.getIntValue("status") == 1 || fileJson.getIntValue("status") == 2)))
@ -720,11 +657,11 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
.collect(Collectors.toList());
if (clientFileUrl != null && clientFileUrl.size() > 0) {
JSONObject fileJson = new JSONObject();
fileJson.put("key", putKeys[i]);
fileJson.put("name", fileNames[i]);
fileJson.put("key", PUT_KEYS[i]);
fileJson.put("name", FILE_NAMES[i]);
fileJson.put("file_value", clientFileUrl);
fileJson.put("file_write", false);
resultFile.add(fileJson);
result.put(fileKey,fileJson);
} else {
List<JSONObject> clientBackToFileUrl = clientFiles.stream()
.filter(fileJson -> (fileKey.equals(fileJson.getString("file_name")) && (fileJson.getIntValue("status") == 0 || fileJson.getIntValue("status") == 3)))
@ -737,23 +674,29 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
})
.collect(Collectors.toList());
JSONObject fileJson = new JSONObject();
fileJson.put("key", putKeys[i]);
fileJson.put("name", fileNames[i]);
fileJson.put("key", PUT_KEYS[i]);
fileJson.put("name", FILE_NAMES[i]);
if (clientBackToFileUrl != null && clientBackToFileUrl.size() > 0) {
if ("client_agree_file".equals(fileKey)) {
List<JSONObject> agreeFile = new ArrayList<>();
agreeFile.add(clientBackToFileUrl.get(0));
fileJson.put("file_value", agreeFile);
fileJson.put("file_write", true);
}else {
fileJson.put("file_value", clientBackToFileUrl);
fileJson.put("file_write", true);
}
}else {
fileJson.put("file_write", true);
resultFile.add(fileJson);
}
result.put(fileKey,fileJson);
clientFilesIsLess = true;
}
}
result.put("client_less_file", clientFilesIsLess);
if (clientFilesIsLess) {
result.put("client_files", resultFile);
}
result.put("client_refuse_reason", "测试驳回!!!");
}
}
return result;
}
}

@ -9,10 +9,16 @@
and is_valid = 1
order by last_update_date desc
</select>
<select id="deleteByClientAndType" resultType="com.alibaba.fastjson.JSONObject">
<select id="deleteByClientAndFileId" resultType="com.alibaba.fastjson.JSONObject">
update sys_files set is_valid = 0
where file_id = #{file_id}
</select>
<select id="deleteAggreeByClientId" resultType="com.alibaba.fastjson.JSONObject">
update sys_files set is_valid = 0
where client_id = #{client_id}
and file_name='client_agree_file'
and status != 1
</select>
<update id="confirmAgreeFile">
update sys_files
set state = 2

@ -762,7 +762,6 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload','uiBoot
app.controller('clientCommitToComplianceFilesCtrl', ['$scope', '$http', '$rootScope', 'commonDialog', '$state', 'Upload', 'file', function ($scope, $http, $rootScope, commonDialog, $state, Upload, file) {
$scope.file = file.data || {};
$scope.client_files = file.data.client_files;
//audit files
$scope.uploadBankFile = function (file) {
if (file != null) {

@ -13,7 +13,7 @@
<a ui-sref="partner_detail({client_moniker:partner.client_moniker})">Partner Detail</a>
</li>
<li ui-sref-active="active">
<a ui-sref="compliance_detail({client_moniker:partner.client_moniker})">Compliance_Audit</a>
<a ui-sref="compliance_detail({client_moniker:partner.client_moniker})">Compliance Audit</a>
</li>
</ul>
<div class="tab-content" ui-view>
@ -71,8 +71,12 @@
<div class="panel-body">
<div class="form-horizontal">
<div class="form-group">
<label class="control-label col-sm-2">* bank statement<span ng-if="file.client_bank_file[0].status == 1" class="small text-success">(已通过)</span><span ng-if="file.client_bank_file[0].status != 1" class="small text-danger">(待审核)</span></label>
<div class="col-sm-4">
<label class="control-label col-sm-4" style="text-align: center;">* bank statement
<span ng-if="file.client_bank_file[0].status == 1" class="small text-success">(已通过)</span>
<span ng-if="file.client_bank_file[0].status == 2" class="small text-danger">(待审核)</span>
<span ng-if="file.client_bank_file[0].status == 3" class="small text-danger">(已驳回)</span>
</label>
<div class="col-sm-6">
<table>
<tbody>
<tr ng-repeat="file_src in file.client_bank_file track by $index">
@ -89,8 +93,12 @@
</div>
<div class="form-group">
<label class="control-label col-sm-2">* Certificate of Registration<span ng-if="file.client_company_file[0].status == 1" class="small text-success">(已通过)</span><span ng-if="file.client_company_file[0].status != 1" class="small text-danger">(待审核)</span></label>
<div class="col-sm-4">
<label class="control-label col-sm-4" style="text-align: center;">* Certificate of Registration
<span ng-if="file.client_company_file[0].status == 1" class="small text-success">(已通过)</span>
<span ng-if="file.client_company_file[0].status == 2" class="small text-danger">(待审核)</span>
<span ng-if="file.client_company_file[0].status == 3" class="small text-danger">(已驳回)</span>
</label>
<div class="col-sm-6">
<table>
<tbody>
<tr ng-repeat="file_src in file.client_company_file track by $index">
@ -106,8 +114,12 @@
</div>
<div class="form-group">
<label class="control-label col-sm-2">* ID <span ng-if="file.client_id_file[0].status == 1" class="small text-success">(已通过)</span><span ng-if="file.client_id_file[0].status != 1" class="small text-danger">(待审核)</span></label>
<div class="col-sm-4">
<label class="control-label col-sm-4" style="text-align: center;">* ID
<span ng-if="file.client_id_file[0].status == 1" class="small text-success">(已通过)</span>
<span ng-if="file.client_id_file[0].status == 2" class="small text-danger">(待审核)</span>
<span ng-if="file.client_id_file[0].status == 3" class="small text-danger">(已驳回)</span>
</label>
<div class="col-sm-6">
<table>
<tbody>
<tr ng-repeat="file_src in file.client_id_file track by $index">
@ -123,8 +135,12 @@
</div>
<div class="form-group">
<label class="control-label col-sm-2">* Agreement<span ng-if="file.client_agree_file[0].status == 1" class="small text-success">(已通过)</span><span ng-if="file.client_agree_file[0].status != 1" class="small text-danger">(待审核)</span></label>
<div class="col-sm-4">
<label class="control-label col-sm-4" style="text-align: center;">* Agreement
<span ng-if="file.client_agree_file[0].status == 1" class="small text-success">(已通过)</span>
<span ng-if="file.client_agree_file[0].status == 2" class="small text-danger">(待审核)</span>
<span ng-if="file.client_agree_file[0].status == 3" class="small text-danger">(已驳回)</span>
</label>
<div class="col-sm-6">
<table>
<tbody>
<tr ng-repeat="file_src in file.client_agree_file track by $index">

@ -20,10 +20,10 @@
<div class="form-control-static">
<button class="btn btn-primary" type="button"
ngf-select="uploadBankFile($file)"
ng-if="client_files.client_bank_file.file_write && file.file_company.status != 0 && file.file_company.status!=1">
ng-if="file.client_bank_file.file_write && file.file_company.status != 0 && file.file_company.status!=1">
<i class="fa fa-upload"></i> Upload
</button>
<a ng-if="client_files.client_bank_file" role="button" class="btn-group btn btn-warning" type="button" ng-href="{{client_files.client_bank_file}}" target="_blank"><i class="fa fa-download"></i></a>
<a ng-if="file.client_bank_file" role="button" class="btn-group btn btn-warning" type="button" ng-href="{{file.client_bank_file}}" target="_blank"><i class="fa fa-download"></i></a>
<i class="fa fa-check-square-o check-i" aria-hidden="true" style="float: none" ng-if="$root.complianceCheck.authFile"></i>
</div>
<uib-progressbar value="bankFileProgress.value" ng-if="bankFileProgress"></uib-progressbar>
@ -33,12 +33,12 @@
</a>-->
<table>
<tbody>
<tr ng-repeat="file_src in client_files.client_bank_file.file_value track by $index">
<tr ng-repeat="file_src in file.client_bank_file.file_value track by $index">
<td ng-bind="$index+1+'.'" ALIGN="left" VALIGN="top" class="btn">1</td>
<td><a ng-if="bankIsImage" target="_blank" ng-href="{{file_src.file_value}}">
<img class="col-sm-6" style="border: 1px solid #ddd" ng-src="{{file_src.file_value}}" class="col-sm-8" onerror="this.src='https://static.easyicon.net/preview/118/1184255.gif'">
</a>
<button class="btn btn-danger" type="button" ng-click="deleteComplianceFiles(file_src.file_id)" ng-if="client_files.client_bank_file.file_write && file_src.status !=1 && file.file_company.status != 0 && file.file_company.status!=1">X</button>
<button class="btn btn-danger" type="button" ng-click="deleteComplianceFiles(file_src.file_id)" ng-if="file.client_bank_file.file_write && file_src.status !=1 && file.file_company.status != 0 && file.file_company.status!=1">X</button>
</td>
</tr>
</tbody>
@ -61,7 +61,7 @@
<div class="form-control-static">
<button class="btn btn-primary" type="button"
ngf-select="uploadCompanyFile($file)"
ng-if="client_files.client_company_file.file_write && file.file_company.status != 0 && file.file_company.status!=1">
ng-if="file.client_company_file.file_write && file.file_company.status != 0 && file.file_company.status!=1">
<i class="fa fa-upload"></i> Upload
</button>
<a ng-if="file.client_company_file" role="button" class="btn-group btn btn-warning" type="button" ng-href="{{file.client_company_file}}" target="_blank"><i class="fa fa-download"></i></a>
@ -71,12 +71,12 @@
<!-- <a ng-if="companyIsImage" ng-repeat="src in file.client_company_file" ng-href="{{src}}" target="_blank">
<img ng-src="{{src}}" class="col-sm-8"></a>-->
<table><tbody>
<tr ng-repeat="file_src in client_files.client_company_file.file_value track by $index">
<tr ng-repeat="file_src in file.client_company_file.file_value track by $index">
<td ng-bind="$index+1+'.'" class="btn">1</td>
<td><a ng-if="companyIsImage" target="_blank" ng-href="{{file_src.file_value}}">
<img ng-src="{{file_src.file_value}}" class="col-sm-8" onerror="this.src='https://static.easyicon.net/preview/118/1184255.gif'">
</a>
<button class="btn btn-danger" type="button" ng-click="deleteComplianceFiles(file_src.file_id)" ng-if="client_files.client_company_file.file_write && file_src.status !=1 && file.file_company.status != 0 && file.file_company.status!=1">X</button>
<button class="btn btn-danger" type="button" ng-click="deleteComplianceFiles(file_src.file_id)" ng-if="file.client_company_file.file_write && file_src.status !=1 && file.file_company.status != 0 && file.file_company.status!=1">X</button>
</td>
</tr>
</tbody></table>
@ -104,7 +104,7 @@
<div class="form-control-static">
<button class="btn btn-primary" type="button"
ngf-select="uploadIDFile($file)"
ng-if="client_files.client_id_file.file_write && file.file_company.status != 0 && file.file_company.status!=1">
ng-if="file.client_id_file.file_write && file.file_company.status != 0 && file.file_company.status!=1">
<i class="fa fa-upload"></i> Upload
</button>
<a ng-if="file.client_id_file" role="button" class="btn-group btn btn-warning" type="button" ng-href="{{file.client_id_file}}" target="_blank"><i class="fa fa-download"></i></a>
@ -115,12 +115,12 @@
<img ng-src="{{src}}" class="col-sm-8"></a>-->
<table>
<tbody>
<tr ng-repeat="file_src in client_files.client_id_file.file_value track by $index">
<tr ng-repeat="file_src in file.client_id_file.file_value track by $index">
<td ng-bind="$index+1+'.'" class="btn">1</td>
<td><a ng-if="idIsImage" target="_blank" ng-href="{{file_src.file_value}}">
<img ng-src="{{file_src.file_value}}" class="col-sm-8" onerror="this.src='https://static.easyicon.net/preview/118/1184255.gif'">
</a>
<button class="btn btn-danger" type="button" ng-click="deleteComplianceFiles(file_src.file_id)" ng-if="client_files.client_id_file.file_write && file_src.status !=1 && file.file_company.status != 0 && file.file_company.status!=1 ">X</button>
<button class="btn btn-danger" type="button" ng-click="deleteComplianceFiles(file_src.file_id)" ng-if="file.client_id_file.file_write && file_src.status !=1 && file.file_company.status != 0 && file.file_company.status!=1 ">X</button>
</td>
</tr>
</tbody></table>
@ -149,7 +149,7 @@
<div class="form-control-static">
<button class="btn btn-primary" type="button"
ngf-select="uploadAgreementFile($file)"
ng-if="client_files.client_agree_file.file_write && file.file_company.status != 0 && file.file_company.status!=1">
ng-if="file.client_agree_file.file_write && file.file_company.status != 0 && file.file_company.status!=1">
<i class="fa fa-upload"></i> Upload
</button>
<a ng-if="file.client_agree_file" role="button" class="btn-group btn btn-warning" type="button" ng-href="{{file.client_agree_file}}" target="_blank"><i class="fa fa-download"></i></a>
@ -160,12 +160,12 @@
<img ng-src="{{src}}" class="col-sm-8"></a>-->
<table>
<tbody>
<tr ng-repeat="file_src in client_files.client_agree_file.file_value track by $index">
<tr ng-repeat="file_src in file.client_agree_file.file_value track by $index">
<td ng-bind="$index+1+'.'" class="btn">1</td>
<td><a ng-if="bankIsImage" target="_blank" ng-href="{{file_src.file_value}}">
<img ng-src="{{file_src.file_value}}" class="col-sm-8">
</a>
<button class="btn btn-danger" type="button" ng-click="deleteComplianceFiles(file_src.file_id)" ng-if="client_files.client_agree_file.file_write && file_src.status !=1 && file.file_company.status != 0 && file.file_company.status!=1">X</button>
<button class="btn btn-danger" type="button" ng-click="deleteComplianceFiles(file_src.file_id)" ng-if="file.client_agree_file.file_write && file_src.status !=1 && file.file_company.status != 0 && file.file_company.status!=1">X</button>
</td>
</tr>
</tbody></table>

@ -51,7 +51,7 @@
<a ui-sref="partner_detail({client_moniker:partner.client_moniker})">Partner Detail</a>
</li>
<li ui-sref-active="active">
<a ui-sref="compliance_detail({client_moniker:partner.client_moniker})">Compliance_Audit</a>
<a ui-sref="compliance_detail({client_moniker:partner.client_moniker})">Compliance Audit</a>
</li>
</ul>
<div class="tab-content" ui-view>

@ -45,6 +45,7 @@
<th>BD</th>
<th>AuthFile Status</th>
<th>Submit Time</th>
<th>Source</th>
<th>Operation</th>
</tr>
</thead>
@ -74,6 +75,10 @@
<span ng-if="compliance_company.status==2">打回</span>
</td>
<td ng-bind="compliance_company.submit_time|date:'dd/MMM/yyyy'"></td>
<td>
<span ng-if="compliance_company.source==1">App</span>
<span ng-if="compliance_company.source==2">Web</span>
</td>
<td><a class="text-primary" role="button" title="Detail"
ui-sref="compliance_detail({client_moniker:compliance_company.client_moniker})">
<i class="fa fa-search"></i> Detail

Loading…
Cancel
Save