zelong.shao

customer|邮件bug修复

...@@ -4,6 +4,7 @@ import com.fedex.connect.common.dao.biz.*; ...@@ -4,6 +4,7 @@ import com.fedex.connect.common.dao.biz.*;
4 import com.fedex.connect.customer.repository.dao.AttachmentExtMapper; 4 import com.fedex.connect.customer.repository.dao.AttachmentExtMapper;
5 import com.fedex.connect.customer.repository.dao.ConsignmentExtMapper; 5 import com.fedex.connect.customer.repository.dao.ConsignmentExtMapper;
6 import com.fedex.connect.customer.repository.dao.UploadRecordExtMapper; 6 import com.fedex.connect.customer.repository.dao.UploadRecordExtMapper;
7 +import com.fedex.connect.customer.repository.dao.UserExtMapper;
7 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
8 9
9 public class BaseDao { 10 public class BaseDao {
...@@ -25,4 +26,6 @@ public class BaseDao { ...@@ -25,4 +26,6 @@ public class BaseDao {
25 protected EmailMapper emailMapper; 26 protected EmailMapper emailMapper;
26 @Autowired 27 @Autowired
27 protected UploadRecordExtMapper uploadRecordExtMapper; 28 protected UploadRecordExtMapper uploadRecordExtMapper;
29 + @Autowired
30 + protected UserExtMapper userExtMapper;
28 } 31 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
34 c.USER_INPUT_SHIPPER_ACCOUNT, 34 c.USER_INPUT_SHIPPER_ACCOUNT,
35 c.USER_INPUT_ORIGIN_COUNTRY_CODE, 35 c.USER_INPUT_ORIGIN_COUNTRY_CODE,
36 c.USER_INPUT_ORIGIN_COUNTRY, 36 c.USER_INPUT_ORIGIN_COUNTRY,
37 - m.CE_FLAG 37 + MAX(m.CE_FLAG) AS CE_FLAG
38 </sql> 38 </sql>
39 39
40 <select id="findConsignments" resultType="com.fedex.connect.customer.data.dto.FindConsignmentsDto"> 40 <select id="findConsignments" resultType="com.fedex.connect.customer.data.dto.FindConsignmentsDto">
...@@ -66,6 +66,12 @@ ...@@ -66,6 +66,12 @@
66 #{item} 66 #{item}
67 </foreach> 67 </foreach>
68 </if> 68 </if>
69 + GROUP BY
70 + c.ID, c.CONSIGNMENT_CODE, c.RECIPIENT_CONTACT_NAME, c.RECIPIENT_COMPANY,
71 + c.ORIGIN_COUNTRY, c.DOC_NONDOC_FLAG, c.CREATE_USER_NAME, c.CREATE_TIME,
72 + c.MODIFY_TIME, c.STATUS_NAME, c.USER_UUID, c.SHIPPER_ACCOUNT,
73 + c.USER_INPUT_SHIPPER_ACCOUNT, c.USER_INPUT_ORIGIN_COUNTRY_CODE,
74 + c.USER_INPUT_ORIGIN_COUNTRY
69 ORDER BY c.CREATE_TIME DESC 75 ORDER BY c.CREATE_TIME DESC
70 <include refid="OracleDialectSuffix" /> 76 <include refid="OracleDialectSuffix" />
71 </select> 77 </select>
......
...@@ -46,7 +46,7 @@ public class ConsignmentRepositoryImpl extends BaseDao implements IConsignmentRe ...@@ -46,7 +46,7 @@ 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 (!StringUtils.equals(user.getUserUuid(), consignment.getUserUuid()) || (consignment.getCeFlag() != null && consignment.getCeFlag() == 0)) { 49 + if (!StringUtils.equals(user.getUserUuid(), consignment.getUserUuid()) && (consignment.getCeFlag() != null && consignment.getCeFlag() == 0)) {
50 consignment.setRecipientContactName(null); 50 consignment.setRecipientContactName(null);
51 consignment.setRecipientCompany(null); 51 consignment.setRecipientCompany(null);
52 consignment.setDocNondocFlag(null); 52 consignment.setDocNondocFlag(null);
......
...@@ -9,6 +9,6 @@ import org.springframework.stereotype.Repository; ...@@ -9,6 +9,6 @@ import org.springframework.stereotype.Repository;
9 public class UserRepositoryImpl extends BaseDao implements IUserRepository { 9 public class UserRepositoryImpl extends BaseDao implements IUserRepository {
10 @Override 10 @Override
11 public User findUserByUuid(String uuid) { 11 public User findUserByUuid(String uuid) {
12 - return null; 12 + return userExtMapper.findUserByUuid(uuid);
13 } 13 }
14 } 14 }
......
...@@ -27,7 +27,7 @@ public class EmailServiceImpl extends BaseService implements IEmailService { ...@@ -27,7 +27,7 @@ public class EmailServiceImpl extends BaseService implements IEmailService {
27 */ 27 */
28 @Override 28 @Override
29 public void saveNotificationEmail(Consignment consignment, User user) throws Exception { 29 public void saveNotificationEmail(Consignment consignment, User user) throws Exception {
30 - if (!StringUtils.isEmpty(consignment.getUserUuid()) && consignment.getUserUuid().equals(user.getUserUuid())){ 30 + if (StringUtils.isEmpty(consignment.getUserUuid()) || consignment.getUserUuid().equals(user.getUserUuid())) {
31 return; 31 return;
32 } 32 }
33 /** 33 /**
......
...@@ -36,7 +36,7 @@ public class ConsignmentQueryUtil { ...@@ -36,7 +36,7 @@ public class ConsignmentQueryUtil {
36 Consignment resultConsignment = null; 36 Consignment resultConsignment = null;
37 if(Objects.nonNull(consignment)){ 37 if(Objects.nonNull(consignment)){
38 //uuid相同,则将运单所有信息返回给到前端 38 //uuid相同,则将运单所有信息返回给到前端
39 - if(Objects.equals(userConsignmentInfoQuery.getUserUuid(),consignment.getUserUuid()) || (byUserIdAndConsignmentCode.getCeFlag() != null &&byUserIdAndConsignmentCode.getCeFlag() == 1L)){ 39 + if(Objects.equals(userConsignmentInfoQuery.getUserUuid(),consignment.getUserUuid()) || (byUserIdAndConsignmentCode.getCeFlag() == null || byUserIdAndConsignmentCode.getCeFlag() == 1L)){
40 //1:如果运单UUID与登录账号UUID相同或者用户shipperAccount与运单shipperAccount相同,则显示运单、收发件人信息,以及501信息 40 //1:如果运单UUID与登录账号UUID相同或者用户shipperAccount与运单shipperAccount相同,则显示运单、收发件人信息,以及501信息
41 resultConsignment = consignment; 41 resultConsignment = consignment;
42 }else { 42 }else {
......
...@@ -2,6 +2,7 @@ package com.fedex.connect.customer.util.service.biz; ...@@ -2,6 +2,7 @@ package com.fedex.connect.customer.util.service.biz;
2 2
3 import com.fedex.connect.common.dependencies.enums.biz.EmailStatusEnum; 3 import com.fedex.connect.common.dependencies.enums.biz.EmailStatusEnum;
4 import com.fedex.connect.common.dependencies.enums.biz.EmailTypeEnum; 4 import com.fedex.connect.common.dependencies.enums.biz.EmailTypeEnum;
5 +import com.fedex.connect.common.dependencies.template.clearanceEmail.DuplicateEmailTemplate;
5 import com.fedex.connect.common.dependencies.util.AssignmentFieldUtils; 6 import com.fedex.connect.common.dependencies.util.AssignmentFieldUtils;
6 import com.fedex.connect.common.model.biz.Consignment; 7 import com.fedex.connect.common.model.biz.Consignment;
7 import com.fedex.connect.common.model.biz.Email; 8 import com.fedex.connect.common.model.biz.Email;
...@@ -17,6 +18,8 @@ import java.util.Optional; ...@@ -17,6 +18,8 @@ import java.util.Optional;
17 public class EmailUtil { 18 public class EmailUtil {
18 @Autowired 19 @Autowired
19 private IUserRepository iUserRepository; 20 private IUserRepository iUserRepository;
21 + @Autowired
22 + private DuplicateEmailTemplate duplicateEmailTemplate;
20 23
21 public void initNotificationEmail(Email email, Consignment consignment) throws Exception{ 24 public void initNotificationEmail(Email email, Consignment consignment) throws Exception{
22 email.setBizId(consignment.getId()); 25 email.setBizId(consignment.getId());
...@@ -26,7 +29,7 @@ public class EmailUtil { ...@@ -26,7 +29,7 @@ public class EmailUtil {
26 .map(user -> StringUtils.defaultIfEmpty(user.getEmail(), consignment.getShipperEmail())) 29 .map(user -> StringUtils.defaultIfEmpty(user.getEmail(), consignment.getShipperEmail()))
27 .orElse(consignment.getShipperEmail()); 30 .orElse(consignment.getShipperEmail());
28 email.setToAddress(emailAddress); 31 email.setToAddress(emailAddress);
29 - email.setSubject(""); 32 + email.setSubject(duplicateEmailTemplate.getTitle(email.getBizCode()));
30 email.setTypeName(EmailTypeEnum.NOTIFICATION_SENDER.getMsg()); 33 email.setTypeName(EmailTypeEnum.NOTIFICATION_SENDER.getMsg());
31 email.setTypeCode(EmailTypeEnum.NOTIFICATION_SENDER.getCode()); 34 email.setTypeCode(EmailTypeEnum.NOTIFICATION_SENDER.getCode());
32 email.setStatusName(EmailStatusEnum.PENDING.getMsg()); 35 email.setStatusName(EmailStatusEnum.PENDING.getMsg());
...@@ -37,11 +40,6 @@ public class EmailUtil { ...@@ -37,11 +40,6 @@ public class EmailUtil {
37 public void initPushConsignmentFileEmail(Email email, Consignment consignment,UploadRecord uploadRecord) throws Exception{ 40 public void initPushConsignmentFileEmail(Email email, Consignment consignment,UploadRecord uploadRecord) throws Exception{
38 email.setBizId(uploadRecord.getId()); 41 email.setBizId(uploadRecord.getId());
39 email.setBizCode(consignment.getConsignmentCode()); 42 email.setBizCode(consignment.getConsignmentCode());
40 - String emailAddress = Optional.ofNullable(consignment.getUserUuid())
41 - .map(iUserRepository::findUserByUuid)
42 - .map(user -> StringUtils.defaultIfEmpty(user.getEmail(), consignment.getShipperEmail()))
43 - .orElse(consignment.getShipperEmail());
44 - email.setToAddress(emailAddress);
45 email.setSubject(""); 43 email.setSubject("");
46 email.setTypeName(EmailTypeEnum.PUSH_CON_FILE.getMsg()); 44 email.setTypeName(EmailTypeEnum.PUSH_CON_FILE.getMsg());
47 email.setTypeCode(EmailTypeEnum.PUSH_CON_FILE.getCode()); 45 email.setTypeCode(EmailTypeEnum.PUSH_CON_FILE.getCode());
......
...@@ -61,7 +61,7 @@ public class EmailHistory implements Serializable { ...@@ -61,7 +61,7 @@ public class EmailHistory implements Serializable {
61 /** 61 /**
62 * 发送次数(0-3次) 62 * 发送次数(0-3次)
63 */ 63 */
64 - private Long sendNum; 64 + private int sendNum;
65 65
66 /** 66 /**
67 * 邮件发送时间 67 * 邮件发送时间
...@@ -190,11 +190,11 @@ public class EmailHistory implements Serializable { ...@@ -190,11 +190,11 @@ public class EmailHistory implements Serializable {
190 this.statusName = statusName == null ? null : statusName.trim(); 190 this.statusName = statusName == null ? null : statusName.trim();
191 } 191 }
192 192
193 - public Long getSendNum() { 193 + public int getSendNum() {
194 return sendNum; 194 return sendNum;
195 } 195 }
196 196
197 - public void setSendNum(Long sendNum) { 197 + public void setSendNum(int sendNum) {
198 this.sendNum = sendNum; 198 this.sendNum = sendNum;
199 } 199 }
200 200
......
...@@ -7,7 +7,7 @@ import org.apache.ibatis.annotations.Select; ...@@ -7,7 +7,7 @@ import org.apache.ibatis.annotations.Select;
7 @Mapper 7 @Mapper
8 public interface PortclearEmailMappingExtMapper { 8 public interface PortclearEmailMappingExtMapper {
9 9
10 - @Select("SELECT EMAIL FROM T_BI_PORTCLEAR_EMAIL_MAPPING WHERE PORT_CODE = #{portCode AND STATUS = 1") 10 + @Select("SELECT EMAIL FROM T_BI_PORTCLEAR_EMAIL_MAPPING WHERE PORT_CODE = #{portCode} AND STATUS = 1")
11 String findEmailByPortCode(@Param("portCode") String portCode); 11 String findEmailByPortCode(@Param("portCode") String portCode);
12 12
13 } 13 }
......
...@@ -10,6 +10,7 @@ import com.fedex.connect.task.service.base.BaseService; ...@@ -10,6 +10,7 @@ import com.fedex.connect.task.service.base.BaseService;
10 import com.fedex.connect.task.service.biz.IDuplicateConsignmentEmailService; 10 import com.fedex.connect.task.service.biz.IDuplicateConsignmentEmailService;
11 import com.fedex.connect.task.utils.sys.DuplicateEmailUtil; 11 import com.fedex.connect.task.utils.sys.DuplicateEmailUtil;
12 import com.fedex.connect.task.utils.sys.EmailUtil; 12 import com.fedex.connect.task.utils.sys.EmailUtil;
13 +import org.apache.commons.lang3.StringUtils;
13 import org.springframework.beans.factory.annotation.Autowired; 14 import org.springframework.beans.factory.annotation.Autowired;
14 import org.springframework.stereotype.Service; 15 import org.springframework.stereotype.Service;
15 16
...@@ -51,7 +52,10 @@ public class DuplicateConsignmentEmailServiceImpl extends BaseService implements ...@@ -51,7 +52,10 @@ public class DuplicateConsignmentEmailServiceImpl extends BaseService implements
51 /** 52 /**
52 * 发送邮件 53 * 发送邮件
53 */ 54 */
54 - boolean result = emailUtil.sendMail(mailConfigDto); 55 + boolean result = false;
56 + if (StringUtils.isNotEmpty(mailConfigDto.getTo())){
57 + result = emailUtil.sendMail(mailConfigDto);
58 + }
55 /** 59 /**
56 * 更新邮件实体 60 * 更新邮件实体
57 */ 61 */
......
...@@ -149,7 +149,10 @@ public class ConFileEmailUtil { ...@@ -149,7 +149,10 @@ public class ConFileEmailUtil {
149 /** 149 /**
150 * 发送邮件 150 * 发送邮件
151 */ 151 */
152 - boolean result = emailUtil.sendMail(mailMessageReqDto); 152 + boolean result = false;
153 + if (StringUtils.isNotEmpty(emailAddress)){
154 + result = emailUtil.sendMail(mailMessageReqDto);
155 + }
153 156
154 return result; 157 return result;
155 } 158 }
...@@ -273,13 +276,14 @@ public class ConFileEmailUtil { ...@@ -273,13 +276,14 @@ public class ConFileEmailUtil {
273 conPushEmail.setStatusCode(success.getCode()); 276 conPushEmail.setStatusCode(success.getCode());
274 conPushEmail.setStatusName(success.getDescription()); 277 conPushEmail.setStatusName(success.getDescription());
275 }else { 278 }else {
276 - if (conPushEmail.getSendNum()<3){ 279 + if (conPushEmail.getSendNum()<2 && StringUtils.isNotEmpty(mailMessageReqDto.getTo())){
277 conPushEmail.setStatusCode(pending.getCode()); 280 conPushEmail.setStatusCode(pending.getCode());
278 conPushEmail.setStatusName(pending.getDescription()); 281 conPushEmail.setStatusName(pending.getDescription());
279 conPushEmail.setSendNum(conPushEmail.getSendNum()+1); 282 conPushEmail.setSendNum(conPushEmail.getSendNum()+1);
280 }else { 283 }else {
281 conPushEmail.setStatusCode(failed.getCode()); 284 conPushEmail.setStatusCode(failed.getCode());
282 conPushEmail.setStatusName(failed.getDescription()); 285 conPushEmail.setStatusName(failed.getDescription());
286 + conPushEmail.setSendNum(conPushEmail.getSendNum()+1);
283 } 287 }
284 } 288 }
285 } 289 }
......
...@@ -10,7 +10,7 @@ import com.fedex.connect.task.config.PropertiesConfig; ...@@ -10,7 +10,7 @@ import com.fedex.connect.task.config.PropertiesConfig;
10 import com.fedex.connect.task.data.dto.MailConfigDto; 10 import com.fedex.connect.task.data.dto.MailConfigDto;
11 import com.fedex.connect.task.repository.repo.biz.IEmailRepository; 11 import com.fedex.connect.task.repository.repo.biz.IEmailRepository;
12 import com.fedex.connect.task.repository.repo.log.IEmailHistoryRepository; 12 import com.fedex.connect.task.repository.repo.log.IEmailHistoryRepository;
13 -import com.fedex.connect.task.repository.repo.sys.IParamConfigRepository; 13 +import org.apache.commons.lang3.StringUtils;
14 import org.springframework.beans.BeanUtils; 14 import org.springframework.beans.BeanUtils;
15 import org.springframework.beans.factory.annotation.Autowired; 15 import org.springframework.beans.factory.annotation.Autowired;
16 import org.springframework.stereotype.Component; 16 import org.springframework.stereotype.Component;
...@@ -33,8 +33,6 @@ public class DuplicateEmailUtil { ...@@ -33,8 +33,6 @@ public class DuplicateEmailUtil {
33 @Autowired 33 @Autowired
34 private DuplicateEmailTemplate duplicateEmailTemplate; 34 private DuplicateEmailTemplate duplicateEmailTemplate;
35 35
36 - @Autowired
37 - private IParamConfigRepository paramConfigRepository;
38 36
39 /** 37 /**
40 * @Author Szl 38 * @Author Szl
...@@ -125,7 +123,7 @@ public class DuplicateEmailUtil { ...@@ -125,7 +123,7 @@ public class DuplicateEmailUtil {
125 email.setStatusCode(success.getCode()); 123 email.setStatusCode(success.getCode());
126 email.setStatusName(success.getDescription()); 124 email.setStatusName(success.getDescription());
127 }else { 125 }else {
128 - if (email.getSendNum()<3){ 126 + if (email.getSendNum()<3 && StringUtils.isNotEmpty(mailConfigDto.getTo())){
129 email.setStatusCode(pending.getCode()); 127 email.setStatusCode(pending.getCode());
130 email.setStatusName(pending.getDescription()); 128 email.setStatusName(pending.getDescription());
131 email.setSendNum(email.getSendNum()+1); 129 email.setSendNum(email.getSendNum()+1);
...@@ -145,7 +143,7 @@ public class DuplicateEmailUtil { ...@@ -145,7 +143,7 @@ public class DuplicateEmailUtil {
145 */ 143 */
146 @Transactional 144 @Transactional
147 public void saveEmail(Email email){ 145 public void saveEmail(Email email){
148 - if (EmailStatusEnum.PENDING.getCode().equals(email.getTypeCode())){ 146 + if (EmailStatusEnum.PENDING.getCode().equals(email.getStatusCode())){
149 emailRepository.saveOrUpdate(email); 147 emailRepository.saveOrUpdate(email);
150 }else { 148 }else {
151 EmailHistory emailHistory = new EmailHistory(); 149 EmailHistory emailHistory = new EmailHistory();
......
...@@ -265,7 +265,7 @@ public class SendFailedEmailUtil { ...@@ -265,7 +265,7 @@ public class SendFailedEmailUtil {
265 email.setStatusCode(EmailStatusEnum.FAILED.getCode()); 265 email.setStatusCode(EmailStatusEnum.FAILED.getCode());
266 email.setStatusName(EmailStatusEnum.FAILED.getEnMsg()); 266 email.setStatusName(EmailStatusEnum.FAILED.getEnMsg());
267 } 267 }
268 - email.setSendNum(DigitConstants.DIGIT_ONE_LONG); 268 + email.setSendNum(DigitConstants.DIGIT_ONE);
269 email.setSendTime(new Date()); 269 email.setSendTime(new Date());
270 AssignmentFieldUtils.assignmentTableBaseField(email); 270 AssignmentFieldUtils.assignmentTableBaseField(email);
271 271
......