批量发邮件

master
jiahuiwen 2021-12-22 17:02:20 +08:00
parent a63eedfac5
commit 95f5ecbbae
4 changed files with 108 additions and 4 deletions

0
conf/buchang.txt 100644
View File

View File

@ -6,7 +6,10 @@ import com.jmfy.dao.impl.GSUserDaoImpl;
import com.jmfy.model.*;
import com.jmfy.model.vo.CUserVo;
import com.jmfy.model.vo.Hero;
import com.jmfy.redisProperties.RedisUserKey;
import com.jmfy.utils.DateUtil;
import com.jmfy.utils.JsonUtil;
import com.jmfy.utils.RedisUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
@ -19,7 +22,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.PrintWriter;
import java.io.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -57,6 +60,11 @@ public class UserInfoController {
return "getHeroInfo";
}
@RequestMapping(value = "/toSendMailInfoPage", method = RequestMethod.GET)
public String toSendMailInfoPage(ModelMap map){
return "sendMails";
}
@RequestMapping(value = "/getAllUserId", method = {RequestMethod.POST, RequestMethod.GET})
public String getAllUserId(HttpSession session, ModelMap map, HttpServletRequest request) throws Exception {
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap(request);
@ -119,7 +127,6 @@ public class UserInfoController {
GSUser gsUser = gsUserDao.findUserInfoQuick(userInfoById.getServerid(), roleId);
CUserVo cUserVo = getcUserVo(gsUser);
GSHeroMap gsHeroMap = gsUserDao.findHeroMap(userInfoById.getServerid(), roleId);
if(cUserVo.isData==1){
cUserVo.setServerId(String.valueOf(userInfoById.getServerid()));
}
@ -156,8 +163,34 @@ public class UserInfoController {
@RequestMapping(value = "/sendAppointMail", method = {RequestMethod.POST, RequestMethod.GET})
@ResponseBody
public String sendAppointMail(ModelMap map, HttpServletRequest request) throws Exception {
return "暂无展示信息";
String pathName = "config/buchang.txt";
File file = new File(pathName);
if(!file.exists()){
LOGGER.info("sendAppointMail->file is't exist");
throw new Exception("sendAppointMail is not exists =>{}" + pathName);
}
InputStreamReader read = new InputStreamReader(new FileInputStream(file), "utf-8");
BufferedReader bufferedReader = new BufferedReader(read);
String lineTxt = null;
while ((lineTxt = bufferedReader.readLine()) != null) {
if (lineTxt.isEmpty()) {
continue;
}
String[] split = lineTxt.split("\\|");
CUserInfo userInfoById = userInfoDao.findUserInfoById(split[0]);
if (userInfoById == null) {
continue;
}
MailPersonalCache mailPersonalCache = new MailPersonalCache();
mailPersonalCache.setTitle("升星配方调整补偿");
mailPersonalCache.setContent("觉醒神将补偿");
mailPersonalCache.setReward(split[1]);
int sendTime = (int) (DateUtil.now() / 1000);
mailPersonalCache.setTime(sendTime);
mailPersonalCache.setValidTime(sendTime + 86400 * 7);
RedisUtil.getInstence().putMapEntry(Integer.toString(userInfoById.getServerid()), RedisUserKey.READY_TO_USER_MAIL + RedisUserKey.Delimiter_colon, split[0].trim(), mailPersonalCache, 86400 * 7);
}
return "发送成功";
}
private CUserVo getcUserVo(GSUser gsUser) throws Exception {

View File

@ -44,6 +44,7 @@ public enum PowersEnum {
GUILD_LIST_MANAGER(410,"公会列表管理",400,1,"initGuildList"),
GUILD_OPERATE_PERMISSIONS(411,"权限: 操作公会",400,1,""),
USER_INFO_QUERY1(412,"角色神将查询",400,1,"toGetHeroInfoPage"),
SEND_MAILS(413,"发送txt里的邮件",400,1,"toSendMailInfoPage"),
// 流水日志管理500-599
BILL_LOG(500,"流水日志管理",500,1,""),

View File

@ -0,0 +1,70 @@
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="../static/lib/html5shiv.js"></script>
<script type="text/javascript" src="../static/lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="../static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="../static/lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/style.css" />
<!--[if IE 6]>
<script type="text/javascript" src="../static/lib/DD_belatedPNG_0.0.8a-min.js"></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>批量发邮件</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 批量发邮件 <span class="c-gray en">&gt;</span> 批量发邮件 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container" style="text-align: center">
<h1><span style="color: red">批量发邮件</span></h1>
<form class="form form-horizontal" id="form-article-add" action="/sendAppointMail" method="post" onsubmit="return getUserInfo()">
<div class="row cl">
<label class="form-label col-xs-4 col-sm-2">
<span class="c-red">*</span>
临时功能</label>
<div class="formControls col-xs-8 col-sm-9">
<input type="text" name="roleId" placeholder="" value="" class="input-text"/>
<span class="ROLEID"></span>
</div>
</div>
<div class="row cl" style="text-align: center" >
<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
<button class="btn btn-primary radius" type="submit" style="font-size: 15px"><i class="Hui-iconfont">&#xe665;</i> 批量发邮件</button>
</div>
</div>
</form>
</div>
<script type="text/javascript" src="../static/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="../static/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="../static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="../static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->
<script type="text/javascript" src="../static/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript">
function getUserInfo() {
var serverId = $("#serverId").val();
var roleId = $("input[name='roleId']").val();
var erroCode = $('.SERVERID');
if (roleId === '' || roleId == null) {
erroCode = $('.ROLEID');
erroCode.html('<span style="color: red; ">角色id不能为空!</span>');
return false;
}else {
erroCode = $('.ROLEID');
erroCode.html('<span style="color: red; "></span>');
}
return true
}
</script>
</body>
</html>