Commit 7e5df0df authored by Quxl's avatar Quxl

x

parent ee6548f1
...@@ -8,6 +8,7 @@ import java.util.Map; ...@@ -8,6 +8,7 @@ import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.egolm.common.MailUtil; import com.egolm.common.MailUtil;
...@@ -78,34 +79,43 @@ public class EmailServiceImpl implements EmailService { ...@@ -78,34 +79,43 @@ public class EmailServiceImpl implements EmailService {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
Integer adminid = (Integer)adminTokenService.getToken().getId(); Integer adminid = (Integer)adminTokenService.getToken().getId();
Fc_member_film memberFilm = filmService.queryMemberFilmById(member_film_id); Fc_member_film memberFilm = filmService.queryMemberFilmById(member_film_id);
Fc_member member = memberService.getMemberById(memberFilm.getMember_id()); Fc_member member = null;
Locale locale = new Locale("zh", "CN"); try {
if("en".equals(member.getLang())) { member = memberService.getMemberById(memberFilm.getMember_id());
locale = new Locale("en", "US"); } catch (EmptyResultDataAccessException e) {
member = null;
} }
String subject = messages.get("email.getPassword.subject", locale); if(member != null) {
String content = Common.getStringAsStream(prefix + "_" + locale.getLanguage().toLowerCase() + "_" + locale.getCountry().toUpperCase() + ".txt"); Locale locale = new Locale("zh", "CN");
String filmName = null; if("en".equals(member.getLang())) {
if(locale.getLanguage().toLowerCase().equals("zh")) { locale = new Locale("en", "US");
filmName = memberFilm.getCn_name(); }
} else if(locale.getLanguage().toLowerCase().equals("en")) { String subject = messages.get("email.getPassword.subject", locale);
filmName = memberFilm.getEn_name(); String content = Common.getStringAsStream(prefix + "_" + locale.getLanguage().toLowerCase() + "_" + locale.getCountry().toUpperCase() + ".txt");
} String filmName = null;
if(filmName == null || filmName.trim().length() == 0) { if(locale.getLanguage().toLowerCase().equals("zh")) {
filmName = memberFilm.getOrigion_name(); filmName = memberFilm.getCn_name();
} } else if(locale.getLanguage().toLowerCase().equals("en")) {
if(filmName == null || filmName.trim().length() == 0) { filmName = memberFilm.getEn_name();
filmName = memberFilm.getEn_name(); }
} if(filmName == null || filmName.trim().length() == 0) {
if(filmName == null || filmName.trim().length() == 0) { filmName = memberFilm.getOrigion_name();
filmName = memberFilm.getCn_name(); }
if(filmName == null || filmName.trim().length() == 0) {
filmName = memberFilm.getEn_name();
}
if(filmName == null || filmName.trim().length() == 0) {
filmName = memberFilm.getCn_name();
}
String film_no = StringUtil.formatLength(memberFilm.getFilm_no(), "0000");
content = MessageFormat.format(content, member.getUsername(), film_no, filmName == null ? "" : filmName);
this.send(2, adminid, subject, content, member.getEmail());
map.put("email", member.getEmail());
map.put("film_no", film_no);
return map;
} else {
return null;
} }
String film_no = StringUtil.formatLength(memberFilm.getFilm_no(), "0000");
content = MessageFormat.format(content, member.getUsername(), film_no, filmName == null ? "" : filmName);
this.send(2, adminid, subject, content, member.getEmail());
map.put("email", member.getEmail());
map.put("film_no", film_no);
return map;
} }
public static void main(String[] args) { public static void main(String[] args) {
......
...@@ -128,7 +128,9 @@ public class AdminFirstController { ...@@ -128,7 +128,9 @@ public class AdminFirstController {
reviewService.toFirstRound(member_film_id); reviewService.toFirstRound(member_film_id);
Map<String, Object> map = emailService.sendByTemplate_01(member_film_id, "doc/first_pass"); Map<String, Object> map = emailService.sendByTemplate_01(member_film_id, "doc/first_pass");
Rjx rjx = Rjx.jsonOk(); Rjx rjx = Rjx.jsonOk();
rjx.putAll(map); if(map != null) {
rjx.putAll(map);
}
return rjx; return rjx;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment