From da8aa4362afa4ae382a7a14a780a1a77c19c010f Mon Sep 17 00:00:00 2001 From: haozq <1611483981@qq.com> Date: Sat, 8 Feb 2025 14:08:20 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/bonus/common/log/aspect/LogAspect.java | 2 +- .../java/com/bonus/job/service/SysJobServiceImpl.java | 8 ++++---- .../resources/mapper/system/DeviceInformationMapper.xml | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/bonus-common/bonus-common-log/src/main/java/com/bonus/common/log/aspect/LogAspect.java b/bonus-common/bonus-common-log/src/main/java/com/bonus/common/log/aspect/LogAspect.java index 57af62d..fb8c4ab 100644 --- a/bonus-common/bonus-common-log/src/main/java/com/bonus/common/log/aspect/LogAspect.java +++ b/bonus-common/bonus-common-log/src/main/java/com/bonus/common/log/aspect/LogAspect.java @@ -136,7 +136,7 @@ public class LogAspect sysLogsVo.setOperaUserName(username); } Long userId = SecurityUtils.getUserId(); - if (userId!=null && userId!=0l) { + if (userId!=null && userId!=0L) { sysLogsVo.setUserId(userId.toString()); } sysLogsVo.setOperaUri(StringUtils.substring(ServletUtils.getRequest().getRequestURI(), 0, 255)); diff --git a/bonus-modules/bonus-job/src/main/java/com/bonus/job/service/SysJobServiceImpl.java b/bonus-modules/bonus-job/src/main/java/com/bonus/job/service/SysJobServiceImpl.java index 0fecd9f..4f166a8 100644 --- a/bonus-modules/bonus-job/src/main/java/com/bonus/job/service/SysJobServiceImpl.java +++ b/bonus-modules/bonus-job/src/main/java/com/bonus/job/service/SysJobServiceImpl.java @@ -377,9 +377,9 @@ public class SysJobServiceImpl implements ISysJobService { } else if (date.compareTo(delayTime) > 0 && "2".equals(item.getIsCheck())) { item.setCheckStatus("8"); } else if (date.compareTo(delayTime) <= 0 && !"2".equals(item.getIsCheck())) { - item.setCheckStatus("7"); - } else if (date.compareTo(delayTime) > 0 && !"2".equals(item.getIsCheck())) { item.setCheckStatus("3"); + } else if (date.compareTo(delayTime) > 0 && !"2".equals(item.getIsCheck())) { + item.setCheckStatus("7"); } } else { //判断整改时间是否大于当前时间 @@ -387,9 +387,9 @@ public class SysJobServiceImpl implements ISysJobService { item.setCheckStatus("2"); } else if (date.compareTo(correctionTime) > 0 && "2".equals(item.getIsCheck())) { item.setCheckStatus("6"); - } else if (date.compareTo(correctionTime) <= 0 && !"2".equals(item.getIsCheck())) { - item.setCheckStatus("5"); } else if (date.compareTo(correctionTime) > 0 && !"2".equals(item.getIsCheck())) { + item.setCheckStatus("5"); + } else if (date.compareTo(correctionTime) <= 0 && !"2".equals(item.getIsCheck())) { item.setCheckStatus("1"); } } diff --git a/bonus-modules/bonus-project/src/main/resources/mapper/system/DeviceInformationMapper.xml b/bonus-modules/bonus-project/src/main/resources/mapper/system/DeviceInformationMapper.xml index 4a0da97..9a6c72d 100644 --- a/bonus-modules/bonus-project/src/main/resources/mapper/system/DeviceInformationMapper.xml +++ b/bonus-modules/bonus-project/src/main/resources/mapper/system/DeviceInformationMapper.xml @@ -43,7 +43,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" pdi.device_phone AS devicePhone, pdi.create_user AS createUser, pdi.create_time AS createTime, - pdi.puid,pdi.type_code typeCode, + pdi.puid, pdi.device_status deviceStatus, + pdi.type_code typeCode, pdi.ball_index as ballIndex, if(ppi.pro_name IS NULL, '无', ppi.pro_name) AS proName FROM From 133041bf6d9915008d7b2533656f084128610aeb Mon Sep 17 00:00:00 2001 From: haozq <1611483981@qq.com> Date: Sat, 8 Feb 2025 17:50:59 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../handler/GlobalExceptionHandler.java | 5 ++++ .../main/java/com/bonus/job/task/RyTask.java | 2 +- .../AdmissionRequestController.java | 4 +-- .../service/impl/ImportServiceImpl.java | 3 ++- .../ProMaterialManagementServiceImpl.java | 14 ++++++---- .../mapper/system/AdmissionRequestMapper.xml | 2 ++ .../service/impl/SysUserServiceImpl.java | 27 ++++++------------- 7 files changed, 28 insertions(+), 29 deletions(-) diff --git a/bonus-common/bonus-common-security/src/main/java/com/bonus/common/security/handler/GlobalExceptionHandler.java b/bonus-common/bonus-common-security/src/main/java/com/bonus/common/security/handler/GlobalExceptionHandler.java index aa06f49..7fb3245 100644 --- a/bonus-common/bonus-common-security/src/main/java/com/bonus/common/security/handler/GlobalExceptionHandler.java +++ b/bonus-common/bonus-common-security/src/main/java/com/bonus/common/security/handler/GlobalExceptionHandler.java @@ -32,6 +32,8 @@ public class GlobalExceptionHandler public final static String BODY_ERROR="Required request body is missing:"; public final static String DATA_ERROR="Data truncation: Data too long for"; + + private final static String TRANS_ERR="Transaction rolled back because it has been marked as rollback-only"; /** * 权限码异常 */ @@ -112,6 +114,9 @@ public class GlobalExceptionHandler if (msg.contains(DATA_ERROR)){ return AjaxResult.error("数据长度过长"); } + if(msg.contains(TRANS_ERR)){ + return AjaxResult.error("操作失败,请检查数据是否正确!"); + } } String requestUri = request.getRequestURI(); log.error("请求地址'{}',发生未知异常.", requestUri, e); diff --git a/bonus-modules/bonus-job/src/main/java/com/bonus/job/task/RyTask.java b/bonus-modules/bonus-job/src/main/java/com/bonus/job/task/RyTask.java index 8486613..18518b2 100644 --- a/bonus-modules/bonus-job/src/main/java/com/bonus/job/task/RyTask.java +++ b/bonus-modules/bonus-job/src/main/java/com/bonus/job/task/RyTask.java @@ -188,8 +188,8 @@ public class RyTask } } - public void updateHiddenDangerStatus() { + public void updateHiddenDangerStatus() { sysJobService.updateHiddenDangerStatus(); } diff --git a/bonus-modules/bonus-project/src/main/java/com/bonus/project/controller/AdmissionRequestController.java b/bonus-modules/bonus-project/src/main/java/com/bonus/project/controller/AdmissionRequestController.java index f7c855a..64f58f1 100644 --- a/bonus-modules/bonus-project/src/main/java/com/bonus/project/controller/AdmissionRequestController.java +++ b/bonus-modules/bonus-project/src/main/java/com/bonus/project/controller/AdmissionRequestController.java @@ -117,9 +117,7 @@ public class AdmissionRequestController extends BaseController { try { String params = allRequestParams.get("params"); org.json.JSONObject jsonObject = new org.json.JSONObject(params); - if (!arService.checkUserTypeNameUnique(allRequestParams)){ - return toAjax(arService.addMataddAdmissionRequesterial(facePhotoList, medicalExaminationList, elseImgList, specialTypeOfWorkList, otherFilesList, allRequestParams)); - }else { + if (arService.checkUserTypeNameUnique(allRequestParams)){ arService.addUserName(allRequestParams); } return toAjax(arService.addMataddAdmissionRequesterial(facePhotoList, medicalExaminationList, elseImgList, specialTypeOfWorkList, otherFilesList, allRequestParams)); diff --git a/bonus-modules/bonus-project/src/main/java/com/bonus/project/service/impl/ImportServiceImpl.java b/bonus-modules/bonus-project/src/main/java/com/bonus/project/service/impl/ImportServiceImpl.java index cedb82a..5512d01 100644 --- a/bonus-modules/bonus-project/src/main/java/com/bonus/project/service/impl/ImportServiceImpl.java +++ b/bonus-modules/bonus-project/src/main/java/com/bonus/project/service/impl/ImportServiceImpl.java @@ -215,9 +215,10 @@ public class ImportServiceImpl implements ImportService { ajaxResult.put("result","此zip内文件在系统内无对应人员,导入失败!"); } } catch (Exception e) { + log.error(e.toString(),e); ajaxResult.isError(); -// throw new Exception("文件上传失败"+e); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return AjaxResult.error("导入模板不正确"); } return ajaxResult; diff --git a/bonus-modules/bonus-project/src/main/java/com/bonus/project/service/impl/ProMaterialManagementServiceImpl.java b/bonus-modules/bonus-project/src/main/java/com/bonus/project/service/impl/ProMaterialManagementServiceImpl.java index b3f193f..e16fd94 100644 --- a/bonus-modules/bonus-project/src/main/java/com/bonus/project/service/impl/ProMaterialManagementServiceImpl.java +++ b/bonus-modules/bonus-project/src/main/java/com/bonus/project/service/impl/ProMaterialManagementServiceImpl.java @@ -7,6 +7,8 @@ import com.bonus.project.mapper.ProMaterialManagementMapper; import com.bonus.project.service.ProMaterialManagementService; import com.bonus.system.api.RemoteFileService; import com.bonus.system.api.domain.SysFile; +import lombok.extern.slf4j.Slf4j; +import org.hibernate.validator.internal.util.StringHelper; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; @@ -22,6 +24,7 @@ import java.util.List; * Description:工程资料管理 逻辑处理层 */ @Service +@Slf4j public class ProMaterialManagementServiceImpl implements ProMaterialManagementService { @Resource private ProMaterialManagementMapper mapper; @@ -62,7 +65,6 @@ public class ProMaterialManagementServiceImpl implements ProMaterialManagementSe @Transactional(rollbackFor = Exception.class) public int engineeringMaterialUpload(MultipartFile[] fileList, String proId, String uploadType) { int code = 0; - for (MultipartFile file : fileList) { try { // 获取文件名 @@ -72,12 +74,14 @@ public int engineeringMaterialUpload(MultipartFile[] fileList, String proId, Str // 获取文件路径 R fileResult = remoteFileService.upload(file); if (fileResult == null || fileResult.getData() == null) { - throw new RuntimeException("Failed to upload file"); + throw new RuntimeException("文件上传异常"); } String materialPath = fileResult.getData().getUrl(); - // 保存文件信息 ProMaterialManagement bean = new ProMaterialManagement(); + if(StringHelper.isNullOrEmptyString(proId) || "undefined".equals(proId)){ + throw new RuntimeException("未选择工程"); + } bean.setProId(Long.valueOf(proId)); bean.setMaterialName(materialName); bean.setMaterialSize(Long.toString(materialSize)); @@ -85,10 +89,10 @@ public int engineeringMaterialUpload(MultipartFile[] fileList, String proId, Str bean.setMaterialType(uploadType); bean.setCreateName(SecurityUtils.getUsername()); bean.setCreateUser(SecurityUtils.getUserId()); - code += mapper.insertProMaterial(bean); } catch (Exception e) { - throw new RuntimeException("Failed to add upload file due to exception", e); + log.error(e.toString(),e); + throw new RuntimeException("文件上传入库失败", e); } } diff --git a/bonus-modules/bonus-project/src/main/resources/mapper/system/AdmissionRequestMapper.xml b/bonus-modules/bonus-project/src/main/resources/mapper/system/AdmissionRequestMapper.xml index fd027a8..b93399d 100644 --- a/bonus-modules/bonus-project/src/main/resources/mapper/system/AdmissionRequestMapper.xml +++ b/bonus-modules/bonus-project/src/main/resources/mapper/system/AdmissionRequestMapper.xml @@ -432,6 +432,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" FROM sys_user WHERE phonenumber = #{phone} AND del_flag = '0' + limit 1