From 3b3d9c0f437b8fb52efc7cebb30dfea7ad54f61c Mon Sep 17 00:00:00 2001 From: cwchen <1048842385@qq.com> Date: Thu, 3 Apr 2025 11:21:56 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=BC=E5=90=88=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SynthesisQueryController.java | 27 +++++ .../backstage/dao/SynthesisQueryDao.java | 9 ++ .../backstage/entity/QueryParamDto.java | 62 +++++++++++ .../service/SynthesisQueryService.java | 9 ++ .../impl/SynthesisQueryServiceImpl.java | 17 +++ .../bonus/imgTool/task/job/ProPullTask.java | 2 +- .../backstage/SynthesisQueryMapper.xml | 82 +++++++++++++- .../js/layui-v2.9.14/layui/rightPopup.js | 1 + .../js/synthesisQuery/highSearchForm.js | 37 ++++++- .../js/synthesisQuery/synthesisQuery.js | 104 +++++++++++++----- .../pages/synthesisQuery/highSearchForm.html | 57 +++++----- .../pages/synthesisQuery/synthesisQuery.html | 4 +- 12 files changed, 340 insertions(+), 71 deletions(-) diff --git a/src/main/java/com/bonus/imgTool/backstage/controller/SynthesisQueryController.java b/src/main/java/com/bonus/imgTool/backstage/controller/SynthesisQueryController.java index 7aeb0b7..d80463d 100644 --- a/src/main/java/com/bonus/imgTool/backstage/controller/SynthesisQueryController.java +++ b/src/main/java/com/bonus/imgTool/backstage/controller/SynthesisQueryController.java @@ -6,6 +6,8 @@ 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.system.vo.SysWhiteDto; +import com.bonus.imgTool.system.vo.SysWhiteVo; import com.bonus.imgTool.utils.ServerResponse; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; @@ -16,7 +18,9 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * @className:SynthesisQueryController @@ -45,4 +49,27 @@ public class SynthesisQueryController { public ServerResponse getImgList(EncryptedReq data) { return synthesisQueryService.getImgList(data.getData()); } + + @ApiOperation("收藏/取消收藏图片") + @PostMapping(value = "collectData") + @DecryptAndVerify(decryptedClass = QueryParamDto.class) + public ServerResponse collectData(EncryptedReq data) { + return synthesisQueryService.collectData(data.getData()); + } + + /*@PostMapping(value = "getProClassifyStatisticsList") + @DecryptAndVerify(decryptedClass = QueryParamDto.class)//加解密统一管理 + @LogAnnotation(operModul = "综合查询-照片综合查询", operation = "查询照片", operDesc = "系统级事件",operType="查询") + public ServerResponse getProClassifyStatisticsList(EncryptedReq dto) { + PageHelper.startPage(dto.getData().getPageNum(), dto.getData().getPageSize()); + Map map = new HashMap(); + try { + PageInfo pageInfo = synthesisQueryService.getProClassifyStatisticsList(dto.getData()); + return ServerResponse.createSuccessPage(pageInfo, dto.getData().getPage(), dto.getData().getLimit()); + } catch (Exception e) { + log.error(e.toString(), e); + } + return ServerResponse.createErrorPage(dto.getData().getPage(), dto.getData().getLimit()); + }*/ + } diff --git a/src/main/java/com/bonus/imgTool/backstage/dao/SynthesisQueryDao.java b/src/main/java/com/bonus/imgTool/backstage/dao/SynthesisQueryDao.java index 5be6528..2cb4fd4 100644 --- a/src/main/java/com/bonus/imgTool/backstage/dao/SynthesisQueryDao.java +++ b/src/main/java/com/bonus/imgTool/backstage/dao/SynthesisQueryDao.java @@ -34,4 +34,13 @@ public interface SynthesisQueryDao { * @date 2025/3/31 15:56 */ List getImgList(QueryParamDto dto); + + /** + * 收藏/取消收藏图片 + * @param dto + * @return void + * @author cwchen + * @date 2025/4/3 11:16 + */ + void collectData(QueryParamDto dto); } diff --git a/src/main/java/com/bonus/imgTool/backstage/entity/QueryParamDto.java b/src/main/java/com/bonus/imgTool/backstage/entity/QueryParamDto.java index af322b9..6ce9f84 100644 --- a/src/main/java/com/bonus/imgTool/backstage/entity/QueryParamDto.java +++ b/src/main/java/com/bonus/imgTool/backstage/entity/QueryParamDto.java @@ -14,6 +14,8 @@ import java.util.List; @Data public class QueryParamDto { + private Long id; + private String imgPath; /** @@ -34,6 +36,66 @@ public class QueryParamDto { */ private String roleLevel; + /** + * 查询 1.标题查询 2.数量查询 3.高级筛选查询 + */ + private int searchType; + + /** + * 查询 1.安全违章、2.质量检查、3.安全措施落实、4.协调照片、5.重要事项及宣传照片 + */ + private String uploadType; + + /**关键字*/ + private String keyWord; + /**工程ID*/ + private Long proId; + /**专业*/ + private Long majorId; + /**工序*/ + private Long gxId; + /**开始时间*/ + private String startTime; + /**结束时间*/ + private String endTime; + + /**安全违章照片-违章地点*/ + private String vioPlace; + + /**安全违章照片-检查描述*/ + private String vioDesc; + + /**安全违章照片-整改说明*/ + private String rectDesc; + + /**质量检查照片-检查地点*/ + private String checkPlace2; + + /**质量检查照片-检查描述*/ + private String checkDesc2; + + /**质量检查照片-整改说明*/ + private String rectDesc2; + + /**安全措施落实照片-检查地点*/ + private String checkDesc3; + + /**安全措施落实照片-整改说明*/ + private String rectDesc3; + + /**协调照片-建设地点*/ + private String buildPlace; + + /**重要事项及宣传照片-标题*/ + private String title; + + /**照片类型*/ + private List photoType; + /**0.取消收藏 1.收藏*/ + private int collectType; + + private String userName; + private int pageNum = 1; private int pageSize = 15; } diff --git a/src/main/java/com/bonus/imgTool/backstage/service/SynthesisQueryService.java b/src/main/java/com/bonus/imgTool/backstage/service/SynthesisQueryService.java index a076da2..ea4690b 100644 --- a/src/main/java/com/bonus/imgTool/backstage/service/SynthesisQueryService.java +++ b/src/main/java/com/bonus/imgTool/backstage/service/SynthesisQueryService.java @@ -29,4 +29,13 @@ public interface SynthesisQueryService { * @date 2025/3/31 15:47 */ ServerResponse getImgList(QueryParamDto data); + + /** + * 收藏/取消收藏图片 + * @param data + * @return ServerResponse + * @author cwchen + * @date 2025/4/3 11:14 + */ + ServerResponse collectData(QueryParamDto data); } diff --git a/src/main/java/com/bonus/imgTool/backstage/service/impl/SynthesisQueryServiceImpl.java b/src/main/java/com/bonus/imgTool/backstage/service/impl/SynthesisQueryServiceImpl.java index 6cf015e..b8afc30 100644 --- a/src/main/java/com/bonus/imgTool/backstage/service/impl/SynthesisQueryServiceImpl.java +++ b/src/main/java/com/bonus/imgTool/backstage/service/impl/SynthesisQueryServiceImpl.java @@ -15,6 +15,8 @@ import lombok.extern.slf4j.Slf4j; import org.apache.catalina.security.SecurityUtil; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.transaction.interceptor.TransactionAspectSupport; import javax.annotation.Resource; import java.util.*; @@ -66,4 +68,19 @@ public class SynthesisQueryServiceImpl implements SynthesisQueryService { return ServerResponse.createErroe("查询失败"); } } + + @Override + @Transactional(rollbackFor = Exception.class) + public ServerResponse collectData(QueryParamDto dto) { + try { + Long userId = Optional.ofNullable(UserUtil.getLoginUser()).map(LoginUser::getId).orElse(0L); + dto.setUserId(userId); + synthesisQueryDao.collectData(dto); + return ServerResponse.createSuccess("操作成功"); + } catch (Exception e) { + log.error(e.toString(), e); + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return ServerResponse.createErroe("操作失败"); + } + } } diff --git a/src/main/java/com/bonus/imgTool/task/job/ProPullTask.java b/src/main/java/com/bonus/imgTool/task/job/ProPullTask.java index c68b7ea..fcffd50 100644 --- a/src/main/java/com/bonus/imgTool/task/job/ProPullTask.java +++ b/src/main/java/com/bonus/imgTool/task/job/ProPullTask.java @@ -34,7 +34,7 @@ public class ProPullTask { /** * 拉取工程数据 */ - @Scheduled(initialDelay = 6000, fixedDelay = 60000 * 30) +// @Scheduled(initialDelay = 6000, fixedDelay = 60000 * 30) @Async public void getAttTempDataTask() { log.info("--------实名制工程数据拉取定时器开启------"); diff --git a/src/main/resources/mappers/backstage/SynthesisQueryMapper.xml b/src/main/resources/mappers/backstage/SynthesisQueryMapper.xml index 5d6d1a6..a239986 100644 --- a/src/main/resources/mappers/backstage/SynthesisQueryMapper.xml +++ b/src/main/resources/mappers/backstage/SynthesisQueryMapper.xml @@ -47,14 +47,84 @@ WHERE sd2.dict_code = 'file_source_type' ) A ON A.dict_value = sfr.source_type - - AND tcq.pro_id IN - - #{proId} - - + + AND tpc.file_resource_id IS NOT NULL + + + AND tcq.title LIKE CONCAT('%',#{imgPath},'%') + + + + AND tcq.upload_type = #{uploadType} + + + + + + + + AND tcq.pro_id = #{proId} + + + AND tcq.major_id = #{majorId} + + + AND tcq.gx_id = #{gxId} + + + AND DATE_FORMAT(sfr.create_time, '%Y-%m-%d') BETWEEN #{startTime} AND #{endTime} + + + AND INSTR(tcq.vio_place,#{vioPlace}) > 0 AND tcq.upload_type = '1' + + + AND INSTR(tcq.vio_desc,#{vioDesc}) > 0 AND tcq.upload_type = '1' + + + AND INSTR(tcq.rect_desc,#{rectDesc}) > 0 AND tcq.upload_type = '1' + + + AND INSTR(tcq.vio_place,#{checkPlace2}) > 0 AND tcq.upload_type = '2' + + + AND INSTR(tcq.vio_desc,#{checkDesc2}) > 0 AND tcq.upload_type = '2' + + + AND INSTR(tcq.rect_desc,#{rectDesc2}) > 0 AND tcq.upload_type = '2' + + + AND INSTR(tcq.vio_desc,#{checkDesc3}) > 0 AND tcq.upload_type = '3' + + + AND INSTR(tcq.rect_desc,#{rectDesc3}) > 0 AND tcq.upload_type = '3' + + + AND INSTR(tcq.vio_place,#{buildPlace}) > 0 AND tcq.upload_type = '4' + + + AND INSTR(tcq.title,#{title}) > 0 AND tcq.upload_type = '5' + + + + AND tcq.pro_id IN + + #{proId} + + AND tcq.is_active = '1' ORDER BY sfr.create_time DESC + + + + INSERT INTO tb_photo_collect (file_resource_id, collect_user_id,collect_user_name, create_user,create_user_name) + VALUES ( + #{id},#{userId},#{userName},#{userId},#{userName} + ) + + + DELETE FROM tb_photo_collect WHERE file_resource_id = #{id} AND collect_user_id = #{userId} + + diff --git a/src/main/resources/static/js/layui-v2.9.14/layui/rightPopup.js b/src/main/resources/static/js/layui-v2.9.14/layui/rightPopup.js index 735d865..8769e88 100644 --- a/src/main/resources/static/js/layui-v2.9.14/layui/rightPopup.js +++ b/src/main/resources/static/js/layui-v2.9.14/layui/rightPopup.js @@ -4,6 +4,7 @@ layui.define(["layer"], function (exports) { var obj = { rightPopupLayer: function (content, obj,area) { let layerIndex = layer.open({ + id:'highSearchForm', type: 2, title: "高级筛选", offset: ["0px", "100%"], diff --git a/src/main/resources/static/js/synthesisQuery/highSearchForm.js b/src/main/resources/static/js/synthesisQuery/highSearchForm.js index 67da427..a087f60 100644 --- a/src/main/resources/static/js/synthesisQuery/highSearchForm.js +++ b/src/main/resources/static/js/synthesisQuery/highSearchForm.js @@ -1,14 +1,43 @@ -let form, laydate,layer; -function setParams(obj){ - layui.use(["form", 'laydate','layer'], function () { +let form, laydate, layer, highSearchData = {}; + +function setParams(obj) { + highSearchData = JSON.parse(obj); + layui.use(["form", 'laydate', 'layer'], function () { form = layui.form; laydate = layui.laydate; layer = layui.layer; // 日期范围 - 左右面板联动选择模式 laydate.render({ - elem: '#ID-laydate-range-datetime', + elem: '#dateRange', type: 'date', range: true }); + form.val('formInfo', highSearchData); + $.each(highSearchData.photoType,function(index,item){ + $('input[name="photoType"][value='+item+']').prop('checked', true); + }) + layui.form.render(); }); +} + +/**搜索数据*/ +function searchData() { + let data = form.val('formInfo'); + console.error(data) + let checkedValues = []; + $('input[name="photoType"]:checked').each(function () { + checkedValues.push($(this).val()); + }); + data.photoType = checkedValues; + data.startTime = data.dateRange.split(' - ')[0]; + data.endTime = data.dateRange.split(' - ')[1]; + // let frameId = document.getElementById('apply_plan_detail').getElementsByTagName("iframe")[0]; + // frameId.contentWindow.refreshAllData(); + let index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe层的索引 + window.parent.highSearchValue(JSON.stringify(data)); +} + +/**重置数据*/ +function resetData() { + $('#formInfo2')[0].reset(); } \ No newline at end of file diff --git a/src/main/resources/static/js/synthesisQuery/synthesisQuery.js b/src/main/resources/static/js/synthesisQuery/synthesisQuery.js index c9bb004..074d5f7 100644 --- a/src/main/resources/static/js/synthesisQuery/synthesisQuery.js +++ b/src/main/resources/static/js/synthesisQuery/synthesisQuery.js @@ -1,22 +1,27 @@ -let form, laydate, flow,layer,rightPopup; +let form, laydate, flow, layer, rightPopup; let pageNum = 1, pageSize = 15; // 定义分页 let queryType = 2; // 默认最近上传 +let highSearchData = {}; layui.config({ base: "../../js/layui-v2.9.14/layui/", //此处路径请自行处理, 可以使用绝对路径 }).extend({ rightPopup: "rightPopup", -}).use(["form", 'laydate', 'flow','layer','rightPopup'], function () { +}).use(["form", 'laydate', 'flow', 'layer', 'rightPopup'], function () { form = layui.form; laydate = layui.laydate; flow = layui.flow; layer = layui.layer; rightPopup = layui.rightPopup; initImgNum(); - dataFlow(); + dataFlow({ + pageNum: pageNum, + pageSize: pageSize, + queryType: queryType + }); }); /**数据流加载*/ -function dataFlow() { +function dataFlow(queryParams) { flow.load({ elem: '#ID-flow-demo', // 流加载容器 scrollElem: '#ID-flow-demo', // 滚动条所在元素,一般不用填,此处只是演示需要。 @@ -26,7 +31,7 @@ function dataFlow() { console.error(page); pageNum = page; let lis = []; - let returnData = loadData(); + let returnData = loadData(queryParams); if (returnData != null) { lis = initImgData(returnData.data.list) next(lis.join(''), page < returnData.data.total / 15); @@ -44,8 +49,8 @@ function dataFlow() { /*切换查询类型*/ function changeType(type, that) { + resetData(); queryType = type; - pageNum = 1; $(that).removeClass("noCheckedElement"); if ($(that).hasClass("checkedElement") && type === 1) { $(that).next().removeClass("checkedElement").addClass("noCheckedElement"); @@ -58,19 +63,18 @@ function changeType(type, that) { $(that).addClass("checkedElement"); $(that).prev().removeClass("checkedElement").addClass("noCheckedElement"); } - $('#ID-flow-demo').empty(); - dataFlow(); -} - -/**加载图片数据*/ -function loadData() { - let returnData = null; - let url = dataUrl + "/backstage/synthesisQuery/getImgList" - let obj = { + searchData({ pageNum: pageNum, pageSize: pageSize, queryType: queryType - } + }); +} + +/**加载图片数据*/ +function loadData(queryParams) { + let returnData = null; + let url = dataUrl + "/backstage/synthesisQuery/getImgList" + let obj = queryParams; let params = { encryptedData: encryptCBC(JSON.stringify(obj)) } @@ -138,22 +142,16 @@ function initImgData(list) { } // 设置标题 - function setSourceTypeName(item){ - if(item.sourceType === '9'){ + function setSourceTypeName(item) { + if (item.sourceType === '9') { return item.title; - }else{ + } else { return item.sourceTypeName.split('-')[1]; } } } - - - - - - /**收藏*/ function collectImg(that, item, type) { if (type === 0) { // 收藏 @@ -168,14 +166,60 @@ function collectImg(that, item, type) { } /**高级筛选*/ -function highSearch(){ - rightPopup.rightPopupLayer("../../pages/synthesisQuery/highSearchForm.html", JSON.stringify({}),["45%", "100%"]); +function highSearch() { + rightPopup.rightPopupLayer("../../pages/synthesisQuery/highSearchForm.html", JSON.stringify(highSearchData), ["45%", "100%"]); } +/**标题查询*/ +function titleSearch() { + resetData(); + let queryParams = { + pageNum: pageNum, + pageSize: pageSize, + queryType: queryType, + searchType: 1, + uploadType: $('#uploadType').val() + } + searchData(queryParams); +} + + /*图片类型查询*/ -function queryByType(that,type){ - $('.type-num').each(function(){ +function queryByType(that, type) { + resetData(); + $(that).addClass('type-num-check'); + let queryParams = { + pageNum: pageNum, + pageSize: pageSize, + queryType: queryType, + searchType: 2, + uploadType: type + } + searchData(queryParams); +} + +/**高级筛选数据*/ +function highSearchValue(obj) { + resetData(); + highSearchData = JSON.parse(obj); + let queryParams = Object.assign(highSearchData, {}) + queryParams.pageNum = pageNum; + queryParams.pageSize = pageSize; + queryParams.queryType = queryType; + queryParams.searchType = 3; + dataFlow(queryParams); +} + +// 查询数据 +function searchData(queryParams) { + $('#ID-flow-demo').empty(); + dataFlow(queryParams); +} + +/**重置基本数据*/ +function resetData(){ + pageNum = 1; + $('.type-num').each(function () { $(this).removeClass('type-num-check'); }) - $(that).addClass('type-num-check'); } diff --git a/src/main/resources/static/pages/synthesisQuery/highSearchForm.html b/src/main/resources/static/pages/synthesisQuery/highSearchForm.html index 3232ea7..cf6ff25 100644 --- a/src/main/resources/static/pages/synthesisQuery/highSearchForm.html +++ b/src/main/resources/static/pages/synthesisQuery/highSearchForm.html @@ -16,8 +16,8 @@
-
-
+
+
通用信息查询
@@ -25,13 +25,14 @@
- +
-
@@ -40,7 +41,7 @@
- +
@@ -48,13 +49,13 @@
- +
- +
@@ -65,28 +66,28 @@
- - + +
- +
- +
- +
- +
@@ -97,14 +98,14 @@
- - + +
- +
@@ -112,13 +113,13 @@
- +
- +
@@ -130,13 +131,13 @@
- +
- +
@@ -147,15 +148,15 @@
- - - + + +
- +
@@ -166,16 +167,16 @@
- +
- +
- - + +
diff --git a/src/main/resources/static/pages/synthesisQuery/synthesisQuery.html b/src/main/resources/static/pages/synthesisQuery/synthesisQuery.html index 767b4d9..f77db89 100644 --- a/src/main/resources/static/pages/synthesisQuery/synthesisQuery.html +++ b/src/main/resources/static/pages/synthesisQuery/synthesisQuery.html @@ -21,10 +21,10 @@
-
- +