Merge remote-tracking branch 'origin/develop' into develop

master
james.zhao 6 years ago
commit 224ea3c64f

@ -0,0 +1,66 @@
package au.com.royalpay.payment.manage.dev.web;
import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
import au.com.royalpay.payment.manage.support.wechatclients.RedpackWechatApiImpl;
import au.com.royalpay.payment.tools.connections.mpsupport.beans.WxOauthType;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.permission.wechat.WechatMapping;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.globalfreepay.payment.tools.CommonConsts;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.List;
@Controller
@WechatMapping(value = "/testMerchantPassword", addonMp = {RedpackWechatApiImpl.class}, oauthType = WxOauthType.USERINFO)
public class TestMerchantPassword {
private Logger logger = LoggerFactory.getLogger(getClass());
@Resource
private ManagerMapper managerMapper;
@WechatMapping(method = RequestMethod.GET)
public String testMerchantPassword(@RequestParam String[] accounts, @ModelAttribute(CommonConsts.WECHATINFO) JSONObject wxUser, Model modelMap) {
if (accounts == null) {
return null;
}
List<String> openIds = managerMapper.listDevAndBdOpenId();
if (!openIds.contains(wxUser.getString("openid"))) {
throw new ForbiddenException("无权限查看此页面");
}
JSONArray array = new JSONArray();
for (String account : accounts) {
try {
String accountDe = URLDecoder.decode(account, "UTF-8");
JSONObject accountJson = new JSONObject();
String temp[] = accountDe.split(",");
accountJson.put("username", temp[0]);
accountJson.put("password", temp[1]);
accountJson.put("role", temp[2]);
accountJson.put("client_moniker", temp[3]);
array.add(accountJson);
} catch (UnsupportedEncodingException e) {
logger.error("获取临时密码失败转换url错误 " + e);
}
}
modelMap.addAttribute("accounts", array);
return "testMerchantPassword";
}
}

@ -65,6 +65,9 @@ public interface ManagerMapper {
List<JSONObject> listServants(@Param("mask") int mask);
@Select("select email from sys_managers where is_valid=1 AND role & 256 > 0 AND email IS NOT NULL")
List<String> listDevManager();
@Select("select email from sys_managers where is_valid=1 AND (role & 256 > 0 OR role & 4 > 0) AND email IS NOT NULL")
List<String> listDevAndBdManager();
@Select("select wx_openid from sys_managers where is_valid=1 AND (role & 256 > 0 OR role & 4 > 0) AND wx_openid IS NOT NULL")
List<String> listDevAndBdOpenId();
}

