luoyang 6 years ago
parent 3c807a4050
commit 9c5b1eb6a4

@ -1,14 +1,17 @@
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 com.globalfreepay.payment.tools.permission.wechat.WechatMapping;
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.*;
@ -18,25 +21,19 @@ import java.net.URLDecoder;
import java.util.List;
@RestController
@RequestMapping("/testMerchantPassword")
@Controller
@WechatMapping(value = "/testMerchantPassword", addonMp = {RedpackWechatApiImpl.class}, oauthType = WxOauthType.USERINFO)
public class TestMerchantPassword {
private Logger logger = LoggerFactory.getLogger(getClass());
@Resource
private ManagerMapper managerMapper;
@WechatMapping
public String testMerchantPassword(@PathVariable String accounts, @ModelAttribute(CommonConsts.WECHATINFO) JSONObject wxUser, Model modelMap) {
if (StringUtils.isBlank(accounts)) {
@WechatMapping(method = RequestMethod.GET)
public String testMerchantPassword(@RequestParam String[] accounts, @ModelAttribute(CommonConsts.WECHATINFO) JSONObject wxUser, Model modelMap) {
if (accounts == null) {
return null;
}
try {
accounts = URLDecoder.decode(accounts, "UTF-8");
} catch (UnsupportedEncodingException e) {
logger.error("获取临时密码失败转换url错误 " + e);
}
List<String> openIds = managerMapper.listDevAndBdOpenId();
@ -44,9 +41,26 @@ public class TestMerchantPassword {
throw new ForbiddenException("无权限查看此页面");
}
JSONArray array = JSONArray.parseArray(accounts);
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 "templates/testMerchantPassword";
return "testMerchantPassword";
}
}

@ -4462,14 +4462,13 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
}).start();
StringBuffer accountsStr = new StringBuffer("?accounts={");
StringBuffer accountsStr = new StringBuffer("?");
accounts.forEach(e->{
accountsStr.append("['username':'" + e.getString("username") + "','password':'" +
e.getString("password") + "','role':'"+ e.getString("role") + "','client_moniker':'"+ e.getString("client_moniker") +"'],");
accountsStr.append("accounts=" + e.getString("username") + ","
+ e.getString("password") + "," + e.getIntValue("role") + "," + e.getString("client_moniker") + "&");
});
String account = accountsStr.substring(0, accountsStr.length() - 1);
account += "}";
List<String> wx_openIds = managerMapper.listDevAndBdOpenId();
@ -4490,10 +4489,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override
public void tempSend() {
String tmpOpenId = "o32MzuPR4AnVN94C4ISc6Y1n7xKI";
String account = "[{'username':'aa','password':'a123456a','role':'2','client_monkier'='PINE'}," +
"[{'username':'bb','password':'a123456a','role':'2','client_monkier'='PINE'}," +
"[{'username':'cc','password':'a123456a','role':'2','client_monkier'='PINE'}," +
"[{'username':'dd','password':'a123456a','role':'2','client_monkier'='PINE'}]";
String account = "?accounts=aa,a123456a,1,PINE&accounts=dadasa,a123456a,1,PINE&accounts=asdasdasd,a123456a,1,PINE&accounts=tetsa,a123456a,1,PINE";
try {
MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi();
TemplateMessage msg = initSendTestPasswordTemplate(tmpOpenId, paymentApi.getTemplateId("test-merchant-password"), account);
@ -4505,7 +4501,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
private TemplateMessage initSendTestPasswordTemplate(String wxopenid, String templateId,String url) {
TemplateMessage msg = new TemplateMessage(wxopenid, templateId, "https://www.royalpay.com.au/testMerchantPassword" + 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");

@ -3,7 +3,6 @@
<style type="text/css">
table.gridtable {
font-family: verdana,arial,sans-serif;
font-size:11px;
color:#333333;
border-width: 1px;
border-color: #666666;
@ -12,11 +11,14 @@
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;
@ -24,7 +26,7 @@
background-color: #ffffff;
}
</style>
<table class="gridtable">
<table class="gridtable" style="width: 100%;height: 80%;alignment: center">
<thead>
<tr>
<th>商户</th>

Loading…
Cancel
Save