Merge remote-tracking branch 'origin/master'

This commit is contained in:
fl 2025-03-31 18:11:16 +08:00
commit 55f292ddd1
17 changed files with 570 additions and 2 deletions

View File

@ -1,9 +1,22 @@
package com.bonus.imgTool.backstage.controller;
import com.bonus.imgTool.annotation.DecryptAndVerify;
import com.bonus.imgTool.annotation.LogAnnotation;
import com.bonus.imgTool.backstage.entity.QueryParamDto;
import com.bonus.imgTool.backstage.service.SynthesisQueryService;
import com.bonus.imgTool.model.SysUser;
import com.bonus.imgTool.system.vo.EncryptedReq;
import com.bonus.imgTool.utils.ServerResponse;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* @className:SynthesisQueryController
* @author:cwchen
@ -15,5 +28,13 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/backstage/synthesisQuery/")
public class SynthesisQueryController {
@Resource(name = "SynthesisQueryService")
private SynthesisQueryService synthesisQueryService;
@PostMapping(value = "getImgList")
@DecryptAndVerify(decryptedClass = QueryParamDto.class)
@LogAnnotation(operModul = "综合查询-照片综合查询", operation = "查询照片", operDesc = "系统级事件",operType="查询")
public ServerResponse getImgList(EncryptedReq<QueryParamDto> data) {
return synthesisQueryService.getImgList(data.getData());
}
}

View File

@ -1,7 +1,11 @@
package com.bonus.imgTool.backstage.dao;
import com.bonus.imgTool.backstage.entity.QueryParamDto;
import com.bonus.imgTool.backstage.entity.SynthesisQueryVo;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @className:SynthesisQueryDao
* @author:cwchen
@ -11,4 +15,12 @@ import org.springframework.stereotype.Repository;
*/
@Repository(value = "SynthesisQueryDao")
public interface SynthesisQueryDao {
/**
* 照片综合查询
* @param dto
* @return List<SynthesisQueryVo>
* @author cwchen
* @date 2025/3/31 15:56
*/
List<SynthesisQueryVo> getImgList(QueryParamDto dto);
}

View File

@ -0,0 +1,23 @@
package com.bonus.imgTool.backstage.entity;
import lombok.Data;
/**
* @className:QueryParamDto
* @author:cwchen
* @date:2025-03-31-15:46
* @version:1.0
* @description:前端参数
*/
@Data
public class QueryParamDto {
/**
* 1.我的收藏 2.最近上传
*/
private int queryType;
/**用户id*/
private long userId;
private int pageNum = 1;
private int pageSize = 10;
}

View File

@ -1,5 +1,10 @@
package com.bonus.imgTool.backstage.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
/**
* @className:SynthesisQueryVo
* @author:cwchen
@ -7,5 +12,46 @@ package com.bonus.imgTool.backstage.entity;
* @version:1.0
* @description:综合查询-vo
*/
@Data
public class SynthesisQueryVo {
private String id;
/**
* 原图图片路径
*/
private String originalFilePath;
/**
* 压缩图片路径
*/
private String compressFilePath;
/**
* 图片水印路径
*/
private String watermarkFilePath;
/**
* 上传类型 1.安全违章2.质量检查3.安全措施落实4.协调照片5.重要事项及宣传照片
*/
private String uploadType;
/**
* 上传类型名称 1.安全违章2.质量检查3.安全措施落实4.协调照片5.重要事项及宣传照片
*/
private String uploadTypeName;
/**
* 上传时间
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date uploadTime;
/**
* 资源类型
*/
private String sourceType;
/**
* 资源类型名称
*/
private String sourceTypeName;
/**
* 收藏状态 0.未收藏 1.已收藏
*/
private String collectStatus;
}

View File

@ -1,5 +1,8 @@
package com.bonus.imgTool.backstage.service;
import com.bonus.imgTool.backstage.entity.QueryParamDto;
import com.bonus.imgTool.utils.ServerResponse;
/**
* @className:SynthesisQueryService
* @author:cwchen
@ -8,4 +11,12 @@ package com.bonus.imgTool.backstage.service;
* @description:综合查询
*/
public interface SynthesisQueryService {
/**
* 照片综合查询
* @param data
* @return ServerResponse
* @author cwchen
* @date 2025/3/31 15:47
*/
ServerResponse getImgList(QueryParamDto data);
}

