Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Fedex
/
iClear-Connect-Pre-Clearance
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
zelong.shao
2024-12-18 16:33:47 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
db7d5b9332521bd3df1c7f21d898ece458caac70
db7d5b93
1 parent
03696cc9
customer|流程代码调整
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
443 additions
and
40 deletions
server/biz-customer/src/main/java/com/fedex/connect/customer/controller/biz/impl/AttachmentController.java
server/biz-customer/src/main/java/com/fedex/connect/customer/controller/biz/impl/UploadRecordController.java
server/biz-customer/src/main/java/com/fedex/connect/customer/repository/repo/impl/ConsignmentRepositoryImpl.java
server/biz-customer/src/main/java/com/fedex/connect/customer/service/biz/impl/ConsignmentServiceImpl.java
server/biz-customer/src/main/java/com/fedex/connect/customer/util/service/biz/AttachmentUtil.java
server/biz-customer/src/main/java/com/fedex/connect/customer/util/service/biz/UploadRecordUtil.java
server/biz-customer/src/main/resources/message_en_US.properties
server/biz-customer/src/main/resources/message_zh_CN.properties
server/common-dependencies/src/main/java/com/fedex/connect/common/dependencies/enums/biz/AttachmentBizTypeEnum.java
server/common-dependencies/src/main/java/com/fedex/connect/common/dependencies/template/clearanceEmail/DuplicateEmailTemplate.java
server/common-dependencies/src/main/java/com/fedex/connect/common/dependencies/util/FileUtil.java
server/common-dependencies/src/main/java/com/fedex/connect/common/dependencies/util/ResponseUtils.java
server/kafka-cndc-server/src/main/java/com/fedex/connect/kafka/data/dto/dm/dm501/Dm501Consignments.java
server/kafka-cndc-server/src/main/java/com/fedex/connect/kafka/util/Dm501Util.java
server/manager-server/src/main/webapp/WEB-INF/weblogic.xml
server/task-schedule/src/main/java/com/fedex/connect/task/job/EmailJob.java
server/task-schedule/src/main/java/com/fedex/connect/task/utils/sys/DuplicateEmailUtil.java
server/biz-customer/src/main/java/com/fedex/connect/customer/controller/biz/impl/AttachmentController.java
View file @
db7d5b9
package
com
.
fedex
.
connect
.
customer
.
controller
.
biz
.
impl
;
import
com.fedex.connect.common.dependencies.annotation.OperationMethodLog
;
import
com.fedex.connect.common.dependencies.contants.AnnotationConstants
;
import
com.fedex.connect.common.dependencies.util.FileUtil
;
import
com.fedex.connect.customer.controller.base.BaseController
;
import
com.fedex.connect.customer.controller.biz.IAttachmentController
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
/**
* @Author Szl
* @Description 类说明 附件相关
...
...
@@ -18,4 +27,15 @@ import org.springframework.web.bind.annotation.RestController;
@Api
(
value
=
"AttachmentControllerImpl"
,
tags
=
{
"附件操作相关"
})
public
class
AttachmentController
extends
BaseController
implements
IAttachmentController
{
@GetMapping
(
value
=
"/downLoadFile"
)
@OperationMethodLog
(
describe
=
"business_log_20008"
,
remarkType
=
AnnotationConstants
.
LOG_REMARK_TYPE_SPECIAL
,
status
=
AnnotationConstants
.
LOG_STATUS_SHOW
)
@ApiOperation
(
value
=
"下载单个文件"
)
public
void
downLoadFile
(
HttpServletRequest
request
,
HttpServletResponse
response
,
@RequestParam
(
name
=
"path"
)
String
path
,
@RequestParam
(
name
=
"name"
)
String
name
)
throws
Exception
{
name
=
new
String
(
name
.
getBytes
(
"UTF-8"
),
"ISO-8859-1"
);
String
contentType
=
FileUtil
.
getContentType
(
name
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
name
+
";content-type:"
+
contentType
);
FileUtil
.
download
(
request
,
response
,
path
+
FileUtil
.
SIGN
,
name
,
contentType
);
}
}
...
...
server/biz-customer/src/main/java/com/fedex/connect/customer/controller/biz/impl/UploadRecordController.java
View file @
db7d5b9
...
...
@@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.RestController;
public
class
UploadRecordController
extends
BaseController
implements
IUploadRecordController
{
@Override
@PostMapping
(
"/queryHistoryList
/{consignmentId}
"
)
@PostMapping
(
"/queryHistoryList"
)
@ApiOperation
(
value
=
"ResponseVo"
,
notes
=
"运单历史上传记录查询"
)
@OperationMethodLog
(
describe
=
"business_log_20006"
)
public
ResponseVo
queryHistoryList
(
@RequestBody
AttachmentHistoryQuery
attachmentHistoryQuery
)
{
...
...
server/biz-customer/src/main/java/com/fedex/connect/customer/repository/repo/impl/ConsignmentRepositoryImpl.java
View file @
db7d5b9
...
...
@@ -8,6 +8,7 @@ import com.fedex.connect.customer.data.query.ConsignmentQuery;
import
com.fedex.connect.customer.data.query.UserConsignmentInfoQuery
;
import
com.fedex.connect.customer.repository.base.BaseDao
;
import
com.fedex.connect.customer.repository.repo.IConsignmentRepository
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Repository
;
import
java.time.LocalDate
;
...
...
@@ -45,7 +46,7 @@ public class ConsignmentRepositoryImpl extends BaseDao implements IConsignmentRe
if
(
SystemDefaultUserConstants
.
SYSTEM_USER_KEYS
.
USER_NAME
.
equals
(
consignment
.
getCreateUserName
())){
consignment
.
setCreateUserName
(
user
.
getUserName
());
}
if
(!
user
.
getUserUuid
().
equals
(
consignment
.
getUserUuid
())
&&
!
user
.
getAccountNo
().
equals
(
consignment
.
getShipperAccount
(
))){
if
(!
user
.
getUserUuid
().
equals
(
consignment
.
getUserUuid
())
&&
(!
StringUtils
.
isEmpty
(
user
.
getAccountNo
())
&&
!
user
.
getAccountNo
().
equals
(
consignment
.
getShipperAccount
()
))){
consignment
.
setRecipientContactName
(
null
);
consignment
.
setRecipientCompany
(
null
);
consignment
.
setDocNondocFlag
(
null
);
...
...
server/biz-customer/src/main/java/com/fedex/connect/customer/service/biz/impl/ConsignmentServiceImpl.java
View file @
db7d5b9
...
...
@@ -129,7 +129,7 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS
/**
* 初始化上传记录信息
*/
UploadRecord
uploadRecord
=
uploadRecordUtil
.
initUploadRecord
(
consignment
.
getConsignmentCode
());
UploadRecord
uploadRecord
=
uploadRecordUtil
.
initUploadRecord
(
consignment
.
getConsignmentCode
()
,
user
);
/**
* 保存运单相关信息
*/
...
...
server/biz-customer/src/main/java/com/fedex/connect/customer/util/service/biz/AttachmentUtil.java
View file @
db7d5b9
...
...
@@ -50,7 +50,7 @@ public class AttachmentUtil {
* @return void
*/
private
void
initAttachment
(
Attachment
attachment
,
String
bizType
,
User
user
)
throws
Exception
{
DictionaryEntries
attachmentBizTypeEntries
=
cacheSystem
.
getDicAttachmentBizType
(
bizType
);
DictionaryEntries
attachmentBizTypeEntries
=
cacheSystem
.
getDicAttachmentBizType
(
AttachmentBizTypeEnum
.
getCodeByExt1
(
bizType
)
);
attachment
.
setBizTypeCode
(
attachmentBizTypeEntries
.
getCode
());
attachment
.
setBizTypeName
(
attachmentBizTypeEntries
.
getEnglishName
());
DictionaryEntries
attachmentFileTypeEntries
=
cacheSystem
.
getDicAttachmentFileType
(
AttachmentFileTypeEnum
.
FILE
.
getCode
());
...
...
@@ -108,7 +108,7 @@ public class AttachmentUtil {
//用户上传原文件名称
attachment
.
setSourceFileName
(
sourceFileName
);
//生成系统文件名称例子:AWB_123456789012_20241023164532982_001.pdf
String
fileName
=
AttachmentBizTypeEnum
.
getExt1ByCode
(
bizType
)
+
BaseSeparatorConstants
.
SEPARATOR_UNDERLINE
+
String
fileName
=
bizType
+
BaseSeparatorConstants
.
SEPARATOR_UNDERLINE
+
consignmentCode
+
BaseSeparatorConstants
.
SEPARATOR_UNDERLINE
+
fileSuffix
+
suffix
;
//系统生成文件名称
attachment
.
setFileName
(
fileName
);
...
...
@@ -142,6 +142,7 @@ public class AttachmentUtil {
public
static
MultipartFile
findFileByName
(
MultipartFile
[]
files
,
String
fileName
)
{
for
(
MultipartFile
file
:
files
)
{
log
.
info
(
"fileName:"
+
file
.
getOriginalFilename
());
if
(
file
.
getOriginalFilename
().
equals
(
fileName
))
{
return
file
;
// 找到匹配的文件,返回该文件
}
...
...
server/biz-customer/src/main/java/com/fedex/connect/customer/util/service/biz/UploadRecordUtil.java
View file @
db7d5b9
...
...
@@ -6,6 +6,7 @@ import com.fedex.connect.common.dependencies.enums.biz.ConsignmentStatusEnum;
import
com.fedex.connect.common.dependencies.util.AssignmentFieldUtils
;
import
com.fedex.connect.common.model.bi.DictionaryEntries
;
import
com.fedex.connect.common.model.biz.UploadRecord
;
import
com.fedex.connect.common.model.sys.User
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
...
...
@@ -28,7 +29,7 @@ public class UploadRecordUtil {
* @param consignmentCode
* @return com.fedex.connect.common.model.biz.UploadRecord
*/
public
UploadRecord
initUploadRecord
(
String
consignmentCode
)
throws
Exception
{
public
UploadRecord
initUploadRecord
(
String
consignmentCode
,
User
user
)
throws
Exception
{
DictionaryEntries
consignmentStatusDic
=
cacheSystem
.
getDicConsignmentStatus
(
ConsignmentStatusEnum
.
CONSIGNMENT_STATUS_01
.
getCode
());
UploadRecord
uploadRecord
=
new
UploadRecord
();
//记录当前运单号
...
...
@@ -36,6 +37,10 @@ public class UploadRecordUtil {
//记录当前运单状态
uploadRecord
.
setStatusCode
(
consignmentStatusDic
.
getCode
());
uploadRecord
.
setStatusName
(
consignmentStatusDic
.
getEnglishName
());
uploadRecord
.
setCreateUserId
(
user
.
getId
());
uploadRecord
.
setCreateUserName
(
user
.
getUserName
());
uploadRecord
.
setModifyUserId
(
user
.
getId
());
uploadRecord
.
setModifyUserName
(
user
.
getUserName
());
/**
* 初始化基础字段
*/
...
...
server/biz-customer/src/main/resources/message_en_US.properties
View file @
db7d5b9
...
...
@@ -6,6 +6,7 @@ business_log_20004=运单详细信息查询
business_log_20005
=
根据运单ID查询用户上传记录
business_log_20006
=
运单历史上传记录查询
business_log_20007
=
上传历史附件记录
business_log_20008
=
下载附件
system_exception_20003
=
提示信息过长,未保存成功
#******************鉴权相关提示,需要做国际化******************
...
...
server/biz-customer/src/main/resources/message_zh_CN.properties
View file @
db7d5b9
...
...
@@ -6,6 +6,7 @@ business_log_20004=运单详细信息查询
business_log_20005
=
根据运单ID查询用户上传记录
business_log_20006
=
运单历史上传记录查询
business_log_20007
=
上传历史附件记录
business_log_20008
=
下载附件
system_exception_20003
=
提示信息过长,未保存成功
#******************鉴权相关提示,需要做国际化******************
...
...
server/common-dependencies/src/main/java/com/fedex/connect/common/dependencies/enums/biz/AttachmentBizTypeEnum.java
View file @
db7d5b9
...
...
@@ -65,4 +65,14 @@ public enum AttachmentBizTypeEnum {
}
return
null
;
// 如果没有找到匹配的 code,返回 null
}
public
static
String
getCodeByExt1
(
String
ext1
)
{
for
(
AttachmentBizTypeEnum
type
:
AttachmentBizTypeEnum
.
values
())
{
if
(
type
.
getExt1
().
equals
(
ext1
))
{
return
type
.
getCode
();
}
}
return
null
;
// 如果没有找到匹配的 ext1,返回 null
}
}
...
...
server/common-dependencies/src/main/java/com/fedex/connect/common/dependencies/template/clearanceEmail/DuplicateEmailTemplate.java
View file @
db7d5b9
...
...
@@ -28,17 +28,20 @@ public class DuplicateEmailTemplate implements EmailTemplate {
}
interface
CLEARANCE_TITLE
{
String
TITLE
=
"
Sender Reminder:
"
;
String
TITLE
=
"
Create waybill({0}) reminder
"
;
}
interface
CLEARANCE_BODY
{
String
DESCRIPTION
=
"<p>
Sender Reminder: The task will poll every {0} minutes after the system starts.
</p>\n"
;
String
DESCRIPTION
=
"<p>
This email is a reminder email, please do not reply!
</p>\n"
;
String
BODY
=
"<div><div style='margin-left:4%;'>"
+
"<p align='center'><img src='{0}'></p>"
+
"<p align='center'><img src='{1}'></p>"
+
"<p>Import Pre-Clearance System Notification:</p>"
+
"<p> {2}The consignment has been created and uploaded by another user.</p>"
+
"</font><br/><br/>"
;
//"<p align='center'><img src='{0}'></p>" +
//"<p align='center'><img src='{1}'></p>" +
"<p>FedEx iClear Connect System Notification:</p>"
+
"<p> The waybill with tracking number {0} has been created by someone else. Please verify!</p>"
+
"</font><br/><br/>"
+
"<div style=color:#808080;font-style:Arial;font-size:14px;margin: auto;margin-bottom: 5px;>"
+
"{1}\n"
+
"</div>"
;
}
}
...
...
server/common-dependencies/src/main/java/com/fedex/connect/common/dependencies/util/FileUtil.java
0 → 100644
View file @
db7d5b9
package
com
.
fedex
.
connect
.
common
.
dependencies
.
util
;
import
org.apache.poi.util.IOUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.util.StreamUtils
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.*
;
import
java.net.URL
;
import
java.net.URLConnection
;
import
java.nio.file.*
;
import
java.nio.file.attribute.BasicFileAttributes
;
import
java.text.SimpleDateFormat
;
import
java.util.Arrays
;
import
java.util.Date
;
//import org.junit.platform.commons.util.StringUtils;
/**
* Created by liyang on 2017/4/22.
*/
public
class
FileUtil
{
private
static
Logger
log
=
LoggerFactory
.
getLogger
(
FileUtil
.
class
);
private
static
final
int
BUFFER_SIZE
=
16
*
1024
;
public
static
final
String
SIGN
=
"/"
;
private
static
final
SimpleDateFormat
DATE_FORMAT_YYYYMM
=
new
SimpleDateFormat
(
"yyyyMM"
);
private
static
final
SimpleDateFormat
DATE_FORMAT_YYYYMMDDHHMMSSSSS
=
new
SimpleDateFormat
(
"yyyyMMdd_HHmmss_SSS"
);
public
static
String
getContentType
(
String
fileName
)
{
// 使用 URLConnection 根据文件名获取 MIME 类型
String
contentType
=
URLConnection
.
guessContentTypeFromName
(
fileName
);
if
(
contentType
==
null
)
{
// 如果无法推测出 MIME 类型,则默认为 "application/octet-stream"
contentType
=
"application/octet-stream"
;
}
return
contentType
;
}
/**
* 文件上传到服务器
*
* @param file
* @param updatePath
* @param entityName
* @return
* @throws IOException
*/
public
static
File
fileUpload
(
MultipartFile
file
,
String
updatePath
,
String
entityName
)
throws
IOException
{
byte
[]
bytes
=
file
.
getBytes
();
if
(
bytes
==
null
||
bytes
.
length
==
0
)
{
return
null
;
}
if
(
updatePath
.
endsWith
(
SIGN
)){
updatePath
=
updatePath
.
substring
(
0
,
updatePath
.
lastIndexOf
(
"SIGN"
));
}
String
finalTargetFolder
=
updatePath
+
SIGN
+
DATE_FORMAT_YYYYMM
.
format
(
new
Date
());
File
rootFolder
=
new
File
(
finalTargetFolder
);
// 文件夹不存在,则创建文件夹
if
(!
rootFolder
.
exists
())
{
rootFolder
.
mkdirs
();
}
// 生成文件名
String
[]
nameSplit
=
file
.
getOriginalFilename
().
split
(
"\\."
);
File
finalFile
=
new
File
(
finalTargetFolder
+
SIGN
+
entityName
+
"_"
+
DATE_FORMAT_YYYYMMDDHHMMSSSSS
.
format
(
new
Date
())
+
"."
+
nameSplit
[
nameSplit
.
length
-
1
]);
// 写文件
if
(!
file
.
isEmpty
())
{
file
.
transferTo
(
finalFile
);
}
return
finalFile
;
}
/**
* 文件上传到服务器
*
* @param file
* @param updatePath
* @param entityName
* @param superAddition 追加目录
* @return
* @throws IOException
*/
public
static
File
fileUpload
(
MultipartFile
file
,
String
updatePath
,
String
entityName
,
String
superAddition
)
throws
IOException
{
/* byte[] bytes = file.getBytes();
if (bytes == null || bytes.length == 0) {
return null;
}*/
if
(
updatePath
.
endsWith
(
SIGN
)){
updatePath
=
updatePath
.
substring
(
0
,
updatePath
.
lastIndexOf
(
SIGN
));
}
String
finalTargetFolder
=
updatePath
+
SIGN
+
DATE_FORMAT_YYYYMM
.
format
(
new
Date
())
+
SIGN
+
superAddition
;
log
.
info
(
finalTargetFolder
);
File
rootFolder
=
new
File
(
finalTargetFolder
);
// 文件夹不存在,则创建文件夹
if
(!
rootFolder
.
exists
())
{
rootFolder
.
mkdirs
();
}
// 生成文件名
String
[]
nameSplit
=
file
.
getOriginalFilename
().
split
(
"\\."
);
File
finalFile
=
new
File
(
finalTargetFolder
+
SIGN
+
entityName
+
"_"
+
DATE_FORMAT_YYYYMMDDHHMMSSSSS
.
format
(
new
Date
())
+
"."
+
nameSplit
[
nameSplit
.
length
-
1
]);
log
.
info
(
Arrays
.
toString
(
nameSplit
));
// 写文件
//if (!file.isEmpty()) {
/*import org.apache.commons.io.FileUtils;
FileUtils.copyInputStreamToFile(file.getInputStream(), finalFile);*/
//具体参考:https://blog.csdn.net/canduecho/article/details/131598461
try
(
OutputStream
outputStream
=
new
FileOutputStream
(
finalFile
))
{
StreamUtils
.
copy
(
file
.
getInputStream
(),
outputStream
);
}
//}
return
finalFile
;
}
/**
* 下载
*
* @param request
* @param response
* @param storeName
* @param contentType
* @throws Exception
*/
public
static
void
download
(
HttpServletRequest
request
,
HttpServletResponse
response
,
String
folder
,
String
storeName
,
String
contentType
)
throws
Exception
{
response
.
setContentType
(
"text/html;charset=UTF-8"
);
request
.
setCharacterEncoding
(
"UTF-8"
);
BufferedInputStream
bis
=
null
;
BufferedOutputStream
bos
=
null
;
String
downLoadPath
=
folder
+
storeName
;
long
fileLength
=
new
File
(
downLoadPath
).
length
();
response
.
setContentType
(
contentType
);
response
.
setHeader
(
"Content-Length"
,
String
.
valueOf
(
fileLength
));
bis
=
new
BufferedInputStream
(
new
FileInputStream
(
downLoadPath
));
bos
=
new
BufferedOutputStream
(
response
.
getOutputStream
());
byte
[]
buff
=
new
byte
[
2048
];
int
bytesRead
;
while
(-
1
!=
(
bytesRead
=
bis
.
read
(
buff
,
0
,
buff
.
length
)))
{
bos
.
write
(
buff
,
0
,
bytesRead
);
}
bis
.
close
();
bos
.
close
();
}
/**
* 下载
*
* @param request
* @param response
* @param storeName
* @param contentType
* @param realName
* @throws Exception
*/
public
static
void
download
(
HttpServletRequest
request
,
HttpServletResponse
response
,
String
folder
,
String
storeName
,
String
contentType
,
String
realName
)
throws
Exception
{
response
.
setContentType
(
"text/html;charset=UTF-8"
);
request
.
setCharacterEncoding
(
"UTF-8"
);
BufferedInputStream
bis
=
null
;
BufferedOutputStream
bos
=
null
;
// String ctxPath = uploadFolder + SIGN;
String
downLoadPath
=
folder
+
storeName
;
long
fileLength
=
new
File
(
downLoadPath
).
length
();
response
.
setContentType
(
contentType
);
response
.
setHeader
(
"Content-disposition"
,
"attachment; filename=\""
+
new
String
(
realName
.
getBytes
(
"GBK"
),
"ISO8859-1"
)
+
"\""
);
response
.
setHeader
(
"Content-Length"
,
String
.
valueOf
(
fileLength
));
bis
=
new
BufferedInputStream
(
new
FileInputStream
(
downLoadPath
));
bos
=
new
BufferedOutputStream
(
response
.
getOutputStream
());
byte
[]
buff
=
new
byte
[
2048
];
int
bytesRead
;
while
(-
1
!=
(
bytesRead
=
bis
.
read
(
buff
,
0
,
buff
.
length
)))
{
bos
.
write
(
buff
,
0
,
bytesRead
);
}
bis
.
close
();
bos
.
close
();
}
/**
* copy文件
*
* @param oldLoad 需要下载文件路径
* @param newLoad 需要copy路径
*/
public
static
void
copyFile
(
String
oldLoad
,
String
newLoad
,
String
fileNme
)
{
InputStream
inputStream
=
null
;
OutputStream
outputStream
=
null
;
try
{
File
rootFolder
=
new
File
(
newLoad
);
//文件夹不存在,则创建文件夹
if
(!
rootFolder
.
exists
())
{
rootFolder
.
mkdirs
();
}
//图片下载
URL
url
=
new
URL
(
oldLoad
);
URLConnection
conn
=
url
.
openConnection
();
inputStream
=
conn
.
getInputStream
();
outputStream
=
new
FileOutputStream
(
new
File
(
newLoad
+
"//"
+
fileNme
));
IOUtils
.
copy
(
inputStream
,
outputStream
);
}
catch
(
IOException
e
)
{
System
.
err
.
println
(
e
);
}
finally
{
IOUtils
.
closeQuietly
(
inputStream
);
IOUtils
.
closeQuietly
(
outputStream
);
}
}
/**
* 创建文件
*
* @param filepath
* @throws IOException
*/
public
static
void
createFile
(
String
filepath
)
throws
IOException
{
File
file
=
new
File
(
filepath
);
if
(!
file
.
exists
())
{
file
.
createNewFile
();
}
}
public
static
void
copyAndRenameFile
(
String
sourceFile
,
String
targetPath
,
String
newFileName
)
{
File
in
=
new
File
(
sourceFile
);
File
out
=
new
File
(
targetPath
);
// 目标文件夹
try
{
Files
.
copy
(
in
.
toPath
(),
out
.
toPath
().
resolve
(
newFileName
),
StandardCopyOption
.
REPLACE_EXISTING
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
public
static
void
createFolder
(
String
folderPath
){
try
{
File
file
=
new
File
(
folderPath
);
file
.
mkdirs
();
}
catch
(
Exception
e
){
e
.
printStackTrace
();
log
.
error
(
"createFolder() error:{}"
,
e
);
}
}
public
static
boolean
deleteAllFile
(
String
dir
)
{
File
dirFile
=
new
File
(
dir
);
if
((!
dirFile
.
exists
())
||
(!
dirFile
.
isDirectory
()))
{
log
.
info
(
"删除文件夹失败:{} 不存在!"
,
dir
);
return
false
;
}
boolean
flag
=
true
;
// 删除文件夹中的所有文件包括子文件夹
File
[]
files
=
dirFile
.
listFiles
();
for
(
int
i
=
0
;
i
<
files
.
length
;
i
++)
{
// 删除子文件
if
(
files
[
i
].
isFile
())
{
flag
=
FileUtil
.
deleteFile
(
files
[
i
].
getAbsolutePath
());
if
(!
flag
){
break
;
}
// 删除子文件夹
}
else
if
(
files
[
i
].
isDirectory
())
{
flag
=
FileUtil
.
deleteAllFile
(
files
[
i
].
getAbsolutePath
());
if
(!
flag
){
break
;
}
}
}
if
(!
flag
)
{
log
.
info
(
"删除文件夹{}失败!"
,
dir
);
return
false
;
}
// 删除当前文件夹
if
(
dirFile
.
delete
())
{
log
.
info
(
"删除文件夹"
+
dir
+
"成功!"
);
return
true
;
}
else
{
return
false
;
}
}
public
static
boolean
deleteFile
(
String
fileName
)
{
try
{
File
file
=
new
File
(
fileName
);
if
(
file
.
exists
()
&&
file
.
isFile
())
{
if
(
file
.
delete
())
{
log
.
info
(
"删除文件"
+
fileName
+
"成功!"
);
return
true
;
}
else
{
log
.
info
(
"删除文件"
+
fileName
+
"失败!"
);
return
false
;
}
}
else
{
log
.
info
(
fileName
+
"不存在!"
);
return
false
;
}
}
catch
(
Exception
e
){
log
.
error
(
"deleteFile() fileName:{} error:{},"
,
fileName
,
e
);
}
return
false
;
}
public
static
String
getFileNameWithoutSuffix
(
String
fileName
){
return
fileName
.
substring
(
0
,
fileName
.
lastIndexOf
(
"."
));
}
public
static
void
copyFiles
(
String
sourceFolder
,
String
targetFolder
)
throws
IOException
{
Path
sourcePath
=
Paths
.
get
(
sourceFolder
);
Path
targetPath
=
Paths
.
get
(
targetFolder
);
if
(!
Files
.
exists
(
targetPath
))
{
Files
.
createDirectories
(
targetPath
);
}
Files
.
walkFileTree
(
sourcePath
,
new
SimpleFileVisitor
<
Path
>()
{
@Override
public
FileVisitResult
visitFile
(
Path
file
,
BasicFileAttributes
attrs
)
throws
IOException
{
Path
destination
=
targetPath
.
resolve
(
sourcePath
.
relativize
(
file
));
Files
.
copy
(
file
,
destination
,
StandardCopyOption
.
REPLACE_EXISTING
);
return
FileVisitResult
.
CONTINUE
;
}
@Override
public
FileVisitResult
visitFileFailed
(
Path
file
,
IOException
exc
)
throws
IOException
{
return
FileVisitResult
.
CONTINUE
;
}
});
}
}
server/common-dependencies/src/main/java/com/fedex/connect/common/dependencies/util/ResponseUtils.java
View file @
db7d5b9
...
...
@@ -86,8 +86,13 @@ public class ResponseUtils {
}
public
<
T
>
ResponseVo
success
(
T
data
)
{
if
(
data
instanceof
Enum
)
{
ResponseCodeBo
responseCodeBo
=
this
.
ref
(
data
);
return
new
ResponseVo
<>(
200
,
responseCodeBo
.
getErrMsg
(),
null
);
}
else
{
return
new
ResponseVo
<>(
data
);
}
}
public
String
msg
(
String
msg
){
String
message
=
localeMessageUtil
.
getMessage
(
msg
);
...
...
server/kafka-cndc-server/src/main/java/com/fedex/connect/kafka/data/dto/dm/dm501/Dm501Consignments.java
View file @
db7d5b9
...
...
@@ -52,7 +52,7 @@ public class Dm501Consignments implements Serializable {
//扫描状态日期
Date
scanDate
;
//用户uuid
String
u
ui
d
;
String
u
serI
d
;
//发件人邮箱
String
shipperEmail
;
...
...
server/kafka-cndc-server/src/main/java/com/fedex/connect/kafka/util/Dm501Util.java
View file @
db7d5b9
package
com
.
fedex
.
connect
.
kafka
.
util
;
import
com.fedex.connect.common.dependencies.cache.CacheSystem
;
import
com.fedex.connect.common.dependencies.enums.biz.ConsignmentStatusEnum
;
import
com.fedex.connect.common.dependencies.util.AssignmentFieldUtils
;
import
com.fedex.connect.common.dependencies.util.DateUtil
;
import
com.fedex.connect.common.model.bi.DictionaryEntries
;
...
...
@@ -108,7 +107,7 @@ public class Dm501Util {
//重量单位
ceInfo
.
setWeightunit
(
dm501Consignment
.
getWeightUnit
());
//用户uuid
ceInfo
.
setUserUuid
(
dm501Consignment
.
getU
ui
d
());
ceInfo
.
setUserUuid
(
dm501Consignment
.
getU
serI
d
());
//发件人邮箱
ceInfo
.
setShipperEmail
(
dm501Consignment
.
getShipperEmail
());
//参考信息
...
...
server/manager-server/src/main/webapp/WEB-INF/weblogic.xml
View file @
db7d5b9
...
...
@@ -9,4 +9,8 @@
<library-name>
lib4iClearConnect
</library-name>
<specification-version>
1.0
</specification-version>
</wls:library-ref>
<wls:virtual-directory-mapping>
<wls:local-path>
/app/Oracle/Middleware/user_projects/domains/base_domain/iclearConnect
</wls:local-path>
<wls:url-pattern>
/*
</wls:url-pattern>
</wls:virtual-directory-mapping>
</wls:weblogic-web-app>
\ No newline at end of file
...
...
server/task-schedule/src/main/java/com/fedex/connect/task/job/EmailJob.java
View file @
db7d5b9
...
...
@@ -25,11 +25,11 @@ public class EmailJob {
* @param
* @return void
*/
//
@ProcessingInterval(paramCode = ParamConfigConstants.TASK_PARAM_KEYS.NOTIFICATION_SENDER_EMAIL_INTERVAL)
//
@Scheduled(cron = "${export.task.allocation.sendOb}")
//
public void notificationSenderTask() {
//
duplicateConsignmentEmailService.duplicateConsignmentEmail();
//
}
@ProcessingInterval
(
paramCode
=
ParamConfigConstants
.
TASK_PARAM_KEYS
.
NOTIFICATION_SENDER_EMAIL_INTERVAL
)
@Scheduled
(
cron
=
"${export.task.allocation.sendOb}"
)
public
void
notificationSenderTask
()
{
duplicateConsignmentEmailService
.
duplicateConsignmentEmail
();
}
/**
* @Author Szl
...
...
@@ -38,15 +38,15 @@ public class EmailJob {
* @param
* @return void
*/
@ProcessingInterval
(
paramCode
=
ParamConfigConstants
.
TASK_PARAM_KEYS
.
PUSH_CON_EMAIL_INTERVAL
)
@Scheduled
(
cron
=
"${export.task.allocation.sendOb}"
)
public
void
pushConsignmentFileTask
()
{
pushConsignmentFileService
.
pushConsignmentFileTask
();
}
/**
* 发送失败邮件提醒
*/
//
@ProcessingInterval(paramCode = ParamConfigConstants.TASK_PARAM_KEYS.PUSH_CON_EMAIL_INTERVAL)
//
@Scheduled(cron = "${export.task.allocation.sendOb}")
//
public void pushConsignmentFileTask() {
//
pushConsignmentFileService.pushConsignmentFileTask();
//
}
//
/
//
**
//
* 发送失败邮件提醒
//
*/
//@ProcessingInterval(paramCode = ParamConfigConstants.TASK_PARAM_KEYS.SEND_FAIL_ALERT_INTERVAL)
//@Scheduled(cron = "${export.task.allocation.sendOb}")
//public void sendingFailedEmailAlert() {
...
...
server/task-schedule/src/main/java/com/fedex/connect/task/utils/sys/DuplicateEmailUtil.java
View file @
db7d5b9
package
com
.
fedex
.
connect
.
task
.
utils
.
sys
;
import
com.fedex.connect.common.dependencies.cache.CacheSystem
;
import
com.fedex.connect.common.dependencies.contants.ParamConfigConstants
;
import
com.fedex.connect.common.dependencies.enums.biz.EmailStatusEnum
;
import
com.fedex.connect.common.dependencies.template.clearanceEmail.DuplicateEmailTemplate
;
import
com.fedex.connect.common.model.bi.DictionaryEntries
;
import
com.fedex.connect.common.model.biz.Email
;
import
com.fedex.connect.common.model.log.EmailHistory
;
import
com.fedex.connect.common.model.sys.ParamConfig
;
import
com.fedex.connect.task.config.PropertiesConfig
;
import
com.fedex.connect.task.data.dto.MailConfigDto
;
import
com.fedex.connect.task.repository.repo.biz.IEmailRepository
;
...
...
@@ -59,7 +57,7 @@ public class DuplicateEmailUtil {
mailConfigDto
.
setReceiveAccount
(
email
.
getToAddress
());
//设置邮件标题
mailConfigDto
.
setSubject
(
duplicateEmailTemplate
.
getTitle
());
mailConfigDto
.
setSubject
(
duplicateEmailTemplate
.
getTitle
(
email
.
getBizCode
()
));
String
emailBody
=
this
.
createEmailBody
(
email
.
getBizCode
());
mailConfigDto
.
setContent
(
emailBody
);
...
...
@@ -89,14 +87,11 @@ public class DuplicateEmailUtil {
* 邮件备注
*/
StringBuffer
remarks
=
new
StringBuffer
();
ParamConfig
paramConfig
=
paramConfigRepository
.
findValueByCode
(
ParamConfigConstants
.
TASK_PARAM_KEYS
.
NOTIFICATION_SENDER_EMAIL_INTERVAL
);
this
.
buildBottom
(
remarks
,
paramConfig
.
getValue
());
this
.
buildBottom
(
remarks
);
/**
* 添加模板
*/
return
duplicateEmailTemplate
.
getBody
(
propertiesConfig
.
getBaseUrl
()+
propertiesConfig
.
getLine
(),
propertiesConfig
.
getBaseUrl
()+
propertiesConfig
.
getFedex
(),
bizCode
,
remarks
);
return
duplicateEmailTemplate
.
getBody
(
bizCode
,
remarks
);
}
...
...
@@ -107,8 +102,8 @@ public class DuplicateEmailUtil {
* @param remarks
* @return void
*/
private
void
buildBottom
(
StringBuffer
remarks
,
String
paramConfig
){
remarks
.
append
(
duplicateEmailTemplate
.
getDescription
(
paramConfig
));
private
void
buildBottom
(
StringBuffer
remarks
){
remarks
.
append
(
duplicateEmailTemplate
.
getDescription
());
}
/**
...
...
Please
register
or
login
to post a comment