zelong.shao

customer|task|定时任务调整

package com.fedex.connect.customer.repository.dao;
import com.fedex.connect.common.model.sys.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@Mapper
public interface UserExtMapper {
@Select("SELECT * FROM T_SYS_USER WHERE USER_UUID = #{uuid}")
public User findUserByUuid(@Param("uuid") String uuid);
}
......@@ -327,7 +327,7 @@
FROM
T_BIZ_UPLOAD_RECORD
WHERE
CONSIGNMENT_ID = #{consignmentId}
CONSIGNMENT_ID = #{consignmentId} ORDER BY ID DESC
<include refid="OracleDialectSuffix" />
</select>
</mapper>
\ No newline at end of file
......
package com.fedex.connect.customer.repository.repo;
import com.fedex.connect.common.model.sys.User;
public interface IUserRepository {
User findUserByUuid(String uuid);
}
......@@ -46,15 +46,12 @@ 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()) && (!StringUtils.isEmpty(user.getAccountNo()) && !user.getAccountNo().equals(consignment.getShipperAccount()))
&& (!StringUtils.isEmpty(consignment.getUserInputShipperAccount()) && !consignment.getUserInputShipperAccount().equals(consignment.getShipperAccount()))){
if (!StringUtils.equals(user.getUserUuid(), consignment.getUserUuid())
&& !StringUtils.equals(user.getAccountNo(), consignment.getShipperAccount())
&& !StringUtils.equals(consignment.getUserInputShipperAccount(), consignment.getShipperAccount())) {
consignment.setRecipientContactName(null);
consignment.setRecipientCompany(null);
consignment.setDocNondocFlag(null);
consignment.setCreateUserName(null);
consignment.setCreateTime(null);
consignment.setModifyTime(null);
consignment.setStatusName(null);
consignment.setUserUuid(null);
consignment.setShipperAccount(null);
consignment.setOriginCountry(consignment.getUserInputOriginCountry());
......
package com.fedex.connect.customer.repository.repo.impl;
import com.fedex.connect.common.model.sys.User;
import com.fedex.connect.customer.repository.base.BaseDao;
import com.fedex.connect.customer.repository.repo.IUserRepository;
import org.springframework.stereotype.Repository;
@Repository
public class UserRepositoryImpl extends BaseDao implements IUserRepository {
@Override
public User findUserByUuid(String uuid) {
return null;
}
}
......@@ -5,14 +5,26 @@ import com.fedex.connect.common.dependencies.enums.biz.EmailTypeEnum;
import com.fedex.connect.common.dependencies.util.AssignmentFieldUtils;
import com.fedex.connect.common.model.biz.Consignment;
import com.fedex.connect.common.model.biz.Email;
import com.fedex.connect.customer.repository.repo.IUserRepository;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Optional;
@Component
public class EmailUtil {
@Autowired
private IUserRepository iUserRepository;
public void initNotificationEmail(Email email, Consignment consignment) throws Exception{
email.setBizId(consignment.getId());
email.setBizCode(consignment.getConsignmentCode());
email.setToAddress(consignment.getShipperEmail());
String emailAddress = Optional.ofNullable(consignment.getUserUuid())
.map(iUserRepository::findUserByUuid)
.map(user -> StringUtils.defaultIfEmpty(user.getEmail(), consignment.getShipperEmail()))
.orElse(consignment.getShipperEmail());
email.setToAddress(emailAddress);
email.setSubject("");
email.setSubject("");
email.setTypeName(EmailTypeEnum.NOTIFICATION_SENDER.getMsg());
......
......@@ -38,20 +38,20 @@ 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.SEND_FAIL_ALERT_INTERVAL)
//@Scheduled(cron = "${export.task.allocation.sendOb}")
//public void sendingFailedEmailAlert() {
// sendWarningEmail.sendFailedEmail();
//}
@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() {
sendWarningEmail.sendFailedEmail();
}
}
......
......@@ -149,6 +149,7 @@ public class DuplicateEmailUtil {
}else {
EmailHistory emailHistory = new EmailHistory();
BeanUtils.copyProperties(email, emailHistory);
emailHistory.setId(null);
emailRepository.deleteById(email.getId());
emailHistoryRepository.saveOrUpdate(emailHistory);
}
......