commit
f0f7a76f7c
91
.gitignore
vendored
91
.gitignore
vendored
@ -1,50 +1,47 @@
|
|||||||
# These are some examples of commonly ignored file patterns.
|
*#
|
||||||
# You should customize this list as applicable to your project.
|
*.iml
|
||||||
# Learn more about .gitignore:
|
*.ipr
|
||||||
# https://www.atlassian.com/git/tutorials/saving-changes/gitignore
|
*.iws
|
||||||
|
|
||||||
# Node artifact files
|
|
||||||
node_modules/
|
|
||||||
dist/
|
|
||||||
|
|
||||||
# Compiled Java class files
|
|
||||||
*.class
|
|
||||||
|
|
||||||
# Compiled Python bytecode
|
|
||||||
*.py[cod]
|
|
||||||
|
|
||||||
# Log files
|
|
||||||
*.log
|
|
||||||
|
|
||||||
# Package files
|
|
||||||
*.jar
|
*.jar
|
||||||
|
*.sw?
|
||||||
# Maven
|
*~
|
||||||
target/
|
.#*
|
||||||
dist/
|
.*.md.html
|
||||||
|
|
||||||
# JetBrains IDE
|
|
||||||
.idea/
|
|
||||||
|
|
||||||
# Unit test reports
|
|
||||||
TEST*.xml
|
|
||||||
|
|
||||||
# Generated by MacOS
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
.attach_pid*
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.gradle
|
||||||
|
.idea
|
||||||
|
.metadata
|
||||||
|
.project
|
||||||
|
.recommenders
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.vscode
|
||||||
|
/code
|
||||||
|
MANIFEST.MF
|
||||||
|
_site/
|
||||||
|
activemq-data
|
||||||
|
bin
|
||||||
|
build
|
||||||
|
!/**/src/**/bin
|
||||||
|
!/**/src/**/build
|
||||||
|
build.log
|
||||||
|
dependency-reduced-pom.xml
|
||||||
|
dump.rdb
|
||||||
|
interpolated*.xml
|
||||||
|
lib/
|
||||||
|
manifest.yml
|
||||||
|
out
|
||||||
|
overridedb.*
|
||||||
|
target
|
||||||
|
transaction-logs
|
||||||
|
.flattened-pom.xml
|
||||||
|
secrets.yml
|
||||||
|
src/main/resources/application-local.yml
|
||||||
|
.gradletasknamecache
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
# Generated by Windows
|
mvnw
|
||||||
Thumbs.db
|
mvnw.cmd
|
||||||
|
|
||||||
# Applications
|
|
||||||
*.app
|
|
||||||
*.exe
|
|
||||||
*.war
|
|
||||||
|
|
||||||
# Large media files
|
|
||||||
*.mp4
|
|
||||||
*.tiff
|
|
||||||
*.avi
|
|
||||||
*.flv
|
|
||||||
*.mov
|
|
||||||
*.wmv
|
|
||||||
|
|
||||||
|
85
pom.xml
85
pom.xml
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>3.0.6</version>
|
<version>2.7.5</version>
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>com.iconplus</groupId>
|
<groupId>com.iconplus</groupId>
|
||||||
@ -14,9 +14,73 @@
|
|||||||
<name>smartproc</name>
|
<name>smartproc</name>
|
||||||
<description>Initialisasi Smartproc Framework</description>
|
<description>Initialisasi Smartproc Framework</description>
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>17</java.version>
|
<java.version>11</java.version>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-security</artifactId>
|
||||||
|
<version>2.5.4</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-web</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-config</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security.oauth.boot</groupId>
|
||||||
|
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
|
||||||
|
<version>2.5.2</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-web</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-config</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-web</artifactId>
|
||||||
|
<version>5.3.9.RELEASE</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-config</artifactId>
|
||||||
|
<version>5.3.9.RELEASE</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.zxing</groupId>
|
||||||
|
<artifactId>core</artifactId>
|
||||||
|
<version>3.3.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.zxing</groupId>
|
||||||
|
<artifactId>javase</artifactId>
|
||||||
|
<version>3.3.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
|
<artifactId>jjwt</artifactId>
|
||||||
|
<version>0.9.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.nimbusds</groupId>
|
||||||
|
<artifactId>nimbus-jose-jwt</artifactId>
|
||||||
|
<version>8.19</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||||
@ -29,13 +93,28 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.zipkin.brave</groupId>
|
||||||
|
<artifactId>brave</artifactId>
|
||||||
|
<version>5.16.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.velocity</groupId>
|
||||||
|
<artifactId>velocity-engine-core</artifactId>
|
||||||
|
<version>2.3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
<version>3.12.0</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-devtools</artifactId>
|
<artifactId>spring-boot-devtools</artifactId>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.postgresql</groupId>
|
<groupId>org.postgresql</groupId>
|
||||||
<artifactId>postgresql</artifactId>
|
<artifactId>postgresql</artifactId>
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.iconplus.smartproc.configuration;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.model.projection.UserRoleView;
|
||||||
|
import com.iconplus.smartproc.repository.RolesRepository;
|
||||||
|
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||||
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
|
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class CustomUserDetailsService implements UserDetailsService {
|
||||||
|
|
||||||
|
private final RolesRepository rolesRepository;
|
||||||
|
|
||||||
|
public CustomUserDetailsService(RolesRepository rolesRepository) {
|
||||||
|
this.rolesRepository = rolesRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserDetails loadUserByUsername(String username) {
|
||||||
|
List<SimpleGrantedAuthority> authorities = null;
|
||||||
|
Optional<UserRoleView> userRole = rolesRepository.getUserRoleByUserId(username);
|
||||||
|
if (userRole.isPresent()) {
|
||||||
|
authorities=List.of(new SimpleGrantedAuthority(userRole.get().getRole()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return new org.springframework.security.core.userdetails.User(username, username, authorities);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
package com.iconplus.smartproc.configuration;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.iconplus.smartproc.exception.ErrorResponse;
|
||||||
|
import com.iconplus.smartproc.util.Constants;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.security.access.AccessDeniedException;
|
||||||
|
import org.springframework.security.web.access.AccessDeniedHandler;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Log4j2
|
||||||
|
public class JwtAuthenticationAccessDenied implements AccessDeniedHandler {
|
||||||
|
|
||||||
|
private static final String DEFAULT_CODE = "30000";
|
||||||
|
private static final String DEFAULT_MESSAGE = "Access denied";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, AccessDeniedException e) throws IOException {
|
||||||
|
|
||||||
|
log.error("Access denied, {}", e.getMessage());
|
||||||
|
|
||||||
|
ErrorResponse errorResponse = new ErrorResponse();
|
||||||
|
errorResponse.setCode(DEFAULT_CODE);
|
||||||
|
errorResponse.setTitle(Constants.TITLE_INVALID_NEXT_STEP);
|
||||||
|
errorResponse.setMessage(DEFAULT_MESSAGE);
|
||||||
|
|
||||||
|
httpServletResponse.setStatus(HttpServletResponse.SC_FORBIDDEN);
|
||||||
|
httpServletResponse.setContentType(MediaType.APPLICATION_JSON_VALUE);
|
||||||
|
|
||||||
|
httpServletResponse.getOutputStream()
|
||||||
|
.println(new ObjectMapper().writeValueAsString(errorResponse));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
package com.iconplus.smartproc.configuration;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.iconplus.smartproc.exception.ErrorResponse;
|
||||||
|
import com.iconplus.smartproc.util.Constants;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.security.core.AuthenticationException;
|
||||||
|
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void commence(HttpServletRequest request, HttpServletResponse response,
|
||||||
|
AuthenticationException authException) throws IOException {
|
||||||
|
|
||||||
|
ErrorResponse errorResponse = new ErrorResponse();
|
||||||
|
|
||||||
|
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
|
||||||
|
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
|
||||||
|
|
||||||
|
var exception = (Exception) request.getAttribute("exception");
|
||||||
|
|
||||||
|
String message;
|
||||||
|
|
||||||
|
if (exception != null) {
|
||||||
|
|
||||||
|
if (exception.getCause() != null) {
|
||||||
|
message = exception.getCause().toString() + " " + exception.getMessage();
|
||||||
|
} else {
|
||||||
|
message = exception.getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
errorResponse.setCode(Constants.ERR_CODE_40051);
|
||||||
|
errorResponse.setTitle(Constants.TITLE_INVALID_NEXT_STEP);
|
||||||
|
errorResponse.setMessage(message);
|
||||||
|
response.getOutputStream()
|
||||||
|
.println(new ObjectMapper().writeValueAsString(errorResponse));
|
||||||
|
} else {
|
||||||
|
errorResponse.setCode(Constants.ERR_CODE_80007);
|
||||||
|
errorResponse.setTitle(Constants.TITLE_INVALID_NEXT_STEP);
|
||||||
|
errorResponse.setMessage("Invalid Access Token");
|
||||||
|
response.getOutputStream()
|
||||||
|
.println(new ObjectMapper().writeValueAsString(errorResponse));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,80 @@
|
|||||||
|
package com.iconplus.smartproc.configuration;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.exception.BusinessException;
|
||||||
|
import com.iconplus.smartproc.model.request.PostAccessTokenRequest;
|
||||||
|
import com.iconplus.smartproc.service.authentication.PostCheckAccessTokenService;
|
||||||
|
import io.jsonwebtoken.ExpiredJwtException;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.security.authentication.BadCredentialsException;
|
||||||
|
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||||
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
import org.springframework.web.filter.OncePerRequestFilter;
|
||||||
|
|
||||||
|
import javax.servlet.FilterChain;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class JwtRequestFilter extends OncePerRequestFilter {
|
||||||
|
|
||||||
|
private final JwtTokenUtil jwtTokenUtil;
|
||||||
|
private final PostCheckAccessTokenService postCheckAccessTokenService;
|
||||||
|
|
||||||
|
public JwtRequestFilter(JwtTokenUtil jwtTokenUtil,
|
||||||
|
PostCheckAccessTokenService postCheckAccessTokenService) {
|
||||||
|
this.jwtTokenUtil = jwtTokenUtil;
|
||||||
|
this.postCheckAccessTokenService = postCheckAccessTokenService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
|
||||||
|
throws ServletException, IOException {
|
||||||
|
try {
|
||||||
|
String jwtToken = extractJwtFromRequest(request);
|
||||||
|
if (StringUtils.hasText(jwtToken) && jwtTokenUtil.validateTokenOnly(jwtToken)) {
|
||||||
|
isValidToken(request, jwtToken);
|
||||||
|
UserDetails userDetails = new org.springframework.security.core.userdetails.User(jwtTokenUtil.getUsernameFromToken(jwtToken), "",
|
||||||
|
jwtTokenUtil.getRolesFromToken(jwtToken));
|
||||||
|
|
||||||
|
UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken = new UsernamePasswordAuthenticationToken(
|
||||||
|
userDetails, null, userDetails.getAuthorities());
|
||||||
|
SecurityContextHolder.getContext().setAuthentication(usernamePasswordAuthenticationToken);
|
||||||
|
}
|
||||||
|
} catch(ExpiredJwtException | BadCredentialsException ex)
|
||||||
|
{
|
||||||
|
request.setAttribute("exception", ex);
|
||||||
|
}
|
||||||
|
chain.doFilter(request, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void isValidToken(HttpServletRequest request, String jwtToken) {
|
||||||
|
String requestUrl = request.getRequestURI();
|
||||||
|
String refreshTokenUrl = "/api/authentication/refresh-token";
|
||||||
|
String forgotPasswordUrl = "/api/authentication/forgot-password";
|
||||||
|
if (!org.apache.commons.lang3.StringUtils.equalsAnyIgnoreCase(requestUrl, refreshTokenUrl, forgotPasswordUrl)) {
|
||||||
|
var isValid = isValidAuthenticateToken(jwtToken);
|
||||||
|
if (!isValid) {
|
||||||
|
throw new BusinessException(HttpStatus.UNAUTHORIZED, "Invalid Access Token");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isValidAuthenticateToken(String jwtToken) {
|
||||||
|
return postCheckAccessTokenService.execute(PostAccessTokenRequest.builder()
|
||||||
|
.accessToken(jwtToken)
|
||||||
|
.build()).getIsValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String extractJwtFromRequest(HttpServletRequest request) {
|
||||||
|
String bearerToken = request.getHeader("Authorization");
|
||||||
|
if (StringUtils.hasText(bearerToken) && bearerToken.startsWith("Bearer ")) {
|
||||||
|
return bearerToken.substring(7);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,97 @@
|
|||||||
|
package com.iconplus.smartproc.configuration;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.model.token.TokenContent;
|
||||||
|
import io.jsonwebtoken.*;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.authentication.BadCredentialsException;
|
||||||
|
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||||
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.security.KeyPair;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class JwtTokenUtil implements Serializable {
|
||||||
|
private static final long serialVersionUID = -2550185165626007488L;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private KeyPair keyPair;
|
||||||
|
|
||||||
|
//retrieve expiration date from jwt token
|
||||||
|
public Date getExpirationDateFromToken(String token) {
|
||||||
|
return getClaimFromToken(token, Claims::getExpiration);
|
||||||
|
}
|
||||||
|
public <T> T getClaimFromToken(String token, Function<Claims, T> claimsResolver) {
|
||||||
|
final Claims claims = getAllClaimsFromToken(token);
|
||||||
|
return claimsResolver.apply(claims);
|
||||||
|
}
|
||||||
|
//for retrieveing any information from token we will need the secret key
|
||||||
|
public Claims getAllClaimsFromToken(String token) {
|
||||||
|
return Jwts.parser().setSigningKey(keyPair.getPublic()).parseClaimsJws(token).getBody();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Boolean isTokenExpired(String token) {
|
||||||
|
final Date expiration = getExpirationDateFromToken(token);
|
||||||
|
return expiration.before(new Date());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String generateToken(String username, TokenContent tokenContent, Integer expirationInMs) {
|
||||||
|
Map<String, Object> claims = new HashMap<>();
|
||||||
|
|
||||||
|
claims.put("authorities", tokenContent.getAccessMenu());
|
||||||
|
claims.put("nama", tokenContent.getNama());
|
||||||
|
claims.put("username", tokenContent.getUsername());
|
||||||
|
claims.put("user_id", tokenContent.getUserId());
|
||||||
|
claims.put("roleId", tokenContent.getRoleId());
|
||||||
|
claims.put("role", tokenContent.getRole());
|
||||||
|
claims.put("instansiId", tokenContent.getInstansiId());
|
||||||
|
claims.put("instansi", tokenContent.getInstansi());
|
||||||
|
claims.put("bidangId", tokenContent.getBidangId());
|
||||||
|
claims.put("bidang", tokenContent.getBidang());
|
||||||
|
claims.put("jabatanId", tokenContent.getJabatanId());
|
||||||
|
claims.put("jabatan", tokenContent.getJabatan());
|
||||||
|
|
||||||
|
return doGenerateToken(claims, username, expirationInMs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String doGenerateToken(Map<String, Object> claims, String subject, Integer expirationInMs) {
|
||||||
|
return Jwts.builder().setClaims(claims).setSubject(subject).setIssuedAt(new Date(System.currentTimeMillis()))
|
||||||
|
.setExpiration(new Date(System.currentTimeMillis() + expirationInMs))
|
||||||
|
.signWith(SignatureAlgorithm.RS256, keyPair.getPrivate()).compact();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean validateToken(String token, UserDetails userDetails) {
|
||||||
|
final String username = getUsernameFromToken(token);
|
||||||
|
return (username.equals(userDetails.getUsername()) && !isTokenExpired(token));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean validateTokenOnly(String authToken) {
|
||||||
|
try {
|
||||||
|
Jwts.parser().setSigningKey(keyPair.getPublic()).parseClaimsJws(authToken);
|
||||||
|
return true;
|
||||||
|
} catch (SignatureException | MalformedJwtException | UnsupportedJwtException | IllegalArgumentException ex) {
|
||||||
|
throw new BadCredentialsException("INVALID_CREDENTIALS", ex);
|
||||||
|
} catch (ExpiredJwtException ex) {
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsernameFromToken(String token) {
|
||||||
|
Claims claims = Jwts.parser().setSigningKey(keyPair.getPublic()).parseClaimsJws(token).getBody();
|
||||||
|
return claims.getSubject();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("squid:S4834")
|
||||||
|
public List<SimpleGrantedAuthority> getRolesFromToken(String token) {
|
||||||
|
Claims claims = Jwts.parser().setSigningKey(keyPair.getPublic()).parseClaimsJws(token).getBody();
|
||||||
|
List<SimpleGrantedAuthority> authorityList = new ArrayList<>();
|
||||||
|
ArrayList<String> authorities = claims.get("authorities", ArrayList.class);
|
||||||
|
authorities.forEach(c-> authorityList.add(new SimpleGrantedAuthority(c)));
|
||||||
|
return authorityList;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package com.iconplus.smartproc.configuration;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.util.RSAUtil;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
import java.security.KeyPair;
|
||||||
|
import java.security.PrivateKey;
|
||||||
|
import java.security.PublicKey;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class KeyConfiguration {
|
||||||
|
|
||||||
|
@Value("${jwt.private-key}")
|
||||||
|
private String privateKey;
|
||||||
|
|
||||||
|
@Value("${jwt.public-key}")
|
||||||
|
private String publicKey;
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public KeyPair keypairBean() {
|
||||||
|
|
||||||
|
PublicKey pubKey = RSAUtil.getPublicKey(publicKey);
|
||||||
|
PrivateKey privKey = RSAUtil.getPrivateKey(privateKey);
|
||||||
|
|
||||||
|
return new KeyPair(pubKey, privKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package com.iconplus.smartproc.configuration;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
|
||||||
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||||
|
import org.springframework.security.config.annotation.web.builders.WebSecurity;
|
||||||
|
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||||
|
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||||
|
import org.springframework.security.config.http.SessionCreationPolicy;
|
||||||
|
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
||||||
|
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@EnableWebSecurity
|
||||||
|
@EnableGlobalMethodSecurity(prePostEnabled = true)
|
||||||
|
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private JwtAuthenticationEntryPoint jwtAuthenticationEntryPoint;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private JwtAuthenticationAccessDenied jwtAuthenticationAccessDenied;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private JwtRequestFilter jwtRequestFilter;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configure(HttpSecurity httpSecurity) throws Exception {
|
||||||
|
httpSecurity
|
||||||
|
.sessionManagement()
|
||||||
|
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
|
||||||
|
.sessionFixation().none().and()
|
||||||
|
.csrf().disable();
|
||||||
|
httpSecurity.authorizeRequests()
|
||||||
|
.antMatchers("/api*/**").permitAll()
|
||||||
|
.antMatchers("/api/authentication/*").permitAll()
|
||||||
|
.antMatchers("/actuator/health").permitAll()
|
||||||
|
.antMatchers("/swagger*/**").permitAll()
|
||||||
|
.antMatchers("/v2*/**").permitAll()
|
||||||
|
.antMatchers("/token/jwks.json").permitAll()
|
||||||
|
.anyRequest().authenticated().and()
|
||||||
|
.exceptionHandling().authenticationEntryPoint(jwtAuthenticationEntryPoint)
|
||||||
|
.accessDeniedHandler(jwtAuthenticationAccessDenied);
|
||||||
|
httpSecurity.addFilterBefore(jwtRequestFilter, UsernamePasswordAuthenticationFilter.class);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configure(WebSecurity web) throws Exception {
|
||||||
|
web.ignoring().antMatchers("/v2/api-docs",
|
||||||
|
"/configuration/ui",
|
||||||
|
"/swagger-resources/**",
|
||||||
|
"/configuration/security",
|
||||||
|
"/swagger-ui.html",
|
||||||
|
"/webjars/**");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,114 @@
|
|||||||
|
package com.iconplus.smartproc.controller;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.model.EmptyRequest;
|
||||||
|
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
|
import com.iconplus.smartproc.model.request.DrpApprovalRequest;
|
||||||
|
import com.iconplus.smartproc.model.request.DrpRekomendasiRequest;
|
||||||
|
import com.iconplus.smartproc.model.request.ListDrpApprovalRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.*;
|
||||||
|
import com.iconplus.smartproc.service.approval.*;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@CrossOrigin(origins = "${fe.server}", allowCredentials = "true")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/drp/approval")
|
||||||
|
public class ApprovalDrpController {
|
||||||
|
|
||||||
|
private GetListUserVpService getListUserVpService;
|
||||||
|
private GetListUserDirekturKomiteService getListUserDirekturKomiteService;
|
||||||
|
private PostCreateDrpApprovalService postCreateDrpApprovalService;
|
||||||
|
private GetListApprovalDrpServie getListApprovalDrpServie;
|
||||||
|
private PostDrpRekomendasiService postDrpRekomendasiService;
|
||||||
|
private PostDrpApprovalExecutionService postDrpApprovalExecutionService;
|
||||||
|
private GetApprovalService getApprovalService;
|
||||||
|
private GetListRekomendasiService getListRekomendasiService;
|
||||||
|
private GetHistoryApprovalService getHistoryApprovalService;
|
||||||
|
public ApprovalDrpController(GetListUserVpService getListUserVpService,
|
||||||
|
GetListUserDirekturKomiteService getListUserDirekturKomiteService,
|
||||||
|
PostCreateDrpApprovalService postCreateDrpApprovalService,
|
||||||
|
GetListApprovalDrpServie getListApprovalDrpServie,
|
||||||
|
PostDrpRekomendasiService postDrpRekomendasiService,
|
||||||
|
PostDrpApprovalExecutionService postDrpApprovalExecutionService,
|
||||||
|
GetApprovalService getApprovalService,
|
||||||
|
GetListRekomendasiService getListRekomendasiService,
|
||||||
|
GetHistoryApprovalService getHistoryApprovalService) {
|
||||||
|
this.getListUserVpService = getListUserVpService;
|
||||||
|
this.getListUserDirekturKomiteService = getListUserDirekturKomiteService;
|
||||||
|
this.postCreateDrpApprovalService = postCreateDrpApprovalService;
|
||||||
|
this.getListApprovalDrpServie = getListApprovalDrpServie;
|
||||||
|
this.postDrpRekomendasiService = postDrpRekomendasiService;
|
||||||
|
this.postDrpApprovalExecutionService = postDrpApprovalExecutionService;
|
||||||
|
this.getApprovalService = getApprovalService;
|
||||||
|
this.getListRekomendasiService = getListRekomendasiService;
|
||||||
|
this.getHistoryApprovalService = getHistoryApprovalService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/vp")
|
||||||
|
public GetListUserApprovalResponse getUserVp(EmptyRequest emptyRequest) {
|
||||||
|
return getListUserVpService.execute(emptyRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("direktur-komite")
|
||||||
|
public GetListUserApprovalResponse getUserDirekturKomite(EmptyRequest emptyRequest) {
|
||||||
|
return getListUserDirekturKomiteService.execute(emptyRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public EmptyResponse createDrpHasApproval(@RequestBody ListDrpApprovalRequest listDrpApprovalRequest) {
|
||||||
|
return postCreateDrpApprovalService.execute(listDrpApprovalRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public GetListDrpApprovalResponse getListDrpApprovalResponse(@RequestParam(name = "search", required = false) String search,
|
||||||
|
@RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||||
|
@RequestParam(name = "size", defaultValue = "5") Integer size) {
|
||||||
|
|
||||||
|
Pageable pageable = PageRequest.of((page - 1), size);
|
||||||
|
DrpApprovalRequest drpApprovalRequest = DrpApprovalRequest.builder()
|
||||||
|
.search(search)
|
||||||
|
.pageable(pageable)
|
||||||
|
.build();
|
||||||
|
return getListApprovalDrpServie.execute(drpApprovalRequest);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/rekomendasi")
|
||||||
|
public DrpRekomendasiResponse drpRekomendasiResponse(@RequestBody DrpRekomendasiRequest drpRekomendasiRequest) {
|
||||||
|
return postDrpRekomendasiService.execute(drpRekomendasiRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/execution")
|
||||||
|
public EmptyResponse drpApprovalExecution(@RequestBody DrpApprovalRequest drpApprovalRequest) {
|
||||||
|
return postDrpApprovalExecutionService.execute(drpApprovalRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/jenis-pengadaan/{id}")
|
||||||
|
public DrpApprovalResponse getDrpApproval(@PathVariable(name = "id") Long id) {
|
||||||
|
return getApprovalService.execute(DrpApprovalRequest.builder()
|
||||||
|
.jenisPengadaanId(id)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/rekomendasi/jenis-pengadaan/{id}")
|
||||||
|
public GetListDrpRekomendasiResponse getListRekomendasi(@PathVariable(name = "id") Long id,
|
||||||
|
@RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||||
|
@RequestParam(name = "size", defaultValue = "5") Integer size) {
|
||||||
|
|
||||||
|
Pageable pageable = PageRequest.of((page - 1), size);
|
||||||
|
DrpRekomendasiRequest drpRekomendasiRequest = DrpRekomendasiRequest.builder()
|
||||||
|
.jenisPengadaanId(id)
|
||||||
|
.pageable(pageable)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
return getListRekomendasiService.execute(drpRekomendasiRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}/history")
|
||||||
|
public GetListDrpApprovalHistoryResponse getListDrpApprovalResponse(@PathVariable(name = "id") Long id) {
|
||||||
|
return getHistoryApprovalService.execute(DrpApprovalRequest.builder()
|
||||||
|
.drpId(id)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,83 @@
|
|||||||
|
package com.iconplus.smartproc.controller;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.exception.BusinessException;
|
||||||
|
import com.iconplus.smartproc.helper.model.EmptyRequest;
|
||||||
|
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
|
import com.iconplus.smartproc.model.request.*;
|
||||||
|
import com.iconplus.smartproc.model.response.GlobalResponse;
|
||||||
|
import com.iconplus.smartproc.model.response.InitForgotPasswordResponse;
|
||||||
|
import com.iconplus.smartproc.model.response.RefreshTokenResponse;
|
||||||
|
import com.iconplus.smartproc.service.authentication.*;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@CrossOrigin(origins = "${fe.server}", allowCredentials = "true")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/authentication")
|
||||||
|
public class AuthenticationController {
|
||||||
|
|
||||||
|
private final LoginService loginService;
|
||||||
|
private final TokenManagementService tokenManagementService;
|
||||||
|
private final LogoutService logoutService;
|
||||||
|
private final ChangePasswordService changePasswordService;
|
||||||
|
private final ForgotPasswordService forgotPasswordService;
|
||||||
|
private final InitForgotPasswordService initForgotPasswordService;
|
||||||
|
|
||||||
|
public AuthenticationController(LoginService loginService,
|
||||||
|
TokenManagementService tokenManagementService,
|
||||||
|
LogoutService logoutService,
|
||||||
|
ChangePasswordService changePasswordService,
|
||||||
|
ForgotPasswordService forgotPasswordService,
|
||||||
|
InitForgotPasswordService initForgotPasswordService) {
|
||||||
|
this.loginService = loginService;
|
||||||
|
this.tokenManagementService = tokenManagementService;
|
||||||
|
this.logoutService = logoutService;
|
||||||
|
this.changePasswordService = changePasswordService;
|
||||||
|
this.forgotPasswordService = forgotPasswordService;
|
||||||
|
this.initForgotPasswordService = initForgotPasswordService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/login")
|
||||||
|
public GlobalResponse getLoginResponse(@RequestBody LoginRequest loginRequest) {
|
||||||
|
try {
|
||||||
|
var loginResponse = loginService.execute(loginRequest);
|
||||||
|
return GlobalResponse.builder()
|
||||||
|
.isOk(true)
|
||||||
|
.message("Succes")
|
||||||
|
.data(loginResponse)
|
||||||
|
.build();
|
||||||
|
} catch (BusinessException exception) {
|
||||||
|
return GlobalResponse.builder()
|
||||||
|
.isOk(false)
|
||||||
|
.message(exception.getErrorMessage())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/refresh-token")
|
||||||
|
public RefreshTokenResponse getRefreshToken(@RequestBody RefreshTokenRequest refreshTokenRequest) {
|
||||||
|
return tokenManagementService.execute(refreshTokenRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/logout")
|
||||||
|
public EmptyResponse logoutUser(EmptyRequest request) {
|
||||||
|
return logoutService.execute(request);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/change-password")
|
||||||
|
public EmptyResponse changePassword(@RequestBody ChangePasswordRequest changePasswordRequest) {
|
||||||
|
return changePasswordService.execute(changePasswordRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/forgot-password")
|
||||||
|
public EmptyResponse forgotPassword(@RequestBody ForgotPasswordRequest forgotPasswordRequest) {
|
||||||
|
return forgotPasswordService.execute(forgotPasswordRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/init/forgot-password")
|
||||||
|
public InitForgotPasswordResponse initForgotPassword(@RequestBody InitForgotPasswordRequest initForgotPasswordRequest) {
|
||||||
|
return initForgotPasswordService.execute(initForgotPasswordRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,74 @@
|
|||||||
|
package com.iconplus.smartproc.controller;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
|
import com.iconplus.smartproc.model.request.BidangRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.BidangResponse;
|
||||||
|
import com.iconplus.smartproc.model.response.GetListBidangResponse;
|
||||||
|
import com.iconplus.smartproc.service.bidang.*;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@CrossOrigin(origins = "${fe.server}", allowCredentials = "true")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/bidang")
|
||||||
|
public class BidangController {
|
||||||
|
|
||||||
|
private GetBidangService getBidangService;
|
||||||
|
private DeleteBidangService deleteBidangService;
|
||||||
|
private GetListBidangService getListBidangService;
|
||||||
|
private PostCreateBidangService postCreateBidangService;
|
||||||
|
private PutUpdateBidangService putUpdateBidangService;
|
||||||
|
|
||||||
|
public BidangController(GetBidangService getBidangService,
|
||||||
|
DeleteBidangService deleteBidangService,
|
||||||
|
GetListBidangService getListBidangService,
|
||||||
|
PostCreateBidangService postCreateBidangService,
|
||||||
|
PutUpdateBidangService putUpdateBidangService) {
|
||||||
|
this.getBidangService = getBidangService;
|
||||||
|
this.deleteBidangService = deleteBidangService;
|
||||||
|
this.getListBidangService = getListBidangService;
|
||||||
|
this.postCreateBidangService = postCreateBidangService;
|
||||||
|
this.putUpdateBidangService = putUpdateBidangService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public GetListBidangResponse getListInstansi(@RequestParam(name = "search", required = false) String search,
|
||||||
|
@RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||||
|
@RequestParam(name = "size", defaultValue = "5") Integer size){
|
||||||
|
|
||||||
|
Pageable pageable = PageRequest.of((page - 1), size);
|
||||||
|
BidangRequest bidangRequest = BidangRequest.builder()
|
||||||
|
.search(search)
|
||||||
|
.pageable(pageable)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
return getListBidangService.execute(bidangRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public BidangResponse createBidang(@RequestBody BidangRequest request) {
|
||||||
|
return postCreateBidangService.execute(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public BidangResponse getBidangById(@PathVariable Long id) {
|
||||||
|
return getBidangService.execute(BidangRequest.builder()
|
||||||
|
.id(id)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
public BidangResponse updateBidang(@PathVariable Long id, @RequestBody BidangRequest request){
|
||||||
|
request.setId(id);
|
||||||
|
return putUpdateBidangService.execute(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public EmptyResponse deleteBidang(@PathVariable Long id){
|
||||||
|
return deleteBidangService.execute(BidangRequest.builder()
|
||||||
|
.id(id)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,122 @@
|
|||||||
|
package com.iconplus.smartproc.controller;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
|
import com.iconplus.smartproc.model.request.DrpDokumenRequest;
|
||||||
|
import com.iconplus.smartproc.model.request.DrpRekomendasiRequest;
|
||||||
|
import com.iconplus.smartproc.model.request.DrpRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.*;
|
||||||
|
import com.iconplus.smartproc.service.drp.*;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@CrossOrigin(origins = "${fe.server}", allowCredentials = "true")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/drp")
|
||||||
|
public class DrpController {
|
||||||
|
|
||||||
|
private final GetDrpService getDrpService;
|
||||||
|
private final GetListDrpService getListDrpService;
|
||||||
|
private final PostDrpUploadDokumenRKAPService postDrpUploadDokumenRKAPService;
|
||||||
|
private final PostCreateTahunDrpService postCreateTahunDrpService;
|
||||||
|
private final DeleteDokumenUploadService deleteDokumenUploadService;
|
||||||
|
private final PostCreateDrpService postCreateDrpService;
|
||||||
|
private final EditUploadDokumenDrpService editUploadDokumenDrpService;
|
||||||
|
private final GetListDrpRekomendasiService getListDrpRekomendasiService;
|
||||||
|
|
||||||
|
public DrpController(GetDrpService getDrpService,
|
||||||
|
GetListDrpService getListDrpService,
|
||||||
|
PostDrpUploadDokumenRKAPService postDrpUploadDokumenRKAPService,
|
||||||
|
PostCreateTahunDrpService postCreateTahunDrpService,
|
||||||
|
DeleteDokumenUploadService deleteDokumenUploadService,
|
||||||
|
PostCreateDrpService postCreateDrpService,
|
||||||
|
EditUploadDokumenDrpService editUploadDokumenDrpService,
|
||||||
|
GetListDrpRekomendasiService getListDrpRekomendasiService) {
|
||||||
|
this.getDrpService = getDrpService;
|
||||||
|
this.getListDrpService = getListDrpService;
|
||||||
|
this.postDrpUploadDokumenRKAPService = postDrpUploadDokumenRKAPService;
|
||||||
|
this.postCreateTahunDrpService = postCreateTahunDrpService;
|
||||||
|
this.deleteDokumenUploadService = deleteDokumenUploadService;
|
||||||
|
this.postCreateDrpService = postCreateDrpService;
|
||||||
|
this.editUploadDokumenDrpService = editUploadDokumenDrpService;
|
||||||
|
this.getListDrpRekomendasiService = getListDrpRekomendasiService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public GetListDrpResponse getListDrp(@RequestParam(name = "search", required = false) String search,
|
||||||
|
@RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||||
|
@RequestParam(name = "size", defaultValue = "5") Integer size){
|
||||||
|
|
||||||
|
Pageable pageable = PageRequest.of((page - 1), size);
|
||||||
|
DrpRequest drpRequest = DrpRequest.builder()
|
||||||
|
.search(search)
|
||||||
|
.pageable(pageable)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
return getListDrpService.execute(drpRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public DrpResponse getDrp(@PathVariable Long id) {
|
||||||
|
return getDrpService.execute(DrpRequest.builder()
|
||||||
|
.id(id)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/tahun")
|
||||||
|
public DrpResponse createTahunDrp(@RequestBody DrpRequest drpRequest) {
|
||||||
|
return postCreateTahunDrpService.execute(drpRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public DrpResponse createDrp(@RequestBody DrpRequest drpRequest) {
|
||||||
|
return postCreateDrpService.execute(drpRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/upload/dokumen")
|
||||||
|
public DrpDokumenResponse uploadDokumenRkap(@RequestParam(name = "jenisDokumenId") Long jenisDokumenId,
|
||||||
|
@RequestParam(name = "keterangan") String keterangan,
|
||||||
|
@RequestParam(name = "file") MultipartFile file) throws IOException {
|
||||||
|
return postDrpUploadDokumenRKAPService.execute(DrpDokumenRequest.builder()
|
||||||
|
.jenisDokumenId(jenisDokumenId)
|
||||||
|
.keterangan(keterangan)
|
||||||
|
.file(file)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/upload/dokumen")
|
||||||
|
public EmptyResponse deleteDokumenRkap(@RequestBody DrpDokumenRequest drpDokumenRequest) {
|
||||||
|
return deleteDokumenUploadService.execute(drpDokumenRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/upload/dokumen")
|
||||||
|
public DrpDokumenResponse editUploadDrpDokumen(@RequestParam(name = "filename") String filename,
|
||||||
|
@RequestParam(name = "jenisDokumenId") Long jenisDokumenId,
|
||||||
|
@RequestParam(name = "keterangan") String keterangan,
|
||||||
|
@RequestParam(name = "file") MultipartFile file) {
|
||||||
|
return editUploadDokumenDrpService.execute(DrpDokumenRequest.builder()
|
||||||
|
.filename(filename)
|
||||||
|
.jenisDokumenId(jenisDokumenId)
|
||||||
|
.keterangan(keterangan)
|
||||||
|
.file(file)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}/rekomendasi")
|
||||||
|
public GetListDrpRekomendasiResponse getListDrpRekomendasiResponse(@PathVariable(name = "id") Long id,
|
||||||
|
@RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||||
|
@RequestParam(name = "size", defaultValue = "5") Integer size) {
|
||||||
|
Pageable pageable = PageRequest.of((page - 1), size);
|
||||||
|
DrpRekomendasiRequest drpRekomendasiRequest = DrpRekomendasiRequest.builder()
|
||||||
|
.drpId(id)
|
||||||
|
.pageable(pageable)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
return getListDrpRekomendasiService.execute(drpRekomendasiRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,113 @@
|
|||||||
|
package com.iconplus.smartproc.controller;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
|
import com.iconplus.smartproc.model.request.DrpPengadaanDokumenRequest;
|
||||||
|
import com.iconplus.smartproc.model.request.DrpPengadaanRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.*;
|
||||||
|
import com.iconplus.smartproc.service.drppengadaan.*;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@CrossOrigin(origins = "${fe.server}", allowCredentials = "true")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/drp/pengadaan")
|
||||||
|
public class DrpPengadaanController {
|
||||||
|
|
||||||
|
private final PostCreateDrpPengadaanService postCreateDrpPengadaanService;
|
||||||
|
private final GetListDrpPengadaanService getListDrpPengadaanService;
|
||||||
|
private final PostDrpUploadDokumenPendukungService postDrpUploadDokumenPendukungService;
|
||||||
|
private final DeleteDrpPengadaanService deleteDrpPengadaanService;
|
||||||
|
private final DeleteDokumenPendukungService deleteDokumenPendukungService;
|
||||||
|
private final EditUploadDrpPengadaanService editUploadDrpPengadaanService;
|
||||||
|
private final GetDrpPengadaanService getDrpPengadaanService;
|
||||||
|
private final PutDrpPengadaanService putDrpPengadaanService;
|
||||||
|
|
||||||
|
public DrpPengadaanController(PostCreateDrpPengadaanService postCreateDrpPengadaanService,
|
||||||
|
GetListDrpPengadaanService getListDrpPengadaanService,
|
||||||
|
PostDrpUploadDokumenPendukungService postDrpUploadDokumenPendukungService,
|
||||||
|
DeleteDrpPengadaanService deleteDrpPengadaanService,
|
||||||
|
DeleteDokumenPendukungService deleteDokumenPendukungService,
|
||||||
|
EditUploadDrpPengadaanService editUploadDrpPengadaanService,
|
||||||
|
GetDrpPengadaanService getDrpPengadaanService,
|
||||||
|
PutDrpPengadaanService putDrpPengadaanService) {
|
||||||
|
this.postCreateDrpPengadaanService = postCreateDrpPengadaanService;
|
||||||
|
this.getListDrpPengadaanService = getListDrpPengadaanService;
|
||||||
|
this.postDrpUploadDokumenPendukungService = postDrpUploadDokumenPendukungService;
|
||||||
|
this.deleteDrpPengadaanService = deleteDrpPengadaanService;
|
||||||
|
this.deleteDokumenPendukungService = deleteDokumenPendukungService;
|
||||||
|
this.editUploadDrpPengadaanService = editUploadDrpPengadaanService;
|
||||||
|
this.getDrpPengadaanService = getDrpPengadaanService;
|
||||||
|
this.putDrpPengadaanService = putDrpPengadaanService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list/{id}")
|
||||||
|
public GetListDrpPengadaanResponse getDrpPengadaan(@PathVariable(name = "id") Long drpId,
|
||||||
|
@RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||||
|
@RequestParam(name = "size", defaultValue = "5") Integer size){
|
||||||
|
|
||||||
|
Pageable pageable = PageRequest.of((page - 1), size);
|
||||||
|
DrpPengadaanRequest drpPengadaanRequest = DrpPengadaanRequest.builder()
|
||||||
|
.drpId(drpId)
|
||||||
|
.pageable(pageable)
|
||||||
|
.build();
|
||||||
|
return getListDrpPengadaanService.execute(drpPengadaanRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public DrpPengadaanResponse createDrpPengadaan(@RequestBody DrpPengadaanRequest drpPengadaanRequest) {
|
||||||
|
return postCreateDrpPengadaanService.execute(drpPengadaanRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public DrpPengadaanResponse getDrpPengadaanById(@PathVariable Long id) {
|
||||||
|
return getDrpPengadaanService.execute(DrpPengadaanRequest.builder()
|
||||||
|
.id(id)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
public DrpPengadaanResponse updateDrpPengadaan(@PathVariable Long id,
|
||||||
|
@RequestBody DrpPengadaanRequest drpPengadaanRequest) throws IOException {
|
||||||
|
drpPengadaanRequest.setId(id);
|
||||||
|
return putDrpPengadaanService.execute(drpPengadaanRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public EmptyResponse deleteDrpPengadaan(@RequestBody DrpPengadaanRequest drpPengadaanRequest) {
|
||||||
|
return deleteDrpPengadaanService.execute(drpPengadaanRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/upload/dokumen")
|
||||||
|
public DrpPengadaanDokumenResponse uploadDokumenPendukung(@RequestParam(name = "jenisDokumenId") Long jenisDokumenId,
|
||||||
|
@RequestParam(name = "keterangan") String keterangan,
|
||||||
|
@RequestParam(name = "file") MultipartFile file) throws IOException {
|
||||||
|
return postDrpUploadDokumenPendukungService.execute(DrpPengadaanDokumenRequest.builder()
|
||||||
|
.jenisDokumenId(jenisDokumenId)
|
||||||
|
.keterangan(keterangan)
|
||||||
|
.file(file)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/upload/dokumen")
|
||||||
|
public DrpPengadaanDokumenResponse editUploadDrpDokumen(@RequestParam(name = "filename") String filename,
|
||||||
|
@RequestParam(name = "jenisDokumenId") Long jenisDokumenId,
|
||||||
|
@RequestParam(name = "keterangan") String keterangan,
|
||||||
|
@RequestParam(name = "file") MultipartFile file) {
|
||||||
|
return editUploadDrpPengadaanService.execute(DrpPengadaanDokumenRequest.builder()
|
||||||
|
.filename(filename)
|
||||||
|
.jenisDokumenId(jenisDokumenId)
|
||||||
|
.keterangan(keterangan)
|
||||||
|
.file(file)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/upload/dokumen")
|
||||||
|
public EmptyResponse deleteDokumenPendukung(@RequestBody DrpPengadaanDokumenRequest drpPengadaanDokumenRequest) {
|
||||||
|
return deleteDokumenPendukungService.execute(drpPengadaanDokumenRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,74 @@
|
|||||||
|
package com.iconplus.smartproc.controller;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
|
import com.iconplus.smartproc.model.request.InstansiRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.GetListInstansiResponse;
|
||||||
|
import com.iconplus.smartproc.model.response.InstansiResponse;
|
||||||
|
import com.iconplus.smartproc.service.instansi.*;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@CrossOrigin(origins = "${fe.server}", allowCredentials = "true")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/instansi")
|
||||||
|
public class InstansiController {
|
||||||
|
|
||||||
|
private final GetListInstansiService getListInstansiService;
|
||||||
|
private final PostCreateInstansiService postCreateInstansiService;
|
||||||
|
private final PutUpdateInstansiService putUpdateInstansiService;
|
||||||
|
private final GetInstansiByIdService getInstansiByIdService;
|
||||||
|
private final DeleteInstansiService deleteInstansiService;
|
||||||
|
|
||||||
|
public InstansiController(GetListInstansiService getListInstansiService,
|
||||||
|
PostCreateInstansiService postCreateInstansiService,
|
||||||
|
PutUpdateInstansiService putUpdateInstansiService,
|
||||||
|
GetInstansiByIdService getInstansiByIdService,
|
||||||
|
DeleteInstansiService deleteInstansiService) {
|
||||||
|
this.getListInstansiService = getListInstansiService;
|
||||||
|
this.postCreateInstansiService = postCreateInstansiService;
|
||||||
|
this.putUpdateInstansiService = putUpdateInstansiService;
|
||||||
|
this.getInstansiByIdService = getInstansiByIdService;
|
||||||
|
this.deleteInstansiService = deleteInstansiService;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public GetListInstansiResponse getListInstansi(@RequestParam(name = "search", required = false) String search,
|
||||||
|
@RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||||
|
@RequestParam(name = "size", defaultValue = "5") Integer size){
|
||||||
|
|
||||||
|
Pageable pageable = PageRequest.of((page - 1), size);
|
||||||
|
InstansiRequest instansiRequest = InstansiRequest.builder()
|
||||||
|
.search(search)
|
||||||
|
.pageable(pageable)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
return getListInstansiService.execute(instansiRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public InstansiResponse createInstansi(@RequestBody InstansiRequest request) {
|
||||||
|
return postCreateInstansiService.execute(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public InstansiResponse getInstansiById(@PathVariable Long id) {
|
||||||
|
return getInstansiByIdService.execute(InstansiRequest.builder()
|
||||||
|
.id(id)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
public InstansiResponse updateInstansi(@PathVariable Long id, @RequestBody InstansiRequest request){
|
||||||
|
request.setId(id);
|
||||||
|
return putUpdateInstansiService.execute(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public EmptyResponse deleteInstansi(@PathVariable Long id){
|
||||||
|
return deleteInstansiService.execute(InstansiRequest.builder()
|
||||||
|
.id(id)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,73 @@
|
|||||||
|
package com.iconplus.smartproc.controller;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
|
import com.iconplus.smartproc.model.request.JabatanRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.GetListJabatanResponse;
|
||||||
|
import com.iconplus.smartproc.model.response.JabatanResponse;
|
||||||
|
import com.iconplus.smartproc.service.jabatan.*;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@CrossOrigin(origins = "${fe.server}", allowCredentials = "true")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/jabatan")
|
||||||
|
public class JabatanController {
|
||||||
|
|
||||||
|
private DeleteJabatanService deleteJabatanService;
|
||||||
|
private GetJabatanService getJabatanService;
|
||||||
|
private GetListJabatanService getListJabatanService;
|
||||||
|
private PostCreateJabatanService postCreateJabatanService;
|
||||||
|
private PutUpdateJabatanService putUpdateJabatanService;
|
||||||
|
|
||||||
|
public JabatanController(DeleteJabatanService deleteJabatanService,
|
||||||
|
GetJabatanService getJabatanService,
|
||||||
|
GetListJabatanService getListJabatanService,
|
||||||
|
PostCreateJabatanService postCreateJabatanService,
|
||||||
|
PutUpdateJabatanService putUpdateJabatanService) {
|
||||||
|
this.deleteJabatanService = deleteJabatanService;
|
||||||
|
this.getJabatanService = getJabatanService;
|
||||||
|
this.getListJabatanService = getListJabatanService;
|
||||||
|
this.postCreateJabatanService = postCreateJabatanService;
|
||||||
|
this.putUpdateJabatanService = putUpdateJabatanService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public GetListJabatanResponse getListJabatan(@RequestParam(name = "search", required = false) String search,
|
||||||
|
@RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||||
|
@RequestParam(name = "size", defaultValue = "5") Integer size){
|
||||||
|
|
||||||
|
Pageable pageable = PageRequest.of((page - 1), size);
|
||||||
|
JabatanRequest bidangRequest = JabatanRequest.builder()
|
||||||
|
.search(search)
|
||||||
|
.pageable(pageable)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
return getListJabatanService.execute(bidangRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public JabatanResponse createJabatan(@RequestBody JabatanRequest request) {
|
||||||
|
return postCreateJabatanService.execute(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public JabatanResponse getJabatanById(@PathVariable Long id) {
|
||||||
|
return getJabatanService.execute(JabatanRequest.builder()
|
||||||
|
.id(id)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
public JabatanResponse updateBidang(@PathVariable Long id, @RequestBody JabatanRequest request){
|
||||||
|
request.setId(id);
|
||||||
|
return putUpdateJabatanService.execute(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public EmptyResponse deleteJabatan(@PathVariable Long id){
|
||||||
|
return deleteJabatanService.execute(JabatanRequest.builder()
|
||||||
|
.id(id)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,77 @@
|
|||||||
|
package com.iconplus.smartproc.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
|
import com.iconplus.smartproc.model.request.JenisAnggaranRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.GetListJenisAnggaranResponse;
|
||||||
|
import com.iconplus.smartproc.model.response.JenisAnggaranResponse;
|
||||||
|
import com.iconplus.smartproc.service.jenisanggaran.*;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@CrossOrigin(origins = "${fe.server}", allowCredentials = "true")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/jenisanggaran")
|
||||||
|
public class JenisAnggaranController {
|
||||||
|
|
||||||
|
private final GetListJenisAnggaranService getListJenisAnggaranService;
|
||||||
|
private final GetJenisAnggaranByIdService getJenisAnggaranByIdService;
|
||||||
|
private final PostCreateJenisAnggaranService postCreateJenisAnggaranService;
|
||||||
|
private final PutUpdateJenisAnggaranService putUpdateJenisAnggaranService;
|
||||||
|
private final DeleteJenisAnggaranService deleteJenisAnggaranService;
|
||||||
|
|
||||||
|
public JenisAnggaranController(GetListJenisAnggaranService getListJenisAnggaranService,
|
||||||
|
GetJenisAnggaranByIdService getJenisAnggaranByIdService,
|
||||||
|
PostCreateJenisAnggaranService postCreateJenisAnggaranService,
|
||||||
|
PutUpdateJenisAnggaranService putUpdateJenisAnggaranService,
|
||||||
|
DeleteJenisAnggaranService deleteJenisAnggaranService) {
|
||||||
|
this.getListJenisAnggaranService = getListJenisAnggaranService;
|
||||||
|
this.getJenisAnggaranByIdService = getJenisAnggaranByIdService;
|
||||||
|
this.postCreateJenisAnggaranService = postCreateJenisAnggaranService;
|
||||||
|
this.putUpdateJenisAnggaranService = putUpdateJenisAnggaranService;
|
||||||
|
this.deleteJenisAnggaranService = deleteJenisAnggaranService;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public GetListJenisAnggaranResponse getListJenisAnggaran(@RequestParam(name = "search", required = false) String search,
|
||||||
|
@RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||||
|
@RequestParam(name = "size", defaultValue = "5") Integer size){
|
||||||
|
|
||||||
|
Pageable pageable = PageRequest.of((page - 1), size);
|
||||||
|
JenisAnggaranRequest jenisAnggaranRequest = JenisAnggaranRequest.builder()
|
||||||
|
.search(search)
|
||||||
|
.pageable(pageable)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
return getListJenisAnggaranService.execute(jenisAnggaranRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public JenisAnggaranResponse createJenisAnggaran(@RequestBody JenisAnggaranRequest jenisAnggaranRequest) {
|
||||||
|
return postCreateJenisAnggaranService.execute(jenisAnggaranRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public JenisAnggaranResponse getJenisAnggaranById(@PathVariable Long id) {
|
||||||
|
return getJenisAnggaranByIdService.execute(JenisAnggaranRequest.builder()
|
||||||
|
.id(id)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
public JenisAnggaranResponse updateJenisanggaran(@PathVariable Long id,
|
||||||
|
@RequestBody JenisAnggaranRequest jenisAnggaranRequest){
|
||||||
|
jenisAnggaranRequest.setId(id);
|
||||||
|
return putUpdateJenisAnggaranService.execute(jenisAnggaranRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public EmptyResponse deleteJenisAnggaran(@PathVariable Long id) {
|
||||||
|
return deleteJenisAnggaranService.execute(JenisAnggaranRequest.builder()
|
||||||
|
.id(id)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,77 @@
|
|||||||
|
package com.iconplus.smartproc.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
|
import com.iconplus.smartproc.model.request.JenisKontrakRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.GetListJenisKontrakResponse;
|
||||||
|
import com.iconplus.smartproc.model.response.JenisKontrakResponse;
|
||||||
|
import com.iconplus.smartproc.service.jeniskontrak.*;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@CrossOrigin(origins = "${fe.server}", allowCredentials = "true")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/jeniskontrak")
|
||||||
|
public class JenisKontrakController {
|
||||||
|
|
||||||
|
private final GetListJenisKontrakService getListJenisKontrakService;
|
||||||
|
private final GetJenisKontrakByIdService getJenisKontrakByIdService;
|
||||||
|
private final PostCreateJenisKontrakService postCreateJenisKontrakService;
|
||||||
|
private final PutUpdateJenisKontrakService putUpdateJenisKontrakService;
|
||||||
|
private final DeleteJenisKontrakService deleteJenisKontrakService;
|
||||||
|
|
||||||
|
public JenisKontrakController(GetListJenisKontrakService getListJenisKontrakService,
|
||||||
|
GetJenisKontrakByIdService getJenisKontrakByIdService,
|
||||||
|
PostCreateJenisKontrakService postCreateJenisKontrakService,
|
||||||
|
PutUpdateJenisKontrakService putUpdateJenisKontrakService,
|
||||||
|
DeleteJenisKontrakService deleteJenisKontrakService) {
|
||||||
|
this.getListJenisKontrakService = getListJenisKontrakService;
|
||||||
|
this.getJenisKontrakByIdService = getJenisKontrakByIdService;
|
||||||
|
this.postCreateJenisKontrakService = postCreateJenisKontrakService;
|
||||||
|
this.putUpdateJenisKontrakService = putUpdateJenisKontrakService;
|
||||||
|
this.deleteJenisKontrakService = deleteJenisKontrakService;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public GetListJenisKontrakResponse getListJenisKontrak(@RequestParam(name = "search", required = false) String search,
|
||||||
|
@RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||||
|
@RequestParam(name = "size", defaultValue = "5") Integer size){
|
||||||
|
|
||||||
|
Pageable pageable = PageRequest.of((page - 1), size);
|
||||||
|
JenisKontrakRequest jenisKontrakRequest = JenisKontrakRequest.builder()
|
||||||
|
.search(search)
|
||||||
|
.pageable(pageable)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
return getListJenisKontrakService.execute(jenisKontrakRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public JenisKontrakResponse createJenisKontrak(@RequestBody JenisKontrakRequest jenisKontrakRequest) {
|
||||||
|
return postCreateJenisKontrakService.execute(jenisKontrakRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public JenisKontrakResponse getJenisKontrakById(@PathVariable Long id) {
|
||||||
|
return getJenisKontrakByIdService.execute(JenisKontrakRequest.builder()
|
||||||
|
.id(id)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
public JenisKontrakResponse updateJeniskontrak(@PathVariable Long id,
|
||||||
|
@RequestBody JenisKontrakRequest jenisKontrakRequest){
|
||||||
|
jenisKontrakRequest.setId(id);
|
||||||
|
return putUpdateJenisKontrakService.execute(jenisKontrakRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public EmptyResponse deleteJenisKontrak(@PathVariable Long id) {
|
||||||
|
return deleteJenisKontrakService.execute(JenisKontrakRequest.builder()
|
||||||
|
.id(id)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,75 @@
|
|||||||
|
package com.iconplus.smartproc.controller;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
|
import com.iconplus.smartproc.model.request.JenisPengadaanRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.GetListJenisPengadaanResponse;
|
||||||
|
import com.iconplus.smartproc.model.response.JenisPengadaanResponse;
|
||||||
|
import com.iconplus.smartproc.service.jenispengadaan.*;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@CrossOrigin(origins = "${fe.server}", allowCredentials = "true")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/jenispengadaan")
|
||||||
|
public class JenisPengadaanController {
|
||||||
|
|
||||||
|
private final GetListJenisPengadaanService getListJenisPengadaanService;
|
||||||
|
private final GetJenisPengadaanService getJenisPengadaanService;
|
||||||
|
private final PostCreateJenisPengadaanService postCreateJenisPengadaanService;
|
||||||
|
private final DeleteJenisPengadaanService deleteJenisPengadaanService;
|
||||||
|
private final PutUpdateJenisPengadaanService putUpdateJenisPengadaanService;
|
||||||
|
|
||||||
|
public JenisPengadaanController(GetListJenisPengadaanService getListJenisPengadaanService,
|
||||||
|
GetJenisPengadaanService getJenisPengadaanService,
|
||||||
|
PostCreateJenisPengadaanService postCreateJenisPengadaanService,
|
||||||
|
DeleteJenisPengadaanService deleteJenisPengadaanService,
|
||||||
|
PutUpdateJenisPengadaanService putUpdateJenisPengadaanService) {
|
||||||
|
this.getListJenisPengadaanService = getListJenisPengadaanService;
|
||||||
|
this.getJenisPengadaanService = getJenisPengadaanService;
|
||||||
|
this.postCreateJenisPengadaanService = postCreateJenisPengadaanService;
|
||||||
|
this.deleteJenisPengadaanService = deleteJenisPengadaanService;
|
||||||
|
this.putUpdateJenisPengadaanService = putUpdateJenisPengadaanService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public GetListJenisPengadaanResponse getListJenisPengadaan(@RequestParam(name = "search", required = false) String search,
|
||||||
|
@RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||||
|
@RequestParam(name = "size", defaultValue = "5") Integer size){
|
||||||
|
|
||||||
|
Pageable pageable = PageRequest.of((page - 1), size);
|
||||||
|
JenisPengadaanRequest jenisPengadaanRequest = JenisPengadaanRequest.builder()
|
||||||
|
.search(search)
|
||||||
|
.pageable(pageable)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
return getListJenisPengadaanService.execute(jenisPengadaanRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public JenisPengadaanResponse createJenisPengadaan(@RequestBody JenisPengadaanRequest jenisPengadaanRequest) {
|
||||||
|
return postCreateJenisPengadaanService.execute(jenisPengadaanRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public JenisPengadaanResponse getJenisPengadaannById(@PathVariable Long id) {
|
||||||
|
return getJenisPengadaanService.execute(JenisPengadaanRequest.builder()
|
||||||
|
.id(id)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
public JenisPengadaanResponse updateJenisPengadaan(@PathVariable Long id,
|
||||||
|
@RequestBody JenisPengadaanRequest jenisPengadaanRequest){
|
||||||
|
jenisPengadaanRequest.setId(id);
|
||||||
|
return putUpdateJenisPengadaanService.execute(jenisPengadaanRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public EmptyResponse deleteJenisAnggaran(@PathVariable Long id) {
|
||||||
|
return deleteJenisPengadaanService.execute(JenisPengadaanRequest.builder()
|
||||||
|
.id(id)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
}
|
@ -1,65 +0,0 @@
|
|||||||
package com.iconplus.smartproc.controller;
|
|
||||||
|
|
||||||
import com.iconplus.smartproc.entity.Jenisanggaran;
|
|
||||||
import com.iconplus.smartproc.exception.ResourceNotFoundException;
|
|
||||||
import com.iconplus.smartproc.repository.JenisanggaranRepository;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@CrossOrigin(origins = "http://localhost:8080", allowCredentials = "true")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/jenisanggaran")
|
|
||||||
public class JenisanggaranController {
|
|
||||||
@Autowired
|
|
||||||
private JenisanggaranRepository jenisanggaranRepository;
|
|
||||||
|
|
||||||
//get all data
|
|
||||||
@GetMapping
|
|
||||||
public List<Jenisanggaran> getAllJenisanggarans(){
|
|
||||||
return jenisanggaranRepository.findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
// create
|
|
||||||
@PostMapping
|
|
||||||
public Jenisanggaran createJenisanggaran(@RequestBody Jenisanggaran jenisanggaran) {
|
|
||||||
return jenisanggaranRepository.save(jenisanggaran);
|
|
||||||
}
|
|
||||||
|
|
||||||
// get jenisanggaran by id rest api
|
|
||||||
@GetMapping("/{id}")
|
|
||||||
public ResponseEntity<Jenisanggaran> getJenisanggaranById(@PathVariable Long id) {
|
|
||||||
Jenisanggaran jenisanggaran = jenisanggaranRepository.findById(id)
|
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Jenisanggaran not exist with id :" + id));
|
|
||||||
return ResponseEntity.ok(jenisanggaran);
|
|
||||||
}
|
|
||||||
|
|
||||||
// update jenisanggaran rest api
|
|
||||||
@PutMapping("/{id}")
|
|
||||||
public ResponseEntity<Jenisanggaran> updateJenisanggaran(@PathVariable Long id, @RequestBody Jenisanggaran jenisanggaranDetails){
|
|
||||||
Jenisanggaran jenisanggaran = jenisanggaranRepository.findById(id)
|
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Jenisanggaran not exist with id :" + id));
|
|
||||||
|
|
||||||
jenisanggaran.setJenisanggaran(jenisanggaranDetails.getJenisanggaran());
|
|
||||||
jenisanggaran.setKeterangan(jenisanggaranDetails.getKeterangan());
|
|
||||||
|
|
||||||
Jenisanggaran updatedJenisanggaran = jenisanggaranRepository.save(jenisanggaran);
|
|
||||||
return ResponseEntity.ok(updatedJenisanggaran);
|
|
||||||
}
|
|
||||||
|
|
||||||
// delete jenisanggaran rest api
|
|
||||||
@DeleteMapping("/{id}")
|
|
||||||
public ResponseEntity<Map<String, Boolean>> deleteJenisanggaran(@PathVariable Long id){
|
|
||||||
Jenisanggaran jenisanggaran = jenisanggaranRepository.findById(id)
|
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Supposmatrix not exist with id :" + id));
|
|
||||||
|
|
||||||
jenisanggaranRepository.delete(jenisanggaran);
|
|
||||||
Map<String, Boolean> response = new HashMap<>();
|
|
||||||
response.put("deleted", Boolean.TRUE);
|
|
||||||
return ResponseEntity.ok(response);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,65 +0,0 @@
|
|||||||
package com.iconplus.smartproc.controller;
|
|
||||||
|
|
||||||
import com.iconplus.smartproc.entity.Jeniskontrak;
|
|
||||||
import com.iconplus.smartproc.exception.ResourceNotFoundException;
|
|
||||||
import com.iconplus.smartproc.repository.JeniskontrakRepository;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@CrossOrigin(origins = "http://localhost:8080", allowCredentials = "true")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/jeniskontrak")
|
|
||||||
public class JeniskontrakController {
|
|
||||||
@Autowired
|
|
||||||
private JeniskontrakRepository jeniskontrakRepository;
|
|
||||||
|
|
||||||
//get all data
|
|
||||||
@GetMapping
|
|
||||||
public List<Jeniskontrak> getAllJeniskontraks(){
|
|
||||||
return jeniskontrakRepository.findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
// create
|
|
||||||
@PostMapping
|
|
||||||
public Jeniskontrak createJeniskontrak(@RequestBody Jeniskontrak jeniskontrak) {
|
|
||||||
return jeniskontrakRepository.save(jeniskontrak);
|
|
||||||
}
|
|
||||||
|
|
||||||
// get jeniskontrak by id rest api
|
|
||||||
@GetMapping("/{id}")
|
|
||||||
public ResponseEntity<Jeniskontrak> getJeniskontrakById(@PathVariable Long id) {
|
|
||||||
Jeniskontrak jeniskontrak = jeniskontrakRepository.findById(id)
|
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Jeniskontrak not exist with id :" + id));
|
|
||||||
return ResponseEntity.ok(jeniskontrak);
|
|
||||||
}
|
|
||||||
|
|
||||||
// update jeniskontrak rest api
|
|
||||||
@PutMapping("/{id}")
|
|
||||||
public ResponseEntity<Jeniskontrak> updateJeniskontrak(@PathVariable Long id, @RequestBody Jeniskontrak jeniskontrakDetails){
|
|
||||||
Jeniskontrak jeniskontrak = jeniskontrakRepository.findById(id)
|
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Jeniskontrak not exist with id :" + id));
|
|
||||||
|
|
||||||
jeniskontrak.setJeniskontrak(jeniskontrakDetails.getJeniskontrak());
|
|
||||||
jeniskontrak.setKeterangan(jeniskontrakDetails.getKeterangan());
|
|
||||||
|
|
||||||
Jeniskontrak updatedJeniskontrak = jeniskontrakRepository.save(jeniskontrak);
|
|
||||||
return ResponseEntity.ok(updatedJeniskontrak);
|
|
||||||
}
|
|
||||||
|
|
||||||
// delete jeniskontrak rest api
|
|
||||||
@DeleteMapping("/{id}")
|
|
||||||
public ResponseEntity<Map<String, Boolean>> deleteJeniskontrak(@PathVariable Long id){
|
|
||||||
Jeniskontrak jeniskontrak = jeniskontrakRepository.findById(id)
|
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Jeniskontrak not exist with id :" + id));
|
|
||||||
|
|
||||||
jeniskontrakRepository.delete(jeniskontrak);
|
|
||||||
Map<String, Boolean> response = new HashMap<>();
|
|
||||||
response.put("deleted", Boolean.TRUE);
|
|
||||||
return ResponseEntity.ok(response);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,65 +0,0 @@
|
|||||||
package com.iconplus.smartproc.controller;
|
|
||||||
|
|
||||||
import com.iconplus.smartproc.entity.Jenispengadaan;
|
|
||||||
import com.iconplus.smartproc.exception.ResourceNotFoundException;
|
|
||||||
import com.iconplus.smartproc.repository.JenispengadaanRepository;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@CrossOrigin(origins = "http://localhost:8080", allowCredentials = "true")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/jenispengadaan")
|
|
||||||
public class JenispengadaanController {
|
|
||||||
@Autowired
|
|
||||||
private JenispengadaanRepository jenispengadaanRepository;
|
|
||||||
|
|
||||||
//get all data
|
|
||||||
@GetMapping
|
|
||||||
public List<Jenispengadaan> getAllJenispengadaans(){
|
|
||||||
return jenispengadaanRepository.findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
// create
|
|
||||||
@PostMapping
|
|
||||||
public Jenispengadaan createJenispengadaan(@RequestBody Jenispengadaan jenispengadaan) {
|
|
||||||
return jenispengadaanRepository.save(jenispengadaan);
|
|
||||||
}
|
|
||||||
|
|
||||||
// get jenispengadaan by id rest api
|
|
||||||
@GetMapping("/{id}")
|
|
||||||
public ResponseEntity<Jenispengadaan> getJenispengadaanById(@PathVariable Long id) {
|
|
||||||
Jenispengadaan jenispengadaan = jenispengadaanRepository.findById(id)
|
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Jenispengadaan not exist with id :" + id));
|
|
||||||
return ResponseEntity.ok(jenispengadaan);
|
|
||||||
}
|
|
||||||
|
|
||||||
// update jenispengadaan rest api
|
|
||||||
@PutMapping("/{id}")
|
|
||||||
public ResponseEntity<Jenispengadaan> updateJenispengadaan(@PathVariable Long id, @RequestBody Jenispengadaan jenispengadaanDetails){
|
|
||||||
Jenispengadaan jenispengadaan = jenispengadaanRepository.findById(id)
|
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Jenispengadaan not exist with id :" + id));
|
|
||||||
|
|
||||||
jenispengadaan.setJenispengadaan(jenispengadaanDetails.getJenispengadaan());
|
|
||||||
jenispengadaan.setKeterangan(jenispengadaanDetails.getKeterangan());
|
|
||||||
|
|
||||||
Jenispengadaan updatedJenispengadaan = jenispengadaanRepository.save(jenispengadaan);
|
|
||||||
return ResponseEntity.ok(updatedJenispengadaan);
|
|
||||||
}
|
|
||||||
|
|
||||||
// delete jenispengadaan rest api
|
|
||||||
@DeleteMapping("/{id}")
|
|
||||||
public ResponseEntity<Map<String, Boolean>> deleteJenispengadaan(@PathVariable Long id){
|
|
||||||
Jenispengadaan jenispengadaan = jenispengadaanRepository.findById(id)
|
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Supposmatrix not exist with id :" + id));
|
|
||||||
|
|
||||||
jenispengadaanRepository.delete(jenispengadaan);
|
|
||||||
Map<String, Boolean> response = new HashMap<>();
|
|
||||||
response.put("deleted", Boolean.TRUE);
|
|
||||||
return ResponseEntity.ok(response);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,69 +1,77 @@
|
|||||||
package com.iconplus.smartproc.controller;
|
package com.iconplus.smartproc.controller;
|
||||||
|
|
||||||
import com.iconplus.smartproc.entity.Lokasi;
|
|
||||||
import com.iconplus.smartproc.exception.ResourceNotFoundException;
|
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
import com.iconplus.smartproc.repository.LokasiRepository;
|
import com.iconplus.smartproc.model.request.LokasiRequest;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import com.iconplus.smartproc.model.response.GetListLokasiResponse;
|
||||||
import org.springframework.http.ResponseEntity;
|
import com.iconplus.smartproc.model.response.LokasiResponse;
|
||||||
|
import com.iconplus.smartproc.service.lokasi.*;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.HashMap;
|
@CrossOrigin(origins = "${fe.server}", allowCredentials = "true")
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@CrossOrigin(origins = "http://localhost:8080", allowCredentials = "true")
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/lokasi")
|
@RequestMapping("/api/lokasi")
|
||||||
public class LokasiController {
|
public class LokasiController {
|
||||||
@Autowired
|
|
||||||
private LokasiRepository lokasiRepository;
|
|
||||||
|
|
||||||
//get all data
|
private final GetListLokasiService getListLokasiService;
|
||||||
|
private final GetLokasiByIdService getLokasiByIdService;
|
||||||
|
private final PostCreateLokasiService postCreateLokasiService;
|
||||||
|
private final PutUpdateLokasiService putUpdateLokasiService;
|
||||||
|
private final DeleteLokasiService deleteLokasiService;
|
||||||
|
|
||||||
|
public LokasiController(GetListLokasiService getListLokasiService,
|
||||||
|
GetLokasiByIdService getLokasiByIdService,
|
||||||
|
PostCreateLokasiService postCreateLokasiService,
|
||||||
|
PutUpdateLokasiService putUpdateLokasiService,
|
||||||
|
DeleteLokasiService deleteLokasiService) {
|
||||||
|
this.getListLokasiService = getListLokasiService;
|
||||||
|
this.getLokasiByIdService = getLokasiByIdService;
|
||||||
|
this.postCreateLokasiService = postCreateLokasiService;
|
||||||
|
this.putUpdateLokasiService = putUpdateLokasiService;
|
||||||
|
this.deleteLokasiService = deleteLokasiService;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public List<Lokasi> getAllLokasis(){
|
public GetListLokasiResponse getListLokasi(@RequestParam(name = "search", required = false) String search,
|
||||||
return lokasiRepository.findAll();
|
@RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||||
|
@RequestParam(name = "size", defaultValue = "5") Integer size){
|
||||||
|
|
||||||
|
Pageable pageable = PageRequest.of((page - 1), size);
|
||||||
|
LokasiRequest lokasiRequest = LokasiRequest.builder()
|
||||||
|
.search(search)
|
||||||
|
.pageable(pageable)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
return getListLokasiService.execute(lokasiRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
// create
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public Lokasi createLokasi(@RequestBody Lokasi lokasi) {
|
public LokasiResponse createLokasi(@RequestBody LokasiRequest lokasiRequest) {
|
||||||
return lokasiRepository.save(lokasi);
|
return postCreateLokasiService.execute(lokasiRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
// get lokasi by id rest api
|
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public ResponseEntity<Lokasi> getLokasiById(@PathVariable Long id) {
|
public LokasiResponse getLokasiById(@PathVariable Long id) {
|
||||||
Lokasi lokasi = lokasiRepository.findById(id)
|
return getLokasiByIdService.execute(LokasiRequest.builder()
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Lokasi not exist with id :" + id));
|
.id(id)
|
||||||
return ResponseEntity.ok(lokasi);
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
// update lokasi rest api
|
|
||||||
@PutMapping("/{id}")
|
@PutMapping("/{id}")
|
||||||
public ResponseEntity<Lokasi> updateSumberdana(@PathVariable Long id, @RequestBody Lokasi lokasiDetails){
|
public LokasiResponse updateLokasi(@PathVariable Long id,
|
||||||
Lokasi lokasi = lokasiRepository.findById(id)
|
@RequestBody LokasiRequest LokasiRequest){
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Lokasi not exist with id :" + id));
|
LokasiRequest.setId(id);
|
||||||
|
return putUpdateLokasiService.execute(LokasiRequest);
|
||||||
lokasi.setLokasi(lokasiDetails.getLokasi());
|
|
||||||
lokasi.setKeterangan(lokasiDetails.getKeterangan());
|
|
||||||
|
|
||||||
Lokasi updatedLokasi = lokasiRepository.save(lokasi);
|
|
||||||
return ResponseEntity.ok(updatedLokasi);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete lokasi rest api
|
|
||||||
@DeleteMapping("/{id}")
|
@DeleteMapping("/{id}")
|
||||||
public ResponseEntity<Map<String, Boolean>> deleteLokasi(@PathVariable Long id){
|
public EmptyResponse deleteLokasi(@PathVariable Long id) {
|
||||||
Lokasi lokasi = lokasiRepository.findById(id)
|
return deleteLokasiService.execute(LokasiRequest.builder()
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Lokasi not exist with id :" + id));
|
.id(id)
|
||||||
|
.build());
|
||||||
lokasiRepository.delete(lokasi);
|
|
||||||
Map<String, Boolean> response = new HashMap<>();
|
|
||||||
response.put("deleted", Boolean.TRUE);
|
|
||||||
return ResponseEntity.ok(response);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,77 @@
|
|||||||
|
package com.iconplus.smartproc.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
|
import com.iconplus.smartproc.model.request.MetodePengadaanRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.GetListMetodePengadaanResponse;
|
||||||
|
import com.iconplus.smartproc.model.response.MetodePengadaanResponse;
|
||||||
|
import com.iconplus.smartproc.service.metodepengadaan.*;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@CrossOrigin(origins = "${fe.server}", allowCredentials = "true")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/metodepengadaan")
|
||||||
|
public class MetodePengadaanController {
|
||||||
|
|
||||||
|
private final GetListMetodePengadaanService getListMetodePengadaanService;
|
||||||
|
private final GetMetodePengadaanByIdService getMetodePengadaanByIdService;
|
||||||
|
private final PostCreateMetodePengadaanService postCreateMetodePengadaanService;
|
||||||
|
private final PutUpdateMetodePengadaanService putUpdateMetodePengadaanService;
|
||||||
|
private final DeleteMetodePengadaanService deleteMetodePengadaanService;
|
||||||
|
|
||||||
|
public MetodePengadaanController(GetListMetodePengadaanService getListMetodePengadaanService,
|
||||||
|
GetMetodePengadaanByIdService getMetodePengadaanByIdService,
|
||||||
|
PostCreateMetodePengadaanService postCreateMetodePengadaanService,
|
||||||
|
PutUpdateMetodePengadaanService putUpdateMetodePengadaanService,
|
||||||
|
DeleteMetodePengadaanService deleteMetodePengadaanService) {
|
||||||
|
this.getListMetodePengadaanService = getListMetodePengadaanService;
|
||||||
|
this.getMetodePengadaanByIdService = getMetodePengadaanByIdService;
|
||||||
|
this.postCreateMetodePengadaanService = postCreateMetodePengadaanService;
|
||||||
|
this.putUpdateMetodePengadaanService = putUpdateMetodePengadaanService;
|
||||||
|
this.deleteMetodePengadaanService = deleteMetodePengadaanService;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public GetListMetodePengadaanResponse getListMetodePengadaan(@RequestParam(name = "search", required = false) String search,
|
||||||
|
@RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||||
|
@RequestParam(name = "size", defaultValue = "5") Integer size){
|
||||||
|
|
||||||
|
Pageable pageable = PageRequest.of((page - 1), size);
|
||||||
|
MetodePengadaanRequest metodePengadaanRequest = MetodePengadaanRequest.builder()
|
||||||
|
.search(search)
|
||||||
|
.pageable(pageable)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
return getListMetodePengadaanService.execute(metodePengadaanRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public MetodePengadaanResponse createMetodePengadaan(@RequestBody MetodePengadaanRequest metodePengadaanRequest) {
|
||||||
|
return postCreateMetodePengadaanService.execute(metodePengadaanRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public MetodePengadaanResponse getMetodePengadaanById(@PathVariable Long id) {
|
||||||
|
return getMetodePengadaanByIdService.execute(MetodePengadaanRequest.builder()
|
||||||
|
.id(id)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
public MetodePengadaanResponse updateMetodepengadaan(@PathVariable Long id,
|
||||||
|
@RequestBody MetodePengadaanRequest metodePengadaanRequest){
|
||||||
|
metodePengadaanRequest.setId(id);
|
||||||
|
return putUpdateMetodePengadaanService.execute(metodePengadaanRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public EmptyResponse deleteMetodePengadaan(@PathVariable Long id) {
|
||||||
|
return deleteMetodePengadaanService.execute(MetodePengadaanRequest.builder()
|
||||||
|
.id(id)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,82 @@
|
|||||||
|
package com.iconplus.smartproc.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
|
import com.iconplus.smartproc.model.request.MetodePenyampaianRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.GetListMetodePenyampaianResponse;
|
||||||
|
import com.iconplus.smartproc.model.response.MetodePenyampaianResponse;
|
||||||
|
import com.iconplus.smartproc.repository.MetodePenyampaianRepository;
|
||||||
|
import com.iconplus.smartproc.service.metodepenyampaian.*;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@CrossOrigin(origins = "${fe.server}", allowCredentials = "true")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/metodepenyampaian")
|
||||||
|
public class MetodePenyampaianController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MetodePenyampaianRepository metodepenyampaianRepository;
|
||||||
|
|
||||||
|
private final GetListMetodePenyampaianService getListMetodePenyampaianService;
|
||||||
|
private final GetMetodePenyampaianByIdService getMetodePenyampaianByIdService;
|
||||||
|
private final PostCreateMetodePenyampaianService postCreateMetodePenyampaianService;
|
||||||
|
private final PutUpdateMetodePenyampaianService putUpdateMetodePenyampaianService;
|
||||||
|
private final DeleteMetodePenyampaianService deleteMetodePenyampaianService;
|
||||||
|
|
||||||
|
public MetodePenyampaianController(GetListMetodePenyampaianService getListMetodePenyampaianService,
|
||||||
|
GetMetodePenyampaianByIdService getMetodePenyampaianByIdService,
|
||||||
|
PostCreateMetodePenyampaianService postCreateMetodePenyampaianService,
|
||||||
|
PutUpdateMetodePenyampaianService putUpdateMetodePenyampaianService,
|
||||||
|
DeleteMetodePenyampaianService deleteMetodePenyampaianService) {
|
||||||
|
this.getListMetodePenyampaianService = getListMetodePenyampaianService;
|
||||||
|
this.getMetodePenyampaianByIdService = getMetodePenyampaianByIdService;
|
||||||
|
this.postCreateMetodePenyampaianService = postCreateMetodePenyampaianService;
|
||||||
|
this.putUpdateMetodePenyampaianService = putUpdateMetodePenyampaianService;
|
||||||
|
this.deleteMetodePenyampaianService = deleteMetodePenyampaianService;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public GetListMetodePenyampaianResponse getListMetodePenyampaian(@RequestParam(name = "search", required = false) String search,
|
||||||
|
@RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||||
|
@RequestParam(name = "size", defaultValue = "5") Integer size){
|
||||||
|
|
||||||
|
Pageable pageable = PageRequest.of((page - 1), size);
|
||||||
|
MetodePenyampaianRequest metodePenyampaianRequest = MetodePenyampaianRequest.builder()
|
||||||
|
.search(search)
|
||||||
|
.pageable(pageable)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
return getListMetodePenyampaianService.execute(metodePenyampaianRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public MetodePenyampaianResponse createMetodePenyampaian(@RequestBody MetodePenyampaianRequest metodePenyampaianRequest) {
|
||||||
|
return postCreateMetodePenyampaianService.execute(metodePenyampaianRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public MetodePenyampaianResponse getMetodePenyampaianById(@PathVariable Long id) {
|
||||||
|
return getMetodePenyampaianByIdService.execute(MetodePenyampaianRequest.builder()
|
||||||
|
.id(id)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
public MetodePenyampaianResponse updateMetodepenyampaian(@PathVariable Long id,
|
||||||
|
@RequestBody MetodePenyampaianRequest metodePenyampaianRequest){
|
||||||
|
metodePenyampaianRequest.setId(id);
|
||||||
|
return putUpdateMetodePenyampaianService.execute(metodePenyampaianRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public EmptyResponse deleteMetodePenyampaian(@PathVariable Long id) {
|
||||||
|
return deleteMetodePenyampaianService.execute(MetodePenyampaianRequest.builder()
|
||||||
|
.id(id)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
}
|
@ -1,68 +0,0 @@
|
|||||||
package com.iconplus.smartproc.controller;
|
|
||||||
|
|
||||||
import com.iconplus.smartproc.entity.Metodepengadaan;
|
|
||||||
import com.iconplus.smartproc.exception.ResourceNotFoundException;
|
|
||||||
import com.iconplus.smartproc.repository.MetodepengadaanRepository;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@CrossOrigin(origins = "http://localhost:8080", allowCredentials = "true")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/metodepengadaan")
|
|
||||||
public class MetodepengadaanController {
|
|
||||||
@Autowired
|
|
||||||
private MetodepengadaanRepository metodepengadaanRepository;
|
|
||||||
|
|
||||||
//get all data
|
|
||||||
@GetMapping
|
|
||||||
public List<Metodepengadaan> getAllMetodepengadaans(){
|
|
||||||
return metodepengadaanRepository.findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
// create
|
|
||||||
@PostMapping
|
|
||||||
public Metodepengadaan createMetodepengadaan(@RequestBody Metodepengadaan metodepengadaan) {
|
|
||||||
return metodepengadaanRepository.save(metodepengadaan);
|
|
||||||
}
|
|
||||||
|
|
||||||
// get metodepengadaan by id rest api
|
|
||||||
@GetMapping("/{id}")
|
|
||||||
public ResponseEntity<Metodepengadaan> getMetodepengadaanById(@PathVariable Long id) {
|
|
||||||
Metodepengadaan metodepengadaan = metodepengadaanRepository.findById(id)
|
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Metodepengadaan not exist with id :" + id));
|
|
||||||
return ResponseEntity.ok(metodepengadaan);
|
|
||||||
}
|
|
||||||
|
|
||||||
// update metodepengadaan rest api
|
|
||||||
@PutMapping("/{id}")
|
|
||||||
public ResponseEntity<Metodepengadaan> updateMetodepengadaan(@PathVariable Long id, @RequestBody Metodepengadaan metodepengadaanDetails){
|
|
||||||
Metodepengadaan metodepengadaan = metodepengadaanRepository.findById(id)
|
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Metodepengadaan not exist with id :" + id));
|
|
||||||
|
|
||||||
metodepengadaan.setMetodepengadaan(metodepengadaanDetails.getMetodepengadaan());
|
|
||||||
metodepengadaan.setKeterangan(metodepengadaanDetails.getKeterangan());
|
|
||||||
|
|
||||||
Metodepengadaan updatedMetodepengadaan = metodepengadaanRepository.save(metodepengadaan);
|
|
||||||
return ResponseEntity.ok(updatedMetodepengadaan);
|
|
||||||
}
|
|
||||||
|
|
||||||
// delete metodepengadaan rest api
|
|
||||||
@DeleteMapping("/{id}")
|
|
||||||
public ResponseEntity<Map<String, Boolean>> deleteMetodepengadaan(@PathVariable Long id){
|
|
||||||
Metodepengadaan metodepengadaan = metodepengadaanRepository.findById(id)
|
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Metodepengadaan not exist with id :" + id));
|
|
||||||
|
|
||||||
metodepengadaanRepository.delete(metodepengadaan);
|
|
||||||
Map<String, Boolean> response = new HashMap<>();
|
|
||||||
response.put("deleted", Boolean.TRUE);
|
|
||||||
return ResponseEntity.ok(response);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,68 +0,0 @@
|
|||||||
package com.iconplus.smartproc.controller;
|
|
||||||
|
|
||||||
import com.iconplus.smartproc.entity.Metodepenyampaian;
|
|
||||||
import com.iconplus.smartproc.exception.ResourceNotFoundException;
|
|
||||||
import com.iconplus.smartproc.repository.MetodepenyampaianRepository;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@CrossOrigin(origins = "http://localhost:8080", allowCredentials = "true")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/metodepenyampaian")
|
|
||||||
public class MetodepenyampaianController {
|
|
||||||
@Autowired
|
|
||||||
private MetodepenyampaianRepository metodepenyampaianRepository;
|
|
||||||
|
|
||||||
//get all data
|
|
||||||
@GetMapping
|
|
||||||
public List<Metodepenyampaian> getAllMetodepenyampaians(){
|
|
||||||
return metodepenyampaianRepository.findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
// create
|
|
||||||
@PostMapping
|
|
||||||
public Metodepenyampaian createMetodepenyampaian(@RequestBody Metodepenyampaian metodepenyampaian) {
|
|
||||||
return metodepenyampaianRepository.save(metodepenyampaian);
|
|
||||||
}
|
|
||||||
|
|
||||||
// get metodepenyampaian by id rest api
|
|
||||||
@GetMapping("/{id}")
|
|
||||||
public ResponseEntity<Metodepenyampaian> getMetodepenyampaianById(@PathVariable Long id) {
|
|
||||||
Metodepenyampaian metodepenyampaian = metodepenyampaianRepository.findById(id)
|
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Metodepenyampaian not exist with id :" + id));
|
|
||||||
return ResponseEntity.ok(metodepenyampaian);
|
|
||||||
}
|
|
||||||
|
|
||||||
// update metodepenyampaian rest api
|
|
||||||
@PutMapping("/{id}")
|
|
||||||
public ResponseEntity<Metodepenyampaian> updateMetodepenyampaian(@PathVariable Long id, @RequestBody Metodepenyampaian metodepenyampaianDetails){
|
|
||||||
Metodepenyampaian metodepenyampaian = metodepenyampaianRepository.findById(id)
|
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Metodepenyampaian not exist with id :" + id));
|
|
||||||
|
|
||||||
metodepenyampaian.setMetodepenyampaian(metodepenyampaianDetails.getMetodepenyampaian());
|
|
||||||
metodepenyampaian.setKeterangan(metodepenyampaianDetails.getKeterangan());
|
|
||||||
|
|
||||||
Metodepenyampaian updatedMetodepenyampaian = metodepenyampaianRepository.save(metodepenyampaian);
|
|
||||||
return ResponseEntity.ok(updatedMetodepenyampaian);
|
|
||||||
}
|
|
||||||
|
|
||||||
// delete metodepenyampaian rest api
|
|
||||||
@DeleteMapping("/{id}")
|
|
||||||
public ResponseEntity<Map<String, Boolean>> deleteMetodepenyampaian(@PathVariable Long id){
|
|
||||||
Metodepenyampaian metodepenyampaian = metodepenyampaianRepository.findById(id)
|
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Metodepenyampaian not exist with id :" + id));
|
|
||||||
|
|
||||||
metodepenyampaianRepository.delete(metodepenyampaian);
|
|
||||||
Map<String, Boolean> response = new HashMap<>();
|
|
||||||
response.put("deleted", Boolean.TRUE);
|
|
||||||
return ResponseEntity.ok(response);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
|||||||
|
package com.iconplus.smartproc.controller;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
|
import com.iconplus.smartproc.model.request.ListPermissionRequest;
|
||||||
|
import com.iconplus.smartproc.repository.PermissionRepository;
|
||||||
|
import com.iconplus.smartproc.service.permission.PutUpdatePermissionService;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@CrossOrigin(origins = "${fe.server}", allowCredentials = "true")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/permission")
|
||||||
|
public class PermissionController {
|
||||||
|
|
||||||
|
private PermissionRepository permissionRepository;
|
||||||
|
private PutUpdatePermissionService putUpdatePermissionService;
|
||||||
|
|
||||||
|
public PermissionController(PermissionRepository permissionRepository,
|
||||||
|
PutUpdatePermissionService putUpdatePermissionService) {
|
||||||
|
this.permissionRepository = permissionRepository;
|
||||||
|
this.putUpdatePermissionService = putUpdatePermissionService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/{roleId}")
|
||||||
|
public EmptyResponse editPermissionRole(@PathVariable Long roleId, @RequestBody ListPermissionRequest listPermissionRequest) {
|
||||||
|
listPermissionRequest.setRoleId(roleId);
|
||||||
|
return putUpdatePermissionService.execute(listPermissionRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
package com.iconplus.smartproc.controller;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
|
import com.iconplus.smartproc.model.request.PrintDrpRequest;
|
||||||
|
import com.iconplus.smartproc.model.request.RolesRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.GetListPrintDrpResponse;
|
||||||
|
import com.iconplus.smartproc.model.response.PrintDrpResponse;
|
||||||
|
import com.iconplus.smartproc.service.print.DrpPrintExecutionService;
|
||||||
|
import com.iconplus.smartproc.service.print.GetListPrintDrpService;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@CrossOrigin(origins = "${fe.server}", allowCredentials = "true")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/drp/cetak")
|
||||||
|
public class PrintController {
|
||||||
|
|
||||||
|
private final GetListPrintDrpService getListPrintDrpService;
|
||||||
|
private final DrpPrintExecutionService drpPrintExecutionService;
|
||||||
|
|
||||||
|
public PrintController(GetListPrintDrpService getListPrintDrpService,
|
||||||
|
DrpPrintExecutionService drpPrintExecutionService) {
|
||||||
|
this.getListPrintDrpService = getListPrintDrpService;
|
||||||
|
this.drpPrintExecutionService = drpPrintExecutionService;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public GetListPrintDrpResponse getListPrintDrpResponse(@RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||||
|
@RequestParam(name = "size", defaultValue = "5") Integer size) {
|
||||||
|
|
||||||
|
Pageable pageable = PageRequest.of((page - 1), size);
|
||||||
|
PrintDrpRequest printDrpRequest = PrintDrpRequest.builder()
|
||||||
|
.pageable(pageable)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
return getListPrintDrpService.execute(printDrpRequest);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("execution")
|
||||||
|
public EmptyResponse drpPrintExecution(@RequestBody PrintDrpRequest printDrpRequest) throws Exception {
|
||||||
|
return drpPrintExecutionService.execute(printDrpRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,81 @@
|
|||||||
|
package com.iconplus.smartproc.controller;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
|
import com.iconplus.smartproc.model.request.RksDaftarIsiRequest;
|
||||||
|
import com.iconplus.smartproc.model.request.RksIsiRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.*;
|
||||||
|
import com.iconplus.smartproc.service.rksdaftarisi.*;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@CrossOrigin(origins = "${fe.server}", allowCredentials = "true")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/rks/daftar-isi")
|
||||||
|
public class RksDaftarIsiController {
|
||||||
|
|
||||||
|
private final GetListRksDaftarIsiService getListRksDaftarIsiService;
|
||||||
|
private final PostCreateRksDaftarIsiService postCreateRksDaftarIsiService;
|
||||||
|
private final GetListRksIsiService getListRksIsiService;
|
||||||
|
private final DeleteRksDaftarIsiService deleteRksDaftarIsiService;
|
||||||
|
private final PutUpdateRksDaftarIsiService putUpdateRksDaftarIsiService;
|
||||||
|
public RksDaftarIsiController(GetListRksDaftarIsiService getListRksDaftarIsiService,
|
||||||
|
PostCreateRksDaftarIsiService postCreateRksDaftarIsiService,
|
||||||
|
GetListRksIsiService getListRksIsiService,
|
||||||
|
DeleteRksDaftarIsiService deleteRksDaftarIsiService,
|
||||||
|
PutUpdateRksDaftarIsiService putUpdateRksDaftarIsiService) {
|
||||||
|
this.getListRksDaftarIsiService = getListRksDaftarIsiService;
|
||||||
|
this.postCreateRksDaftarIsiService = postCreateRksDaftarIsiService;
|
||||||
|
this.getListRksIsiService = getListRksIsiService;
|
||||||
|
this.deleteRksDaftarIsiService = deleteRksDaftarIsiService;
|
||||||
|
this.putUpdateRksDaftarIsiService = putUpdateRksDaftarIsiService;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping()
|
||||||
|
public ListRksDaftarIsiResponse getAllRksDaftarIsi(@RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||||
|
@RequestParam(name = "size", defaultValue = "5") Integer size){
|
||||||
|
|
||||||
|
Pageable pageable = PageRequest.of((page - 1), size);
|
||||||
|
RksDaftarIsiRequest rksDaftarIsiRequest = RksDaftarIsiRequest.builder()
|
||||||
|
.pageable(pageable)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
return getListRksDaftarIsiService.execute(rksDaftarIsiRequest);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping()
|
||||||
|
public RksDaftarIsiResponse createRksDaftarIsi(@RequestBody RksDaftarIsiRequest rksDaftarIsiRequest) {
|
||||||
|
return postCreateRksDaftarIsiService.execute(rksDaftarIsiRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}/isi")
|
||||||
|
public ListRksIsiResponse getListRksIsi(@PathVariable(name = "id") Long id,
|
||||||
|
@RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||||
|
@RequestParam(name = "size", defaultValue = "5") Integer size) {
|
||||||
|
|
||||||
|
Pageable pageable = PageRequest.of((page - 1), size);
|
||||||
|
RksIsiRequest rksIsiRequest = RksIsiRequest.builder()
|
||||||
|
.rksDaftarIsiId(id)
|
||||||
|
.pageable(pageable)
|
||||||
|
.build();
|
||||||
|
return getListRksIsiService.execute(rksIsiRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
public RksDaftarIsiResponse editRksDaftarIsi(@PathVariable(name = "id") Long id,
|
||||||
|
@RequestBody RksDaftarIsiRequest rksDaftarIsiRequest) {
|
||||||
|
rksDaftarIsiRequest.setId(id);
|
||||||
|
return putUpdateRksDaftarIsiService.execute(rksDaftarIsiRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public EmptyResponse deleteRksDaftarIsi(@PathVariable(name = "id") Long id) {
|
||||||
|
return deleteRksDaftarIsiService.execute(RksDaftarIsiRequest.builder()
|
||||||
|
.id(id)
|
||||||
|
.build());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,68 @@
|
|||||||
|
package com.iconplus.smartproc.controller;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
|
import com.iconplus.smartproc.model.request.RksDaftarIsiRequest;
|
||||||
|
import com.iconplus.smartproc.model.request.RksTemplateRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.ListRksTemplateResponse;
|
||||||
|
import com.iconplus.smartproc.model.response.RksDaftarIsiResponse;
|
||||||
|
import com.iconplus.smartproc.model.response.RksTemplateResponse;
|
||||||
|
import com.iconplus.smartproc.service.rkstemplate.DeleteRksTemplateService;
|
||||||
|
import com.iconplus.smartproc.service.rkstemplate.GetListRksTemplateService;
|
||||||
|
import com.iconplus.smartproc.service.rkstemplate.PostCreateRksTemplateService;
|
||||||
|
import com.iconplus.smartproc.service.rkstemplate.PutUpdateRksTemplateService;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@CrossOrigin(origins = "${fe.server}", allowCredentials = "true")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/rks/template")
|
||||||
|
public class RksTemplateController {
|
||||||
|
|
||||||
|
private final PostCreateRksTemplateService postCreateRksTemplateService;
|
||||||
|
private final GetListRksTemplateService getListRksTemplateService;
|
||||||
|
private final PutUpdateRksTemplateService putUpdateRksTemplateService;
|
||||||
|
private final DeleteRksTemplateService deleteRksTemplateService;
|
||||||
|
public RksTemplateController(PostCreateRksTemplateService postCreateRksTemplateService,
|
||||||
|
GetListRksTemplateService getListRksTemplateService,
|
||||||
|
PutUpdateRksTemplateService putUpdateRksTemplateService,
|
||||||
|
DeleteRksTemplateService deleteRksTemplateService) {
|
||||||
|
this.postCreateRksTemplateService = postCreateRksTemplateService;
|
||||||
|
this.getListRksTemplateService = getListRksTemplateService;
|
||||||
|
this.putUpdateRksTemplateService = putUpdateRksTemplateService;
|
||||||
|
this.deleteRksTemplateService = deleteRksTemplateService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping()
|
||||||
|
public RksTemplateResponse createRksTemplate(@RequestBody RksTemplateRequest rksTemplateRequest) {
|
||||||
|
return postCreateRksTemplateService.execute(rksTemplateRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping()
|
||||||
|
public ListRksTemplateResponse getListRksTemplate(@RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||||
|
@RequestParam(name = "size", defaultValue = "5") Integer size) {
|
||||||
|
|
||||||
|
Pageable pageable = PageRequest.of((page - 1), size);
|
||||||
|
RksTemplateRequest rksTemplateRequest = RksTemplateRequest.builder()
|
||||||
|
.pageable(pageable)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
return getListRksTemplateService.execute(rksTemplateRequest);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
public RksTemplateResponse editRksTemplate(@PathVariable(name = "id") Long id,
|
||||||
|
@RequestBody RksTemplateRequest rksTemplateRequest) {
|
||||||
|
rksTemplateRequest.setId(id);
|
||||||
|
return putUpdateRksTemplateService.execute(rksTemplateRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public EmptyResponse deleteRksTemplate(@PathVariable(name = "id") Long id) {
|
||||||
|
return deleteRksTemplateService.execute(RksTemplateRequest.builder()
|
||||||
|
.id(id)
|
||||||
|
.build());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -1,66 +1,73 @@
|
|||||||
package com.iconplus.smartproc.controller;
|
package com.iconplus.smartproc.controller;
|
||||||
|
|
||||||
import com.iconplus.smartproc.entity.Roles;
|
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
import com.iconplus.smartproc.exception.ResourceNotFoundException;
|
import com.iconplus.smartproc.model.request.RolesRequest;
|
||||||
import com.iconplus.smartproc.repository.RolesRepository;
|
import com.iconplus.smartproc.model.response.GetRolesResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import com.iconplus.smartproc.model.response.RolesResponse;
|
||||||
import org.springframework.http.ResponseEntity;
|
import com.iconplus.smartproc.service.roles.*;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.HashMap;
|
@CrossOrigin(origins = "${fe.server}", allowCredentials = "true")
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@CrossOrigin(origins = "http://localhost:8080", allowCredentials = "true")
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/roles")
|
@RequestMapping("/api/roles")
|
||||||
public class RolesController {
|
public class RolesController {
|
||||||
@Autowired
|
|
||||||
private RolesRepository rolesRepository;
|
|
||||||
|
|
||||||
//get all data
|
private final GetRolesService getRolesService;
|
||||||
|
private final PostCreateRoleService postCreateRoleService;
|
||||||
|
private final GetRoleByIdService getRoleByIdService;
|
||||||
|
private final PutUpdateRoleService putUpdateRoleService;
|
||||||
|
private final DeleteRoleService deleteRoleService;
|
||||||
|
|
||||||
|
public RolesController(GetRolesService getRolesService,
|
||||||
|
PostCreateRoleService postCreateRoleService,
|
||||||
|
GetRoleByIdService getRoleByIdService,
|
||||||
|
PutUpdateRoleService putUpdateRoleService,
|
||||||
|
DeleteRoleService deleteRoleService) {
|
||||||
|
this.getRolesService = getRolesService;
|
||||||
|
this.postCreateRoleService = postCreateRoleService;
|
||||||
|
this.getRoleByIdService = getRoleByIdService;
|
||||||
|
this.putUpdateRoleService = putUpdateRoleService;
|
||||||
|
this.deleteRoleService = deleteRoleService;
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public List<Roles> getAllRoless(){
|
public GetRolesResponse getRoles(@RequestParam(name = "search", required = false) String search,
|
||||||
return rolesRepository.findAll();
|
@RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||||
|
@RequestParam(name = "size", defaultValue = "5") Integer size){
|
||||||
|
|
||||||
|
Pageable pageable = PageRequest.of((page - 1), size);
|
||||||
|
RolesRequest rolesRequest = RolesRequest.builder()
|
||||||
|
.search(search)
|
||||||
|
.pageable(pageable)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
return getRolesService.execute(rolesRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
// create
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public Roles createRoles(@RequestBody Roles roles) {
|
public RolesResponse createRoles(@RequestBody RolesRequest rolesRequest) {
|
||||||
return rolesRepository.save(roles);
|
return postCreateRoleService.execute(rolesRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
// get roles by id rest api
|
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public ResponseEntity<Roles> getRolesById(@PathVariable Long id) {
|
public RolesResponse getRolesById(@PathVariable Long id) {
|
||||||
Roles roles = rolesRepository.findById(id)
|
return getRoleByIdService.execute(RolesRequest.builder()
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Roles not exist with id :" + id));
|
.id(id)
|
||||||
return ResponseEntity.ok(roles);
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
// update roles rest api
|
|
||||||
@PutMapping("/{id}")
|
@PutMapping("/{id}")
|
||||||
public ResponseEntity<Roles> updateRoles(@PathVariable Long id, @RequestBody Roles rolesDetails){
|
public RolesResponse updateRoles(@PathVariable Long id, @RequestBody RolesRequest rolesRequest){
|
||||||
Roles roles = rolesRepository.findById(id)
|
rolesRequest.setId(id);
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Roles not exist with id :" + id));
|
return putUpdateRoleService.execute(rolesRequest);
|
||||||
|
|
||||||
roles.setRoles(rolesDetails.getRoles());
|
|
||||||
roles.setKeterangan(rolesDetails.getKeterangan());
|
|
||||||
roles.setIsactive(rolesDetails.getIsactive());
|
|
||||||
|
|
||||||
Roles updatedRoles = rolesRepository.save(roles);
|
|
||||||
return ResponseEntity.ok(updatedRoles);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete roles rest api
|
|
||||||
@DeleteMapping("/{id}")
|
@DeleteMapping("/{id}")
|
||||||
public ResponseEntity<Map<String, Boolean>> deleteRoles(@PathVariable Long id){
|
public EmptyResponse deleteRoles(@PathVariable Long id){
|
||||||
Roles roles = rolesRepository.findById(id)
|
return deleteRoleService.execute(RolesRequest.builder()
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Supposmatrix not exist with id :" + id));
|
.id(id)
|
||||||
|
.build());
|
||||||
rolesRepository.delete(roles);
|
|
||||||
Map<String, Boolean> response = new HashMap<>();
|
|
||||||
response.put("deleted", Boolean.TRUE);
|
|
||||||
return ResponseEntity.ok(response);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,76 @@
|
|||||||
|
package com.iconplus.smartproc.controller;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
|
import com.iconplus.smartproc.model.request.StrategiPengadaanRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.GetListStrategiPengadaanResponse;
|
||||||
|
import com.iconplus.smartproc.model.response.StrategiPengadaanResponse;
|
||||||
|
import com.iconplus.smartproc.service.strategipengadaan.*;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@CrossOrigin(origins = "${fe.server}", allowCredentials = "true")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/strategipengadaan")
|
||||||
|
public class StrategiPengadaanController {
|
||||||
|
|
||||||
|
private final DeleteStrategiPengadaanService deleteStrategiPengadaanService;
|
||||||
|
private final GetListStrategiPengadaanService getListStrategiPengadaanService;
|
||||||
|
private final GetStrategiPengadaanByIdService getStrategiPengadaanByIdService;
|
||||||
|
private final PostCreateStrategiPengadaanService postCreateStrategiPengadaanService;
|
||||||
|
private final PutUpdateStrategiPengadaanService putUpdateStrategiPengadaanService;
|
||||||
|
|
||||||
|
public StrategiPengadaanController(DeleteStrategiPengadaanService deleteStrategiPengadaanService,
|
||||||
|
GetListStrategiPengadaanService getListStrategiPengadaanService,
|
||||||
|
GetStrategiPengadaanByIdService getStrategiPengadaanByIdService,
|
||||||
|
PostCreateStrategiPengadaanService postCreateStrategiPengadaanService,
|
||||||
|
PutUpdateStrategiPengadaanService putUpdateStrategiPengadaanService) {
|
||||||
|
this.deleteStrategiPengadaanService = deleteStrategiPengadaanService;
|
||||||
|
this.getListStrategiPengadaanService = getListStrategiPengadaanService;
|
||||||
|
this.getStrategiPengadaanByIdService = getStrategiPengadaanByIdService;
|
||||||
|
this.postCreateStrategiPengadaanService = postCreateStrategiPengadaanService;
|
||||||
|
this.putUpdateStrategiPengadaanService = putUpdateStrategiPengadaanService;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public GetListStrategiPengadaanResponse getListStrategiPengadaan(@RequestParam(name = "search", required = false) String search,
|
||||||
|
@RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||||
|
@RequestParam(name = "size", defaultValue = "5") Integer size){
|
||||||
|
|
||||||
|
Pageable pageable = PageRequest.of((page - 1), size);
|
||||||
|
StrategiPengadaanRequest strategiPengadaanRequest = StrategiPengadaanRequest.builder()
|
||||||
|
.search(search)
|
||||||
|
.pageable(pageable)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
return getListStrategiPengadaanService.execute(strategiPengadaanRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public StrategiPengadaanResponse createStrategiPengadaan(@RequestBody StrategiPengadaanRequest strategiPengadaanRequest) {
|
||||||
|
return postCreateStrategiPengadaanService.execute(strategiPengadaanRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public StrategiPengadaanResponse getStrategiPengadaan(@PathVariable Long id) {
|
||||||
|
return getStrategiPengadaanByIdService.execute(StrategiPengadaanRequest.builder()
|
||||||
|
.id(id)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
public StrategiPengadaanResponse updateStrategiPengadaan(@PathVariable Long id,
|
||||||
|
@RequestBody StrategiPengadaanRequest strategiPengadaanRequest){
|
||||||
|
strategiPengadaanRequest.setId(id);
|
||||||
|
return putUpdateStrategiPengadaanService.execute(strategiPengadaanRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public EmptyResponse deleteStrategiPengadaan(@PathVariable Long id) {
|
||||||
|
return deleteStrategiPengadaanService.execute(StrategiPengadaanRequest.builder()
|
||||||
|
.id(id)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
}
|
@ -1,69 +0,0 @@
|
|||||||
package com.iconplus.smartproc.controller;
|
|
||||||
|
|
||||||
import com.iconplus.smartproc.entity.Strategipengadaan;
|
|
||||||
import com.iconplus.smartproc.exception.ResourceNotFoundException;
|
|
||||||
import com.iconplus.smartproc.repository.StrategipengadaanRepository;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@CrossOrigin(origins = "http://localhost:8080", allowCredentials = "true")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/strategipengadaan")
|
|
||||||
public class StrategipengadaanController {
|
|
||||||
@Autowired
|
|
||||||
private StrategipengadaanRepository strategipengadaanRepository;
|
|
||||||
|
|
||||||
//get all data
|
|
||||||
@GetMapping
|
|
||||||
public List<Strategipengadaan> getAllstrategipengadaans(){
|
|
||||||
return strategipengadaanRepository.findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
// create
|
|
||||||
@PostMapping
|
|
||||||
public Strategipengadaan createStrategipengadaan(@RequestBody Strategipengadaan strategipengadaan) {
|
|
||||||
return strategipengadaanRepository.save(strategipengadaan);
|
|
||||||
}
|
|
||||||
|
|
||||||
// get strategipengadaan by id rest api
|
|
||||||
@GetMapping("/{id}")
|
|
||||||
public ResponseEntity<Strategipengadaan> getStrategipengadaanById(@PathVariable Long id) {
|
|
||||||
Strategipengadaan strategipengadaan = strategipengadaanRepository.findById(id)
|
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Strategipengadaan not exist with id :" + id));
|
|
||||||
return ResponseEntity.ok(strategipengadaan);
|
|
||||||
}
|
|
||||||
|
|
||||||
// update strategipengadaan rest api
|
|
||||||
@PutMapping("/{id}")
|
|
||||||
public ResponseEntity<Strategipengadaan> updateStrategipengadaan(@PathVariable Long id, @RequestBody Strategipengadaan strategipengadaanDetails){
|
|
||||||
Strategipengadaan strategipengadaan = strategipengadaanRepository.findById(id)
|
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Strategipengadaan not exist with id :" + id));
|
|
||||||
|
|
||||||
strategipengadaan.setStrategipengadaan(strategipengadaanDetails.getStrategipengadaan());
|
|
||||||
strategipengadaan.setKeterangan(strategipengadaanDetails.getKeterangan());
|
|
||||||
|
|
||||||
Strategipengadaan updatedStrategipengadaan = strategipengadaanRepository.save(strategipengadaan);
|
|
||||||
return ResponseEntity.ok(updatedStrategipengadaan);
|
|
||||||
}
|
|
||||||
|
|
||||||
// delete strategipengadaan rest api
|
|
||||||
@DeleteMapping("/{id}")
|
|
||||||
public ResponseEntity<Map<String, Boolean>> deleteStrategipengadaan(@PathVariable Long id){
|
|
||||||
Strategipengadaan strategipengadaan = strategipengadaanRepository.findById(id)
|
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Strategipengadaan not exist with id :" + id));
|
|
||||||
|
|
||||||
strategipengadaanRepository.delete(strategipengadaan);
|
|
||||||
Map<String, Boolean> response = new HashMap<>();
|
|
||||||
response.put("deleted", Boolean.TRUE);
|
|
||||||
return ResponseEntity.ok(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -0,0 +1,73 @@
|
|||||||
|
package com.iconplus.smartproc.controller;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
|
import com.iconplus.smartproc.model.request.SumberDanaRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.GetListSumberDanaResponse;
|
||||||
|
import com.iconplus.smartproc.model.response.SumberDanaResponse;
|
||||||
|
import com.iconplus.smartproc.service.sumberdana.*;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@CrossOrigin(origins = "${fe.server}", allowCredentials = "true")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/sumberdana")
|
||||||
|
public class SumberDanaController {
|
||||||
|
|
||||||
|
private GetListSumberDanaService getListSumberDanaService;
|
||||||
|
private PostCreateSumberDanaService postCreateSumberDanaService;
|
||||||
|
private DeleteSumberDanaService deleteSumberDanaService;
|
||||||
|
private GetSumberDanaService getSumberDanaService;
|
||||||
|
private PutSumberDanaService putSumberDanaService;
|
||||||
|
|
||||||
|
public SumberDanaController(GetListSumberDanaService getListSumberDanaService,
|
||||||
|
PostCreateSumberDanaService postCreateSumberDanaService,
|
||||||
|
DeleteSumberDanaService deleteSumberDanaService,
|
||||||
|
GetSumberDanaService getSumberDanaService,
|
||||||
|
PutSumberDanaService putSumberDanaService) {
|
||||||
|
this.getListSumberDanaService = getListSumberDanaService;
|
||||||
|
this.postCreateSumberDanaService = postCreateSumberDanaService;
|
||||||
|
this.deleteSumberDanaService = deleteSumberDanaService;
|
||||||
|
this.getSumberDanaService = getSumberDanaService;
|
||||||
|
this.putSumberDanaService = putSumberDanaService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public GetListSumberDanaResponse getListSumberDana(@RequestParam(name = "search", required = false) String search,
|
||||||
|
@RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||||
|
@RequestParam(name = "size", defaultValue = "5") Integer size){
|
||||||
|
|
||||||
|
Pageable pageable = PageRequest.of((page - 1), size);
|
||||||
|
SumberDanaRequest sumberDanaRequest = SumberDanaRequest.builder()
|
||||||
|
.search(search)
|
||||||
|
.pageable(pageable)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
return getListSumberDanaService.execute(sumberDanaRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public SumberDanaResponse createSumberDana(@RequestBody SumberDanaRequest request) {
|
||||||
|
return postCreateSumberDanaService.execute(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public SumberDanaResponse getSumberDanaById(@PathVariable Long id) {
|
||||||
|
return getSumberDanaService.execute(SumberDanaRequest.builder()
|
||||||
|
.id(id)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
public SumberDanaResponse updateBidang(@PathVariable Long id, @RequestBody SumberDanaRequest request){
|
||||||
|
request.setId(id);
|
||||||
|
return putSumberDanaService.execute(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public EmptyResponse deleteBidang(@PathVariable Long id){
|
||||||
|
return deleteSumberDanaService.execute(SumberDanaRequest.builder()
|
||||||
|
.id(id)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
}
|
@ -1,78 +0,0 @@
|
|||||||
package com.iconplus.smartproc.controller;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
|
||||||
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.iconplus.smartproc.exception.ResourceNotFoundException;
|
|
||||||
import com.iconplus.smartproc.entity.Sumberdana;
|
|
||||||
import com.iconplus.smartproc.repository.SumberdanaRepository;
|
|
||||||
|
|
||||||
@CrossOrigin(origins = "http://localhost:8080", allowCredentials = "true")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/sumberdana")
|
|
||||||
public class SumberdanaController {
|
|
||||||
@Autowired
|
|
||||||
private SumberdanaRepository sumberdanaRepository;
|
|
||||||
|
|
||||||
//get all data
|
|
||||||
@GetMapping
|
|
||||||
public List<Sumberdana> getAllSumberdanas(){
|
|
||||||
return sumberdanaRepository.findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
// create
|
|
||||||
@PostMapping
|
|
||||||
public Sumberdana createSumberdana(@RequestBody Sumberdana sumberdana) {
|
|
||||||
return sumberdanaRepository.save(sumberdana);
|
|
||||||
}
|
|
||||||
|
|
||||||
// get sumberdana by id rest api
|
|
||||||
@GetMapping("/{id}")
|
|
||||||
public ResponseEntity<Sumberdana> getSumberdanaById(@PathVariable Long id) {
|
|
||||||
Sumberdana sumberdana = sumberdanaRepository.findById(id)
|
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Sumberdana not exist with id :" + id));
|
|
||||||
return ResponseEntity.ok(sumberdana);
|
|
||||||
}
|
|
||||||
|
|
||||||
// update sumberdana rest api
|
|
||||||
@PutMapping("/{id}")
|
|
||||||
public ResponseEntity<Sumberdana> updateSumberdana(@PathVariable Long id, @RequestBody Sumberdana sumberdanaDetails){
|
|
||||||
Sumberdana sumberdana = sumberdanaRepository.findById(id)
|
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Sumberdana not exist with id :" + id));
|
|
||||||
|
|
||||||
sumberdana.setSumberdana(sumberdanaDetails.getSumberdana());
|
|
||||||
sumberdana.setKeterangan(sumberdanaDetails.getKeterangan());
|
|
||||||
|
|
||||||
Sumberdana updatedSumberdana = sumberdanaRepository.save(sumberdana);
|
|
||||||
return ResponseEntity.ok(updatedSumberdana);
|
|
||||||
}
|
|
||||||
|
|
||||||
// delete sumberdana rest api
|
|
||||||
@DeleteMapping("/{id}")
|
|
||||||
public ResponseEntity<Map<String, Boolean>> deleteSumberdana(@PathVariable Long id){
|
|
||||||
Sumberdana sumberdana = sumberdanaRepository.findById(id)
|
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Sumberdana not exist with id :" + id));
|
|
||||||
|
|
||||||
sumberdanaRepository.delete(sumberdana);
|
|
||||||
Map<String, Boolean> response = new HashMap<>();
|
|
||||||
response.put("deleted", Boolean.TRUE);
|
|
||||||
return ResponseEntity.ok(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -0,0 +1,82 @@
|
|||||||
|
package com.iconplus.smartproc.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
|
import com.iconplus.smartproc.model.request.SupplyPositioningMatrixRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.GetListSupplyPositioningMatrixResponse;
|
||||||
|
import com.iconplus.smartproc.model.response.SupplyPositioningMatrixResponse;
|
||||||
|
import com.iconplus.smartproc.repository.SupplyPositioningMatrixRepository;
|
||||||
|
import com.iconplus.smartproc.service.supplypositioningmatrix.*;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@CrossOrigin(origins = "${fe.server}", allowCredentials = "true")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/supplypositioningmatrix")
|
||||||
|
public class SupplyPositioningMatrixController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SupplyPositioningMatrixRepository supplypositioningmatrixRepository;
|
||||||
|
|
||||||
|
private final GetListSupplyPositioningMatrixService getListSupplyPositioningMatrixService;
|
||||||
|
private final GetSupplyPositioningMatrixByIdService getSupplyPositioningMatrixByIdService;
|
||||||
|
private final PostCreateSupplyPositioningMatrixService postCreateSupplyPositioningMatrixService;
|
||||||
|
private final PutUpdateSupplyPositioningMatrixService putUpdateSupplyPositioningMatrixService;
|
||||||
|
private final DeleteSupplyPositioningMatrixService deleteSupplyPositioningMatrixService;
|
||||||
|
|
||||||
|
public SupplyPositioningMatrixController(GetListSupplyPositioningMatrixService getListSupplyPositioningMatrixService,
|
||||||
|
GetSupplyPositioningMatrixByIdService getSupplyPositioningMatrixByIdService,
|
||||||
|
PostCreateSupplyPositioningMatrixService postCreateSupplyPositioningMatrixService,
|
||||||
|
PutUpdateSupplyPositioningMatrixService putUpdateSupplyPositioningMatrixService,
|
||||||
|
DeleteSupplyPositioningMatrixService deleteSupplyPositioningMatrixService) {
|
||||||
|
this.getListSupplyPositioningMatrixService = getListSupplyPositioningMatrixService;
|
||||||
|
this.getSupplyPositioningMatrixByIdService = getSupplyPositioningMatrixByIdService;
|
||||||
|
this.postCreateSupplyPositioningMatrixService = postCreateSupplyPositioningMatrixService;
|
||||||
|
this.putUpdateSupplyPositioningMatrixService = putUpdateSupplyPositioningMatrixService;
|
||||||
|
this.deleteSupplyPositioningMatrixService = deleteSupplyPositioningMatrixService;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public GetListSupplyPositioningMatrixResponse getListSupplyPositioningMatrix(@RequestParam(name = "search", required = false) String search,
|
||||||
|
@RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||||
|
@RequestParam(name = "size", defaultValue = "5") Integer size){
|
||||||
|
|
||||||
|
Pageable pageable = PageRequest.of((page - 1), size);
|
||||||
|
SupplyPositioningMatrixRequest supplyPositioningMatrixRequest = SupplyPositioningMatrixRequest.builder()
|
||||||
|
.search(search)
|
||||||
|
.pageable(pageable)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
return getListSupplyPositioningMatrixService.execute(supplyPositioningMatrixRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public SupplyPositioningMatrixResponse createSupplyPositioningMatrix(@RequestBody SupplyPositioningMatrixRequest supplyPositioningMatrixRequest) {
|
||||||
|
return postCreateSupplyPositioningMatrixService.execute(supplyPositioningMatrixRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public SupplyPositioningMatrixResponse getSupplyPositioningMatrixById(@PathVariable Long id) {
|
||||||
|
return getSupplyPositioningMatrixByIdService.execute(SupplyPositioningMatrixRequest.builder()
|
||||||
|
.id(id)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
public SupplyPositioningMatrixResponse updateSupplyPositioningmatrix(@PathVariable Long id,
|
||||||
|
@RequestBody SupplyPositioningMatrixRequest supplyPositioningMatrixRequest){
|
||||||
|
supplyPositioningMatrixRequest.setId(id);
|
||||||
|
return putUpdateSupplyPositioningMatrixService.execute(supplyPositioningMatrixRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public EmptyResponse deleteSupplyPositioningMatrix(@PathVariable Long id) {
|
||||||
|
return deleteSupplyPositioningMatrixService.execute(SupplyPositioningMatrixRequest.builder()
|
||||||
|
.id(id)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
}
|
@ -1,74 +0,0 @@
|
|||||||
package com.iconplus.smartproc.controller;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
|
||||||
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.iconplus.smartproc.exception.ResourceNotFoundException;
|
|
||||||
import com.iconplus.smartproc.entity.Supplypositioningmatrix;
|
|
||||||
import com.iconplus.smartproc.repository.SupplypositioningmatrixRepository;
|
|
||||||
|
|
||||||
@CrossOrigin(origins = "http://localhost:8080", allowCredentials = "true")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/supplypositioningmatrix")
|
|
||||||
public class SupplypositioningmatrixController {
|
|
||||||
@Autowired
|
|
||||||
private SupplypositioningmatrixRepository supplypositioningmatrixRepository;
|
|
||||||
|
|
||||||
//get all data
|
|
||||||
@GetMapping
|
|
||||||
public List<Supplypositioningmatrix> getAllSupplypositioningmatrix(){
|
|
||||||
return supplypositioningmatrixRepository.findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
// create
|
|
||||||
@PostMapping
|
|
||||||
public Supplypositioningmatrix createSupplypositioningmatrix(@RequestBody Supplypositioningmatrix supplypositioningmatrix) {
|
|
||||||
return supplypositioningmatrixRepository.save(supplypositioningmatrix);
|
|
||||||
}
|
|
||||||
|
|
||||||
// get supplypositioningmatrix by id rest api
|
|
||||||
@GetMapping("/{id}")
|
|
||||||
public ResponseEntity<Supplypositioningmatrix> getSupplypositioningmatrixById(@PathVariable Long id) {
|
|
||||||
Supplypositioningmatrix supplypositioningmatrix = supplypositioningmatrixRepository.findById(id)
|
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Supplypositioningmatrix not exist with id :" + id));
|
|
||||||
return ResponseEntity.ok(supplypositioningmatrix);
|
|
||||||
}
|
|
||||||
|
|
||||||
// update jenispengadaan rest api
|
|
||||||
@PutMapping("/{id}")
|
|
||||||
public ResponseEntity<Supplypositioningmatrix> updateSupplypositioningmatrix(@PathVariable Long id, @RequestBody Supplypositioningmatrix supplypositioningmatrixDetails){
|
|
||||||
Supplypositioningmatrix supplypositioningmatrix = supplypositioningmatrixRepository.findById(id)
|
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Supplypositioningmatrix not exist with id :" + id));
|
|
||||||
|
|
||||||
supplypositioningmatrix.setSupplypositioningmatrix(supplypositioningmatrixDetails.getSupplypositioningmatrix());
|
|
||||||
supplypositioningmatrix.setKeterangan(supplypositioningmatrixDetails.getKeterangan());
|
|
||||||
|
|
||||||
Supplypositioningmatrix updatedSupplypositioningmatrix = supplypositioningmatrixRepository.save(supplypositioningmatrix);
|
|
||||||
return ResponseEntity.ok(updatedSupplypositioningmatrix);
|
|
||||||
}
|
|
||||||
|
|
||||||
// delete jenispengadaan rest api
|
|
||||||
@DeleteMapping("/{id}")
|
|
||||||
public ResponseEntity<Map<String, Boolean>> deleteSupplypositioningmatrix(@PathVariable Long id){
|
|
||||||
Supplypositioningmatrix supplypositioningmatrix = supplypositioningmatrixRepository.findById(id)
|
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Unit inisiator not exist with id :" + id));
|
|
||||||
|
|
||||||
supplypositioningmatrixRepository.delete(supplypositioningmatrix);
|
|
||||||
Map<String, Boolean> response = new HashMap<>();
|
|
||||||
response.put("deleted", Boolean.TRUE);
|
|
||||||
return ResponseEntity.ok(response);
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,76 @@
|
|||||||
|
package com.iconplus.smartproc.controller;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
|
import com.iconplus.smartproc.model.request.UnitInisiatorRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.GetListUnitInisiatorResponse;
|
||||||
|
import com.iconplus.smartproc.model.response.UnitInisiatorResponse;
|
||||||
|
import com.iconplus.smartproc.service.unitinisiator.*;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@CrossOrigin(origins = "${fe.server}", allowCredentials = "true")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/unitinisiator")
|
||||||
|
public class UnitInisiatorController {
|
||||||
|
|
||||||
|
private final GetUnitInisiatorService getUnitInisiatorService;
|
||||||
|
private final GetListUnitInisiatorService getListUnitInisiatorService;
|
||||||
|
private final PostCreateUnitInisiatorService postCreateUnitInisiatorService;
|
||||||
|
private final DeleteUnitInisiatorService deleteUnitInisiatorService;
|
||||||
|
private final PutUpdateUnitInisiatorService putUpdateUnitInisiatorService;
|
||||||
|
|
||||||
|
public UnitInisiatorController(GetUnitInisiatorService getUnitInisiatorService,
|
||||||
|
GetListUnitInisiatorService getListUnitInisiatorService,
|
||||||
|
PostCreateUnitInisiatorService postCreateUnitInisiatorService,
|
||||||
|
DeleteUnitInisiatorService deleteUnitInisiatorService,
|
||||||
|
PutUpdateUnitInisiatorService putUpdateUnitInisiatorService) {
|
||||||
|
this.getUnitInisiatorService = getUnitInisiatorService;
|
||||||
|
this.getListUnitInisiatorService = getListUnitInisiatorService;
|
||||||
|
this.postCreateUnitInisiatorService = postCreateUnitInisiatorService;
|
||||||
|
this.deleteUnitInisiatorService = deleteUnitInisiatorService;
|
||||||
|
this.putUpdateUnitInisiatorService = putUpdateUnitInisiatorService;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public GetListUnitInisiatorResponse getListUnitInisiator(@RequestParam(name = "search", required = false) String search,
|
||||||
|
@RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||||
|
@RequestParam(name = "size", defaultValue = "5") Integer size){
|
||||||
|
|
||||||
|
Pageable pageable = PageRequest.of((page - 1), size);
|
||||||
|
UnitInisiatorRequest unitInisiatorRequest = UnitInisiatorRequest.builder()
|
||||||
|
.search(search)
|
||||||
|
.pageable(pageable)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
return getListUnitInisiatorService.execute(unitInisiatorRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public UnitInisiatorResponse createUnitInisiator(@RequestBody UnitInisiatorRequest request) {
|
||||||
|
return postCreateUnitInisiatorService.execute(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public UnitInisiatorResponse getUnitInisiator(@PathVariable Long id) {
|
||||||
|
return getUnitInisiatorService.execute(UnitInisiatorRequest.builder()
|
||||||
|
.id(id)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
public UnitInisiatorResponse updateUnitInisiator(@PathVariable Long id, @RequestBody UnitInisiatorRequest request){
|
||||||
|
request.setId(id);
|
||||||
|
return putUpdateUnitInisiatorService.execute(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public EmptyResponse deleteUnitInisiator(@PathVariable Long id){
|
||||||
|
return deleteUnitInisiatorService.execute(UnitInisiatorRequest.builder()
|
||||||
|
.id(id)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,74 +0,0 @@
|
|||||||
package com.iconplus.smartproc.controller;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
|
||||||
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.iconplus.smartproc.exception.ResourceNotFoundException;
|
|
||||||
import com.iconplus.smartproc.entity.Unitinisiator;
|
|
||||||
import com.iconplus.smartproc.repository.UnitinisiatorRepository;
|
|
||||||
|
|
||||||
@CrossOrigin(origins = "http://localhost:8080", allowCredentials = "true")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/unitinisiator")
|
|
||||||
public class UnitinisiatorController {
|
|
||||||
@Autowired
|
|
||||||
private UnitinisiatorRepository unitinisiatorRepository;
|
|
||||||
|
|
||||||
//get all data
|
|
||||||
@GetMapping
|
|
||||||
public List<Unitinisiator> getAllUnitinisiator(){
|
|
||||||
return unitinisiatorRepository.findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
// create
|
|
||||||
@PostMapping
|
|
||||||
public Unitinisiator createUnitinisiator(@RequestBody Unitinisiator unitinisiator) {
|
|
||||||
return unitinisiatorRepository.save(unitinisiator);
|
|
||||||
}
|
|
||||||
|
|
||||||
// get unitinisiator by id rest api
|
|
||||||
@GetMapping("/{id}")
|
|
||||||
public ResponseEntity<Unitinisiator> getUnitinisiatorById(@PathVariable Long id) {
|
|
||||||
Unitinisiator unitinisiator = unitinisiatorRepository.findById(id)
|
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Unitinisiator not exist with id :" + id));
|
|
||||||
return ResponseEntity.ok(unitinisiator);
|
|
||||||
}
|
|
||||||
|
|
||||||
// update jenispengadaan rest api
|
|
||||||
@PutMapping("/{id}")
|
|
||||||
public ResponseEntity<Unitinisiator> updateUnitinisiator(@PathVariable Long id, @RequestBody Unitinisiator unitinisiatorDetails){
|
|
||||||
Unitinisiator unitinisiator = unitinisiatorRepository.findById(id)
|
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Unitinisiator not exist with id :" + id));
|
|
||||||
|
|
||||||
unitinisiator.setUnitinisiator(unitinisiatorDetails.getUnitinisiator());
|
|
||||||
unitinisiator.setKeterangan(unitinisiatorDetails.getKeterangan());
|
|
||||||
|
|
||||||
Unitinisiator updatedUnitinisiator = unitinisiatorRepository.save(unitinisiator);
|
|
||||||
return ResponseEntity.ok(updatedUnitinisiator);
|
|
||||||
}
|
|
||||||
|
|
||||||
// delete jenispengadaan rest api
|
|
||||||
@DeleteMapping("/{id}")
|
|
||||||
public ResponseEntity<Map<String, Boolean>> deleteUnitinisiator(@PathVariable Long id){
|
|
||||||
Unitinisiator unitinisiator = unitinisiatorRepository.findById(id)
|
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Unit inisiator not exist with id :" + id));
|
|
||||||
|
|
||||||
unitinisiatorRepository.delete(unitinisiator);
|
|
||||||
Map<String, Boolean> response = new HashMap<>();
|
|
||||||
response.put("deleted", Boolean.TRUE);
|
|
||||||
return ResponseEntity.ok(response);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,71 +1,85 @@
|
|||||||
package com.iconplus.smartproc.controller;
|
package com.iconplus.smartproc.controller;
|
||||||
|
|
||||||
import com.iconplus.smartproc.entity.Users;
|
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
import com.iconplus.smartproc.exception.ResourceNotFoundException;
|
import com.iconplus.smartproc.model.request.UsersRequest;
|
||||||
import com.iconplus.smartproc.repository.UsersRepository;
|
import com.iconplus.smartproc.model.response.GetUsersResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import com.iconplus.smartproc.model.response.UsersResponse;
|
||||||
import org.springframework.http.ResponseEntity;
|
import com.iconplus.smartproc.service.manajemenuser.*;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.HashMap;
|
@CrossOrigin(origins = "${fe.server}", allowCredentials = "true")
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@CrossOrigin(origins = "http://localhost:8080", allowCredentials = "true")
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/users")
|
@RequestMapping("/api/users")
|
||||||
public class UsersController {
|
public class UsersController {
|
||||||
@Autowired
|
|
||||||
private UsersRepository usersRepository;
|
|
||||||
|
|
||||||
//get all data
|
private final GetListUserService getListUserService;
|
||||||
|
private final PostCreateUserService postCreateUserService;
|
||||||
|
private final PutUpdateUserService putUpdateUserService;
|
||||||
|
private final GetUserByIdService getUserByIdService;
|
||||||
|
private final DeleteUserService deleteUserService;
|
||||||
|
public UsersController(GetListUserService getListUserService,
|
||||||
|
PostCreateUserService postCreateUserService,
|
||||||
|
PutUpdateUserService putUpdateUserService,
|
||||||
|
GetUserByIdService getUserByIdService,
|
||||||
|
DeleteUserService deleteUserService) {
|
||||||
|
this.getListUserService = getListUserService;
|
||||||
|
this.postCreateUserService = postCreateUserService;
|
||||||
|
this.putUpdateUserService = putUpdateUserService;
|
||||||
|
this.getUserByIdService = getUserByIdService;
|
||||||
|
this.deleteUserService = deleteUserService;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public List<Users> getAllUserss(){
|
public GetUsersResponse getUsers(@RequestParam(name = "search", required = false) String search,
|
||||||
return usersRepository.findAll();
|
@RequestParam(name = "instansi", required = false) String instansi,
|
||||||
|
@RequestParam(name = "bidang", required = false) String bidang,
|
||||||
|
@RequestParam(name = "nama", required = false) String nama,
|
||||||
|
@RequestParam(name = "jabatan", required = false) String jabatan,
|
||||||
|
@RequestParam(name = "role", required = false) String role,
|
||||||
|
@RequestParam(name = "email", required = false) String email,
|
||||||
|
@RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||||
|
@RequestParam(name = "size", defaultValue = "5") Integer size){
|
||||||
|
|
||||||
|
Pageable pageable = PageRequest.of((page - 1), size);
|
||||||
|
UsersRequest usersRequest = UsersRequest.builder()
|
||||||
|
.search(search)
|
||||||
|
.instansi(instansi)
|
||||||
|
.bidang(bidang)
|
||||||
|
.nama(nama)
|
||||||
|
.jabatan(jabatan)
|
||||||
|
.role(role)
|
||||||
|
.email(email)
|
||||||
|
.pageable(pageable)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
return getListUserService.execute(usersRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
// create
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public Users createUsers(@RequestBody Users users) {
|
public UsersResponse createUsers(@RequestBody UsersRequest request) {
|
||||||
return usersRepository.save(users);
|
return postCreateUserService.execute(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
// get users by id rest api
|
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public ResponseEntity<Users> getUsersById(@PathVariable Long id) {
|
public UsersResponse getUsersById(@PathVariable Long id) {
|
||||||
Users users = usersRepository.findById(id)
|
return getUserByIdService.execute(UsersRequest.builder()
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Users not exist with id :" + id));
|
.id(id)
|
||||||
return ResponseEntity.ok(users);
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
// update users rest api
|
|
||||||
@PutMapping("/{id}")
|
@PutMapping("/{id}")
|
||||||
public ResponseEntity<Users> updateUsers(@PathVariable Long id, @RequestBody Users usersDetails){
|
public UsersResponse updateUsers(@PathVariable Long id, @RequestBody UsersRequest request){
|
||||||
Users users = usersRepository.findById(id)
|
request.setId(id);
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Users not exist with id :" + id));
|
return putUpdateUserService.execute(request);
|
||||||
|
|
||||||
users.setUsername(usersDetails.getUsername());
|
|
||||||
users.setNama(usersDetails.getNama());
|
|
||||||
users.setEmail(usersDetails.getEmail());
|
|
||||||
users.setPassword(usersDetails.getPassword());
|
|
||||||
users.setInstansi(usersDetails.getInstansi());
|
|
||||||
users.setBidang(usersDetails.getBidang());
|
|
||||||
users.setJabatan(usersDetails.getJabatan());
|
|
||||||
users.setRole(usersDetails.getRole());
|
|
||||||
|
|
||||||
Users updatedUsers = usersRepository.save(users);
|
|
||||||
return ResponseEntity.ok(updatedUsers);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete users rest api
|
|
||||||
@DeleteMapping("/{id}")
|
@DeleteMapping("/{id}")
|
||||||
public ResponseEntity<Map<String, Boolean>> deleteUsers(@PathVariable Long id){
|
public EmptyResponse deleteUsers(@PathVariable Long id){
|
||||||
Users users = usersRepository.findById(id)
|
return deleteUserService.execute(UsersRequest.builder()
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Users not exist with id :" + id));
|
.id(id)
|
||||||
|
.build());
|
||||||
usersRepository.delete(users);
|
|
||||||
Map<String, Boolean> response = new HashMap<>();
|
|
||||||
response.put("deleted", Boolean.TRUE);
|
|
||||||
return ResponseEntity.ok(response);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,40 +0,0 @@
|
|||||||
package com.iconplus.smartproc.entity;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
@Table(name = "jenisanggaran")
|
|
||||||
public class Jenisanggaran {
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
private long id;
|
|
||||||
private String jenisanggaran;
|
|
||||||
private String keterangan;
|
|
||||||
|
|
||||||
public Jenisanggaran() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public Jenisanggaran(String jenisanggaran, String keterangan) {
|
|
||||||
super();
|
|
||||||
this.jenisanggaran = jenisanggaran;
|
|
||||||
this.keterangan = keterangan;
|
|
||||||
}
|
|
||||||
public long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setId(long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
public String getJenisanggaran() {
|
|
||||||
return jenisanggaran;
|
|
||||||
}
|
|
||||||
public void setJenisanggaran(String jenisanggaran) {
|
|
||||||
this.jenisanggaran = jenisanggaran;
|
|
||||||
}
|
|
||||||
public String getKeterangan() {
|
|
||||||
return keterangan;
|
|
||||||
}
|
|
||||||
public void setKeterangan(String keterangan) {
|
|
||||||
this.keterangan = keterangan;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
package com.iconplus.smartproc.entity;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
@Table(name = "jeniskontrak")
|
|
||||||
public class Jeniskontrak {
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
private long id;
|
|
||||||
|
|
||||||
private String jeniskontrak;
|
|
||||||
private String keterangan;
|
|
||||||
|
|
||||||
public Jeniskontrak() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public Jeniskontrak(String jeniskontrak, String keterangan) {
|
|
||||||
super();
|
|
||||||
this.jeniskontrak = jeniskontrak;
|
|
||||||
this.keterangan = keterangan;
|
|
||||||
}
|
|
||||||
public long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setId(long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
public String getJeniskontrak() {
|
|
||||||
return jeniskontrak;
|
|
||||||
}
|
|
||||||
public void setJeniskontrak(String jeniskontrak) {
|
|
||||||
this.jeniskontrak = jeniskontrak;
|
|
||||||
}
|
|
||||||
public String getKeterangan() {
|
|
||||||
return keterangan;
|
|
||||||
}
|
|
||||||
public void setKeterangan(String keterangan) {
|
|
||||||
this.keterangan = keterangan;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
package com.iconplus.smartproc.entity;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
@Table(name = "jenispengadaan")
|
|
||||||
public class Jenispengadaan {
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
private long id;
|
|
||||||
private String jenispengadaan;
|
|
||||||
private String keterangan;
|
|
||||||
|
|
||||||
public Jenispengadaan() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public Jenispengadaan(String jenispengadaan, String keterangan) {
|
|
||||||
super();
|
|
||||||
this.jenispengadaan = jenispengadaan;
|
|
||||||
this.keterangan = keterangan;
|
|
||||||
}
|
|
||||||
public long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setId(long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
public String getJenispengadaan() {
|
|
||||||
return jenispengadaan;
|
|
||||||
}
|
|
||||||
public void setJenispengadaan(String jenispengadaan) {
|
|
||||||
this.jenispengadaan = jenispengadaan;
|
|
||||||
}
|
|
||||||
public String getKeterangan() {
|
|
||||||
return keterangan;
|
|
||||||
}
|
|
||||||
public void setKeterangan(String keterangan) {
|
|
||||||
this.keterangan = keterangan;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
package com.iconplus.smartproc.entity;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
@Table(name = "lokasi")
|
|
||||||
public class Lokasi {
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
private long id;
|
|
||||||
private String lokasi;
|
|
||||||
private String keterangan;
|
|
||||||
|
|
||||||
public Lokasi() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public Lokasi(String lokasi, String keterangan) {
|
|
||||||
super();
|
|
||||||
this.lokasi = lokasi;
|
|
||||||
this.keterangan = keterangan;
|
|
||||||
}
|
|
||||||
public long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setId(long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
public String getLokasi() {
|
|
||||||
return lokasi;
|
|
||||||
}
|
|
||||||
public void setLokasi(String lokasi) {
|
|
||||||
this.lokasi = lokasi;
|
|
||||||
}
|
|
||||||
public String getKeterangan() {
|
|
||||||
return keterangan;
|
|
||||||
}
|
|
||||||
public void setKeterangan(String keterangan) {
|
|
||||||
this.keterangan = keterangan;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
package com.iconplus.smartproc.entity;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
@Table(name = "metodepengadaan")
|
|
||||||
public class Metodepengadaan {
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
private long id;
|
|
||||||
|
|
||||||
private String metodepengadaan;
|
|
||||||
private String keterangan;
|
|
||||||
|
|
||||||
public Metodepengadaan() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public Metodepengadaan(String metodepengadaan, String keterangan) {
|
|
||||||
super();
|
|
||||||
this.metodepengadaan = metodepengadaan;
|
|
||||||
this.keterangan = keterangan;
|
|
||||||
}
|
|
||||||
public long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setId(long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
public String getMetodepengadaan() {
|
|
||||||
return metodepengadaan;
|
|
||||||
}
|
|
||||||
public void setMetodepengadaan(String metodepengadaan) {
|
|
||||||
this.metodepengadaan = metodepengadaan;
|
|
||||||
}
|
|
||||||
public String getKeterangan() {
|
|
||||||
return keterangan;
|
|
||||||
}
|
|
||||||
public void setKeterangan(String keterangan) {
|
|
||||||
this.keterangan = keterangan;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
package com.iconplus.smartproc.entity;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
@Table(name = "metodepenyampaian")
|
|
||||||
public class Metodepenyampaian {
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
private long id;
|
|
||||||
|
|
||||||
private String metodepenyampaian;
|
|
||||||
private String keterangan;
|
|
||||||
|
|
||||||
public Metodepenyampaian() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public Metodepenyampaian(String metodepenyampaian, String keterangan) {
|
|
||||||
super();
|
|
||||||
this.metodepenyampaian = metodepenyampaian;
|
|
||||||
this.keterangan = keterangan;
|
|
||||||
}
|
|
||||||
public long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setId(long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
public String getMetodepenyampaian() {
|
|
||||||
return metodepenyampaian;
|
|
||||||
}
|
|
||||||
public void setMetodepenyampaian(String metodepenyampaian) {
|
|
||||||
this.metodepenyampaian = metodepenyampaian;
|
|
||||||
}
|
|
||||||
public String getKeterangan() {
|
|
||||||
return keterangan;
|
|
||||||
}
|
|
||||||
public void setKeterangan(String keterangan) {
|
|
||||||
this.keterangan = keterangan;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
package com.iconplus.smartproc.entity;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
@Table(name = "roles")
|
|
||||||
public class Roles {
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
private long id;
|
|
||||||
private String roles;
|
|
||||||
private String keterangan;
|
|
||||||
private Boolean is_active;
|
|
||||||
|
|
||||||
public Roles() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public Roles(String roles, String keterangan, Boolean is_active) {
|
|
||||||
super();
|
|
||||||
this.roles = roles;
|
|
||||||
this.keterangan = keterangan;
|
|
||||||
this.is_active = is_active;
|
|
||||||
}
|
|
||||||
public long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setId(long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
public String getRoles() {
|
|
||||||
return roles;
|
|
||||||
}
|
|
||||||
public void setRoles(String roles) {
|
|
||||||
this.roles = roles;
|
|
||||||
}
|
|
||||||
public String getKeterangan() {
|
|
||||||
return keterangan;
|
|
||||||
}
|
|
||||||
public void setKeterangan(String keterangan) {
|
|
||||||
this.keterangan = keterangan;
|
|
||||||
}
|
|
||||||
public Boolean getIsactive() {
|
|
||||||
return is_active;
|
|
||||||
}
|
|
||||||
public void setIsactive(Boolean is_active) {
|
|
||||||
this.is_active = is_active;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
package com.iconplus.smartproc.entity;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
@Table(name = "strategipengadaan")
|
|
||||||
public class Strategipengadaan {
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
private long id;
|
|
||||||
private String strategipengadaan;
|
|
||||||
private String keterangan;
|
|
||||||
|
|
||||||
public Strategipengadaan() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public Strategipengadaan(String strategipengadaan, String keterangan) {
|
|
||||||
super();
|
|
||||||
this.strategipengadaan = strategipengadaan;
|
|
||||||
this.keterangan = keterangan;
|
|
||||||
}
|
|
||||||
public long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setId(long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
public String getStrategipengadaan() {
|
|
||||||
return strategipengadaan;
|
|
||||||
}
|
|
||||||
public void setStrategipengadaan(String strategipengadaan) {
|
|
||||||
this.strategipengadaan = strategipengadaan;
|
|
||||||
}
|
|
||||||
public String getKeterangan() {
|
|
||||||
return keterangan;
|
|
||||||
}
|
|
||||||
public void setKeterangan(String keterangan) {
|
|
||||||
this.keterangan = keterangan;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
package com.iconplus.smartproc.entity;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
@Table(name = "sumberdana")
|
|
||||||
public class Sumberdana {
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
private long id;
|
|
||||||
private String sumberdana;
|
|
||||||
private String keterangan;
|
|
||||||
|
|
||||||
public Sumberdana() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public Sumberdana(String sumberdana, String keterangan) {
|
|
||||||
super();
|
|
||||||
this.sumberdana = sumberdana;
|
|
||||||
this.keterangan = keterangan;
|
|
||||||
}
|
|
||||||
public long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setId(long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
public String getSumberdana() {
|
|
||||||
return sumberdana;
|
|
||||||
}
|
|
||||||
public void setSumberdana(String sumberdana) {
|
|
||||||
this.sumberdana = sumberdana;
|
|
||||||
}
|
|
||||||
public String getKeterangan() {
|
|
||||||
return keterangan;
|
|
||||||
}
|
|
||||||
public void setKeterangan(String keterangan) {
|
|
||||||
this.keterangan = keterangan;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
package com.iconplus.smartproc.entity;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
@Table(name = "supplypositioningmatrix")
|
|
||||||
public class Supplypositioningmatrix {
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
private long id;
|
|
||||||
|
|
||||||
private String supplypositioningmatrix;
|
|
||||||
private String keterangan;
|
|
||||||
|
|
||||||
public Supplypositioningmatrix() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public Supplypositioningmatrix(String supplypositioningmatrix, String keterangan) {
|
|
||||||
super();
|
|
||||||
this.supplypositioningmatrix = supplypositioningmatrix;
|
|
||||||
this.keterangan = keterangan;
|
|
||||||
}
|
|
||||||
public long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setId(long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
public String getSupplypositioningmatrix() {
|
|
||||||
return supplypositioningmatrix;
|
|
||||||
}
|
|
||||||
public void setSupplypositioningmatrix(String supplypositioningmatrix) {
|
|
||||||
this.supplypositioningmatrix = supplypositioningmatrix;
|
|
||||||
}
|
|
||||||
public String getKeterangan() {
|
|
||||||
return keterangan;
|
|
||||||
}
|
|
||||||
public void setKeterangan(String keterangan) {
|
|
||||||
this.keterangan = keterangan;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
package com.iconplus.smartproc.entity;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
@Entity
|
|
||||||
@Table(name = "unitinisiator")
|
|
||||||
public class Unitinisiator {
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
private long id;
|
|
||||||
|
|
||||||
private String unitinisiator;
|
|
||||||
private String keterangan;
|
|
||||||
|
|
||||||
public Unitinisiator() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public Unitinisiator(String unitinisiator, String keterangan) {
|
|
||||||
super();
|
|
||||||
this.unitinisiator = unitinisiator;
|
|
||||||
this.keterangan = keterangan;
|
|
||||||
}
|
|
||||||
public long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setId(long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
public String getUnitinisiator() {
|
|
||||||
return unitinisiator;
|
|
||||||
}
|
|
||||||
public void setUnitinisiator(String unitinisiator) {
|
|
||||||
this.unitinisiator = unitinisiator;
|
|
||||||
}
|
|
||||||
public String getKeterangan() {
|
|
||||||
return keterangan;
|
|
||||||
}
|
|
||||||
public void setKeterangan(String keterangan) {
|
|
||||||
this.keterangan = keterangan;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,96 +0,0 @@
|
|||||||
package com.iconplus.smartproc.entity;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
@Table(name = "users")
|
|
||||||
public class Users {
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
private long id;
|
|
||||||
private String username;
|
|
||||||
private String nama;
|
|
||||||
private String email;
|
|
||||||
private String password;
|
|
||||||
private String instansi_id;
|
|
||||||
private String bidang_id;
|
|
||||||
private String jabatan;
|
|
||||||
private String role_id;
|
|
||||||
private Boolean is_active;
|
|
||||||
|
|
||||||
public Users() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public Users(String username, String nama, String email, String password, String instansi_id, String bidang_id, String jabatan, String role_id, Boolean is_active) {
|
|
||||||
super();
|
|
||||||
this.username = username;
|
|
||||||
this.nama = nama;
|
|
||||||
this.email = email;
|
|
||||||
this.password = password;
|
|
||||||
this.instansi_id = instansi_id;
|
|
||||||
this.bidang_id = bidang_id;
|
|
||||||
this.jabatan = jabatan;
|
|
||||||
this.role_id = role_id;
|
|
||||||
this.is_active = is_active;
|
|
||||||
}
|
|
||||||
public long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setId(long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
public String getUsername() {
|
|
||||||
return username;
|
|
||||||
}
|
|
||||||
public void setUsername(String username) {
|
|
||||||
this.username = username;
|
|
||||||
}
|
|
||||||
public String getNama() {
|
|
||||||
return nama;
|
|
||||||
}
|
|
||||||
public void setNama(String nama) {
|
|
||||||
this.nama = nama;
|
|
||||||
}
|
|
||||||
public String getEmail() {
|
|
||||||
return email;
|
|
||||||
}
|
|
||||||
public void setEmail(String email) {
|
|
||||||
this.email = email;
|
|
||||||
}
|
|
||||||
public String getPassword() {
|
|
||||||
return password;
|
|
||||||
}
|
|
||||||
public void setPassword(String password) {
|
|
||||||
this.password = password;
|
|
||||||
}
|
|
||||||
public String getInstansi() {
|
|
||||||
return instansi_id;
|
|
||||||
}
|
|
||||||
public void setInstansi(String instansi_id) {
|
|
||||||
this.instansi_id = instansi_id;
|
|
||||||
}
|
|
||||||
public String getBidang() {
|
|
||||||
return bidang_id;
|
|
||||||
}
|
|
||||||
public void setBidang(String bidang_id) {
|
|
||||||
this.bidang_id = bidang_id;
|
|
||||||
}
|
|
||||||
public String getJabatan() {
|
|
||||||
return jabatan;
|
|
||||||
}
|
|
||||||
public void setJabatan(String jabatan) {
|
|
||||||
this.jabatan = jabatan;
|
|
||||||
}
|
|
||||||
public String getRole() {
|
|
||||||
return role_id;
|
|
||||||
}
|
|
||||||
public void setRole(String role_id) {
|
|
||||||
this.role_id = role_id;
|
|
||||||
}
|
|
||||||
public Boolean getIsactive() {
|
|
||||||
return is_active;
|
|
||||||
}
|
|
||||||
public void setIsactive(Boolean is_active) {
|
|
||||||
this.is_active = is_active;
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,49 @@
|
|||||||
|
package com.iconplus.smartproc.exception;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@ToString
|
||||||
|
public class BaseException extends RuntimeException {
|
||||||
|
|
||||||
|
protected HttpStatus httpStatus;
|
||||||
|
protected String errorCode;
|
||||||
|
protected String errorDesc;
|
||||||
|
protected String errorMessage;
|
||||||
|
protected String rootCause;
|
||||||
|
protected Map<String, String> errorMessageMap;
|
||||||
|
|
||||||
|
|
||||||
|
public BaseException(HttpStatus httpStatus, String errorCode, String rootCause, String errorDesc, String errorMessage) {
|
||||||
|
super(rootCause);
|
||||||
|
this.httpStatus = httpStatus;
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
this.errorDesc = errorDesc;
|
||||||
|
this.errorMessage = errorMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseException(HttpStatus httpStatus, String errorCode, String rootCause) {
|
||||||
|
super(rootCause);
|
||||||
|
this.httpStatus = httpStatus;
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseException(String errorCode, String rootCause) {
|
||||||
|
super(rootCause);
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseException(HttpStatus httpStatus, String errorCode, String rootCause, Map<String, String> errorMessageMap){
|
||||||
|
super(rootCause);
|
||||||
|
this.httpStatus = httpStatus;
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
this.errorMessageMap = errorMessageMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
package com.iconplus.smartproc.exception;
|
||||||
|
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class BusinessException extends BaseException {
|
||||||
|
|
||||||
|
public BusinessException(String errorCode, String errorDesc, String errorMessage) {
|
||||||
|
super(HttpStatus.CONFLICT, errorCode, "", errorDesc, errorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BusinessException(HttpStatus httpStatus, String errorCode, String errorDesc, String errorMessage) {
|
||||||
|
super(httpStatus, errorCode, "", errorDesc, errorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BusinessException(String errorCode) {
|
||||||
|
super(HttpStatus.CONFLICT, errorCode, "");
|
||||||
|
}
|
||||||
|
public BusinessException(HttpStatus httpStatus, String errorCode) {
|
||||||
|
super(httpStatus, errorCode, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public BusinessException(String errorCode, Map<String, String> maps) {
|
||||||
|
super(HttpStatus.CONFLICT, errorCode, "", maps);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BusinessException(HttpStatus httpStatus, String errorCode, Map<String, String> maps) {
|
||||||
|
super(httpStatus, errorCode, "", maps);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BusinessException(String errorCode, String rootCause) {
|
||||||
|
super(HttpStatus.CONFLICT, errorCode, rootCause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BusinessException(HttpStatus httpStatus, String errorCode, String rootCause) {
|
||||||
|
super(httpStatus, errorCode, rootCause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BusinessException(String errorCode, String rootCause, Map<String, String> maps) {
|
||||||
|
super(HttpStatus.CONFLICT, errorCode, rootCause, maps);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BusinessException(HttpStatus httpStatus, String errorCode, String rootCause, Map<String, String> maps) {
|
||||||
|
super(httpStatus, errorCode, rootCause, maps);
|
||||||
|
}
|
||||||
|
}
|
@ -1,28 +0,0 @@
|
|||||||
package com.iconplus.smartproc.exception;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
public class ErrorDetails {
|
|
||||||
private Date timestamp;
|
|
||||||
private String message;
|
|
||||||
private String details;
|
|
||||||
|
|
||||||
public ErrorDetails(Date timestamp, String message, String details) {
|
|
||||||
super();
|
|
||||||
this.timestamp = timestamp;
|
|
||||||
this.message = message;
|
|
||||||
this.details = details;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getTimestamp() {
|
|
||||||
return timestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMessage() {
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDetails() {
|
|
||||||
return details;
|
|
||||||
}
|
|
||||||
}
|
|
116
src/main/java/com/iconplus/smartproc/exception/ErrorHelper.java
Normal file
116
src/main/java/com/iconplus/smartproc/exception/ErrorHelper.java
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
package com.iconplus.smartproc.exception;
|
||||||
|
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.apache.velocity.Template;
|
||||||
|
import org.apache.velocity.VelocityContext;
|
||||||
|
import org.apache.velocity.app.Velocity;
|
||||||
|
import org.apache.velocity.app.VelocityEngine;
|
||||||
|
import org.apache.velocity.context.Context;
|
||||||
|
import org.apache.velocity.runtime.resource.loader.StringResourceLoader;
|
||||||
|
import org.apache.velocity.runtime.resource.util.StringResourceRepository;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
|
||||||
|
import java.io.StringWriter;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static org.apache.velocity.runtime.RuntimeConstants.RESOURCE_LOADER;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@Log4j2
|
||||||
|
public class ErrorHelper {
|
||||||
|
|
||||||
|
public static final String RAW_TEMPLATE = "rawTemplate";
|
||||||
|
private final VelocityEngine engine;
|
||||||
|
|
||||||
|
public ErrorHelper() {
|
||||||
|
engine = new VelocityEngine();
|
||||||
|
this.addVelocityProperties();
|
||||||
|
engine.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResponseEntity<ErrorResponse> throwErrorException(String errorCode, HttpStatus httpStatus) {
|
||||||
|
|
||||||
|
ErrorResponse errorResponse = new ErrorResponse();
|
||||||
|
errorResponse.setCode(errorCode);
|
||||||
|
errorResponse.setTitle("Kesalahan terjadi");
|
||||||
|
errorResponse.setMessage("Kesalahan terjadi");
|
||||||
|
|
||||||
|
return new ResponseEntity<>(errorResponse, new HttpHeaders(), httpStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResponseEntity<ErrorResponse> throwErrorExceptionWithHardcodedMsg(String errorCode, HttpStatus httpStatus,
|
||||||
|
String errorDesc, String errorMsg) {
|
||||||
|
|
||||||
|
ErrorResponse errorResponse = new ErrorResponse();
|
||||||
|
errorResponse.setCode(errorCode);
|
||||||
|
errorResponse.setTitle(errorDesc);
|
||||||
|
errorResponse.setMessage(errorMsg);
|
||||||
|
return new ResponseEntity<>(errorResponse, new HttpHeaders(), httpStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResponseEntity<ErrorResponse> throwErrorExceptionWithMetadata(String errorCode, HttpStatus httpStatus,
|
||||||
|
Map<String, String> metadata) {
|
||||||
|
|
||||||
|
ErrorResponse errorResponse = new ErrorResponse();
|
||||||
|
errorResponse.setCode(errorCode);
|
||||||
|
errorResponse.setTitle("Kesalahan terjadi");
|
||||||
|
errorResponse.setMessage(transform("Kesalahan terjadi", metadata));
|
||||||
|
|
||||||
|
return new ResponseEntity<>(errorResponse, new HttpHeaders(), httpStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResponseEntity<ErrorResponse> throwErrorExceptionWithMessageAndMetadataWithoutLocalization(HttpStatus httpStatus, String errorCode, String errorTitle, String errorMessage,
|
||||||
|
Map<String, String> metadata) {
|
||||||
|
|
||||||
|
ErrorResponse errorResponse = new ErrorResponse();
|
||||||
|
errorResponse.setCode(errorCode);
|
||||||
|
errorResponse.setTitle(errorTitle);
|
||||||
|
errorResponse.setMessage(transform(errorMessage, metadata));
|
||||||
|
|
||||||
|
return new ResponseEntity<>(errorResponse, new HttpHeaders(), httpStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String transform(String rawNotificationTemplate, Map<String, String> parameters) {
|
||||||
|
|
||||||
|
VelocityContext context = this.getVelocityContext(rawNotificationTemplate, parameters);
|
||||||
|
Template template = engine.getTemplate(RAW_TEMPLATE);
|
||||||
|
|
||||||
|
StringWriter templateWriter = new StringWriter(rawNotificationTemplate.length());
|
||||||
|
template.merge(context, templateWriter);
|
||||||
|
|
||||||
|
return templateWriter.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private VelocityContext getVelocityContext(String rawNotificationTemplate, Map<String, String> parameters) {
|
||||||
|
StringResourceRepository resourceRepository = (StringResourceRepository) engine
|
||||||
|
.getApplicationAttribute(StringResourceLoader.REPOSITORY_NAME_DEFAULT);
|
||||||
|
resourceRepository.putStringResource(RAW_TEMPLATE, rawNotificationTemplate);
|
||||||
|
|
||||||
|
return new VelocityContext((Context) parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addVelocityProperties() {
|
||||||
|
Velocity.addProperty("string.resource.loader.description", "Velocity StringResource loader");
|
||||||
|
|
||||||
|
engine.addProperty(RESOURCE_LOADER, "string");
|
||||||
|
engine.addProperty("string.resource.loader.repository.static", "false");
|
||||||
|
engine.addProperty("string.resource.loader.class",
|
||||||
|
"org.apache.velocity.runtime.resource.loader.StringResourceLoader");
|
||||||
|
engine.addProperty("string.resource.loader.repository.class",
|
||||||
|
"org.apache.velocity.runtime.resource.util.StringResourceRepositoryImpl");
|
||||||
|
engine.setProperty("runtime.log.logsystem.class", "org.apache.velocity.runtime.log.NullLogChute");
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResponseEntity<ErrorResponse> throwErrorExceptionWithMessage(HttpStatus httpStatus, String errorCode, String errorTitle, String errorMessage) {
|
||||||
|
|
||||||
|
ErrorResponse errorResponse = new ErrorResponse();
|
||||||
|
errorResponse.setCode(errorCode);
|
||||||
|
errorResponse.setTitle(errorTitle);
|
||||||
|
errorResponse.setMessage(errorMessage);
|
||||||
|
|
||||||
|
return new ResponseEntity<>(errorResponse, new HttpHeaders(), httpStatus);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.iconplus.smartproc.exception;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Data
|
||||||
|
public class ErrorResponse implements Serializable {
|
||||||
|
private String code;
|
||||||
|
private String title;
|
||||||
|
private String message;
|
||||||
|
}
|
@ -0,0 +1,102 @@
|
|||||||
|
package com.iconplus.smartproc.exception;
|
||||||
|
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.validation.FieldError;
|
||||||
|
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||||
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||||
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
|
import org.springframework.web.client.HttpServerErrorException;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.TimeoutException;
|
||||||
|
|
||||||
|
@Log4j2
|
||||||
|
@ControllerAdvice
|
||||||
|
public class GlobalExceptionHandler {
|
||||||
|
|
||||||
|
private ErrorHelper errorHelper;
|
||||||
|
|
||||||
|
public GlobalExceptionHandler(ErrorHelper errorHelper) {
|
||||||
|
this.errorHelper = errorHelper;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Boolean isError = false;
|
||||||
|
private static final String DEFAULT_ERROR_CODE = "80000";
|
||||||
|
|
||||||
|
@ExceptionHandler(Exception.class)
|
||||||
|
public ResponseEntity<ErrorResponse> renderDefaultResponse(Exception ex) {
|
||||||
|
log.error("Exception occurred: ", ex);
|
||||||
|
|
||||||
|
return errorHelper.throwErrorException(DEFAULT_ERROR_CODE, HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExceptionHandler(BusinessException.class)
|
||||||
|
public ResponseEntity<ErrorResponse> renderBusinessErrorResponse(BusinessException exception) {
|
||||||
|
log.error("BusinessException occurred: ", exception);
|
||||||
|
if (Objects.nonNull(exception.getErrorMessageMap())) {
|
||||||
|
return getErrorResponseResponseEntity(exception.getErrorDesc(), exception.getErrorMessage(), exception.getErrorCode(), exception.getHttpStatus(), exception.getErrorMessageMap());
|
||||||
|
}
|
||||||
|
|
||||||
|
return getErrorResponseResponseEntity(exception.getErrorDesc(), exception.getErrorMessage(), exception.getErrorCode(), exception.getHttpStatus(), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ExceptionHandler(TechnicalException.class)
|
||||||
|
public ResponseEntity<ErrorResponse> renderTechnicalErrorResponse(TechnicalException exception) {
|
||||||
|
log.error("TechnicalException occurred: ", exception);
|
||||||
|
|
||||||
|
return getErrorResponseResponseEntity(exception.getErrorDesc(), exception.getErrorMessage(), exception.getErrorCode(), exception.getHttpStatus(), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExceptionHandler(MethodArgumentNotValidException.class)
|
||||||
|
public ResponseEntity<ErrorResponse> renderMethodArgumentErrorResponse(MethodArgumentNotValidException exception) {
|
||||||
|
log.error("MethodArgumentNotValidException occurred: ", exception);
|
||||||
|
|
||||||
|
List<String> errors = new ArrayList<String>();
|
||||||
|
|
||||||
|
for (FieldError error : exception.getBindingResult().getFieldErrors()) {
|
||||||
|
errors.add(error.getField().concat(":").concat(error.getDefaultMessage()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return errorHelper.throwErrorExceptionWithMessage(HttpStatus.BAD_REQUEST, "80400", "Request Validation Error", errors.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExceptionHandler(HttpServerErrorException.class)
|
||||||
|
public ResponseEntity<ErrorResponse> renderHttpServerErrorResponse(HttpServerErrorException exception) {
|
||||||
|
log.error("HttpServerErrorException occurred: ", exception);
|
||||||
|
|
||||||
|
return errorHelper.throwErrorException(DEFAULT_ERROR_CODE, HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExceptionHandler(TimeoutException.class)
|
||||||
|
public ResponseEntity<ErrorResponse> renderTimeoutResponse(TimeoutException exception) {
|
||||||
|
log.error("TimeoutException occurred: ", exception);
|
||||||
|
|
||||||
|
return errorHelper.throwErrorException("80001", HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ResponseEntity<ErrorResponse> getErrorResponseResponseEntity(String errorDesc, String errorMessage,
|
||||||
|
String errorCode, HttpStatus httpStatus,
|
||||||
|
Map<String, String> metadata) {
|
||||||
|
if (StringUtils.isNotBlank(errorDesc) && StringUtils.isNotBlank(errorMessage)) {
|
||||||
|
|
||||||
|
return errorHelper.throwErrorExceptionWithMessageAndMetadataWithoutLocalization(httpStatus, errorCode, errorDesc, errorMessage, metadata);
|
||||||
|
} else {
|
||||||
|
if (Objects.nonNull(metadata)) {
|
||||||
|
return errorHelper.throwErrorExceptionWithMetadata(errorCode, httpStatus, metadata);
|
||||||
|
}
|
||||||
|
|
||||||
|
return errorHelper.throwErrorException(errorCode, httpStatus);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean isError() {
|
||||||
|
return isError;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,69 @@
|
|||||||
|
package com.iconplus.smartproc.exception;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
import org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver;
|
||||||
|
import org.springframework.web.servlet.view.json.MappingJackson2JsonView;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Log4j2
|
||||||
|
@Component
|
||||||
|
public class ResponseExceptionResolver extends AbstractHandlerExceptionResolver {
|
||||||
|
|
||||||
|
private static final String DEFAULT_ERROR_CODE = "80000";
|
||||||
|
|
||||||
|
|
||||||
|
public ResponseExceptionResolver() {}
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
|
@Override
|
||||||
|
protected ModelAndView doResolveException(
|
||||||
|
HttpServletRequest request,
|
||||||
|
HttpServletResponse response,
|
||||||
|
Object handler,
|
||||||
|
Exception ex
|
||||||
|
) {
|
||||||
|
return handleException(request, response, ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ModelAndView handleException(
|
||||||
|
HttpServletRequest request,
|
||||||
|
HttpServletResponse response,
|
||||||
|
Exception exception
|
||||||
|
) {
|
||||||
|
if (ObjectUtils.isNotEmpty(response) && HttpStatus.UNAUTHORIZED.value() == response.getStatus()
|
||||||
|
&& ObjectUtils.isNotEmpty(exception) && exception instanceof BusinessException
|
||||||
|
) {
|
||||||
|
BusinessException businessException = (BusinessException) exception;
|
||||||
|
ErrorResponse errorResponse = new ErrorResponse();
|
||||||
|
errorResponse.setCode(businessException.getErrorCode());
|
||||||
|
errorResponse.setTitle(businessException.getErrorDesc());
|
||||||
|
errorResponse.setMessage(businessException.getErrorMessage());
|
||||||
|
log.info("Error Response Exception : {}", errorResponse);
|
||||||
|
return new ModelAndView(new MappingJackson2JsonView(), this.getErrorResponse(errorResponse));
|
||||||
|
}
|
||||||
|
response.setHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE);
|
||||||
|
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
||||||
|
|
||||||
|
ErrorResponse errorResponse = new ErrorResponse();
|
||||||
|
errorResponse.setCode(DEFAULT_ERROR_CODE);
|
||||||
|
errorResponse.setTitle("Kesalahan terjadi");
|
||||||
|
errorResponse.setMessage("Kesalahan terjadi");
|
||||||
|
return new ModelAndView(new MappingJackson2JsonView(), this.getErrorResponse(errorResponse));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, String> getErrorResponse(ErrorResponse errorResponse) {
|
||||||
|
return new ObjectMapper().convertValue(errorResponse, new TypeReference<Map<String, String>>() {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
package com.iconplus.smartproc.exception;
|
||||||
|
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class TechnicalException extends BaseException {
|
||||||
|
|
||||||
|
public TechnicalException(String errorCode, String errorDesc, String errorMessage) {
|
||||||
|
super(HttpStatus.INTERNAL_SERVER_ERROR, errorCode, "", errorDesc, errorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TechnicalException(HttpStatus httpStatus, String errorCode, String errorDesc, String errorMessage){
|
||||||
|
super(httpStatus, errorCode, "", errorDesc, errorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TechnicalException(String errorCode){
|
||||||
|
super(HttpStatus.INTERNAL_SERVER_ERROR, errorCode, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public TechnicalException(HttpStatus httpStatus, String errorCode){
|
||||||
|
super(httpStatus, errorCode, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public TechnicalException(String errorCode, String rootCause){
|
||||||
|
super(HttpStatus.INTERNAL_SERVER_ERROR, errorCode, rootCause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TechnicalException(HttpStatus httpStatus, String errorCode, String rootCause) {
|
||||||
|
super(httpStatus, errorCode, rootCause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TechnicalException(String errorCode, String rootCause, Map<String, String> maps) {
|
||||||
|
super(HttpStatus.CONFLICT, errorCode, rootCause, maps);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TechnicalException(HttpStatus httpStatus, String errorCode, String rootCause, Map<String, String> maps) {
|
||||||
|
super(httpStatus, errorCode, rootCause, maps);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package com.iconplus.smartproc.helper.base;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.hibernate.annotations.CreationTimestamp;
|
||||||
|
import org.hibernate.annotations.UpdateTimestamp;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.MappedSuperclass;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@MappedSuperclass
|
||||||
|
public class BaseEntity implements Serializable {
|
||||||
|
|
||||||
|
@Column(name = "user_created", length = 50)
|
||||||
|
private String userCreated;
|
||||||
|
|
||||||
|
@Column(name = "time_created", nullable = false, updatable=false)
|
||||||
|
@CreationTimestamp
|
||||||
|
private Timestamp timeCreated;
|
||||||
|
|
||||||
|
@Column(name = "user_update", length = 50)
|
||||||
|
private String userUpdate;
|
||||||
|
|
||||||
|
@Column(name = "last_update")
|
||||||
|
@UpdateTimestamp
|
||||||
|
private Timestamp lastUpdate;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.iconplus.smartproc.helper.base;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public interface BaseInterfaceRequest extends Serializable {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.iconplus.smartproc.helper.base;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public interface BaseInterfaceResponse extends Serializable {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.iconplus.smartproc.helper.base;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
public class BasePaginationRequest extends BaseRequest{
|
||||||
|
|
||||||
|
|
||||||
|
private Integer pageSize;
|
||||||
|
private Integer pageNumber;
|
||||||
|
private String sortBy;
|
||||||
|
private String sortType;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
|||||||
|
package com.iconplus.smartproc.helper.base;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.model.Pagination;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
public class BasePaginationResponse extends BaseResponse{
|
||||||
|
|
||||||
|
private Pagination pagination;
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.iconplus.smartproc.helper.base;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public class BaseRequest implements Serializable {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.iconplus.smartproc.helper.base;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public class BaseResponse implements Serializable {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
|
||||||
|
package com.iconplus.smartproc.helper.context;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ApiContext {
|
||||||
|
|
||||||
|
private HttpHeaders httpHeaders;
|
||||||
|
private String userRefId;
|
||||||
|
private String customerId;
|
||||||
|
private String otpMobileNo;
|
||||||
|
private String cid;
|
||||||
|
private String passportNo;
|
||||||
|
private String tokenScope;
|
||||||
|
private String deviceId;
|
||||||
|
private String boUserFullName;
|
||||||
|
private String boUserId;
|
||||||
|
private String authorization;
|
||||||
|
private String language;
|
||||||
|
private String requestId;
|
||||||
|
private String correlationId;
|
||||||
|
private String forwardedFor;
|
||||||
|
private String userAgent;
|
||||||
|
private String platform;
|
||||||
|
private String clientVersion;
|
||||||
|
private String channelId;
|
||||||
|
private String apiKey;
|
||||||
|
private String sleuthId;
|
||||||
|
private String userName;
|
||||||
|
private String userId;
|
||||||
|
private String smUniversalId;
|
||||||
|
private String clientId;
|
||||||
|
private String clientSecret;
|
||||||
|
private String secretKey;
|
||||||
|
private String timestamp;
|
||||||
|
private String mandiriKey;
|
||||||
|
private String signature;
|
||||||
|
private String clientIp;
|
||||||
|
private String releaseId;
|
||||||
|
private List<String> stackTrace;
|
||||||
|
private String snapshot;
|
||||||
|
}
|
@ -0,0 +1,183 @@
|
|||||||
|
package com.iconplus.smartproc.helper.context;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.service.TokenUtils;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Log4j2
|
||||||
|
public class ApiContextFactory {
|
||||||
|
|
||||||
|
private ApiContextFactory() {
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final String DEFAULT_LANGUAGE = "id-id";
|
||||||
|
private static final String HEADER_AUTHORIZATION = "Authorization";
|
||||||
|
private static final String HEADER_ACCEPT_LANGUAGE = HttpHeaders.ACCEPT_LANGUAGE;
|
||||||
|
private static final String HEADER_REQUEST_ID = "X-Request-ID";
|
||||||
|
private static final String HEADER_CORRELATION_ID = "X-Correlation-ID";
|
||||||
|
private static final String HEADER_FORWARDED_FOR = "X-Forwarded-For";
|
||||||
|
private static final String HEADER_USER_AGENT = "User-Agent";
|
||||||
|
private static final String HEADER_PLATFORM = "X-Platform";
|
||||||
|
private static final String HEADER_CLIENT_VERSION = "X-Client-Version";
|
||||||
|
private static final String HEADER_CHANNEL_ID = "X-Channel-ID";
|
||||||
|
private static final String HEADER_API_KEY = "X-API-Key";
|
||||||
|
private static final String HEADER_SLEUTH_ID = "X-Sleuth-ID";
|
||||||
|
private static final String HEADER_USER_NAME = "X-User-Name";
|
||||||
|
private static final String HEADER_USER_ID = "X-User-ID";
|
||||||
|
private static final String HEADER_SM_UNIVERSAL_ID = "sm_universalId";
|
||||||
|
private static final String HEADER_CUSTOMER_ID = "X-Customer-ID";
|
||||||
|
private static final String HEADER_CLIENT_ID = "X-Client-ID";
|
||||||
|
private static final String HEADER_CLIENT_SECRET = "X-Client-Secret";
|
||||||
|
private static final String HEADER_SECRET_KEY = "X-Secret-Key";
|
||||||
|
private static final String HEADER_TIMESTAMP = "X-TIMESTAMP";
|
||||||
|
private static final String HEADER_MANDIRI_KEY = "X-MANDIRI-KEY";
|
||||||
|
private static final String HEADER_SIGNATURE = "X-SIGNATURE";
|
||||||
|
private static final String HEADER_RELEASE_ID = "X-Release-ID";
|
||||||
|
|
||||||
|
private static final String JWT_USER_ID = "user_id";
|
||||||
|
private static final String JWT_CUSTOMER_ID = "customer_id";
|
||||||
|
private static final String JWT_OTP_MOBILE_NO = "otpMobileNo";
|
||||||
|
private static final String JWT_CID = "cid";
|
||||||
|
private static final String JWT_PASSPORT_NO = "passportNo";
|
||||||
|
private static final String JWT_LOGIN_SCOPE = "scope";
|
||||||
|
private static final String JWT_DEVICE_ID = "device_id";
|
||||||
|
private static final String JWT_CLIENT_ID = "clientId";
|
||||||
|
private static final String JWT_BO_USER_FULL_NAME = "boUserFullName";
|
||||||
|
private static final String JWT_BO_USER_ID = "boUserId";
|
||||||
|
|
||||||
|
private static final String X_FORWARDED_FOR = "x-forwarded-for";
|
||||||
|
private static final String PROXY_CLIENT_IP = "proxy-client-ip";
|
||||||
|
private static final String WL_PROXY_CLIENT_IP = "wl-proxy-client-ip";
|
||||||
|
private static final String HTTP_CLIENT_IP = "http_client_ip";
|
||||||
|
private static final String HTTP_X_FORWARDED_FOR = "http_x_forwarded_for";
|
||||||
|
private static final String UNKNOWN = "unknown";
|
||||||
|
|
||||||
|
private static final String CLIENT_IP = "clientIp";
|
||||||
|
|
||||||
|
private static final List<String> ALLOW_HEADER_LIST = List
|
||||||
|
.of(HEADER_AUTHORIZATION, HEADER_ACCEPT_LANGUAGE, HEADER_REQUEST_ID,
|
||||||
|
HEADER_CORRELATION_ID, HEADER_FORWARDED_FOR, HEADER_USER_AGENT, HEADER_PLATFORM,
|
||||||
|
HEADER_CLIENT_VERSION, HEADER_CHANNEL_ID, HEADER_API_KEY, JWT_DEVICE_ID, HEADER_SLEUTH_ID, HEADER_USER_NAME,
|
||||||
|
HEADER_USER_ID, HEADER_SM_UNIVERSAL_ID, HEADER_CUSTOMER_ID, HEADER_CLIENT_ID, HEADER_CLIENT_SECRET, HEADER_SECRET_KEY,
|
||||||
|
HEADER_TIMESTAMP, HEADER_MANDIRI_KEY, HEADER_SIGNATURE, HEADER_RELEASE_ID).stream()
|
||||||
|
.map(String::toLowerCase).collect(Collectors.toList());
|
||||||
|
|
||||||
|
public static ApiContext generateApiContext() throws IOException {
|
||||||
|
ApiContext apiContext = new ApiContext();
|
||||||
|
|
||||||
|
HttpHeaders httpHeaders = constructHttpHeaders();
|
||||||
|
String platform = httpHeaders.getFirst(HEADER_PLATFORM);
|
||||||
|
String authentication = httpHeaders.getFirst(HEADER_AUTHORIZATION);
|
||||||
|
|
||||||
|
if (authentication != null) {
|
||||||
|
authentication = authentication.replace("Bearer", "");
|
||||||
|
authentication = authentication.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (authentication != null) {
|
||||||
|
Map<String, String> jwtBodyMap = TokenUtils.decodeToken(authentication);
|
||||||
|
apiContext.setUserId(jwtBodyMap.getOrDefault(JWT_USER_ID, ""));
|
||||||
|
apiContext.setCustomerId(jwtBodyMap.getOrDefault(JWT_CUSTOMER_ID, ""));
|
||||||
|
apiContext.setDeviceId(jwtBodyMap.getOrDefault(JWT_DEVICE_ID, ""));
|
||||||
|
apiContext.setTokenScope(jwtBodyMap.getOrDefault(JWT_LOGIN_SCOPE, ""));
|
||||||
|
apiContext.setClientId(jwtBodyMap.getOrDefault(JWT_CLIENT_ID, ""));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(StringUtils.isEmpty(apiContext.getClientId())) {
|
||||||
|
apiContext.setClientId(httpHeaders.getFirst(HEADER_CLIENT_ID));
|
||||||
|
}
|
||||||
|
|
||||||
|
apiContext.setHttpHeaders(httpHeaders);
|
||||||
|
apiContext.setAuthorization(authentication);
|
||||||
|
apiContext.setLanguage(httpHeaders.getFirst(HEADER_ACCEPT_LANGUAGE));
|
||||||
|
apiContext.setRequestId(httpHeaders.getFirst(HEADER_REQUEST_ID));
|
||||||
|
apiContext.setCorrelationId(httpHeaders.getFirst(HEADER_CORRELATION_ID));
|
||||||
|
apiContext.setForwardedFor(httpHeaders.getFirst(HEADER_FORWARDED_FOR));
|
||||||
|
apiContext.setUserAgent(httpHeaders.getFirst(HEADER_USER_AGENT));
|
||||||
|
apiContext.setPlatform(httpHeaders.getFirst(HEADER_PLATFORM));
|
||||||
|
apiContext.setClientVersion(httpHeaders.getFirst(HEADER_CLIENT_VERSION));
|
||||||
|
apiContext.setChannelId(httpHeaders.getFirst(HEADER_CHANNEL_ID));
|
||||||
|
apiContext.setSleuthId(httpHeaders.getFirst(HEADER_SLEUTH_ID));
|
||||||
|
apiContext.setApiKey(httpHeaders.getFirst(HEADER_API_KEY));
|
||||||
|
apiContext.setClientSecret(httpHeaders.getFirst(HEADER_CLIENT_SECRET));
|
||||||
|
apiContext.setSecretKey(httpHeaders.getFirst(HEADER_SECRET_KEY));
|
||||||
|
apiContext.setTimestamp(httpHeaders.getFirst(HEADER_TIMESTAMP));
|
||||||
|
apiContext.setMandiriKey(httpHeaders.getFirst(HEADER_MANDIRI_KEY));
|
||||||
|
apiContext.setSignature(httpHeaders.getFirst(HEADER_SIGNATURE));
|
||||||
|
apiContext.setClientIp(httpHeaders.getFirst(CLIENT_IP));
|
||||||
|
apiContext.setReleaseId(httpHeaders.getFirst(HEADER_RELEASE_ID));
|
||||||
|
|
||||||
|
//fill the username with user id if its empty, because AD changed the design and they remove the x-user-name
|
||||||
|
String userName = httpHeaders.getFirst(HEADER_USER_NAME);
|
||||||
|
if (userName == null || userName.equals("")) {
|
||||||
|
userName = httpHeaders.getFirst(HEADER_USER_ID);
|
||||||
|
}
|
||||||
|
apiContext.setUserName(userName);
|
||||||
|
|
||||||
|
return apiContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HttpHeaders constructHttpHeaders() throws IOException {
|
||||||
|
HttpHeaders httpHeaders = new HttpHeaders();
|
||||||
|
httpHeaders.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
HttpServletRequest curRequest = ((ServletRequestAttributes) RequestContextHolder
|
||||||
|
.currentRequestAttributes()).getRequest();
|
||||||
|
Enumeration<String> headerNames = curRequest.getHeaderNames();
|
||||||
|
|
||||||
|
if (headerNames != null) {
|
||||||
|
while (headerNames.hasMoreElements()) {
|
||||||
|
String header = headerNames.nextElement();
|
||||||
|
String value = curRequest.getHeader(header);
|
||||||
|
if (ALLOW_HEADER_LIST.contains(header)) {
|
||||||
|
log.debug("Adding header {} with value {}", header, value);
|
||||||
|
httpHeaders.add(header, value);
|
||||||
|
} else {
|
||||||
|
log.debug("Header {} with value {} is not required to be copied", header,
|
||||||
|
value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!httpHeaders.containsKey(HEADER_ACCEPT_LANGUAGE) || StringUtils
|
||||||
|
.isEmpty(httpHeaders.getFirst(
|
||||||
|
HEADER_ACCEPT_LANGUAGE))) {
|
||||||
|
httpHeaders.set(HEADER_ACCEPT_LANGUAGE, DEFAULT_LANGUAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
httpHeaders.add(CLIENT_IP, getClientIp(httpHeaders, curRequest.getRemoteAddr()));
|
||||||
|
|
||||||
|
return httpHeaders;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getClientIp(HttpHeaders httpHeaders, String remoteAddr) {
|
||||||
|
String ip = httpHeaders.getFirst(X_FORWARDED_FOR);
|
||||||
|
if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
|
||||||
|
ip = httpHeaders.getFirst(PROXY_CLIENT_IP);
|
||||||
|
}
|
||||||
|
if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
|
||||||
|
ip = httpHeaders.getFirst(WL_PROXY_CLIENT_IP);
|
||||||
|
}
|
||||||
|
if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
|
||||||
|
ip = httpHeaders.getFirst(HTTP_CLIENT_IP);
|
||||||
|
}
|
||||||
|
if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
|
||||||
|
ip = httpHeaders.getFirst(HTTP_X_FORWARDED_FOR);
|
||||||
|
}
|
||||||
|
if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
|
||||||
|
ip = remoteAddr;
|
||||||
|
}
|
||||||
|
return ip;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.iconplus.smartproc.helper.context;
|
||||||
|
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.context.annotation.RequestScope;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class AutoConfiguration {
|
||||||
|
|
||||||
|
@RequestScope
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnMissingBean(ApiContext.class)
|
||||||
|
public ApiContext apiContext() throws IOException {
|
||||||
|
return ApiContextFactory.generateApiContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package com.iconplus.smartproc.helper.context;
|
||||||
|
|
||||||
|
import org.springframework.beans.BeansException;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.ApplicationContextAware;
|
||||||
|
|
||||||
|
public class ContextProvider implements ApplicationContextAware {
|
||||||
|
|
||||||
|
private static ApplicationContext CONTEXT;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||||
|
CONTEXT = applicationContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a Spring bean by type.
|
||||||
|
**/
|
||||||
|
public static <T> T getBean(Class<T> beanClass) {
|
||||||
|
return CONTEXT.getBean(beanClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a Spring bean by name.
|
||||||
|
**/
|
||||||
|
public static Object getBean(String beanName) {
|
||||||
|
return CONTEXT.getBean(beanName);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.iconplus.smartproc.helper.context;
|
||||||
|
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpRequest;
|
||||||
|
import org.springframework.http.client.ClientHttpRequestExecution;
|
||||||
|
import org.springframework.http.client.ClientHttpRequestInterceptor;
|
||||||
|
import org.springframework.http.client.ClientHttpResponse;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@Log4j2
|
||||||
|
@Component
|
||||||
|
public class HttpHeadersInterceptor implements ClientHttpRequestInterceptor {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApiContext apiContext;
|
||||||
|
|
||||||
|
public HttpHeadersInterceptor(ApiContext apiContext) {
|
||||||
|
this.apiContext = apiContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClientHttpResponse intercept(HttpRequest request, byte[] body,
|
||||||
|
ClientHttpRequestExecution execution) throws IOException {
|
||||||
|
apiContext.getHttpHeaders().entrySet().stream()
|
||||||
|
.filter(x -> x.getKey() != null)
|
||||||
|
.forEach(x -> request.getHeaders().add(x.getKey(), x.getValue().get(0)));
|
||||||
|
return execution.execute(request, body);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.iconplus.smartproc.helper.model;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseRequest;
|
||||||
|
|
||||||
|
public class EmptyRequest extends BaseRequest {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.iconplus.smartproc.helper.model;
|
||||||
|
|
||||||
|
import brave.internal.Nullable;
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseResponse;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public class EmptyResponse extends BaseResponse {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package com.iconplus.smartproc.helper.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class Pagination implements Serializable {
|
||||||
|
private Integer pageSize;
|
||||||
|
private Integer currentPage;
|
||||||
|
private Integer totalPages;
|
||||||
|
private Long totalRecords;
|
||||||
|
private Boolean isFirstPage;
|
||||||
|
private Boolean isLastPage;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
|||||||
|
package com.iconplus.smartproc.helper.service;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseInterfaceRequest;
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseInterfaceResponse;
|
||||||
|
|
||||||
|
public interface BaseInterfaceService<T extends BaseInterfaceRequest, V extends BaseInterfaceResponse> {
|
||||||
|
V execute(T input);
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package com.iconplus.smartproc.helper.service;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BasePaginationRequest;
|
||||||
|
import com.iconplus.smartproc.helper.base.BasePaginationResponse;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public abstract class BasePaginationService<T extends BasePaginationRequest, V extends BasePaginationResponse> implements BaseService<T, V>{
|
||||||
|
|
||||||
|
@Value("${default.page.size}")
|
||||||
|
private Integer pageSize;
|
||||||
|
|
||||||
|
@Value("${default.page.number}")
|
||||||
|
private Integer pageNumber;
|
||||||
|
|
||||||
|
@Value("${default.page.sortBy}")
|
||||||
|
private String sortBy;
|
||||||
|
|
||||||
|
@Value("${default.page.sortType}")
|
||||||
|
private String sortType;
|
||||||
|
|
||||||
|
@Value("${default.page.maxPageSize}")
|
||||||
|
private Integer maxPageSize;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.iconplus.smartproc.helper.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseRequest;
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseResponse;
|
||||||
|
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public interface BaseService<T extends BaseRequest, V extends BaseResponse> {
|
||||||
|
V execute(T input) throws Exception;
|
||||||
|
}
|
@ -0,0 +1,53 @@
|
|||||||
|
package com.iconplus.smartproc.helper.service;
|
||||||
|
|
||||||
|
import com.nimbusds.jose.JWSObject;
|
||||||
|
import com.nimbusds.jose.Payload;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import net.minidev.json.JSONObject;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@Log4j2
|
||||||
|
public class TokenUtils {
|
||||||
|
|
||||||
|
private TokenUtils() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<String, String> decodeToken(String jwtToken) {
|
||||||
|
Map<String, String> body = new HashMap<>();
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (jwtToken != null) {
|
||||||
|
jwtToken = jwtToken.replace("Bearer", "");
|
||||||
|
jwtToken = jwtToken.trim();
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(jwtToken)) {
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
JWSObject token = JWSObject.parse(jwtToken);
|
||||||
|
|
||||||
|
Payload tokenPayload = token.getPayload();
|
||||||
|
JSONObject tokenBody = tokenPayload.toJSONObject();
|
||||||
|
|
||||||
|
tokenBody.forEach((key, value) -> {
|
||||||
|
if (Objects.isNull(value)) {
|
||||||
|
value = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
body.put(key, value.toString());
|
||||||
|
});
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Failed to parse JWT Token. Error: {}", e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Object getValueByParam(String param, String token) {
|
||||||
|
return decodeToken(token).get(param);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
package com.iconplus.smartproc.model.entity;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Entity
|
||||||
|
@Table(name = "bidang")
|
||||||
|
public class Bidang extends BaseEntity {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Column(name = "instansi_id")
|
||||||
|
private Long instansiId;
|
||||||
|
|
||||||
|
@Column(name = "bidang")
|
||||||
|
private String bidang;
|
||||||
|
|
||||||
|
@Column(name = "keterangan")
|
||||||
|
private String keterangan;
|
||||||
|
|
||||||
|
@Column(name = "is_active")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isActive;
|
||||||
|
|
||||||
|
@Column(name = "is_delete")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isDelete;
|
||||||
|
}
|
58
src/main/java/com/iconplus/smartproc/model/entity/Drp.java
Normal file
58
src/main/java/com/iconplus/smartproc/model/entity/Drp.java
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
package com.iconplus.smartproc.model.entity;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.sql.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Entity
|
||||||
|
@Table(name = "drp")
|
||||||
|
public class Drp extends BaseEntity {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Column(name = "tahun")
|
||||||
|
private Integer tahun;
|
||||||
|
|
||||||
|
@Column(name = "approve_status")
|
||||||
|
private String approveStatus;
|
||||||
|
|
||||||
|
@Column(name = "approve_date")
|
||||||
|
private Date approveDate;
|
||||||
|
|
||||||
|
@Column(name = "vp_approve_date")
|
||||||
|
private Date vpApproveDate;
|
||||||
|
|
||||||
|
@Column(name = "komite_approve_date")
|
||||||
|
private Date komiteApproveDate;
|
||||||
|
|
||||||
|
@Column(name = "direktur_approve_date")
|
||||||
|
private Date direkturApproveDate;
|
||||||
|
|
||||||
|
@Column(name = "is_print")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isPrint;
|
||||||
|
|
||||||
|
@Column(name = "print_date")
|
||||||
|
private Date printDate;
|
||||||
|
|
||||||
|
@Column(name = "is_active")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isActive;
|
||||||
|
|
||||||
|
@Column(name = "is_delete")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isDelete;
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
package com.iconplus.smartproc.model.entity;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Entity
|
||||||
|
@Table(name = "drp_approval")
|
||||||
|
public class DrpApproval extends BaseEntity {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Column(name = "drp_id")
|
||||||
|
private Long drpId;
|
||||||
|
|
||||||
|
@Column(name = "approver_user_id")
|
||||||
|
private Long approverUserId;
|
||||||
|
|
||||||
|
@Column(name = "is_approve")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isApprove;
|
||||||
|
|
||||||
|
@Column(name = "level")
|
||||||
|
private String level;
|
||||||
|
|
||||||
|
@Column(name = "catatan")
|
||||||
|
private String catatan;
|
||||||
|
|
||||||
|
@Column(name = "is_active")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isActive;
|
||||||
|
|
||||||
|
@Column(name = "is_delete")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isDelete;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
package com.iconplus.smartproc.model.entity;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.sql.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Entity
|
||||||
|
@Table(name = "drp_approval_history")
|
||||||
|
public class DrpApprovalHistory extends BaseEntity {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Column(name = "drp_approval_id")
|
||||||
|
private Long drpApprovalId;
|
||||||
|
|
||||||
|
@Column(name = "date")
|
||||||
|
private Date date;
|
||||||
|
|
||||||
|
@Column(name = "status")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@Column(name = "is_active")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isActive;
|
||||||
|
|
||||||
|
@Column(name = "is_delete")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isDelete;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package com.iconplus.smartproc.model.entity;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Entity
|
||||||
|
@Table(name = "drp_dokumen")
|
||||||
|
public class DrpDokumen extends BaseEntity {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Column(name = "drp_id")
|
||||||
|
private Long drpId;
|
||||||
|
|
||||||
|
@Column(name = "jenis_dokumen_id")
|
||||||
|
private Long jenisDokumenId;
|
||||||
|
|
||||||
|
@Column(name = "filename")
|
||||||
|
private String filename;
|
||||||
|
|
||||||
|
@Column(name = "keterangan")
|
||||||
|
private String keterangan;
|
||||||
|
|
||||||
|
@Column(name = "is_active")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isActive;
|
||||||
|
|
||||||
|
@Column(name = "is_delete")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isDelete;
|
||||||
|
}
|
@ -0,0 +1,83 @@
|
|||||||
|
package com.iconplus.smartproc.model.entity;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.sql.Date;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Entity
|
||||||
|
@Table(name = "drp_pengadaan")
|
||||||
|
public class DrpPengadaan extends BaseEntity {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Column(name = "drp_id")
|
||||||
|
private Long drpId;
|
||||||
|
|
||||||
|
@Column(name = "nomor")
|
||||||
|
private String nomor;
|
||||||
|
|
||||||
|
@Column(name = "nama_pengadaan")
|
||||||
|
private String namaPengadaan;
|
||||||
|
|
||||||
|
@Column(name = "lokasi_id")
|
||||||
|
private Long lokasiId;
|
||||||
|
|
||||||
|
@Column(name = "jenis_pengadaan_id")
|
||||||
|
private Long jenisPengadaanId;
|
||||||
|
|
||||||
|
@Column(name = "unit_inisiator_id")
|
||||||
|
private Long unitInisiatorId;
|
||||||
|
|
||||||
|
@Column(name = "pagu")
|
||||||
|
private BigDecimal pagu;
|
||||||
|
|
||||||
|
@Column(name = "sumber_dana_id")
|
||||||
|
private Long sumberDanaId;
|
||||||
|
|
||||||
|
@Column(name = "supply_positioning_matrix_id")
|
||||||
|
private Long supplyPositioningMatrixId;
|
||||||
|
|
||||||
|
@Column(name = "metode_pengadaan_id")
|
||||||
|
private Long metodePengadaanId;
|
||||||
|
|
||||||
|
@Column(name = "metode_penyampaian_id")
|
||||||
|
private Long metodePenyampaianId;
|
||||||
|
|
||||||
|
@Column(name = "jenis_kontrak_id")
|
||||||
|
private Long jenisKontrakId;
|
||||||
|
|
||||||
|
@Column(name = "strategi_pengadaan_id")
|
||||||
|
private Long strategiPengadaanId;
|
||||||
|
|
||||||
|
@Column(name = "rencana_tanggal")
|
||||||
|
private Date rencanaTanggal;
|
||||||
|
|
||||||
|
@Column(name = "target_tanggal")
|
||||||
|
private Date targetTanggal;
|
||||||
|
|
||||||
|
@Column(name = "hpe")
|
||||||
|
private BigDecimal hpe;
|
||||||
|
|
||||||
|
@Column(name = "is_active")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isActive;
|
||||||
|
|
||||||
|
@Column(name = "is_delete")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isDelete;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
package com.iconplus.smartproc.model.entity;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Entity
|
||||||
|
@Table(name = "drp_pengadaan_dokumen")
|
||||||
|
public class DrpPengadaanDokumen extends BaseEntity {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Column(name = "drp_pengadaan_id")
|
||||||
|
private Long drpPengadaanId;
|
||||||
|
|
||||||
|
@Column(name = "drp_id")
|
||||||
|
private Long drpId;
|
||||||
|
|
||||||
|
@Column(name = "jenis_dokumen_id")
|
||||||
|
private Long jenisDokumenId;
|
||||||
|
|
||||||
|
@Column(name = "filename")
|
||||||
|
private String filename;
|
||||||
|
|
||||||
|
@Column(name = "keterangan")
|
||||||
|
private String keterangan;
|
||||||
|
|
||||||
|
@Column(name = "is_active")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isActive;
|
||||||
|
|
||||||
|
@Column(name = "is_delete")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isDelete;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
package com.iconplus.smartproc.model.entity;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.sql.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Entity
|
||||||
|
@Table(name = "drp_rekomendasi")
|
||||||
|
public class DrpRekomendasi extends BaseEntity {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Column(name = "drp_id")
|
||||||
|
private Long drpId;
|
||||||
|
|
||||||
|
@Column(name = "user_id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Column(name = "jenis_pengadaan_id")
|
||||||
|
private Long jenisPengadaanId;
|
||||||
|
|
||||||
|
@Column(name = "drp_approval_id")
|
||||||
|
private Long drpApprovalId;
|
||||||
|
|
||||||
|
@Column(name = "rekomendasi")
|
||||||
|
private String rekomendasi;
|
||||||
|
|
||||||
|
@Column(name = "rekomendasi_date")
|
||||||
|
private Date rekomendasiDate;
|
||||||
|
|
||||||
|
@Column(name = "is_active")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isActive;
|
||||||
|
|
||||||
|
@Column(name = "is_delete")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isDelete;
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
package com.iconplus.smartproc.model.entity;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Entity
|
||||||
|
@Table(name = "instansi")
|
||||||
|
public class Instansi extends BaseEntity {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Column(name = "instansi")
|
||||||
|
private String instansi;
|
||||||
|
|
||||||
|
@Column(name = "alamat")
|
||||||
|
private String alamat;
|
||||||
|
|
||||||
|
@Column(name = "keterangan")
|
||||||
|
private String keterangan;
|
||||||
|
|
||||||
|
@Column(name = "is_active")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isActive;
|
||||||
|
|
||||||
|
@Column(name = "is_delete")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isDelete;
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package com.iconplus.smartproc.model.entity;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Entity
|
||||||
|
@Table(name = "jabatan")
|
||||||
|
public class Jabatan extends BaseEntity {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Column(name = "jabatan")
|
||||||
|
private String jabatan;
|
||||||
|
|
||||||
|
@Column(name = "instansi_id")
|
||||||
|
private Long instansiId;
|
||||||
|
|
||||||
|
@Column(name = "bidang_id")
|
||||||
|
private Long bidangId;
|
||||||
|
|
||||||
|
@Column(name = "keterangan")
|
||||||
|
private String keterangan;
|
||||||
|
|
||||||
|
@Column(name = "is_active")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isActive;
|
||||||
|
|
||||||
|
@Column(name = "is_delete")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isDelete;
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package com.iconplus.smartproc.model.entity;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Table(name = "jenis_anggaran")
|
||||||
|
public class JenisAnggaran extends BaseEntity {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Column(name = "jenis_anggaran")
|
||||||
|
private String jenisAnggaran;
|
||||||
|
|
||||||
|
@Column(name = "keterangan")
|
||||||
|
private String keterangan;
|
||||||
|
|
||||||
|
@Column(name = "is_active")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isActive;
|
||||||
|
|
||||||
|
@Column(name = "is_delete")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isDelete;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package com.iconplus.smartproc.model.entity;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "jenis_kontrak")
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class JenisKontrak extends BaseEntity {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Column(name = "jenis_kontrak")
|
||||||
|
private String jenisKontrak;
|
||||||
|
|
||||||
|
@Column(name = "keterangan")
|
||||||
|
private String keterangan;
|
||||||
|
|
||||||
|
@Column(name = "is_active")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isActive;
|
||||||
|
|
||||||
|
@Column(name = "is_delete")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isDelete;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package com.iconplus.smartproc.model.entity;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "jenis_pengadaan")
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class JenisPengadaan extends BaseEntity {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id")
|
||||||
|
private long id;
|
||||||
|
|
||||||
|
@Column(name = "jenis_pengadaan")
|
||||||
|
private String jenisPengadaan;
|
||||||
|
|
||||||
|
@Column(name = "keterangan")
|
||||||
|
private String keterangan;
|
||||||
|
|
||||||
|
@Column(name = "is_active")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isActive;
|
||||||
|
|
||||||
|
@Column(name = "is_delete")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isDelete;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package com.iconplus.smartproc.model.entity;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "lokasi")
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class Lokasi extends BaseEntity {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Column(name = "lokasi")
|
||||||
|
private String lokasi;
|
||||||
|
|
||||||
|
@Column(name = "keterangan")
|
||||||
|
private String keterangan;
|
||||||
|
|
||||||
|
@Column(name = "is_active")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isActive;
|
||||||
|
|
||||||
|
@Column(name = "is_delete")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isDelete;
|
||||||
|
|
||||||
|
}
|
44
src/main/java/com/iconplus/smartproc/model/entity/Menus.java
Normal file
44
src/main/java/com/iconplus/smartproc/model/entity/Menus.java
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
package com.iconplus.smartproc.model.entity;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Entity
|
||||||
|
@Table(name = "menus")
|
||||||
|
public class Menus extends BaseEntity {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Column(name = "parent_id")
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
@Column(name = "nama")
|
||||||
|
private String nama;
|
||||||
|
|
||||||
|
@Column(name = "link")
|
||||||
|
private String link;
|
||||||
|
|
||||||
|
@Column(name = "urutan")
|
||||||
|
private Long urutan;
|
||||||
|
|
||||||
|
@Column(name = "icon")
|
||||||
|
private String icon;
|
||||||
|
|
||||||
|
@Column(name = "is_delete")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isDelete;
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package com.iconplus.smartproc.model.entity;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "metode_pengadaan")
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class MetodePengadaan extends BaseEntity {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id")
|
||||||
|
private long id;
|
||||||
|
|
||||||
|
@Column(name = "metode_pengadaan")
|
||||||
|
private String metodePengadaan;
|
||||||
|
|
||||||
|
@Column(name = "keterangan")
|
||||||
|
private String keterangan;
|
||||||
|
|
||||||
|
@Column(name = "is_active")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isActive;
|
||||||
|
|
||||||
|
@Column(name = "is_delete")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isDelete;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
package com.iconplus.smartproc.model.entity;
|
||||||
|
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "metode_penyampaian")
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class MetodePenyampaian extends BaseEntity {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id")
|
||||||
|
private long id;
|
||||||
|
|
||||||
|
@Column(name = "metode_penyampaian")
|
||||||
|
private String metodePenyampaian;
|
||||||
|
|
||||||
|
@Column(name = "keterangan")
|
||||||
|
private String keterangan;
|
||||||
|
|
||||||
|
@Column(name = "is_active")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isActive;
|
||||||
|
|
||||||
|
@Column(name = "is_delete")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isDelete;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
package com.iconplus.smartproc.model.entity;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Entity
|
||||||
|
@Table(name = "permission")
|
||||||
|
public class Permission extends BaseEntity {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Column(name = "role_id")
|
||||||
|
private Long roleId;
|
||||||
|
|
||||||
|
@Column(name = "menu_id")
|
||||||
|
private Long menuId;
|
||||||
|
|
||||||
|
@Column(name = "can_view")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean canView;
|
||||||
|
|
||||||
|
@Column(name = "can_create")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean canCreate;
|
||||||
|
|
||||||
|
@Column(name = "can_read")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean canRead;
|
||||||
|
|
||||||
|
@Column(name = "can_update")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean canUpdate;
|
||||||
|
|
||||||
|
@Column(name = "can_delete")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean canDelete;
|
||||||
|
|
||||||
|
@Column(name = "is_delete")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isDelete;
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
package com.iconplus.smartproc.model.entity;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Entity
|
||||||
|
@Table(name = "rks_daftar_isi")
|
||||||
|
public class RksDaftarIsi extends BaseEntity {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Column(name = "kode_template")
|
||||||
|
private String kodeTemplate;
|
||||||
|
|
||||||
|
@Column(name = "nama_template")
|
||||||
|
private String namaTemplate;
|
||||||
|
|
||||||
|
@Column(name = "metode_pengadaan_id")
|
||||||
|
private Long metodePengadaanId;
|
||||||
|
|
||||||
|
@Column(name = "versi")
|
||||||
|
private String versi;
|
||||||
|
|
||||||
|
@Column(name = "is_active")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isActive;
|
||||||
|
|
||||||
|
@Column(name = "is_delete")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isDelete;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package com.iconplus.smartproc.model.entity;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Entity
|
||||||
|
@Table(name = "rks_isi")
|
||||||
|
public class RksIsi extends BaseEntity {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Column(name = "rks_daftar_isi_id")
|
||||||
|
private Long rksDaftarIsiId;
|
||||||
|
|
||||||
|
@Column(name = "nomor")
|
||||||
|
private String nomor;
|
||||||
|
|
||||||
|
@Column(name = "parent_id")
|
||||||
|
private Integer parentId;
|
||||||
|
|
||||||
|
@Column(name = "nama")
|
||||||
|
private String nama;
|
||||||
|
|
||||||
|
@Column(name = "bab")
|
||||||
|
private String bab;
|
||||||
|
|
||||||
|
@Column(name = "sub_bab")
|
||||||
|
private String subBab;
|
||||||
|
|
||||||
|
@Column(name = "urutan")
|
||||||
|
private String urutan;
|
||||||
|
|
||||||
|
@Column(name = "is_kontrak")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isKontrak;
|
||||||
|
|
||||||
|
@Column(name = "is_active")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isActive;
|
||||||
|
|
||||||
|
@Column(name = "is_delete")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isDelete;
|
||||||
|
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user