/** * */ package jp.agentec.sinaburocast.action.batch; import java.util.ArrayList; import java.util.List; import java.util.Map; import javax.annotation.Resource; import jp.agentec.sinaburocast.action.AbstractAction; import jp.agentec.sinaburocast.common.util.PropertyUtil; import jp.agentec.sinaburocast.entity.DeliveryGroupMember; import jp.agentec.sinaburocast.entity.EnqueteMail; import jp.agentec.sinaburocast.service.DeliveryGroupMemberService; import jp.agentec.sinaburocast.service.EnqueteMailAddressTmpService; import jp.agentec.sinaburocast.service.EnqueteMailService; import org.apache.log4j.Logger; import org.seasar.struts.annotation.Execute; /** * @author kim-hs * */ public class MailSendBatchAction extends AbstractAction { private final Logger logger = Logger.getLogger(getClass()); public EnqueteMailService enqueteMailService; public DeliveryGroupMemberService deliveryGroupMemberService; public EnqueteMailAddressTmpService enqueteMailAddressTmpService; @Resource protected Map requestScope; @Execute(validator=false) public String index() throws Exception { List<EnqueteMail> mailResult = new ArrayList<EnqueteMail>(); mailResult = enqueteMailService.findAllBatch(); String serverUrl = PropertyUtil.getString("ENQUETE_SERVER_URL"); for (EnqueteMail mail : mailResult) { List<DeliveryGroupMember> list = null; if (mail.enqueteId == null) { list = deliveryGroupMemberService.findAllOrderByIdAllList(mail.deliveryGroupId, null); } else { list = enqueteMailAddressTmpService.findByEnqueteMailIdExchangeDeliveryGroupMember(mail.enqueteMailId); } enqueteMailService.insertRegistMailSendLogic(mail, PropertyUtil.getString("BATCH_UPDATE"), serverUrl, list); // 送信完了したら一時保存していたデータを削除 if (mail.enqueteId != null) { enqueteMailAddressTmpService.deleteByEnqueteMailId(mail.enqueteMailId); } } return null; } }