提交 57f48c48 编写于 作者: doc_wei's avatar doc_wei

桌面背景图片操作完成

上级 3e0325c7
package com.skyeye.authority.dao;
import java.util.List;
import java.util.Map;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
public interface SysEveWinBgPicDao {
public List<Map<String, Object>> querySysEveWinBgPicList(Map<String, Object> map, PageBounds pageBounds) throws Exception;
public int insertSysEveWinBgPicMation(Map<String, Object> map) throws Exception;
public int deleteSysEveWinBgPicMationById(Map<String, Object> map) throws Exception;
public Map<String, Object> querySysEveMationById(Map<String, Object> map) throws Exception;
}
package com.skyeye.authority.service;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
public interface SysEveWinBgPicService {
public void querySysEveWinBgPicList(InputObject inputObject, OutputObject outputObject) throws Exception;
public void insertSysEveWinBgPicMation(InputObject inputObject, OutputObject outputObject) throws Exception;
public void deleteSysEveWinBgPicMationById(InputObject inputObject, OutputObject outputObject) throws Exception;
}
package com.skyeye.authority.service.impl;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import com.skyeye.authority.dao.SysEveWinBgPicDao;
import com.skyeye.authority.service.SysEveWinBgPicService;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
import com.skyeye.common.util.ToolUtil;
@Service
public class SysEveWinBgPicServiceImpl implements SysEveWinBgPicService{
@Autowired
private SysEveWinBgPicDao sysEveWinBgPicDao;
/**
*
* @Title: querySysEveWinBgPicList
* @Description: 获取win系统桌面图片列表
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void querySysEveWinBgPicList(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
List<Map<String, Object>> beans = sysEveWinBgPicDao.querySysEveWinBgPicList(map,
new PageBounds(Integer.parseInt(map.get("page").toString()), Integer.parseInt(map.get("limit").toString())));
PageList<Map<String, Object>> beansPageList = (PageList<Map<String, Object>>)beans;
int total = beansPageList.getPaginator().getTotalCount();
outputObject.setBeans(beans);
outputObject.settotal(total);
}
/**
*
* @Title: insertSysEveWinBgPicMation
* @Description: 添加win系统桌面图片信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void insertSysEveWinBgPicMation(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> user = inputObject.getLogParams();
map.put("id", ToolUtil.getSurFaceId());
map.put("createId", user.get("id"));
map.put("createTime", ToolUtil.getTimeAndToString());
sysEveWinBgPicDao.insertSysEveWinBgPicMation(map);
}
/**
*
* @Title: deleteSysEveWinBgPicMationById
* @Description: 删除win系统桌面图片信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@SuppressWarnings("static-access")
@Override
public void deleteSysEveWinBgPicMationById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> bean = sysEveWinBgPicDao.querySysEveMationById(map);
String tPath = inputObject.getRequest().getSession().getServletContext().getRealPath("/");
String basePath = tPath + bean.get("picUrl").toString();
ToolUtil.deleteFile(basePath);
sysEveWinBgPicDao.deleteSysEveWinBgPicMationById(map);
}
}
...@@ -62,6 +62,12 @@ public class CommonServiceImpl implements CommonService{ ...@@ -62,6 +62,12 @@ public class CommonServiceImpl implements CommonService{
case 1://小程序上传 case 1://小程序上传
basePath = tPath + "\\assets\\smpropic" ; basePath = tPath + "\\assets\\smpropic" ;
break; break;
case 2://系统桌面背景自定义图片上传
basePath = tPath + "\\assets\\winbgpic" ;
break;
case 3://系统桌面锁屏背景自定义图片上传
basePath = tPath + "\\assets\\winlockbgpic" ;
break;
default: default:
basePath = tPath.substring(0, inputObject.getRequest().getSession().getServletContext().getRealPath("/").indexOf(Constants.PROJECT_WEB)); basePath = tPath.substring(0, inputObject.getRequest().getSession().getServletContext().getRealPath("/").indexOf(Constants.PROJECT_WEB));
break; break;
...@@ -84,6 +90,18 @@ public class CommonServiceImpl implements CommonService{ ...@@ -84,6 +90,18 @@ public class CommonServiceImpl implements CommonService{
String path = basePath + "\\" + newFileName; String path = basePath + "\\" + newFileName;
// 上传 // 上传
file.transferTo(new File(path)); file.transferTo(new File(path));
switch (type) {
case 1://小程序上传
break;
case 2://系统桌面背景自定义图片上传
newFileName = "/assets/winbgpic/" + newFileName ;
break;
case 3://系统桌面锁屏背景自定义图片上传
newFileName = "/assets/winlockbgpic/" + newFileName ;
break;
default:
break;
}
if(ToolUtil.isBlank(trueFileName)){ if(ToolUtil.isBlank(trueFileName)){
trueFileName = newFileName; trueFileName = newFileName;
}else{ }else{
......
package com.skyeye.authority.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.skyeye.authority.service.SysEveWinBgPicService;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
@Controller
public class SysEveWinBgPicController {
@Autowired
private SysEveWinBgPicService sysEveWinBgPicService;
/**
*
* @Title: querySysEveWinBgPicList
* @Description: 获取win系统桌面图片列表
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/SysEveWinBgPicController/querySysEveWinBgPicList")
@ResponseBody
public void querySysEveWinBgPicList(InputObject inputObject, OutputObject outputObject) throws Exception{
sysEveWinBgPicService.querySysEveWinBgPicList(inputObject, outputObject);
}
/**
*
* @Title: insertSysEveWinBgPicMation
* @Description: 添加win系统桌面图片信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/SysEveWinBgPicController/insertSysEveWinBgPicMation")
@ResponseBody
public void insertSysEveWinBgPicMation(InputObject inputObject, OutputObject outputObject) throws Exception{
sysEveWinBgPicService.insertSysEveWinBgPicMation(inputObject, outputObject);
}
/**
*
* @Title: deleteSysEveWinBgPicMationById
* @Description: 删除win系统桌面图片信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/SysEveWinBgPicController/deleteSysEveWinBgPicMationById")
@ResponseBody
public void deleteSysEveWinBgPicMationById(InputObject inputObject, OutputObject outputObject) throws Exception{
sysEveWinBgPicService.deleteSysEveWinBgPicMationById(inputObject, outputObject);
}
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.skyeye.authority.dao.SysEveWinBgPicDao">
<select id="querySysEveWinBgPicList" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id,
a.pic_url picUrl,
CONVERT(a.create_time, char) createTime
FROM
sys_eve_win_bg_pic a
WHERE a.pic_type = '1'
ORDER BY a.create_time DESC
</select>
<insert id="insertSysEveWinBgPicMation" parameterType="java.util.Map">
INSERT into sys_eve_win_bg_pic
(id, pic_url, pic_type, create_id, create_time)
VALUES
(#{id}, #{picUrl}, '1', #{createId}, #{createTime})
</insert>
<delete id="deleteSysEveWinBgPicMationById" parameterType="java.util.Map">
DELETE
FROM
sys_eve_win_bg_pic
WHERE
id = #{id}
</delete>
<select id="querySysEveMationById" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id,
a.pic_url picUrl
FROM
sys_eve_win_bg_pic a
WHERE a.id = #{id}
</select>
</mapper>
\ No newline at end of file
...@@ -164,6 +164,17 @@ ...@@ -164,6 +164,17 @@
</url> </url>
<url id="redis003" path="/post/SysRedisMonitorController/queryRedisKeysList" val="获取当前数据库中key的数量" allUse="0"> <url id="redis003" path="/post/SysRedisMonitorController/queryRedisKeysList" val="获取当前数据库中key的数量" allUse="0">
</url> </url>
<url id="sysevewinbgpic001" path="/post/SysEveWinBgPicController/querySysEveWinBgPicList" val="获取win系统桌面图片列表" allUse="1">
<property id="limit" name="limit" ref="required,num" var="分页参数,每页多少条数据" />
<property id="page" name="page" ref="required,num" var="分页参数,第几页"/>
</url>
<url id="sysevewinbgpic002" path="/post/SysEveWinBgPicController/insertSysEveWinBgPicMation" val="添加win系统桌面图片信息" allUse="1">
<property id="picUrl" name="picUrl" ref="required" var="图片路径"/>
</url>
<url id="sysevewinbgpic003" path="/post/SysEveWinBgPicController/deleteSysEveWinBgPicMationById" val="删除win系统桌面图片信息" allUse="1">
<property id="rowId" name="id" ref="required" var="win系统桌面图片id"/>
</url>
<!-- 系统角色用户管理结束 --> <!-- 系统角色用户管理结束 -->
<!-- 系统数据库管理开始 --> <!-- 系统数据库管理开始 -->
......
...@@ -2033,6 +2033,29 @@ body .layer-ext-winconfirm { ...@@ -2033,6 +2033,29 @@ body .layer-ext-winconfirm {
/***系统icon样式end***/ /***系统icon样式end***/
/***系统桌面背景图片样式start***/
.pic-item{
padding-top: 10px;
height: 140px;
}
.pic-item-div-top{
text-align: center;
}
.win-bg-pic{
width: 70%;
height: 90px;
}
.pic-item-div>div{
text-align: center;
margin-top: 10px;
}
/***系统桌面背景图片样式end***/
/***common start***/ /***common start***/
.noMation{ .noMation{
......
var rowId = "";
layui.config({
base: basePath,
version: skyeyeVersion
}).define(['table', 'jquery', 'winui', 'upload'], function (exports) {
winui.renderColor();
var $ = layui.$,
form = layui.form,
upload = layui.upload;
//初始化数据
showGrid({
id: "showForm",
url: reqBasePath + "sysevewinbgpic001",
params: {},
pagination: true,
pagesize: 18,
template: getFileContent('tpl/sysevewinbgpic/bgpic-item.tpl'),
ajaxSendLoadBefore: function(hdb){
hdb.registerHelper("compare1", function(v1, options){
return fileBasePath + v1;
});
},
options: {'click .del':function(index, row){
layer.confirm('确认删除选中数据吗?', { icon: 3, title: '删除win系统桌面图片' }, function (index) {
layer.close(index);
AjaxPostUtil.request({url:reqBasePath + "sysevewinbgpic003", params:{rowId: row.id}, type:'json', callback:function(json){
if(json.returnCode == 0){
top.winui.window.msg("删除成功", {icon: 1,time: 2000});
loadTable();
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
});
}, 'click .sel':function(index, row){
layer.open({
type:1,
title:false,
closeBtn:0,
skin: 'demo-class',
shadeClose:true,
content:'<img src="' + fileBasePath + data.picUrl + '" style="max-height:600px;max-width:100%;">',
scrollbar:false
});
}
},
ajaxSendAfter:function(json){
}
});
//刷新数据
$("body").on("click", "#reloadTable", function(){
loadTable();
});
var uploadInst = upload.render({
elem: '#addBean', // 绑定元素
url: reqBasePath + 'common003', // 上传接口
data: {type: 2},
done: function(json) {
// 上传完毕回调
if(json.returnCode == 0){
AjaxPostUtil.request({url:reqBasePath + "sysevewinbgpic002", params:{picUrl: json.bean.picUrl}, type:'json', callback:function(json){
if(json.returnCode == 0){
top.winui.window.msg("上传成功", {icon: 1,time: 2000});
loadTable();
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
},
error: function(e) {
// 请求异常回调
console.log(e);
}
});
function loadTable(){
refreshGrid("showForm", {params:{}});
}
exports('sysevewinbgpiclist', {});
});
{{#each rows}}
<div class="layui-col-xs2 pic-item">
<div class="layui-col-xs12 pic-item-div-top">
<img class="win-bg-pic sel" src="{{#compare1 picUrl}}{{/compare1}}"/>
</div>
<div class="layui-col-xs12 pic-item-div">
<div>
<a class="layui-btn layui-btn-danger layui-btn-xs del">删除</a>
</div>
</div>
</div>
{{/each}}
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<link href="../../assets/lib/layui/css/layui.css" rel="stylesheet" />
<link href="../../assets/lib/font-awesome-4.7.0/css/font-awesome.css" rel="stylesheet" />
<link href="../../assets/lib/winui/css/winui.css" rel="stylesheet" />
</head>
<body>
<div class="winui-toolbar">
<div class="winui-tool">
<button id="reloadTable" class="winui-toolbtn"><i class="fa fa-refresh" aria-hidden="true"></i>刷新数据</button>
<button id="addBean" class="winui-toolbtn"><i class="fa fa-plus" aria-hidden="true"></i>新增win系统桌面图片</button>
</div>
</div>
<div style="margin:auto 10px;">
<div class="layui-col-xs12" id="showForm">
</div>
</div>
<script src="../../assets/lib/layui/layui.js"></script>
<script src="../../assets/lib/layui/custom.js"></script>
<script type="text/javascript">
layui.config({base: '../../js/sysevewinbgpic/'}).use('sysevewinbgpiclist');
</script>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册