zelong.shao

customer|task|定时任务调整

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
......
1 +package com.fedex.connect.customer.repository.repo;
2 +
3 +import com.fedex.connect.common.model.sys.User;
4 +
5 +public interface IUserRepository {
6 + User findUserByUuid(String uuid);
7 +}
...@@ -46,15 +46,12 @@ public class ConsignmentRepositoryImpl extends BaseDao implements IConsignmentRe ...@@ -46,15 +46,12 @@ public class ConsignmentRepositoryImpl extends BaseDao implements IConsignmentRe
46 if (SystemDefaultUserConstants.SYSTEM_USER_KEYS.USER_NAME.equals(consignment.getCreateUserName())){ 46 if (SystemDefaultUserConstants.SYSTEM_USER_KEYS.USER_NAME.equals(consignment.getCreateUserName())){
47 consignment.setCreateUserName(user.getUserName()); 47 consignment.setCreateUserName(user.getUserName());
48 } 48 }
49 - if (!user.getUserUuid().equals(consignment.getUserUuid()) && (!StringUtils.isEmpty(user.getAccountNo()) && !user.getAccountNo().equals(consignment.getShipperAccount())) 49 + if (!StringUtils.equals(user.getUserUuid(), consignment.getUserUuid())
50 - && (!StringUtils.isEmpty(consignment.getUserInputShipperAccount()) && !consignment.getUserInputShipperAccount().equals(consignment.getShipperAccount()))){ 50 + && !StringUtils.equals(user.getAccountNo(), consignment.getShipperAccount())
51 + && !StringUtils.equals(consignment.getUserInputShipperAccount(), consignment.getShipperAccount())) {
51 consignment.setRecipientContactName(null); 52 consignment.setRecipientContactName(null);
52 consignment.setRecipientCompany(null); 53 consignment.setRecipientCompany(null);
53 consignment.setDocNondocFlag(null); 54 consignment.setDocNondocFlag(null);
54 - consignment.setCreateUserName(null);
55 - consignment.setCreateTime(null);
56 - consignment.setModifyTime(null);
57 - consignment.setStatusName(null);
58 consignment.setUserUuid(null); 55 consignment.setUserUuid(null);
59 consignment.setShipperAccount(null); 56 consignment.setShipperAccount(null);
60 consignment.setOriginCountry(consignment.getUserInputOriginCountry()); 57 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 +}
...@@ -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());
......
...@@ -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 }
......
...@@ -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 }
......