View File

@ -1,10 +1,23 @@
package com.bonus.imgTool.backstage.service.impl;
import com.bonus.imgTool.backstage.dao.SynthesisQueryDao;
import com.bonus.imgTool.backstage.entity.QueryParamDto;
import com.bonus.imgTool.backstage.entity.SynthesisQueryVo;
import com.bonus.imgTool.backstage.service.SynthesisQueryService;
import com.bonus.imgTool.utils.ServerResponse;
import com.bonus.imgTool.utils.UserUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.catalina.security.SecurityUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
/**
* @className:SynthesisQueryServiceImpl
* @author:cwchen
@ -16,5 +29,20 @@ import org.springframework.stereotype.Service;
@Slf4j
public class SynthesisQueryServiceImpl implements SynthesisQueryService {
@Resource(name = "SynthesisQueryDao")
private SynthesisQueryDao synthesisQueryDao;
@Override
public ServerResponse getImgList(QueryParamDto dto) {
PageHelper.startPage(dto.getPageNum(), dto.getPageSize());
try {
dto.setUserId(UserUtil.getLoginUser() != null ? UserUtil.getLoginUser().getId() : 0);
List<SynthesisQueryVo> list = Optional.ofNullable(synthesisQueryDao.getImgList(dto)).orElseGet(ArrayList::new);
PageInfo<SynthesisQueryVo> pageInfo = new PageInfo<>(list);
return ServerResponse.createSuccess(pageInfo);
} catch (Exception e) {
log.error(e.toString(), e);
return ServerResponse.createErroe("查询失败");
}
}
}

View File

@ -3,6 +3,18 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.imgTool.backstage.dao.SynthesisQueryDao">
<!--照片综合查询-->
<select id="getImgList" resultType="com.bonus.imgTool.backstage.entity.SynthesisQueryVo">
SELECT id,
'../../img/synthesisQuery/7.jpg' AS originalFilePath,
'../../img/synthesisQuery/7.jpg' AS compressFilePath,
'../../img/synthesisQuery/7.jpg' AS watermarkFilePath,
'1' AS uploadType,
'安全违章' AS uploadTypeName,
operate_time AS uploadTime,
'1' AS sourceType,
'违章照片' AS sourceTypeName,
'1' AS collectStatus
FROM sys_logs
</select>
</mapper>

View File

@ -0,0 +1,191 @@
html,
body {
width: 99.5%;
height: 99%;
margin: 0.15% 0 0 0.25%;
padding: 0;
font-family: 'Alibaba PuHuiTi R';
}
.layout {
display: flex;
justify-content: center;
align-items: center;
}
#main-box {
width: 100%;
height: 100%;
padding: 0.5% 1%;
box-sizing: border-box;
/*background-color: #fff;*/
}
#search-box {
width: 100%;
height: 60px;
}
#type-num-box {
width: 100%;
height: 90px;
justify-content: space-between;
}
.type-num {
width: 200px;
height: 80px;
border-radius: 6px;
background-color: #fff;
}
.type-num > div:nth-child(1) {
width: 70%;
height: 100%;
flex-direction: column;
justify-content: space-evenly;
}
.type-num > div > p:nth-child(1) {
color: #999;
}
.type-num > div > p:nth-child(2) {
color: #666;
font-size: 20px;
font-weight: bold;
}
.type-num > div:nth-child(2) {
width: 30%;
height: 100%;
}
.type-num > div:nth-child(2) > img {
width: 32px;
height: 32px;
}
#change-type-box {
width: 130px;
height: 60px;
justify-content: space-between;
}
#change-type-box p {
cursor: pointer;
}
.checkedElement {
color: #00377a !important;
font-weight: bold;
}
.noCheckedElement {
color: #999 !important;
}
#img-box {
width: 100%;
height: calc(100% - 200px);
}
.layui-flow-more{
width: 100%;
}
#ID-flow-demo {
width: 100%;
height: 100%;
justify-content: start;
align-items: start;
flex-wrap: wrap;
overflow-y: auto;
}
.img-info {
width: 19%;
height: 250px;
margin: 0 1% 1% 0;
background-color: #fff;
}
.imgData {
width: 100%;
height: 70%;
}
.imgData img {
width: 100%;
height: 100%;
object-fit: contain; /* 或 contain */
}
.imgData2 {
width: 100%;
height: 15%;
justify-content: space-between;
}
.imgData2>p{
margin: 0 10px;
}
.imgData2>p:nth-child(1){
color: #999;
}
.imgData3 {
width: 100%;
height: 15%;
justify-content: start;
}
.imgData3>p{
margin: 0 10px;
}
.imgData3>p:nth-child(1){
color: #666;
font-weight: bold;
}
.img-color1{
background-color: #FEF1F1;
color: #F36C6C;
padding: 2px 10px;
}
.img-color2{
background-color: #EFFBF6;
color: #5AD8A6;
padding: 2px 10px;
}
.img-color3{
background-color: #FFF9EA;
color: #FFC328;
padding: 2px 10px;
}
.img-color4{
background-color: #FCF2FA;
color: #F66CD7;
padding: 2px 10px;
}
.img-color5{
background-color: #E6F9F9;
color: #00CCDD;
padding: 2px 10px;
}
.layui-input:hover,
.layui-select:hover,
.layui-textarea:hover {
border-color: #00377a !important;
box-shadow: 0 0 0 3px rgba(0, 55, 122, .08)
}
.layui-input:focus,
.layui-select:focus,
.layui-textarea:focus {
border-color: #00377a !important;
box-shadow: 0 0 0 3px rgba(0, 55, 122, .08)
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 923 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 889 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1022 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 926 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1019 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 850 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1016 KiB

View File

@ -0,0 +1,110 @@
let form, laydate, flow;
let pageNum = 1, pageSize = 15; // 定义分页
let queryType = 2; // 默认最近上传
layui.use(["form", 'laydate', 'flow'], function () {
form = layui.form;
laydate = layui.laydate;
flow = layui.flow;
flow.load({
elem: '#ID-flow-demo', // 流加载容器
scrollElem: '#ID-flow-demo', // 滚动条所在元素,一般不用填,此处只是演示需要。
end: '数据加载完毕',
direction:'bottom',
done: function (page, next) { // 执行下一页的回调
console.error(page);
pageNum = page;
let lis = [];
let returnData = loadData();
if (returnData != null) {
lis = initImgData(returnData.data.list)
next(lis.join(''), page < returnData.data.total/15);
}
}
});
});
/*切换查询类型*/
function changeType(type, that) {
queryType = type;
pageNum = 1;
$(that).removeClass("noCheckedElement");
if ($(that).hasClass("checkedElement") && type === 1) {
$(that).next().removeClass("checkedElement").addClass("noCheckedElement");
} else if (!$(that).hasClass("checkedElement") && type === 1) {
$(that).addClass("checkedElement");
$(that).next().removeClass("checkedElement").addClass("noCheckedElement");
} else if ($(that).hasClass("checkedElement") && type === 2) {
$(that).prev().removeClass("checkedElement").addClass("noCheckedElement");
} else if (!$(that).hasClass("checkedElement") && type === 2) {
$(that).addClass("checkedElement");
$(that).prev().removeClass("checkedElement").addClass("noCheckedElement");
}
$('#ID-flow-demo').empty();
flow.load({
elem: '#ID-flow-demo', // 流加载容器
scrollElem: '#ID-flow-demo', // 滚动条所在元素,一般不用填,此处只是演示需要。
end: '数据加载完毕',
direction:'bottom',
done: function (page, next) { // 执行下一页的回调
console.error(page);
let lis = [];
let returnData = loadData();
if (returnData != null) {
lis = initImgData(returnData.data.list)
next(lis.join(''), page < returnData.data.total/15);
}
}
});
}
/**加载图片数据*/
function loadData() {
let returnData = null;
let url = dataUrl + "/backstage/synthesisQuery/getImgList"
let obj = {
pageNum: pageNum,
pageSize: pageSize,
queryType: queryType
}
let params = {
encryptedData: encryptCBC(JSON.stringify(obj))
}
ajaxRequest(url, "POST", params, false, function () {
}, function (result) {
if (result.status === 200) {
console.log(result)
returnData = result;
} else {
layer.msg(result.msg, {icon: 2})
}
}, function (xhr) {
error(xhr)
});
return returnData;
}
/**渲染图片*/
function initImgData(list) {
let htmlArr = [];
if (list && list.length > 0) {
$.each(list, function (index, item) {
htmlArr.push("<div class='img-info'>" +
" <div class='imgData layout'>\n" +
" <img src='" + item.compressFilePath + "'>" +
" </div>" +
" <div class='imgData2 layout'>" +
" <p>" + item.uploadTime + "</p>" +
" <p class='img-color" + (item.uploadType) + "'>" + item.uploadTypeName + "</p>" +
" </div>" +
" <div class='imgData3 layout'>" +
" <p>" + item.sourceTypeName + "</p>" +
" <p>" + item.id.substr(0,10) + "</p>" +
" </div>" +
" </div>");
})
}
return htmlArr;
}

View File

@ -0,0 +1,114 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>照片综合查询</title>
<link rel="stylesheet" href="../../js/layui-v2.9.14/layui/css/layui.css">
<link rel="stylesheet" href="../../css/synthesisQuery/synthesisQuery.css">
<link rel="stylesheet" href="../../css/font.css">
<script src="../../js/libs/jquery-3.7.0.min.js" charset="UTF-8" type="text/javascript"></script>
<script src="../../js/layui-v2.9.14/layui/layui.js" charset="UTF-8" type="text/javascript"></script>
<script src="../../js/publicJs.js"></script>
<script src="../../js/commonUtils.js"></script>
<script src="../../js/openIframe.js"></script>
<script src="../../js/my/aes.js"></script>
<script src="../../js/ajaxRequest.js"></script>
</head>
<body>
<div id="main-box">
<!--搜索-->
<div id="search-box">
<form class="layui-form">
<div class="layui-form-item layout">
<div class="layui-input-group">
<input style="width: 600px;" type="text" id="title" name="title" placeholder="搜索标题"
autocomplete="off" class="layui-input" lay-affix="clear">
<div class="layui-input-split layui-input-suffix" style="cursor: pointer;background-color: #fff;">
<i class="layui-icon layui-icon-search"></i>
</div>
</div>
</div>
</form>
</div>
<!--各类型图片数量-->
<div id="type-num-box" class="layout">
<div class="type-num layout">
<div class="layout">
<p>总照片数</p>
<p>1250</p>
</div>
<div class="layout">
<img src="../../img/synthesisQuery/1.png">
</div>
</div>
<div class="type-num layout">
<div class="layout">
<p>安全违章</p>
<p>1250</p>
</div>
<div class="layout">
<img src="../../img/synthesisQuery/2.png">
</div>
</div>
<div class="type-num layout">
<div class="layout">
<p>质量检查</p>
<p>1250</p>
</div>
<div class="layout">
<img src="../../img/synthesisQuery/3.png">
</div>
</div>
<div class="type-num layout">
<div class="layout">
<p>安全措施落实</p>
<p>1250</p>
</div>
<div class="layout">
<img src="../../img/synthesisQuery/4.png">
</div>
</div>
<div class="type-num layout">
<div class="layout">
<p>协调照片</p>
<p>1250</p>
</div>
<div class="layout">
<img src="../../img/synthesisQuery/5.png">
</div>
</div>
<div class="type-num layout">
<div class="layout">
<p>重要事项及宣传类</p>
<p>1250</p>
</div>
<div class="layout">
<img src="../../img/synthesisQuery/6.png">
</div>
</div>
</div>
<!--我的收藏、最近上传-->
<div id="change-type-box" class="layout">
<p class="noCheckedElement" onclick="changeType(1,this)">我的收藏</p>
<p class="checkedElement" onclick="changeType(2,this)">最近上传</p>
</div>
<div id="img-box">
<div class="flow-demo layout" id="ID-flow-demo">
<!--<div class="img-info">
<div class="imgData layout">
<img src="../../img/synthesisQuery/7.jpg">
</div>
<div class="imgData2 layout">
<p>2024-05-05</p>
<p class="img-color1">安全违章</p>
</div>
<div class="imgData3 layout">
<p>违章照片</p>
</div>
</div>-->
</div>
</div>
</div>
</body>
<script src="../../js/synthesisQuery/synthesisQuery.js" charset="UTF-8" type="text/javascript"></script>
</html>