关于短信群发的简单实现
样式:
文章图片
前台代码:
Insert title here - 锐客网
序号
时间
操作人
进度
用户
短信内容
备注
【关于短信群发的简单实现】新增弹窗
文章图片
后台代码:
vo:
public class MassageRecordingVo {
private int id;
private String createtime;
private String admin;
private String process;
private String user;
private String content;
private String remark;
controller:
@Controller
public class MassageRecordingController {
@Autowired
private MassageRecordingService massageRecordingService;
@Autowired
private MassageService massageService;
/**
* 获取短信模板列表
*
* @param page
* @param rows
* @return
*/
@RequestMapping("/massageRecording/getMassageRecordingByPage")
@ResponseBody
public EasyUIDatagrid getMassageRecordingByPage(Integer page, Integer rows) {
return massageRecordingService.getMassageRecordingByPage(page, rows);
}/**
* 加载短信模板
* @param
* @param
*/
@RequestMapping("/massageRecording/loadMassage")
@ResponseBody
public List loadInstitute() throws Exception {
List mList = new ArrayList();
try {
mList = massageService.listAllMassages();
} catch (Exception e) {
e.printStackTrace();
}
return mList;
}/**
* 添加短信群发
* @param massage
* @return
*/
@RequestMapping("/massageRecording/addMassageRecording")
@ResponseBody
public Map addMassageRecording(String user,String content){
Map retMap = new HashMap();
try {
massageRecordingService.addMassageRecording(user,content);
retMap.put("result", "success");
} catch (Exception e) {
e.printStackTrace();
retMap.put("result", "error");
}return retMap;
}}
ServiceImpl:
@Service
public class MassageRecordingServiceImpl implements MassageRecordingService {@Autowired
private MassageRecordingDao massageRecordingDao;
@Override
public EasyUIDatagrid getMassageRecordingByPage(Integer page, Integer rows) {
// 使用分页插件进行分页处理// startPage方法一定要在statement执行前执行
PageHelper.startPage(page, rows);
List list = massageRecordingDao.getMassageRecordingByPage();
// pageInfo包含了分页的所有信息
PageInfo pageInfo = new PageInfo(list);
EasyUIDatagrid easyUIDatagrid = new EasyUIDatagrid();
easyUIDatagrid.setRows(pageInfo.getList());
easyUIDatagrid.setTotal(pageInfo.getTotal());
return easyUIDatagrid;
}@Override
public void addMassageRecording(String user, String content) {
MassageRecordingVo mrv = new MassageRecordingVo();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
mrv.setCreatetime(sdf.format(new Date()));
String[] split = user.split(",");
mrv.setUser("共有"+split.length+"名用户");
mrv.setAdmin("admin");
mrv.setProcess("发送完成");
mrv.setContent(content);
mrv.setRemark("");
massageRecordingDao.addMassageRecording(mrv);
}}
dao.xml:
"getMassageRecordingByPage" resultType="massageRecordingVo">
SELECT
`id`, `createtime`,
`admin`, `process`,`user`,
`content`, `remark`
FROM
`massage_recording`
ORDER BY `id`
INSERT
INTO `massage_recording`
(`createtime`,`admin`, `process`,
`user`,`content`, `remark`)
VALUES
(#{createtime}, #{admin},#{process},#{user}, #{content},#{remark})
推荐阅读
- 关于QueryWrapper|关于QueryWrapper,实现MybatisPlus多表关联查询方式
- 四首关于旅行记忆的外文歌曲
- 醒不来的梦
- 关于自我为中心的一点感想
- 「按键精灵安卓版」关于全分辨率脚本的一些理解(非游戏app)
- 关于Ruby的杂想
- 关于读书的思考
- 关于this的一些问题(1)
- 《声之形》
- 关于如何沟通的1/2/3