@ -4443,17 +4443,56 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
private void sendTestMerchantPassword(List<JSONObject> accounts, List<String> emails) {
List<String> devAndBdEmails = managerMapper.listDevAndBdManager();
for(int i=0;i<devAndBdEmails.size();i++){
if(StringUtils.isBlank(devAndBdEmails.get(i)))
devAndBdEmails.remove(i);
}
Context ctx = new Context();
ctx.setVariable("accounts", accounts);
final String content = thymeleaf.process( "mail/test_merchant_password", ctx);
new Thread(() -> {
try {
mailService.sendEmail("测试商户账户已更新", emails.isEmpty() ? "" : StringUtils.join(emails, ","), "", content);
mailService.sendEmail("测试商户账户已更新", emails.isEmpty() ? "" : StringUtils.join(emails, ","), devAndBdEmails.isEmpty() ? "" : StringUtils.join(devAndBdEmails, ","), content);
} catch (Exception ignored) {
logger.error("邮件发送失败", ignored);
throw new BadRequestException("邮件发送失败");
}
}).start();
StringBuffer accountsStr = new StringBuffer("?");
accounts.forEach(e->{
accountsStr.append("accounts=" + e.getString("username") + ","
+ e.getString("password") + "," + e.getIntValue("role") + "," + e.getString("client_moniker") + "&");
});
String account = accountsStr.substring(0, accountsStr.length() - 1);
List<String> wx_openIds = managerMapper.listDevAndBdOpenId();
for (String wxopenid : wx_openIds) {
if (StringUtils.isNotBlank(wxopenid)) {
try {
MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi();
TemplateMessage msg = initSendTestPasswordTemplate(wxopenid, paymentApi.getTemplateId("test-merchant-password"), account);
paymentApi.sendTemplateMessage(msg);
} catch (WechatException e) {
logger.error("Wechat Message Error,密码修改完成" + e.getMessage());
publisher.publishEvent(new WechatExceptionEvent(this, e, "测试商户密码修改完成"));
}
}
}
}
private TemplateMessage initSendTestPasswordTemplate(String wxopenid, String templateId,String url) {
TemplateMessage msg = new TemplateMessage(wxopenid, templateId, "https://mpay.royalpay.com.au/testMerchantPassword" + url);
msg.put("first", "尊敬的用户,该商户下账号密码已重置。", "#000000");
msg.put("keyword1", "PINE", "#0000ff");
msg.put("keyword2", "账号密码重置", "#000000");
msg.put("keyword3", DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss,z"), "#000000");
msg.put("remark", "点击查看", "#0000FF");
return msg;
}
private String getCBBankShortLink(String longUrl) {

@ -252,7 +252,10 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
if (client != null && StringUtils.isNotBlank(realOrderIds)) {
String[] orderIdArray = realOrderIds.trim().split(",");
JSONObject orderInfo = new JSONObject();
// 获取订单信息
/**
*
*
*/
if (riskEvent.getIntValue("order_type") == 3) {
for (int i = 0; i < orderIdArray.length; i++) {
orderInfo = tradeLogService.getOrderDetail(new JSONObject(), riskEvent.getString("client_moniker"), orderIdArray[i], null);
@ -320,6 +323,14 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
}
return params;
}
/**
*
* risk_orders
*
* @param params
* @param manager
*/
@Override
public void addRiskEvent(JSONObject params, JSONObject manager) {
params = getEvent(params);
@ -357,6 +368,11 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
setRiskOrders(params);
}
/**
*
* @param riskId
* @param response
*/
@Override
public void downloadAuditMaterialZiP(String riskId, HttpServletResponse response) {
@ -371,9 +387,9 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + downloadFilename);
ZipOutputStream zos = new ZipOutputStream(response.getOutputStream());
for(int i=1;i<=6;i++){
if(riskMaterial.containsKey("file"+i)){
List<String> fileList= (List<String>)riskMaterial.get("file"+i);
for(int i = 1; i <= 6; i++){
if(riskMaterial.containsKey("file" + i)){
List<String> fileList= (List<String>) riskMaterial.get("file"+i);
for(String fileUrl : fileList){
zos.putNextEntry(new ZipEntry("file" + i+fileUrl.substring(fileUrl.lastIndexOf("/"))));
InputStream inputStream = new URL(fileUrl).openConnection().getInputStream();
@ -393,6 +409,14 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
}
}
/**
*
*
*
* App
* @param riskId
* @throws IOException
*/
@Override
public void sendUploadEmail(String riskId) throws IOException {
JSONObject event = getRiskEventDetail(riskId);
@ -433,6 +457,11 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
});
}
/**
* App
* risk
* @param event
*/
private void sendAppRiskMessage(JSONObject event){
JSONObject client = clientMapper.findClientByMoniker(event.getString("client_moniker"));
logger.debug("sendRiskAppMessage-" + client.getString("client_moniker") + "-" + "risk_id:"+event.getString("risk_id"));
@ -477,6 +506,15 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
}
}
/**
*
* @param dev_id
* @param client_id
* @param messageType
* @param dev_token
* @param remark
* @return
*/
private JSONObject saveAppMessageLog(String dev_id, int client_id, String messageType, String dev_token, String remark) {
JSONObject log = new JSONObject();
log.put("dev_id", dev_id);
@ -490,6 +528,15 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
}
/**
*
*
*
*
* @param riskId
* @param refuseDescription
* @throws IOException
*/
@Transactional
@Override
public void sendRefuseEmail(String riskId, String refuseDescription) throws IOException {
@ -518,7 +565,6 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
event.put("result_type",RiskResultTypeEnum.MATERIAL_NOT_PASS.getResultType());
event.put("submit_url",uploadUrl);
riskEventMapper.update(event);
// 日志记录
riskProcessLogService.addRiskProcessLog(riskId,
event.getString("fillin_id"),
event.getString("fillin_person"),
@ -531,6 +577,11 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
});
}
/**
*
* @param riskId
* @throws IOException
*/
@Override
public void sendUrgeEmail(String riskId) throws IOException {
JSONObject event = getRiskEventDetail(riskId);
@ -614,14 +665,47 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
List<JSONObject> orders = new ArrayList();
int isSendClient = event.getIntValue("is_send_client");
ctx.setVariable("emailsTos", bdEmails);
// 内部调单需要密送的人
List<String> emailsBccs = new ArrayList<>(Arrays.asList(
"locky@royalpay.com.au ", "leo.huang@royalpay.com.au",
"mona.zhang@royalpay.com.au", "weixinfengkong@royalpay.com.au", "thomas.li@royalpay.com.au"
));
/**
*
* bd
* bdemailsBccs
*
*
* "18852852189@163.com"
*
* Arrays.asList("18852852189@139.com", "1370256381@qq.com")debug
*/
if (isSendClient == 1) {
ctx.setVariable("emailsTos", clientEmails);
ctx.setVariable("emailsCcs", bdEmails);
if (orderType == RiskOrderTypeEnum.ROYALPAY_ORDER.getOrderType().intValue()) {
ctx.setVariable("emailsBccs", Arrays.asList(
// "locky@royalpay.com.au ", "zoe.tao@royalpay.com.au", "leo.huang@royalpay.com.au",
// "mona.zhang@royalpay.com.au", "weixinfengkong@royalpay.com.au", "thomas.li@royalpay.com.au"
"18852852189@139.com", "1370256381@qq.com"
ctx.setVariable("emailsCcs", null);
if (PlatformEnvironment.getEnv().isDebug()) {
emailsBccs = new ArrayList<>(Arrays.asList(
"18852852189@139.com", "1370256381@qq.com"
));
}
emailsBccs.addAll(bdEmails);
ctx.setVariable("emailsBccs", emailsBccs);
}
} else {
if (orderType == RiskOrderTypeEnum.ROYALPAY_ORDER.getOrderType().intValue()) {
if (PlatformEnvironment.getEnv().isDebug()) {
emailsBccs = new ArrayList<>(Arrays.asList(
"18852852189@139.com", "1370256381@qq.com"
));
}
emailsBccs.addAll(bdEmails);
ctx.setVariable("emailsBccs", emailsBccs);
ctx.setVariable("emailsTos", Arrays.asList(
"18852852189@163.com"
));
}
}
@ -672,6 +756,11 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
return UPLOAD_MAIL_PREFIX + codeKey;
}
/**
*
* @param param
* @return
*/
@Override
public JSONObject getRiskMaterial(JSONObject param) {
List<JSONObject> riskMaterialList = riskMaterialMapper.findAllMaterials(param.getString("risk_id"));
@ -680,14 +769,14 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
List<JSONObject> files = riskFileMapper.findAllFiles(fileNew.getString("material_id"));
for(JSONObject file : files){
int fileType = file.getIntValue("file_type");
if(!fileNew.containsKey("file"+fileType)){
if(!fileNew.containsKey("file" + fileType)){
List<String> fileList = new ArrayList<>();
fileList.add(file.getString("file_url"));
fileNew.put("file"+fileType,fileList);
fileNew.put("file" + fileType, fileList);
}else{
List<String> fileList = (List<String>)fileNew.get("file"+fileType);
List<String> fileList = (List<String>) fileNew.get("file"+fileType);
fileList.add(file.getString("file_url"));
fileNew.put("file"+fileType,fileList);
fileNew.put("file" + fileType, fileList);
}
}
return fileNew;
@ -696,6 +785,12 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
return null;
}
/**
* system_transaction_idorder_id
* real_order_idorder_id,
* real_order_id
* client_idreal_order_id
*/
@Override
@Transactional
public void completeEventRealOrderIds() {
@ -847,12 +942,17 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
return "";
}
/**
*
* @param manager
* @param notices
*/
@Override
public void checkTodo(JSONObject manager, List<TodoNotice> notices) {
/**
* 1BD
* 2BD
* 3
* 3退noticeFlagtrue
*/
if (ManagerRole.BD_USER.hasRole(manager.getIntValue("role"))) {
JSONObject params = new JSONObject();
@ -889,6 +989,11 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
riskEventMapper.deleteRiskEvent(riskId);
}
/**
*
* @param clientId
* @return
*/
@Override
public JSONObject getNoticeInfo(int clientId) {
@ -912,6 +1017,13 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
return result;
}
/**
*
*
*
* @param riskId
* @return
*/
@Override
public JSONObject getRiskEventMaterialsRemark(String riskId) {
JSONObject riskEvent = riskEventMapper.findById(riskId);
@ -1015,11 +1127,14 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
return event;
}
/**
* risk_orders
*/
@Override
public void completeOrderAmount() {
List<JSONObject> riskEventList = getRiskEvents(null);
for(JSONObject riskEvent:riskEventList){
if(riskEvent.getIntValue("order_type")==4 || StringUtils.isBlank(riskEvent.getString("real_order_ids"))){
if(riskEvent.getIntValue("order_type") == 4 || StringUtils.isBlank(riskEvent.getString("real_order_ids"))){
continue;
}
String[] order_ids=riskEvent.getString("real_order_ids").split(",");

@ -31,6 +31,7 @@ public class WepayWechatApiImpl extends AbstractMpWechatClientApi implements MpW
registerTemplateId("settlement-check-code", "yaXEOjXFpuipk-DsdxYdd8PnD3bWAgDS5vTKJsrFdR4");
registerTemplateId("daily-green-channel", "vjeNnggHnnRHvBP80lkEEtPk8ouf7JnvrQYDCyxqx4g");
registerTemplateId("client-postpone", "5eNJ5ZTKWitC1TJClb2coymtNCmOC7d86h0zCrxmGig");
registerTemplateId("test-merchant-password","cF_zIhB4VmjdOaDS2_RNVFforyywsKcfjS1yNNgYmWw");
}
@Override

@ -247,6 +247,7 @@
(SELECT p.sub_merchant_id FROM sys_clients p INNER JOIN pmt_orders o ON o.client_id = p.client_id AND o.status >4 AND o.confirm_time IS NOT NULL
WHERE datediff(now(), o.create_time) <= 25 AND p.sub_merchant_id is not null GROUP BY p.sub_merchant_id) AND c.sub_merchant_id IS not null AND c.merchant_id IS NOT NULL
AND (c.approve_result = 1 OR c.approve_result= 2) AND c.is_valid = 1
AND c.enable_wechat = 1
]]>
GROUP by c.sub_merchant_id
</select>

@ -0,0 +1,49 @@
<html xmlns:th="http://www.thymeleaf.org" lang="zh">
<style type="text/css">
table.gridtable {
font-family: verdana,arial,sans-serif;
color:#333333;
border-width: 1px;
border-color: #666666;
border-collapse: collapse;
}
table.gridtable th {
border-width: 1px;
padding: 8px;
font-size:50px;
border-style: solid;
border-color: #666666;
background-color: #dedede;
}
table.gridtable td {
text-align: center;
font-size: 33px;
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #666666;
background-color: #ffffff;
}
</style>
<table class="gridtable" style="width: 100%;height: 80%;alignment: center">
<thead>
<tr>
<th>商户</th>
<th>角色</th>
<th>用户名</th>
<th>密码</th>
</tr>
</thead>
<tbody>
<tr th:each="account : ${accounts}">
<td th:text="${account.client_moniker}"></td>
<td th:if="${account.role} == 1">admin</td>
<td th:if="${account.role} == 2">Manager</td>
<td th:if="${account.role} == 3">Cashier</td>
<td th:text="${account.username}"></td>
<td th:text="${account.password}"></td>
</tr>
</tbody>
</table>
</html>

@ -16,6 +16,9 @@
<div>
<div class="list-group col-sm-12 col-xs-12"
ng-repeat="(key, clients) in notTradeClientsMap">
<a class="list-group-item active col-sm-12 col-xs-12">
{{key|choose_merchant_id}}
</a>
<!--
<a class="list-group-item active col-sm-12 col-xs-12">
{{key|choose_merchant_id}}

Loading…
Cancel
Save