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