From ccbd5a9c3ab605d26c52d981fd23cd9065c69f9a Mon Sep 17 00:00:00 2001 From: "james.zhao" Date: Mon, 15 Oct 2018 17:39:06 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A3=8E=E6=8E=A7=E9=82=AE=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/mappers/payment/OrderMapper.java | 2 + .../riskbusiness/RiskMaterialMapper.java | 3 + .../manage/notice/core/MailService.java | 2 + .../notice/core/impls/MailServiceImp.java | 34 ++ .../core/RiskBusinessService.java | 13 + .../riskbusiness/core/RiskUploadService.java | 24 + .../core/impl/RiskBusinessServiceImpl.java | 133 +++++- .../core/impl/RiskUploadServiceIpml.java | 95 ++++ .../web/RiskBusinessController.java | 19 +- .../web/RiskFileUploadController.java | 42 ++ .../attachment/web/AttachmentController.java | 4 + .../manage/mappers/payment/OrderMapper.xml | 77 +++- .../riskbusiness/RiskMaterialMapper.xml | 14 + .../templates/mail/risk_operator_notice.html | 24 + .../resources/templates/mail/risk_upload.html | 434 ++++++++++++++++++ .../templates/mail/risk_upload_mail.html | 53 +++ src/main/ui/risk_upload_success.html | 190 ++++++++ src/main/ui/static/analysis/risk_business.js | 15 +- .../analysis/templates/riskEvent_detail.html | 4 +- src/main/ui/static/riskupload/risk_upload.js | 201 ++++++++ 20 files changed, 1372 insertions(+), 11 deletions(-) create mode 100644 src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/RiskUploadService.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/impl/RiskUploadServiceIpml.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/riskbusiness/web/RiskFileUploadController.java create mode 100644 src/main/resources/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.xml create mode 100644 src/main/resources/templates/mail/risk_operator_notice.html create mode 100644 src/main/resources/templates/mail/risk_upload.html create mode 100644 src/main/resources/templates/mail/risk_upload_mail.html create mode 100644 src/main/ui/risk_upload_success.html create mode 100644 src/main/ui/static/riskupload/risk_upload.js diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.java index 7c351ef10..085df36ac 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.java @@ -79,4 +79,6 @@ public interface OrderMapper { List listAnalysisClientCustomer(JSONObject params); PageList listTransactionsForApp(JSONObject params, PageBounds pageBounds); + + JSONObject findOrderById(@Param("order_id") String orderId); } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.java index 90080f13d..4fed8604f 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.java @@ -4,9 +4,12 @@ import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper; import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; import cn.yixblog.support.mybatis.autosql.annotations.SqlType; import com.alibaba.fastjson.JSONObject; +import org.apache.ibatis.annotations.Param; @AutoMapper(tablename = "risk_material", pkName = "material_id") public interface RiskMaterialMapper { @AutoSql(type = SqlType.INSERT) void save(JSONObject material); + + JSONObject findOperatorById(@Param("risk_id") String risk_id); } diff --git a/src/main/java/au/com/royalpay/payment/manage/notice/core/MailService.java b/src/main/java/au/com/royalpay/payment/manage/notice/core/MailService.java index 3044b09fc..8291074da 100644 --- a/src/main/java/au/com/royalpay/payment/manage/notice/core/MailService.java +++ b/src/main/java/au/com/royalpay/payment/manage/notice/core/MailService.java @@ -17,6 +17,8 @@ public interface MailService { String sendEmail(String title, String mailTos, String mailCcs, String content, List attachFiles) throws URISyntaxException, IOException; + String sendRiskEmail(String title, String mailTos, String mailCcs, String content, int order_type) throws URISyntaxException, IOException; + List checkEmailStatus(String emailId); void removeUnsub(Long id); diff --git a/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/MailServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/MailServiceImp.java index 63a1ed1db..2892391de 100644 --- a/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/MailServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/MailServiceImp.java @@ -266,4 +266,38 @@ public class MailServiceImp implements MailService { } } + @Override + public String sendRiskEmail(String title, String mailTos, String mailCcs, String content, int order_type) throws URISyntaxException, IOException { + NoticeBean noticeBean = new NoticeBean(); + noticeBean.setTitle(title); + List mailClients = new ArrayList<>(); + JSONObject mailClient = new JSONObject(); + mailClient.put("mailto", mailTos); + mailClient.put("mailcc", mailCcs); + mailClients.add(mailClient); + noticeBean.setMailClients(mailClients); + noticeBean.setContent(content); + noticeBean.setSenderAddress("riskcontrol@royalpay.com.au"); + noticeBean.setPassword("RPrisk123"); + if(order_type == 1 || order_type == 2){ + noticeBean.setSenderAddress("risk@royalpay.com.au"); + noticeBean.setPassword("Tunnelrisk123"); + } + String postUrl = mailHost + "/mail/single?" + generateMailSignParam(); + HttpRequestResult result = null; + try { + logger.info("===sendEmail===noticeBean:" + JSON.toJSON(noticeBean)); + result = new HttpRequestGenerator(postUrl, RequestMethod.POST).setJSONEntity(noticeBean).setTimeout(60_000).execute(); + if (result.isSuccess()) { + String mail_id = result.getResponseContentJSONObj().getString("mail_id"); + return mail_id; + //System.out.println("send Mail=============="+mail_id); + } else { + throw new ServerErrorException("Error Connection"); + } + } catch (URISyntaxException e) { + throw new ServerErrorException("Error Connection"); + } + } + } diff --git a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/RiskBusinessService.java b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/RiskBusinessService.java index 63c011a69..898aa9dee 100644 --- a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/RiskBusinessService.java +++ b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/RiskBusinessService.java @@ -57,4 +57,17 @@ public interface RiskBusinessService { * @param riskId */ void downloadAuditMaterialZiP(String riskId, HttpServletResponse response); + + /** + * 发送上传材料的邮件 + * @param riskId + */ + void sendUploadEmail(String riskId); + + /** + * 发送拒绝邮件 + * @param riskId + */ + void sendRefuseEmail(String riskId); + } diff --git a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/RiskUploadService.java b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/RiskUploadService.java new file mode 100644 index 000000000..33cc158b2 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/RiskUploadService.java @@ -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); +} diff --git a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/impl/RiskBusinessServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/impl/RiskBusinessServiceImpl.java index c88d23c00..739b70d2f 100644 --- a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/impl/RiskBusinessServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/impl/RiskBusinessServiceImpl.java @@ -1,18 +1,30 @@ package au.com.royalpay.payment.manage.riskbusiness.core.impl; +import au.com.royalpay.payment.core.exceptions.EmailException; import au.com.royalpay.payment.core.exceptions.InvalidShortIdException; import au.com.royalpay.payment.manage.mappers.payment.OrderMapper; import au.com.royalpay.payment.manage.mappers.riskbusiness.RiskEventMapper; import au.com.royalpay.payment.manage.mappers.system.ClientMapper; +import au.com.royalpay.payment.manage.mappers.system.ClientBDMapper; +import au.com.royalpay.payment.manage.notice.core.MailService; import au.com.royalpay.payment.manage.riskbusiness.core.RiskBusinessService; +import au.com.royalpay.payment.tools.env.PlatformEnvironment; +import au.com.royalpay.payment.tools.exceptions.BadRequestException; +import au.com.royalpay.payment.tools.threadpool.RoyalThreadPoolExecutor; import au.com.royalpay.payment.tools.utils.PageListUtils; import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageList; +import org.apache.commons.lang3.RandomStringUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateFormatUtils; +import org.apache.commons.lang3.time.DateUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Service; +import org.thymeleaf.context.Context; +import org.thymeleaf.spring4.SpringTemplateEngine; import javax.servlet.http.HttpServletResponse; import java.io.IOException; @@ -20,9 +32,13 @@ import java.io.InputStream; import java.net.URL; import java.util.ArrayList; import java.util.Date; +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.Date; import java.util.List; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; +import java.util.concurrent.TimeUnit; /** * @Author lvjian @@ -31,14 +47,23 @@ import java.util.zip.ZipOutputStream; @Service public class RiskBusinessServiceImpl implements RiskBusinessService { - @Autowired + @Resource private RiskEventMapper riskEventMapper; - - @Autowired - private OrderMapper orderMapper; - - @Autowired + @Resource private ClientMapper clientMapper; + @Resource + private ClientBDMapper clientBDMapper; + @Resource + private OrderMapper orderMapper; + @Resource + private StringRedisTemplate stringRedisTemplate; + @Resource + private SpringTemplateEngine thymeleaf; + @Resource + private MailService mailService; + @Resource + private RoyalThreadPoolExecutor royalThreadPoolExecutor; + private final String UPLOAD_MAIL_PREFIX = "UPLOAD_MAIL"; @Override public List getRiskEvents(JSONObject params) { @@ -87,6 +112,13 @@ public class RiskBusinessServiceImpl implements RiskBusinessService { @Override public void addRiskEvent(JSONObject params) { + JSONObject client = clientMapper.findClientByMoniker(params.getString("client_moniker")); + if(client == null){ + throw new InvalidShortIdException(); + } + if(client.containsKey("sub_merchant_id")){ + params.put("sub_merchant_id",client.getString("sub_merchant_id")); + } riskEventMapper.save(params); } @@ -123,4 +155,93 @@ public class RiskBusinessServiceImpl implements RiskBusinessService { e.printStackTrace(); } } + + @Override + public void sendUploadEmail(String riskId) { + JSONObject event = getRiskEventDetail(riskId); + Context ctx = getMailContext(event); + final List emails = (List)ctx.getVariable("emails"); + final String content = thymeleaf.process("mail/risk_upload_mail.html", ctx); + royalThreadPoolExecutor.execute(() -> { + try { + String emailId = mailService.sendRiskEmail("Your merchants needs to submit risk materials", emails.isEmpty() ? "" : StringUtils.join(emails, ","), + "", content, event.getIntValue("order_type")); + event.put("email_status",1); + event.put("result_type",1); + riskEventMapper.update(event); + } catch (Exception e) { + throw new EmailException("Email Sending Failed", e); + } + }); + } + + @Override + public void sendRefuseEmail(String riskId) { + JSONObject event = getRiskEventDetail(riskId); + Context ctx = getMailContext(event); + ctx.setVariable("refuse",true); + final List emails = (List)ctx.getVariable("emails"); + final String content = thymeleaf.process("mail/risk_upload_mail.html", ctx); + royalThreadPoolExecutor.execute(() -> { + try { + String emailId = mailService.sendRiskEmail("Your merchants needs to resubmit risk materials", emails.isEmpty() ? "" : StringUtils.join(emails, ","), + "", content, event.getIntValue("order_type")); + event.put("email_status",2); + event.put("result_type",4); + riskEventMapper.update(event); + } catch (Exception e) { + throw new EmailException("Email Sending Failed", e); + } + }); + } + + private Context getMailContext(JSONObject event){ + JSONObject client = clientMapper.findClientByMonikerAll(event.getString("client_moniker")); + if (client == null) { + throw new InvalidShortIdException(); + } + String codeKey = RandomStringUtils.random(20, true, true); + while(stringRedisTemplate.boundValueOps(getRiskUploadKey(codeKey)).get()!=null ){ + codeKey = RandomStringUtils.random(20, true, true); + } + String codeKeyValue = RandomStringUtils.random(10, true, true); + String expireDay = "7"; + stringRedisTemplate.boundValueOps(getRiskUploadKey(codeKey)).set(codeKeyValue, Long.parseLong(expireDay), TimeUnit.DAYS); + String uploadUrl = PlatformEnvironment.getEnv().concatUrl("/risk/upload/") + event.getString("risk_id") + "/" + codeKey; + List bds = clientBDMapper.listClientBDInfoAvailable(client.getIntValue("client_id"), new Date()); + List bdNames = new ArrayList<>(); + List emails = new ArrayList<>(); + for (JSONObject bd : bds) { + String bdName = bd.getString("display_name"); + if (StringUtils.isNotEmpty(bdName)) { + bdNames.add(bdName); + } + String email = bd.getString("email"); + if (StringUtils.isNotEmpty(email)) { + emails.add(email); + } + } + String bdNamesStr = bdNames.isEmpty() ? "" : StringUtils.join(bdNames, ","); + String reply_date = DateFormatUtils.format(DateUtils.addDays(event.getDate("reply_email_date"),-1),"yyyy年MM月dd日"); + String[] orderIds = event.getString("order_ids").split(","); + List orders = new ArrayList(); + for(String orderId : orderIds){ + JSONObject order = orderMapper.findOrderById(orderId); + if(order==null){ + throw new BadRequestException("Order: "+orderId+" not exists"); + } + orders.add(order); + } + Context ctx = new Context(); + ctx.setVariable("bdNamesStr", bdNamesStr); + ctx.setVariable("reply_date", reply_date); + ctx.setVariable("orders", orders); + ctx.setVariable("client", client); + ctx.setVariable("uploadUrl", uploadUrl); + ctx.setVariable("emails", emails); + return ctx; + } + private String getRiskUploadKey(String codeKey){ + return UPLOAD_MAIL_PREFIX + codeKey; + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/impl/RiskUploadServiceIpml.java b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/impl/RiskUploadServiceIpml.java new file mode 100644 index 000000000..b5aaa04a0 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/impl/RiskUploadServiceIpml.java @@ -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; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/web/RiskBusinessController.java b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/web/RiskBusinessController.java index 8ed299654..90c03da5f 100644 --- a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/web/RiskBusinessController.java +++ b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/web/RiskBusinessController.java @@ -10,6 +10,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; import java.util.List; /** @@ -18,7 +22,8 @@ import java.util.List; * @Date 2018/10/10 1:12 */ @RestController -@ManagerMapping(value = "/risk/business/", role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) +//@ManagerMapping(value = "/risk/business/", role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) +@RequestMapping(value = "/risk/business/") public class RiskBusinessController { @Autowired @@ -42,6 +47,7 @@ public class RiskBusinessController { @PostMapping(value = "events") public void RegisterRiskEvent(@RequestBody JSONObject params, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + params.put("fillin_id", manager.getString("manager_id")); params.put("fillin_person", manager.getString("display_name")); riskBusinessService.addRiskEvent(params); } @@ -55,5 +61,16 @@ public class RiskBusinessController { public void downloadComplianceZip(@PathVariable("risk_id") String riskId, HttpServletResponse response) throws Exception { riskBusinessService.downloadAuditMaterialZiP(riskId, response); } + + + @RequestMapping(value = "/{risk_id}/upload_mail",method = RequestMethod.PUT) + public void uploadEmail(@PathVariable String risk_id) { + riskBusinessService.sendUploadEmail(risk_id); + } + + @RequestMapping(value = "/{risk_id}/refuse",method = RequestMethod.PUT) + public void refuseEmail(@PathVariable String risk_id) { + riskBusinessService.sendRefuseEmail(risk_id); + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/web/RiskFileUploadController.java b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/web/RiskFileUploadController.java new file mode 100644 index 000000000..b60ab662f --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/web/RiskFileUploadController.java @@ -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); + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/support/attachment/web/AttachmentController.java b/src/main/java/au/com/royalpay/payment/manage/support/attachment/web/AttachmentController.java index 34a8f2907..bccc665f9 100644 --- a/src/main/java/au/com/royalpay/payment/manage/support/attachment/web/AttachmentController.java +++ b/src/main/java/au/com/royalpay/payment/manage/support/attachment/web/AttachmentController.java @@ -27,6 +27,10 @@ public class AttachmentController { public JSONObject uploadImage(@RequestParam MultipartFile file) throws IOException { return attachmentClient.uploadFile(file,false); } + @RequestMapping(value = "/riskFiles", method = RequestMethod.POST) + public JSONObject uploadRiskImage(@RequestParam MultipartFile file) throws IOException { + return attachmentClient.uploadFile(file,false); + } @RequestMapping(value = "/secret_files", method = RequestMethod.POST) @RequirePartner diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml index 2b0482c19..0ac8982e1 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml @@ -738,5 +738,80 @@ and t.clearing_status=#{clearing_status} + - \ No newline at end of file + diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.xml new file mode 100644 index 000000000..5179b5180 --- /dev/null +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.xml @@ -0,0 +1,14 @@ + + + + + diff --git a/src/main/resources/templates/mail/risk_operator_notice.html b/src/main/resources/templates/mail/risk_operator_notice.html new file mode 100644 index 000000000..d38f3b17f --- /dev/null +++ b/src/main/resources/templates/mail/risk_operator_notice.html @@ -0,0 +1,24 @@ + +

Dear :

+

您好,您于创建的风控事件单已经接收到了商户()的风控材料,请及时审核。

+

Best Regards

+

+
+ Contact Us
+ Email:
+ info@royalpay.com.au
+ Tel:
+ 1300 10 77 50
+
+ Service WeChat Account:
+
+ Level 14, 383 Kent Street, Sydney NSW 2000
+
+ Level 11, 15 William Street, Melbourne VIC 3000 +

+

Tunnel Show Pty Ltd trading as RoyalPay
+ Representative of AFSL licensee 448066 +

+ diff --git a/src/main/resources/templates/mail/risk_upload.html b/src/main/resources/templates/mail/risk_upload.html new file mode 100644 index 000000000..82ecf6c13 --- /dev/null +++ b/src/main/resources/templates/mail/risk_upload.html @@ -0,0 +1,434 @@ + + + + + + + RoyalPay | Risk Materials + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+ +
+
+ +
+
+
+ +

Image size should not exceed 3MB

+
+
+
+
+ +
+
+ +
+ + +
+ +
+
+ +
+ + +
+
+ +
+ +
+
+ +
+ + +
+ +
+
+ +
+ + +
+
+ +
+ +
+
+ +
+ + +
+ +
+
+ +
+ + +
+
+ +
+ +
+
+ +
+ + +
+ +
+
+ +
+ + +
+
+ +
+ +
+
+ +
+ + +
+ +
+
+ +
+ + +
+
+
+ +
+ + + +
+ +
+
+
+
+ +
+ Submit +
+ +
+
+ + +
+ +
+
+ + +
+
+ + diff --git a/src/main/resources/templates/mail/risk_upload_mail.html b/src/main/resources/templates/mail/risk_upload_mail.html new file mode 100644 index 000000000..3939e6cc5 --- /dev/null +++ b/src/main/resources/templates/mail/risk_upload_mail.html @@ -0,0 +1,53 @@ + +

Dear :

+

您好,您提交的风控材料已被拒绝。请于下午6:00(悉尼时间)前提供被查商户 ()的以下材料

+

请提供以下被查单号的小票, 物流单据(如有邮寄产品的情况), 以及消费者与买家的聊天记录等来佐证被查交易单号。 被查交易单号如下:

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Order IDAmountInput AmountAUD AmountExchange RateStatusCreate TimeGateway
+

请点击此链接上传所需材料

+

如果提交的材料不齐, 则有关停支付的风险。还请按时提供商户材料并直接回复该邮件, 感谢,辛苦。

+

Best Regards

+

+
+ Contact Us
+ Email:
+ info@royalpay.com.au
+ Tel:
+ 1300 10 77 50
+
+ Service WeChat Account:
+
+ Level 14, 383 Kent Street, Sydney NSW 2000
+
+ Level 11, 15 William Street, Melbourne VIC 3000 +

+

Tunnel Show Pty Ltd trading as RoyalPay
+ Representative of AFSL licensee 448066 +

+ diff --git a/src/main/ui/risk_upload_success.html b/src/main/ui/risk_upload_success.html new file mode 100644 index 000000000..c596999f8 --- /dev/null +++ b/src/main/ui/risk_upload_success.html @@ -0,0 +1,190 @@ + + + + + + + + Risk Materials | Success + + + + + + + + + + + + + + + + +
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+ + + + +
+ +

We have received your materials, our risk manager will review soon,

+

please wait for result.

+
+ +
+
+
+ +
+
+
+ +
+
+ + diff --git a/src/main/ui/static/analysis/risk_business.js b/src/main/ui/static/analysis/risk_business.js index b09684270..24e7de473 100644 --- a/src/main/ui/static/analysis/risk_business.js +++ b/src/main/ui/static/analysis/risk_business.js @@ -23,7 +23,8 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], var emailStatusMap = { "0": "未发送", - "1": "已发送" + "1": "已发送", + "2": "打回并已发送" }; var app = angular.module('riskBusinessApp', ['ui.router']); @@ -173,6 +174,18 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], $scope.loadRiskEventDetail = function(riskId) { $http.get('/risk/business/events/' + riskId) } + $scope.resendUploadEmail = function () { + commonDialog.confirm({ + title: 'Warning', + content: 'Please confirm sending mail.' + }).then(function () { + $http.put('/risk/business/' + $scope.riskEvent.risk_id + '/upload_mail').then(function () { + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + }) + }; } ]); diff --git a/src/main/ui/static/analysis/templates/riskEvent_detail.html b/src/main/ui/static/analysis/templates/riskEvent_detail.html index 5461723fc..4ee3fefb2 100644 --- a/src/main/ui/static/analysis/templates/riskEvent_detail.html +++ b/src/main/ui/static/analysis/templates/riskEvent_detail.html @@ -160,7 +160,7 @@ Send Email + class="btn btn-info" ng-click="resendUploadEmail()">Send Email @@ -303,4 +303,4 @@ - \ No newline at end of file + diff --git a/src/main/ui/static/riskupload/risk_upload.js b/src/main/ui/static/riskupload/risk_upload.js new file mode 100644 index 000000000..8398b10e9 --- /dev/null +++ b/src/main/ui/static/riskupload/risk_upload.js @@ -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; +// +// }) + +