zelong.shao

customer|流程代码调整

Showing 27 changed files with 480 additions and 59 deletions
......@@ -4,4 +4,6 @@ import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
public interface IAttachmentQueryController {
ResponseVo queryInfo(Long consignmentId);
ResponseVo queryByRecord(Long recordId);
}
......
package com.fedex.connect.customer.controller.biz;
import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
import com.fedex.connect.customer.data.query.AttachmentHistoryQuery;
public interface IUploadRecordController {
ResponseVo queryHistoryList(Long consignmentId);
ResponseVo queryHistoryList(AttachmentHistoryQuery attachmentHistoryQuery);
}
......
......@@ -5,13 +5,15 @@ import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
import com.fedex.connect.common.model.sys.User;
import com.fedex.connect.customer.controller.base.BaseController;
import com.fedex.connect.customer.controller.biz.IAttachmentQueryController;
import com.fedex.connect.customer.data.bo.LongBo;
import com.fedex.connect.customer.data.query.UserConsignmentInfoQuery;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author Szl
......@@ -43,4 +45,23 @@ public class AttachmentQueryController extends BaseController implements IAttach
UserConsignmentInfoQuery userConsignmentInfoQuery = UserConsignmentInfoQuery.getInstance(user,consignmentId);
return attachmentQueryService.queryInfo(userConsignmentInfoQuery);
}
@Override
@PostMapping("/queryByRecord/{recordId}")
@ApiOperation(value = "ResponseVo", notes = "根据批次号查询用户上传记录")
@OperationMethodLog(describe = "business_log_20005")
public ResponseVo queryByRecord(@ApiParam(value="Record ID",required = true) @PathVariable(value = "recordId") Long recordId) {
/**
* 运单id非空校验
*/
consignmentInfoValidate.validateConsignmentId(recordId);
/**
* 获取当前用户信息
*/
User user = this.getCurrentUserInfo();
/**
* 构造查询对象
*/
return attachmentQueryService.queryByRecord(recordId);
}
}
......
......@@ -8,10 +8,9 @@ import com.fedex.connect.customer.controller.biz.IUploadRecordController;
import com.fedex.connect.customer.data.query.AttachmentHistoryQuery;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PathVariable;
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;
......@@ -30,8 +29,7 @@ public class UploadRecordController extends BaseController implements IUploadRec
@PostMapping("/queryHistoryList/{consignmentId}")
@ApiOperation(value = "ResponseVo", notes = "运单历史上传记录查询")
@OperationMethodLog(describe = "business_log_20006")
public ResponseVo queryHistoryList(@ApiParam(value="运单ID",required = true) @PathVariable(value = "consignmentId") Long consignmentId) {
AttachmentHistoryQuery attachmentHistoryQuery = AttachmentHistoryQuery.getInstance(consignmentId);
public ResponseVo queryHistoryList(@RequestBody AttachmentHistoryQuery attachmentHistoryQuery) {
/**
* 运单id非空校验
*/
......
package com.fedex.connect.customer.data.bo;
import com.fedex.connect.common.dependencies.annotation.BaseNotBlank;
import com.fedex.connect.common.model.biz.Attachment;
import lombok.Data;
import java.util.List;
......@@ -29,5 +30,5 @@ public class ConsignmentBo {
private String destinationCountry;
//文件业务类型AWB,INV,PKL,OTH(分运单,发票,箱单和其它这四种类型)
@BaseNotBlank(describe = "business_field_31008")
private List<String> attachmentBizTypeList;
private List<Attachment> attachmentBizTypeList;
}
......
package com.fedex.connect.customer.data.dto;
import com.fedex.connect.common.model.biz.UploadRecord;
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 UploadRecord uploadRecord;
private Integer creatorFlag;
}
......
......@@ -3,6 +3,7 @@ package com.fedex.connect.customer.repository.base;
import com.fedex.connect.common.dao.biz.*;
import com.fedex.connect.customer.repository.dao.AttachmentExtMapper;
import com.fedex.connect.customer.repository.dao.ConsignmentExtMapper;
import com.fedex.connect.customer.repository.dao.UploadRecordExtMapper;
import org.springframework.beans.factory.annotation.Autowired;
public class BaseDao {
......@@ -22,4 +23,6 @@ public class BaseDao {
protected AttachmentExtMapper attachmentExtMapper;
@Autowired
protected EmailMapper emailMapper;
@Autowired
protected UploadRecordExtMapper uploadRecordExtMapper;
}
\ No newline at end of file
......
......@@ -18,4 +18,8 @@ public interface AttachmentExtMapper {
"(SELECT MAX(ID) FROM T_BIZ_UPLOAD_RECORD WHERE CREATE_USER_ID = #{query.userId} " +
"AND CONSIGNMENT_ID = #{query.consignmentId}) AND STATUS = 1")
List<Attachment> queryInfo(@Param("query") UserConsignmentInfoQuery query);
@Select("SELECT * FROM T_BIZ_ATTACHMENT WHERE UPLOAD_RECORD_ID = #{uploadRecordId}")
List<Attachment> getAttachmentsByUploadRecordId(@Param("uploadRecordId") Long uploadRecordId);
}
\ No newline at end of file
......
......@@ -25,7 +25,7 @@ public interface ConsignmentExtMapper {
") WHERE ROWNUM = 1")
Consignment findByConsignmentCode(@Param("consignmentCode") String consignmentCode, @Param("dateParam") LocalDate dateParam);
@Select("SELECT BC.* FROM T_BIZ_CONSIGNMENT BC INNER JOIN T_BIZ_USER_CONSIGNMENT_MAPPING BUCM ON(BC.ID = BUCM.CONSIGNMENT_ID) " +
@Select("SELECT BC.* FROM T_BIZ_CONSIGNMENT BC LEFT JOIN T_BIZ_USER_CONSIGNMENT_MAPPING BUCM ON(BC.ID = BUCM.CONSIGNMENT_ID) " +
"WHERE BC.ID = #{query.consignmentId} AND (BC.USER_UUID = #{query.userUuid} OR BUCM.USER_ID = #{query.userId})")
Consignment findConsignmentInfo(@Param("query") UserConsignmentInfoQuery query);
......
package com.fedex.connect.customer.repository.dao;
import com.fedex.connect.common.model.biz.UploadRecord;
import com.fedex.connect.customer.data.query.AttachmentHistoryQuery;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface UploadRecordExtMapper {
List<UploadRecord> getUploadRecordsByConsignmentId(AttachmentHistoryQuery attachmentHistoryQuery);
}
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fedex.connect.customer.repository.dao.UploadRecordExtMapper">
<resultMap id="BaseResultMap" type="com.fedex.connect.common.model.biz.UploadRecord">
<id column="ID" jdbcType="NUMERIC" property="id" />
<result column="CONSIGNMENT_ID" jdbcType="NUMERIC" property="consignmentId" />
<result column="STATUS_CODE" jdbcType="VARCHAR" property="statusCode" />
<result column="STATUS_NAME" jdbcType="VARCHAR" property="statusName" />
<result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime" />
<result column="CREATE_USER_ID" jdbcType="NUMERIC" property="createUserId" />
<result column="CREATE_USER_NAME" jdbcType="VARCHAR" property="createUserName" />
<result column="MODIFY_TIME" jdbcType="TIMESTAMP" property="modifyTime" />
<result column="MODIFY_USER_ID" jdbcType="NUMERIC" property="modifyUserId" />
<result column="MODIFY_USER_NAME" jdbcType="VARCHAR" property="modifyUserName" />
<result column="CONSIGNMENT_CODE" jdbcType="VARCHAR" property="consignmentCode" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
ID, CONSIGNMENT_ID, STATUS_CODE, STATUS_NAME, CREATE_TIME, CREATE_USER_ID, CREATE_USER_NAME,
MODIFY_TIME, MODIFY_USER_ID, MODIFY_USER_NAME, CONSIGNMENT_CODE
</sql>
<select id="selectByExample" parameterType="com.fedex.connect.common.model.biz.UploadRecordExample" resultMap="BaseResultMap">
<include refid="OracleDialectPrefix" />
select
<if test="distinct">
distinct
</if>
'true' as QUERYID,
<include refid="Base_Column_List" />
from T_BIZ_UPLOAD_RECORD
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<include refid="OracleDialectSuffix" />
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from T_BIZ_UPLOAD_RECORD
where ID = #{id,jdbcType=NUMERIC}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from T_BIZ_UPLOAD_RECORD
where ID = #{id,jdbcType=NUMERIC}
</delete>
<delete id="deleteByExample" parameterType="com.fedex.connect.common.model.biz.UploadRecordExample">
delete from T_BIZ_UPLOAD_RECORD
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.fedex.connect.common.model.biz.UploadRecord">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
SELECT SEQ_T_BIZ_UPLOAD_RECORD.NEXTVAL FROM DUAL
</selectKey>
insert into T_BIZ_UPLOAD_RECORD (ID, CONSIGNMENT_ID, STATUS_CODE,
STATUS_NAME, CREATE_TIME, CREATE_USER_ID,
CREATE_USER_NAME, MODIFY_TIME, MODIFY_USER_ID,
MODIFY_USER_NAME, CONSIGNMENT_CODE)
values (#{id,jdbcType=NUMERIC}, #{consignmentId,jdbcType=NUMERIC}, #{statusCode,jdbcType=VARCHAR},
#{statusName,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{createUserId,jdbcType=NUMERIC},
#{createUserName,jdbcType=VARCHAR}, #{modifyTime,jdbcType=TIMESTAMP}, #{modifyUserId,jdbcType=NUMERIC},
#{modifyUserName,jdbcType=VARCHAR}, #{consignmentCode,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.fedex.connect.common.model.biz.UploadRecord">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
SELECT SEQ_T_BIZ_UPLOAD_RECORD.NEXTVAL FROM DUAL
</selectKey>
insert into T_BIZ_UPLOAD_RECORD
<trim prefix="(" suffix=")" suffixOverrides=",">
ID,
<if test="consignmentId != null">
CONSIGNMENT_ID,
</if>
<if test="statusCode != null">
STATUS_CODE,
</if>
<if test="statusName != null">
STATUS_NAME,
</if>
<if test="createTime != null">
CREATE_TIME,
</if>
<if test="createUserId != null">
CREATE_USER_ID,
</if>
<if test="createUserName != null">
CREATE_USER_NAME,
</if>
<if test="modifyTime != null">
MODIFY_TIME,
</if>
<if test="modifyUserId != null">
MODIFY_USER_ID,
</if>
<if test="modifyUserName != null">
MODIFY_USER_NAME,
</if>
<if test="consignmentCode != null">
CONSIGNMENT_CODE,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id,jdbcType=NUMERIC},
<if test="consignmentId != null">
#{consignmentId,jdbcType=NUMERIC},
</if>
<if test="statusCode != null">
#{statusCode,jdbcType=VARCHAR},
</if>
<if test="statusName != null">
#{statusName,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="createUserId != null">
#{createUserId,jdbcType=NUMERIC},
</if>
<if test="createUserName != null">
#{createUserName,jdbcType=VARCHAR},
</if>
<if test="modifyTime != null">
#{modifyTime,jdbcType=TIMESTAMP},
</if>
<if test="modifyUserId != null">
#{modifyUserId,jdbcType=NUMERIC},
</if>
<if test="modifyUserName != null">
#{modifyUserName,jdbcType=VARCHAR},
</if>
<if test="consignmentCode != null">
#{consignmentCode,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.fedex.connect.common.model.biz.UploadRecordExample" resultType="java.lang.Long">
select count(*) from T_BIZ_UPLOAD_RECORD
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update T_BIZ_UPLOAD_RECORD
<set>
<if test="record.id != null">
ID = #{record.id,jdbcType=NUMERIC},
</if>
<if test="record.consignmentId != null">
CONSIGNMENT_ID = #{record.consignmentId,jdbcType=NUMERIC},
</if>
<if test="record.statusCode != null">
STATUS_CODE = #{record.statusCode,jdbcType=VARCHAR},
</if>
<if test="record.statusName != null">
STATUS_NAME = #{record.statusName,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
CREATE_TIME = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.createUserId != null">
CREATE_USER_ID = #{record.createUserId,jdbcType=NUMERIC},
</if>
<if test="record.createUserName != null">
CREATE_USER_NAME = #{record.createUserName,jdbcType=VARCHAR},
</if>
<if test="record.modifyTime != null">
MODIFY_TIME = #{record.modifyTime,jdbcType=TIMESTAMP},
</if>
<if test="record.modifyUserId != null">
MODIFY_USER_ID = #{record.modifyUserId,jdbcType=NUMERIC},
</if>
<if test="record.modifyUserName != null">
MODIFY_USER_NAME = #{record.modifyUserName,jdbcType=VARCHAR},
</if>
<if test="record.consignmentCode != null">
CONSIGNMENT_CODE = #{record.consignmentCode,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update T_BIZ_UPLOAD_RECORD
set ID = #{record.id,jdbcType=NUMERIC},
CONSIGNMENT_ID = #{record.consignmentId,jdbcType=NUMERIC},
STATUS_CODE = #{record.statusCode,jdbcType=VARCHAR},
STATUS_NAME = #{record.statusName,jdbcType=VARCHAR},
CREATE_TIME = #{record.createTime,jdbcType=TIMESTAMP},
CREATE_USER_ID = #{record.createUserId,jdbcType=NUMERIC},
CREATE_USER_NAME = #{record.createUserName,jdbcType=VARCHAR},
MODIFY_TIME = #{record.modifyTime,jdbcType=TIMESTAMP},
MODIFY_USER_ID = #{record.modifyUserId,jdbcType=NUMERIC},
MODIFY_USER_NAME = #{record.modifyUserName,jdbcType=VARCHAR},
CONSIGNMENT_CODE = #{record.consignmentCode,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.fedex.connect.common.model.biz.UploadRecord">
update T_BIZ_UPLOAD_RECORD
<set>
<if test="consignmentId != null">
CONSIGNMENT_ID = #{consignmentId,jdbcType=NUMERIC},
</if>
<if test="statusCode != null">
STATUS_CODE = #{statusCode,jdbcType=VARCHAR},
</if>
<if test="statusName != null">
STATUS_NAME = #{statusName,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
CREATE_TIME = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="createUserId != null">
CREATE_USER_ID = #{createUserId,jdbcType=NUMERIC},
</if>
<if test="createUserName != null">
CREATE_USER_NAME = #{createUserName,jdbcType=VARCHAR},
</if>
<if test="modifyTime != null">
MODIFY_TIME = #{modifyTime,jdbcType=TIMESTAMP},
</if>
<if test="modifyUserId != null">
MODIFY_USER_ID = #{modifyUserId,jdbcType=NUMERIC},
</if>
<if test="modifyUserName != null">
MODIFY_USER_NAME = #{modifyUserName,jdbcType=VARCHAR},
</if>
<if test="consignmentCode != null">
CONSIGNMENT_CODE = #{consignmentCode,jdbcType=VARCHAR},
</if>
</set>
where ID = #{id,jdbcType=NUMERIC}
</update>
<update id="updateByPrimaryKey" parameterType="com.fedex.connect.common.model.biz.UploadRecord">
update T_BIZ_UPLOAD_RECORD
set CONSIGNMENT_ID = #{consignmentId,jdbcType=NUMERIC},
STATUS_CODE = #{statusCode,jdbcType=VARCHAR},
STATUS_NAME = #{statusName,jdbcType=VARCHAR},
CREATE_TIME = #{createTime,jdbcType=TIMESTAMP},
CREATE_USER_ID = #{createUserId,jdbcType=NUMERIC},
CREATE_USER_NAME = #{createUserName,jdbcType=VARCHAR},
MODIFY_TIME = #{modifyTime,jdbcType=TIMESTAMP},
MODIFY_USER_ID = #{modifyUserId,jdbcType=NUMERIC},
MODIFY_USER_NAME = #{modifyUserName,jdbcType=VARCHAR},
CONSIGNMENT_CODE = #{consignmentCode,jdbcType=VARCHAR}
where ID = #{id,jdbcType=NUMERIC}
</update>
<sql id="OracleDialectPrefix">
<if test="start != null and start >= 0 and size != null and size >= 0">
select * from ( select row_.*, rownum rownum_ from (
</if>
</sql>
<sql id="OracleDialectSuffix">
<if test="start != null and start >= 0 and size != null and size >= 0">
<![CDATA[ ) row_ ) where rownum_ > #{start} and rownum_ <= #{start} + #{size} ]]>
</if>
</sql>
<select id="getUploadRecordsByConsignmentId" resultType="com.fedex.connect.common.model.biz.UploadRecord">
<include refid="OracleDialectPrefix"/>
SELECT
*
FROM
T_BIZ_UPLOAD_RECORD
WHERE
CONSIGNMENT_ID = #{consignmentId}
<include refid="OracleDialectSuffix" />
</select>
</mapper>
\ No newline at end of file
......@@ -15,4 +15,6 @@ public interface IAttachmentRepository {
Attachment saveOrUpdate(Attachment entity);
void saveOrUpdateAll(List<Attachment> list);
List<Attachment> getAttachmentsByUploadRecordId(Long uploadRecordId);
}
\ No newline at end of file
......
package com.fedex.connect.customer.repository.repo;
import com.fedex.connect.common.model.biz.UploadRecord;
import com.fedex.connect.customer.data.query.AttachmentHistoryQuery;
import java.util.List;
......@@ -21,4 +22,12 @@ public interface IUploadRecordRepository {
* @return void
*/
void saveOrUpdateAll(List<UploadRecord> list);
/**
* @Author Szl
* @Description 功能说明 根据运单id查询历史上传数据
* @Date 2024/12/16
* @return java.util.List<com.fedex.connect.common.model.biz.UploadRecord>
*/
List<UploadRecord> getUploadRecordsByConsignmentId(AttachmentHistoryQuery attachmentHistoryQuery);
}
......
package com.fedex.connect.customer.repository.repo.impl;
import com.fedex.connect.common.model.biz.Attachment;
import com.fedex.connect.common.model.biz.UploadRecord;
import com.fedex.connect.customer.data.dto.AttachmentHistoryDto;
import com.fedex.connect.customer.data.query.AttachmentHistoryQuery;
import com.fedex.connect.customer.data.query.UserConsignmentInfoQuery;
......@@ -52,4 +51,9 @@ public class AttachmentRepositoryImpl extends BaseDao implements IAttachmentRepo
}
});
}
@Override
public List<Attachment> getAttachmentsByUploadRecordId(Long uploadRecordId) {
return attachmentExtMapper.getAttachmentsByUploadRecordId(uploadRecordId);
}
}
\ No newline at end of file
......
package com.fedex.connect.customer.repository.repo.impl;
import com.fedex.connect.common.model.biz.UploadRecord;
import com.fedex.connect.customer.data.query.AttachmentHistoryQuery;
import com.fedex.connect.customer.repository.base.BaseDao;
import com.fedex.connect.customer.repository.repo.IUploadRecordRepository;
import org.springframework.stereotype.Repository;
......@@ -31,4 +32,11 @@ public class UploadRecordRepositoryImpl extends BaseDao implements IUploadRecord
}
});
}
@Override
public List<UploadRecord> getUploadRecordsByConsignmentId(AttachmentHistoryQuery attachmentHistoryQuery) {
return uploadRecordExtMapper.getUploadRecordsByConsignmentId(attachmentHistoryQuery);
}
}
......
......@@ -5,4 +5,6 @@ import com.fedex.connect.customer.data.query.UserConsignmentInfoQuery;
public interface IAttachmentQueryService {
ResponseVo queryInfo(UserConsignmentInfoQuery userConsignmentInfoQuery);
ResponseVo queryByRecord(Long recordId);
}
......
......@@ -8,7 +8,7 @@ import java.util.List;
public interface IAttachmentService {
List<Attachment> uploadAttachments(MultipartFile[] files,
List<String> attachmentBizTypeList,
List<Attachment> attachmentBizTypeList,
User user,
String consignmentCode);
......
......@@ -28,4 +28,9 @@ public class AttachmentQueryServiceImpl extends BaseService implements IAttachme
List<Attachment> attachmentList = attachmentRepository.queryInfo(userConsignmentInfoQuery);
return responseUtils.success(attachmentList);
}
@Override
public ResponseVo queryByRecord(Long recordId) {
return responseUtils.success(attachmentRepository.getAttachmentsByUploadRecordId(recordId));
}
}
\ No newline at end of file
......
......@@ -7,6 +7,7 @@ import com.fedex.connect.common.model.sys.User;
import com.fedex.connect.customer.service.base.BaseService;
import com.fedex.connect.customer.service.biz.IAttachmentService;
import com.fedex.connect.customer.util.service.biz.AttachmentUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
......@@ -48,19 +49,33 @@ public class AttachmentServiceImpl extends BaseService implements IAttachmentSer
* @return void
*/
public List<Attachment> uploadAttachments(MultipartFile[] files,
List<String> attachmentBizTypeList,
List<Attachment> attachmentBizTypeList,
User user,
String consignmentCode){
List<Attachment> attachmentList = new ArrayList<>();
String yyyyMMddHHmmss = DateUtil.yyyyMMddHHmmss(new Date());
try {
for (int i = 0; i < files.length; i++) {
MultipartFile file = files[i];
String bizType = attachmentBizTypeList.get(i);
int i = 0;
for (Attachment attachment : attachmentBizTypeList) {
/**
* 判断是否为需要复制过来的历史图片,如果是则复制,如果不是则新增
*/
String bizType = attachment.getBizTypeCode();
//构造文件后缀
String fileSuffix = yyyyMMddHHmmss + BaseSeparatorConstants.SEPARATOR_UNDERLINE + String.format("%03d",(i + 1));
Attachment attachment = attachmentUtil.uploadFile(file, bizType, user, consignmentCode, fileSuffix);
attachmentList.add(attachment);
String filePath = attachment.getFilePath();
Attachment attachmentNew = null;
if (StringUtils.isEmpty(filePath)){
MultipartFile file = attachmentUtil.findFileByName(files,attachment.getFileName());
attachmentNew = attachmentUtil.uploadFile(file, bizType, user, consignmentCode, fileSuffix);
}else {
attachmentNew = attachment;
attachmentNew.setId(null);
attachmentNew.setCreateTime(new Date());
attachmentNew.setModifyTime(new Date());
}
attachmentList.add(attachmentNew);
++i;
}
}catch(Exception ex){
//如果上传过程中存在失败,则所有已上传的文件进行删除
......
......@@ -3,6 +3,7 @@ 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.ResponseVo;
import com.fedex.connect.common.model.biz.UploadRecord;
import com.fedex.connect.common.model.sys.User;
import com.fedex.connect.customer.data.dto.AttachmentHistoryDto;
import com.fedex.connect.customer.data.query.AttachmentHistoryQuery;
......@@ -10,6 +11,7 @@ import com.fedex.connect.customer.service.base.BaseService;
import com.fedex.connect.customer.service.biz.IUploadRecordService;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
......@@ -29,22 +31,23 @@ public class UploadRecordServiceImpl extends BaseService implements IUploadRecor
* @return com.fedex.connect.common.dependencies.date.vo.ResponseVo
*/
public ResponseVo findHistory(AttachmentHistoryQuery attachmentHistoryQuery, User user) {
List<AttachmentHistoryDto> history = attachmentRepository.findHistory(attachmentHistoryQuery);
List<UploadRecord> history = uploadRecordRepository.getUploadRecordsByConsignmentId(attachmentHistoryQuery);
List<AttachmentHistoryDto> attachmentHistoryDtos = new ArrayList<>();
if (history != null) {
history.forEach(attachmentHistoryDto ->
attachmentHistoryDto.setCreatorFlag(
(attachmentHistoryDto.getUploadUserId() != null &&
attachmentHistoryDto.getUploadUserId().equals(user.getId())) ?
DigitConstants.DIGIT_ONE : DigitConstants.DIGIT_ZERO
)
);
for (UploadRecord uploadRecord : history) {
AttachmentHistoryDto attachmentHistoryDto = new AttachmentHistoryDto();
attachmentHistoryDto.setUploadRecord(uploadRecord);
attachmentHistoryDto.setCreatorFlag(
(uploadRecord.getCreateUserId() != null) ?
DigitConstants.DIGIT_ONE : DigitConstants.DIGIT_ZERO
);
attachmentHistoryDtos.add(attachmentHistoryDto);
}
}
PageResult pageResult = new PageResult();
pageResult.setPage(attachmentHistoryQuery.getPage());
pageResult.setSize(attachmentHistoryQuery.getSize());
pageResult.setList(history != null ? history : Collections.emptyList());
pageResult.setList(attachmentHistoryDtos != null ? attachmentHistoryDtos : Collections.emptyList());
return responseUtils.success(pageResult);
}
......
......@@ -108,7 +108,7 @@ public class AttachmentUtil {
//用户上传原文件名称
attachment.setSourceFileName(sourceFileName);
//生成系统文件名称例子:AWB_123456789012_20241023164532982_001.pdf
String fileName = AttachmentBizTypeEnum.valueOf(bizType).getExt1() + BaseSeparatorConstants.SEPARATOR_UNDERLINE +
String fileName = AttachmentBizTypeEnum.getExt1ByCode(bizType) + BaseSeparatorConstants.SEPARATOR_UNDERLINE +
consignmentCode + BaseSeparatorConstants.SEPARATOR_UNDERLINE + fileSuffix + suffix;
//系统生成文件名称
attachment.setFileName(fileName);
......@@ -139,4 +139,13 @@ public class AttachmentUtil {
}
return attachment;
}
public static MultipartFile findFileByName(MultipartFile[] files, String fileName) {
for (MultipartFile file : files) {
if (file.getOriginalFilename().equals(fileName)) {
return file; // 找到匹配的文件,返回该文件
}
}
return null; // 如果没有找到匹配的文件,返回 null
}
}
\ No newline at end of file
......
package com.fedex.connect.customer.validate.controller.biz;
import com.fedex.connect.common.dependencies.contants.DigitConstants;
import com.fedex.connect.common.dependencies.enums.biz.AttachmentBizTypeEnum;
import com.fedex.connect.common.dependencies.util.ResponseUtils;
import com.fedex.connect.common.dependencies.util.Utils;
import com.fedex.connect.customer.constants.CustomerConstant;
......@@ -57,17 +56,5 @@ public class AttachmentValidate {
if(totalSize > CustomerConstant.VALIDATE_KEYS.UPLOAD_FILE_MAX_SIZE){
responseUtils.fail(ResponseCode.MESSAGE_CODE_30008,CustomerConstant.VALIDATE_KEYS.UPLOAD_FILE_MAX_SIZE);
}
List<String> fileBizTypeList = consignmentBo.getAttachmentBizTypeList();
//运单或发票未上传
if(!fileBizTypeList.contains(AttachmentBizTypeEnum.AWB.getExt1()) ||
!fileBizTypeList.contains(AttachmentBizTypeEnum.INV.getExt1())){
responseUtils.fail(ResponseCode.MESSAGE_CODE_30009);
}
//文件类型不在范围内
fileBizTypeList.stream().forEach(p -> {
if(Objects.isNull(AttachmentBizTypeEnum.valueOf(p))){
responseUtils.fail(ResponseCode.MESSAGE_CODE_30010);
};
});
}
}
......
......@@ -5,6 +5,7 @@ business_log_20003=运单查询
business_log_20004=运单详细信息查询
business_log_20005=根据运单ID查询用户上传记录
business_log_20006=运单历史上传记录查询
business_log_20007=上传历史附件记录
system_exception_20003=提示信息过长,未保存成功
#******************鉴权相关提示,需要做国际化******************
......
......@@ -5,6 +5,7 @@ business_log_20003=运单查询
business_log_20004=运单详细信息查询
business_log_20005=根据运单ID查询用户上传记录
business_log_20006=运单历史上传记录查询
business_log_20007=上传历史附件记录
system_exception_20003=提示信息过长,未保存成功
#******************鉴权相关提示,需要做国际化******************
......
......@@ -29,6 +29,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
import java.util.stream.Collectors;
/**
* 定义切面。用于处理定义的切点。
......@@ -97,13 +98,19 @@ public class OperationLogAspect {
//如果是MultipartFile类型,只记录文件的名称
Object[] param = pjp.getArgs();
param = Arrays.stream(pjp.getArgs())
.filter(o -> !( o instanceof HttpServletResponse))
.filter(o -> !( o instanceof HttpServletRequest))
.filter(o -> !(o instanceof HttpServletResponse))
.filter(o -> !(o instanceof HttpServletRequest))
.map(o -> {
if (o instanceof MultipartFile){
if (o instanceof MultipartFile) {
// 单个 MultipartFile,返回文件名
return ((MultipartFile) o).getOriginalFilename();
} else if (o instanceof MultipartFile[]) {
// MultipartFile[],拼接所有文件名,用逗号分隔
return Arrays.stream((MultipartFile[]) o)
.map(MultipartFile::getOriginalFilename)
.collect(Collectors.joining(", "));
}
return o;
return o; // 其他类型参数保持不变
})
.toArray();
//获取请求的参数进行处理
......
......@@ -55,4 +55,14 @@ public enum AttachmentBizTypeEnum {
public void setExt1(String ext1) {
this.ext1 = ext1;
}
// 通过 code 获取对应的 ext1
public static String getExt1ByCode(String code) {
for (AttachmentBizTypeEnum type : AttachmentBizTypeEnum.values()) {
if (type.getCode().equals(code)) {
return type.getExt1();
}
}
return null; // 如果没有找到匹配的 code,返回 null
}
}
......
......@@ -203,7 +203,7 @@ public class Dm501Util {
/**
* 初始化运单表原产国、目的国
*/
this.initOriginCountryDestinationCountry(ceInfo,consignment);
this.initOriginCountryDestinationCountry(ceInfo,resultConsignment);
/**
* 初始化表基础字段
*/
......