workspace
This commit is contained in:
		
							parent
							
								
									477647da0f
								
							
						
					
					
						commit
						38b8fc040c
					
				| @ -0,0 +1,180 @@ | ||||
| package com.realnet.Communication.Services; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.Optional; | ||||
| import java.util.stream.Collectors; | ||||
| 
 | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.http.HttpEntity; | ||||
| import org.springframework.http.HttpHeaders; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.stereotype.Service; | ||||
| import org.springframework.util.LinkedMultiValueMap; | ||||
| import org.springframework.util.MultiValueMap; | ||||
| import org.springframework.web.client.ResourceAccessException; | ||||
| import org.springframework.web.client.RestTemplate; | ||||
| 
 | ||||
| import com.fasterxml.jackson.core.JsonProcessingException; | ||||
| import com.realnet.config.EmailService; | ||||
| import com.realnet.users.entity1.AppUser; | ||||
| import com.realnet.users.service1.AppUserServiceImpl; | ||||
| import com.realnet.utils.Port_Constant; | ||||
| 
 | ||||
| @Service | ||||
| public class EmailNotificationService { | ||||
| 
 | ||||
| 	@Autowired | ||||
| 	private EmailService emailService; | ||||
| 
 | ||||
| 	@Autowired | ||||
| 	private AppUserServiceImpl userService; | ||||
| 
 | ||||
| 	public void sendDirectEmail(String email, String subject, String message) throws JsonProcessingException { | ||||
| 		// Call the sendSimpleMessage method from EmailService | ||||
| 		emailService.sendSimpleMessage(null, email, subject, message); | ||||
| 	} | ||||
| 
 | ||||
| 	public void sendmailViaSetu(String email, String Name, String type) { | ||||
| 		// Call the method from EmailCommunicationService | ||||
| 
 | ||||
| 		switch (type) { | ||||
| 		case "TeamMember": | ||||
| 			sendEmailTeamMember(email, Name); | ||||
| 			break; | ||||
| 
 | ||||
| 		case "WorkSpaceUser": | ||||
| 			sendEmailtoWorkUser(email, Name); | ||||
| 			break; | ||||
| 		case "AddProject": | ||||
| 			sendEmailAfterAddPrj(email, Name); | ||||
| 			break; | ||||
| 
 | ||||
| 		case "CopyProject": | ||||
| 			sendEmailAfterCopyPrj(email, Name); | ||||
| 			break; | ||||
| 
 | ||||
| 		case "CreateWireframe": | ||||
| 			sendEmailAfterCopyPrj(email, Name); | ||||
| 			break; | ||||
| 
 | ||||
| 		default: | ||||
| 			break; | ||||
| 		} | ||||
| 
 | ||||
| 	} | ||||
| 
 | ||||
| //	 for sending mail to team member | ||||
| 	public ResponseEntity<?> sendEmailTeamMember(String email, String FullName) { | ||||
| 		// Call the method from EmailCommunicationService | ||||
| 
 | ||||
| 		String subject = "Team Added to Workspace"; | ||||
| 		String message = "Dear " + FullName + ",\n\nYou have been added to the workspace."; | ||||
| 		String templateName = "addproject"; | ||||
| 		String gatewayName = "ganesh"; | ||||
| 
 | ||||
| 		// Sending the email via Setu | ||||
| 
 | ||||
| 		ResponseEntity<?> responseEntity = sendEmailViaSetu(email, message, templateName, gatewayName); | ||||
| 		return responseEntity; | ||||
| 	} | ||||
| 
 | ||||
| //	 for sending mail to Sec workspace User | ||||
| 	public ResponseEntity<?> sendEmailtoWorkUser(String email, String FullName) { | ||||
| 		// Call the method from EmailCommunicationService | ||||
| 
 | ||||
| 		String subject = "Workspace Access Granted"; | ||||
| 		String message = "Dear " + FullName + ",\n\nYou have been granted access to the workspace."; | ||||
| 		String templateName = "addproject"; // Replace with actual template name | ||||
| 		String gatewayName = "ganesh"; // Replace with actual gateway name | ||||
| 
 | ||||
| 		// Sending the email via Setu | ||||
| 		return sendEmailViaSetu(email, message, templateName, gatewayName); | ||||
| 	} | ||||
| 
 | ||||
| //	 for sending mail After Add project | ||||
| 	public ResponseEntity<?> sendEmailAfterAddPrj(String email, String Name) { | ||||
| 		// Call the method from EmailCommunicationService | ||||
| 
 | ||||
| 		String subject = "Add Project"; | ||||
| 		String message = "Project " + Name + " has been created successfully."; | ||||
| 		String templateName = "addproject"; // Replace with actual template name | ||||
| 		String gatewayName = "ganesh"; // Replace with actual gateway name | ||||
| 
 | ||||
| 		// Sending the email via Setu | ||||
| 		return sendEmailViaSetu(email, message, templateName, gatewayName); | ||||
| 	} | ||||
| 
 | ||||
| //	 for sending mail After Copy project | ||||
| 	public ResponseEntity<?> sendEmailAfterCopyPrj(String email, String Name) { | ||||
| 		// Call the method from EmailCommunicationService | ||||
| 
 | ||||
| 		String subject = "Copy Project"; | ||||
| 		String message = "Project " + Name + " has been Copied successfully."; | ||||
| 		String templateName = "addproject"; // Replace with actual template name | ||||
| 		String gatewayName = "ganesh"; // Replace with actual gateway name | ||||
| 
 | ||||
| 		// Sending the email via Setu | ||||
| 		return sendEmailViaSetu(email, message, templateName, gatewayName); | ||||
| 	} | ||||
| 
 | ||||
| //	 for sending mail After create Wireframe | ||||
| 	public ResponseEntity<?> sendEmailAfterCreateWireframe(String email, String Name) { | ||||
| 		// Call the method from EmailCommunicationService | ||||
| 
 | ||||
| 		String subject = "Create Wireframe"; | ||||
| 		String message = "A new wireframe has been successfully added to your project."; | ||||
| 
 | ||||
| 		String templateName = "addproject"; // Replace with actual template name | ||||
| 		String gatewayName = "ganesh"; // Replace with actual gateway name | ||||
| 
 | ||||
| 		// Sending the email via Setu | ||||
| 		return sendEmailViaSetu(email, message, templateName, gatewayName); | ||||
| 	} | ||||
| 
 | ||||
| //	send mail via setu | ||||
| 	public ResponseEntity<?> sendEmailViaSetu(String email, String message, String templateName, String gatewayName) | ||||
| 			throws ResourceAccessException { | ||||
| 
 | ||||
| //		template name = notification_template, gateway name = email_gateway | ||||
| 		try { | ||||
| 
 | ||||
| 			String jsonData = "{\r\n" + "  \"job_type\": \"Email\",\r\n" + "  \"send_to\": \"" + email.trim() | ||||
| 					+ "\",\r\n" + "  \"cc\": \"cc@example.com\",\r\n" | ||||
| //					+ "  \"attachment\": \"sample-file.txt\",\r\n" | ||||
| 					+ "  \"gatewaydone\": \"N\",\r\n" + "  \"template_name\": \"" + templateName.trim() + "\",\r\n" | ||||
| 					+ "  \"replacement_string\": \"Hello, {name} " + message + "!\",\r\n" + "  \"gatewayName\": \"" | ||||
| 					+ gatewayName.trim() + "\"\r\n" + "}\r\n"; | ||||
| 
 | ||||
| 			HttpHeaders headers = new HttpHeaders(); | ||||
| //			headers.setContentType(MediaType.MULTIPART_FORM_DATA); | ||||
| 
 | ||||
| 			MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>(); | ||||
| 			queryParams.add("data", jsonData); | ||||
| 
 | ||||
| 			HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(queryParams, headers); | ||||
| 
 | ||||
| 			String apiUrl2 = Port_Constant.SURE_SETU_DOMAIN | ||||
| 					+ "/token/Surecommunication/communication/jobtable/Com_jobTable"; // Replace with the | ||||
| 			// actual API URL | ||||
| 
 | ||||
| 			RestTemplate restTemplate = new RestTemplate(); | ||||
| 
 | ||||
| 			ResponseEntity<String> responseEntity = restTemplate.postForEntity(apiUrl2, requestEntity, String.class); | ||||
| 
 | ||||
| 			return ResponseEntity.ok(responseEntity.getBody()); | ||||
| 
 | ||||
| 		} catch (ResourceAccessException e) { | ||||
| 			throw new ResourceAccessException("communication server no start..." + e); | ||||
| 		} | ||||
| 
 | ||||
| 		catch (Exception e) { | ||||
| 			e.printStackTrace(); | ||||
| 			return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build(); | ||||
| 		} | ||||
| 
 | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
| @ -0,0 +1,107 @@ | ||||
| package com.realnet.Workspaceuser.Controller; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| 
 | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.web.bind.annotation.GetMapping; | ||||
| import org.springframework.web.bind.annotation.RequestMapping; | ||||
| import org.springframework.web.bind.annotation.RestController; | ||||
| 
 | ||||
| import com.realnet.Workspaceuser.Entity.DDTable; | ||||
| import com.realnet.Workspaceuser.Entity.SecUsedDd; | ||||
| import com.realnet.Workspaceuser.Entity.Sec_teams; | ||||
| import com.realnet.Workspaceuser.Repository.Sec_teams_Repository; | ||||
| import com.realnet.users.entity1.AppUser; | ||||
| import com.realnet.users.repository1.AppUserRepository; | ||||
| //@RequestMapping("/Workspace_Dd") | ||||
| @RestController | ||||
| public class DDController { | ||||
| 	 | ||||
| 	@Autowired | ||||
| 	private Sec_teams_Repository sec_teams_Repository; | ||||
| 	 | ||||
| 	@Autowired | ||||
| 	private AppUserRepository appUserRepository; | ||||
| 	 | ||||
| //	SEC TEAM DD | ||||
| 	 | ||||
| 	@GetMapping("/Sec_team") | ||||
| 	public ResponseEntity<?> getteam(){ | ||||
| 		List<Sec_teams> sec = (List<Sec_teams>) sec_teams_Repository.findAll(); | ||||
| 		ArrayList<DDTable> dd = new ArrayList<DDTable>(); | ||||
| 		for(Sec_teams s:sec) { | ||||
| 			DDTable d = new DDTable(); | ||||
| 			d.setId(s.getId()); | ||||
| 			d.setName(s.getName()); | ||||
| 			dd.add(d); | ||||
| 		} | ||||
| 		return new ResponseEntity<>(dd, HttpStatus.OK); | ||||
| 			 | ||||
| 	} | ||||
| 	 | ||||
| //	Report To | ||||
| 	@GetMapping("/Report_to") | ||||
| 	public ResponseEntity<?> reportto(){ | ||||
| 		List<AppUser> sec = (List<AppUser>) appUserRepository.findAll(); | ||||
| 		ArrayList<SecUsedDd> dd = new ArrayList<SecUsedDd>(); | ||||
| 		for(AppUser s:sec) { | ||||
| 			SecUsedDd d = new SecUsedDd(); | ||||
| 			d.setUserId(s.getUserId()); | ||||
| 			d.setFullName(s.getFullName()); | ||||
| 			 | ||||
| 			dd.add(d); | ||||
| 		} | ||||
| 		return new ResponseEntity<>(dd, HttpStatus.OK); | ||||
| 			 | ||||
| 	} | ||||
| //	assign To | ||||
| 	@GetMapping("/Assign") | ||||
| 	public ResponseEntity<?> Assign(){ | ||||
| 		List<AppUser> sec = (List<AppUser>) appUserRepository.findAll(); | ||||
| 		ArrayList<SecUsedDd> dd = new ArrayList<SecUsedDd>(); | ||||
| 		for(AppUser s:sec) { | ||||
| 			SecUsedDd d = new SecUsedDd(); | ||||
| 			d.setUserId(s.getUserId()); | ||||
| 			d.setFullName(s.getFullName()); | ||||
| 			 | ||||
| 			dd.add(d); | ||||
| 		} | ||||
| 		return new ResponseEntity<>(dd, HttpStatus.OK); | ||||
| 			 | ||||
| 	} | ||||
| //	Requestor To | ||||
| 	@GetMapping("/Requestor") | ||||
| 	public ResponseEntity<?> Requestor(){ | ||||
| 		List<AppUser> sec = (List<AppUser>) appUserRepository.findAll(); | ||||
| 		ArrayList<SecUsedDd> dd = new ArrayList<SecUsedDd>(); | ||||
| 		for(AppUser s:sec) { | ||||
| 			SecUsedDd d = new SecUsedDd(); | ||||
| 			d.setUserId(s.getUserId()); | ||||
| 			d.setFullName(s.getFullName()); | ||||
| 			 | ||||
| 			dd.add(d); | ||||
| 		} | ||||
| 		return new ResponseEntity<>(dd, HttpStatus.OK); | ||||
| 			 | ||||
| 	} | ||||
| 	 | ||||
| //	owner To | ||||
| 	@GetMapping("/Owner") | ||||
| 	public ResponseEntity<?> Owner(){ | ||||
| 		List<AppUser> sec = (List<AppUser>) appUserRepository.findAll(); | ||||
| 		ArrayList<SecUsedDd> dd = new ArrayList<SecUsedDd>(); | ||||
| 		for(AppUser s:sec) { | ||||
| 			SecUsedDd d = new SecUsedDd(); | ||||
| 			d.setUserId(s.getUserId()); | ||||
| 			d.setFullName(s.getFullName()); | ||||
| 			 | ||||
| 			dd.add(d); | ||||
| 		} | ||||
| 		return new ResponseEntity<>(dd, HttpStatus.OK); | ||||
| 			 | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
| @ -0,0 +1,87 @@ | ||||
| package com.realnet.Workspaceuser.Controller; | ||||
| 
 | ||||
| import java.util.List; | ||||
| 
 | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.web.bind.annotation.DeleteMapping; | ||||
| import org.springframework.web.bind.annotation.GetMapping; | ||||
| import org.springframework.web.bind.annotation.PathVariable; | ||||
| import org.springframework.web.bind.annotation.PostMapping; | ||||
| import org.springframework.web.bind.annotation.PutMapping; | ||||
| import org.springframework.web.bind.annotation.RequestBody; | ||||
| import org.springframework.web.bind.annotation.RequestMapping; | ||||
| import org.springframework.web.bind.annotation.RestController; | ||||
| 
 | ||||
| import com.realnet.Workspaceuser.Entity.Sec_teams; | ||||
| import com.realnet.Workspaceuser.Service.Sec_teamService; | ||||
| import com.realnet.users.entity1.AppUser; | ||||
| import com.realnet.users.service1.AppUserServiceImpl; | ||||
| 
 | ||||
| @RequestMapping("/Workspace_team") | ||||
| @RestController | ||||
| public class SecTeamController { | ||||
| 
 | ||||
| 	@Autowired | ||||
| 	private Sec_teamService sec_teamService; | ||||
| 
 | ||||
| 	@Autowired | ||||
| 	private AppUserServiceImpl userService; | ||||
| 
 | ||||
| //	create  | ||||
| 	@PostMapping("/SecTeam") | ||||
| 	public Sec_teams create(@RequestBody Sec_teams rnrule) { | ||||
| 		AppUser loggedInUser = userService.getLoggedInUser(); | ||||
| 
 | ||||
| 		long accountId = loggedInUser.getAccount().getAccount_id(); | ||||
| 		Long l = accountId; | ||||
| 		if (l != null) { | ||||
| 			rnrule.setAccountId(accountId); | ||||
| 
 | ||||
| 		} | ||||
| 
 | ||||
| 		Sec_teams rn = sec_teamService.create(rnrule); | ||||
| 		return rn; | ||||
| 	} | ||||
| 
 | ||||
| //	get all | ||||
| 	@GetMapping("/SecTeam") | ||||
| 	public ResponseEntity<?> getall() { | ||||
| 		List<Sec_teams> li = sec_teamService.getall(); | ||||
| 		return new ResponseEntity<>(li, HttpStatus.OK); | ||||
| 	} | ||||
| 
 | ||||
| //	get all by accountId | ||||
| 	@GetMapping("/SecTeam/AccountId") | ||||
| 	public ResponseEntity<?> getallByAccountId() { | ||||
| 		AppUser loggedInUser = userService.getLoggedInUser(); | ||||
| 
 | ||||
| 		long accountId = loggedInUser.getAccount().getAccount_id(); | ||||
| 
 | ||||
| 		List<Sec_teams> li = sec_teamService.getallbyAccountId(accountId); | ||||
| 		return new ResponseEntity<>(li, HttpStatus.OK); | ||||
| 	} | ||||
| 
 | ||||
| //	get by id | ||||
| 	@GetMapping("/SecTeam/{id}") | ||||
| 	public ResponseEntity<?> getbyid(@PathVariable int id) { | ||||
| 		Sec_teams rn = sec_teamService.getbyid(id); | ||||
| 		return new ResponseEntity<>(rn, HttpStatus.OK); | ||||
| 	} | ||||
| 
 | ||||
| //	update by id | ||||
| 	@PutMapping("/SecTeam/{id}") | ||||
| 	public ResponseEntity<?> update(@RequestBody Sec_teams project, @PathVariable int id) { | ||||
| 		Sec_teams rule_t = sec_teamService.updatebyid(project, id); | ||||
| 		return new ResponseEntity<>(rule_t, HttpStatus.OK); | ||||
| 
 | ||||
| 	} | ||||
| 
 | ||||
| //	Delete by id | ||||
| 	@DeleteMapping("/SecTeam/{id}") | ||||
| 	public void deletebyid(@PathVariable int id) { | ||||
| 		sec_teamService.deletebyid(id); | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
| @ -0,0 +1,170 @@ | ||||
| package com.realnet.Workspaceuser.Controller; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.Calendar; | ||||
| import java.util.Date; | ||||
| import java.util.HashSet; | ||||
| import java.util.List; | ||||
| import java.util.Optional; | ||||
| import java.util.Set; | ||||
| 
 | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.cache.annotation.Cacheable; | ||||
| import org.springframework.cache.annotation.EnableCaching; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.web.bind.annotation.GetMapping; | ||||
| import org.springframework.web.bind.annotation.PathVariable; | ||||
| import org.springframework.web.bind.annotation.PostMapping; | ||||
| import org.springframework.web.bind.annotation.RequestBody; | ||||
| import org.springframework.web.bind.annotation.RequestMapping; | ||||
| import org.springframework.web.bind.annotation.RequestParam; | ||||
| import org.springframework.web.bind.annotation.RestController; | ||||
| 
 | ||||
| import com.realnet.Communication.Services.EmailNotificationService; | ||||
| import com.realnet.Workspaceuser.Entity.Sec_team_members; | ||||
| import com.realnet.Workspaceuser.Entity.Sec_workspace_users; | ||||
| import com.realnet.Workspaceuser.Repository.SecWorkspaceUserRepo; | ||||
| import com.realnet.Workspaceuser.Repository.Sec_team_MemberRepository; | ||||
| 
 | ||||
| import com.realnet.users.entity.Role; | ||||
| import com.realnet.users.entity1.AppUser; | ||||
| import com.realnet.users.repository.RoleRepo; | ||||
| import com.realnet.users.repository1.AppUserRepository; | ||||
| import com.realnet.users.response.MessageResponse; | ||||
| import com.realnet.users.service1.AppUserServiceImpl; | ||||
| 
 | ||||
| @RestController | ||||
| @RequestMapping("/workspace/secworkspaceuser") | ||||
| @EnableCaching | ||||
| public class SecWorkSpaceUSerController { | ||||
| 
 | ||||
| 	@Autowired | ||||
| 	private SecWorkspaceUserRepo secWorkspaceUserRepo; | ||||
| 	@Autowired | ||||
| 	private AppUserServiceImpl userService; | ||||
| 	 | ||||
| 
 | ||||
| 	@Autowired | ||||
| 	private Sec_team_MemberRepository memberRepository; | ||||
| 	@Autowired | ||||
| 	private AppUserRepository userRepository; | ||||
| 
 | ||||
| 	@Autowired | ||||
| 	private RoleRepo roleRepo; | ||||
| 
 | ||||
| 	@Autowired | ||||
| 	private EmailNotificationService emailNotificationService; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 	// ADD WHOLE TEAM TO SECWORKSPACE USER BY TEAM_ID | ||||
| 	@PostMapping("/addteam/{project_id}/{team_id}") | ||||
| 	public ResponseEntity<?> addwholeteam(@PathVariable Integer project_id, @PathVariable int team_id, | ||||
| 			@RequestBody Sec_workspace_users users) { | ||||
| 		List<Object> list = new ArrayList<>(); | ||||
| 		List<Sec_team_members> members = memberRepository.getallteam(team_id); | ||||
| 		for (Sec_team_members mem : members) { | ||||
| 			Sec_workspace_users secuser = secWorkspaceUserRepo.getallsecworkspcceuser(mem.getMember_id(), project_id); | ||||
| 			if (secuser == null) { | ||||
| 				Sec_workspace_users user = new Sec_workspace_users(); | ||||
| 				Optional<AppUser> us = userRepository.findById(mem.getMember_id()); | ||||
| 				user.setAccountId(us.get().getAccount().getAccount_id()); | ||||
| 				user.setUser_id(mem.getMember_id()); | ||||
| 				user.setWorksapce_id(project_id); | ||||
| 				user.setProject_id(project_id); | ||||
| 				user.setUser_name(mem.getMember_name()); | ||||
| //				        Set<Role> roles = new HashSet<>(); | ||||
| //				        String role1 = "ROLE_Developer"; | ||||
| //				        Role userRole = roleRepo.findByName(role1); | ||||
| //				        roles.add(userRole); | ||||
| //				        users.setUser_role(roles); | ||||
| 				Sec_workspace_users save = secWorkspaceUserRepo.save(user); | ||||
| 
 | ||||
| 				list.add(save); | ||||
| 
 | ||||
| //				send mail to team member | ||||
| 				try { | ||||
| 					emailNotificationService.sendmailViaSetu(us.get().getEmail(), us.get().getFullName(), "TeamMember"); | ||||
| 
 | ||||
| 				} catch (Exception e) { | ||||
| 					System.out.println("email sending error ..." + e); | ||||
| 					// TODO: handle exception | ||||
| 				} | ||||
| 
 | ||||
| 			} | ||||
| 		} | ||||
| 		return new ResponseEntity<>(list, HttpStatus.OK); | ||||
| 	} | ||||
| 
 | ||||
| 	// GET ALL SEC_WORKSPACE_USER | ||||
| 	@GetMapping("/sec_workspace_users") | ||||
| 	public ResponseEntity<?> getallusers() { | ||||
| 		List<Sec_workspace_users> list = secWorkspaceUserRepo.findAll(); | ||||
| 		return new ResponseEntity<>(list, HttpStatus.OK); | ||||
| 	} | ||||
| 
 | ||||
| 	// GET ALL SEC_WORKSPACE_USER by PROJECT ID | ||||
| 	@GetMapping("/get_by_projectid/{project_id}") | ||||
| 	public ResponseEntity<?> getallusers(@PathVariable Integer project_id) { | ||||
| 		List<Sec_workspace_users> list = secWorkspaceUserRepo.getallproject(project_id); | ||||
| 		return new ResponseEntity<>(list, HttpStatus.OK); | ||||
| 	} | ||||
| 
 | ||||
| 	// ADD SEC WORKSPACE USER | ||||
| 	@PostMapping("/add_workspace/users/{userid}/{project_id}/{access_duration}") | ||||
| 	public ResponseEntity<?> addsecusers(@RequestBody Sec_workspace_users users, @PathVariable Long userid, | ||||
| 			@PathVariable Integer project_id, @PathVariable Integer access_duration, @RequestParam String role) { | ||||
| 
 | ||||
| 		AppUser loggedInUser = userService.getLoggedInUser(); | ||||
| 		Long fromuserid = loggedInUser.getUserId(); | ||||
| 		// Long account_id = loggedInUser.getAccount().getAccount_id(); | ||||
| 
 | ||||
| 		Sec_workspace_users workspace_users = secWorkspaceUserRepo.getallsecworkspcceuser(userid, project_id); | ||||
| 		if (workspace_users == null) { | ||||
| 			Optional<AppUser> us = userRepository.findById(userid); | ||||
| 			users.setAccountId(us.get().getAccount().getAccount_id()); | ||||
| 			users.setFromuserId(fromuserid); | ||||
| 			users.setUser_id(userid); | ||||
| 			users.setUser_name(us.get().getFullName()); | ||||
| 			users.setWorksapce_id(project_id); | ||||
| 			users.setProject_id(project_id); | ||||
| 
 | ||||
| 			users.setAccess_duration(access_duration); | ||||
| 
 | ||||
| 			Calendar c = Calendar.getInstance(); | ||||
| 			c.setTime(new Date()); | ||||
| 			c.add(Calendar.DATE, access_duration); | ||||
| 
 | ||||
| //			SimpleDateFormat dateFormat = new SimpleDateFormat(); | ||||
| //			String format = dateFormat.format(c.getTime()); | ||||
| 
 | ||||
| 			users.setAccess_till_date(c.getTime()); | ||||
| 
 | ||||
| 			Set<Role> roles = new HashSet<>(); | ||||
| //			String role1 = "ROLE_Developer"; | ||||
| 			Role userRole = roleRepo.findByName(role); | ||||
| //			roles.add(userRole); | ||||
| 			if (userRole != null) { | ||||
| 				users.setUser_role(role); | ||||
| 			} | ||||
| 
 | ||||
| 			Sec_workspace_users save = secWorkspaceUserRepo.save(users); | ||||
| 
 | ||||
| //			send mail to team member | ||||
| 
 | ||||
| 			try { | ||||
| 
 | ||||
| 				emailNotificationService.sendmailViaSetu(us.get().getEmail(), us.get().getFullName(), "WorkSpaceUser"); | ||||
| 
 | ||||
| 			} catch (Exception e) { | ||||
| 				System.out.println("email sending error ..." + e); | ||||
| 				// TODO: handle exception | ||||
| 			} | ||||
| 			return new ResponseEntity<>(save, HttpStatus.OK); | ||||
| 		} else | ||||
| 			return ResponseEntity.badRequest().body(new MessageResponse("user already added")); | ||||
| 
 | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
| @ -0,0 +1,60 @@ | ||||
| package com.realnet.Workspaceuser.Controller; | ||||
| 
 | ||||
| import java.util.List; | ||||
| 
 | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.web.bind.annotation.DeleteMapping; | ||||
| import org.springframework.web.bind.annotation.GetMapping; | ||||
| import org.springframework.web.bind.annotation.PathVariable; | ||||
| import org.springframework.web.bind.annotation.PostMapping; | ||||
| import org.springframework.web.bind.annotation.PutMapping; | ||||
| import org.springframework.web.bind.annotation.RequestBody; | ||||
| import org.springframework.web.bind.annotation.RequestMapping; | ||||
| import org.springframework.web.bind.annotation.RestController; | ||||
| import com.realnet.Workspaceuser.Service.SecTeam_MemberService; | ||||
| import com.realnet.Workspaceuser.Entity.Sec_team_members; | ||||
| @RequestMapping("/Workspace_team_member") | ||||
| @RestController | ||||
| public class Sec_team_members_Controller { | ||||
| 	 | ||||
| 	@Autowired | ||||
|  private SecTeam_MemberService secTeam_MemberService; | ||||
| 	 | ||||
| //	create  | ||||
| 	@PostMapping("/Teammember") | ||||
| 	public Sec_team_members create(@RequestBody Sec_team_members rnrule){ | ||||
| 		Sec_team_members rn = secTeam_MemberService.create(rnrule); | ||||
| 		return rn; | ||||
| 	} | ||||
| 	 | ||||
| //	get all | ||||
| 	 | ||||
| 	@GetMapping("/Teammember") | ||||
| 	public ResponseEntity<?> getall(){ | ||||
| 		List<Sec_team_members> li = secTeam_MemberService.getall(); | ||||
| 		return new ResponseEntity<>(li,HttpStatus.OK); | ||||
| 	} | ||||
| 	 | ||||
| //	get by id | ||||
| 	@GetMapping("/Teammember/{id}") | ||||
| 	public ResponseEntity<?> getbyid(@PathVariable int id){ | ||||
| 		Sec_team_members rn= secTeam_MemberService.getbyid(id); | ||||
| 		return new ResponseEntity<>(rn,HttpStatus.OK); | ||||
| 	} | ||||
| 	 | ||||
| //	update by id | ||||
| 	@PutMapping("/Teammember/{id}") | ||||
| 	public ResponseEntity<?> update(@RequestBody Sec_team_members project, @PathVariable int id){ | ||||
| 		Sec_team_members rule_t= secTeam_MemberService.updatebyid(project,id); | ||||
| 		return new ResponseEntity<>(rule_t,HttpStatus.OK); | ||||
| 
 | ||||
| 	} | ||||
| 	 | ||||
| //	Delete by id | ||||
| 	@DeleteMapping("/Teammember/{id}") | ||||
| 	public void deletebyid(@PathVariable int id){ | ||||
| 		secTeam_MemberService.deletebyid(id);		 | ||||
| 	}  | ||||
| } | ||||
| @ -0,0 +1,92 @@ | ||||
| package com.realnet.Workspaceuser.Controller; | ||||
| 
 | ||||
| import java.util.List; | ||||
| 
 | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.web.bind.annotation.DeleteMapping; | ||||
| import org.springframework.web.bind.annotation.GetMapping; | ||||
| import org.springframework.web.bind.annotation.PathVariable; | ||||
| import org.springframework.web.bind.annotation.PostMapping; | ||||
| import org.springframework.web.bind.annotation.PutMapping; | ||||
| import org.springframework.web.bind.annotation.RequestBody; | ||||
| import org.springframework.web.bind.annotation.RequestMapping; | ||||
| import org.springframework.web.bind.annotation.RestController; | ||||
| import com.realnet.Workspaceuser.Entity.Sec_workspace; | ||||
| import com.realnet.Workspaceuser.Repository.WorkspaceRepository; | ||||
| import com.realnet.Workspaceuser.Service.WorkspaceService; | ||||
| import com.realnet.users.entity1.AppUser; | ||||
| import com.realnet.users.service1.AppUserServiceImpl; | ||||
| 
 | ||||
| @RequestMapping("/Workspace_workspace") | ||||
| @RestController | ||||
| public class WorkspaceController { | ||||
| 
 | ||||
| 	@Autowired | ||||
| 	private AppUserServiceImpl userService; | ||||
| 
 | ||||
| 	@Autowired | ||||
| 	private WorkspaceService workspaceService; | ||||
| 	@Autowired | ||||
| 	private WorkspaceRepository workspaceRepository; | ||||
| 
 | ||||
| //	create  | ||||
| 	@PostMapping("/workspace") | ||||
| 	public Sec_workspace create(@RequestBody Sec_workspace rnrule) { | ||||
| 
 | ||||
| 		AppUser loggedInUser = userService.getLoggedInUser(); | ||||
| 		Long userId = loggedInUser.getUserId(); | ||||
| 		rnrule.setOwner_id(userId); | ||||
| 
 | ||||
| 		long accountId = loggedInUser.getAccount().getAccount_id(); | ||||
| 		Long l = accountId; | ||||
| 		if (l != null) { | ||||
| 			rnrule.setAccountId(accountId); | ||||
| 
 | ||||
| 		} | ||||
| 		Sec_workspace rn = workspaceService.create(rnrule); | ||||
| 		return rn; | ||||
| 	} | ||||
| 
 | ||||
| //	get all | ||||
| 
 | ||||
| 	@GetMapping("/workspace") | ||||
| 	public ResponseEntity<?> getall() { | ||||
| 
 | ||||
| 		List<Sec_workspace> li = workspaceService.getall(); | ||||
| 
 | ||||
| 		return new ResponseEntity<>(li, HttpStatus.OK); | ||||
| 	} | ||||
| 
 | ||||
| //	get all BY ACCOUNT ID | ||||
| 	@GetMapping("/FindByaccount") | ||||
| 	public ResponseEntity<?> getallbyaccount() { | ||||
| 		AppUser loggedInUser = userService.getLoggedInUser(); | ||||
| 		long accountId = loggedInUser.getAccount().getAccount_id(); | ||||
| 		List<Sec_workspace> li = workspaceRepository.findByAccountId(accountId); | ||||
| 		return new ResponseEntity<>(li, HttpStatus.OK); | ||||
| 	} | ||||
| 
 | ||||
| //	get by id | ||||
| 	@GetMapping("/workspace/{id}") | ||||
| 	public ResponseEntity<?> getbyid(@PathVariable int id) { | ||||
| 		Sec_workspace rn = workspaceService.getbyid(id); | ||||
| 		return new ResponseEntity<>(rn, HttpStatus.OK); | ||||
| 	} | ||||
| 
 | ||||
| //	update by id | ||||
| 	@PutMapping("/workspace/{id}") | ||||
| 	public ResponseEntity<?> update(@RequestBody Sec_workspace project, @PathVariable int id) { | ||||
| 		Sec_workspace rule_t = workspaceService.updatebyid(project, id); | ||||
| 		return new ResponseEntity<>(rule_t, HttpStatus.OK); | ||||
| 
 | ||||
| 	} | ||||
| 
 | ||||
| //	Delete by id | ||||
| 	@DeleteMapping("/workspace/{id}") | ||||
| 	public void deletebyid(@PathVariable int id) { | ||||
| 		workspaceService.deletebyid(id); | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
| @ -0,0 +1,10 @@ | ||||
| package com.realnet.Workspaceuser.Entity; | ||||
| 
 | ||||
| import lombok.Data; | ||||
| 
 | ||||
| @Data | ||||
| public class DDTable { | ||||
| 	private int id; | ||||
| 	private String name; | ||||
| 
 | ||||
| } | ||||
| @ -0,0 +1,13 @@ | ||||
| package com.realnet.Workspaceuser.Entity; | ||||
| 
 | ||||
| import lombok.Data; | ||||
| 
 | ||||
| @Data | ||||
| public class SecUsedDd { | ||||
| 	 | ||||
| 	private Long userId; | ||||
| 
 | ||||
| 	private String fullName; | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
| @ -0,0 +1,25 @@ | ||||
| package com.realnet.Workspaceuser.Entity; | ||||
| 
 | ||||
| import java.sql.Date; | ||||
| 
 | ||||
| import javax.persistence.Entity; | ||||
| import javax.persistence.GeneratedValue; | ||||
| import javax.persistence.GenerationType; | ||||
| import javax.persistence.Id; | ||||
| 
 | ||||
| import lombok.Data; | ||||
| @Data | ||||
| @Entity | ||||
| public class Sec_team_members { | ||||
| 
 | ||||
| 	@Id | ||||
| 	@GeneratedValue(strategy=GenerationType.IDENTITY) | ||||
| 	private int id; | ||||
| 	 | ||||
| 	private int team_id; | ||||
| 	private Long member_id; | ||||
| 	private boolean member_type; | ||||
| 	private String access_days; | ||||
| 	private Date access_start_date; | ||||
| 	private String member_name; | ||||
| } | ||||
| @ -0,0 +1,31 @@ | ||||
| package com.realnet.Workspaceuser.Entity; | ||||
| 
 | ||||
| import javax.persistence.Entity; | ||||
| import javax.persistence.GeneratedValue; | ||||
| import javax.persistence.GenerationType; | ||||
| import javax.persistence.Id; | ||||
| 
 | ||||
| import com.realnet.fnd.entity.Rn_Who_AccId_Column; | ||||
| 
 | ||||
| import lombok.Data; | ||||
| 
 | ||||
| @Entity | ||||
| @Data | ||||
| public class Sec_teams  extends Rn_Who_AccId_Column{ | ||||
| 	 | ||||
| 	/** | ||||
| 	 *  | ||||
| 	 */ | ||||
| 	private static final long serialVersionUID = 1L; | ||||
| 
 | ||||
| 
 | ||||
| 	@Id | ||||
| 	@GeneratedValue(strategy=GenerationType.IDENTITY) | ||||
| 	private int id; | ||||
| 	 | ||||
| 	 | ||||
| 	private String name; | ||||
| 	private String description; | ||||
| 	private String Is_active; | ||||
| 
 | ||||
| } | ||||
| @ -0,0 +1,32 @@ | ||||
| package com.realnet.Workspaceuser.Entity; | ||||
| 
 | ||||
| import javax.persistence.Entity; | ||||
| import javax.persistence.GeneratedValue; | ||||
| import javax.persistence.GenerationType; | ||||
| import javax.persistence.Id; | ||||
| 
 | ||||
| import com.realnet.fnd.entity.Rn_Who_AccId_Column; | ||||
| 
 | ||||
| import lombok.Data; | ||||
| 
 | ||||
| @Entity | ||||
| @Data | ||||
| public class Sec_workspace extends Rn_Who_AccId_Column { | ||||
| 
 | ||||
| 	/** | ||||
| 	 *  | ||||
| 	 */ | ||||
| 	private static final long serialVersionUID = 1L; | ||||
| 
 | ||||
| 	@Id | ||||
| 	@GeneratedValue(strategy = GenerationType.IDENTITY) | ||||
| 	private int id; | ||||
| 
 | ||||
| 	private String name; | ||||
| 	private String description; | ||||
| 	private String is_default; | ||||
| 	private String Is_active; | ||||
| 	private Long owner_id; | ||||
| 	private Integer project_id; | ||||
| 
 | ||||
| } | ||||
| @ -0,0 +1,40 @@ | ||||
| package com.realnet.Workspaceuser.Entity; | ||||
| 
 | ||||
| import java.util.Date; | ||||
| 
 | ||||
| import javax.persistence.Entity; | ||||
| import javax.persistence.GeneratedValue; | ||||
| import javax.persistence.GenerationType; | ||||
| import javax.persistence.Id; | ||||
| 
 | ||||
| import com.fasterxml.jackson.annotation.JsonFormat; | ||||
| import com.realnet.WhoColumn.Entity.Who_column; | ||||
| 
 | ||||
| import lombok.Data; | ||||
| 
 | ||||
| @Entity | ||||
| @Data | ||||
| public class Sec_workspace_users extends Who_column { | ||||
| 
 | ||||
| 	/** | ||||
| 	 *  | ||||
| 	 */ | ||||
| 	private static final long serialVersionUID = 1L; | ||||
| 	@Id | ||||
| 	@GeneratedValue(strategy = GenerationType.IDENTITY) | ||||
| 	private Long id; | ||||
| 	private int worksapce_id; | ||||
| 	private Long user_id; | ||||
| 	private String user_name; | ||||
| 	private Integer project_id; | ||||
| 	private String user_role; | ||||
| 
 | ||||
| 	private String project_name; | ||||
| 	private Long fromuserId; | ||||
| 
 | ||||
| 	private Integer access_duration; | ||||
| 
 | ||||
| 	@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd-mm-yyyy") | ||||
| 	private Date access_till_date; | ||||
| 
 | ||||
| } | ||||
| @ -0,0 +1,25 @@ | ||||
| package com.realnet.Workspaceuser.Repository; | ||||
| 
 | ||||
| import java.util.List; | ||||
| 
 | ||||
| import org.springframework.data.jpa.repository.JpaRepository; | ||||
| import org.springframework.data.jpa.repository.Query; | ||||
| import org.springframework.stereotype.Repository; | ||||
| 
 | ||||
| import com.realnet.Workspaceuser.Entity.Sec_workspace_users; | ||||
| 
 | ||||
| @Repository | ||||
| public interface SecWorkspaceUserRepo extends JpaRepository<Sec_workspace_users, Long> { | ||||
| 
 | ||||
| 	@Query(value = "SELECT * FROM sec_workspace_users WHERE user_id=?1 &&  access_till_date >= NOW();", nativeQuery = true) | ||||
| 	List<Sec_workspace_users> getallbyuserid(Long userId); | ||||
| 
 | ||||
| 	@Query(value = "SELECT * FROM sec_workspace_users WHERE user_id=?1 and project_id=?2", nativeQuery = true) | ||||
| 	Sec_workspace_users getallsecworkspcceuser(Long userid, Integer project_id); | ||||
| 
 | ||||
| 	@Query(value = "SELECT * FROM sec_workspace_users WHERE  project_id=?1", nativeQuery = true) | ||||
| 	List<Sec_workspace_users> getallproject(Integer project_id); | ||||
| 
 | ||||
| 	@Query(value = "SELECT count(*) FROM sec_workspace_users WHERE user_id=?1", nativeQuery = true) | ||||
| 	Object countSharewithme(Long userId); | ||||
| } | ||||
| @ -0,0 +1,20 @@ | ||||
| package com.realnet.Workspaceuser.Repository; | ||||
| 
 | ||||
| import java.util.List; | ||||
| 
 | ||||
| import org.springframework.data.jpa.repository.Query; | ||||
| import org.springframework.data.repository.CrudRepository; | ||||
| import org.springframework.stereotype.Repository; | ||||
| 
 | ||||
| import com.realnet.Workspaceuser.Entity.Sec_team_members; | ||||
| 
 | ||||
| @Repository | ||||
| public interface Sec_team_MemberRepository extends CrudRepository<Sec_team_members, Integer> { | ||||
| 	Sec_team_members	findById(int id); | ||||
| 	 | ||||
| 	@Query(value = "SELECT * FROM sec_team_members a where  a.team_id =?1", nativeQuery = true) | ||||
| 	List<Sec_team_members> getallteam(int team_id); | ||||
| 	@Query(value = "SELECT * FROM sec_team_members a where  a.team_id =?1 and a.member_id=?2", nativeQuery = true) | ||||
| 	Sec_team_members findteammember(int id, Long userId); | ||||
| 	 | ||||
| } | ||||
| @ -0,0 +1,18 @@ | ||||
| package com.realnet.Workspaceuser.Repository; | ||||
| 
 | ||||
| import java.util.List; | ||||
| 
 | ||||
| import org.springframework.data.jpa.repository.Query; | ||||
| import org.springframework.data.repository.CrudRepository; | ||||
| import org.springframework.stereotype.Repository; | ||||
| 
 | ||||
| import com.realnet.Workspaceuser.Entity.Sec_teams; | ||||
| 
 | ||||
| @Repository | ||||
| public interface Sec_teams_Repository extends CrudRepository<Sec_teams, Integer> { | ||||
| 
 | ||||
| 	Sec_teams findById(int id); | ||||
| 
 | ||||
| 	@Query(value = "SELECT * FROM sec_teams where account_id=?1", nativeQuery = true) | ||||
| 	List<Sec_teams> findAllByAccountid(Long accountId); | ||||
| } | ||||
| @ -0,0 +1,22 @@ | ||||
| package com.realnet.Workspaceuser.Repository; | ||||
| 
 | ||||
| import java.util.List; | ||||
| 
 | ||||
| import org.springframework.data.jpa.repository.Query; | ||||
| import org.springframework.data.repository.CrudRepository; | ||||
| import org.springframework.stereotype.Repository; | ||||
| 
 | ||||
| import com.realnet.Workspaceuser.Entity.Sec_workspace; | ||||
| 
 | ||||
| @Repository | ||||
| public interface WorkspaceRepository extends CrudRepository<Sec_workspace, Integer> { | ||||
| 
 | ||||
| 	Sec_workspace findById(int id); | ||||
| 
 | ||||
| 	List<Sec_workspace> findByAccountId(Long accountId); | ||||
| 
 | ||||
| //	List<Sec_workspace> findByProject_id(Integer project_id); | ||||
| 
 | ||||
| 	@Query(value = "SELECT * FROM sec_workspace WHERE  project_id=?1", nativeQuery = true) | ||||
| 	List<Sec_workspace> findByProject_id(Integer project_id); | ||||
| } | ||||
| @ -0,0 +1,50 @@ | ||||
| package com.realnet.Workspaceuser.Service; | ||||
| 
 | ||||
| import java.util.List; | ||||
| 
 | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | ||||
| 
 | ||||
| import com.realnet.Workspaceuser.Entity.Sec_team_members; | ||||
| import com.realnet.Workspaceuser.Entity.Sec_teams; | ||||
| import com.realnet.Workspaceuser.Repository.Sec_team_MemberRepository; | ||||
| 
 | ||||
| @Service | ||||
| public class SecTeam_MemberService { | ||||
| 	 | ||||
| 	@Autowired | ||||
| 	private Sec_team_MemberRepository sec_team_MemberRepository; | ||||
| 
 | ||||
| 	public Sec_team_members create(Sec_team_members rnrule) { | ||||
| 		return sec_team_MemberRepository.save(rnrule); | ||||
| 	} | ||||
| 
 | ||||
| 	 | ||||
| 	public List<Sec_team_members> getall() { | ||||
| 		return (List<Sec_team_members>) sec_team_MemberRepository.findAll(); | ||||
| 	} | ||||
| 
 | ||||
| 	 | ||||
| 	public Sec_team_members getbyid(int id) { | ||||
| 		return sec_team_MemberRepository.findById(id); | ||||
| 	} | ||||
| 
 | ||||
| 
 | ||||
| 	public Sec_team_members updatebyid(Sec_team_members project, int id) { | ||||
| 		Sec_team_members rule = sec_team_MemberRepository.findById(id); | ||||
| 
 | ||||
| //				.orElseThrow(()-> ResourceNotFoundException("rueboard","id",id)); | ||||
| 		rule.setAccess_days(project.getAccess_days()); | ||||
| 		rule.setAccess_start_date(project.getAccess_start_date()); | ||||
| 		rule.setMember_id(project.getMember_id()); | ||||
| 		rule.setTeam_id(project.getTeam_id()); | ||||
| 		 | ||||
| 		return sec_team_MemberRepository.save(rule); | ||||
| 	} | ||||
| 
 | ||||
| 
 | ||||
| 	public void deletebyid(int id) { | ||||
| 		sec_team_MemberRepository.deleteById(id); | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
| @ -0,0 +1,50 @@ | ||||
| package com.realnet.Workspaceuser.Service; | ||||
| 
 | ||||
| import java.util.List; | ||||
| 
 | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | ||||
| 
 | ||||
| import com.realnet.Workspaceuser.Entity.Sec_teams; | ||||
| import com.realnet.Workspaceuser.Repository.Sec_teams_Repository; | ||||
| 
 | ||||
| @Service | ||||
| public class Sec_teamService { | ||||
| 
 | ||||
| 	@Autowired | ||||
| 	private Sec_teams_Repository sec_teams_Repository; | ||||
| 
 | ||||
| 	public Sec_teams create(Sec_teams rnrule) { | ||||
| 		return sec_teams_Repository.save(rnrule); | ||||
| 	} | ||||
| 
 | ||||
| 	public List<Sec_teams> getall() { | ||||
| 		return (List<Sec_teams>) sec_teams_Repository.findAll(); | ||||
| 	} | ||||
| 
 | ||||
| //	get all by accountId | ||||
| 	public List<Sec_teams> getallbyAccountId(Long accountId) { | ||||
| 		return (List<Sec_teams>) sec_teams_Repository.findAllByAccountid(accountId); | ||||
| 	} | ||||
| 
 | ||||
| 	public Sec_teams getbyid(int id) { | ||||
| 		return sec_teams_Repository.findById(id); | ||||
| 	} | ||||
| 
 | ||||
| 	public Sec_teams updatebyid(Sec_teams project, int id) { | ||||
| 		Sec_teams rule = sec_teams_Repository.findById(id); | ||||
| 
 | ||||
| //				.orElseThrow(()-> ResourceNotFoundException("rueboard","id",id)); | ||||
| 		rule.setAccountId(project.getAccountId()); | ||||
| 		rule.setDescription(project.getDescription()); | ||||
| 		rule.setIs_active(project.getIs_active()); | ||||
| 		rule.setName(project.getName()); | ||||
| 
 | ||||
| 		return sec_teams_Repository.save(rule); | ||||
| 	} | ||||
| 
 | ||||
| 	public void deletebyid(int id) { | ||||
| 		sec_teams_Repository.deleteById(id); | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
| @ -0,0 +1,52 @@ | ||||
| package com.realnet.Workspaceuser.Service; | ||||
| 
 | ||||
| import java.util.List; | ||||
| 
 | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | ||||
| import com.realnet.Workspaceuser.Entity.Sec_workspace; | ||||
| import com.realnet.Workspaceuser.Repository.WorkspaceRepository; | ||||
| 
 | ||||
| @Service | ||||
| public class WorkspaceService { | ||||
| 	 | ||||
| 	@Autowired | ||||
| 	private WorkspaceRepository workspaceRepository; | ||||
| 	 | ||||
| 	public Sec_workspace create(Sec_workspace rnrule) { | ||||
| 		return workspaceRepository.save(rnrule); | ||||
| 	} | ||||
| 
 | ||||
| 	 | ||||
| 	public List<Sec_workspace> getall() { | ||||
| 		return (List<Sec_workspace>) workspaceRepository.findAll(); | ||||
| 	} | ||||
| 
 | ||||
| 	 | ||||
| 	public Sec_workspace getbyid(int id) { | ||||
| 		return workspaceRepository.findById(id); | ||||
| 	} | ||||
| 
 | ||||
| 
 | ||||
| 	public Sec_workspace updatebyid(Sec_workspace project, int id) { | ||||
| 		Sec_workspace rule = workspaceRepository.findById(id); | ||||
| 
 | ||||
| //				.orElseThrow(()-> ResourceNotFoundException("rueboard","id",id)); | ||||
| 		rule.setAccountId(project.getAccountId()); | ||||
| //		rule.setDefault_team_id(project.getDefault_team_id()); | ||||
| 		rule.setDescription(project.getDescription()); | ||||
| 		rule.setIs_active(project.getIs_active()); | ||||
| 		rule.setIs_default(project.getIs_default()); | ||||
| 		rule.setName(project.getName()); | ||||
| 		rule.setOwner_id(project.getOwner_id()); | ||||
| 		 | ||||
| 		return workspaceRepository.save(rule); | ||||
| 	} | ||||
| 
 | ||||
| 
 | ||||
| 	public void deletebyid(int id) { | ||||
| 		Sec_workspace save = workspaceRepository.findById(id); | ||||
| 		workspaceRepository.delete(save); | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
| @ -210,8 +210,7 @@ public class UserController { | ||||
| 
 | ||||
| 			String em = user.getEmail(); | ||||
| 			String subject = "Pass reset"; | ||||
| 			String url = "http://" + Port_Constant.LOCAL_HOST + ":" + Port_Constant.FRONTEND_PORT_9191 | ||||
| 					+ "/#/forgotresetpassword/" + token; | ||||
| 			String url = Port_Constant.FRONTEND_PORTAL_DOMAIN + "/#/forgotresetpassword/" + token; | ||||
| 			// String url = "http://surecns.ml:30165/#/forgotresetpassword/" + token; | ||||
| //	    String url = "http://localhost:9191/api" + "/resources/savePassword/" + token; | ||||
| 			emailService.constructEmail(em, subject, url); | ||||
|  | ||||
| @ -30,6 +30,7 @@ import org.springframework.web.bind.annotation.RestController; | ||||
| 
 | ||||
| import com.fasterxml.jackson.core.JsonProcessingException; | ||||
| import com.realnet.config.EmailService; | ||||
| import com.realnet.fnd.response.EntityResponse; | ||||
| import com.realnet.session.Service.TokenBlacklistService; | ||||
| import com.realnet.userDTO.User; | ||||
| import com.realnet.users.entity.PasswordResetRequest; | ||||
| @ -193,25 +194,31 @@ public class AppUserController { | ||||
| 		AppUser loggedInUser = userService.getLoggedInUser(); | ||||
| 		Long account_id = loggedInUser.getAccount().getAccount_id(); | ||||
| 
 | ||||
| 		AppUser appUser = new AppUser(); | ||||
| 
 | ||||
| 		AppUser user = userService.findUserByEmail(email); | ||||
| 		if (user != null) { | ||||
| 		if (user != null && user.isIsComplete()) { | ||||
| 			return ResponseEntity.badRequest().body(new MessageResponse(email + " already exist")); | ||||
| 		} else { | ||||
| 			String token = UUID.randomUUID().toString(); | ||||
| 			AppUser appUser = new AppUser(); | ||||
| 			userService.adduserviaadmin(appUser, token, email, account_id); | ||||
| 		} | ||||
| 
 | ||||
| 			String subject = "add user"; | ||||
| 		if (user != null) { | ||||
| 			appUser = user; | ||||
| 
 | ||||
| 			String url = Port_Constant.FRONTEND_PORTAL_DOMAIN + "/#/adduser/" + token; | ||||
| 			// String url = "http://localhost:4200/#/adduser/" +token; | ||||
| 			// String url = "http://surecns.ml:30165/#/adduser/" +token; | ||||
| 		} | ||||
| 		String token = UUID.randomUUID().toString(); | ||||
| 
 | ||||
| 		userService.adduserviaadmin(appUser, token, email, account_id); | ||||
| 
 | ||||
| 		String subject = "add user"; | ||||
| 
 | ||||
| 		String url = Port_Constant.FRONTEND_PORTAL_DOMAIN + "/#/adduser/" + token; | ||||
| 		// String url = "http://localhost:4200/#/adduser/" +token; | ||||
| 		// String url = "http://surecns.ml:30165/#/adduser/" +token; | ||||
| //				String url = "http://" + Port_Constant.LOCAL_HOST + ":" + Port_Constant.BACKEND_PORT_9191 + "/api" | ||||
| //						+ "/admin/adduser/" + token; | ||||
| 
 | ||||
| 			emailService.sendEmail(email, subject, url); | ||||
| 			return new ResponseEntity<>("Email sent success", HttpStatus.OK); | ||||
| 		} | ||||
| 		emailService.sendEmail(email, subject, url); | ||||
| 		return new ResponseEntity<>(new EntityResponse("Email sent success"), HttpStatus.OK); | ||||
| 
 | ||||
| 	} | ||||
| 
 | ||||
| @ -267,31 +274,36 @@ public class AppUserController { | ||||
| 		AppUser loggedInUser = userService.getLoggedInUser(); | ||||
| 		String fullName = loggedInUser.getFullName(); | ||||
| 		Long account_id = loggedInUser.getAccount().getAccount_id(); | ||||
| 		AppUser appUser = new AppUser(); | ||||
| 
 | ||||
| 		if (email.contains(" ")) { | ||||
| 			// Replace whitespace with '+' | ||||
| 			email = email.replace(" ", "+"); | ||||
| 		} | ||||
| 
 | ||||
| 		AppUser user = userService.findUserByEmail(email); | ||||
| 		if (user != null) { | ||||
| 		if (user != null && user.isIsComplete()) { | ||||
| 			return ResponseEntity.badRequest().body(new MessageResponse(email + " already exist")); | ||||
| 		} else { | ||||
| 			String token = UUID.randomUUID().toString(); | ||||
| 			AppUser appUser = new AppUser(); | ||||
| 			userService.addguestviaadmin(appUser, token, email, account_id); | ||||
| 		} | ||||
| 
 | ||||
| 		if (user != null) { | ||||
| 			appUser = user; | ||||
| 
 | ||||
| 		} | ||||
| 		String token = UUID.randomUUID().toString(); | ||||
| 		userService.addguestviaadmin(appUser, token, email, account_id); | ||||
| 
 | ||||
| //				String subject = "add guest"; | ||||
| 			String url = Port_Constant.FRONTEND_PORTAL_DOMAIN + "/#/addguest/" + token; | ||||
| 		String url = Port_Constant.FRONTEND_PORTAL_DOMAIN + "/#/addguest/" + token; | ||||
| 
 | ||||
| 			// String url = "http://localhost:4200/#/addguest/" +token; | ||||
| 			// String url = "http://surecns.ml:30165/#/addguest/" +token; | ||||
| 		// String url = "http://localhost:4200/#/addguest/" +token; | ||||
| 		// String url = "http://surecns.ml:30165/#/addguest/" +token; | ||||
| //				String url = "http://" + Port_Constant.LOCAL_HOST + ":" + Port_Constant.BACKEND_PORT_9191 + "/api" | ||||
| //						+ "/admin/addguest/" + token; | ||||
| 
 | ||||
| 			String subject = "Guest Registration.."; | ||||
| 			emailService.sendEmail(email, subject, url); | ||||
| 			return new ResponseEntity<>("Email sent success", HttpStatus.OK); | ||||
| 		} | ||||
| 		String subject = "Guest Registration.."; | ||||
| 		emailService.sendEmail(email, subject, url); | ||||
| 		return new ResponseEntity<>(new EntityResponse("Email sent success"), HttpStatus.OK); | ||||
| 
 | ||||
| 	} | ||||
| 
 | ||||
| @ -335,7 +347,5 @@ public class AppUserController { | ||||
| 
 | ||||
| 		return ResponseEntity.ok().body(new MessageResponse("registration already done")); | ||||
| 	} | ||||
| 	 | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
|  | ||||
| @ -1,137 +1,121 @@ | ||||
| //package com.realnet.users.controller1; | ||||
| // | ||||
| //import java.util.List; | ||||
| // | ||||
| //import org.springframework.beans.factory.annotation.Autowired; | ||||
| //import org.springframework.http.HttpStatus; | ||||
| //import org.springframework.http.ResponseEntity; | ||||
| //import org.springframework.web.bind.annotation.DeleteMapping; | ||||
| //import org.springframework.web.bind.annotation.GetMapping; | ||||
| //import org.springframework.web.bind.annotation.PathVariable; | ||||
| //import org.springframework.web.bind.annotation.PostMapping; | ||||
| //import org.springframework.web.bind.annotation.RequestBody; | ||||
| //import org.springframework.web.bind.annotation.RequestMapping; | ||||
| //import org.springframework.web.bind.annotation.RestController; | ||||
| // | ||||
| //import com.realnet.Workspaceuser.Entity.Sec_team_members; | ||||
| //import com.realnet.Workspaceuser.Entity.Sec_teams; | ||||
| //import com.realnet.Workspaceuser.Repository.SecWorkspaceUserRepo; | ||||
| //import com.realnet.Workspaceuser.Repository.Sec_team_MemberRepository; | ||||
| //import com.realnet.Workspaceuser.Repository.Sec_teams_Repository; | ||||
| //import com.realnet.users.entity1.AppUser; | ||||
| //import com.realnet.users.repository1.AppUserRepository; | ||||
| //import com.realnet.users.response.MessageResponse; | ||||
| //import com.realnet.users.service1.AppUserServiceImpl; | ||||
| // | ||||
| //@RestController | ||||
| //@RequestMapping("/User_workSpace") | ||||
| //public class WorkSpaceController1 { | ||||
| //	@Autowired | ||||
| //	private AppUserServiceImpl userService; | ||||
| //	 | ||||
| //	@Autowired | ||||
| //	private AppUserRepository appUserRepository; | ||||
| //	@Autowired | ||||
| //	private Sec_teams_Repository sec_teams_Repository; | ||||
| //	 | ||||
| //	@Autowired | ||||
| //	private Sec_team_MemberRepository memberRepository; | ||||
| //	 | ||||
| //	@Autowired | ||||
| //	private SecWorkspaceUserRepo secWorkspaceUserRepo; | ||||
| // | ||||
| //	//GET ALL USER attach from login id  | ||||
| //	@GetMapping("/GetAll") | ||||
| //	public ResponseEntity<?> getall(){ | ||||
| //		AppUser loggedInUser = userService.getLoggedInUser(); | ||||
| //		Long account_id = loggedInUser.getAccount().getAccount_id(); | ||||
| //		 | ||||
| //		List<AppUser> li = appUserRepository.getall(account_id); | ||||
| //		return new ResponseEntity<>(li,HttpStatus.OK); | ||||
| //	} | ||||
| //	 | ||||
| //	//ADD USER TO SPECIFIC TEAM | ||||
| //	@PostMapping("/add_team/{id}/{userId}") | ||||
| //	public ResponseEntity<?> addteam(@RequestBody Sec_team_members team_mem,  | ||||
| //			@PathVariable int id,@PathVariable Long userId){ | ||||
| //		Sec_team_members members = memberRepository.findteammember(id,userId); | ||||
| //		if(members == null) { | ||||
| //		 | ||||
| //		Sec_teams team = sec_teams_Repository.findById(id); | ||||
| //		if(team != null) { | ||||
| //			 | ||||
| //		AppUser user = appUserRepository.findById(userId).orElseThrow(null); | ||||
| //		 | ||||
| //		team_mem.setTeam_id(team.getId()); | ||||
| //		team_mem.setMember_name(user.getFullName()); | ||||
| //		team_mem.setMember_id(user.getUserId()); | ||||
| //		Sec_team_members save = memberRepository.save(team_mem); | ||||
| //		 | ||||
| //		 | ||||
| //		return new ResponseEntity<>(save, HttpStatus.OK); | ||||
| //		 | ||||
| //		} | ||||
| //		else  | ||||
| //			return ResponseEntity.badRequest().body(new MessageResponse("team not found")); | ||||
| //		} | ||||
| //		else  | ||||
| //			return ResponseEntity.badRequest().body(new MessageResponse("member already added")); | ||||
| //	} | ||||
| //	 | ||||
| //	//REMOVE MEMBER FROM TEAM | ||||
| //	@DeleteMapping("/RemoveMember/{id}/{userId}") | ||||
| //	public MessageResponse removemember(@PathVariable int id,@PathVariable Long userId){ | ||||
| //		Sec_team_members members = memberRepository.findteammember(id,userId); | ||||
| //		if(members != null) { | ||||
| //			memberRepository.delete(members); | ||||
| //			return new MessageResponse("deleted"); | ||||
| //		}else | ||||
| //		 | ||||
| //			return new MessageResponse("member not found"); | ||||
| //	} | ||||
| //	 | ||||
| //	 | ||||
| //	//GET ALL USER ADD BY ADMIN | ||||
| //	@GetMapping("/GetAllUser") | ||||
| //	public ResponseEntity<?> GetUser(){ | ||||
| //		AppUser loggedInUser = userService.getLoggedInUser(); | ||||
| //		Long account_id = loggedInUser.getAccount().getAccount_id(); | ||||
| //		 | ||||
| //		List<AppUser> li = appUserRepository.getalluser(account_id); | ||||
| //		return new ResponseEntity<>(li,HttpStatus.OK); | ||||
| //	} | ||||
| // | ||||
| //	//GET ALL GUEST ADD BY ADMIN | ||||
| //	@GetMapping("/GetAllGuest") | ||||
| //	public ResponseEntity<?> Getguest(){ | ||||
| //		AppUser loggedInUser = userService.getLoggedInUser(); | ||||
| //		Long account_id = loggedInUser.getAccount().getAccount_id(); | ||||
| //		 | ||||
| //		List<AppUser> li = appUserRepository.getallguest(account_id); | ||||
| //		return new ResponseEntity<>(li,HttpStatus.OK); | ||||
| //	} | ||||
| // | ||||
| //	//GET ALL TEAM MEMBER FROM SPECIFIC TEAM | ||||
| //	@GetMapping("/GetAllMember/{team_id}") | ||||
| //	public ResponseEntity<?> GetAllteamMember(@PathVariable int team_id){ | ||||
| //		 | ||||
| //		 | ||||
| //		List<Sec_team_members> li = memberRepository.getallteam(team_id); | ||||
| //		if(li == null) { | ||||
| //			return ResponseEntity.badRequest().body(new MessageResponse("team not found")); | ||||
| //		}else  | ||||
| //			return new ResponseEntity<>(li,HttpStatus.OK);		 | ||||
| //	} | ||||
| //	 | ||||
| //	 | ||||
| // | ||||
| // | ||||
| // | ||||
| // | ||||
| // | ||||
| // | ||||
| // | ||||
| // | ||||
| // | ||||
| // | ||||
| //} | ||||
| package com.realnet.users.controller1; | ||||
| 
 | ||||
| import java.util.List; | ||||
| 
 | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.web.bind.annotation.DeleteMapping; | ||||
| import org.springframework.web.bind.annotation.GetMapping; | ||||
| import org.springframework.web.bind.annotation.PathVariable; | ||||
| import org.springframework.web.bind.annotation.PostMapping; | ||||
| import org.springframework.web.bind.annotation.RequestBody; | ||||
| import org.springframework.web.bind.annotation.RequestMapping; | ||||
| import org.springframework.web.bind.annotation.RestController; | ||||
| 
 | ||||
| import com.realnet.Workspaceuser.Entity.Sec_team_members; | ||||
| import com.realnet.Workspaceuser.Entity.Sec_teams; | ||||
| import com.realnet.Workspaceuser.Repository.SecWorkspaceUserRepo; | ||||
| import com.realnet.Workspaceuser.Repository.Sec_team_MemberRepository; | ||||
| import com.realnet.Workspaceuser.Repository.Sec_teams_Repository; | ||||
| import com.realnet.users.entity1.AppUser; | ||||
| import com.realnet.users.repository1.AppUserRepository; | ||||
| import com.realnet.users.response.MessageResponse; | ||||
| import com.realnet.users.service1.AppUserServiceImpl; | ||||
| 
 | ||||
| @RestController | ||||
| @RequestMapping("/User_workSpace") | ||||
| public class WorkSpaceController1 { | ||||
| 	@Autowired | ||||
| 	private AppUserServiceImpl userService; | ||||
| 
 | ||||
| 	@Autowired | ||||
| 	private AppUserRepository appUserRepository; | ||||
| 	@Autowired | ||||
| 	private Sec_teams_Repository sec_teams_Repository; | ||||
| 
 | ||||
| 	@Autowired | ||||
| 	private Sec_team_MemberRepository memberRepository; | ||||
| 
 | ||||
| 	@Autowired | ||||
| 	private SecWorkspaceUserRepo secWorkspaceUserRepo; | ||||
| 
 | ||||
| 	// GET ALL USER by account id attach from loggedin user | ||||
| 	@GetMapping("/GetAll/AccountId") | ||||
| 	public ResponseEntity<?> getall() { | ||||
| 		AppUser loggedInUser = userService.getLoggedInUser(); | ||||
| 		Long account_id = loggedInUser.getAccount().getAccount_id(); | ||||
| 
 | ||||
| 		List<AppUser> li = appUserRepository.getall(account_id); | ||||
| 		return new ResponseEntity<>(li, HttpStatus.OK); | ||||
| 	} | ||||
| 
 | ||||
| 	// ADD USER TO SPECIFIC TEAM | ||||
| 	@PostMapping("/add_team/{id}/{userId}") | ||||
| 	public ResponseEntity<?> addteam(@RequestBody Sec_team_members team_mem, @PathVariable int id, | ||||
| 			@PathVariable Long userId) { | ||||
| 		Sec_team_members members = memberRepository.findteammember(id, userId); | ||||
| 		if (members == null) { | ||||
| 
 | ||||
| 			Sec_teams team = sec_teams_Repository.findById(id); | ||||
| 			if (team != null) { | ||||
| 
 | ||||
| 				AppUser user = appUserRepository.findById(userId).orElseThrow(null); | ||||
| 
 | ||||
| 				team_mem.setTeam_id(team.getId()); | ||||
| 				team_mem.setMember_name(user.getFullName()); | ||||
| 				team_mem.setMember_id(user.getUserId()); | ||||
| 				Sec_team_members save = memberRepository.save(team_mem); | ||||
| 
 | ||||
| 				return new ResponseEntity<>(save, HttpStatus.OK); | ||||
| 
 | ||||
| 			} else | ||||
| 				return ResponseEntity.badRequest().body(new MessageResponse("team not found")); | ||||
| 		} else | ||||
| 			return ResponseEntity.badRequest().body(new MessageResponse("member already added")); | ||||
| 	} | ||||
| 
 | ||||
| 	// REMOVE MEMBER FROM TEAM | ||||
| 	@DeleteMapping("/RemoveMember/{id}/{userId}") | ||||
| 	public MessageResponse removemember(@PathVariable int id, @PathVariable Long userId) { | ||||
| 		Sec_team_members members = memberRepository.findteammember(id, userId); | ||||
| 		if (members != null) { | ||||
| 			memberRepository.delete(members); | ||||
| 			return new MessageResponse("deleted"); | ||||
| 		} else | ||||
| 
 | ||||
| 			return new MessageResponse("member not found"); | ||||
| 	} | ||||
| 
 | ||||
| 	// GET ALL USER ADD BY ADMIN | ||||
| 	@GetMapping("/GetAllUser") | ||||
| 	public ResponseEntity<?> GetUser() { | ||||
| 		AppUser loggedInUser = userService.getLoggedInUser(); | ||||
| 		Long account_id = loggedInUser.getAccount().getAccount_id(); | ||||
| 
 | ||||
| 		List<AppUser> li = appUserRepository.getalluser(account_id); | ||||
| 		return new ResponseEntity<>(li, HttpStatus.OK); | ||||
| 	} | ||||
| 
 | ||||
| 	// GET ALL GUEST ADD BY ADMIN | ||||
| 	@GetMapping("/GetAllGuest") | ||||
| 	public ResponseEntity<?> Getguest() { | ||||
| 		AppUser loggedInUser = userService.getLoggedInUser(); | ||||
| 		Long account_id = loggedInUser.getAccount().getAccount_id(); | ||||
| 
 | ||||
| 		List<AppUser> li = appUserRepository.getallguest(account_id); | ||||
| 		return new ResponseEntity<>(li, HttpStatus.OK); | ||||
| 	} | ||||
| 
 | ||||
| 	// GET ALL TEAM MEMBER FROM SPECIFIC TEAM | ||||
| 	@GetMapping("/GetAllMember/{team_id}") | ||||
| 	public ResponseEntity<?> GetAllteamMember(@PathVariable int team_id) { | ||||
| 
 | ||||
| 		List<Sec_team_members> li = memberRepository.getallteam(team_id); | ||||
| 		if (li == null) { | ||||
| 			return ResponseEntity.badRequest().body(new MessageResponse("team not found")); | ||||
| 		} else | ||||
| 			return new ResponseEntity<>(li, HttpStatus.OK); | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
|  | ||||
| @ -157,6 +157,8 @@ public class AppUser implements Serializable { | ||||
| 	@Transient | ||||
| 	private StringBuilder totalLogInfo; | ||||
| 
 | ||||
| 	private String tshirtsize; | ||||
| 
 | ||||
| 	@Transient | ||||
| 	@JsonIgnore | ||||
| 	private PasswordResetToken pass; | ||||
|  | ||||
| @ -11,7 +11,7 @@ public class AppUserDto { | ||||
| 	private String shortName; | ||||
| 	private String fullName; | ||||
| 	private String status; | ||||
| 	 | ||||
| 
 | ||||
| 	private String positionCodeId; | ||||
| 	private String departmentCodeId; | ||||
| 	private Long usrGrpId; | ||||
| @ -20,6 +20,6 @@ public class AppUserDto { | ||||
| 	private String notification; | ||||
| 	private Long mob_no; | ||||
| 	private boolean active; | ||||
| 
 | ||||
| 	private String tshirtsize; | ||||
| 
 | ||||
| } | ||||
|  | ||||
| @ -392,6 +392,9 @@ public class AppUserServiceImpl implements UserDetailsService, AppUserService { | ||||
| 			a.setNotification( | ||||
| 					appUserDto.getNotification() != null ? appUserDto.getNotification() : a.getNotification()); | ||||
| 
 | ||||
| 			if (appUserDto.getTshirtsize() != null) { | ||||
| 				a.setTshirtsize(appUserDto.getTshirtsize()); | ||||
| 			} | ||||
| 			a.setMob_no(appUserDto.getMob_no()); | ||||
| 			a.setActive(appUserDto.isActive()); | ||||
| 
 | ||||
| @ -644,6 +647,9 @@ public class AppUserServiceImpl implements UserDetailsService, AppUserService { | ||||
| 		user.setUsername(email); | ||||
| 		user.setEmail(email); | ||||
| 		user.setAccount(accounts); | ||||
| 		if (user.getCreatedate() == null) { | ||||
| 			user.setCreatedate(LocalDateTime.now()); | ||||
| 		} | ||||
| 
 | ||||
| 		appUserRepository.save(user); | ||||
| 
 | ||||
| @ -657,6 +663,9 @@ public class AppUserServiceImpl implements UserDetailsService, AppUserService { | ||||
| 		user.setUsername(email); | ||||
| 		user.setEmail(email); | ||||
| 		user.setAccount(accounts); | ||||
| 		if (user.getCreatedate() == null) { | ||||
| 			user.setCreatedate(LocalDateTime.now()); | ||||
| 		} | ||||
| //		user.setAccess_duration(access_duration); | ||||
| // | ||||
| //		Calendar c = Calendar.getInstance(); | ||||
|  | ||||
| @ -1,15 +1,113 @@ | ||||
| package com.realnet.utils; | ||||
| 
 | ||||
| import javax.annotation.PostConstruct; | ||||
| 
 | ||||
| import org.springframework.beans.factory.annotation.Value; | ||||
| import org.springframework.stereotype.Component; | ||||
| import org.springframework.web.client.RestTemplate; | ||||
| 
 | ||||
| @Component | ||||
| public class Port_Constant { | ||||
| 
 | ||||
| 	public final static String LOCAL_HOST = "43.205.154.152"; | ||||
| 	public final static String FRONTEND_PORT_9191 = "30165"; | ||||
| 	public static String SURE_SETU_DOMAIN = "http://34.198.218.30:30173"; | ||||
| 
 | ||||
| 	public final static String GITEA_IP_ADDRESS = "try.gitea"; | ||||
| 	public final static String GITEA_PORT = "io"; | ||||
| 	public final static String SURE_VAULT_DOMAIN = "http://54.92.243.148:30150"; | ||||
| 	public final static String SUREVAULT_DEPLOYMENT_TYPE = "32"; | ||||
| 	public static String BACKEND_PORTAL_DOMAIN; | ||||
| 	public static String FRONTEND_PORTAL_DOMAIN; | ||||
| 	public static String SUREOPS_DOMAIN; | ||||
| 	public static String JOBPRO_DOMAIN; | ||||
| 	public static String APP_BUILD_DOMAIN; | ||||
| 	public static String SURE_SERVE_DOMAIN; | ||||
| 	public static String SURE_SETU_DOMAIN; | ||||
| 	public static String FARM_SCRIPT_RUNNER_DOMAIN; | ||||
| 	public static String DEPLOYMENT_TYPE; | ||||
| 	public static String FARM_IP_ADDRESS_online; | ||||
| 	public static String CONTROL_CENTRE_PORT; | ||||
| 	public static String CONTROL_CENTRE_MASTER_PORT; | ||||
| 	public static String CONTROL_CENTRE_MASTER_IP; | ||||
| 	public static String LOCALHOST; | ||||
| 	public static String SUREOPS_LOCALHOST; | ||||
| 	public static String APPBUILD_LOCALHOST; | ||||
| 	public static String SURE_VAULT_DOMAIN; | ||||
| 	public static String GITEA_DB_NAME; | ||||
| 	public static String GITEA_DOMAIN; | ||||
| 	public static String GITEA_USERNAME; | ||||
| 	public static String GITEA_URL; | ||||
| 	public static String PROTOCOL; | ||||
| 	public static String SONAR_QUBE_DOMAIN; | ||||
| 	public static String SONAR_QUBE_Username; | ||||
| 
 | ||||
| 	public static String SONAR_QUBE_password; | ||||
| 	public static String DOMAIN; | ||||
| 
 | ||||
| //	SETTER | ||||
| 
 | ||||
| 	private final RestTemplate restTemplate = new RestTemplate(); | ||||
| 
 | ||||
| 	// Type ('dev', 'prod') | ||||
| 	private final String type = "dev"; | ||||
| 
 | ||||
| 	@Value("${BACKEND_PORTAL_DOMAIN}") | ||||
| 	private String backendPortalDomain; | ||||
| 
 | ||||
| 	// @PostConstruct is used to make API calls and initialize the constants for the | ||||
| 	// entire application during startup. | ||||
| 	@PostConstruct | ||||
| 	public void initializeConstantsFromApi() { | ||||
| 
 | ||||
| //        BACKEND_PORTAL_DOMAIN = getUrlFromApi("Backend_portal_domain"); | ||||
| //    	String backendPortalDomain = getBackendPortalUrl(); | ||||
| //        System.out.println("Fetched BACKEND_PORTAL_DOMAIN: " + backendPortalDomain); | ||||
| 
 | ||||
| 		if (backendPortalDomain != null) { | ||||
| 			BACKEND_PORTAL_DOMAIN = backendPortalDomain; | ||||
| 			System.out.println("Fetched BACKEND_PORTAL_DOMAIN from properties file: " + backendPortalDomain); | ||||
| 
 | ||||
| 			FRONTEND_PORTAL_DOMAIN = getUrlFromApi(backendPortalDomain, "Frontend_portal_domain"); | ||||
| 			System.out.println("FRONTEND_PORTAL_DOMAIN: " + FRONTEND_PORTAL_DOMAIN); | ||||
| 			SUREOPS_DOMAIN = getUrlFromApi(backendPortalDomain, "SUREOPS_DOMAIN"); | ||||
| 			JOBPRO_DOMAIN = getUrlFromApi(backendPortalDomain, "JOBPRO_DOMAIN"); | ||||
| 			APP_BUILD_DOMAIN = getUrlFromApi(backendPortalDomain, "APP_BUILD_DOMAIN"); | ||||
| 			SURE_SERVE_DOMAIN = getUrlFromApi(backendPortalDomain, "SURE_SERVE_DOMAIN"); | ||||
| 			SURE_SETU_DOMAIN = getUrlFromApi(backendPortalDomain, "SURE_SETU_DOMAIN"); | ||||
| 			FARM_SCRIPT_RUNNER_DOMAIN = getUrlFromApi(backendPortalDomain, "FARM_SCRIPT_RUNNER_DOMAIN"); | ||||
| 			DEPLOYMENT_TYPE = getUrlFromApi(backendPortalDomain, "DEPLOYMENT_TYPE"); | ||||
| 			FARM_IP_ADDRESS_online = getUrlFromApi(backendPortalDomain, "FARM_IP_ADDRESS_online"); | ||||
| 			CONTROL_CENTRE_PORT = getUrlFromApi(backendPortalDomain, "CONTROL_CENTRE_PORT"); | ||||
| 			CONTROL_CENTRE_MASTER_PORT = getUrlFromApi(backendPortalDomain, "CONTROL_CENTRE_MASTER_PORT"); | ||||
| 			CONTROL_CENTRE_MASTER_IP = getUrlFromApi(backendPortalDomain, "CONTROL_CENTRE_MASTER_IP"); | ||||
| 			LOCALHOST = getUrlFromApi(backendPortalDomain, "Localhost"); | ||||
| 			SUREOPS_LOCALHOST = getUrlFromApi(backendPortalDomain, "SUREOPS_LOCALHOST"); | ||||
| 			APPBUILD_LOCALHOST = getUrlFromApi(backendPortalDomain, "APPBUILD_LOCALHOST"); | ||||
| 			SURE_VAULT_DOMAIN = getUrlFromApi(backendPortalDomain, "SURE_VAULT_DOMAIN"); | ||||
| 			GITEA_DOMAIN = getUrlFromApi(backendPortalDomain, "GITEA_DOMAIN"); | ||||
| 			GITEA_USERNAME = getUrlFromApi(backendPortalDomain, "GITEA_USERNAME"); | ||||
| 
 | ||||
| 			GITEA_URL = getUrlFromApi(backendPortalDomain, "GITEA_URL"); | ||||
| 
 | ||||
| 			GITEA_DB_NAME = getUrlFromApi(backendPortalDomain, "GITEA_DB_NAME"); | ||||
| 
 | ||||
| 			PROTOCOL = getUrlFromApi(backendPortalDomain, "PROTOCOL"); | ||||
| 			SONAR_QUBE_DOMAIN = getUrlFromApi(backendPortalDomain, "SONAR_QUBE_DOMAIN"); | ||||
| 			SONAR_QUBE_Username = getUrlFromApi(backendPortalDomain, "SONAR_QUBE_Username"); | ||||
| 
 | ||||
| 			SONAR_QUBE_password = getUrlFromApi(backendPortalDomain, "SONAR_QUBE_password"); | ||||
| 			DOMAIN = getUrlFromApi(backendPortalDomain, "DOMAIN"); | ||||
| 
 | ||||
| 		} else { | ||||
| 			System.out.println("Error: BACKEND_PORTAL_DOMAIN could not be fetched."); | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	private String getUrlFromApi(String backendPortalDomain, String serviceName) { | ||||
| 		try { | ||||
| 			// Use the provided backendPortalDomain to construct the full URL | ||||
| 			String baseUrl = backendPortalDomain + "/token/HealthCheckup/DeploymentUrl/Deployment_url/"; | ||||
| 			String url = baseUrl + type + "/" + serviceName; | ||||
| 			String Object = restTemplate.getForObject(url, String.class); // Fetch URL from API | ||||
| 
 | ||||
| 			System.out.println(serviceName + " : " + Object); | ||||
| 			return Object; | ||||
| 		} catch (Exception e) { | ||||
| 			System.out.println("Error fetching URL for " + serviceName + ": " + e.getMessage()); | ||||
| 			return null; | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user