Subversion Repositories SmartDukaan

Rev

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

Rev 16244 Rev 17079
Line 12... Line 12...
12
import in.shop2020.model.v1.user.UserContextException;
12
import in.shop2020.model.v1.user.UserContextException;
13
import in.shop2020.serving.auth.CRMAuthorizingRealm;
13
import in.shop2020.serving.auth.CRMAuthorizingRealm;
14
import in.shop2020.thrift.clients.CRMClient;
14
import in.shop2020.thrift.clients.CRMClient;
15
import in.shop2020.thrift.clients.UserClient;
15
import in.shop2020.thrift.clients.UserClient;
16
import in.shop2020.util.CRMConstants;
16
import in.shop2020.util.CRMConstants;
-
 
17
import in.shop2020.util.SendGrid;
-
 
18
import in.shop2020.util.SendGridException;
17
import in.shop2020.util.CRMConstants.ActivityCommonDescriptionMatrix;
19
import in.shop2020.util.CRMConstants.ActivityCommonDescriptionMatrix;
18
import in.shop2020.util.CRMConstants.ActivityPMCommonDescriptionMatrix;
20
import in.shop2020.util.CRMConstants.ActivityPMCommonDescriptionMatrix;
19
 
21
 
20
import java.text.ParseException;
22
import java.text.ParseException;
21
import java.util.ArrayList;
23
import java.util.ArrayList;
Line 182... Line 184...
182
        }
184
        }
183
        
185
        
184
 
186
 
185
        crmServiceClient = new CRMClient().getClient();
187
        crmServiceClient = new CRMClient().getClient();
186
        activityId = String.valueOf(crmServiceClient.insertActivity(activity));
188
        activityId = String.valueOf(crmServiceClient.insertActivity(activity));
-
 
189
        try{
-
 
190
	        if (ActivityType.RECEIVED_CALL_FROM_CUSTOMER.equals(ActivityType.valueOf(type))) {
-
 
191
	        	String addTo[] = new String[]{"manish.sharma@shop2020.in","amit.sirohi@shop2020.in"};
-
 
192
	        	if(commonDescription!=null && !commonDescription.isEmpty()){
-
 
193
	        		commonDescription = "Received Call From Customer";
-
 
194
	        	}
-
 
195
	        	sendMailToManagers(commonDescription, addTo, description);
-
 
196
	        }
-
 
197
        }
-
 
198
	    catch(Exception e){
-
 
199
	    	e.printStackTrace();
-
 
200
	    }
187
 
201
 
188
        return index();
202
        return index();
189
    }
203
    }
-
 
204
    
-
 
205
    private void sendMailToManagers(String subject, String[] addTo, String body) throws SendGridException{
-
 
206
    	SendGrid sendgrid = new SendGrid("profitmandi", "pma20aug");
-
 
207
		SendGrid.Email email = new SendGrid.Email();
-
 
208
		email.setFrom(CRMConstants.PROFIT_MANDI_EMAIL_SENDER);
-
 
209
		email.setFromName("ProfitMandi");
-
 
210
		email.addTo(addTo);
-
 
211
		email.addBcc("backup@saholic.com");
-
 
212
		email.setSubject(subject);
-
 
213
		email.setHtml(body);
-
 
214
		log.info("Mail Body:- "+body);
-
 
215
		sendgrid.send(email);
-
 
216
		log.info("Mail sent to user:- "+addTo);
-
 
217
    }
190
 
218
 
191
    public String markAsRead() {
219
    public String markAsRead() {
192
        try {
220
        try {
193
            crmServiceClient = new CRMClient().getClient();
221
            crmServiceClient = new CRMClient().getClient();
194
            crmServiceClient.markAsRead(Long.parseLong(activityId),
222
            crmServiceClient.markAsRead(Long.parseLong(activityId),