zelong.shao

customer|流程代码调整

Showing 27 changed files with 144 additions and 56 deletions
...@@ -4,4 +4,6 @@ import com.fedex.connect.common.dependencies.date.vo.ResponseVo; ...@@ -4,4 +4,6 @@ import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
4 4
5 public interface IAttachmentQueryController { 5 public interface IAttachmentQueryController {
6 ResponseVo queryInfo(Long consignmentId); 6 ResponseVo queryInfo(Long consignmentId);
7 +
8 + ResponseVo queryByRecord(Long recordId);
7 } 9 }
......
1 package com.fedex.connect.customer.controller.biz; 1 package com.fedex.connect.customer.controller.biz;
2 2
3 import com.fedex.connect.common.dependencies.date.vo.ResponseVo; 3 import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
4 +import com.fedex.connect.customer.data.query.AttachmentHistoryQuery;
4 5
5 public interface IUploadRecordController { 6 public interface IUploadRecordController {
6 - ResponseVo queryHistoryList(Long consignmentId); 7 + ResponseVo queryHistoryList(AttachmentHistoryQuery attachmentHistoryQuery);
7 } 8 }
......
...@@ -5,13 +5,15 @@ import com.fedex.connect.common.dependencies.date.vo.ResponseVo; ...@@ -5,13 +5,15 @@ import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
5 import com.fedex.connect.common.model.sys.User; 5 import com.fedex.connect.common.model.sys.User;
6 import com.fedex.connect.customer.controller.base.BaseController; 6 import com.fedex.connect.customer.controller.base.BaseController;
7 import com.fedex.connect.customer.controller.biz.IAttachmentQueryController; 7 import com.fedex.connect.customer.controller.biz.IAttachmentQueryController;
8 -import com.fedex.connect.customer.data.bo.LongBo;
9 import com.fedex.connect.customer.data.query.UserConsignmentInfoQuery; 8 import com.fedex.connect.customer.data.query.UserConsignmentInfoQuery;
10 import io.swagger.annotations.Api; 9 import io.swagger.annotations.Api;
11 import io.swagger.annotations.ApiOperation; 10 import io.swagger.annotations.ApiOperation;
12 import io.swagger.annotations.ApiParam; 11 import io.swagger.annotations.ApiParam;
13 import lombok.extern.slf4j.Slf4j; 12 import lombok.extern.slf4j.Slf4j;
14 -import org.springframework.web.bind.annotation.*; 13 +import org.springframework.web.bind.annotation.PathVariable;
14 +import org.springframework.web.bind.annotation.PostMapping;
15 +import org.springframework.web.bind.annotation.RequestMapping;
16 +import org.springframework.web.bind.annotation.RestController;
15 17
16 /** 18 /**
17 * @Author Szl 19 * @Author Szl
...@@ -43,4 +45,23 @@ public class AttachmentQueryController extends BaseController implements IAttach ...@@ -43,4 +45,23 @@ public class AttachmentQueryController extends BaseController implements IAttach
43 UserConsignmentInfoQuery userConsignmentInfoQuery = UserConsignmentInfoQuery.getInstance(user,consignmentId); 45 UserConsignmentInfoQuery userConsignmentInfoQuery = UserConsignmentInfoQuery.getInstance(user,consignmentId);
44 return attachmentQueryService.queryInfo(userConsignmentInfoQuery); 46 return attachmentQueryService.queryInfo(userConsignmentInfoQuery);
45 } 47 }
48 +
49 + @Override
50 + @PostMapping("/queryByRecord/{recordId}")
51 + @ApiOperation(value = "ResponseVo", notes = "根据批次号查询用户上传记录")
52 + @OperationMethodLog(describe = "business_log_20005")
53 + public ResponseVo queryByRecord(@ApiParam(value="Record ID",required = true) @PathVariable(value = "recordId") Long recordId) {
54 + /**
55 + * 运单id非空校验
56 + */
57 + consignmentInfoValidate.validateConsignmentId(recordId);
58 + /**
59 + * 获取当前用户信息
60 + */
61 + User user = this.getCurrentUserInfo();
62 + /**
63 + * 构造查询对象
64 + */
65 + return attachmentQueryService.queryByRecord(recordId);
66 + }
46 } 67 }
......
...@@ -8,10 +8,9 @@ import com.fedex.connect.customer.controller.biz.IUploadRecordController; ...@@ -8,10 +8,9 @@ import com.fedex.connect.customer.controller.biz.IUploadRecordController;
8 import com.fedex.connect.customer.data.query.AttachmentHistoryQuery; 8 import com.fedex.connect.customer.data.query.AttachmentHistoryQuery;
9 import io.swagger.annotations.Api; 9 import io.swagger.annotations.Api;
10 import io.swagger.annotations.ApiOperation; 10 import io.swagger.annotations.ApiOperation;
11 -import io.swagger.annotations.ApiParam;
12 import lombok.extern.slf4j.Slf4j; 11 import lombok.extern.slf4j.Slf4j;
13 -import org.springframework.web.bind.annotation.PathVariable;
14 import org.springframework.web.bind.annotation.PostMapping; 12 import org.springframework.web.bind.annotation.PostMapping;
13 +import org.springframework.web.bind.annotation.RequestBody;
15 import org.springframework.web.bind.annotation.RequestMapping; 14 import org.springframework.web.bind.annotation.RequestMapping;
16 import org.springframework.web.bind.annotation.RestController; 15 import org.springframework.web.bind.annotation.RestController;
17 16
...@@ -30,8 +29,7 @@ public class UploadRecordController extends BaseController implements IUploadRec ...@@ -30,8 +29,7 @@ public class UploadRecordController extends BaseController implements IUploadRec
30 @PostMapping("/queryHistoryList/{consignmentId}") 29 @PostMapping("/queryHistoryList/{consignmentId}")
31 @ApiOperation(value = "ResponseVo", notes = "运单历史上传记录查询") 30 @ApiOperation(value = "ResponseVo", notes = "运单历史上传记录查询")
32 @OperationMethodLog(describe = "business_log_20006") 31 @OperationMethodLog(describe = "business_log_20006")
33 - public ResponseVo queryHistoryList(@ApiParam(value="运单ID",required = true) @PathVariable(value = "consignmentId") Long consignmentId) { 32 + public ResponseVo queryHistoryList(@RequestBody AttachmentHistoryQuery attachmentHistoryQuery) {
34 - AttachmentHistoryQuery attachmentHistoryQuery = AttachmentHistoryQuery.getInstance(consignmentId);
35 /** 33 /**
36 * 运单id非空校验 34 * 运单id非空校验
37 */ 35 */
......
1 package com.fedex.connect.customer.data.bo; 1 package com.fedex.connect.customer.data.bo;
2 2
3 import com.fedex.connect.common.dependencies.annotation.BaseNotBlank; 3 import com.fedex.connect.common.dependencies.annotation.BaseNotBlank;
4 +import com.fedex.connect.common.model.biz.Attachment;
4 import lombok.Data; 5 import lombok.Data;
5 6
6 import java.util.List; 7 import java.util.List;
...@@ -29,5 +30,5 @@ public class ConsignmentBo { ...@@ -29,5 +30,5 @@ public class ConsignmentBo {
29 private String destinationCountry; 30 private String destinationCountry;
30 //文件业务类型AWB,INV,PKL,OTH(分运单,发票,箱单和其它这四种类型) 31 //文件业务类型AWB,INV,PKL,OTH(分运单,发票,箱单和其它这四种类型)
31 @BaseNotBlank(describe = "business_field_31008") 32 @BaseNotBlank(describe = "business_field_31008")
32 - private List<String> attachmentBizTypeList; 33 + private List<Attachment> attachmentBizTypeList;
33 } 34 }
......
1 package com.fedex.connect.customer.data.dto; 1 package com.fedex.connect.customer.data.dto;
2 2
3 +import com.fedex.connect.common.model.biz.UploadRecord;
3 import lombok.Data; 4 import lombok.Data;
4 5
5 -import java.util.Date;
6 -
7 @Data 6 @Data
8 public class AttachmentHistoryDto { 7 public class AttachmentHistoryDto {
9 - private String uploadUserName; 8 + private UploadRecord uploadRecord;
10 -
11 - private Long uploadUserId;
12 -
13 - private Date uploadTime;
14 -
15 - private String statusName;
16 -
17 - private String filePath;
18 -
19 private Integer creatorFlag; 9 private Integer creatorFlag;
20 10
21 } 11 }
......
...@@ -3,6 +3,7 @@ package com.fedex.connect.customer.repository.base; ...@@ -3,6 +3,7 @@ package com.fedex.connect.customer.repository.base;
3 import com.fedex.connect.common.dao.biz.*; 3 import com.fedex.connect.common.dao.biz.*;
4 import com.fedex.connect.customer.repository.dao.AttachmentExtMapper; 4 import com.fedex.connect.customer.repository.dao.AttachmentExtMapper;
5 import com.fedex.connect.customer.repository.dao.ConsignmentExtMapper; 5 import com.fedex.connect.customer.repository.dao.ConsignmentExtMapper;
6 +import com.fedex.connect.customer.repository.dao.UploadRecordExtMapper;
6 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
7 8
8 public class BaseDao { 9 public class BaseDao {
...@@ -22,4 +23,6 @@ public class BaseDao { ...@@ -22,4 +23,6 @@ public class BaseDao {
22 protected AttachmentExtMapper attachmentExtMapper; 23 protected AttachmentExtMapper attachmentExtMapper;
23 @Autowired 24 @Autowired
24 protected EmailMapper emailMapper; 25 protected EmailMapper emailMapper;
26 + @Autowired
27 + protected UploadRecordExtMapper uploadRecordExtMapper;
25 } 28 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -18,4 +18,8 @@ public interface AttachmentExtMapper { ...@@ -18,4 +18,8 @@ public interface AttachmentExtMapper {
18 "(SELECT MAX(ID) FROM T_BIZ_UPLOAD_RECORD WHERE CREATE_USER_ID = #{query.userId} " + 18 "(SELECT MAX(ID) FROM T_BIZ_UPLOAD_RECORD WHERE CREATE_USER_ID = #{query.userId} " +
19 "AND CONSIGNMENT_ID = #{query.consignmentId}) AND STATUS = 1") 19 "AND CONSIGNMENT_ID = #{query.consignmentId}) AND STATUS = 1")
20 List<Attachment> queryInfo(@Param("query") UserConsignmentInfoQuery query); 20 List<Attachment> queryInfo(@Param("query") UserConsignmentInfoQuery query);
21 +
22 + @Select("SELECT * FROM T_BIZ_ATTACHMENT WHERE UPLOAD_RECORD_ID = #{uploadRecordId}")
23 + List<Attachment> getAttachmentsByUploadRecordId(@Param("uploadRecordId") Long uploadRecordId);
24 +
21 } 25 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -25,7 +25,7 @@ public interface ConsignmentExtMapper { ...@@ -25,7 +25,7 @@ public interface ConsignmentExtMapper {
25 ") WHERE ROWNUM = 1") 25 ") WHERE ROWNUM = 1")
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 LEFT 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} OR 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
......
1 package com.fedex.connect.customer.repository.dao; 1 package com.fedex.connect.customer.repository.dao;
2 2
3 +import com.fedex.connect.common.model.biz.UploadRecord;
4 +import com.fedex.connect.customer.data.query.AttachmentHistoryQuery;
3 import org.apache.ibatis.annotations.Mapper; 5 import org.apache.ibatis.annotations.Mapper;
4 6
7 +import java.util.List;
8 +
5 @Mapper 9 @Mapper
6 public interface UploadRecordExtMapper { 10 public interface UploadRecordExtMapper {
11 + List<UploadRecord> getUploadRecordsByConsignmentId(AttachmentHistoryQuery attachmentHistoryQuery);
7 } 12 }
......
...@@ -15,4 +15,6 @@ public interface IAttachmentRepository { ...@@ -15,4 +15,6 @@ public interface IAttachmentRepository {
15 Attachment saveOrUpdate(Attachment entity); 15 Attachment saveOrUpdate(Attachment entity);
16 16
17 void saveOrUpdateAll(List<Attachment> list); 17 void saveOrUpdateAll(List<Attachment> list);
18 +
19 + List<Attachment> getAttachmentsByUploadRecordId(Long uploadRecordId);
18 } 20 }
...\ No newline at end of file ...\ No newline at end of file
......
1 package com.fedex.connect.customer.repository.repo; 1 package com.fedex.connect.customer.repository.repo;
2 2
3 import com.fedex.connect.common.model.biz.UploadRecord; 3 import com.fedex.connect.common.model.biz.UploadRecord;
4 +import com.fedex.connect.customer.data.query.AttachmentHistoryQuery;
4 5
5 import java.util.List; 6 import java.util.List;
6 7
...@@ -21,4 +22,12 @@ public interface IUploadRecordRepository { ...@@ -21,4 +22,12 @@ public interface IUploadRecordRepository {
21 * @return void 22 * @return void
22 */ 23 */
23 void saveOrUpdateAll(List<UploadRecord> list); 24 void saveOrUpdateAll(List<UploadRecord> list);
25 +
26 + /**
27 + * @Author Szl
28 + * @Description 功能说明 根据运单id查询历史上传数据
29 + * @Date 2024/12/16
30 + * @return java.util.List<com.fedex.connect.common.model.biz.UploadRecord>
31 + */
32 + List<UploadRecord> getUploadRecordsByConsignmentId(AttachmentHistoryQuery attachmentHistoryQuery);
24 } 33 }
......
1 package com.fedex.connect.customer.repository.repo.impl; 1 package com.fedex.connect.customer.repository.repo.impl;
2 2
3 import com.fedex.connect.common.model.biz.Attachment; 3 import com.fedex.connect.common.model.biz.Attachment;
4 -import com.fedex.connect.common.model.biz.UploadRecord;
5 import com.fedex.connect.customer.data.dto.AttachmentHistoryDto; 4 import com.fedex.connect.customer.data.dto.AttachmentHistoryDto;
6 import com.fedex.connect.customer.data.query.AttachmentHistoryQuery; 5 import com.fedex.connect.customer.data.query.AttachmentHistoryQuery;
7 import com.fedex.connect.customer.data.query.UserConsignmentInfoQuery; 6 import com.fedex.connect.customer.data.query.UserConsignmentInfoQuery;
...@@ -52,4 +51,9 @@ public class AttachmentRepositoryImpl extends BaseDao implements IAttachmentRepo ...@@ -52,4 +51,9 @@ public class AttachmentRepositoryImpl extends BaseDao implements IAttachmentRepo
52 } 51 }
53 }); 52 });
54 } 53 }
54 +
55 + @Override
56 + public List<Attachment> getAttachmentsByUploadRecordId(Long uploadRecordId) {
57 + return attachmentExtMapper.getAttachmentsByUploadRecordId(uploadRecordId);
58 + }
55 } 59 }
...\ No newline at end of file ...\ No newline at end of file
......
1 package com.fedex.connect.customer.repository.repo.impl; 1 package com.fedex.connect.customer.repository.repo.impl;
2 2
3 import com.fedex.connect.common.model.biz.UploadRecord; 3 import com.fedex.connect.common.model.biz.UploadRecord;
4 +import com.fedex.connect.customer.data.query.AttachmentHistoryQuery;
4 import com.fedex.connect.customer.repository.base.BaseDao; 5 import com.fedex.connect.customer.repository.base.BaseDao;
5 import com.fedex.connect.customer.repository.repo.IUploadRecordRepository; 6 import com.fedex.connect.customer.repository.repo.IUploadRecordRepository;
6 import org.springframework.stereotype.Repository; 7 import org.springframework.stereotype.Repository;
...@@ -31,4 +32,11 @@ public class UploadRecordRepositoryImpl extends BaseDao implements IUploadRecord ...@@ -31,4 +32,11 @@ public class UploadRecordRepositoryImpl extends BaseDao implements IUploadRecord
31 } 32 }
32 }); 33 });
33 } 34 }
35 +
36 + @Override
37 + public List<UploadRecord> getUploadRecordsByConsignmentId(AttachmentHistoryQuery attachmentHistoryQuery) {
38 + return uploadRecordExtMapper.getUploadRecordsByConsignmentId(attachmentHistoryQuery);
39 + }
40 +
41 +
34 } 42 }
......
...@@ -5,4 +5,6 @@ import com.fedex.connect.customer.data.query.UserConsignmentInfoQuery; ...@@ -5,4 +5,6 @@ import com.fedex.connect.customer.data.query.UserConsignmentInfoQuery;
5 5
6 public interface IAttachmentQueryService { 6 public interface IAttachmentQueryService {
7 ResponseVo queryInfo(UserConsignmentInfoQuery userConsignmentInfoQuery); 7 ResponseVo queryInfo(UserConsignmentInfoQuery userConsignmentInfoQuery);
8 +
9 + ResponseVo queryByRecord(Long recordId);
8 } 10 }
......
...@@ -8,7 +8,7 @@ import java.util.List; ...@@ -8,7 +8,7 @@ import java.util.List;
8 8
9 public interface IAttachmentService { 9 public interface IAttachmentService {
10 List<Attachment> uploadAttachments(MultipartFile[] files, 10 List<Attachment> uploadAttachments(MultipartFile[] files,
11 - List<String> attachmentBizTypeList, 11 + List<Attachment> attachmentBizTypeList,
12 User user, 12 User user,
13 String consignmentCode); 13 String consignmentCode);
14 14
......
...@@ -28,4 +28,9 @@ public class AttachmentQueryServiceImpl extends BaseService implements IAttachme ...@@ -28,4 +28,9 @@ public class AttachmentQueryServiceImpl extends BaseService implements IAttachme
28 List<Attachment> attachmentList = attachmentRepository.queryInfo(userConsignmentInfoQuery); 28 List<Attachment> attachmentList = attachmentRepository.queryInfo(userConsignmentInfoQuery);
29 return responseUtils.success(attachmentList); 29 return responseUtils.success(attachmentList);
30 } 30 }
31 +
32 + @Override
33 + public ResponseVo queryByRecord(Long recordId) {
34 + return responseUtils.success(attachmentRepository.getAttachmentsByUploadRecordId(recordId));
35 + }
31 } 36 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -7,6 +7,7 @@ import com.fedex.connect.common.model.sys.User; ...@@ -7,6 +7,7 @@ import com.fedex.connect.common.model.sys.User;
7 import com.fedex.connect.customer.service.base.BaseService; 7 import com.fedex.connect.customer.service.base.BaseService;
8 import com.fedex.connect.customer.service.biz.IAttachmentService; 8 import com.fedex.connect.customer.service.biz.IAttachmentService;
9 import com.fedex.connect.customer.util.service.biz.AttachmentUtil; 9 import com.fedex.connect.customer.util.service.biz.AttachmentUtil;
10 +import org.apache.commons.lang3.StringUtils;
10 import org.springframework.beans.factory.annotation.Autowired; 11 import org.springframework.beans.factory.annotation.Autowired;
11 import org.springframework.stereotype.Service; 12 import org.springframework.stereotype.Service;
12 import org.springframework.web.multipart.MultipartFile; 13 import org.springframework.web.multipart.MultipartFile;
...@@ -48,19 +49,33 @@ public class AttachmentServiceImpl extends BaseService implements IAttachmentSer ...@@ -48,19 +49,33 @@ public class AttachmentServiceImpl extends BaseService implements IAttachmentSer
48 * @return void 49 * @return void
49 */ 50 */
50 public List<Attachment> uploadAttachments(MultipartFile[] files, 51 public List<Attachment> uploadAttachments(MultipartFile[] files,
51 - List<String> attachmentBizTypeList, 52 + List<Attachment> attachmentBizTypeList,
52 User user, 53 User user,
53 String consignmentCode){ 54 String consignmentCode){
54 List<Attachment> attachmentList = new ArrayList<>(); 55 List<Attachment> attachmentList = new ArrayList<>();
55 String yyyyMMddHHmmss = DateUtil.yyyyMMddHHmmss(new Date()); 56 String yyyyMMddHHmmss = DateUtil.yyyyMMddHHmmss(new Date());
56 try { 57 try {
57 - for (int i = 0; i < files.length; i++) { 58 + int i = 0;
58 - MultipartFile file = files[i]; 59 + for (Attachment attachment : attachmentBizTypeList) {
59 - String bizType = attachmentBizTypeList.get(i); 60 + /**
61 + * 判断是否为需要复制过来的历史图片,如果是则复制,如果不是则新增
62 + */
63 + String bizType = attachment.getBizTypeCode();
60 //构造文件后缀 64 //构造文件后缀
61 String fileSuffix = yyyyMMddHHmmss + BaseSeparatorConstants.SEPARATOR_UNDERLINE + String.format("%03d",(i + 1)); 65 String fileSuffix = yyyyMMddHHmmss + BaseSeparatorConstants.SEPARATOR_UNDERLINE + String.format("%03d",(i + 1));
62 - Attachment attachment = attachmentUtil.uploadFile(file, bizType, user, consignmentCode, fileSuffix); 66 + String filePath = attachment.getFilePath();
63 - attachmentList.add(attachment); 67 + Attachment attachmentNew = null;
68 + if (StringUtils.isEmpty(filePath)){
69 + MultipartFile file = attachmentUtil.findFileByName(files,attachment.getFileName());
70 + attachmentNew = attachmentUtil.uploadFile(file, bizType, user, consignmentCode, fileSuffix);
71 + }else {
72 + attachmentNew = attachment;
73 + attachmentNew.setId(null);
74 + attachmentNew.setCreateTime(new Date());
75 + attachmentNew.setModifyTime(new Date());
76 + }
77 + attachmentList.add(attachmentNew);
78 + ++i;
64 } 79 }
65 }catch(Exception ex){ 80 }catch(Exception ex){
66 //如果上传过程中存在失败,则所有已上传的文件进行删除 81 //如果上传过程中存在失败,则所有已上传的文件进行删除
......
...@@ -3,6 +3,7 @@ package com.fedex.connect.customer.service.biz.impl; ...@@ -3,6 +3,7 @@ package com.fedex.connect.customer.service.biz.impl;
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.PageResult; 4 import com.fedex.connect.common.dependencies.date.vo.PageResult;
5 import com.fedex.connect.common.dependencies.date.vo.ResponseVo; 5 import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
6 +import com.fedex.connect.common.model.biz.UploadRecord;
6 import com.fedex.connect.common.model.sys.User; 7 import com.fedex.connect.common.model.sys.User;
7 import com.fedex.connect.customer.data.dto.AttachmentHistoryDto; 8 import com.fedex.connect.customer.data.dto.AttachmentHistoryDto;
8 import com.fedex.connect.customer.data.query.AttachmentHistoryQuery; 9 import com.fedex.connect.customer.data.query.AttachmentHistoryQuery;
...@@ -10,6 +11,7 @@ import com.fedex.connect.customer.service.base.BaseService; ...@@ -10,6 +11,7 @@ import com.fedex.connect.customer.service.base.BaseService;
10 import com.fedex.connect.customer.service.biz.IUploadRecordService; 11 import com.fedex.connect.customer.service.biz.IUploadRecordService;
11 import org.springframework.stereotype.Service; 12 import org.springframework.stereotype.Service;
12 13
14 +import java.util.ArrayList;
13 import java.util.Collections; 15 import java.util.Collections;
14 import java.util.List; 16 import java.util.List;
15 17
...@@ -29,22 +31,23 @@ public class UploadRecordServiceImpl extends BaseService implements IUploadRecor ...@@ -29,22 +31,23 @@ public class UploadRecordServiceImpl extends BaseService implements IUploadRecor
29 * @return com.fedex.connect.common.dependencies.date.vo.ResponseVo 31 * @return com.fedex.connect.common.dependencies.date.vo.ResponseVo
30 */ 32 */
31 public ResponseVo findHistory(AttachmentHistoryQuery attachmentHistoryQuery, User user) { 33 public ResponseVo findHistory(AttachmentHistoryQuery attachmentHistoryQuery, User user) {
32 - List<AttachmentHistoryDto> history = attachmentRepository.findHistory(attachmentHistoryQuery); 34 + List<UploadRecord> history = uploadRecordRepository.getUploadRecordsByConsignmentId(attachmentHistoryQuery);
33 - 35 + List<AttachmentHistoryDto> attachmentHistoryDtos = new ArrayList<>();
34 if (history != null) { 36 if (history != null) {
35 - history.forEach(attachmentHistoryDto -> 37 + for (UploadRecord uploadRecord : history) {
38 + AttachmentHistoryDto attachmentHistoryDto = new AttachmentHistoryDto();
39 + attachmentHistoryDto.setUploadRecord(uploadRecord);
36 attachmentHistoryDto.setCreatorFlag( 40 attachmentHistoryDto.setCreatorFlag(
37 - (attachmentHistoryDto.getUploadUserId() != null && 41 + (uploadRecord.getCreateUserId() != null) ?
38 - attachmentHistoryDto.getUploadUserId().equals(user.getId())) ?
39 DigitConstants.DIGIT_ONE : DigitConstants.DIGIT_ZERO 42 DigitConstants.DIGIT_ONE : DigitConstants.DIGIT_ZERO
40 - )
41 ); 43 );
44 + attachmentHistoryDtos.add(attachmentHistoryDto);
45 + }
42 } 46 }
43 -
44 PageResult pageResult = new PageResult(); 47 PageResult pageResult = new PageResult();
45 pageResult.setPage(attachmentHistoryQuery.getPage()); 48 pageResult.setPage(attachmentHistoryQuery.getPage());
46 pageResult.setSize(attachmentHistoryQuery.getSize()); 49 pageResult.setSize(attachmentHistoryQuery.getSize());
47 - pageResult.setList(history != null ? history : Collections.emptyList()); 50 + pageResult.setList(attachmentHistoryDtos != null ? attachmentHistoryDtos : Collections.emptyList());
48 51
49 return responseUtils.success(pageResult); 52 return responseUtils.success(pageResult);
50 } 53 }
......
...@@ -108,7 +108,7 @@ public class AttachmentUtil { ...@@ -108,7 +108,7 @@ public class AttachmentUtil {
108 //用户上传原文件名称 108 //用户上传原文件名称
109 attachment.setSourceFileName(sourceFileName); 109 attachment.setSourceFileName(sourceFileName);
110 //生成系统文件名称例子:AWB_123456789012_20241023164532982_001.pdf 110 //生成系统文件名称例子:AWB_123456789012_20241023164532982_001.pdf
111 - String fileName = AttachmentBizTypeEnum.valueOf(bizType).getExt1() + BaseSeparatorConstants.SEPARATOR_UNDERLINE + 111 + String fileName = AttachmentBizTypeEnum.getExt1ByCode(bizType) + BaseSeparatorConstants.SEPARATOR_UNDERLINE +
112 consignmentCode + BaseSeparatorConstants.SEPARATOR_UNDERLINE + fileSuffix + suffix; 112 consignmentCode + BaseSeparatorConstants.SEPARATOR_UNDERLINE + fileSuffix + suffix;
113 //系统生成文件名称 113 //系统生成文件名称
114 attachment.setFileName(fileName); 114 attachment.setFileName(fileName);
...@@ -139,4 +139,13 @@ public class AttachmentUtil { ...@@ -139,4 +139,13 @@ public class AttachmentUtil {
139 } 139 }
140 return attachment; 140 return attachment;
141 } 141 }
142 +
143 + public static MultipartFile findFileByName(MultipartFile[] files, String fileName) {
144 + for (MultipartFile file : files) {
145 + if (file.getOriginalFilename().equals(fileName)) {
146 + return file; // 找到匹配的文件,返回该文件
147 + }
148 + }
149 + return null; // 如果没有找到匹配的文件,返回 null
150 + }
142 } 151 }
...\ No newline at end of file ...\ No newline at end of file
......
1 package com.fedex.connect.customer.validate.controller.biz; 1 package com.fedex.connect.customer.validate.controller.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.enums.biz.AttachmentBizTypeEnum;
5 import com.fedex.connect.common.dependencies.util.ResponseUtils; 4 import com.fedex.connect.common.dependencies.util.ResponseUtils;
6 import com.fedex.connect.common.dependencies.util.Utils; 5 import com.fedex.connect.common.dependencies.util.Utils;
7 import com.fedex.connect.customer.constants.CustomerConstant; 6 import com.fedex.connect.customer.constants.CustomerConstant;
...@@ -57,17 +56,5 @@ public class AttachmentValidate { ...@@ -57,17 +56,5 @@ public class AttachmentValidate {
57 if(totalSize > CustomerConstant.VALIDATE_KEYS.UPLOAD_FILE_MAX_SIZE){ 56 if(totalSize > CustomerConstant.VALIDATE_KEYS.UPLOAD_FILE_MAX_SIZE){
58 responseUtils.fail(ResponseCode.MESSAGE_CODE_30008,CustomerConstant.VALIDATE_KEYS.UPLOAD_FILE_MAX_SIZE); 57 responseUtils.fail(ResponseCode.MESSAGE_CODE_30008,CustomerConstant.VALIDATE_KEYS.UPLOAD_FILE_MAX_SIZE);
59 } 58 }
60 - List<String> fileBizTypeList = consignmentBo.getAttachmentBizTypeList();
61 - //运单或发票未上传
62 - if(!fileBizTypeList.contains(AttachmentBizTypeEnum.AWB.getExt1()) ||
63 - !fileBizTypeList.contains(AttachmentBizTypeEnum.INV.getExt1())){
64 - responseUtils.fail(ResponseCode.MESSAGE_CODE_30009);
65 - }
66 - //文件类型不在范围内
67 - fileBizTypeList.stream().forEach(p -> {
68 - if(Objects.isNull(AttachmentBizTypeEnum.valueOf(p))){
69 - responseUtils.fail(ResponseCode.MESSAGE_CODE_30010);
70 - };
71 - });
72 } 59 }
73 } 60 }
......
...@@ -5,6 +5,7 @@ business_log_20003=运单查询 ...@@ -5,6 +5,7 @@ business_log_20003=运单查询
5 business_log_20004=运单详细信息查询 5 business_log_20004=运单详细信息查询
6 business_log_20005=根据运单ID查询用户上传记录 6 business_log_20005=根据运单ID查询用户上传记录
7 business_log_20006=运单历史上传记录查询 7 business_log_20006=运单历史上传记录查询
8 +business_log_20007=上传历史附件记录
8 system_exception_20003=提示信息过长,未保存成功 9 system_exception_20003=提示信息过长,未保存成功
9 10
10 #******************鉴权相关提示,需要做国际化****************** 11 #******************鉴权相关提示,需要做国际化******************
......
...@@ -5,6 +5,7 @@ business_log_20003=运单查询 ...@@ -5,6 +5,7 @@ business_log_20003=运单查询
5 business_log_20004=运单详细信息查询 5 business_log_20004=运单详细信息查询
6 business_log_20005=根据运单ID查询用户上传记录 6 business_log_20005=根据运单ID查询用户上传记录
7 business_log_20006=运单历史上传记录查询 7 business_log_20006=运单历史上传记录查询
8 +business_log_20007=上传历史附件记录
8 system_exception_20003=提示信息过长,未保存成功 9 system_exception_20003=提示信息过长,未保存成功
9 10
10 #******************鉴权相关提示,需要做国际化****************** 11 #******************鉴权相关提示,需要做国际化******************
......
...@@ -29,6 +29,7 @@ import javax.annotation.Resource; ...@@ -29,6 +29,7 @@ import javax.annotation.Resource;
29 import javax.servlet.http.HttpServletRequest; 29 import javax.servlet.http.HttpServletRequest;
30 import javax.servlet.http.HttpServletResponse; 30 import javax.servlet.http.HttpServletResponse;
31 import java.util.*; 31 import java.util.*;
32 +import java.util.stream.Collectors;
32 33
33 /** 34 /**
34 * 定义切面。用于处理定义的切点。 35 * 定义切面。用于处理定义的切点。
...@@ -97,13 +98,19 @@ public class OperationLogAspect { ...@@ -97,13 +98,19 @@ public class OperationLogAspect {
97 //如果是MultipartFile类型,只记录文件的名称 98 //如果是MultipartFile类型,只记录文件的名称
98 Object[] param = pjp.getArgs(); 99 Object[] param = pjp.getArgs();
99 param = Arrays.stream(pjp.getArgs()) 100 param = Arrays.stream(pjp.getArgs())
100 - .filter(o -> !( o instanceof HttpServletResponse)) 101 + .filter(o -> !(o instanceof HttpServletResponse))
101 - .filter(o -> !( o instanceof HttpServletRequest)) 102 + .filter(o -> !(o instanceof HttpServletRequest))
102 .map(o -> { 103 .map(o -> {
103 - if (o instanceof MultipartFile){ 104 + if (o instanceof MultipartFile) {
105 + // 单个 MultipartFile,返回文件名
104 return ((MultipartFile) o).getOriginalFilename(); 106 return ((MultipartFile) o).getOriginalFilename();
107 + } else if (o instanceof MultipartFile[]) {
108 + // MultipartFile[],拼接所有文件名,用逗号分隔
109 + return Arrays.stream((MultipartFile[]) o)
110 + .map(MultipartFile::getOriginalFilename)
111 + .collect(Collectors.joining(", "));
105 } 112 }
106 - return o; 113 + return o; // 其他类型参数保持不变
107 }) 114 })
108 .toArray(); 115 .toArray();
109 //获取请求的参数进行处理 116 //获取请求的参数进行处理
......
...@@ -55,4 +55,14 @@ public enum AttachmentBizTypeEnum { ...@@ -55,4 +55,14 @@ public enum AttachmentBizTypeEnum {
55 public void setExt1(String ext1) { 55 public void setExt1(String ext1) {
56 this.ext1 = ext1; 56 this.ext1 = ext1;
57 } 57 }
58 +
59 + // 通过 code 获取对应的 ext1
60 + public static String getExt1ByCode(String code) {
61 + for (AttachmentBizTypeEnum type : AttachmentBizTypeEnum.values()) {
62 + if (type.getCode().equals(code)) {
63 + return type.getExt1();
64 + }
65 + }
66 + return null; // 如果没有找到匹配的 code,返回 null
67 + }
58 } 68 }
......
...@@ -203,7 +203,7 @@ public class Dm501Util { ...@@ -203,7 +203,7 @@ public class Dm501Util {
203 /** 203 /**
204 * 初始化运单表原产国、目的国 204 * 初始化运单表原产国、目的国
205 */ 205 */
206 - this.initOriginCountryDestinationCountry(ceInfo,consignment); 206 + this.initOriginCountryDestinationCountry(ceInfo,resultConsignment);
207 /** 207 /**
208 * 初始化表基础字段 208 * 初始化表基础字段
209 */ 209 */
......