parent
dd11125c0f
commit
ccbd5a9c3a
@ -0,0 +1,24 @@
|
|||||||
|
package au.com.royalpay.payment.manage.riskbusiness.core;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
|
public interface RiskUploadService {
|
||||||
|
/**
|
||||||
|
* 上传材料
|
||||||
|
* @param material
|
||||||
|
*/
|
||||||
|
void submitMaterial(JSONObject material);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除缓存
|
||||||
|
* @param codeKey
|
||||||
|
*/
|
||||||
|
void deleteUploadMailKey(String codeKey);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param codeKey
|
||||||
|
* @param risk_id
|
||||||
|
*/
|
||||||
|
void checkUploadMailKey(String codeKey,String risk_id);
|
||||||
|
}
|
@ -0,0 +1,95 @@
|
|||||||
|
package au.com.royalpay.payment.manage.riskbusiness.core.impl;
|
||||||
|
|
||||||
|
import au.com.royalpay.payment.core.exceptions.EmailException;
|
||||||
|
import au.com.royalpay.payment.manage.mappers.riskbusiness.RiskEventMapper;
|
||||||
|
import au.com.royalpay.payment.manage.mappers.riskbusiness.RiskMaterialMapper;
|
||||||
|
import au.com.royalpay.payment.manage.notice.core.MailService;
|
||||||
|
import au.com.royalpay.payment.manage.riskbusiness.core.RiskBusinessService;
|
||||||
|
import au.com.royalpay.payment.manage.riskbusiness.core.RiskUploadService;
|
||||||
|
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
|
||||||
|
import au.com.royalpay.payment.tools.threadpool.RoyalThreadPoolExecutor;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||||
|
import org.apache.commons.lang3.time.DateUtils;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.thymeleaf.context.Context;
|
||||||
|
import org.thymeleaf.spring4.SpringTemplateEngine;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class RiskUploadServiceIpml implements RiskUploadService {
|
||||||
|
@Resource
|
||||||
|
private RiskMaterialMapper riskMaterialMapper;
|
||||||
|
@Resource
|
||||||
|
private RiskEventMapper riskEventMapper;
|
||||||
|
@Resource
|
||||||
|
private StringRedisTemplate stringRedisTemplate;
|
||||||
|
@Resource
|
||||||
|
private MailService mailService;
|
||||||
|
@Resource
|
||||||
|
private RoyalThreadPoolExecutor royalThreadPoolExecutor;
|
||||||
|
@Resource
|
||||||
|
private SpringTemplateEngine thymeleaf;
|
||||||
|
private final String UPLOAD_MAIL_PREFIX = "UPLOAD_MAIL";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void submitMaterial(JSONObject material) {
|
||||||
|
riskMaterialMapper.save(material);
|
||||||
|
JSONObject event = riskEventMapper.findById(material.getString("risk_id"));
|
||||||
|
event.put("result_type",2);
|
||||||
|
riskEventMapper.update(event);
|
||||||
|
JSONObject operator = riskMaterialMapper.findOperatorById(material.getString("risk_id"));
|
||||||
|
if(operator.containsKey("email")){
|
||||||
|
Context ctx = new Context();
|
||||||
|
ctx.setVariable("client_moniker", event.getString("client_moniker"));
|
||||||
|
ctx.setVariable("short_name", event.getString("short_name"));
|
||||||
|
ctx.setVariable("create_time", DateFormatUtils.format(event.getDate("create_time"),"yyyy-MM-dd HH:mm:ss"));
|
||||||
|
ctx.setVariable("operator", operator.getString("display_name"));
|
||||||
|
final String content = thymeleaf.process("mail/risk_operator_notice", ctx);
|
||||||
|
royalThreadPoolExecutor.execute(() -> {
|
||||||
|
try {
|
||||||
|
String emailId = mailService.sendRiskEmail(event.getString("client_moniker")+" has submitted the material",operator.getString("email") ,
|
||||||
|
"", content, event.getIntValue("order_type"));
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new EmailException("Email Sending Failed", e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteUploadMailKey(String codeKey) {
|
||||||
|
stringRedisTemplate.delete(getRiskUploadKey(codeKey));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkUploadMailKey(String codeKey,String risk_id) {
|
||||||
|
JSONObject event = riskEventMapper.findById(risk_id);
|
||||||
|
//到期日前一天的下午6点前url可用
|
||||||
|
try {
|
||||||
|
String reply = DateFormatUtils.format(DateUtils.addDays(event.getDate("reply_email_date"),-1),"yyyy-MM-dd 18:00:00");
|
||||||
|
if(new Date().after( DateUtils.parseDate(reply,new String[]{"yyyy-MM-dd HH:mm:ss"}))){
|
||||||
|
deleteUploadMailKey(codeKey);
|
||||||
|
throw new BadRequestException("Url expired");
|
||||||
|
}
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isNotEmpty(codeKey)) {
|
||||||
|
String redisUpload = stringRedisTemplate.boundValueOps(getRiskUploadKey(codeKey)).get();
|
||||||
|
if (redisUpload == null) {
|
||||||
|
throw new BadRequestException("Url expired");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private String getRiskUploadKey(String codeKey){
|
||||||
|
return UPLOAD_MAIL_PREFIX + codeKey;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
package au.com.royalpay.payment.manage.riskbusiness.web;
|
||||||
|
|
||||||
|
import au.com.royalpay.payment.manage.riskbusiness.core.RiskUploadService;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/risk/upload")
|
||||||
|
public class RiskFileUploadController {
|
||||||
|
@Resource
|
||||||
|
private RiskUploadService riskUploadService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传材料的链接
|
||||||
|
* @param codeKey
|
||||||
|
* @param risk_id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/{risk_id}/{codeKey}", method = RequestMethod.GET)
|
||||||
|
public ModelAndView jumpVerifyMail(@PathVariable String codeKey, @PathVariable String risk_id) {
|
||||||
|
//检查codekey是否有效
|
||||||
|
riskUploadService.checkUploadMailKey(codeKey,risk_id);
|
||||||
|
ModelAndView view = new ModelAndView("mail/risk_upload");
|
||||||
|
view.addObject("codeKey", codeKey);
|
||||||
|
view.addObject("risk_id",risk_id);
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传调单材料
|
||||||
|
* @param codeKey
|
||||||
|
* @param material
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/{codeKey}", method = RequestMethod.POST)
|
||||||
|
public void upload(@PathVariable String codeKey, @RequestBody JSONObject material) {
|
||||||
|
riskUploadService.submitMaterial(material);
|
||||||
|
riskUploadService.deleteUploadMailKey(codeKey);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
|
<mapper namespace="au.com.royalpay.payment.manage.mappers.riskbusiness.RiskMaterialMapper">
|
||||||
|
<select id="findOperatorById" resultType="com.alibaba.fastjson.JSONObject">
|
||||||
|
SELECT m.*
|
||||||
|
FROM risk_material r
|
||||||
|
LEFT JOIN risk_event e
|
||||||
|
ON r.risk_id = e.risk_id
|
||||||
|
LEFT JOIN sys_managers m
|
||||||
|
ON e.fillin_id = m.manager_id
|
||||||
|
WHERE r.risk_id = #{risk_id}
|
||||||
|
LIMIT 1
|
||||||
|
</select>
|
||||||
|
</mapper>
|
@ -0,0 +1,24 @@
|
|||||||
|
<html xmlns:th="http://www.thymeleaf.org" lang="zh">
|
||||||
|
<h4>Dear <span th:text="${operator}"></span> :</h4>
|
||||||
|
<p>您好,您于<span th:text="${create_time}"></span>创建的风控事件单已经接收到了商户<span th:text="${short_name}"></span>(<span th:text="${client_moniker}"></span>)的风控材料,请及时审核。</p>
|
||||||
|
<h4>Best Regards</h4>
|
||||||
|
<p>
|
||||||
|
<img style="width: 120px;height: 120px"
|
||||||
|
src="https://mpay.royalpay.com.au/static/images/logo_new.jpg"> <br>
|
||||||
|
Contact Us<br>
|
||||||
|
Email:<br>
|
||||||
|
<a href="mailto:info@royalpay.com.au">info@royalpay.com.au</a> <br>
|
||||||
|
Tel:<br>
|
||||||
|
1300 10 77 50<br>
|
||||||
|
<br>
|
||||||
|
Service WeChat Account:<br>
|
||||||
|
<img src="https://mpay.royalpay.com.au/static/images/customer_service.jpg"
|
||||||
|
style="width: 60px"><br>
|
||||||
|
Level 14, 383 Kent Street, Sydney NSW 2000<br>
|
||||||
|
<br>
|
||||||
|
Level 11, 15 William Street, Melbourne VIC 3000
|
||||||
|
</p>
|
||||||
|
<p>Tunnel Show Pty Ltd trading as RoyalPay<br>
|
||||||
|
Representative of AFSL licensee 448066
|
||||||
|
</p>
|
||||||
|
</html>
|
@ -0,0 +1,190 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" user-scalable="no">
|
||||||
|
<meta name="description" content="">
|
||||||
|
<title>Risk Materials | Success</title>
|
||||||
|
<link href="static/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link href="static/lib/font-awesome-4.6.3/css/font-awesome.min.css" rel="stylesheet">
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="./static/css/index_register.css">
|
||||||
|
<link rel="stylesheet" href="static/lib/dist/css/AdminLTE.min.css">
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||||
|
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
|
||||||
|
<script type="text/javascript" src="/static/lib/jquery/jquery-2.1.4.min.js"></script>
|
||||||
|
<script type="text/javascript" src="/static/lib/angularjs/angular.min.js"></script>
|
||||||
|
<script type="text/javascript" src="/static/lib/angularjs/angular-messages.js"></script>
|
||||||
|
<script type="text/javascript" src="/static/lib/bootstrap/js/bootstrap.min.js"></script>
|
||||||
|
<script type="text/javascript" src="/static/lib/blocs.min.js"></script>
|
||||||
|
<script>
|
||||||
|
var _hmt = _hmt || [];
|
||||||
|
(function() {
|
||||||
|
var hm = document.createElement("script");
|
||||||
|
hm.src = "https://hm.baidu.com/hm.js?d7e727bd889ea69d369cba051844dfe5";
|
||||||
|
var s = document.getElementsByTagName("script")[0];
|
||||||
|
s.parentNode.insertBefore(hm, s);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body class="pace-done fp-viewing-0">
|
||||||
|
<!--[if lte IE 8]>
|
||||||
|
<span class="lower-ie"></span>
|
||||||
|
<![endif]-->
|
||||||
|
<div class="pace pace-inactive">
|
||||||
|
<div class="pace-progress" data-progress-text="100%" data-progress="99"
|
||||||
|
style="transform: translate3d(100%, 0px, 0px);">
|
||||||
|
<div class="pace-progress-inner"></div>
|
||||||
|
</div>
|
||||||
|
<div class="pace-activity"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="main">
|
||||||
|
<div id="page-index">
|
||||||
|
<nav id="header" class="navbar navbar-dark navbar-full navbar-fixed-top navbar-bg" style="position: absolute">
|
||||||
|
<div class="container">
|
||||||
|
<div class="navbar-header">
|
||||||
|
<button class="navbar-toggle collapsed" type="button" data-toggle="collapse"
|
||||||
|
data-target=".navbar-collapse">
|
||||||
|
<span class="sr-only">Toggle navigation</span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
</button>
|
||||||
|
<a class="navbar-brand" href="https://www.royalpay.com.au/">
|
||||||
|
<img src="static/css/img/logo_w.png" alt="" class="navbar--logo">
|
||||||
|
</a>
|
||||||
|
<span class="navbar-brand" style="margin-left: 10px;padding-left: 10px;border-left: 1px solid #fff;">
|
||||||
|
<img src="static/css/img/wechatpay.png" class="navbar--logo" style="transform: translateY(50%);height: 60%;">
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul class="nav navbar-nav navbar-right navbar-collapse collapse">
|
||||||
|
<li id="nav-index" class="nav-item">
|
||||||
|
<a href="https://www.royalpay.com.au/index.html" class="nav-link">Home</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item dropdown">
|
||||||
|
<a role="button" class="nav-link dropdown-toggle" data-toggle="dropdown">GATEWAY API</a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><a href="https://mpay.royalpay.com.au/docs/en/" target="_blank">En</a></li>
|
||||||
|
<li><a href="https://mpay.royalpay.com.au/docs/cn/" target="_blank">中文</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="https://www.royalpay.com.au/industry.html" class="nav-link">Industry</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="https://www.royalpay.com.au/marketing.html" class="nav-link">Marketing</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a role="button" class="nav-link dropdown-toggle" data-toggle="dropdown">About Us</a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><a href="https://www.royalpay.com.au/industry.html" target="_blank">About Us</a></li>
|
||||||
|
<li><a href="https://www.royalpay.com.au/c_news.html">News</a></li>
|
||||||
|
<li><a href="https://www.royalpay.com.au/c_career.html">Career</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="https://www.royalpay.com.au/download.html" class="nav-link">Downloads</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="https://mpay.royalpay.com.au/login.html" target="_blank" class="nav-link">Sign In</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
<div id="fullpage" class="fullpage-wrapper">
|
||||||
|
<section class="section section-industry"></section>
|
||||||
|
<section class="section section-two" style="padding-bottom: 50px;">
|
||||||
|
<div class="container">
|
||||||
|
<div class="container">
|
||||||
|
<!--<div class="row">-->
|
||||||
|
<!--<div class="col-sm-12">-->
|
||||||
|
<!--</div>-->
|
||||||
|
<!--</div>-->
|
||||||
|
<section class="content-header" style="text-align: center">
|
||||||
|
<img src="static/images/pay_success.png" style="width: 120px">
|
||||||
|
<h3>We have received your materials, our risk manager will review soon,</h3>
|
||||||
|
<h3>please wait for result.</h3>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<section class="section section-six fp-auto-height footer">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row margin-bottom">
|
||||||
|
<div class="col-md-4 footer-item">
|
||||||
|
CONTACT US
|
||||||
|
<hr>
|
||||||
|
Level 14<br>
|
||||||
|
383 Kent Street<br>
|
||||||
|
Sydney NSW 2000<br>
|
||||||
|
<br>
|
||||||
|
Level 11<br>
|
||||||
|
15 William Street<br>
|
||||||
|
Melbourne VIC 3000<br>
|
||||||
|
<br>
|
||||||
|
1300-10-77-50<br>
|
||||||
|
03 9448 8865<br>
|
||||||
|
info@royalpay.com.au
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4 sitemap footer-item">
|
||||||
|
SITE MAP
|
||||||
|
<hr>
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="col-xs-6">
|
||||||
|
<p><a href="/">RoyalPay</a></p>
|
||||||
|
<p><a href="https://mpay.royalpay.com.au/docs/en/">Gateway API</a></p>
|
||||||
|
<p><a href="https://www.royalpay.com.au/industry.html">Industry Solution</a></p>
|
||||||
|
<p><a href="https://www.royalpay.com.au/marketing.html">Marketing Service</a></p>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-6">
|
||||||
|
<p><a href="https://www.royalpay.com.au/about.html">About Us</a></p>
|
||||||
|
<p><a href="https://www.royalpay.com.au/c_news.html">News</a></p>
|
||||||
|
<p><a href="https://www.royalpay.com.au/c_career.html">Career</a></p>
|
||||||
|
<p><a href="https://www.royalpay.com.au/download.html">Downloads</a></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4 footer-item">
|
||||||
|
SUPPORT
|
||||||
|
<hr>
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="col-xs-6 qr-box">
|
||||||
|
<img src="static/css/img/qr_royalpay.png">
|
||||||
|
RoyalPay WeChat Official Account
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-6 qr-box">
|
||||||
|
<img src="static/css/img/qr_service.png">
|
||||||
|
Customer Service
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="copyright">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12 text-center">
|
||||||
|
© 2016 Tunnel Show Pty. Ltd. | Representative of AFSL licensee 448066
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="fp-nav" class="right"></div>
|
||||||
|
<div id="cli_dialog_div"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,201 @@
|
|||||||
|
// define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootSwitch', 'ngFileUpload'], function (angular) {
|
||||||
|
// 'use strict';
|
||||||
|
var app = angular.module('riskUploadApp',['ngFileUpload']);
|
||||||
|
app.controller('riskUploadCtrl', ['$scope','$http','Upload','$filter',function ($scope,$http,Upload,$filter) {
|
||||||
|
$scope.material={};
|
||||||
|
$scope.codeKey=document.getElementById('codeKey').value;
|
||||||
|
$scope.material.risk_id=document.getElementById('risk_id').value;
|
||||||
|
$scope.material.update_time=$filter('date')(new Date(), 'yyyy-MM-dd HH:mm:ss');
|
||||||
|
$scope.uploadFile1 = function (file) {
|
||||||
|
if (file != null) {
|
||||||
|
$scope.file1Progress = {value: 0};
|
||||||
|
Upload.upload({
|
||||||
|
url: '/attachment/riskFiles',
|
||||||
|
data: {file: file}
|
||||||
|
}).then(function (resp) {
|
||||||
|
delete $scope.file1Progress;
|
||||||
|
$scope.material.file1_url = resp.data.url;
|
||||||
|
}, function (resp) {
|
||||||
|
delete $scope.file1Progress;
|
||||||
|
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
||||||
|
}, function (evt) {
|
||||||
|
$scope.file1Progress.value = parseInt(100 * evt.loaded / evt.total);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$scope.uploadFile2 = function (file) {
|
||||||
|
if (file != null) {
|
||||||
|
$scope.file2Progress = {value: 0};
|
||||||
|
Upload.upload({
|
||||||
|
url: '/attachment/riskFiles',
|
||||||
|
data: {file: file}
|
||||||
|
}).then(function (resp) {
|
||||||
|
delete $scope.file2Progress;
|
||||||
|
$scope.material.file2_url = resp.data.url;
|
||||||
|
}, function (resp) {
|
||||||
|
delete $scope.file2Progress;
|
||||||
|
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
||||||
|
}, function (evt) {
|
||||||
|
$scope.file2Progress.value = parseInt(100 * evt.loaded / evt.total);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$scope.uploadFile3 = function (file) {
|
||||||
|
if (file != null) {
|
||||||
|
$scope.file3Progress = {value: 0};
|
||||||
|
Upload.upload({
|
||||||
|
url: '/attachment/riskFiles',
|
||||||
|
data: {file: file}
|
||||||
|
}).then(function (resp) {
|
||||||
|
delete $scope.file3Progress;
|
||||||
|
$scope.material.file3_url = resp.data.url;
|
||||||
|
}, function (resp) {
|
||||||
|
delete $scope.file3Progress;
|
||||||
|
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
||||||
|
}, function (evt) {
|
||||||
|
$scope.file3Progress.value = parseInt(100 * evt.loaded / evt.total);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$scope.uploadFile4 = function (file) {
|
||||||
|
if (file != null) {
|
||||||
|
$scope.file4Progress = {value: 0};
|
||||||
|
Upload.upload({
|
||||||
|
url: '/attachment/riskFiles',
|
||||||
|
data: {file: file}
|
||||||
|
}).then(function (resp) {
|
||||||
|
delete $scope.file4Progress;
|
||||||
|
$scope.material.file4_url = resp.data.url;
|
||||||
|
}, function (resp) {
|
||||||
|
delete $scope.file4Progress;
|
||||||
|
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
||||||
|
}, function (evt) {
|
||||||
|
$scope.file4Progress.value = parseInt(100 * evt.loaded / evt.total);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.uploadFile5 = function (file) {
|
||||||
|
if (file != null) {
|
||||||
|
$scope.file5Progress = {value: 0};
|
||||||
|
Upload.upload({
|
||||||
|
url: '/attachment/riskFiles',
|
||||||
|
data: {file: file}
|
||||||
|
}).then(function (resp) {
|
||||||
|
delete $scope.file5Progress;
|
||||||
|
$scope.material.file5_url = resp.data.url;
|
||||||
|
}, function (resp) {
|
||||||
|
delete $scope.file5Progress;
|
||||||
|
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
||||||
|
}, function (evt) {
|
||||||
|
$scope.file5Progress.value = parseInt(100 * evt.loaded / evt.total);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.uploadFile6 = function (file) {
|
||||||
|
if (file != null) {
|
||||||
|
$scope.file6Progress = {value: 0};
|
||||||
|
Upload.upload({
|
||||||
|
url: '/attachment/riskFiles',
|
||||||
|
data: {file: file}
|
||||||
|
}).then(function (resp) {
|
||||||
|
delete $scope.file6Progress;
|
||||||
|
$scope.material.file6_url = resp.data.url;
|
||||||
|
}, function (resp) {
|
||||||
|
delete $scope.file6Progress;
|
||||||
|
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
||||||
|
}, function (evt) {
|
||||||
|
$scope.file6Progress.value = parseInt(100 * evt.loaded / evt.total);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.uploadFile7 = function (file) {
|
||||||
|
if (file != null) {
|
||||||
|
$scope.file7Progress = {value: 0};
|
||||||
|
Upload.upload({
|
||||||
|
url: '/attachment/riskFiles',
|
||||||
|
data: {file: file}
|
||||||
|
}).then(function (resp) {
|
||||||
|
delete $scope.file7Progress;
|
||||||
|
$scope.material.file7_url = resp.data.url;
|
||||||
|
}, function (resp) {
|
||||||
|
delete $scope.file7Progress;
|
||||||
|
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
||||||
|
}, function (evt) {
|
||||||
|
$scope.file7Progress.value = parseInt(100 * evt.loaded / evt.total);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$scope.uploadFile8 = function (file) {
|
||||||
|
if (file != null) {
|
||||||
|
$scope.file8Progress = {value: 0};
|
||||||
|
Upload.upload({
|
||||||
|
url: '/attachment/riskFiles',
|
||||||
|
data: {file: file}
|
||||||
|
}).then(function (resp) {
|
||||||
|
delete $scope.file8Progress;
|
||||||
|
$scope.material.file8_url = resp.data.url;
|
||||||
|
}, function (resp) {
|
||||||
|
delete $scope.file8Progress;
|
||||||
|
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
||||||
|
}, function (evt) {
|
||||||
|
$scope.file8Progress.value = parseInt(100 * evt.loaded / evt.total);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$scope.uploadFile9 = function (file) {
|
||||||
|
if (file != null) {
|
||||||
|
$scope.file9Progress = {value: 0};
|
||||||
|
Upload.upload({
|
||||||
|
url: '/attachment/riskFiles',
|
||||||
|
data: {file: file}
|
||||||
|
}).then(function (resp) {
|
||||||
|
delete $scope.file9Progress;
|
||||||
|
$scope.material.file9_url = resp.data.url;
|
||||||
|
}, function (resp) {
|
||||||
|
delete $scope.file9Progress;
|
||||||
|
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
||||||
|
}, function (evt) {
|
||||||
|
$scope.file9Progress.value = parseInt(100 * evt.loaded / evt.total);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$scope.uploadFile10 = function (file) {
|
||||||
|
if (file != null) {
|
||||||
|
$scope.file10Progress = {value: 0};
|
||||||
|
Upload.upload({
|
||||||
|
url: '/attachment/riskFiles',
|
||||||
|
data: {file: file}
|
||||||
|
}).then(function (resp) {
|
||||||
|
delete $scope.file10Progress;
|
||||||
|
$scope.material.file10_url = resp.data.url;
|
||||||
|
}, function (resp) {
|
||||||
|
delete $scope.file10Progress;
|
||||||
|
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
||||||
|
}, function (evt) {
|
||||||
|
$scope.file10Progress.value = parseInt(100 * evt.loaded / evt.total);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$scope.submit = function (form) {
|
||||||
|
$http.post('/risk/upload/'+$scope.codeKey, $scope.material).then(function (resp) {
|
||||||
|
// commonDialog.alert({title: 'Success', content: 'Submit successfully', type: 'success'});
|
||||||
|
alert('Submit successfully');
|
||||||
|
window.location.href="/risk_upload_success.html";
|
||||||
|
}, function (resp) {
|
||||||
|
alert('Submit failed');
|
||||||
|
// commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// return app;
|
||||||
|
//
|
||||||
|
// })
|
||||||
|
|
||||||
|
|
Loading…
Reference in new issue