Subversion Repositories SmartDukaan

Rev

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

Rev 29209 Rev 31238
Line 1... Line 1...
1
package com.spice.profitmandi.web.controller;
1
package com.spice.profitmandi.web.controller;
2
 
2
 
3
import java.time.LocalDateTime;
-
 
4
import java.util.HashMap;
-
 
5
import java.util.List;
-
 
6
import java.util.Map;
-
 
7
import java.util.stream.Collectors;
-
 
8
 
-
 
9
import javax.servlet.http.HttpServletRequest;
-
 
10
 
-
 
11
import org.apache.logging.log4j.LogManager;
-
 
12
import org.apache.logging.log4j.Logger;
-
 
13
import org.springframework.beans.factory.annotation.Autowired;
-
 
14
import org.springframework.beans.factory.annotation.Qualifier;
-
 
15
import org.springframework.stereotype.Controller;
-
 
16
import org.springframework.transaction.annotation.Transactional;
-
 
17
import org.springframework.ui.Model;
-
 
18
import org.springframework.web.bind.annotation.GetMapping;
-
 
19
import org.springframework.web.bind.annotation.PostMapping;
-
 
20
import org.springframework.web.bind.annotation.RequestParam;
-
 
21
 
-
 
22
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
3
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
23
import com.spice.profitmandi.common.model.ProfitMandiConstants;
4
import com.spice.profitmandi.common.model.ProfitMandiConstants;
24
import com.spice.profitmandi.dao.entity.auth.AuthUser;
5
import com.spice.profitmandi.dao.entity.auth.AuthUser;
25
import com.spice.profitmandi.dao.entity.cs.PartnerPosition;
6
import com.spice.profitmandi.dao.entity.cs.PartnerPosition;
26
import com.spice.profitmandi.dao.entity.cs.Position;
7
import com.spice.profitmandi.dao.entity.cs.Position;
Line 35... Line 16...
35
import com.spice.profitmandi.dao.repository.dtr.UserRoleRepository;
16
import com.spice.profitmandi.dao.repository.dtr.UserRoleRepository;
36
import com.spice.profitmandi.service.AuthService;
17
import com.spice.profitmandi.service.AuthService;
37
import com.spice.profitmandi.web.model.LoginDetails;
18
import com.spice.profitmandi.web.model.LoginDetails;
38
import com.spice.profitmandi.web.util.CookiesProcessor;
19
import com.spice.profitmandi.web.util.CookiesProcessor;
39
import com.spice.profitmandi.web.util.MVCResponseSender;
20
import com.spice.profitmandi.web.util.MVCResponseSender;
-
 
21
import org.apache.logging.log4j.LogManager;
-
 
22
import org.apache.logging.log4j.Logger;
-
 
23
import org.springframework.beans.factory.annotation.Autowired;
-
 
24
import org.springframework.beans.factory.annotation.Qualifier;
-
 
25
import org.springframework.stereotype.Controller;
-
 
26
import org.springframework.transaction.annotation.Transactional;
-
 
27
import org.springframework.ui.Model;
-
 
28
import org.springframework.web.bind.annotation.GetMapping;
-
 
29
import org.springframework.web.bind.annotation.PostMapping;
-
 
30
import org.springframework.web.bind.annotation.RequestParam;
-
 
31
 
-
 
32
import javax.servlet.http.HttpServletRequest;
-
 
33
import java.time.LocalDateTime;
-
 
34
import java.util.HashMap;
-
 
35
import java.util.List;
-
 
36
import java.util.Map;
40
 
37
 
41
@Controller
38
@Controller
42
@Transactional(rollbackFor = Throwable.class)
39
@Transactional(rollbackFor = Throwable.class)
43
public class AuthUserController {
40
public class AuthUserController {
44
 
41
 
Line 249... Line 246...
249
	public String updateAuthUser(Model model, @RequestParam String gmailId, @RequestParam String emailId)
246
	public String updateAuthUser(Model model, @RequestParam String gmailId, @RequestParam String emailId)
250
			throws Exception {
247
			throws Exception {
251
		AuthUser user = authRepository.selectByEmailOrMobile(emailId);
248
		AuthUser user = authRepository.selectByEmailOrMobile(emailId);
252
		user.setGmailId(gmailId);
249
		user.setGmailId(gmailId);
253
		authRepository.persist(user);
250
		authRepository.persist(user);
254
		model.addAttribute("response", "true");
251
		model.addAttribute("response1", "true");
255
		return "response";
252
		return "response";
256
	}
253
	}
257
 
254
 
258
	@PostMapping(value = "/authuser/remove")
255
	@PostMapping(value = "/authuser/remove")
259
	public String removeAuthUser(Model model, @RequestParam int id) throws Exception {
256
	public String removeAuthUser(Model model, @RequestParam int id) throws Exception {
Line 267... Line 264...
267
			positionRepository.delete(position.getId());
264
			positionRepository.delete(position.getId());
268
			for (PartnerPosition partnerPosition : partnerPositions) {
265
			for (PartnerPosition partnerPosition : partnerPositions) {
269
				partnerPositionRepository.delete(partnerPosition.getPositionId());
266
				partnerPositionRepository.delete(partnerPosition.getPositionId());
270
			}
267
			}
271
		}
268
		}
272
		model.addAttribute("response", "true");
269
		model.addAttribute("response1", "true");
273
		return "response";
270
		return "response";
274
	}
271
	}
275
 
272
 
276
}
273
}