| Line 1790... |
Line 1790... |
| 1790 |
if self.callDisposition == 'product_availability':
|
1790 |
if self.callDisposition == 'product_availability':
|
| 1791 |
self.callHistoryCrm.disposition_description='Product Not available'
|
1791 |
self.callHistoryCrm.disposition_description='Product Not available'
|
| 1792 |
elif self.callDisposition == 'return_replacement':
|
1792 |
elif self.callDisposition == 'return_replacement':
|
| 1793 |
self.callHistoryCrm.disposition_description='Return or replacement pending'
|
1793 |
self.callHistoryCrm.disposition_description='Return or replacement pending'
|
| 1794 |
utils.sendCrmProjectMail(self.userId,self.callHistoryCrm.disposition_description,self.callHistoryCrm.disposition_comments)
|
1794 |
utils.sendCrmProjectMail(self.userId,self.callHistoryCrm.disposition_description,self.callHistoryCrm.disposition_comments)
|
| - |
|
1795 |
CrmTicketDtr.addTicket(self, self.userId, self.callHistoryCrm.disposition_description, self.callHistoryCrm.disposition_comments)
|
| 1795 |
elif self.callDisposition == 'already_purchased':
|
1796 |
elif self.callDisposition == 'already_purchased':
|
| 1796 |
self.callHistoryCrm.disposition_description='Already purchased required stock'
|
1797 |
self.callHistoryCrm.disposition_description='Already purchased required stock'
|
| 1797 |
elif self.callDisposition == 'product_quality_issue':
|
1798 |
elif self.callDisposition == 'product_quality_issue':
|
| 1798 |
self.callHistoryCrm.disposition_description='Product Quality issue'
|
1799 |
self.callHistoryCrm.disposition_description='Product Quality issue'
|
| 1799 |
utils.sendCrmProjectMail(self.userId,self.callHistoryCrm.disposition_description,self.callHistoryCrm.disposition_comments)
|
1800 |
utils.sendCrmProjectMail(self.userId,self.callHistoryCrm.disposition_description,self.callHistoryCrm.disposition_comments)
|
| Line 1988... |
Line 1989... |
| 1988 |
userList=[]
|
1989 |
userList=[]
|
| 1989 |
orderUserList=[]
|
1990 |
orderUserList=[]
|
| 1990 |
userMasterMap={}
|
1991 |
userMasterMap={}
|
| 1991 |
queryfilter = {"$and":
|
1992 |
queryfilter = {"$and":
|
| 1992 |
[
|
1993 |
[
|
| 1993 |
{'created':{"$gte":(to_java_date(datetime.now())-2*86400000)}},
|
1994 |
{'created':{"$gte":(to_java_date(datetime.now())-3*86400000)}},
|
| 1994 |
{'created':{"$lte":(to_java_date(datetime.now())- 43200000)}},
|
1995 |
{'created':{"$lte":(to_java_date(datetime.now())- 43200000)}},
|
| 1995 |
{"url":{"$regex" : "http://api.profittill.com/cartdetails"}}
|
1996 |
{"url":{"$regex" : "http://api.profittill.com/cartdetails"}}
|
| 1996 |
]
|
1997 |
]
|
| 1997 |
}
|
1998 |
}
|
| 1998 |
result = get_mongo_connection_dtr_data().User.browsinghistories.find(queryfilter).distinct('user_id')
|
1999 |
result = get_mongo_connection_dtr_data().User.browsinghistories.find(queryfilter).distinct('user_id')
|
| Line 2037... |
Line 2038... |
| 2037 |
userPresent = session.query(UserCrmCallingData).filter_by(user_id=userId).order_by(desc(UserCrmCallingData.modified)).first()
|
2038 |
userPresent = session.query(UserCrmCallingData).filter_by(user_id=userId).order_by(desc(UserCrmCallingData.modified)).first()
|
| 2038 |
if userPresent is not None:
|
2039 |
if userPresent is not None:
|
| 2039 |
if userPresent.user_available==1:
|
2040 |
if userPresent.user_available==1:
|
| 2040 |
if userPresent.project_id==projectId:
|
2041 |
if userPresent.project_id==projectId:
|
| 2041 |
continue
|
2042 |
continue
|
| 2042 |
elif userPresent.modified.date()>=(datetime.now().date()-timedelta(days=3)):
|
2043 |
elif userPresent.modified.date()>=(datetime.now().date()-timedelta(days=30)):
|
| 2043 |
continue
|
2044 |
continue
|
| 2044 |
else:
|
2045 |
else:
|
| 2045 |
continue
|
2046 |
continue
|
| 2046 |
counter=counter+1
|
2047 |
counter=counter+1
|
| 2047 |
userMasterData = UserCrmCallingData()
|
2048 |
userMasterData = UserCrmCallingData()
|
| Line 2179... |
Line 2180... |
| 2179 |
print result
|
2180 |
print result
|
| 2180 |
obj.lastActiveCartTime =datetime.strftime(result[0][0], '%d/%m/%Y %H:%M:%S')
|
2181 |
obj.lastActiveCartTime =datetime.strftime(result[0][0], '%d/%m/%Y %H:%M:%S')
|
| 2181 |
conn.close()
|
2182 |
conn.close()
|
| 2182 |
return obj
|
2183 |
return obj
|
| 2183 |
|
2184 |
|
| - |
|
2185 |
class CrmTicketDtr():
|
| - |
|
2186 |
def on_post(self,req,resp):
|
| - |
|
2187 |
customerFeedbackBackMap = {}
|
| - |
|
2188 |
customerFeedbackBackMap['user_id']=req.get_param("user_id")
|
| - |
|
2189 |
user = session.query(Users).filter_by(id=customerFeedbackBackMap.get('user_id')).first()
|
| - |
|
2190 |
if user is not None:
|
| - |
|
2191 |
customerFeedbackBackMap['email']=user.email
|
| - |
|
2192 |
customerFeedbackBackMap['mobile_number']=user.mobile_number
|
| - |
|
2193 |
customerFeedbackBackMap['customer_name']=user.first_name + ' ' + user.last_name
|
| - |
|
2194 |
customerFeedbackBackMap['subject'] = req.get_param("subject")
|
| - |
|
2195 |
customerFeedbackBackMap['message'] = req.get_param("message")
|
| - |
|
2196 |
customerFeedbackBackMap['created'] = datetime.now()
|
| - |
|
2197 |
if utils.generateCrmTicket(customerFeedbackBackMap):
|
| - |
|
2198 |
resp.body={"result":"success"}
|
| - |
|
2199 |
else:
|
| - |
|
2200 |
resp.body={"result":"failure"}
|
| - |
|
2201 |
else:
|
| - |
|
2202 |
resp.body={"result":"failure"}
|
| - |
|
2203 |
|
| - |
|
2204 |
def addTicket(self,user_id,subject,message):
|
| - |
|
2205 |
customerFeedbackBackMap = {}
|
| - |
|
2206 |
customerFeedbackBackMap['user_id']=user_id
|
| - |
|
2207 |
user = session.query(Users).filter_by(id=user_id).first()
|
| - |
|
2208 |
if user is not None:
|
| - |
|
2209 |
customerFeedbackBackMap['email']=user.email
|
| - |
|
2210 |
customerFeedbackBackMap['mobile_number']=user.mobile_number
|
| - |
|
2211 |
customerFeedbackBackMap['customer_name']=user.first_name + ' ' + user.last_name
|
| - |
|
2212 |
customerFeedbackBackMap['subject'] = subject
|
| - |
|
2213 |
customerFeedbackBackMap['message'] = message
|
| - |
|
2214 |
customerFeedbackBackMap['created'] = datetime.now()
|
| - |
|
2215 |
utils.generateCrmTicket(customerFeedbackBackMap)
|
| - |
|
2216 |
else:
|
| - |
|
2217 |
print 'User is not present'
|
| - |
|
2218 |
|
| 2184 |
class UnitDeal():
|
2219 |
class UnitDeal():
|
| 2185 |
def on_get(self,req,resp, id):
|
2220 |
def on_get(self,req,resp, id):
|
| 2186 |
result = Mongo.getDealById(id)
|
2221 |
result = Mongo.getDealById(id)
|
| 2187 |
resp.body = dumps(result)
|
2222 |
resp.body = dumps(result)
|
| 2188 |
|
2223 |
|
| Line 2190... |
Line 2225... |
| 2190 |
a = RetailerDetail()
|
2225 |
a = RetailerDetail()
|
| 2191 |
retailer = a.getNotActiveRetailer()
|
2226 |
retailer = a.getNotActiveRetailer()
|
| 2192 |
otherContacts = [r for r, in session.query(RetailerContacts.mobile_number).filter_by(retailer_id=retailer.id).order_by(RetailerContacts.contact_type).all()]
|
2227 |
otherContacts = [r for r, in session.query(RetailerContacts.mobile_number).filter_by(retailer_id=retailer.id).order_by(RetailerContacts.contact_type).all()]
|
| 2193 |
print json.dumps(todict(getRetailerObj(retailer, otherContacts, 'fresh')), encoding='utf-8')
|
2228 |
print json.dumps(todict(getRetailerObj(retailer, otherContacts, 'fresh')), encoding='utf-8')
|
| 2194 |
# a = GetUserCrmApplication()
|
2229 |
# a = GetUserCrmApplication()
|
| 2195 |
# a.getUser("accs_active", 2)
|
2230 |
# a.getUser("accs_cart", 1)
|
| 2196 |
|
2231 |
|
| 2197 |
if __name__ == '__main__':
|
2232 |
if __name__ == '__main__':
|
| 2198 |
main()
|
2233 |
main()
|
| 2199 |
|
2234 |
|
| 2200 |
|
2235 |
|