Subversion Repositories SmartDukaan

Rev

Rev 23909 | Rev 23911 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 23909 Rev 23910
Line 24... Line 24...
24
import org.springframework.stereotype.Component;
24
import org.springframework.stereotype.Component;
25
import org.springframework.transaction.annotation.Transactional;
25
import org.springframework.transaction.annotation.Transactional;
26
 
26
 
27
import com.spice.profitmandi.common.model.CustomRetailer;
27
import com.spice.profitmandi.common.model.CustomRetailer;
28
import com.spice.profitmandi.common.util.FormattingUtils;
28
import com.spice.profitmandi.common.util.FormattingUtils;
-
 
29
import com.spice.profitmandi.common.util.Utils;
29
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
30
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
30
import com.spice.profitmandi.dao.entity.fofo.Purchase;
31
import com.spice.profitmandi.dao.entity.fofo.Purchase;
31
import com.spice.profitmandi.dao.entity.transaction.LineItem;
32
import com.spice.profitmandi.dao.entity.transaction.LineItem;
32
import com.spice.profitmandi.dao.entity.transaction.LineItemImei;
33
import com.spice.profitmandi.dao.entity.transaction.LineItemImei;
33
import com.spice.profitmandi.dao.entity.transaction.Order;
34
import com.spice.profitmandi.dao.entity.transaction.Order;
Line 169... Line 170...
169
			} catch (Exception e) {
170
			} catch (Exception e) {
170
				e.printStackTrace();
171
				e.printStackTrace();
171
				continue;
172
				continue;
172
			}
173
			}
173
			FileUtils.writeLines(f, lines);
174
			FileUtils.writeLines(f, lines);
174
			this.sendMailWithAttachments("amit.gupta@shop2020.in", "Partner Investment Summary", "PFA", Arrays.asList(f));
175
			Utils.sendMailWithAttachments(mailSender,"amit.gupta@shop2020.in", null, "Partner Investment Summary", "PFA", Arrays.asList(f));
175
		}
176
		}
176
 
177
 
177
	}
178
	}
178
	
179
	
179
	private void sendMailWithAttachments(String email, String subject, String body, List<File> attachments) throws Exception {
-
 
180
 
-
 
181
    	MimeMessage message = mailSender.createMimeMessage();
-
 
182
    	MimeMessageHelper helper = new MimeMessageHelper(message,true);
-
 
183
    	helper.setSubject(subject);
-
 
184
    	helper.setText(body);
-
 
185
    	//String[] cc = {"backup@shop2020.in", "gadgetcops.01@gmail.com"};
-
 
186
    	//String[] cc = {"amit.gupta@shop2020.in"};
-
 
187
    	//helper.setCc(cc);
-
 
188
    	helper.setTo(email);
-
 
189
    	InternetAddress senderAddress = new InternetAddress("noreply@smartdukaan.com", "ProfitMandi Admin");
-
 
190
    	//helper.setTo("help@smartdukaan.com");
-
 
191
    	helper.setFrom(senderAddress);
-
 
192
    	for (File file : attachments) {
-
 
193
    		helper.addAttachment(file.getName(), file);
-
 
194
    	}
-
 
195
    	mailSender.send(message);
-
 
196
		
-
 
197
	}
-
 
198
}
180
}
199
181