zelong.shao

customer|历史附件查询

Showing 17 changed files with 222 additions and 7 deletions
...@@ -3,6 +3,7 @@ package com.fedex.connect.customer.controller; ...@@ -3,6 +3,7 @@ package com.fedex.connect.customer.controller;
3 3
4 import com.fedex.connect.common.dependencies.date.vo.ResponseResultVo; 4 import com.fedex.connect.common.dependencies.date.vo.ResponseResultVo;
5 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil; 5 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil;
6 +import com.fedex.connect.customer.service.biz.IAttachmentService;
6 import com.fedex.connect.customer.service.biz.IConsignmentService; 7 import com.fedex.connect.customer.service.biz.IConsignmentService;
7 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.http.HttpHeaders; 9 import org.springframework.http.HttpHeaders;
...@@ -25,6 +26,9 @@ public class AbstractEtController { ...@@ -25,6 +26,9 @@ public class AbstractEtController {
25 @Autowired 26 @Autowired
26 protected IConsignmentService consignmentService; 27 protected IConsignmentService consignmentService;
27 28
29 + @Autowired
30 + protected IAttachmentService attachmentService;
31 +
28 32
29 public <T> ResponseEntity<T> seeOther(String url) { 33 public <T> ResponseEntity<T> seeOther(String url) {
30 HttpHeaders httpHeaders = new HttpHeaders(); 34 HttpHeaders httpHeaders = new HttpHeaders();
......
1 +package com.fedex.connect.customer.controller.biz;
2 +
3 +public interface IAttachmentController {
4 +}
1 +package com.fedex.connect.customer.controller.biz.impl;
2 +
3 +import com.fedex.connect.common.dependencies.date.model.LogShowModel;
4 +import com.fedex.connect.common.dependencies.date.vo.ResponseResultVo;
5 +import com.fedex.connect.common.dependencies.enums.ResponseCode;
6 +import com.fedex.connect.common.dependencies.util.CurrentUserInfo;
7 +import com.fedex.connect.customer.controller.AbstractEtController;
8 +import com.fedex.connect.customer.controller.biz.IAttachmentController;
9 +import com.fedex.connect.customer.data.bo.LongBo;
10 +import io.swagger.annotations.Api;
11 +import io.swagger.annotations.ApiOperation;
12 +import org.slf4j.Logger;
13 +import org.slf4j.LoggerFactory;
14 +import org.springframework.web.bind.annotation.PostMapping;
15 +import org.springframework.web.bind.annotation.RequestBody;
16 +import org.springframework.web.bind.annotation.RequestMapping;
17 +import org.springframework.web.bind.annotation.RestController;
18 +
19 +/**
20 + * @Author Szl
21 + * @Description 类说明 附件相关
22 + * @Date 2024/11/4
23 + */
24 +@RestController
25 +@RequestMapping(value = "/attachment", name = "附件相关")
26 +@Api(value = "AttachmentControllerImpl", tags = {"附件相关"})
27 +public class AttachmentControllerImpl extends AbstractEtController implements IAttachmentController {
28 + private static final Logger logger = LoggerFactory.getLogger(AttachmentControllerImpl.class);
29 +
30 + @PostMapping("/find/history")
31 + @ApiOperation(value = "历史上传记录查询")
32 + public ResponseResultVo findHistory(@RequestBody LongBo bo) {
33 + Long userId = null;
34 + try {
35 + userId = CurrentUserInfo.getUserId();
36 + //userId = 0L;
37 + } catch (Exception e) {
38 + logger.error(LogShowModel.showException("Exception", e));
39 + return ResponseResultVo.fail(localeMessageUtil.getMessage(ResponseCode.TOKEN_FORMAT_ERROR.getMsg()));
40 + }
41 + if (userId == null) {
42 + return ResponseResultVo.fail(localeMessageUtil.getMessage(ResponseCode.OVERDUE_TOKEN_CODE.getMsg()));
43 + }
44 + return attachmentService.findHistory(userId,bo.getId());
45 + }
46 +
47 +}
1 +package com.fedex.connect.customer.data.bo;
2 +
3 +import lombok.Data;
4 +
5 +@Data
6 +public class LongBo {
7 + Long id;
8 +}
1 +package com.fedex.connect.customer.data.dto;
2 +
3 +import lombok.Data;
4 +
5 +import java.util.Date;
6 +
7 +@Data
8 +public class AttachmentHistoryDto {
9 + private String uploadUserName;
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;
20 +
21 +}
...@@ -13,7 +13,7 @@ import java.util.List; ...@@ -13,7 +13,7 @@ import java.util.List;
13 13
14 /** 14 /**
15 * @Author Szl 15 * @Author Szl
16 - * @Description 类说明 查询条件对象 16 + * @Description 类说明 运单查询条件对象
17 * @Date 2024/10/31 17 * @Date 2024/10/31
18 */ 18 */
19 public class ConsignmentQuery extends PageBase { 19 public class ConsignmentQuery extends PageBase {
......
1 package com.fedex.connect.customer.repository.base; 1 package com.fedex.connect.customer.repository.base;
2 2
3 +import com.fedex.connect.customer.repository.dao.AttachmentMapper;
3 import com.fedex.connect.customer.repository.dao.ConsignmentExtMapper; 4 import com.fedex.connect.customer.repository.dao.ConsignmentExtMapper;
4 import org.springframework.beans.factory.annotation.Autowired; 5 import org.springframework.beans.factory.annotation.Autowired;
5 6
6 public class BaseDao { 7 public class BaseDao {
7 @Autowired 8 @Autowired
8 public ConsignmentExtMapper consignmentExtMapper; 9 public ConsignmentExtMapper consignmentExtMapper;
10 + @Autowired
11 + public AttachmentMapper attachmentMapper;
9 } 12 }
......
1 +package com.fedex.connect.customer.repository.dao;
2 +
3 +import com.fedex.connect.customer.data.dto.AttachmentHistoryDto;
4 +import org.apache.ibatis.annotations.Mapper;
5 +import org.apache.ibatis.annotations.Param;
6 +
7 +import java.util.List;
8 +
9 +@Mapper
10 +public interface AttachmentMapper {
11 + List<AttachmentHistoryDto> findHistory(@Param("bizId") Long bizId);
12 +}
1 +package com.fedex.connect.customer.repository.repo;
2 +
3 +import com.fedex.connect.customer.data.dto.AttachmentHistoryDto;
4 +
5 +import java.util.List;
6 +
7 +public interface IAttachmentRepository {
8 + List<AttachmentHistoryDto> findHistory(Long bizId);
9 +}
...\ No newline at end of file ...\ No newline at end of file
1 +package com.fedex.connect.customer.repository.repo.impl;
2 +
3 +import com.fedex.connect.customer.data.dto.AttachmentHistoryDto;
4 +import com.fedex.connect.customer.repository.base.BaseDao;
5 +import com.fedex.connect.customer.repository.repo.IAttachmentRepository;
6 +import org.springframework.stereotype.Repository;
7 +
8 +import java.util.List;
9 +
10 +@Repository
11 +public class AttachmentRepositoryImpl extends BaseDao implements IAttachmentRepository {
12 + @Override
13 + public List<AttachmentHistoryDto> findHistory(Long bizId) {
14 + return attachmentMapper.findHistory(bizId);
15 + }
16 +}
...@@ -2,7 +2,8 @@ package com.fedex.connect.customer.service; ...@@ -2,7 +2,8 @@ package com.fedex.connect.customer.service;
2 2
3 3
4 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil; 4 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil;
5 -import com.fedex.connect.customer.repository.repo.impl.ConsignmentExtRepositoryImpl; 5 +import com.fedex.connect.customer.repository.repo.IAttachmentRepository;
6 +import com.fedex.connect.customer.repository.repo.IConsignmentExtRepository;
6 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
7 8
8 import javax.annotation.Resource; 9 import javax.annotation.Resource;
...@@ -13,7 +14,10 @@ public class AbstractEtService { ...@@ -13,7 +14,10 @@ public class AbstractEtService {
13 protected LocaleMessageUtil localeMessageUtil; 14 protected LocaleMessageUtil localeMessageUtil;
14 15
15 @Autowired 16 @Autowired
16 - protected ConsignmentExtRepositoryImpl consignmentExtRepository; 17 + protected IConsignmentExtRepository consignmentExtRepository;
18 +
19 + @Autowired
20 + protected IAttachmentRepository attachmentRepository;
17 21
18 /** 22 /**
19 * repository 23 * repository
......
1 +package com.fedex.connect.customer.service.biz;
2 +
3 +import com.fedex.connect.common.dependencies.date.vo.ResponseResultVo;
4 +
5 +public interface IAttachmentService {
6 + ResponseResultVo findHistory(Long userId, Long bizId);
7 +}
1 +package com.fedex.connect.customer.service.biz.impl;
2 +
3 +import com.fedex.connect.common.dependencies.contants.DigitConstants;
4 +import com.fedex.connect.common.dependencies.date.vo.PageResult;
5 +import com.fedex.connect.common.dependencies.date.vo.ResponseResultVo;
6 +import com.fedex.connect.customer.data.dto.AttachmentHistoryDto;
7 +import com.fedex.connect.customer.service.AbstractEtService;
8 +import com.fedex.connect.customer.service.biz.IAttachmentService;
9 +import org.springframework.stereotype.Service;
10 +
11 +import java.util.Collections;
12 +import java.util.List;
13 +
14 +/**
15 + * @Author Szl
16 + * @Description 类说明 附件相关service
17 + * @Date 2024/11/4
18 + */
19 +@Service
20 +public class AttachmentServiceImpl extends AbstractEtService implements IAttachmentService {
21 + public ResponseResultVo findHistory(Long userId, Long bizId) {
22 + List<AttachmentHistoryDto> history = attachmentRepository.findHistory(bizId);
23 +
24 + if (history != null) {
25 + history.forEach(attachmentHistoryDto ->
26 + attachmentHistoryDto.setCreatorFlag(
27 + (attachmentHistoryDto.getUploadUserId() != null &&
28 + attachmentHistoryDto.getUploadUserId().equals(userId)) ?
29 + DigitConstants.DIGIT_ONE : DigitConstants.DIGIT_ZERO
30 + )
31 + );
32 + }
33 +
34 + PageResult pageResult = new PageResult();
35 + pageResult.setList(history != null ? history : Collections.emptyList());
36 +
37 + return ResponseResultVo.succ(pageResult);
38 + }
39 +
40 +}
1 +package com.fedex.connect.common.dependencies.enums.sys;
2 +
3 +public enum UserTypeEnum {
4 + LOCAL(0L,"LOCAL","本地账号"),
5 + FCL(1L,"FCL","FCL账号");
6 +
7 + private Long code;
8 + private String enMsg;
9 + private String msg;
10 +
11 + UserTypeEnum(Long code, String enMsg,String msg) {
12 + this.code = code;
13 + this.enMsg = enMsg;
14 + this.msg = msg;
15 + }
16 +
17 + public Long getCode() {
18 + return code;
19 + }
20 +
21 + public void setCode(Long code) {
22 + this.code = code;
23 + }
24 +
25 + public String getEnMsg() {
26 + return enMsg;
27 + }
28 +
29 + public void setEnMsg(String enMsg) {
30 + this.enMsg = enMsg;
31 + }
32 +
33 + public String getMsg() {
34 + return msg;
35 + }
36 +
37 + public void setMsg(String msg) {
38 + this.msg = msg;
39 + }
40 +}
1 package com.fedex.connect.common.dependencies.repository.repo.bi.impl; 1 package com.fedex.connect.common.dependencies.repository.repo.bi.impl;
2 2
3 +import com.fedex.connect.common.dependencies.contants.DatabaseConstants;
3 import com.fedex.connect.common.dependencies.repository.base.BaseDao; 4 import com.fedex.connect.common.dependencies.repository.base.BaseDao;
4 import com.fedex.connect.common.dependencies.repository.repo.bi.IDictionaryEntriesRepository; 5 import com.fedex.connect.common.dependencies.repository.repo.bi.IDictionaryEntriesRepository;
5 import com.fedex.connect.common.model.bi.DictionaryEntries; 6 import com.fedex.connect.common.model.bi.DictionaryEntries;
...@@ -13,6 +14,9 @@ public class DictionaryEntriesImpl extends BaseDao implements IDictionaryEntries ...@@ -13,6 +14,9 @@ public class DictionaryEntriesImpl extends BaseDao implements IDictionaryEntries
13 14
14 @Override 15 @Override
15 public List<DictionaryEntries> selectByExample(DictionaryEntriesExample example) { 16 public List<DictionaryEntries> selectByExample(DictionaryEntriesExample example) {
17 + DictionaryEntriesExample.Criteria criteria = example.createCriteria();
18 + criteria.andStatusEqualTo(DatabaseConstants.GLOBAL_STATUS_VALID);
19 + example.setOrderByClause("CREATE_TIME DESC");
16 return dictionaryEntriesMapper.selectByExample(example); 20 return dictionaryEntriesMapper.selectByExample(example);
17 } 21 }
18 } 22 }
......
1 package com.fedex.connect.common.dependencies.service.bi.impl; 1 package com.fedex.connect.common.dependencies.service.bi.impl;
2 2
3 -import com.fedex.connect.common.dependencies.contants.DatabaseConstants;
4 import com.fedex.connect.common.dependencies.date.model.LogShowModel; 3 import com.fedex.connect.common.dependencies.date.model.LogShowModel;
5 import com.fedex.connect.common.dependencies.service.base.BaseService; 4 import com.fedex.connect.common.dependencies.service.base.BaseService;
6 import com.fedex.connect.common.dependencies.service.bi.IDictionaryEntriesService; 5 import com.fedex.connect.common.dependencies.service.bi.IDictionaryEntriesService;
...@@ -20,9 +19,6 @@ public class DictionaryEntriesServiceImpl extends BaseService implements IDictio ...@@ -20,9 +19,6 @@ public class DictionaryEntriesServiceImpl extends BaseService implements IDictio
20 public List<DictionaryEntries> findAll() { 19 public List<DictionaryEntries> findAll() {
21 try{ 20 try{
22 DictionaryEntriesExample example = new DictionaryEntriesExample(); 21 DictionaryEntriesExample example = new DictionaryEntriesExample();
23 - DictionaryEntriesExample.Criteria criteria = example.createCriteria();
24 - criteria.andStatusEqualTo(DatabaseConstants.GLOBAL_STATUS_VALID);
25 - example.setOrderByClause("CREATE_TIME DESC");
26 return dictionaryEntriesRepository.selectByExample(example); 22 return dictionaryEntriesRepository.selectByExample(example);
27 } catch (Exception e){ 23 } catch (Exception e){
28 log.error(LogShowModel.showException("Exception",e)); 24 log.error(LogShowModel.showException("Exception",e));
......