Showing
20 changed files
with
267 additions
and
53 deletions
| ... | @@ -12,10 +12,10 @@ public interface CustomerConstant { | ... | @@ -12,10 +12,10 @@ public interface CustomerConstant { |
| 12 | * @Date 2024/11/12 | 12 | * @Date 2024/11/12 |
| 13 | */ | 13 | */ |
| 14 | interface VALIDATE_KEYS{ | 14 | interface VALIDATE_KEYS{ |
| 15 | - //最大上传文件个数50哥 | 15 | + //最大上传文件个数100个 |
| 16 | - Integer UPLOAD_FILE_MAX_TOTAL = 50; | 16 | + Integer UPLOAD_FILE_MAX_TOTAL = 100; |
| 17 | - //最大上传总文件大小50M | 17 | + //最大上传总文件大小95M |
| 18 | - Integer UPLOAD_FILE_MAX_SIZE = 50 * 1024 * 1024; | 18 | + Integer UPLOAD_FILE_MAX_SIZE = 95 * 1024 * 1024; |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | } | 21 | } | ... | ... |
| ... | @@ -8,7 +8,7 @@ import java.util.List; | ... | @@ -8,7 +8,7 @@ import java.util.List; |
| 8 | @Data | 8 | @Data |
| 9 | public class ConsignmentBo { | 9 | public class ConsignmentBo { |
| 10 | //运单id | 10 | //运单id |
| 11 | - private Integer id; | 11 | + private Long consignmentId; |
| 12 | //运单号 | 12 | //运单号 |
| 13 | @BaseNotBlank(describe = "business_field_31003") | 13 | @BaseNotBlank(describe = "business_field_31003") |
| 14 | private String consignmentCode; | 14 | private String consignmentCode; | ... | ... |
| ... | @@ -16,6 +16,8 @@ public class UserConsignmentInfoQuery { | ... | @@ -16,6 +16,8 @@ public class UserConsignmentInfoQuery { |
| 16 | private String userUuid; | 16 | private String userUuid; |
| 17 | //运单id | 17 | //运单id |
| 18 | private Long consignmentId; | 18 | private Long consignmentId; |
| 19 | + //用户shipperaccount | ||
| 20 | + private String shipperAccount; | ||
| 19 | 21 | ||
| 20 | /** | 22 | /** |
| 21 | * @Author mt | 23 | * @Author mt |
| ... | @@ -30,6 +32,7 @@ public class UserConsignmentInfoQuery { | ... | @@ -30,6 +32,7 @@ public class UserConsignmentInfoQuery { |
| 30 | userConsignmentInfoQuery.setUserId(user.getId()); | 32 | userConsignmentInfoQuery.setUserId(user.getId()); |
| 31 | userConsignmentInfoQuery.setUserUuid(user.getUserUuid()); | 33 | userConsignmentInfoQuery.setUserUuid(user.getUserUuid()); |
| 32 | userConsignmentInfoQuery.setConsignmentId(consignmentId); | 34 | userConsignmentInfoQuery.setConsignmentId(consignmentId); |
| 35 | + userConsignmentInfoQuery.setShipperAccount(user.getAccountNo()); | ||
| 33 | return userConsignmentInfoQuery; | 36 | return userConsignmentInfoQuery; |
| 34 | } | 37 | } |
| 35 | } | 38 | } | ... | ... |
| ... | @@ -30,6 +30,7 @@ public enum ResponseCode { | ... | @@ -30,6 +30,7 @@ public enum ResponseCode { |
| 30 | MESSAGE_CODE_30010(30010,"business_exception_30010"), | 30 | MESSAGE_CODE_30010(30010,"business_exception_30010"), |
| 31 | MESSAGE_CODE_30011(30011,"business_exception_30011"), | 31 | MESSAGE_CODE_30011(30011,"business_exception_30011"), |
| 32 | MESSAGE_CODE_30012(30012,"business_exception_30012"), | 32 | MESSAGE_CODE_30012(30012,"business_exception_30012"), |
| 33 | + MESSAGE_CODE_30013(30013,"business_exception_30013"), | ||
| 33 | 34 | ||
| 34 | /******打个样,编写样例*****/ | 35 | /******打个样,编写样例*****/ |
| 35 | // MESSAGE_CODE_30001(30001,"business_exception_30001"), | 36 | // MESSAGE_CODE_30001(30001,"business_exception_30001"), | ... | ... |
| 1 | package com.fedex.connect.customer.repository.base; | 1 | package com.fedex.connect.customer.repository.base; |
| 2 | 2 | ||
| 3 | +import com.fedex.connect.common.dao.biz.ConsignmentMapper; | ||
| 3 | import com.fedex.connect.customer.repository.dao.AttachmentExtMapper; | 4 | import com.fedex.connect.customer.repository.dao.AttachmentExtMapper; |
| 4 | import com.fedex.connect.customer.repository.dao.ConsignmentExtMapper; | 5 | import com.fedex.connect.customer.repository.dao.ConsignmentExtMapper; |
| 5 | import org.springframework.beans.factory.annotation.Autowired; | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| 6 | 7 | ||
| 7 | public class BaseDao { | 8 | public class BaseDao { |
| 8 | @Autowired | 9 | @Autowired |
| 10 | + public ConsignmentMapper consignmentMapper; | ||
| 11 | + @Autowired | ||
| 9 | public ConsignmentExtMapper consignmentExtMapper; | 12 | public ConsignmentExtMapper consignmentExtMapper; |
| 10 | @Autowired | 13 | @Autowired |
| 11 | public AttachmentExtMapper attachmentExtMapper; | 14 | public AttachmentExtMapper attachmentExtMapper; | ... | ... |
| ... | @@ -26,6 +26,7 @@ public interface ConsignmentExtMapper { | ... | @@ -26,6 +26,7 @@ public interface ConsignmentExtMapper { |
| 26 | Consignment findByConsignmentCode(@Param("consignmentCode") String consignmentCode, @Param("dateParam") LocalDate dateParam); | 26 | Consignment findByConsignmentCode(@Param("consignmentCode") String consignmentCode, @Param("dateParam") LocalDate dateParam); |
| 27 | 27 | ||
| 28 | @Select("SELECT BC.* FROM T_BIZ_CONSIGNMENT BC INNER JOIN T_BIZ_USER_CONSIGNMENT_MAPPING BUCM ON(BC.ID = BUCM.CONSIGNMENT_ID) " + | 28 | @Select("SELECT BC.* FROM T_BIZ_CONSIGNMENT BC INNER JOIN T_BIZ_USER_CONSIGNMENT_MAPPING BUCM ON(BC.ID = BUCM.CONSIGNMENT_ID) " + |
| 29 | - "WHERE BC.ID = #{query.consignmentId} AND (BC.USER_UUID = #{query.userUuid} AND BUCM.USER_ID = #{query.userId})") | 29 | + "WHERE BC.ID = #{query.consignmentId} AND (BC.USER_UUID = #{query.userUuid} OR BUCM.USER_ID = #{query.userId})") |
| 30 | Consignment findConsignmentInfo(@Param("query") UserConsignmentInfoQuery query); | 30 | Consignment findConsignmentInfo(@Param("query") UserConsignmentInfoQuery query); |
| 31 | + | ||
| 31 | } | 32 | } | ... | ... |
| ... | @@ -10,6 +10,8 @@ import java.time.LocalDate; | ... | @@ -10,6 +10,8 @@ import java.time.LocalDate; |
| 10 | import java.util.List; | 10 | import java.util.List; |
| 11 | 11 | ||
| 12 | public interface IConsignmentRepository { | 12 | public interface IConsignmentRepository { |
| 13 | + Consignment findById(Long id); | ||
| 14 | + | ||
| 13 | List<FindConsignmentsDto> findConsignments(ConsignmentQuery query, User user); | 15 | List<FindConsignmentsDto> findConsignments(ConsignmentQuery query, User user); |
| 14 | 16 | ||
| 15 | Long findAllCount(ConsignmentQuery query); | 17 | Long findAllCount(ConsignmentQuery query); | ... | ... |
| ... | @@ -16,6 +16,16 @@ import java.util.List; | ... | @@ -16,6 +16,16 @@ import java.util.List; |
| 16 | 16 | ||
| 17 | @Repository | 17 | @Repository |
| 18 | public class ConsignmentRepositoryImpl extends BaseDao implements IConsignmentRepository { | 18 | public class ConsignmentRepositoryImpl extends BaseDao implements IConsignmentRepository { |
| 19 | + /** | ||
| 20 | + * @Author mt | ||
| 21 | + * @Description 根据运单ID查找运单信息 | ||
| 22 | + * @Date 2024/11/18 | ||
| 23 | + * @param id | ||
| 24 | + * @return com.fedex.connect.common.model.biz.Consignment | ||
| 25 | + */ | ||
| 26 | + public Consignment findById(Long id){ | ||
| 27 | + return consignmentMapper.selectByPrimaryKey(id); | ||
| 28 | + } | ||
| 19 | 29 | ||
| 20 | /** | 30 | /** |
| 21 | * @Author Szl | 31 | * @Author Szl | ... | ... |
| ... | @@ -7,5 +7,10 @@ import org.springframework.web.multipart.MultipartFile; | ... | @@ -7,5 +7,10 @@ import org.springframework.web.multipart.MultipartFile; |
| 7 | import java.util.List; | 7 | import java.util.List; |
| 8 | 8 | ||
| 9 | public interface IAttachmentService { | 9 | public interface IAttachmentService { |
| 10 | - List<Attachment> uploadAttachments(MultipartFile[] files,List<String> fileBizTypeList, User user); | 10 | + List<Attachment> uploadAttachments(MultipartFile[] files, |
| 11 | + List<String> attachmentBizTypeList, | ||
| 12 | + User user, | ||
| 13 | + String consignmentCode); | ||
| 14 | + | ||
| 15 | + void deleteAttachments(List<Attachment> attachmentList); | ||
| 11 | } | 16 | } | ... | ... |
| ... | @@ -25,22 +25,42 @@ public class AttachmentServiceImpl extends BaseService implements IAttachmentSer | ... | @@ -25,22 +25,42 @@ public class AttachmentServiceImpl extends BaseService implements IAttachmentSer |
| 25 | 25 | ||
| 26 | /** | 26 | /** |
| 27 | * @Author mt | 27 | * @Author mt |
| 28 | + * @Description 删除已存在的附件 | ||
| 29 | + * @Date 2024/11/15 | ||
| 30 | + * @param attachmentList | ||
| 31 | + * @return void | ||
| 32 | + */ | ||
| 33 | + public void deleteAttachments(List<Attachment> attachmentList){ | ||
| 34 | + attachmentUtil.deleteAttachments(attachmentList); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * @Author mt | ||
| 28 | * @Description 文件上传到服务器,并且生成附件实体返回 | 39 | * @Description 文件上传到服务器,并且生成附件实体返回 |
| 29 | - * 除运单ID、运单号、用户上传记录表ID,其他参数会返回 | 40 | + * 除运单ID、用户上传记录表ID,其他参数会返回 |
| 30 | * @Date 2024/11/12 | 41 | * @Date 2024/11/12 |
| 31 | * @param files | 42 | * @param files |
| 32 | * @param attachmentBizTypeList | 43 | * @param attachmentBizTypeList |
| 33 | * @param user | 44 | * @param user |
| 34 | * @return void | 45 | * @return void |
| 35 | */ | 46 | */ |
| 36 | - public List<Attachment> uploadAttachments(MultipartFile[] files,List<String> attachmentBizTypeList,User user){ | 47 | + public List<Attachment> uploadAttachments(MultipartFile[] files, |
| 48 | + List<String> attachmentBizTypeList, | ||
| 49 | + User user, | ||
| 50 | + String consignmentCode){ | ||
| 37 | List<Attachment> attachmentList = new ArrayList<>(); | 51 | List<Attachment> attachmentList = new ArrayList<>(); |
| 52 | + try { | ||
| 38 | for (int i = 0; i < files.length; i++) { | 53 | for (int i = 0; i < files.length; i++) { |
| 39 | MultipartFile file = files[i]; | 54 | MultipartFile file = files[i]; |
| 40 | String bizType = attachmentBizTypeList.get(i); | 55 | String bizType = attachmentBizTypeList.get(i); |
| 41 | - Attachment attachment = attachmentUtil.uploadFile(file,bizType,user); | 56 | + Attachment attachment = attachmentUtil.uploadFile(file, bizType, user, consignmentCode, (i + 1)); |
| 42 | attachmentList.add(attachment); | 57 | attachmentList.add(attachment); |
| 43 | } | 58 | } |
| 59 | + }catch(Exception ex){ | ||
| 60 | + //如果上传过程中存在失败,则所有已上传的文件进行删除 | ||
| 61 | + attachmentUtil.deleteAttachments(attachmentList); | ||
| 62 | + throw ex; | ||
| 63 | + } | ||
| 44 | return attachmentList; | 64 | return attachmentList; |
| 45 | } | 65 | } |
| 46 | } | 66 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -62,7 +62,9 @@ public class ConsignmentQueryServiceImpl extends BaseService implements IConsign | ... | @@ -62,7 +62,9 @@ public class ConsignmentQueryServiceImpl extends BaseService implements IConsign |
| 62 | */ | 62 | */ |
| 63 | public ResponseVo findConsignmentInfo(UserConsignmentInfoQuery userConsignmentInfoQuery){ | 63 | public ResponseVo findConsignmentInfo(UserConsignmentInfoQuery userConsignmentInfoQuery){ |
| 64 | Consignment consignment = consignmentRepository.findConsignmentInfo(userConsignmentInfoQuery); | 64 | Consignment consignment = consignmentRepository.findConsignmentInfo(userConsignmentInfoQuery); |
| 65 | - if(Objects.nonNull(consignment) && !consignment.getUserUuid().equals(userConsignmentInfoQuery.getUserUuid())){ | 65 | + if(Objects.nonNull(consignment) |
| 66 | + && !consignment.getUserUuid().equals(userConsignmentInfoQuery.getUserUuid()) | ||
| 67 | + && !consignment.getShipperAccount().equals(userConsignmentInfoQuery.getShipperAccount())){ | ||
| 66 | Consignment consignmentTemp = new Consignment(); | 68 | Consignment consignmentTemp = new Consignment(); |
| 67 | consignmentTemp.setId(consignment.getId()); | 69 | consignmentTemp.setId(consignment.getId()); |
| 68 | consignmentTemp.setConsignmentCode(consignment.getConsignmentCode()); | 70 | consignmentTemp.setConsignmentCode(consignment.getConsignmentCode()); | ... | ... |
| ... | @@ -51,18 +51,18 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS | ... | @@ -51,18 +51,18 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS |
| 51 | if (consignment == null){ | 51 | if (consignment == null){ |
| 52 | if (!StringUtils.isEmpty(bo.getShipperAccount())){ | 52 | if (!StringUtils.isEmpty(bo.getShipperAccount())){ |
| 53 | if (Objects.equals(user.getAccountNo(),bo.getShipperAccount())){ | 53 | if (Objects.equals(user.getAccountNo(),bo.getShipperAccount())){ |
| 54 | - return new ResponseUtils().success(); | 54 | + return responseUtils.success(); |
| 55 | }else { | 55 | }else { |
| 56 | /** | 56 | /** |
| 57 | * 不存在运单,并且没有填写shipperAccount,则直接返回 | 57 | * 不存在运单,并且没有填写shipperAccount,则直接返回 |
| 58 | */ | 58 | */ |
| 59 | - return new ResponseUtils().success(); | 59 | + return responseUtils.success(); |
| 60 | } | 60 | } |
| 61 | }else { | 61 | }else { |
| 62 | /** | 62 | /** |
| 63 | * 不存在运单,并且没有填写shipperAccount,则直接返回 | 63 | * 不存在运单,并且没有填写shipperAccount,则直接返回 |
| 64 | */ | 64 | */ |
| 65 | - return new ResponseUtils().success(); | 65 | + return responseUtils.success(); |
| 66 | } | 66 | } |
| 67 | } | 67 | } |
| 68 | /** | 68 | /** |
| ... | @@ -92,9 +92,13 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS | ... | @@ -92,9 +92,13 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS |
| 92 | */ | 92 | */ |
| 93 | public ResponseVo submitConsignment(MultipartFile[] files,ConsignmentBo consignmentBo,User user){ | 93 | public ResponseVo submitConsignment(MultipartFile[] files,ConsignmentBo consignmentBo,User user){ |
| 94 | /** | 94 | /** |
| 95 | - * 上传附件 | 95 | + * 上传附件,并将附件信息返回 |
| 96 | */ | 96 | */ |
| 97 | - List<Attachment> attachmentList = attachmentService.uploadAttachments(files,consignmentBo.getAttachmentBizTypeList(),user); | 97 | + List<Attachment> attachmentList = attachmentService.uploadAttachments(files, |
| 98 | + consignmentBo.getAttachmentBizTypeList(), | ||
| 99 | + user, | ||
| 100 | + consignmentBo.getConsignmentCode()); | ||
| 101 | + | ||
| 98 | 102 | ||
| 99 | return null; | 103 | return null; |
| 100 | } | 104 | } | ... | ... |
| 1 | package com.fedex.connect.customer.util.service.biz; | 1 | package com.fedex.connect.customer.util.service.biz; |
| 2 | 2 | ||
| 3 | import com.fedex.connect.common.dependencies.cache.CacheSystem; | 3 | import com.fedex.connect.common.dependencies.cache.CacheSystem; |
| 4 | -import com.fedex.connect.common.dependencies.contants.DigitConstants; | 4 | +import com.fedex.connect.common.dependencies.contants.BaseSeparatorConstants; |
| 5 | import com.fedex.connect.common.dependencies.enums.base.StatusEnum; | 5 | import com.fedex.connect.common.dependencies.enums.base.StatusEnum; |
| 6 | +import com.fedex.connect.common.dependencies.enums.biz.AttachmentBizTypeEnum; | ||
| 7 | +import com.fedex.connect.common.dependencies.enums.biz.AttachmentFileTypeEnum; | ||
| 8 | +import com.fedex.connect.common.dependencies.util.AssignmentFieldUtils; | ||
| 9 | +import com.fedex.connect.common.dependencies.util.DateUtil; | ||
| 6 | import com.fedex.connect.common.dependencies.util.NIOFileUtils; | 10 | import com.fedex.connect.common.dependencies.util.NIOFileUtils; |
| 11 | +import com.fedex.connect.common.dependencies.util.ResponseUtils; | ||
| 12 | +import com.fedex.connect.common.model.bi.DictionaryEntries; | ||
| 7 | import com.fedex.connect.common.model.biz.Attachment; | 13 | import com.fedex.connect.common.model.biz.Attachment; |
| 8 | import com.fedex.connect.common.model.sys.User; | 14 | import com.fedex.connect.common.model.sys.User; |
| 15 | +import com.fedex.connect.customer.config.PropertiesConfig; | ||
| 16 | +import com.fedex.connect.customer.enums.ResponseCode; | ||
| 17 | +import lombok.extern.slf4j.Slf4j; | ||
| 18 | +import org.apache.commons.io.FileUtils; | ||
| 9 | import org.springframework.beans.factory.annotation.Autowired; | 19 | import org.springframework.beans.factory.annotation.Autowired; |
| 10 | import org.springframework.stereotype.Component; | 20 | import org.springframework.stereotype.Component; |
| 11 | import org.springframework.web.multipart.MultipartFile; | 21 | import org.springframework.web.multipart.MultipartFile; |
| 12 | 22 | ||
| 23 | +import java.io.File; | ||
| 24 | +import java.io.IOException; | ||
| 25 | +import java.util.Date; | ||
| 26 | +import java.util.List; | ||
| 27 | +import java.util.Objects; | ||
| 28 | + | ||
| 13 | /** | 29 | /** |
| 14 | * @Author mt | 30 | * @Author mt |
| 15 | * @Description 附件相关util | 31 | * @Description 附件相关util |
| 16 | * @Date 2024/11/12 | 32 | * @Date 2024/11/12 |
| 17 | */ | 33 | */ |
| 34 | +@Slf4j | ||
| 18 | @Component | 35 | @Component |
| 19 | public class AttachmentUtil { | 36 | public class AttachmentUtil { |
| 20 | @Autowired | 37 | @Autowired |
| 38 | + PropertiesConfig propertiesConfig; | ||
| 39 | + @Autowired | ||
| 21 | CacheSystem cacheSystem; | 40 | CacheSystem cacheSystem; |
| 22 | - | ||
| 23 | @Autowired | 41 | @Autowired |
| 24 | NIOFileUtils nioFileUtils; | 42 | NIOFileUtils nioFileUtils; |
| 43 | + @Autowired | ||
| 44 | + ResponseUtils responseUtils; | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * @Author mt | ||
| 48 | + * @Description 初始化附件表基础字段信息 | ||
| 49 | + * @Date 2024/11/14 | ||
| 50 | + * @param attachment | ||
| 51 | + * @param bizType | ||
| 52 | + * @param user | ||
| 53 | + * @return void | ||
| 54 | + */ | ||
| 55 | + private void initAttachment(Attachment attachment,String bizType,User user) throws Exception{ | ||
| 56 | + DictionaryEntries attachmentBizTypeEntries = cacheSystem.getDicAttachmentBizType(bizType); | ||
| 57 | + attachment.setBizTypeCode(attachmentBizTypeEntries.getCode()); | ||
| 58 | + attachment.setBizTypeName(attachmentBizTypeEntries.getDescription()); | ||
| 59 | + DictionaryEntries attachmentFileTypeEntries = cacheSystem.getDicAttachmentBizType(AttachmentFileTypeEnum.FILE.getCode()); | ||
| 60 | + attachment.setFileTypeCode(attachmentFileTypeEntries.getCode()); | ||
| 61 | + attachment.setFileTypeName(attachmentFileTypeEntries.getDescription()); | ||
| 62 | + attachment.setStatus(StatusEnum.YES.getCode()); | ||
| 63 | + attachment.setCreateUserId(user.getId()); | ||
| 64 | + attachment.setCreateUserName(user.getUserName()); | ||
| 65 | + attachment.setModifyUserId(user.getId()); | ||
| 66 | + attachment.setModifyUserName(user.getUserName()); | ||
| 67 | + /** | ||
| 68 | + * 初始化基础字段 | ||
| 69 | + */ | ||
| 70 | + AssignmentFieldUtils.assignmentTableBaseField(attachment); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + /** | ||
| 74 | + * @Author mt | ||
| 75 | + * @Description 删除已存在的附件 | ||
| 76 | + * @Date 2024/11/15 | ||
| 77 | + * @param attachmentList | ||
| 78 | + * @return void | ||
| 79 | + */ | ||
| 80 | + public void deleteAttachments(List<Attachment> attachmentList){ | ||
| 81 | + attachmentList.stream().forEach(p->{ | ||
| 82 | + String filePathName = p.getFilePath() + File.separator + p.getFileName(); | ||
| 83 | + try { | ||
| 84 | + nioFileUtils.deleteIfExists(filePathName); | ||
| 85 | + }catch(Exception ex){ | ||
| 86 | + log.error("delete file : {} " , filePathName , ex); | ||
| 87 | + } | ||
| 88 | + }); | ||
| 89 | + } | ||
| 25 | 90 | ||
| 26 | /** | 91 | /** |
| 27 | * @Author mt | 92 | * @Author mt |
| 28 | * @Description 文件上传到服务器,并且生成附件实体返回 | 93 | * @Description 文件上传到服务器,并且生成附件实体返回 |
| 29 | - * 除运单ID、运单号、用户上传记录表ID,其他参数会返回 | 94 | + * 除运单ID、用户上传记录表ID,其他参数会返回 |
| 30 | * @Date 2024/11/14 | 95 | * @Date 2024/11/14 |
| 31 | * @param file | 96 | * @param file |
| 32 | * @param bizType | 97 | * @param bizType |
| 33 | * @param user | 98 | * @param user |
| 34 | * @return com.fedex.connect.common.model.biz.Attachment | 99 | * @return com.fedex.connect.common.model.biz.Attachment |
| 35 | */ | 100 | */ |
| 36 | - public Attachment uploadFile(MultipartFile file,String bizType, User user){ | 101 | + public Attachment uploadFile(MultipartFile file,String bizType, User user,String consignmentCode,int index){ |
| 37 | Attachment attachment = new Attachment(); | 102 | Attachment attachment = new Attachment(); |
| 38 | - | 103 | + //用户上传文件名称,文件名去除前后空格 |
| 39 | -// attachment.setBizTypeCode(); | 104 | + String sourceFileName = file.getOriginalFilename().trim(); |
| 40 | -// attachment.setBizTypeName(); | 105 | + String filePathName = null; |
| 41 | - attachment.setStatus(StatusEnum.YES.getCode()); | 106 | + try{ |
| 107 | + //用户上传原文件名称 | ||
| 108 | + attachment.setSourceFileName(sourceFileName); | ||
| 109 | + //生成系统文件名称例子:AWB_123456789012_20241023164532982_001.pdf | ||
| 110 | + String fileName = AttachmentBizTypeEnum.valueOf(bizType).getExt1() + BaseSeparatorConstants.SEPARATOR_UNDERLINE + | ||
| 111 | + consignmentCode + BaseSeparatorConstants.SEPARATOR_UNDERLINE + | ||
| 112 | + DateUtil.yyyyMMddHHmmss(new Date()) + BaseSeparatorConstants.SEPARATOR_UNDERLINE + | ||
| 113 | + String.format("%03d",(index + 1)); | ||
| 114 | + //系统生成文件名称 | ||
| 115 | + attachment.setFileName(fileName); | ||
| 116 | + //文件存放目录格式:xxxxx/2024-11-15/123456789012 | ||
| 117 | + String filePath = propertiesConfig.getAttachmentPath() + File.separator + DateUtil.format(new Date()) + File.separator + consignmentCode; | ||
| 118 | + //服务器地址 | ||
| 119 | + attachment.setFilePath(filePath); | ||
| 120 | + //设置文件大小 | ||
| 121 | + attachment.setFileSize(file.getSize()); | ||
| 122 | + //完整文件路径 | ||
| 123 | + filePathName = filePath + File.separator + fileName; | ||
| 124 | + //文件上传至服务器 | ||
| 125 | + FileUtils.copyInputStreamToFile(file.getInputStream(),new File(filePathName)); | ||
| 126 | + /** | ||
| 127 | + * 初始化附件表基础字段信息 | ||
| 128 | + */ | ||
| 129 | + this.initAttachment(attachment,bizType,user); | ||
| 130 | + }catch(Exception ex){ | ||
| 131 | + //上传文件如果失败,需要将当前文件删除 | ||
| 132 | + if(Objects.nonNull(filePathName)){ | ||
| 133 | + try { | ||
| 134 | + nioFileUtils.deleteFile(filePathName); | ||
| 135 | + }catch(Exception e){ | ||
| 136 | + log.error("delete file : {} " , filePathName , e); | ||
| 137 | + } | ||
| 138 | + } | ||
| 139 | + responseUtils.fail(ResponseCode.MESSAGE_CODE_30013,ex,sourceFileName); | ||
| 140 | + } | ||
| 42 | return attachment; | 141 | return attachment; |
| 43 | } | 142 | } |
| 44 | } | 143 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -2,13 +2,14 @@ package com.fedex.connect.customer.util.service.biz; | ... | @@ -2,13 +2,14 @@ package com.fedex.connect.customer.util.service.biz; |
| 2 | 2 | ||
| 3 | import com.fedex.connect.common.dependencies.contants.DigitConstants; | 3 | import com.fedex.connect.common.dependencies.contants.DigitConstants; |
| 4 | import com.fedex.connect.common.dependencies.date.vo.ResponseVo; | 4 | import com.fedex.connect.common.dependencies.date.vo.ResponseVo; |
| 5 | -import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil; | ||
| 6 | import com.fedex.connect.common.dependencies.util.ResponseUtils; | 5 | import com.fedex.connect.common.dependencies.util.ResponseUtils; |
| 7 | import com.fedex.connect.common.model.biz.Consignment; | 6 | import com.fedex.connect.common.model.biz.Consignment; |
| 8 | import com.fedex.connect.common.model.sys.User; | 7 | import com.fedex.connect.common.model.sys.User; |
| 9 | import com.fedex.connect.customer.data.bo.AddBo; | 8 | import com.fedex.connect.customer.data.bo.AddBo; |
| 9 | +import com.fedex.connect.customer.data.bo.ConsignmentBo; | ||
| 10 | import com.fedex.connect.customer.data.dto.ConsignmentAddDto; | 10 | import com.fedex.connect.customer.data.dto.ConsignmentAddDto; |
| 11 | import com.fedex.connect.customer.enums.ResponseCode; | 11 | import com.fedex.connect.customer.enums.ResponseCode; |
| 12 | +import com.fedex.connect.customer.repository.repo.IConsignmentRepository; | ||
| 12 | import org.springframework.beans.factory.annotation.Autowired; | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| 13 | import org.springframework.stereotype.Component; | 14 | import org.springframework.stereotype.Component; |
| 14 | import org.springframework.util.StringUtils; | 15 | import org.springframework.util.StringUtils; |
| ... | @@ -23,10 +24,9 @@ import java.util.Objects; | ... | @@ -23,10 +24,9 @@ import java.util.Objects; |
| 23 | @Component | 24 | @Component |
| 24 | public class ConsignmentUtil { | 25 | public class ConsignmentUtil { |
| 25 | @Autowired | 26 | @Autowired |
| 26 | - private LocaleMessageUtil localeMessageUtil; | ||
| 27 | - | ||
| 28 | - @Autowired | ||
| 29 | ResponseUtils responseUtils; | 27 | ResponseUtils responseUtils; |
| 28 | + @Autowired | ||
| 29 | + IConsignmentRepository consignmentRepository; | ||
| 30 | 30 | ||
| 31 | /** | 31 | /** |
| 32 | * @Author Szl | 32 | * @Author Szl |
| ... | @@ -118,4 +118,18 @@ public class ConsignmentUtil { | ... | @@ -118,4 +118,18 @@ public class ConsignmentUtil { |
| 118 | private boolean isShipperAccountMatch(String account1, String account2) { | 118 | private boolean isShipperAccountMatch(String account1, String account2) { |
| 119 | return StringUtils.hasText(account1) && StringUtils.hasText(account2) && account1.equals(account2); | 119 | return StringUtils.hasText(account1) && StringUtils.hasText(account2) && account1.equals(account2); |
| 120 | } | 120 | } |
| 121 | + | ||
| 122 | + /** | ||
| 123 | + * @Author mt | ||
| 124 | + * @Description 初始化运单表信息 | ||
| 125 | + * @Date 2024/11/15 | ||
| 126 | + * @param consignmentBo | ||
| 127 | + * @param user | ||
| 128 | + * @return void | ||
| 129 | + */ | ||
| 130 | + public Consignment initConsignment(ConsignmentBo consignmentBo, User user){ | ||
| 131 | + Consignment consignment = consignmentRepository.findById(consignmentBo.getConsignmentId()); | ||
| 132 | + | ||
| 133 | + return consignment; | ||
| 134 | + } | ||
| 121 | } | 135 | } | ... | ... |
| ... | @@ -43,7 +43,7 @@ public class AttachmentValidate { | ... | @@ -43,7 +43,7 @@ public class AttachmentValidate { |
| 43 | } | 43 | } |
| 44 | //上传最大文件个数限制 | 44 | //上传最大文件个数限制 |
| 45 | if(files.length > CustomerConstant.VALIDATE_KEYS.UPLOAD_FILE_MAX_TOTAL){ | 45 | if(files.length > CustomerConstant.VALIDATE_KEYS.UPLOAD_FILE_MAX_TOTAL){ |
| 46 | - responseUtils.fail(ResponseCode.MESSAGE_CODE_30007); | 46 | + responseUtils.fail(ResponseCode.MESSAGE_CODE_30007,CustomerConstant.VALIDATE_KEYS.UPLOAD_FILE_MAX_TOTAL); |
| 47 | } | 47 | } |
| 48 | //上传总文件大小限制 | 48 | //上传总文件大小限制 |
| 49 | List<Long> fileSizeList = new ArrayList<>(); | 49 | List<Long> fileSizeList = new ArrayList<>(); |
| ... | @@ -53,9 +53,9 @@ public class AttachmentValidate { | ... | @@ -53,9 +53,9 @@ public class AttachmentValidate { |
| 53 | //总文件大小 | 53 | //总文件大小 |
| 54 | Long totalSize = Utils.listOf(fileSizeList).stream().filter(Objects::nonNull) | 54 | Long totalSize = Utils.listOf(fileSizeList).stream().filter(Objects::nonNull) |
| 55 | .mapToLong(f -> Optional.ofNullable(f).orElse(0L)).sum(); | 55 | .mapToLong(f -> Optional.ofNullable(f).orElse(0L)).sum(); |
| 56 | - //最大上传总文件大小超过50M | 56 | + //最大上传总文件大小超过95M |
| 57 | if(totalSize > CustomerConstant.VALIDATE_KEYS.UPLOAD_FILE_MAX_SIZE){ | 57 | if(totalSize > CustomerConstant.VALIDATE_KEYS.UPLOAD_FILE_MAX_SIZE){ |
| 58 | - responseUtils.fail(ResponseCode.MESSAGE_CODE_30008); | 58 | + responseUtils.fail(ResponseCode.MESSAGE_CODE_30008,CustomerConstant.VALIDATE_KEYS.UPLOAD_FILE_MAX_SIZE); |
| 59 | } | 59 | } |
| 60 | List<String> fileBizTypeList = consignmentBo.getAttachmentBizTypeList(); | 60 | List<String> fileBizTypeList = consignmentBo.getAttachmentBizTypeList(); |
| 61 | //运单或发票未上传 | 61 | //运单或发票未上传 | ... | ... |
| ... | @@ -28,15 +28,16 @@ business_field_31007=目的国全称 | ... | @@ -28,15 +28,16 @@ business_field_31007=目的国全称 |
| 28 | business_field_31008=文件业务类型 | 28 | business_field_31008=文件业务类型 |
| 29 | 29 | ||
| 30 | #*********具体响应到前端********** | 30 | #*********具体响应到前端********** |
| 31 | -business_exception_30001=${0}必填字段未填写 | 31 | +business_exception_30001=#{0}必填字段未填写 |
| 32 | business_exception_30002=单次最多可查询1000个运单号码 | 32 | business_exception_30002=单次最多可查询1000个运单号码 |
| 33 | -business_exception_30003=${0}不正确,请重新输入 | 33 | +business_exception_30003=#{0}不正确,请重新输入 |
| 34 | business_exception_30004=The waybill you entered is generated by another user, whether continue uploading? Confirm, Cancel. No more prompts in the future for the same situation. | 34 | business_exception_30004=The waybill you entered is generated by another user, whether continue uploading? Confirm, Cancel. No more prompts in the future for the same situation. |
| 35 | business_exception_30005=The waybill you entered is generated by another account, whether continue uploading? Confirm, Cancel. No more prompts in the future for the same situation. | 35 | business_exception_30005=The waybill you entered is generated by another account, whether continue uploading? Confirm, Cancel. No more prompts in the future for the same situation. |
| 36 | business_exception_30006=附件上传不符合标准 | 36 | business_exception_30006=附件上传不符合标准 |
| 37 | -business_exception_30007=所有上传文件数量不超过50个文件 | 37 | +business_exception_30007=所有上传文件数量不超过#{0}个文件 |
| 38 | -business_exception_30008=所有上传文件总大小不超过50M | 38 | +business_exception_30008=所有上传文件总大小不超过#{0}M |
| 39 | business_exception_30009=运单或发票未上传 | 39 | business_exception_30009=运单或发票未上传 |
| 40 | business_exception_30010=文件类型不在:运单、发票、箱单、其他 | 40 | business_exception_30010=文件类型不在:运单、发票、箱单、其他 |
| 41 | business_exception_30011=该运单已被其他人创建,不可以重复创建 | 41 | business_exception_30011=该运单已被其他人创建,不可以重复创建 |
| 42 | business_exception_30012=UUID不一致 | 42 | business_exception_30012=UUID不一致 |
| 43 | +business_exception_30013=文件名为:#{0},上传失败,请检查后重试 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -40,3 +40,4 @@ business_exception_30009=运单或发票未上传 | ... | @@ -40,3 +40,4 @@ business_exception_30009=运单或发票未上传 |
| 40 | business_exception_30010=文件类型不在:运单、发票、箱单、其他 | 40 | business_exception_30010=文件类型不在:运单、发票、箱单、其他 |
| 41 | business_exception_30011=该运单已被其他人创建,不可以重复创建 | 41 | business_exception_30011=该运单已被其他人创建,不可以重复创建 |
| 42 | business_exception_30012=UUID不一致 | 42 | business_exception_30012=UUID不一致 |
| 43 | +business_exception_30013=文件名为:#{0},上传失败,请检查后重试 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -65,14 +65,26 @@ public class CacheSystem implements CommandLineRunner { | ... | @@ -65,14 +65,26 @@ public class CacheSystem implements CommandLineRunner { |
| 65 | 65 | ||
| 66 | /** | 66 | /** |
| 67 | * @Author mt | 67 | * @Author mt |
| 68 | + * @Description 根据dictCode,字典code获取字典项 | ||
| 69 | + * @Date 2024/11/14 | ||
| 70 | + * @param dictCode | ||
| 71 | + * @param code | ||
| 72 | + * @return com.fedex.connect.common.model.bi.DictionaryEntries | ||
| 73 | + */ | ||
| 74 | + private DictionaryEntries getDicEntries(String dictCode,String code){ | ||
| 75 | + List<DictionaryEntries> filter = dictionaryMap.get(dictCode).stream().filter(p -> code.equals(p.getCode())).collect(Collectors.toList()); | ||
| 76 | + return filter.isEmpty() ? null : filter.get(DigitConstants.DIGIT_ZERO); | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + /** | ||
| 80 | + * @Author mt | ||
| 68 | * @Description 根据code获取用户类型指定字典项 | 81 | * @Description 根据code获取用户类型指定字典项 |
| 69 | * @Date 2024年11月5日18:38:28 | 82 | * @Date 2024年11月5日18:38:28 |
| 70 | * @param code | 83 | * @param code |
| 71 | * @return com.fedex.connect.common.model.bi.DictionaryEntries | 84 | * @return com.fedex.connect.common.model.bi.DictionaryEntries |
| 72 | */ | 85 | */ |
| 73 | public DictionaryEntries getDicUserType(String code){ | 86 | public DictionaryEntries getDicUserType(String code){ |
| 74 | - List<DictionaryEntries> filter = dictionaryMap.get(DictionaryConstants.USER_TYPE).stream().filter(p -> code.equals(p.getCode())).collect(Collectors.toList()); | 87 | + return this.getDicEntries(DictionaryConstants.USER_TYPE,code); |
| 75 | - return filter.isEmpty() ? null : filter.get(DigitConstants.DIGIT_ZERO); | ||
| 76 | } | 88 | } |
| 77 | 89 | ||
| 78 | /** | 90 | /** |
| ... | @@ -83,8 +95,7 @@ public class CacheSystem implements CommandLineRunner { | ... | @@ -83,8 +95,7 @@ public class CacheSystem implements CommandLineRunner { |
| 83 | * @return com.fedex.connect.common.model.bi.DictionaryEntries | 95 | * @return com.fedex.connect.common.model.bi.DictionaryEntries |
| 84 | */ | 96 | */ |
| 85 | public DictionaryEntries getDicConsignmentStatus(String code){ | 97 | public DictionaryEntries getDicConsignmentStatus(String code){ |
| 86 | - List<DictionaryEntries> filter = dictionaryMap.get(DictionaryConstants.CONSIGNMENT_STATUS).stream().filter(p -> code.equals(p.getCode())).collect(Collectors.toList()); | 98 | + return this.getDicEntries(DictionaryConstants.CONSIGNMENT_STATUS,code); |
| 87 | - return filter.isEmpty() ? null : filter.get(DigitConstants.DIGIT_ZERO); | ||
| 88 | } | 99 | } |
| 89 | 100 | ||
| 90 | /** | 101 | /** |
| ... | @@ -95,8 +106,7 @@ public class CacheSystem implements CommandLineRunner { | ... | @@ -95,8 +106,7 @@ public class CacheSystem implements CommandLineRunner { |
| 95 | * @return com.fedex.connect.common.model.bi.DictionaryEntries | 106 | * @return com.fedex.connect.common.model.bi.DictionaryEntries |
| 96 | */ | 107 | */ |
| 97 | public DictionaryEntries getDicCountry(String code){ | 108 | public DictionaryEntries getDicCountry(String code){ |
| 98 | - List<DictionaryEntries> filter = dictionaryMap.get(DictionaryConstants.COUNTRY).stream().filter(p -> code.equals(p.getCode())).collect(Collectors.toList()); | 109 | + return this.getDicEntries(DictionaryConstants.COUNTRY,code); |
| 99 | - return filter.isEmpty() ? null : filter.get(DigitConstants.DIGIT_ZERO); | ||
| 100 | } | 110 | } |
| 101 | 111 | ||
| 102 | /** | 112 | /** |
| ... | @@ -119,8 +129,7 @@ public class CacheSystem implements CommandLineRunner { | ... | @@ -119,8 +129,7 @@ public class CacheSystem implements CommandLineRunner { |
| 119 | * @return com.fedex.connect.common.model.bi.DictionaryEntries | 129 | * @return com.fedex.connect.common.model.bi.DictionaryEntries |
| 120 | */ | 130 | */ |
| 121 | public DictionaryEntries getDicUserLoginType(String code){ | 131 | public DictionaryEntries getDicUserLoginType(String code){ |
| 122 | - List<DictionaryEntries> filter = dictionaryMap.get(DictionaryConstants.USER_LOGIN_TYPE).stream().filter(p -> code.equals(p.getCode())).collect(Collectors.toList()); | 132 | + return this.getDicEntries(DictionaryConstants.USER_LOGIN_TYPE,code); |
| 123 | - return filter.isEmpty() ? null : filter.get(DigitConstants.DIGIT_ZERO); | ||
| 124 | } | 133 | } |
| 125 | 134 | ||
| 126 | /** | 135 | /** |
| ... | @@ -131,8 +140,7 @@ public class CacheSystem implements CommandLineRunner { | ... | @@ -131,8 +140,7 @@ public class CacheSystem implements CommandLineRunner { |
| 131 | * @return com.fedex.connect.common.model.bi.DictionaryEntries | 140 | * @return com.fedex.connect.common.model.bi.DictionaryEntries |
| 132 | */ | 141 | */ |
| 133 | public DictionaryEntries getDicEmailType(String code){ | 142 | public DictionaryEntries getDicEmailType(String code){ |
| 134 | - List<DictionaryEntries> filter = dictionaryMap.get(DictionaryConstants.EMAIL_TYPE).stream().filter(p -> code.equals(p.getCode())).collect(Collectors.toList()); | 143 | + return this.getDicEntries(DictionaryConstants.EMAIL_TYPE,code); |
| 135 | - return filter.isEmpty() ? null : filter.get(DigitConstants.DIGIT_ZERO); | ||
| 136 | } | 144 | } |
| 137 | 145 | ||
| 138 | /** | 146 | /** |
| ... | @@ -143,7 +151,28 @@ public class CacheSystem implements CommandLineRunner { | ... | @@ -143,7 +151,28 @@ public class CacheSystem implements CommandLineRunner { |
| 143 | * @return com.fedex.connect.common.model.bi.DictionaryEntries | 151 | * @return com.fedex.connect.common.model.bi.DictionaryEntries |
| 144 | */ | 152 | */ |
| 145 | public DictionaryEntries getDicEmailStatus(String code){ | 153 | public DictionaryEntries getDicEmailStatus(String code){ |
| 146 | - List<DictionaryEntries> filter = dictionaryMap.get(DictionaryConstants.EMAIL_STATUS).stream().filter(p -> code.equals(p.getCode())).collect(Collectors.toList()); | 154 | + return this.getDicEntries(DictionaryConstants.EMAIL_STATUS,code); |
| 147 | - return filter.isEmpty() ? null : filter.get(DigitConstants.DIGIT_ZERO); | 155 | + } |
| 156 | + | ||
| 157 | + /** | ||
| 158 | + * @Author mt | ||
| 159 | + * @Description 功能说明 根据code获取附件业务类型指定字典项 | ||
| 160 | + * @Date 2024/11/7 | ||
| 161 | + * @param code | ||
| 162 | + * @return com.fedex.connect.common.model.bi.DictionaryEntries | ||
| 163 | + */ | ||
| 164 | + public DictionaryEntries getDicAttachmentBizType(String code){ | ||
| 165 | + return this.getDicEntries(DictionaryConstants.ATTACHMENT_BIZ_TYPE,code); | ||
| 166 | + } | ||
| 167 | + | ||
| 168 | + /** | ||
| 169 | + * @Author mt | ||
| 170 | + * @Description 功能说明 根据code获取附件文件类型指定字典项 | ||
| 171 | + * @Date 2024/11/7 | ||
| 172 | + * @param code | ||
| 173 | + * @return com.fedex.connect.common.model.bi.DictionaryEntries | ||
| 174 | + */ | ||
| 175 | + public DictionaryEntries getDicAttachmentFileType(String code){ | ||
| 176 | + return this.getDicEntries(DictionaryConstants.ATTACHMENT_FILE_TYPE,code); | ||
| 148 | } | 177 | } |
| 149 | } | 178 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -21,8 +21,8 @@ public class DateUtil { | ... | @@ -21,8 +21,8 @@ public class DateUtil { |
| 21 | public static final String PATTERN_DATE = "yyyy-MM-dd"; | 21 | public static final String PATTERN_DATE = "yyyy-MM-dd"; |
| 22 | public static final String PATTERN_DATE_TIME = "yyyy-MM-dd HH:mm:ss"; | 22 | public static final String PATTERN_DATE_TIME = "yyyy-MM-dd HH:mm:ss"; |
| 23 | public static final String PATTERN_DATE_TIME_ORACLE = "yyyy-MM-dd hh:mi:ss"; | 23 | public static final String PATTERN_DATE_TIME_ORACLE = "yyyy-MM-dd hh:mi:ss"; |
| 24 | - | ||
| 25 | public static final String PATTERN_DATE_TIME_MS = "yyyy-mm-dd hh24:mi:ss"; | 24 | public static final String PATTERN_DATE_TIME_MS = "yyyy-mm-dd hh24:mi:ss"; |
| 25 | + public static final String PATTERN_yyyyMMddHHmmss = "yyyyMMddHHmmss"; | ||
| 26 | 26 | ||
| 27 | private static SimpleDateFormat dateFormat = new SimpleDateFormat(); | 27 | private static SimpleDateFormat dateFormat = new SimpleDateFormat(); |
| 28 | 28 | ||
| ... | @@ -59,11 +59,14 @@ public class DateUtil { | ... | @@ -59,11 +59,14 @@ public class DateUtil { |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | /** | 61 | /** |
| 62 | - * Format a Time object to a String. Now use the Medium format of Locale | 62 | + * @Author mt |
| 63 | - * CHINA. The format is YYYYMMDDHHmmss | 63 | + * @Description yyyyMMddHHmmss |
| 64 | + * @Date 2024/11/14 | ||
| 65 | + * @param date | ||
| 66 | + * @return java.lang.String | ||
| 64 | */ | 67 | */ |
| 65 | - public static String formatTimeWithoutSlash(Date date) { | 68 | + public static String yyyyMMddHHmmss(Date date){ |
| 66 | - dateFormat.applyPattern("yyyyMMddHHmmss"); | 69 | + dateFormat.applyPattern(PATTERN_yyyyMMddHHmmss); |
| 67 | return dateFormat.format(date); | 70 | return dateFormat.format(date); |
| 68 | } | 71 | } |
| 69 | 72 | ... | ... |
| ... | @@ -48,6 +48,22 @@ public class ResponseUtils { | ... | @@ -48,6 +48,22 @@ public class ResponseUtils { |
| 48 | * @param objects | 48 | * @param objects |
| 49 | * @return void | 49 | * @return void |
| 50 | */ | 50 | */ |
| 51 | + public void fail(Object codeEnum,Throwable e,Object...objects) { | ||
| 52 | + ResponseCodeBo responseCodeBo = this.ref(codeEnum,objects); | ||
| 53 | + log.error(responseCodeBo.getErrMsg(),e); | ||
| 54 | + throw new OpErrorException(responseCodeBo.getCode(), responseCodeBo.getErrMsg()); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * @Author mt | ||
| 59 | + * @Description | ||
| 60 | + * 第一个参数值为:#{0}必填字段未填写,#{1}。 | ||
| 61 | + * 第二个参数为:List<String>或字符串等 | ||
| 62 | + * @Date 2024/11/12 | ||
| 63 | + * @param codeEnum | ||
| 64 | + * @param objects | ||
| 65 | + * @return void | ||
| 66 | + */ | ||
| 51 | public void fail(Object codeEnum,Object...objects) { | 67 | public void fail(Object codeEnum,Object...objects) { |
| 52 | ResponseCodeBo responseCodeBo = this.ref(codeEnum,objects); | 68 | ResponseCodeBo responseCodeBo = this.ref(codeEnum,objects); |
| 53 | log.error(responseCodeBo.getErrMsg()); | 69 | log.error(responseCodeBo.getErrMsg()); |
| ... | @@ -56,7 +72,7 @@ public class ResponseUtils { | ... | @@ -56,7 +72,7 @@ public class ResponseUtils { |
| 56 | 72 | ||
| 57 | public void fail(Object codeEnum,Throwable e) { | 73 | public void fail(Object codeEnum,Throwable e) { |
| 58 | ResponseCodeBo responseCodeBo = this.ref(codeEnum); | 74 | ResponseCodeBo responseCodeBo = this.ref(codeEnum); |
| 59 | - log.error(responseCodeBo.getErrMsg()); | 75 | + log.error(responseCodeBo.getErrMsg(),e); |
| 60 | throw new OpErrorException(responseCodeBo.getCode(), responseCodeBo.getErrMsg(),e); | 76 | throw new OpErrorException(responseCodeBo.getCode(), responseCodeBo.getErrMsg(),e); |
| 61 | } | 77 | } |
| 62 | 78 | ... | ... |
-
Please register or login to post a comment