build_app

This commit is contained in:
risadmin_prod 2025-03-26 04:51:50 +00:00
parent 6876b18f47
commit d24dbacaf3
10 changed files with 769 additions and 1 deletions

View File

@ -69,6 +69,12 @@ public class BuilderService {
executeDump(true);
// ADD OTHER SERVICE
addCustomMenu( "Formb", "Transcations");
addCustomMenu( "Forma", "Transcations");
addCustomMenu( "Tesrt", "Transcations");

View File

@ -0,0 +1,163 @@
package com.realnet.basicp1.Controllers;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.springframework.web.bind.annotation.CrossOrigin;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.realnet.config.EmailService;
import com.realnet.users.entity1.AppUser;
import com.realnet.users.service1.AppUserServiceImpl;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.data.domain.Pageable;
import org.springframework.beans.factory.annotation.*;
import com.realnet.basicp1.Entity.Forma;
import com.realnet.basicp1.Services.FormaService ;
@RequestMapping(value = "/Forma")
@CrossOrigin("*")
@RestController
public class FormaController {
@Autowired
private FormaService Service;
@Value("${projectPath}")
private String projectPath;
@PostMapping("/Forma")
public Forma Savedata(@RequestBody Forma data) {
Forma save = Service.Savedata(data) ;
System.out.println("data saved..." + save);
return save;
}
@PutMapping("/Forma/{id}")
public Forma update(@RequestBody Forma data,@PathVariable Integer id ) {
Forma update = Service.update(data,id);
System.out.println("data update..." + update);
return update;
}
// get all with pagination
@GetMapping("/Forma/getall/page")
public Page<Forma> getall(@RequestParam(value = "page", required = false) Integer page,
@RequestParam(value = "size", required = false) Integer size) {
Pageable paging = PageRequest.of(page, size);
Page<Forma> get = Service.getAllWithPagination(paging);
return get;
}
@GetMapping("/Forma")
public List<Forma> getdetails() {
List<Forma> get = Service.getdetails();
return get;
}
// get all without authentication
@GetMapping("/token/Forma")
public List<Forma> getallwioutsec() {
List<Forma> get = Service.getdetails();
return get;
}
@GetMapping("/Forma/{id}")
public Forma getdetailsbyId(@PathVariable Integer id ) {
Forma get = Service.getdetailsbyId(id);
return get;
}
@DeleteMapping("/Forma/{id}")
public void delete_by_id(@PathVariable Integer id ) {
Service.delete_by_id(id);
}
}

View File

@ -0,0 +1,115 @@
package com.realnet.basicp1.Controllers;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.springframework.web.bind.annotation.CrossOrigin;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.realnet.config.EmailService;
import com.realnet.users.entity1.AppUser;
import com.realnet.users.service1.AppUserServiceImpl;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.data.domain.Pageable;
import org.springframework.beans.factory.annotation.*;
import com.realnet.basicp1.Entity.Formb;
import com.realnet.basicp1.Services.FormbService ;
@RequestMapping(value = "/Formb")
@CrossOrigin("*")
@RestController
public class FormbController {
@Autowired
private FormbService Service;
@Value("${projectPath}")
private String projectPath;
@PostMapping("/Formb")
public Formb Savedata(@RequestBody Formb data) {
Formb save = Service.Savedata(data) ;
System.out.println("data saved..." + save);
return save;
}
@PutMapping("/Formb/{id}")
public Formb update(@RequestBody Formb data,@PathVariable Integer id ) {
Formb update = Service.update(data,id);
System.out.println("data update..." + update);
return update;
}
// get all with pagination
@GetMapping("/Formb/getall/page")
public Page<Formb> getall(@RequestParam(value = "page", required = false) Integer page,
@RequestParam(value = "size", required = false) Integer size) {
Pageable paging = PageRequest.of(page, size);
Page<Formb> get = Service.getAllWithPagination(paging);
return get;
}
@GetMapping("/Formb")
public List<Formb> getdetails() {
List<Formb> get = Service.getdetails();
return get;
}
// get all without authentication
@GetMapping("/token/Formb")
public List<Formb> getallwioutsec() {
List<Formb> get = Service.getdetails();
return get;
}
@GetMapping("/Formb/{id}")
public Formb getdetailsbyId(@PathVariable Integer id ) {
Formb get = Service.getdetailsbyId(id);
return get;
}
@DeleteMapping("/Formb/{id}")
public void delete_by_id(@PathVariable Integer id ) {
Service.delete_by_id(id);
}
}

View File

@ -0,0 +1,70 @@
package com.realnet.basicp1.Entity;
import lombok.*;
import com.realnet.WhoColumn.Entity.Extension;
import javax.persistence.*;
import java.time.LocalDateTime;
import java.util.*;
@Entity
@Data
public class Forma extends Extension {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String text_field;
private int number_field;
private String phone_number;
@Column(length = 2000)
private String paragraph_field;
private String password_field;
@Transient
private String confirmpassword_field;
@Column(length = 2000)
private String textarea;
private String date_field;
private String datetime_field;
private String email_field;
private boolean toggle_switch;
private String url_field;
}

View File

@ -0,0 +1,42 @@
package com.realnet.basicp1.Entity;
import lombok.*;
import com.realnet.WhoColumn.Entity.Extension;
import javax.persistence.*;
import java.time.LocalDateTime;
import java.util.*;
@Entity
@Data
public class Formb extends Extension {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private double decimal_field;
private int percentage_field;
private String recaptcha;
private String documentgg;
private Long user_id;
private String user_name;
}

View File

@ -0,0 +1,46 @@
package com.realnet.basicp1.Repository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.*;
import com.realnet.basicp1.Entity.Forma;
@Repository
public interface FormaRepository extends JpaRepository<Forma, Integer> {
@Query(value = "select * from forma where created_by=?1", nativeQuery = true)
List<Forma> findAll(Long creayedBy);
@Query(value = "select * from forma where created_by=?1", nativeQuery = true)
Page<Forma> findAll(Pageable page, Long creayedBy);
}

View File

@ -0,0 +1,34 @@
package com.realnet.basicp1.Repository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.*;
import com.realnet.basicp1.Entity.Formb;
@Repository
public interface FormbRepository extends JpaRepository<Formb, Integer> {
@Query(value = "select * from formb where created_by=?1", nativeQuery = true)
List<Formb> findAll(Long creayedBy);
@Query(value = "select * from formb where created_by=?1", nativeQuery = true)
Page<Formb> findAll(Pageable page, Long creayedBy);
}

View File

@ -0,0 +1,174 @@
package com.realnet.basicp1.Services;
import com.realnet.basicp1.Repository.FormaRepository;
import com.realnet.basicp1.Entity.Forma;import java.util.List;
import java.util.ArrayList;
import org.springframework.beans.factory.annotation.Autowired;
import com.realnet.SequenceGenerator.Service.SequenceService;
import com.realnet.Notification.Entity.NotificationService;
import org.springframework.data.domain.Page;
import com.realnet.realm.Entity.Realm;
import com.realnet.realm.Services.RealmService;import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
import com.realnet.users.service1.AppUserServiceImpl;
import org.springframework.http.HttpStatus;
import com.realnet.users.entity1.AppUser;
import org.springframework.stereotype.Service;
@Service
public class FormaService {
@Autowired
private FormaRepository Repository;
@Autowired
private AppUserServiceImpl userService;
@Autowired
private RealmService realmService;
public Forma Savedata(Forma data) {
data.setUpdatedBy(getUser().getUserId());
data.setCreatedBy(getUser().getUserId());
data.setAccountId(getUser().getAccount().getAccount_id());
Forma save = Repository.save(data);
return save;
}
// get all with pagination
public Page<Forma> getAllWithPagination(Pageable page) {
return Repository.findAll(page, getUser().getUserId());
}
public List<Forma> getdetails() {
List<Realm> realm = realmService.findByUserId(getUser().getUserId());
List<Forma> all = Repository.findAll(getUser().getUserId());
return all ; }
public Forma getdetailsbyId(Integer id) {
return Repository.findById(id).get();
}
public void delete_by_id(Integer id) {
Repository.deleteById(id);
}
public Forma update(Forma data,Integer id) {
Forma old = Repository.findById(id).get();
old.setText_field(data.getText_field());
old.setNumber_field(data.getNumber_field());
old.setPhone_number(data.getPhone_number());
old.setParagraph_field(data.getParagraph_field());
old.setPassword_field(data.getPassword_field());
old.setTextarea(data.getTextarea());
old.setDate_field(data.getDate_field());
old.setDatetime_field(data.getDatetime_field());
old.setEmail_field(data.getEmail_field());
old.setToggle_switch (data.isToggle_switch());
old.setUrl_field(data.getUrl_field());
final Forma test = Repository.save(old);
data.setUpdatedBy(getUser().getUserId());
return test;}
public AppUser getUser() {
AppUser user = userService.getLoggedInUser();
return user;
}}

View File

@ -0,0 +1,116 @@
package com.realnet.basicp1.Services;
import com.realnet.basicp1.Repository.FormbRepository;
import com.realnet.basicp1.Entity.Formb;import java.util.List;
import java.util.ArrayList;
import org.springframework.beans.factory.annotation.Autowired;
import com.realnet.SequenceGenerator.Service.SequenceService;
import com.realnet.Notification.Entity.NotificationService;
import org.springframework.data.domain.Page;
import com.realnet.realm.Entity.Realm;
import com.realnet.realm.Services.RealmService;import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
import com.realnet.users.service1.AppUserServiceImpl;
import org.springframework.http.HttpStatus;
import com.realnet.users.entity1.AppUser;
import org.springframework.stereotype.Service;
@Service
public class FormbService {
@Autowired
private FormbRepository Repository;
@Autowired
private AppUserServiceImpl userService;
@Autowired
private RealmService realmService;
@Autowired
private SequenceService documentggsequenceService;
public Formb Savedata(Formb data) {
data.setDocumentgg (documentggsequenceService.GenerateSequence("kk"));
data.setUser_id(getUser().getUserId());
data.setUser_name(getUser().getFullName());
data.setUpdatedBy(getUser().getUserId());
data.setCreatedBy(getUser().getUserId());
data.setAccountId(getUser().getAccount().getAccount_id());
Formb save = Repository.save(data);
return save;
}
// get all with pagination
public Page<Formb> getAllWithPagination(Pageable page) {
return Repository.findAll(page, getUser().getUserId());
}
public List<Formb> getdetails() {
List<Realm> realm = realmService.findByUserId(getUser().getUserId());
List<Formb> all = Repository.findAll(getUser().getUserId());
return all ; }
public Formb getdetailsbyId(Integer id) {
return Repository.findById(id).get();
}
public void delete_by_id(Integer id) {
Repository.deleteById(id);
}
public Formb update(Formb data,Integer id) {
Formb old = Repository.findById(id).get();
old.setDecimal_field(data.getDecimal_field());
old.setPercentage_field(data.getPercentage_field());
old.setRecaptcha(data.getRecaptcha());
old.setDocumentgg(data.getDocumentgg());
final Formb test = Repository.save(old);
data.setUpdatedBy(getUser().getUserId());
return test;}
public AppUser getUser() {
AppUser user = userService.getLoggedInUser();
return user;
}}

View File

@ -1,2 +1,4 @@
CREATE TABLE db.Tesrt(id BIGINT NOT NULL AUTO_INCREMENT, active VARCHAR(400), description VARCHAR(400), name VARCHAR(400), PRIMARY KEY (id));
CREATE TABLE db.Forma(id BIGINT NOT NULL AUTO_INCREMENT, paragraph_field VARCHAR(400), textarea VARCHAR(400), toggle_switch VARCHAR(400), number_field int, text_field VARCHAR(400), datetime_field VARCHAR(400), phone_number VARCHAR(400), password_field VARCHAR(400), date_field Date, email_field VARCHAR(400), url_field VARCHAR(400), PRIMARY KEY (id));
CREATE TABLE db.Formb(id BIGINT NOT NULL AUTO_INCREMENT, documentgg VARCHAR(400), recaptcha VARCHAR(400), percentage_field int, userid_field VARCHAR(400), decimal_field double, PRIMARY KEY (id));