Showing
12 changed files
with
76 additions
and
24 deletions
server/biz-customer/src/main/java/com/fedex/connect/customer/repository/dao/UserExtMapper.java
0 → 100644
| 1 | +package com.fedex.connect.customer.repository.dao; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.model.sys.User; | ||
| 4 | +import org.apache.ibatis.annotations.Mapper; | ||
| 5 | +import org.apache.ibatis.annotations.Param; | ||
| 6 | +import org.apache.ibatis.annotations.Select; | ||
| 7 | + | ||
| 8 | +@Mapper | ||
| 9 | +public interface UserExtMapper { | ||
| 10 | + @Select("SELECT * FROM T_SYS_USER WHERE USER_UUID = #{uuid}") | ||
| 11 | + public User findUserByUuid(@Param("uuid") String uuid); | ||
| 12 | +} |
| ... | @@ -327,7 +327,7 @@ | ... | @@ -327,7 +327,7 @@ |
| 327 | FROM | 327 | FROM |
| 328 | T_BIZ_UPLOAD_RECORD | 328 | T_BIZ_UPLOAD_RECORD |
| 329 | WHERE | 329 | WHERE |
| 330 | - CONSIGNMENT_ID = #{consignmentId} | 330 | + CONSIGNMENT_ID = #{consignmentId} ORDER BY ID DESC |
| 331 | <include refid="OracleDialectSuffix" /> | 331 | <include refid="OracleDialectSuffix" /> |
| 332 | </select> | 332 | </select> |
| 333 | </mapper> | 333 | </mapper> |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -49,15 +49,12 @@ public class ConsignmentRepositoryImpl extends BaseDao implements IConsignmentRe | ... | @@ -49,15 +49,12 @@ public class ConsignmentRepositoryImpl extends BaseDao implements IConsignmentRe |
| 49 | if (SystemDefaultUserConstants.SYSTEM_USER_KEYS.USER_NAME.equals(consignment.getCreateUserName())){ | 49 | if (SystemDefaultUserConstants.SYSTEM_USER_KEYS.USER_NAME.equals(consignment.getCreateUserName())){ |
| 50 | consignment.setCreateUserName(user.getUserName()); | 50 | consignment.setCreateUserName(user.getUserName()); |
| 51 | } | 51 | } |
| 52 | - if (!user.getUserUuid().equals(consignment.getUserUuid()) && (!StringUtils.isEmpty(user.getAccountNo()) && !user.getAccountNo().equals(consignment.getShipperAccount())) | 52 | + if (!StringUtils.equals(user.getUserUuid(), consignment.getUserUuid()) |
| 53 | - && (!StringUtils.isEmpty(consignment.getUserInputShipperAccount()) && !consignment.getUserInputShipperAccount().equals(consignment.getShipperAccount()))){ | 53 | + && !StringUtils.equals(user.getAccountNo(), consignment.getShipperAccount()) |
| 54 | + && !StringUtils.equals(consignment.getUserInputShipperAccount(), consignment.getShipperAccount())) { | ||
| 54 | consignment.setRecipientContactName(null); | 55 | consignment.setRecipientContactName(null); |
| 55 | consignment.setRecipientCompany(null); | 56 | consignment.setRecipientCompany(null); |
| 56 | consignment.setDocNondocFlag(null); | 57 | consignment.setDocNondocFlag(null); |
| 57 | - consignment.setCreateUserName(null); | ||
| 58 | - consignment.setCreateTime(null); | ||
| 59 | - consignment.setModifyTime(null); | ||
| 60 | - consignment.setStatusName(null); | ||
| 61 | consignment.setUserUuid(null); | 58 | consignment.setUserUuid(null); |
| 62 | consignment.setShipperAccount(null); | 59 | consignment.setShipperAccount(null); |
| 63 | consignment.setOriginCountry(consignment.getUserInputOriginCountry()); | 60 | consignment.setOriginCountry(consignment.getUserInputOriginCountry()); | ... | ... |
| 1 | +package com.fedex.connect.customer.repository.repo.impl; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.model.sys.User; | ||
| 4 | +import com.fedex.connect.customer.repository.base.BaseDao; | ||
| 5 | +import com.fedex.connect.customer.repository.repo.IUserRepository; | ||
| 6 | +import org.springframework.stereotype.Repository; | ||
| 7 | + | ||
| 8 | +@Repository | ||
| 9 | +public class UserRepositoryImpl extends BaseDao implements IUserRepository { | ||
| 10 | + @Override | ||
| 11 | + public User findUserByUuid(String uuid) { | ||
| 12 | + return null; | ||
| 13 | + } | ||
| 14 | +} |
| ... | @@ -84,7 +84,7 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS | ... | @@ -84,7 +84,7 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS |
| 84 | */ | 84 | */ |
| 85 | if (StringUtils.isEmpty(bo.getShipperAccount())){ | 85 | if (StringUtils.isEmpty(bo.getShipperAccount())){ |
| 86 | ConsignmentAddDto consignmentAddDto = new ConsignmentAddDto(); | 86 | ConsignmentAddDto consignmentAddDto = new ConsignmentAddDto(); |
| 87 | - consignmentAddDto.setIsCreatorFlag(DigitConstants.DIGIT_TWO); | 87 | + consignmentAddDto.setIsCreatorFlag(DigitConstants.DIGIT_ZERO); |
| 88 | return responseUtils.success(consignmentAddDto); | 88 | return responseUtils.success(consignmentAddDto); |
| 89 | } | 89 | } |
| 90 | return consignmentUtil.consignmentCheckWithNotCe(consignment,bo); | 90 | return consignmentUtil.consignmentCheckWithNotCe(consignment,bo); | ... | ... |
| ... | @@ -5,14 +5,26 @@ import com.fedex.connect.common.dependencies.enums.biz.EmailTypeEnum; | ... | @@ -5,14 +5,26 @@ import com.fedex.connect.common.dependencies.enums.biz.EmailTypeEnum; |
| 5 | import com.fedex.connect.common.dependencies.util.AssignmentFieldUtils; | 5 | import com.fedex.connect.common.dependencies.util.AssignmentFieldUtils; |
| 6 | import com.fedex.connect.common.model.biz.Consignment; | 6 | import com.fedex.connect.common.model.biz.Consignment; |
| 7 | import com.fedex.connect.common.model.biz.Email; | 7 | import com.fedex.connect.common.model.biz.Email; |
| 8 | +import com.fedex.connect.customer.repository.repo.IUserRepository; | ||
| 9 | +import org.apache.commons.lang3.StringUtils; | ||
| 10 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 8 | import org.springframework.stereotype.Component; | 11 | import org.springframework.stereotype.Component; |
| 9 | 12 | ||
| 13 | +import java.util.Optional; | ||
| 14 | + | ||
| 10 | @Component | 15 | @Component |
| 11 | public class EmailUtil { | 16 | public class EmailUtil { |
| 17 | + @Autowired | ||
| 18 | + private IUserRepository iUserRepository; | ||
| 19 | + | ||
| 12 | public void initNotificationEmail(Email email, Consignment consignment) throws Exception{ | 20 | public void initNotificationEmail(Email email, Consignment consignment) throws Exception{ |
| 13 | email.setBizId(consignment.getId()); | 21 | email.setBizId(consignment.getId()); |
| 14 | email.setBizCode(consignment.getConsignmentCode()); | 22 | email.setBizCode(consignment.getConsignmentCode()); |
| 15 | - email.setToAddress(consignment.getShipperEmail()); | 23 | + String emailAddress = Optional.ofNullable(consignment.getUserUuid()) |
| 24 | + .map(iUserRepository::findUserByUuid) | ||
| 25 | + .map(user -> StringUtils.defaultIfEmpty(user.getEmail(), consignment.getShipperEmail())) | ||
| 26 | + .orElse(consignment.getShipperEmail()); | ||
| 27 | + email.setToAddress(emailAddress); | ||
| 16 | email.setSubject(""); | 28 | email.setSubject(""); |
| 17 | email.setSubject(""); | 29 | email.setSubject(""); |
| 18 | email.setTypeName(EmailTypeEnum.NOTIFICATION_SENDER.getMsg()); | 30 | email.setTypeName(EmailTypeEnum.NOTIFICATION_SENDER.getMsg()); | ... | ... |
| ... | @@ -12,6 +12,7 @@ public enum EmailTypeEnum { | ... | @@ -12,6 +12,7 @@ public enum EmailTypeEnum { |
| 12 | PUSH_CON_FILE("emailType_01","Push Pre-Customs Clearance Files","推送预清关文件"), | 12 | PUSH_CON_FILE("emailType_01","Push Pre-Customs Clearance Files","推送预清关文件"), |
| 13 | NOTIFICATION_SENDER("emailType_02","Remind Sender","提醒发件人"), | 13 | NOTIFICATION_SENDER("emailType_02","Remind Sender","提醒发件人"), |
| 14 | SEND_FAILED_EMAIL("emailType_03", "Error Email Alert","错误邮件预警"), | 14 | SEND_FAILED_EMAIL("emailType_03", "Error Email Alert","错误邮件预警"), |
| 15 | + SEND_OB("ob", "ob","推送ob"), | ||
| 15 | 16 | ||
| 16 | ; | 17 | ; |
| 17 | 18 | ... | ... |
| ... | @@ -38,20 +38,20 @@ public class EmailJob { | ... | @@ -38,20 +38,20 @@ public class EmailJob { |
| 38 | * @param | 38 | * @param |
| 39 | * @return void | 39 | * @return void |
| 40 | */ | 40 | */ |
| 41 | - //@ProcessingInterval(paramCode = ParamConfigConstants.TASK_PARAM_KEYS.PUSH_CON_EMAIL_INTERVAL) | 41 | + @ProcessingInterval(paramCode = ParamConfigConstants.TASK_PARAM_KEYS.PUSH_CON_EMAIL_INTERVAL) |
| 42 | - //@Scheduled(cron = "${export.task.allocation.sendOb}") | 42 | + @Scheduled(cron = "${export.task.allocation.sendOb}") |
| 43 | - //public void pushConsignmentFileTask() { | 43 | + public void pushConsignmentFileTask() { |
| 44 | - // pushConsignmentFileService.pushConsignmentFileTask(); | 44 | + pushConsignmentFileService.pushConsignmentFileTask(); |
| 45 | - //} | 45 | + } |
| 46 | - // | 46 | + |
| 47 | - ///** | 47 | + /** |
| 48 | - // * 发送失败邮件提醒 | 48 | + * 发送失败邮件提醒 |
| 49 | - // */ | 49 | + */ |
| 50 | - //@ProcessingInterval(paramCode = ParamConfigConstants.TASK_PARAM_KEYS.SEND_FAIL_ALERT_INTERVAL) | 50 | + @ProcessingInterval(paramCode = ParamConfigConstants.TASK_PARAM_KEYS.SEND_FAIL_ALERT_INTERVAL) |
| 51 | - //@Scheduled(cron = "${export.task.allocation.sendOb}") | 51 | + @Scheduled(cron = "${export.task.allocation.sendOb}") |
| 52 | - //public void sendingFailedEmailAlert() { | 52 | + public void sendingFailedEmailAlert() { |
| 53 | - // sendWarningEmail.sendFailedEmail(); | 53 | + sendWarningEmail.sendFailedEmail(); |
| 54 | - //} | 54 | + } |
| 55 | 55 | ||
| 56 | 56 | ||
| 57 | } | 57 | } | ... | ... |
| ... | @@ -59,6 +59,14 @@ public class SendFailedEmailAlertServiceImpl extends BaseService implements ISen | ... | @@ -59,6 +59,14 @@ public class SendFailedEmailAlertServiceImpl extends BaseService implements ISen |
| 59 | */ | 59 | */ |
| 60 | List<SendFailedEmailDto> sendFailedEmailDto = sendFailedEmailUtil.createSendFailedEmailDto(emails,obs,paramConfigMap); | 60 | List<SendFailedEmailDto> sendFailedEmailDto = sendFailedEmailUtil.createSendFailedEmailDto(emails,obs,paramConfigMap); |
| 61 | /** | 61 | /** |
| 62 | + * 无错误邮件不发送邮件 | ||
| 63 | + */ | ||
| 64 | + boolean dataFlag = sendFailedEmailDto.stream() | ||
| 65 | + .anyMatch(failedEmailDto -> failedEmailDto.getStatusCodeCount() != 0); | ||
| 66 | + if (!dataFlag) { | ||
| 67 | + return; | ||
| 68 | + } | ||
| 69 | + /** | ||
| 62 | * 构建邮件内容 | 70 | * 构建邮件内容 |
| 63 | */ | 71 | */ |
| 64 | String emailBody = sendFailedEmailUtil.createEmailBody(sendFailedEmailDto,paramConfigMap); | 72 | String emailBody = sendFailedEmailUtil.createEmailBody(sendFailedEmailDto,paramConfigMap); | ... | ... |
| ... | @@ -149,6 +149,7 @@ public class DuplicateEmailUtil { | ... | @@ -149,6 +149,7 @@ public class DuplicateEmailUtil { |
| 149 | }else { | 149 | }else { |
| 150 | EmailHistory emailHistory = new EmailHistory(); | 150 | EmailHistory emailHistory = new EmailHistory(); |
| 151 | BeanUtils.copyProperties(email, emailHistory); | 151 | BeanUtils.copyProperties(email, emailHistory); |
| 152 | + emailHistory.setId(null); | ||
| 152 | emailRepository.deleteById(email.getId()); | 153 | emailRepository.deleteById(email.getId()); |
| 153 | emailHistoryRepository.saveOrUpdate(emailHistory); | 154 | emailHistoryRepository.saveOrUpdate(emailHistory); |
| 154 | } | 155 | } | ... | ... |
| ... | @@ -228,7 +228,7 @@ public class SendFailedEmailUtil { | ... | @@ -228,7 +228,7 @@ public class SendFailedEmailUtil { |
| 228 | || propertiesConfig.getEnv().equalsIgnoreCase("test") | 228 | || propertiesConfig.getEnv().equalsIgnoreCase("test") |
| 229 | ) { | 229 | ) { |
| 230 | //ce接收人 | 230 | //ce接收人 |
| 231 | - mailConfigDto.setTo("zelong.shao@erry.com"); | 231 | + mailConfigDto.setTo("zelong.shao@erry.com,jialiang.song@erry.com"); |
| 232 | mailConfigDto.setCcAccount(""); | 232 | mailConfigDto.setCcAccount(""); |
| 233 | mailConfigDto.setReceiveAccount("zelong.shao@erry.com"); | 233 | mailConfigDto.setReceiveAccount("zelong.shao@erry.com"); |
| 234 | //发件人 | 234 | //发件人 | ... | ... |
-
Please register or login to post a comment