zelong.shao

customer|流程代码调整

Showing 17 changed files with 86 additions and 41 deletions
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);
}
}
......
......@@ -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) {
......
......@@ -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);
......
......@@ -129,7 +129,7 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS
/**
* 初始化上传记录信息
*/
UploadRecord uploadRecord = uploadRecordUtil.initUploadRecord(consignment.getConsignmentCode());
UploadRecord uploadRecord = uploadRecordUtil.initUploadRecord(consignment.getConsignmentCode(),user);
/**
* 保存运单相关信息
*/
......
......@@ -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; // 找到匹配的文件,返回该文件
}
......
......@@ -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());
/**
* 初始化基础字段
*/
......
......@@ -6,6 +6,7 @@ business_log_20004=运单详细信息查询
business_log_20005=根据运单ID查询用户上传记录
business_log_20006=运单历史上传记录查询
business_log_20007=上传历史附件记录
business_log_20008=下载附件
system_exception_20003=提示信息过长,未保存成功
#******************鉴权相关提示,需要做国际化******************
......
......@@ -6,6 +6,7 @@ business_log_20004=运单详细信息查询
business_log_20005=根据运单ID查询用户上传记录
business_log_20006=运单历史上传记录查询
business_log_20007=上传历史附件记录
business_log_20008=下载附件
system_exception_20003=提示信息过长,未保存成功
#******************鉴权相关提示,需要做国际化******************
......
......@@ -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
}
}
......
......@@ -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>&nbsp;&nbsp;&nbsp;&nbsp;{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>&nbsp;&nbsp;&nbsp;&nbsp;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>";
}
}
......
......@@ -86,7 +86,12 @@ public class ResponseUtils {
}
public <T> ResponseVo success(T data) {
return new ResponseVo<>(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){
......
......@@ -52,7 +52,7 @@ public class Dm501Consignments implements Serializable {
//扫描状态日期
Date scanDate;
//用户uuid
String uuid;
String userId;
//发件人邮箱
String shipperEmail;
......
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.getUuid());
ceInfo.setUserUuid(dm501Consignment.getUserId());
//发件人邮箱
ceInfo.setShipperEmail(dm501Consignment.getShipperEmail());
//参考信息
......
......@@ -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
......
......@@ -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() {
......
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());
}
/**
......