From 3003569c1ffba644ffdcd2d354c8c01881560c42 Mon Sep 17 00:00:00 2001 From: cwchen <1048842385@qq.com> Date: Fri, 16 May 2025 11:28:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E5=A1=AB=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/screen/vo/WorkReportVo.java | 30 ++++++++++ .../interceptor/ParamSecureHandler.java | 25 +++------ .../controller/WorkReportController.java | 45 +++++++++++++++ .../screen/mapper/IWorkReportMapper.java | 35 ++++++++++++ .../screen/service/IWorkReportService.java | 34 +++++++++++ .../service/impl/WorkReportServiceImpl.java | 56 +++++++++++++++++++ .../resources/mapper/WorkReportMapper.xml | 27 +++++++++ 7 files changed, 236 insertions(+), 16 deletions(-) create mode 100644 securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/screen/vo/WorkReportVo.java create mode 100644 securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/controller/WorkReportController.java create mode 100644 securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/mapper/IWorkReportMapper.java create mode 100644 securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/IWorkReportService.java create mode 100644 securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/impl/WorkReportServiceImpl.java create mode 100644 securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/WorkReportMapper.xml diff --git a/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/screen/vo/WorkReportVo.java b/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/screen/vo/WorkReportVo.java new file mode 100644 index 0000000..38f2273 --- /dev/null +++ b/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/screen/vo/WorkReportVo.java @@ -0,0 +1,30 @@ +package com.securitycontrol.entity.screen.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; + +/** + * @className:WorkReportVo + * @author:cwchen + * @date:2025-05-16-9:17 + * @version:1.0 + * @description:工作完成情况填报-vo + */ +@Data +public class WorkReportVo { + + private String id; + + private String workContent; + + @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8") + private Date workDate; + + private String completionStatus; + + private String fillStatus; + + private Date fillTime = new Date(); +} diff --git a/securitycontrol-commons/securitycontrol-commons-security/src/main/java/com/securitycontrol/common/security/interceptor/ParamSecureHandler.java b/securitycontrol-commons/securitycontrol-commons-security/src/main/java/com/securitycontrol/common/security/interceptor/ParamSecureHandler.java index 17ca85c..50d96d0 100644 --- a/securitycontrol-commons/securitycontrol-commons-security/src/main/java/com/securitycontrol/common/security/interceptor/ParamSecureHandler.java +++ b/securitycontrol-commons/securitycontrol-commons-security/src/main/java/com/securitycontrol/common/security/interceptor/ParamSecureHandler.java @@ -66,7 +66,7 @@ public class ParamSecureHandler implements AsyncHandlerInterceptor { public static String[] SC_URL= new String[]{"/app/index/","/largeScreen/accessMge/", "/largeScreen/alarmMge/","/largeScreen/constructionQuality/","/largeScreen/operatingEnvironment/", "/largeScreen/personnelControl/","/largeScreen/scIndex/","/largeScreen/towerAssInspect/", - "/largeScreen/video/","/largeScreen/xcIndex/","/largeScreen/dataAnalysis/","/largeScreen/constrDisplay/"}; + "/largeScreen/video/","/largeScreen/xcIndex/","/largeScreen/dataAnalysis/","/largeScreen/workReport/","/largeScreen/constrDisplay/"}; private final String whiteURL = "http://127.0.0.1:18080/"; @@ -103,23 +103,20 @@ public class ParamSecureHandler implements AsyncHandlerInterceptor { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { try{ - - if (!checkIsYq(request)) { returnJson(response, "越权访问,接口未授权", 401); return false; } }catch (Exception e){ returnJson(response, "令牌不能为空", 401); - return false; } // 过滤文件上传功能 if(isFileUpload(request)){ return true; } XssRequestWrapper requestWrapper = new XssRequestWrapper(request); - // System.out.println("进入了拦截器"); - // System.err.println(request.getRequestURI()); + System.out.println("进入了拦截器"); + System.err.println(request.getRequestURI()); String requestUrl = requestWrapper.getRequestURI(); /** @@ -144,7 +141,7 @@ public class ParamSecureHandler implements AsyncHandlerInterceptor { return false; } - // System.err.println(JSON.toJSONString(request.getParameterMap())); + System.err.println(JSON.toJSONString(request.getParameterMap())); /** * 获取所有跳转路径参数,保留传入下个界面 */ @@ -165,8 +162,8 @@ public class ParamSecureHandler implements AsyncHandlerInterceptor { */ String readerParam = requestWrapper.getReaderParam(); // 判断是否是文件上传,是不对流参数进行验证 - String uplFile = "uploadFile", upImage = "uploadImage", path="pushImageData"; - if (!requestUrl.contains(uplFile) && !requestUrl.contains(upImage) && !requestUrl.contains(path)) { + String uplFile = "uploadFile", upImage = "uploadImage"; + if (!requestUrl.contains(uplFile) && !requestUrl.contains(upImage)) { boolean checkReader = checkReader(readerParam, requestUrl); if (!checkReader) { returnJson(response, "请求重复", 500); @@ -205,12 +202,8 @@ public class ParamSecureHandler implements AsyncHandlerInterceptor { if(SecurityConstants.INNER.equals(head)){ return true; } + String requestUri = request.getRequestURI(); - if(requestUri.contains("files") || requestUri.contains("file")){ - return true; - } - - if(Arrays.asList(WHITE_URLS).contains(requestUri)){ return true; } @@ -238,7 +231,7 @@ public class ParamSecureHandler implements AsyncHandlerInterceptor { } } } - // System.out.println("==================越狱记录:========================userId:" + userId + "============是否越狱:" + result); + System.out.println("==================越狱记录:========================userId:" + userId + "============是否越狱:" + result); } if (!result) { addExceedsAccessLog(requestUri, token); @@ -431,7 +424,7 @@ public class ParamSecureHandler implements AsyncHandlerInterceptor { */ private boolean checkReader(String readerParam, String requestUrl) { if (SafeUtil.checkScript(readerParam)) { - // log.info("请求失败,当前请求参数不安全!请求地址:\n" + requestUrl + "\n不安全参数:数据流:" + readerParam); + log.info("请求失败,当前请求参数不安全!请求地址:\n" + requestUrl + "\n不安全参数:数据流:" + readerParam); return false; } return true; diff --git a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/controller/WorkReportController.java b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/controller/WorkReportController.java new file mode 100644 index 0000000..4be23de --- /dev/null +++ b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/controller/WorkReportController.java @@ -0,0 +1,45 @@ +package com.securitycontrol.screen.controller; + +import com.securitycontrol.common.core.web.controller.BaseController; +import com.securitycontrol.common.core.web.domain.AjaxResult; +import com.securitycontrol.common.core.web.page.TableDataInfo; +import com.securitycontrol.common.log.annotation.Log; +import com.securitycontrol.common.log.enums.OperationType; +import com.securitycontrol.entity.screen.dto.ScreenParamDto; +import com.securitycontrol.entity.screen.vo.WorkReportVo; +import com.securitycontrol.screen.service.IWorkReportService; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * @className:WorkReportController + * @author:cwchen + * @date:2025-05-15-19:42 + * @version:1.0 + * @description:工作完成情况填报 + */ +@RestController +@RequestMapping("/largeScreen/workReport/") +public class WorkReportController extends BaseController { + + @Resource(name = "IWorkReportService") + private IWorkReportService service; + + @ApiOperation(value = "工作完成情况填报列表") + @GetMapping("getWorkLists") + @Log(title = "工作完成情况填报列表", menu = "工作完成情况填报->工作完成情况填报列表", grade = OperationType.QUERY_BUSINESS, details = "查询告警管理列表", type = "业务日志") + public TableDataInfo getWorkLists(ScreenParamDto dto) { + startLayPage(); + List list = service.getWorkLists(dto); + return getDataTableLayui(list); + } + + @ApiOperation(value = "填报工作情况") + @PostMapping("fillWorkSituation") + public AjaxResult fillWorkSituation(@RequestBody WorkReportVo vo){ + return service.fillWorkSituation(vo); + } +} diff --git a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/mapper/IWorkReportMapper.java b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/mapper/IWorkReportMapper.java new file mode 100644 index 0000000..e6e0851 --- /dev/null +++ b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/mapper/IWorkReportMapper.java @@ -0,0 +1,35 @@ +package com.securitycontrol.screen.mapper; + +import com.securitycontrol.entity.screen.dto.ScreenParamDto; +import com.securitycontrol.entity.screen.vo.WorkReportVo; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * @className:IWorkReportMapper + * @author:cwchen + * @date:2025-05-15-19:43 + * @version:1.0 + * @description:工作完成情况-数据层 + */ +@Repository("IWorkReportMapper") +public interface IWorkReportMapper { + /** + * 工作完成情况填报列表 + * @param dto + * @return List + * @author cwchen + * @date 2025/5/16 9:20 + */ + List getWorkLists(ScreenParamDto dto); + + /** + * 填写工作情况 + * @param vo + * @return void + * @author cwchen + * @date 2025/5/16 9:40 + */ + void fillWorkSituation(WorkReportVo vo); +} diff --git a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/IWorkReportService.java b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/IWorkReportService.java new file mode 100644 index 0000000..09f1e2a --- /dev/null +++ b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/IWorkReportService.java @@ -0,0 +1,34 @@ +package com.securitycontrol.screen.service; + +import com.securitycontrol.common.core.web.domain.AjaxResult; +import com.securitycontrol.entity.screen.dto.ScreenParamDto; +import com.securitycontrol.entity.screen.vo.WorkReportVo; + +import java.util.List; + +/** + * @className:WorkReportService + * @author:cwchen + * @date:2025-05-15-19:42 + * @version:1.0 + * @description:工作完成情况填报-业务层 + */ +public interface IWorkReportService { + /** + * 工作完成情况填报列表 + * @param dto + * @return List + * @author cwchen + * @date 2025/5/16 9:18 + */ + List getWorkLists(ScreenParamDto dto); + + /** + * 填报工作情况 + * @param vo + * @return AjaxResult + * @author cwchen + * @date 2025/5/16 9:37 + */ + AjaxResult fillWorkSituation(WorkReportVo vo); +} diff --git a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/impl/WorkReportServiceImpl.java b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/impl/WorkReportServiceImpl.java new file mode 100644 index 0000000..3b8a4d2 --- /dev/null +++ b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/impl/WorkReportServiceImpl.java @@ -0,0 +1,56 @@ +package com.securitycontrol.screen.service.impl; + +import com.securitycontrol.common.core.web.domain.AjaxResult; +import com.securitycontrol.entity.screen.dto.ScreenParamDto; +import com.securitycontrol.entity.screen.vo.WorkReportVo; +import com.securitycontrol.screen.mapper.IWorkReportMapper; +import com.securitycontrol.screen.service.IWorkReportService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.transaction.interceptor.TransactionAspectSupport; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +/** + * @className:WorkReportServiceImpl + * @author:cwchen + * @date:2025-05-15-19:43 + * @version:1.0 + * @description:工作完成情况填报-业务逻辑层 + */ +@Service(value = "IWorkReportService") +@Slf4j +public class WorkReportServiceImpl implements IWorkReportService { + + @Resource(name = "IWorkReportMapper") + private IWorkReportMapper mapper; + + @Override + public List getWorkLists(ScreenParamDto dto) { + List list = null; + try { + list = Optional.ofNullable(mapper.getWorkLists(dto)).orElseGet(ArrayList::new); + return list; + } catch (Exception e) { + log.error(e.toString(),e); + return new ArrayList<>(); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public AjaxResult fillWorkSituation(WorkReportVo vo) { + try { + mapper.fillWorkSituation(vo); + return AjaxResult.success("操作成功"); + } catch (Exception e) { + log.error(e.toString(), e); + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return AjaxResult.error("操作失败"); + } + } +} diff --git a/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/WorkReportMapper.xml b/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/WorkReportMapper.xml new file mode 100644 index 0000000..ead1e00 --- /dev/null +++ b/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/WorkReportMapper.xml @@ -0,0 +1,27 @@ + + + + + + INSERT INTO jj_class_completion(class_id,completion_status,fill_time) VALUES ( + #{id},#{completionStatus},#{fillTime} + ) + + + + + + \ No newline at end of file