zelong.shao

customer|历史附件查询

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