add master data api
This commit is contained in:
parent
c573eb2fb3
commit
fe72608465
@ -1,65 +1,77 @@
|
|||||||
package com.iconplus.smartproc.controller;
|
package com.iconplus.smartproc.controller;
|
||||||
|
|
||||||
import com.iconplus.smartproc.model.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 com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
import java.util.List;
|
import com.iconplus.smartproc.model.request.JenisKontrakRequest;
|
||||||
import java.util.Map;
|
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 = "http://localhost:8080", allowCredentials = "true")
|
@CrossOrigin(origins = "http://localhost:8080", allowCredentials = "true")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/jeniskontrak")
|
@RequestMapping("/api/jeniskontrak")
|
||||||
public class JenisKontrakController {
|
public class JenisKontrakController {
|
||||||
@Autowired
|
|
||||||
private JenisKontrakRepository jeniskontrakRepository;
|
|
||||||
|
|
||||||
//get all data
|
private final GetListJenisKontrakService getListJenisKontrakService;
|
||||||
@GetMapping
|
private final GetJenisKontrakByIdService getJenisKontrakByIdService;
|
||||||
public List<JenisKontrak> getAllJeniskontraks(){
|
private final PostCreateJenisKontrakService postCreateJenisKontrakService;
|
||||||
return jeniskontrakRepository.findAll();
|
private final PutUpdateJenisKontrakService putUpdateJenisKontrakService;
|
||||||
}
|
private final DeleteJenisKontrakService deleteJenisKontrakService;
|
||||||
|
|
||||||
// create
|
public JenisKontrakController(GetListJenisKontrakService getListJenisKontrakService,
|
||||||
@PostMapping
|
GetJenisKontrakByIdService getJenisKontrakByIdService,
|
||||||
public JenisKontrak createJeniskontrak(@RequestBody JenisKontrak jeniskontrak) {
|
PostCreateJenisKontrakService postCreateJenisKontrakService,
|
||||||
return jeniskontrakRepository.save(jeniskontrak);
|
PutUpdateJenisKontrakService putUpdateJenisKontrakService,
|
||||||
}
|
DeleteJenisKontrakService deleteJenisKontrakService) {
|
||||||
|
this.getListJenisKontrakService = getListJenisKontrakService;
|
||||||
|
this.getJenisKontrakByIdService = getJenisKontrakByIdService;
|
||||||
|
this.postCreateJenisKontrakService = postCreateJenisKontrakService;
|
||||||
|
this.putUpdateJenisKontrakService = putUpdateJenisKontrakService;
|
||||||
|
this.deleteJenisKontrakService = deleteJenisKontrakService;
|
||||||
|
}
|
||||||
|
|
||||||
// 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
|
@GetMapping
|
||||||
@PutMapping("/{id}")
|
public GetListJenisKontrakResponse getListJenisKontrak(@RequestParam(name = "search", required = false) String search,
|
||||||
public ResponseEntity<JenisKontrak> updateJeniskontrak(@PathVariable Long id, @RequestBody JenisKontrak jenisKontrakDetails){
|
@RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||||
JenisKontrak jeniskontrak = jeniskontrakRepository.findById(id)
|
@RequestParam(name = "size", defaultValue = "5") Integer size){
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Jeniskontrak not exist with id :" + id));
|
|
||||||
|
|
||||||
jeniskontrak.setJenisKontrak(jenisKontrakDetails.getJenisKontrak());
|
Pageable pageable = PageRequest.of((page - 1), size);
|
||||||
jeniskontrak.setKeterangan(jenisKontrakDetails.getKeterangan());
|
JenisKontrakRequest jenisKontrakRequest = JenisKontrakRequest.builder()
|
||||||
|
.search(search)
|
||||||
|
.pageable(pageable)
|
||||||
|
.build();
|
||||||
|
|
||||||
JenisKontrak updatedJenisKontrak = jeniskontrakRepository.save(jeniskontrak);
|
return getListJenisKontrakService.execute(jenisKontrakRequest);
|
||||||
return ResponseEntity.ok(updatedJenisKontrak);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// delete jeniskontrak rest api
|
@PostMapping
|
||||||
@DeleteMapping("/{id}")
|
public JenisKontrakResponse createJenisKontrak(@RequestBody JenisKontrakRequest jenisKontrakRequest) {
|
||||||
public ResponseEntity<Map<String, Boolean>> deleteJeniskontrak(@PathVariable Long id){
|
return postCreateJenisKontrakService.execute(jenisKontrakRequest);
|
||||||
JenisKontrak jeniskontrak = jeniskontrakRepository.findById(id)
|
}
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Jeniskontrak not exist with id :" + id));
|
|
||||||
|
|
||||||
jeniskontrakRepository.delete(jeniskontrak);
|
@GetMapping("/{id}")
|
||||||
Map<String, Boolean> response = new HashMap<>();
|
public JenisKontrakResponse getJenisKontrakById(@PathVariable Long id) {
|
||||||
response.put("deleted", Boolean.TRUE);
|
return getJenisKontrakByIdService.execute(JenisKontrakRequest.builder()
|
||||||
return ResponseEntity.ok(response);
|
.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());
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,69 +1,77 @@
|
|||||||
package com.iconplus.smartproc.controller;
|
package com.iconplus.smartproc.controller;
|
||||||
|
|
||||||
import com.iconplus.smartproc.model.entity.Lokasi;
|
|
||||||
import com.iconplus.smartproc.exception.ResourceNotFoundException;
|
|
||||||
import com.iconplus.smartproc.repository.LokasiRepository;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
import java.util.List;
|
import com.iconplus.smartproc.model.request.LokasiRequest;
|
||||||
import java.util.Map;
|
import com.iconplus.smartproc.model.response.GetListLokasiResponse;
|
||||||
|
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.*;
|
||||||
|
|
||||||
@CrossOrigin(origins = "http://localhost:8080", allowCredentials = "true")
|
@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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,68 +1,79 @@
|
|||||||
package com.iconplus.smartproc.controller;
|
package com.iconplus.smartproc.controller;
|
||||||
|
|
||||||
import com.iconplus.smartproc.model.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 com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
import java.util.List;
|
import com.iconplus.smartproc.model.request.MetodePengadaanRequest;
|
||||||
import java.util.Map;
|
import com.iconplus.smartproc.model.response.GetListMetodePengadaanResponse;
|
||||||
|
import com.iconplus.smartproc.model.response.MetodePengadaanResponse;
|
||||||
|
import com.iconplus.smartproc.repository.MetodePengadaanRepository;
|
||||||
|
import com.iconplus.smartproc.service.metodepengadaan.*;
|
||||||
|
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 = "http://localhost:8080", allowCredentials = "true")
|
@CrossOrigin(origins = "http://localhost:8080", allowCredentials = "true")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/metodepengadaan")
|
@RequestMapping("/api/metodepengadaan")
|
||||||
public class MetodePengadaanController {
|
public class MetodePengadaanController {
|
||||||
@Autowired
|
|
||||||
private MetodePengadaanRepository metodepengadaanRepository;
|
|
||||||
|
|
||||||
//get all data
|
private final GetListMetodePengadaanService getListMetodePengadaanService;
|
||||||
@GetMapping
|
private final GetMetodePengadaanByIdService getMetodePengadaanByIdService;
|
||||||
public List<MetodePengadaan> getAllMetodepengadaans(){
|
private final PostCreateMetodePengadaanService postCreateMetodePengadaanService;
|
||||||
return metodepengadaanRepository.findAll();
|
private final PutUpdateMetodePengadaanService putUpdateMetodePengadaanService;
|
||||||
}
|
private final DeleteMetodePengadaanService deleteMetodePengadaanService;
|
||||||
|
|
||||||
// create
|
public MetodePengadaanController(GetListMetodePengadaanService getListMetodePengadaanService,
|
||||||
@PostMapping
|
GetMetodePengadaanByIdService getMetodePengadaanByIdService,
|
||||||
public MetodePengadaan createMetodepengadaan(@RequestBody MetodePengadaan metodepengadaan) {
|
PostCreateMetodePengadaanService postCreateMetodePengadaanService,
|
||||||
return metodepengadaanRepository.save(metodepengadaan);
|
PutUpdateMetodePengadaanService putUpdateMetodePengadaanService,
|
||||||
}
|
DeleteMetodePengadaanService deleteMetodePengadaanService) {
|
||||||
|
this.getListMetodePengadaanService = getListMetodePengadaanService;
|
||||||
|
this.getMetodePengadaanByIdService = getMetodePengadaanByIdService;
|
||||||
|
this.postCreateMetodePengadaanService = postCreateMetodePengadaanService;
|
||||||
|
this.putUpdateMetodePengadaanService = putUpdateMetodePengadaanService;
|
||||||
|
this.deleteMetodePengadaanService = deleteMetodePengadaanService;
|
||||||
|
}
|
||||||
|
|
||||||
// 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
|
@GetMapping
|
||||||
@PutMapping("/{id}")
|
public GetListMetodePengadaanResponse getListMetodePengadaan(@RequestParam(name = "search", required = false) String search,
|
||||||
public ResponseEntity<MetodePengadaan> updateMetodepengadaan(@PathVariable Long id, @RequestBody MetodePengadaan metodePengadaanDetails){
|
@RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||||
MetodePengadaan metodepengadaan = metodepengadaanRepository.findById(id)
|
@RequestParam(name = "size", defaultValue = "5") Integer size){
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Metodepengadaan not exist with id :" + id));
|
|
||||||
|
|
||||||
metodepengadaan.setMetodePengadaan(metodePengadaanDetails.getMetodePengadaan());
|
Pageable pageable = PageRequest.of((page - 1), size);
|
||||||
metodepengadaan.setKeterangan(metodePengadaanDetails.getKeterangan());
|
MetodePengadaanRequest metodePengadaanRequest = MetodePengadaanRequest.builder()
|
||||||
|
.search(search)
|
||||||
|
.pageable(pageable)
|
||||||
|
.build();
|
||||||
|
|
||||||
MetodePengadaan updatedMetodePengadaan = metodepengadaanRepository.save(metodepengadaan);
|
return getListMetodePengadaanService.execute(metodePengadaanRequest);
|
||||||
return ResponseEntity.ok(updatedMetodePengadaan);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// delete metodepengadaan rest api
|
@PostMapping
|
||||||
@DeleteMapping("/{id}")
|
public MetodePengadaanResponse createMetodePengadaan(@RequestBody MetodePengadaanRequest metodePengadaanRequest) {
|
||||||
public ResponseEntity<Map<String, Boolean>> deleteMetodepengadaan(@PathVariable Long id){
|
return postCreateMetodePengadaanService.execute(metodePengadaanRequest);
|
||||||
MetodePengadaan metodepengadaan = metodepengadaanRepository.findById(id)
|
}
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Metodepengadaan not exist with id :" + id));
|
|
||||||
|
|
||||||
metodepengadaanRepository.delete(metodepengadaan);
|
@GetMapping("/{id}")
|
||||||
Map<String, Boolean> response = new HashMap<>();
|
public MetodePengadaanResponse getMetodePengadaanById(@PathVariable Long id) {
|
||||||
response.put("deleted", Boolean.TRUE);
|
return getMetodePengadaanByIdService.execute(MetodePengadaanRequest.builder()
|
||||||
return ResponseEntity.ok(response);
|
.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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,68 +1,82 @@
|
|||||||
package com.iconplus.smartproc.controller;
|
package com.iconplus.smartproc.controller;
|
||||||
|
|
||||||
import com.iconplus.smartproc.model.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 com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
import java.util.List;
|
import com.iconplus.smartproc.model.request.MetodePenyampaianRequest;
|
||||||
import java.util.Map;
|
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 = "http://localhost:8080", allowCredentials = "true")
|
@CrossOrigin(origins = "http://localhost:8080", allowCredentials = "true")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/metodepenyampaian")
|
@RequestMapping("/api/metodepenyampaian")
|
||||||
public class MetodePenyampaianController {
|
public class MetodePenyampaianController {
|
||||||
@Autowired
|
|
||||||
private MetodePenyampaianRepository metodepenyampaianRepository;
|
|
||||||
|
|
||||||
//get all data
|
@Autowired
|
||||||
@GetMapping
|
private MetodePenyampaianRepository metodepenyampaianRepository;
|
||||||
public List<MetodePenyampaian> getAllMetodepenyampaians(){
|
|
||||||
return metodepenyampaianRepository.findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
// create
|
private final GetListMetodePenyampaianService getListMetodePenyampaianService;
|
||||||
@PostMapping
|
private final GetMetodePenyampaianByIdService getMetodePenyampaianByIdService;
|
||||||
public MetodePenyampaian createMetodepenyampaian(@RequestBody MetodePenyampaian metodepenyampaian) {
|
private final PostCreateMetodePenyampaianService postCreateMetodePenyampaianService;
|
||||||
return metodepenyampaianRepository.save(metodepenyampaian);
|
private final PutUpdateMetodePenyampaianService putUpdateMetodePenyampaianService;
|
||||||
}
|
private final DeleteMetodePenyampaianService deleteMetodePenyampaianService;
|
||||||
|
|
||||||
// get metodepenyampaian by id rest api
|
public MetodePenyampaianController(GetListMetodePenyampaianService getListMetodePenyampaianService,
|
||||||
@GetMapping("/{id}")
|
GetMetodePenyampaianByIdService getMetodePenyampaianByIdService,
|
||||||
public ResponseEntity<MetodePenyampaian> getMetodepenyampaianById(@PathVariable Long id) {
|
PostCreateMetodePenyampaianService postCreateMetodePenyampaianService,
|
||||||
MetodePenyampaian metodepenyampaian = metodepenyampaianRepository.findById(id)
|
PutUpdateMetodePenyampaianService putUpdateMetodePenyampaianService,
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Metodepenyampaian not exist with id :" + id));
|
DeleteMetodePenyampaianService deleteMetodePenyampaianService) {
|
||||||
return ResponseEntity.ok(metodepenyampaian);
|
this.getListMetodePenyampaianService = getListMetodePenyampaianService;
|
||||||
}
|
this.getMetodePenyampaianByIdService = getMetodePenyampaianByIdService;
|
||||||
|
this.postCreateMetodePenyampaianService = postCreateMetodePenyampaianService;
|
||||||
|
this.putUpdateMetodePenyampaianService = putUpdateMetodePenyampaianService;
|
||||||
|
this.deleteMetodePenyampaianService = deleteMetodePenyampaianService;
|
||||||
|
}
|
||||||
|
|
||||||
// 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());
|
@GetMapping
|
||||||
metodepenyampaian.setKeterangan(metodePenyampaianDetails.getKeterangan());
|
public GetListMetodePenyampaianResponse getListMetodePenyampaian(@RequestParam(name = "search", required = false) String search,
|
||||||
|
@RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||||
|
@RequestParam(name = "size", defaultValue = "5") Integer size){
|
||||||
|
|
||||||
MetodePenyampaian updatedMetodePenyampaian = metodepenyampaianRepository.save(metodepenyampaian);
|
Pageable pageable = PageRequest.of((page - 1), size);
|
||||||
return ResponseEntity.ok(updatedMetodePenyampaian);
|
MetodePenyampaianRequest metodePenyampaianRequest = MetodePenyampaianRequest.builder()
|
||||||
}
|
.search(search)
|
||||||
|
.pageable(pageable)
|
||||||
|
.build();
|
||||||
|
|
||||||
// delete metodepenyampaian rest api
|
return getListMetodePenyampaianService.execute(metodePenyampaianRequest);
|
||||||
@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);
|
@PostMapping
|
||||||
Map<String, Boolean> response = new HashMap<>();
|
public MetodePenyampaianResponse createMetodePenyampaian(@RequestBody MetodePenyampaianRequest metodePenyampaianRequest) {
|
||||||
response.put("deleted", Boolean.TRUE);
|
return postCreateMetodePenyampaianService.execute(metodePenyampaianRequest);
|
||||||
return ResponseEntity.ok(response);
|
}
|
||||||
}
|
|
||||||
|
@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,69 +1,76 @@
|
|||||||
package com.iconplus.smartproc.controller;
|
package com.iconplus.smartproc.controller;
|
||||||
|
|
||||||
import com.iconplus.smartproc.model.entity.StrategiPengadaan;
|
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
import com.iconplus.smartproc.exception.ResourceNotFoundException;
|
import com.iconplus.smartproc.model.request.StrategiPengadaanRequest;
|
||||||
import com.iconplus.smartproc.repository.StrategiPengadaanRepository;
|
import com.iconplus.smartproc.model.response.GetListStrategiPengadaanResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import com.iconplus.smartproc.model.response.StrategiPengadaanResponse;
|
||||||
import org.springframework.http.ResponseEntity;
|
import com.iconplus.smartproc.service.strategipengadaan.*;
|
||||||
|
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;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@CrossOrigin(origins = "http://localhost:8080", allowCredentials = "true")
|
@CrossOrigin(origins = "http://localhost:8080", allowCredentials = "true")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/strategipengadaan")
|
@RequestMapping("/api/strategipengadaan")
|
||||||
public class StrategiPengadaanController {
|
public class StrategiPengadaanController {
|
||||||
@Autowired
|
|
||||||
private StrategiPengadaanRepository strategipengadaanRepository;
|
|
||||||
|
|
||||||
//get all data
|
private final DeleteStrategiPengadaanService deleteStrategiPengadaanService;
|
||||||
@GetMapping
|
private final GetListStrategiPengadaanService getListStrategiPengadaanService;
|
||||||
public List<StrategiPengadaan> getAllstrategipengadaans(){
|
private final GetStrategiPengadaanByIdService getStrategiPengadaanByIdService;
|
||||||
return strategipengadaanRepository.findAll();
|
private final PostCreateStrategiPengadaanService postCreateStrategiPengadaanService;
|
||||||
}
|
private final PutUpdateStrategiPengadaanService putUpdateStrategiPengadaanService;
|
||||||
|
|
||||||
// create
|
public StrategiPengadaanController(DeleteStrategiPengadaanService deleteStrategiPengadaanService,
|
||||||
@PostMapping
|
GetListStrategiPengadaanService getListStrategiPengadaanService,
|
||||||
public StrategiPengadaan createStrategipengadaan(@RequestBody StrategiPengadaan strategipengadaan) {
|
GetStrategiPengadaanByIdService getStrategiPengadaanByIdService,
|
||||||
return strategipengadaanRepository.save(strategipengadaan);
|
PostCreateStrategiPengadaanService postCreateStrategiPengadaanService,
|
||||||
}
|
PutUpdateStrategiPengadaanService putUpdateStrategiPengadaanService) {
|
||||||
|
this.deleteStrategiPengadaanService = deleteStrategiPengadaanService;
|
||||||
|
this.getListStrategiPengadaanService = getListStrategiPengadaanService;
|
||||||
|
this.getStrategiPengadaanByIdService = getStrategiPengadaanByIdService;
|
||||||
|
this.postCreateStrategiPengadaanService = postCreateStrategiPengadaanService;
|
||||||
|
this.putUpdateStrategiPengadaanService = putUpdateStrategiPengadaanService;
|
||||||
|
|
||||||
// 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
@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,74 +1,82 @@
|
|||||||
package com.iconplus.smartproc.controller;
|
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 com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
import org.springframework.http.ResponseEntity;
|
import com.iconplus.smartproc.model.request.SupplyPositioningMatrixRequest;
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
import com.iconplus.smartproc.model.response.GetListSupplyPositioningMatrixResponse;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import com.iconplus.smartproc.model.response.SupplyPositioningMatrixResponse;
|
||||||
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.model.entity.SupplyPositioningMatrix;
|
|
||||||
import com.iconplus.smartproc.repository.SupplyPositioningMatrixRepository;
|
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 = "http://localhost:8080", allowCredentials = "true")
|
@CrossOrigin(origins = "http://localhost:8080", allowCredentials = "true")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/supplypositioningmatrix")
|
@RequestMapping("/api/supplypositioningmatrix")
|
||||||
public class SupplyPositioningMatrixController {
|
public class SupplyPositioningMatrixController {
|
||||||
@Autowired
|
|
||||||
private SupplyPositioningMatrixRepository supplypositioningmatrixRepository;
|
|
||||||
|
|
||||||
//get all data
|
@Autowired
|
||||||
@GetMapping
|
private SupplyPositioningMatrixRepository supplypositioningmatrixRepository;
|
||||||
public List<SupplyPositioningMatrix> getAllSupplypositioningmatrix(){
|
|
||||||
return supplypositioningmatrixRepository.findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
// create
|
private final GetListSupplyPositioningMatrixService getListSupplyPositioningMatrixService;
|
||||||
@PostMapping
|
private final GetSupplyPositioningMatrixByIdService getSupplyPositioningMatrixByIdService;
|
||||||
public SupplyPositioningMatrix createSupplypositioningmatrix(@RequestBody SupplyPositioningMatrix supplypositioningmatrix) {
|
private final PostCreateSupplyPositioningMatrixService postCreateSupplyPositioningMatrixService;
|
||||||
return supplypositioningmatrixRepository.save(supplypositioningmatrix);
|
private final PutUpdateSupplyPositioningMatrixService putUpdateSupplyPositioningMatrixService;
|
||||||
}
|
private final DeleteSupplyPositioningMatrixService deleteSupplyPositioningMatrixService;
|
||||||
|
|
||||||
// get supplypositioningmatrix by id rest api
|
public SupplyPositioningMatrixController(GetListSupplyPositioningMatrixService getListSupplyPositioningMatrixService,
|
||||||
@GetMapping("/{id}")
|
GetSupplyPositioningMatrixByIdService getSupplyPositioningMatrixByIdService,
|
||||||
public ResponseEntity<SupplyPositioningMatrix> getSupplypositioningmatrixById(@PathVariable Long id) {
|
PostCreateSupplyPositioningMatrixService postCreateSupplyPositioningMatrixService,
|
||||||
SupplyPositioningMatrix supplypositioningmatrix = supplypositioningmatrixRepository.findById(id)
|
PutUpdateSupplyPositioningMatrixService putUpdateSupplyPositioningMatrixService,
|
||||||
.orElseThrow(() -> new ResourceNotFoundException("Supplypositioningmatrix not exist with id :" + id));
|
DeleteSupplyPositioningMatrixService deleteSupplyPositioningMatrixService) {
|
||||||
return ResponseEntity.ok(supplypositioningmatrix);
|
this.getListSupplyPositioningMatrixService = getListSupplyPositioningMatrixService;
|
||||||
}
|
this.getSupplyPositioningMatrixByIdService = getSupplyPositioningMatrixByIdService;
|
||||||
|
this.postCreateSupplyPositioningMatrixService = postCreateSupplyPositioningMatrixService;
|
||||||
|
this.putUpdateSupplyPositioningMatrixService = putUpdateSupplyPositioningMatrixService;
|
||||||
|
this.deleteSupplyPositioningMatrixService = deleteSupplyPositioningMatrixService;
|
||||||
|
}
|
||||||
|
|
||||||
// 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());
|
@GetMapping
|
||||||
supplypositioningmatrix.setKeterangan(supplyPositioningMatrixDetails.getKeterangan());
|
public GetListSupplyPositioningMatrixResponse getListSupplyPositioningMatrix(@RequestParam(name = "search", required = false) String search,
|
||||||
|
@RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||||
|
@RequestParam(name = "size", defaultValue = "5") Integer size){
|
||||||
|
|
||||||
SupplyPositioningMatrix updatedSupplyPositioningMatrix = supplypositioningmatrixRepository.save(supplypositioningmatrix);
|
Pageable pageable = PageRequest.of((page - 1), size);
|
||||||
return ResponseEntity.ok(updatedSupplyPositioningMatrix);
|
SupplyPositioningMatrixRequest supplyPositioningMatrixRequest = SupplyPositioningMatrixRequest.builder()
|
||||||
}
|
.search(search)
|
||||||
|
.pageable(pageable)
|
||||||
|
.build();
|
||||||
|
|
||||||
// delete jenispengadaan rest api
|
return getListSupplyPositioningMatrixService.execute(supplyPositioningMatrixRequest);
|
||||||
@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);
|
@PostMapping
|
||||||
Map<String, Boolean> response = new HashMap<>();
|
public SupplyPositioningMatrixResponse createSupplyPositioningMatrix(@RequestBody SupplyPositioningMatrixRequest supplyPositioningMatrixRequest) {
|
||||||
response.put("deleted", Boolean.TRUE);
|
return postCreateSupplyPositioningMatrixService.execute(supplyPositioningMatrixRequest);
|
||||||
return ResponseEntity.ok(response);
|
}
|
||||||
}
|
|
||||||
|
@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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,10 @@ public class MetodePengadaan extends BaseEntity {
|
|||||||
|
|
||||||
@Column(name = "is_active")
|
@Column(name = "is_active")
|
||||||
@Type(type = "org.hibernate.type.NumericBooleanType")
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
|
private Boolean isActive;
|
||||||
|
|
||||||
|
@Column(name = "is_delete")
|
||||||
|
@Type(type = "org.hibernate.type.NumericBooleanType")
|
||||||
private Boolean isDelete;
|
private Boolean isDelete;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.iconplus.smartproc.model.projection;
|
||||||
|
|
||||||
|
public interface JenisKontrakView {
|
||||||
|
Long getId();
|
||||||
|
String getJenisKontrak();
|
||||||
|
String getKeterangan();
|
||||||
|
Boolean getIsActive();
|
||||||
|
Boolean getIsDelete();
|
||||||
|
|
||||||
|
void setId(Long id);
|
||||||
|
void setJenisKontrak(String jenisKontrak);
|
||||||
|
void setKeterangan(String keterangan);
|
||||||
|
void setIsActive(Boolean isActive);
|
||||||
|
void setIsDelete(Boolean isDelete);
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.iconplus.smartproc.model.projection;
|
||||||
|
|
||||||
|
public interface LokasiView {
|
||||||
|
|
||||||
|
Long getId();
|
||||||
|
String getLokasi();
|
||||||
|
String getKeterangan();
|
||||||
|
Boolean getIsActive();
|
||||||
|
Boolean getIsDelete();
|
||||||
|
|
||||||
|
void setId(Long id);
|
||||||
|
void setLokasi(String lokasi);
|
||||||
|
void setKeterangan(String keterangan);
|
||||||
|
void setIsActive(Boolean isActive);
|
||||||
|
void setIsDelete(Boolean isDelete);
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.iconplus.smartproc.model.projection;
|
||||||
|
|
||||||
|
public interface MetodePengadaanView {
|
||||||
|
|
||||||
|
Long getId();
|
||||||
|
String getMetodePengadaan();
|
||||||
|
String getKeterangan();
|
||||||
|
Boolean getIsActive();
|
||||||
|
Boolean getIsDelete();
|
||||||
|
|
||||||
|
void setId(Long id);
|
||||||
|
void setMetodePengadaan(String metodePengadaan);
|
||||||
|
void setKeterangan(String keterangan);
|
||||||
|
void setIsActive(Boolean isActive);
|
||||||
|
void setIsDelete(Boolean isDelete);
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.iconplus.smartproc.model.projection;
|
||||||
|
|
||||||
|
public interface MetodePenyampaianView {
|
||||||
|
|
||||||
|
Long getId();
|
||||||
|
String getMetodePenyampaian();
|
||||||
|
String getKeterangan();
|
||||||
|
Boolean getIsActive();
|
||||||
|
Boolean getIsDelete();
|
||||||
|
|
||||||
|
void setId(Long id);
|
||||||
|
void setMetodePenyampaian(String metodePenyampaian);
|
||||||
|
void setKeterangan(String keterangan);
|
||||||
|
void setIsActive(Boolean isActive);
|
||||||
|
void setIsDelete(Boolean isDelete);
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.iconplus.smartproc.model.projection;
|
||||||
|
|
||||||
|
public interface StrategiPengadaanView {
|
||||||
|
|
||||||
|
Long getId();
|
||||||
|
String getStrategiPengadaan();
|
||||||
|
String getKeterangan();
|
||||||
|
Boolean getIsActive();
|
||||||
|
Boolean getIsDelete();
|
||||||
|
|
||||||
|
void setId(Long id);
|
||||||
|
void setStrategiPengadaan(String strategiPengadaan);
|
||||||
|
void setKeterangan(String keterangan);
|
||||||
|
void setIsActive(Boolean isActive);
|
||||||
|
void setIsDelete(Boolean isDelete);
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.iconplus.smartproc.model.projection;
|
||||||
|
|
||||||
|
public interface SupplyPositioningMatrixView {
|
||||||
|
|
||||||
|
Long getId();
|
||||||
|
String getSupplyPositioningMatrix();
|
||||||
|
String getKeterangan();
|
||||||
|
Boolean getIsActive();
|
||||||
|
Boolean getIsDelete();
|
||||||
|
|
||||||
|
void setId(Long id);
|
||||||
|
void setSupplyPositioningMatrix(String supplyPositioningMatrix);
|
||||||
|
void setKeterangan(String keterangan);
|
||||||
|
void setIsActive(Boolean isActive);
|
||||||
|
void setIsDelete(Boolean isDelete);
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.iconplus.smartproc.model.request;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseRequest;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class JenisKontrakRequest extends BaseRequest {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
private String jenisKontrak;
|
||||||
|
private String keterangan;
|
||||||
|
private Boolean isActive;
|
||||||
|
private Boolean isDelete;
|
||||||
|
private String search;
|
||||||
|
private transient Pageable pageable;
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.iconplus.smartproc.model.request;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseRequest;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class LokasiRequest extends BaseRequest {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
private String lokasi;
|
||||||
|
private String keterangan;
|
||||||
|
private Boolean isActive;
|
||||||
|
private Boolean isDelete;
|
||||||
|
private String search;
|
||||||
|
private transient Pageable pageable;
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.iconplus.smartproc.model.request;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseRequest;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class MetodePengadaanRequest extends BaseRequest {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
private String metodePengadaan;
|
||||||
|
private String keterangan;
|
||||||
|
private Boolean isActive;
|
||||||
|
private Boolean isDelete;
|
||||||
|
private String search;
|
||||||
|
private transient Pageable pageable;
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.iconplus.smartproc.model.request;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseRequest;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class MetodePenyampaianRequest extends BaseRequest {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
private String metodePenyampaian;
|
||||||
|
private String keterangan;
|
||||||
|
private Boolean isActive;
|
||||||
|
private Boolean isDelete;
|
||||||
|
private String search;
|
||||||
|
private transient Pageable pageable;
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.iconplus.smartproc.model.request;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseRequest;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class StrategiPengadaanRequest extends BaseRequest {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
private String strategiPengadaan;
|
||||||
|
private String keterangan;
|
||||||
|
private Boolean isActive;
|
||||||
|
private Boolean isDelete;
|
||||||
|
private String search;
|
||||||
|
private transient Pageable pageable;
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.iconplus.smartproc.model.request;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseRequest;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class SupplyPositioningMatrixRequest extends BaseRequest {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
private String supplyPositioningMatrix;
|
||||||
|
private String keterangan;
|
||||||
|
private Boolean isActive;
|
||||||
|
private Boolean isDelete;
|
||||||
|
private String search;
|
||||||
|
private transient Pageable pageable;
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.iconplus.smartproc.model.response;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseResponse;
|
||||||
|
import com.iconplus.smartproc.helper.model.Pagination;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class GetListJenisKontrakResponse extends BaseResponse {
|
||||||
|
|
||||||
|
private List<JenisKontrakResponse> data;
|
||||||
|
private Pagination pagination;
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.iconplus.smartproc.model.response;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseResponse;
|
||||||
|
import com.iconplus.smartproc.helper.model.Pagination;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class GetListLokasiResponse extends BaseResponse {
|
||||||
|
|
||||||
|
private List<LokasiResponse> data;
|
||||||
|
private Pagination pagination;
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.iconplus.smartproc.model.response;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseResponse;
|
||||||
|
import com.iconplus.smartproc.helper.model.Pagination;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class GetListMetodePengadaanResponse extends BaseResponse {
|
||||||
|
|
||||||
|
private List<MetodePengadaanResponse> data;
|
||||||
|
private Pagination pagination;
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.iconplus.smartproc.model.response;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseResponse;
|
||||||
|
import com.iconplus.smartproc.helper.model.Pagination;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class GetListMetodePenyampaianResponse extends BaseResponse {
|
||||||
|
|
||||||
|
private List<MetodePenyampaianResponse> data;
|
||||||
|
private Pagination pagination;
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.iconplus.smartproc.model.response;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseResponse;
|
||||||
|
import com.iconplus.smartproc.helper.model.Pagination;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class GetListStrategiPengadaanResponse extends BaseResponse {
|
||||||
|
|
||||||
|
private List<StrategiPengadaanResponse> data;
|
||||||
|
private Pagination pagination;
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.iconplus.smartproc.model.response;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseResponse;
|
||||||
|
import com.iconplus.smartproc.helper.model.Pagination;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class GetListSupplyPositioningMatrixResponse extends BaseResponse {
|
||||||
|
|
||||||
|
private List<SupplyPositioningMatrixResponse> data;
|
||||||
|
private Pagination pagination;
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.iconplus.smartproc.model.response;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseResponse;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class JenisKontrakResponse extends BaseResponse {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
private String jenisKontrak;
|
||||||
|
private String keterangan;
|
||||||
|
private Boolean isActive;
|
||||||
|
private Boolean isDelete;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.iconplus.smartproc.model.response;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseResponse;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class LokasiResponse extends BaseResponse {
|
||||||
|
|
||||||
|
private long id;
|
||||||
|
private String lokasi;
|
||||||
|
private String keterangan;
|
||||||
|
private Boolean isActive;
|
||||||
|
private Boolean isDelete;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.iconplus.smartproc.model.response;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseResponse;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class MetodePengadaanResponse extends BaseResponse {
|
||||||
|
|
||||||
|
private long id;
|
||||||
|
private String metodePengadaan;
|
||||||
|
private String keterangan;
|
||||||
|
private Boolean isActive;
|
||||||
|
private Boolean isDelete;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.iconplus.smartproc.model.response;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseResponse;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class MetodePenyampaianResponse extends BaseResponse {
|
||||||
|
|
||||||
|
private long id;
|
||||||
|
private String metodePenyampaian;
|
||||||
|
private String keterangan;
|
||||||
|
private Boolean isActive;
|
||||||
|
private Boolean isDelete;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.iconplus.smartproc.model.response;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseResponse;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class StrategiPengadaanResponse extends BaseResponse {
|
||||||
|
|
||||||
|
private long id;
|
||||||
|
private String strategiPengadaan;
|
||||||
|
private String keterangan;
|
||||||
|
private Boolean isActive;
|
||||||
|
private Boolean isDelete;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.iconplus.smartproc.model.response;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.base.BaseResponse;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class SupplyPositioningMatrixResponse extends BaseResponse {
|
||||||
|
|
||||||
|
private long id;
|
||||||
|
private String supplyPositioningMatrix;
|
||||||
|
private String keterangan;
|
||||||
|
private Boolean isActive;
|
||||||
|
private Boolean isDelete;
|
||||||
|
|
||||||
|
}
|
@ -1,10 +1,32 @@
|
|||||||
package com.iconplus.smartproc.repository;
|
package com.iconplus.smartproc.repository;
|
||||||
|
|
||||||
import com.iconplus.smartproc.model.entity.JenisKontrak;
|
import com.iconplus.smartproc.model.entity.JenisKontrak;
|
||||||
|
import com.iconplus.smartproc.model.projection.JenisKontrakView;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface JenisKontrakRepository extends JpaRepository<JenisKontrak, Long> {
|
public interface JenisKontrakRepository extends JpaRepository<JenisKontrak, Long> {
|
||||||
|
|
||||||
|
@Query(value = "SELECT jk.id as id, " +
|
||||||
|
"jk.jenisKontrak as jenisKontrak, " +
|
||||||
|
"jk.keterangan as keterangan, " +
|
||||||
|
"jk.isActive as isActive, " +
|
||||||
|
"jk.isDelete as isDelete " +
|
||||||
|
"FROM JenisKontrak jk " +
|
||||||
|
"WHERE jk.isDelete = false " +
|
||||||
|
"AND (:search is '' " +
|
||||||
|
"or UPPER(jk.jenisKontrak) like :search) " +
|
||||||
|
"ORDER BY jk.id")
|
||||||
|
Page<JenisKontrakView> getAllJenisKontrak(String search, Pageable pageable);
|
||||||
|
|
||||||
|
Optional<JenisKontrak> findByIdAndIsDeleteFalse(Long id);
|
||||||
|
|
||||||
|
Optional<JenisKontrak> findByJenisKontrakAndIsDeleteFalse(String jenisKontrak);
|
||||||
|
|
||||||
}
|
}
|
@ -1,10 +1,32 @@
|
|||||||
package com.iconplus.smartproc.repository;
|
package com.iconplus.smartproc.repository;
|
||||||
|
|
||||||
import com.iconplus.smartproc.model.entity.Lokasi;
|
import com.iconplus.smartproc.model.entity.Lokasi;
|
||||||
|
import com.iconplus.smartproc.model.projection.LokasiView;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface LokasiRepository extends JpaRepository<Lokasi, Long> {
|
public interface LokasiRepository extends JpaRepository<Lokasi, Long> {
|
||||||
|
|
||||||
|
@Query(value = "SELECT l.id as id, " +
|
||||||
|
"l.lokasi as lokasi, " +
|
||||||
|
"l.keterangan as keterangan, " +
|
||||||
|
"l.isActive as isActive, " +
|
||||||
|
"l.isDelete as isDelete " +
|
||||||
|
"FROM Lokasi l " +
|
||||||
|
"WHERE l.isDelete = false " +
|
||||||
|
"AND (:search = '' " +
|
||||||
|
"or UPPER(l.lokasi) like :search) " +
|
||||||
|
"ORDER BY l.id")
|
||||||
|
Page<LokasiView> getAllLokasi(String search, Pageable pageable);
|
||||||
|
|
||||||
|
Optional<Lokasi> findByIdAndIsDeleteFalse(Long id);
|
||||||
|
|
||||||
|
Optional<Lokasi> findByLokasiAndIsDeleteFalse(String lokasi);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,32 @@
|
|||||||
package com.iconplus.smartproc.repository;
|
package com.iconplus.smartproc.repository;
|
||||||
|
|
||||||
import com.iconplus.smartproc.model.entity.MetodePengadaan;
|
import com.iconplus.smartproc.model.entity.MetodePengadaan;
|
||||||
|
import com.iconplus.smartproc.model.projection.MetodePengadaanView;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface MetodePengadaanRepository extends JpaRepository<MetodePengadaan, Long> {
|
public interface MetodePengadaanRepository extends JpaRepository<MetodePengadaan, Long> {
|
||||||
|
|
||||||
|
@Query(value = "SELECT mp.id as id, " +
|
||||||
|
"mp.metodePengadaan as metodePengadaan, " +
|
||||||
|
"mp.keterangan as keterangan, " +
|
||||||
|
"mp.isActive as isActive, " +
|
||||||
|
"mp.isDelete as isDelete " +
|
||||||
|
"FROM MetodePengadaan mp " +
|
||||||
|
"WHERE mp.isDelete = false " +
|
||||||
|
"AND (:search = '' " +
|
||||||
|
"or UPPER(mp.metodePengadaan) like :search) " +
|
||||||
|
"ORDER BY mp.id")
|
||||||
|
Page<MetodePengadaanView> getAllMetodePengadaan(String search, Pageable pageable);
|
||||||
|
|
||||||
|
Optional<MetodePengadaan> findByIdAndIsDeleteFalse(Long id);
|
||||||
|
|
||||||
|
Optional<MetodePengadaan> findByMetodePengadaanAndIsDeleteFalse(String metodePengadaan);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,32 @@
|
|||||||
package com.iconplus.smartproc.repository;
|
package com.iconplus.smartproc.repository;
|
||||||
|
|
||||||
import com.iconplus.smartproc.model.entity.MetodePenyampaian;
|
import com.iconplus.smartproc.model.entity.MetodePenyampaian;
|
||||||
|
import com.iconplus.smartproc.model.projection.MetodePenyampaianView;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface MetodePenyampaianRepository extends JpaRepository<MetodePenyampaian, Long> {
|
public interface MetodePenyampaianRepository extends JpaRepository<MetodePenyampaian, Long> {
|
||||||
|
|
||||||
|
@Query(value = "SELECT mp.id as id, " +
|
||||||
|
"mp.metodePenyampaian as metodePenyampaian, " +
|
||||||
|
"mp.keterangan as keterangan, " +
|
||||||
|
"mp.isActive as isActive, " +
|
||||||
|
"mp.isDelete as isDelete " +
|
||||||
|
"FROM MetodePenyampaian mp " +
|
||||||
|
"WHERE mp.isDelete = false " +
|
||||||
|
"AND (:search = '' " +
|
||||||
|
"or UPPER(mp.metodePenyampaian) like :search) " +
|
||||||
|
"ORDER BY mp.id")
|
||||||
|
Page<MetodePenyampaianView> getAllMetodePenyampaian(String search, Pageable pageable);
|
||||||
|
|
||||||
|
Optional<MetodePenyampaian> findByIdAndIsDeleteFalse(Long id);
|
||||||
|
|
||||||
|
Optional<MetodePenyampaian> findByMetodePenyampaianAndIsDeleteFalse(String metodePenyampaian);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,32 @@
|
|||||||
package com.iconplus.smartproc.repository;
|
package com.iconplus.smartproc.repository;
|
||||||
|
|
||||||
import com.iconplus.smartproc.model.entity.StrategiPengadaan;
|
import com.iconplus.smartproc.model.entity.StrategiPengadaan;
|
||||||
|
import com.iconplus.smartproc.model.projection.StrategiPengadaanView;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface StrategiPengadaanRepository extends JpaRepository<StrategiPengadaan, Long> {
|
public interface StrategiPengadaanRepository extends JpaRepository<StrategiPengadaan, Long> {
|
||||||
|
|
||||||
|
@Query(value = "SELECT sp.id as id, " +
|
||||||
|
"sp.strategiPengadaan as strategiPengadaan, " +
|
||||||
|
"sp.keterangan as keterangan, " +
|
||||||
|
"sp.isActive as isActive, " +
|
||||||
|
"sp.isDelete as isDelete " +
|
||||||
|
"FROM StrategiPengadaan sp " +
|
||||||
|
"WHERE sp.isDelete = false " +
|
||||||
|
"AND (:search = '' " +
|
||||||
|
"or UPPER(sp.strategiPengadaan) like :search) " +
|
||||||
|
"ORDER BY sp.id")
|
||||||
|
Page<StrategiPengadaanView> getAllStrategiPengadaan(String search, Pageable pageable);
|
||||||
|
|
||||||
|
Optional<StrategiPengadaan> findByIdAndIsDeleteFalse(Long id);
|
||||||
|
|
||||||
|
Optional<StrategiPengadaan> findByStrategiPengadaanAndIsDeleteFalse(String strategiPengadaan);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,32 @@
|
|||||||
package com.iconplus.smartproc.repository;
|
package com.iconplus.smartproc.repository;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.model.projection.SupplyPositioningMatrixView;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
import com.iconplus.smartproc.model.entity.SupplyPositioningMatrix;
|
import com.iconplus.smartproc.model.entity.SupplyPositioningMatrix;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface SupplyPositioningMatrixRepository extends JpaRepository<SupplyPositioningMatrix, Long> {
|
public interface SupplyPositioningMatrixRepository extends JpaRepository<SupplyPositioningMatrix, Long> {
|
||||||
|
|
||||||
|
@Query(value = "SELECT spm.id as id, " +
|
||||||
|
"spm.supplyPositioningMatrix as supplyPositioningMatrix, " +
|
||||||
|
"spm.keterangan as keterangan, " +
|
||||||
|
"spm.isActive as isActive, " +
|
||||||
|
"spm.isDelete as isDelete " +
|
||||||
|
"FROM SupplyPositioningMatrix spm " +
|
||||||
|
"WHERE spm.isDelete = false " +
|
||||||
|
"AND (:search = '' " +
|
||||||
|
"or UPPER(spm.supplyPositioningMatrix) like :search) " +
|
||||||
|
"ORDER BY spm.id")
|
||||||
|
Page<SupplyPositioningMatrixView> getAllSupplyPositioningMatrix(String search, Pageable pageable);
|
||||||
|
|
||||||
|
Optional<SupplyPositioningMatrix> findByIdAndIsDeleteFalse(Long id);
|
||||||
|
|
||||||
|
Optional<SupplyPositioningMatrix> findBySupplyPositioningMatrixAndIsDeleteFalse(String supplyPositioningMatrix);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,38 @@
|
|||||||
|
package com.iconplus.smartproc.service.jeniskontrak;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.exception.BusinessException;
|
||||||
|
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
|
import com.iconplus.smartproc.helper.service.BaseService;
|
||||||
|
import com.iconplus.smartproc.model.request.JenisKontrakRequest;
|
||||||
|
import com.iconplus.smartproc.repository.JenisKontrakRepository;
|
||||||
|
import com.iconplus.smartproc.util.Constants;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class DeleteJenisKontrakService implements BaseService<JenisKontrakRequest, EmptyResponse> {
|
||||||
|
|
||||||
|
private JenisKontrakRepository jenisKontrakRepository;
|
||||||
|
|
||||||
|
public DeleteJenisKontrakService(JenisKontrakRepository jenisKontrakRepository) {
|
||||||
|
this.jenisKontrakRepository = jenisKontrakRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EmptyResponse execute(JenisKontrakRequest input) {
|
||||||
|
|
||||||
|
var jenisKontrak = jenisKontrakRepository.findByIdAndIsDeleteFalse(input.getId())
|
||||||
|
.orElseThrow(() -> new BusinessException(HttpStatus.CONFLICT,
|
||||||
|
Constants.ERR_CODE_10001,
|
||||||
|
Constants.ERR_TTL_10001,
|
||||||
|
String.format(Constants.ERR_MSG_10001, input.getId())));
|
||||||
|
|
||||||
|
jenisKontrak.setIsDelete(true);
|
||||||
|
jenisKontrakRepository.save(jenisKontrak);
|
||||||
|
log.info("success delete jenis kontrak id {}", jenisKontrak.getIsDelete());
|
||||||
|
return new EmptyResponse();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
package com.iconplus.smartproc.service.jeniskontrak;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.exception.BusinessException;
|
||||||
|
import com.iconplus.smartproc.helper.service.BaseService;
|
||||||
|
import com.iconplus.smartproc.model.request.JenisKontrakRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.JenisKontrakResponse;
|
||||||
|
import com.iconplus.smartproc.repository.JenisKontrakRepository;
|
||||||
|
import com.iconplus.smartproc.util.Constants;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class GetJenisKontrakByIdService implements BaseService<JenisKontrakRequest, JenisKontrakResponse> {
|
||||||
|
|
||||||
|
private final JenisKontrakRepository jenisKontrakRepository;
|
||||||
|
|
||||||
|
public GetJenisKontrakByIdService(JenisKontrakRepository jenisKontrakRepository) {
|
||||||
|
this.jenisKontrakRepository = jenisKontrakRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JenisKontrakResponse execute(JenisKontrakRequest input) {
|
||||||
|
var jenisKontrakView = jenisKontrakRepository.findByIdAndIsDeleteFalse(input.getId());
|
||||||
|
if (jenisKontrakView.isEmpty()) {
|
||||||
|
throw new BusinessException(HttpStatus.CONFLICT,
|
||||||
|
Constants.ERR_CODE_10001,
|
||||||
|
Constants.ERR_TTL_10001,
|
||||||
|
String.format(Constants.ERR_MSG_10001, input.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return JenisKontrakResponse.builder()
|
||||||
|
.id(jenisKontrakView.get().getId())
|
||||||
|
.jenisKontrak(jenisKontrakView.get().getJenisKontrak())
|
||||||
|
.keterangan(jenisKontrakView.get().getKeterangan())
|
||||||
|
.isActive(jenisKontrakView.get().getIsActive())
|
||||||
|
.isDelete(jenisKontrakView.get().getIsDelete())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
package com.iconplus.smartproc.service.jeniskontrak;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.model.Pagination;
|
||||||
|
import com.iconplus.smartproc.helper.service.BaseService;
|
||||||
|
import com.iconplus.smartproc.model.projection.JenisKontrakView;
|
||||||
|
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.repository.JenisKontrakRepository;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class GetListJenisKontrakService implements BaseService<JenisKontrakRequest, GetListJenisKontrakResponse> {
|
||||||
|
|
||||||
|
private JenisKontrakRepository jenisKontrakRepository;
|
||||||
|
|
||||||
|
public GetListJenisKontrakService(JenisKontrakRepository jenisKontrakRepository) {
|
||||||
|
this.jenisKontrakRepository = jenisKontrakRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GetListJenisKontrakResponse execute(JenisKontrakRequest input) {
|
||||||
|
validateRequest(input);
|
||||||
|
List<JenisKontrakResponse> jenisKontrakResponseList = new ArrayList<>();
|
||||||
|
var jenisKontrakViews = jenisKontrakRepository.getAllJenisKontrak(input.getSearch(), input.getPageable());
|
||||||
|
|
||||||
|
for (JenisKontrakView jenisKontrakView : jenisKontrakViews) {
|
||||||
|
JenisKontrakResponse jenisKontrakResponse = JenisKontrakResponse.builder()
|
||||||
|
.id(jenisKontrakView.getId())
|
||||||
|
.jenisKontrak(jenisKontrakView.getJenisKontrak())
|
||||||
|
.keterangan(jenisKontrakView.getKeterangan())
|
||||||
|
.isActive(jenisKontrakView.getIsActive())
|
||||||
|
.isDelete(jenisKontrakView.getIsDelete())
|
||||||
|
.build();
|
||||||
|
jenisKontrakResponseList.add(jenisKontrakResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetListJenisKontrakResponse.builder()
|
||||||
|
.data(jenisKontrakResponseList)
|
||||||
|
.pagination(Pagination.builder()
|
||||||
|
.pageSize(input.getPageable().getPageSize())
|
||||||
|
.currentPage(input.getPageable().getPageNumber())
|
||||||
|
.totalPages(jenisKontrakViews.getTotalPages())
|
||||||
|
.totalRecords(jenisKontrakViews.getTotalElements())
|
||||||
|
.isFirstPage(jenisKontrakViews.isFirst())
|
||||||
|
.isLastPage(jenisKontrakViews.isLast())
|
||||||
|
.build())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateRequest(JenisKontrakRequest input) {
|
||||||
|
if (StringUtils.isNotBlank(input.getSearch())) {
|
||||||
|
input.setSearch('%'+ input.getSearch().toUpperCase()+'%');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
package com.iconplus.smartproc.service.jeniskontrak;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.exception.BusinessException;
|
||||||
|
import com.iconplus.smartproc.helper.service.BaseService;
|
||||||
|
import com.iconplus.smartproc.model.entity.JenisKontrak;
|
||||||
|
import com.iconplus.smartproc.model.request.JenisKontrakRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.JenisKontrakResponse;
|
||||||
|
import com.iconplus.smartproc.repository.JenisKontrakRepository;
|
||||||
|
import com.iconplus.smartproc.util.Constants;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class PostCreateJenisKontrakService implements BaseService<JenisKontrakRequest, JenisKontrakResponse> {
|
||||||
|
|
||||||
|
private final JenisKontrakRepository jenisKontrakRepository;
|
||||||
|
|
||||||
|
public PostCreateJenisKontrakService(JenisKontrakRepository jenisKontrakRepository) {
|
||||||
|
this.jenisKontrakRepository = jenisKontrakRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JenisKontrakResponse execute(JenisKontrakRequest input) {
|
||||||
|
|
||||||
|
var existJenisKontrak = jenisKontrakRepository.findByJenisKontrakAndIsDeleteFalse(input.getJenisKontrak());
|
||||||
|
if (existJenisKontrak.isPresent()) {
|
||||||
|
throw new BusinessException(HttpStatus.CONFLICT,
|
||||||
|
Constants.ERR_CODE_10002,
|
||||||
|
Constants.ERR_TTL_10002,
|
||||||
|
String.format(Constants.ERR_MSG_10002, existJenisKontrak.get().getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
JenisKontrak jenisKontrak = JenisKontrak.builder()
|
||||||
|
.jenisKontrak(input.getJenisKontrak())
|
||||||
|
.isActive(input.getIsActive())
|
||||||
|
.keterangan(input.getKeterangan())
|
||||||
|
.isDelete(false)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
var result = jenisKontrakRepository.save(jenisKontrak);
|
||||||
|
log.info("success insert jenis kontrak id : {}", result.getId());
|
||||||
|
return JenisKontrakResponse.builder()
|
||||||
|
.id(result.getId())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
package com.iconplus.smartproc.service.jeniskontrak;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.exception.BusinessException;
|
||||||
|
import com.iconplus.smartproc.helper.service.BaseService;
|
||||||
|
import com.iconplus.smartproc.model.request.JenisKontrakRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.JenisKontrakResponse;
|
||||||
|
import com.iconplus.smartproc.repository.JenisKontrakRepository;
|
||||||
|
import com.iconplus.smartproc.util.Constants;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.BooleanUtils;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class PutUpdateJenisKontrakService implements BaseService<JenisKontrakRequest, JenisKontrakResponse> {
|
||||||
|
|
||||||
|
private JenisKontrakRepository jenisKontrakRepository;
|
||||||
|
|
||||||
|
public PutUpdateJenisKontrakService(JenisKontrakRepository jenisKontrakRepository) {
|
||||||
|
this.jenisKontrakRepository = jenisKontrakRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JenisKontrakResponse execute(JenisKontrakRequest input) {
|
||||||
|
|
||||||
|
var jenisKontrak = jenisKontrakRepository.findByIdAndIsDeleteFalse(input.getId())
|
||||||
|
.orElseThrow(() -> new BusinessException(HttpStatus.CONFLICT,
|
||||||
|
Constants.ERR_CODE_10001,
|
||||||
|
Constants.ERR_TTL_10001,
|
||||||
|
String.format(Constants.ERR_MSG_10001, input.getId())));
|
||||||
|
|
||||||
|
jenisKontrak.setJenisKontrak(input.getJenisKontrak());
|
||||||
|
jenisKontrak.setKeterangan(input.getKeterangan());
|
||||||
|
jenisKontrak.setIsActive(input.getIsActive());
|
||||||
|
jenisKontrakRepository.save(jenisKontrak);
|
||||||
|
log.info("Success edit jenis kontrak id {}", jenisKontrak.getId());
|
||||||
|
return JenisKontrakResponse.builder()
|
||||||
|
.id(jenisKontrak.getId())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package com.iconplus.smartproc.service.lokasi;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.exception.BusinessException;
|
||||||
|
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
|
import com.iconplus.smartproc.helper.service.BaseService;
|
||||||
|
import com.iconplus.smartproc.model.request.LokasiRequest;
|
||||||
|
import com.iconplus.smartproc.repository.LokasiRepository;
|
||||||
|
import com.iconplus.smartproc.util.Constants;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class DeleteLokasiService implements BaseService<LokasiRequest, EmptyResponse> {
|
||||||
|
|
||||||
|
private LokasiRepository lokasiRepository;
|
||||||
|
|
||||||
|
public DeleteLokasiService(LokasiRepository lokasiRepository) {
|
||||||
|
this.lokasiRepository = lokasiRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EmptyResponse execute(LokasiRequest input) {
|
||||||
|
|
||||||
|
var lokasi = lokasiRepository.findByIdAndIsDeleteFalse(input.getId())
|
||||||
|
.orElseThrow(() -> new BusinessException(HttpStatus.CONFLICT,
|
||||||
|
Constants.ERR_CODE_10001,
|
||||||
|
Constants.ERR_TTL_10001,
|
||||||
|
String.format(Constants.ERR_MSG_10001, input.getId())));
|
||||||
|
|
||||||
|
lokasi.setIsDelete(true);
|
||||||
|
lokasiRepository.save(lokasi);
|
||||||
|
log.info("success delete jenis lokasi id {}", lokasi.getIsDelete());
|
||||||
|
return new EmptyResponse();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
package com.iconplus.smartproc.service.lokasi;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.model.Pagination;
|
||||||
|
import com.iconplus.smartproc.helper.service.BaseService;
|
||||||
|
import com.iconplus.smartproc.model.projection.LokasiView;
|
||||||
|
import com.iconplus.smartproc.model.request.LokasiRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.GetListLokasiResponse;
|
||||||
|
import com.iconplus.smartproc.model.response.LokasiResponse;
|
||||||
|
import com.iconplus.smartproc.repository.LokasiRepository;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class GetListLokasiService implements BaseService<LokasiRequest, GetListLokasiResponse> {
|
||||||
|
|
||||||
|
private LokasiRepository lokasiRepository;
|
||||||
|
|
||||||
|
public GetListLokasiService(LokasiRepository lokasiRepository) {
|
||||||
|
this.lokasiRepository = lokasiRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GetListLokasiResponse execute(LokasiRequest input) {
|
||||||
|
validateRequest(input);
|
||||||
|
List<LokasiResponse> lokasiResponseList = new ArrayList<>();
|
||||||
|
Page<LokasiView> lokasiViews = lokasiRepository.getAllLokasi(input.getSearch(), input.getPageable());
|
||||||
|
|
||||||
|
for (LokasiView lokasiView : lokasiViews) {
|
||||||
|
LokasiResponse lokasiResponse = LokasiResponse.builder()
|
||||||
|
.id(lokasiView.getId())
|
||||||
|
.lokasi(lokasiView.getLokasi())
|
||||||
|
.keterangan(lokasiView.getKeterangan())
|
||||||
|
.isActive(lokasiView.getIsActive())
|
||||||
|
.isDelete(lokasiView.getIsDelete())
|
||||||
|
.build();
|
||||||
|
lokasiResponseList.add(lokasiResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetListLokasiResponse.builder()
|
||||||
|
.data(lokasiResponseList)
|
||||||
|
.pagination(Pagination.builder()
|
||||||
|
.pageSize(input.getPageable().getPageSize())
|
||||||
|
.currentPage(input.getPageable().getPageNumber())
|
||||||
|
.totalPages(lokasiViews.getTotalPages())
|
||||||
|
.totalRecords(lokasiViews.getTotalElements())
|
||||||
|
.isFirstPage(lokasiViews.isFirst())
|
||||||
|
.isLastPage(lokasiViews.isLast())
|
||||||
|
.build())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateRequest(LokasiRequest input) {
|
||||||
|
if (StringUtils.isNotBlank(input.getSearch())) {
|
||||||
|
input.setSearch('%'+ input.getSearch().toUpperCase()+'%');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
package com.iconplus.smartproc.service.lokasi;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.exception.BusinessException;
|
||||||
|
import com.iconplus.smartproc.helper.service.BaseService;
|
||||||
|
import com.iconplus.smartproc.model.request.LokasiRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.LokasiResponse;
|
||||||
|
import com.iconplus.smartproc.repository.LokasiRepository;
|
||||||
|
import com.iconplus.smartproc.util.Constants;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class GetLokasiByIdService implements BaseService<LokasiRequest, LokasiResponse> {
|
||||||
|
|
||||||
|
private final LokasiRepository lokasiRepository;
|
||||||
|
|
||||||
|
public GetLokasiByIdService(LokasiRepository lokasiRepository) {
|
||||||
|
this.lokasiRepository = lokasiRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LokasiResponse execute(LokasiRequest input) {
|
||||||
|
LokasiResponse lokasiResponse = new LokasiResponse();
|
||||||
|
var lokasiView = lokasiRepository.findByIdAndIsDeleteFalse(input.getId());
|
||||||
|
if (lokasiView.isEmpty()) {
|
||||||
|
throw new BusinessException(HttpStatus.CONFLICT,
|
||||||
|
Constants.ERR_CODE_10001,
|
||||||
|
Constants.ERR_TTL_10001,
|
||||||
|
String.format(Constants.ERR_MSG_10001, input.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
lokasiResponse.setLokasi(lokasiView.get().getLokasi());
|
||||||
|
lokasiResponse.setKeterangan(lokasiView.get().getKeterangan());
|
||||||
|
lokasiResponse.setIsDelete(lokasiView.get().getIsDelete());
|
||||||
|
|
||||||
|
return LokasiResponse.builder()
|
||||||
|
.id(lokasiView.get().getId())
|
||||||
|
.lokasi(lokasiView.get().getLokasi())
|
||||||
|
.keterangan(lokasiView.get().getKeterangan())
|
||||||
|
.isDelete(lokasiView.get().getIsDelete())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
package com.iconplus.smartproc.service.lokasi;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.exception.BusinessException;
|
||||||
|
import com.iconplus.smartproc.helper.service.BaseService;
|
||||||
|
import com.iconplus.smartproc.model.entity.Lokasi;
|
||||||
|
import com.iconplus.smartproc.model.request.LokasiRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.LokasiResponse;
|
||||||
|
import com.iconplus.smartproc.repository.LokasiRepository;
|
||||||
|
import com.iconplus.smartproc.util.Constants;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class PostCreateLokasiService implements BaseService<LokasiRequest, LokasiResponse> {
|
||||||
|
|
||||||
|
private final LokasiRepository lokasiRepository;
|
||||||
|
|
||||||
|
public PostCreateLokasiService(LokasiRepository lokasiRepository) {
|
||||||
|
this.lokasiRepository = lokasiRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LokasiResponse execute(LokasiRequest input) {
|
||||||
|
|
||||||
|
var existLokasi = lokasiRepository.findByLokasiAndIsDeleteFalse(input.getLokasi());
|
||||||
|
if (existLokasi.isPresent()) {
|
||||||
|
throw new BusinessException(HttpStatus.CONFLICT,
|
||||||
|
Constants.ERR_CODE_10002,
|
||||||
|
Constants.ERR_TTL_10002,
|
||||||
|
String.format(Constants.ERR_MSG_10002, input.getLokasi()));
|
||||||
|
}
|
||||||
|
|
||||||
|
Lokasi lokasi = Lokasi.builder()
|
||||||
|
.lokasi(input.getLokasi())
|
||||||
|
.keterangan(input.getKeterangan())
|
||||||
|
.isDelete(false)
|
||||||
|
.isActive(input.getIsActive())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
var result = lokasiRepository.save(lokasi);
|
||||||
|
log.info("success insert lokasi id : {}", result.getId());
|
||||||
|
return LokasiResponse.builder()
|
||||||
|
.id(result.getId())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
package com.iconplus.smartproc.service.lokasi;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.exception.BusinessException;
|
||||||
|
import com.iconplus.smartproc.helper.service.BaseService;
|
||||||
|
import com.iconplus.smartproc.model.request.LokasiRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.LokasiResponse;
|
||||||
|
import com.iconplus.smartproc.repository.LokasiRepository;
|
||||||
|
import com.iconplus.smartproc.util.Constants;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.BooleanUtils;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class PutUpdateLokasiService implements BaseService<LokasiRequest, LokasiResponse> {
|
||||||
|
|
||||||
|
private LokasiRepository lokasiRepository;
|
||||||
|
|
||||||
|
public PutUpdateLokasiService(LokasiRepository lokasiRepository) {
|
||||||
|
this.lokasiRepository = lokasiRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LokasiResponse execute(LokasiRequest input) {
|
||||||
|
|
||||||
|
var lokasi = lokasiRepository.findByIdAndIsDeleteFalse(input.getId())
|
||||||
|
.orElseThrow(() -> new BusinessException(HttpStatus.CONFLICT,
|
||||||
|
Constants.ERR_CODE_10001,
|
||||||
|
Constants.ERR_TTL_10001,
|
||||||
|
String.format(Constants.ERR_MSG_10001, input.getId())));
|
||||||
|
|
||||||
|
lokasi.setLokasi(input.getLokasi());
|
||||||
|
lokasi.setKeterangan(input.getKeterangan());
|
||||||
|
lokasi.setIsDelete(BooleanUtils.isTrue(input.getIsDelete()));
|
||||||
|
lokasi.setLastUpdate(new Timestamp(System.currentTimeMillis()));
|
||||||
|
lokasiRepository.save(lokasi);
|
||||||
|
log.info("Success edit lokasi id {}", lokasi.getId());
|
||||||
|
return LokasiResponse.builder()
|
||||||
|
.id(lokasi.getId())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package com.iconplus.smartproc.service.metodepengadaan;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.exception.BusinessException;
|
||||||
|
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
|
import com.iconplus.smartproc.helper.service.BaseService;
|
||||||
|
import com.iconplus.smartproc.model.request.MetodePengadaanRequest;
|
||||||
|
import com.iconplus.smartproc.repository.MetodePengadaanRepository;
|
||||||
|
import com.iconplus.smartproc.util.Constants;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class DeleteMetodePengadaanService implements BaseService<MetodePengadaanRequest, EmptyResponse> {
|
||||||
|
|
||||||
|
private MetodePengadaanRepository metodePengadaanRepository;
|
||||||
|
|
||||||
|
public DeleteMetodePengadaanService(MetodePengadaanRepository metodePengadaanRepository) {
|
||||||
|
this.metodePengadaanRepository = metodePengadaanRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EmptyResponse execute(MetodePengadaanRequest input) {
|
||||||
|
|
||||||
|
var metodePengadaan = metodePengadaanRepository.findByIdAndIsDeleteFalse(input.getId())
|
||||||
|
.orElseThrow(() -> new BusinessException(HttpStatus.CONFLICT,
|
||||||
|
Constants.ERR_CODE_10001,
|
||||||
|
Constants.ERR_TTL_10001,
|
||||||
|
String.format(Constants.ERR_MSG_10001, input.getId())));
|
||||||
|
|
||||||
|
metodePengadaan.setIsDelete(true);
|
||||||
|
metodePengadaanRepository.save(metodePengadaan);
|
||||||
|
log.info("success delete metode pengadaan id {}", metodePengadaan.getIsDelete());
|
||||||
|
return new EmptyResponse();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
package com.iconplus.smartproc.service.metodepengadaan;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.model.Pagination;
|
||||||
|
import com.iconplus.smartproc.helper.service.BaseService;
|
||||||
|
import com.iconplus.smartproc.model.projection.MetodePengadaanView;
|
||||||
|
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.repository.MetodePengadaanRepository;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class GetListMetodePengadaanService implements BaseService<MetodePengadaanRequest, GetListMetodePengadaanResponse> {
|
||||||
|
|
||||||
|
private MetodePengadaanRepository metodePengadaanRepository;
|
||||||
|
|
||||||
|
public GetListMetodePengadaanService(MetodePengadaanRepository metodePengadaanRepository) {
|
||||||
|
this.metodePengadaanRepository = metodePengadaanRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GetListMetodePengadaanResponse execute(MetodePengadaanRequest input) {
|
||||||
|
validateRequest(input);
|
||||||
|
List<MetodePengadaanResponse> metodePengadaanResponseList = new ArrayList<>();
|
||||||
|
Page<MetodePengadaanView> metodePengadaanViews = metodePengadaanRepository.getAllMetodePengadaan(input.getSearch(), input.getPageable());
|
||||||
|
|
||||||
|
for (MetodePengadaanView metodePengadaanView : metodePengadaanViews) {
|
||||||
|
MetodePengadaanResponse metodePengadaanResponse = MetodePengadaanResponse.builder()
|
||||||
|
.id(metodePengadaanView.getId())
|
||||||
|
.metodePengadaan(metodePengadaanView.getMetodePengadaan())
|
||||||
|
.keterangan(metodePengadaanView.getKeterangan())
|
||||||
|
.isActive(metodePengadaanView.getIsActive())
|
||||||
|
.isDelete(metodePengadaanView.getIsDelete())
|
||||||
|
.build();
|
||||||
|
metodePengadaanResponseList.add(metodePengadaanResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetListMetodePengadaanResponse.builder()
|
||||||
|
.data(metodePengadaanResponseList)
|
||||||
|
.pagination(Pagination.builder()
|
||||||
|
.pageSize(input.getPageable().getPageSize())
|
||||||
|
.currentPage(input.getPageable().getPageNumber())
|
||||||
|
.totalPages(metodePengadaanViews.getTotalPages())
|
||||||
|
.totalRecords(metodePengadaanViews.getTotalElements())
|
||||||
|
.isFirstPage(metodePengadaanViews.isFirst())
|
||||||
|
.isLastPage(metodePengadaanViews.isLast())
|
||||||
|
.build())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateRequest(MetodePengadaanRequest input) {
|
||||||
|
if (StringUtils.isNotBlank(input.getSearch())) {
|
||||||
|
input.setSearch('%'+ input.getSearch().toUpperCase()+'%');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
package com.iconplus.smartproc.service.metodepengadaan;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.exception.BusinessException;
|
||||||
|
import com.iconplus.smartproc.helper.service.BaseService;
|
||||||
|
import com.iconplus.smartproc.model.request.MetodePengadaanRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.MetodePengadaanResponse;
|
||||||
|
import com.iconplus.smartproc.repository.MetodePengadaanRepository;
|
||||||
|
import com.iconplus.smartproc.util.Constants;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class GetMetodePengadaanByIdService implements BaseService<MetodePengadaanRequest, MetodePengadaanResponse> {
|
||||||
|
|
||||||
|
private final MetodePengadaanRepository metodePengadaanRepository;
|
||||||
|
|
||||||
|
public GetMetodePengadaanByIdService(MetodePengadaanRepository metodePengadaanRepository) {
|
||||||
|
this.metodePengadaanRepository = metodePengadaanRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MetodePengadaanResponse execute(MetodePengadaanRequest input) {
|
||||||
|
|
||||||
|
var metodePengadaanView = metodePengadaanRepository.findByIdAndIsDeleteFalse(input.getId());
|
||||||
|
if (metodePengadaanView.isEmpty()) {
|
||||||
|
throw new BusinessException(HttpStatus.CONFLICT,
|
||||||
|
Constants.ERR_CODE_10001,
|
||||||
|
Constants.ERR_TTL_10001,
|
||||||
|
String.format(Constants.ERR_MSG_10001, input.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return MetodePengadaanResponse.builder()
|
||||||
|
.id(metodePengadaanView.get().getId())
|
||||||
|
.metodePengadaan(metodePengadaanView.get().getMetodePengadaan())
|
||||||
|
.keterangan(metodePengadaanView.get().getKeterangan())
|
||||||
|
.isActive(metodePengadaanView.get().getIsActive())
|
||||||
|
.isDelete(metodePengadaanView.get().getIsDelete())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
package com.iconplus.smartproc.service.metodepengadaan;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.exception.BusinessException;
|
||||||
|
import com.iconplus.smartproc.helper.service.BaseService;
|
||||||
|
import com.iconplus.smartproc.model.entity.MetodePengadaan;
|
||||||
|
import com.iconplus.smartproc.model.request.MetodePengadaanRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.MetodePengadaanResponse;
|
||||||
|
import com.iconplus.smartproc.repository.MetodePengadaanRepository;
|
||||||
|
import com.iconplus.smartproc.util.Constants;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class PostCreateMetodePengadaanService implements BaseService<MetodePengadaanRequest, MetodePengadaanResponse> {
|
||||||
|
|
||||||
|
private final MetodePengadaanRepository metodePengadaanRepository;
|
||||||
|
|
||||||
|
public PostCreateMetodePengadaanService(MetodePengadaanRepository metodePengadaanRepository) {
|
||||||
|
this.metodePengadaanRepository = metodePengadaanRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MetodePengadaanResponse execute(MetodePengadaanRequest input) {
|
||||||
|
|
||||||
|
var existMetodePengadaan = metodePengadaanRepository.findByMetodePengadaanAndIsDeleteFalse(input.getMetodePengadaan());
|
||||||
|
if (existMetodePengadaan.isPresent()) {
|
||||||
|
throw new BusinessException(HttpStatus.CONFLICT,
|
||||||
|
Constants.ERR_CODE_10002,
|
||||||
|
Constants.ERR_TTL_10002,
|
||||||
|
String.format(Constants.ERR_MSG_10002, input.getMetodePengadaan()));
|
||||||
|
}
|
||||||
|
|
||||||
|
MetodePengadaan metodePengadaan = MetodePengadaan.builder()
|
||||||
|
.metodePengadaan(input.getMetodePengadaan())
|
||||||
|
.keterangan(input.getKeterangan())
|
||||||
|
.isActive(input.getIsActive())
|
||||||
|
.isDelete(false)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
var result = metodePengadaanRepository.save(metodePengadaan);
|
||||||
|
log.info("success insert metode pengadaan id : {}", result.getId());
|
||||||
|
return MetodePengadaanResponse.builder()
|
||||||
|
.id(result.getId())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package com.iconplus.smartproc.service.metodepengadaan;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.exception.BusinessException;
|
||||||
|
import com.iconplus.smartproc.helper.service.BaseService;
|
||||||
|
import com.iconplus.smartproc.model.request.MetodePengadaanRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.MetodePengadaanResponse;
|
||||||
|
import com.iconplus.smartproc.repository.MetodePengadaanRepository;
|
||||||
|
import com.iconplus.smartproc.util.Constants;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.BooleanUtils;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class PutUpdateMetodePengadaanService implements BaseService<MetodePengadaanRequest, MetodePengadaanResponse> {
|
||||||
|
|
||||||
|
private MetodePengadaanRepository metodePengadaanRepository;
|
||||||
|
|
||||||
|
public PutUpdateMetodePengadaanService(MetodePengadaanRepository metodePengadaanRepository) {
|
||||||
|
this.metodePengadaanRepository = metodePengadaanRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MetodePengadaanResponse execute(MetodePengadaanRequest input) {
|
||||||
|
|
||||||
|
var metodePengadaan = metodePengadaanRepository.findByIdAndIsDeleteFalse(input.getId())
|
||||||
|
.orElseThrow(() -> new BusinessException(HttpStatus.CONFLICT,
|
||||||
|
Constants.ERR_CODE_10001,
|
||||||
|
Constants.ERR_TTL_10001,
|
||||||
|
String.format(Constants.ERR_MSG_10001, input.getId())));
|
||||||
|
|
||||||
|
metodePengadaan.setMetodePengadaan(input.getMetodePengadaan());
|
||||||
|
metodePengadaan.setKeterangan(input.getKeterangan());
|
||||||
|
metodePengadaan.setIsActive(input.getIsActive());
|
||||||
|
metodePengadaanRepository.save(metodePengadaan);
|
||||||
|
log.info("Success edit metode pengadaan id {}", metodePengadaan.getId());
|
||||||
|
return MetodePengadaanResponse.builder()
|
||||||
|
.id(metodePengadaan.getId())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package com.iconplus.smartproc.service.metodepenyampaian;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.exception.BusinessException;
|
||||||
|
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
|
import com.iconplus.smartproc.helper.service.BaseService;
|
||||||
|
import com.iconplus.smartproc.model.request.MetodePenyampaianRequest;
|
||||||
|
import com.iconplus.smartproc.repository.MetodePenyampaianRepository;
|
||||||
|
import com.iconplus.smartproc.util.Constants;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class DeleteMetodePenyampaianService implements BaseService<MetodePenyampaianRequest, EmptyResponse> {
|
||||||
|
|
||||||
|
private MetodePenyampaianRepository metodePenyampaianRepository;
|
||||||
|
|
||||||
|
public DeleteMetodePenyampaianService(MetodePenyampaianRepository metodePenyampaianRepository) {
|
||||||
|
this.metodePenyampaianRepository = metodePenyampaianRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EmptyResponse execute(MetodePenyampaianRequest input) {
|
||||||
|
|
||||||
|
var metodePenyampaian = metodePenyampaianRepository.findByIdAndIsDeleteFalse(input.getId())
|
||||||
|
.orElseThrow(() -> new BusinessException(HttpStatus.CONFLICT,
|
||||||
|
Constants.ERR_CODE_10001,
|
||||||
|
Constants.ERR_TTL_10001,
|
||||||
|
String.format(Constants.ERR_MSG_10001, input.getId())));
|
||||||
|
|
||||||
|
metodePenyampaian.setIsDelete(true);
|
||||||
|
metodePenyampaianRepository.save(metodePenyampaian);
|
||||||
|
log.info("success delete metode penyampaian id {}", metodePenyampaian.getIsDelete());
|
||||||
|
return new EmptyResponse();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
package com.iconplus.smartproc.service.metodepenyampaian;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.model.Pagination;
|
||||||
|
import com.iconplus.smartproc.helper.service.BaseService;
|
||||||
|
import com.iconplus.smartproc.model.projection.MetodePenyampaianView;
|
||||||
|
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 org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class GetListMetodePenyampaianService implements BaseService<MetodePenyampaianRequest, GetListMetodePenyampaianResponse> {
|
||||||
|
|
||||||
|
private MetodePenyampaianRepository metodePenyampaianRepository;
|
||||||
|
|
||||||
|
public GetListMetodePenyampaianService(MetodePenyampaianRepository metodePenyampaianRepository) {
|
||||||
|
this.metodePenyampaianRepository = metodePenyampaianRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GetListMetodePenyampaianResponse execute(MetodePenyampaianRequest input) {
|
||||||
|
validateRequest(input);
|
||||||
|
List<MetodePenyampaianResponse> metodePenyampaianResponseList = new ArrayList<>();
|
||||||
|
Page<MetodePenyampaianView> metodePenyampaianViews = metodePenyampaianRepository.getAllMetodePenyampaian(input.getSearch(), input.getPageable());
|
||||||
|
|
||||||
|
for (MetodePenyampaianView metodePenyampaianView : metodePenyampaianViews) {
|
||||||
|
MetodePenyampaianResponse metodePenyampaianResponse = MetodePenyampaianResponse.builder()
|
||||||
|
.id(metodePenyampaianView.getId())
|
||||||
|
.metodePenyampaian(metodePenyampaianView.getMetodePenyampaian())
|
||||||
|
.keterangan(metodePenyampaianView.getKeterangan())
|
||||||
|
.isActive(metodePenyampaianView.getIsActive())
|
||||||
|
.isDelete(metodePenyampaianView.getIsDelete())
|
||||||
|
.build();
|
||||||
|
metodePenyampaianResponseList.add(metodePenyampaianResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetListMetodePenyampaianResponse.builder()
|
||||||
|
.data(metodePenyampaianResponseList)
|
||||||
|
.pagination(Pagination.builder()
|
||||||
|
.pageSize(input.getPageable().getPageSize())
|
||||||
|
.currentPage(input.getPageable().getPageNumber())
|
||||||
|
.totalPages(metodePenyampaianViews.getTotalPages())
|
||||||
|
.totalRecords(metodePenyampaianViews.getTotalElements())
|
||||||
|
.isFirstPage(metodePenyampaianViews.isFirst())
|
||||||
|
.isLastPage(metodePenyampaianViews.isLast())
|
||||||
|
.build())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateRequest(MetodePenyampaianRequest input) {
|
||||||
|
if (StringUtils.isNotBlank(input.getSearch())) {
|
||||||
|
input.setSearch('%'+ input.getSearch().toUpperCase()+'%');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
package com.iconplus.smartproc.service.metodepenyampaian;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.exception.BusinessException;
|
||||||
|
import com.iconplus.smartproc.helper.service.BaseService;
|
||||||
|
import com.iconplus.smartproc.model.request.MetodePenyampaianRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.MetodePenyampaianResponse;
|
||||||
|
import com.iconplus.smartproc.repository.MetodePenyampaianRepository;
|
||||||
|
import com.iconplus.smartproc.util.Constants;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class GetMetodePenyampaianByIdService implements BaseService<MetodePenyampaianRequest, MetodePenyampaianResponse> {
|
||||||
|
|
||||||
|
private final MetodePenyampaianRepository metodePenyampaianRepository;
|
||||||
|
|
||||||
|
public GetMetodePenyampaianByIdService(MetodePenyampaianRepository metodePenyampaianRepository) {
|
||||||
|
this.metodePenyampaianRepository = metodePenyampaianRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MetodePenyampaianResponse execute(MetodePenyampaianRequest input) {
|
||||||
|
var metodePenyampaianView = metodePenyampaianRepository.findByIdAndIsDeleteFalse(input.getId());
|
||||||
|
if (metodePenyampaianView.isEmpty()) {
|
||||||
|
throw new BusinessException(HttpStatus.CONFLICT,
|
||||||
|
Constants.ERR_CODE_10001,
|
||||||
|
Constants.ERR_TTL_10001,
|
||||||
|
String.format(Constants.ERR_MSG_10001, input.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return MetodePenyampaianResponse.builder()
|
||||||
|
.id(metodePenyampaianView.get().getId())
|
||||||
|
.metodePenyampaian(metodePenyampaianView.get().getMetodePenyampaian())
|
||||||
|
.keterangan(metodePenyampaianView.get().getKeterangan())
|
||||||
|
.isActive(metodePenyampaianView.get().getIsActive())
|
||||||
|
.isDelete(metodePenyampaianView.get().getIsDelete())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
package com.iconplus.smartproc.service.metodepenyampaian;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.exception.BusinessException;
|
||||||
|
import com.iconplus.smartproc.helper.service.BaseService;
|
||||||
|
import com.iconplus.smartproc.model.entity.MetodePenyampaian;
|
||||||
|
import com.iconplus.smartproc.model.request.MetodePenyampaianRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.MetodePenyampaianResponse;
|
||||||
|
import com.iconplus.smartproc.repository.MetodePenyampaianRepository;
|
||||||
|
import com.iconplus.smartproc.util.Constants;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class PostCreateMetodePenyampaianService implements BaseService<MetodePenyampaianRequest, MetodePenyampaianResponse> {
|
||||||
|
|
||||||
|
private final MetodePenyampaianRepository metodePenyampaianRepository;
|
||||||
|
|
||||||
|
public PostCreateMetodePenyampaianService(MetodePenyampaianRepository metodePenyampaianRepository) {
|
||||||
|
this.metodePenyampaianRepository = metodePenyampaianRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MetodePenyampaianResponse execute(MetodePenyampaianRequest input) {
|
||||||
|
|
||||||
|
var existMetodePenyampaian = metodePenyampaianRepository.findByMetodePenyampaianAndIsDeleteFalse(input.getMetodePenyampaian());
|
||||||
|
if (existMetodePenyampaian.isPresent()) {
|
||||||
|
throw new BusinessException(HttpStatus.CONFLICT,
|
||||||
|
Constants.ERR_CODE_10002,
|
||||||
|
Constants.ERR_TTL_10002,
|
||||||
|
String.format(Constants.ERR_MSG_10002, input.getMetodePenyampaian()));
|
||||||
|
}
|
||||||
|
|
||||||
|
MetodePenyampaian metodePenyampaian = MetodePenyampaian.builder()
|
||||||
|
.metodePenyampaian(input.getMetodePenyampaian())
|
||||||
|
.keterangan(input.getKeterangan())
|
||||||
|
.isActive(input.getIsActive())
|
||||||
|
.isDelete(false)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
var result = metodePenyampaianRepository.save(metodePenyampaian);
|
||||||
|
log.info("success insert metode penyampaian id : {}", result.getId());
|
||||||
|
return MetodePenyampaianResponse.builder()
|
||||||
|
.id(result.getId())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package com.iconplus.smartproc.service.metodepenyampaian;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.exception.BusinessException;
|
||||||
|
import com.iconplus.smartproc.helper.service.BaseService;
|
||||||
|
import com.iconplus.smartproc.model.request.MetodePenyampaianRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.MetodePenyampaianResponse;
|
||||||
|
import com.iconplus.smartproc.repository.MetodePenyampaianRepository;
|
||||||
|
import com.iconplus.smartproc.util.Constants;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.BooleanUtils;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class PutUpdateMetodePenyampaianService implements BaseService<MetodePenyampaianRequest, MetodePenyampaianResponse> {
|
||||||
|
|
||||||
|
private MetodePenyampaianRepository metodePenyampaianRepository;
|
||||||
|
|
||||||
|
public PutUpdateMetodePenyampaianService(MetodePenyampaianRepository metodePenyampaianRepository) {
|
||||||
|
this.metodePenyampaianRepository = metodePenyampaianRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MetodePenyampaianResponse execute(MetodePenyampaianRequest input) {
|
||||||
|
|
||||||
|
var metodePenyampaian = metodePenyampaianRepository.findByIdAndIsDeleteFalse(input.getId())
|
||||||
|
.orElseThrow(() -> new BusinessException(HttpStatus.CONFLICT,
|
||||||
|
Constants.ERR_CODE_10001,
|
||||||
|
Constants.ERR_TTL_10001,
|
||||||
|
String.format(Constants.ERR_MSG_10001, input.getId())));
|
||||||
|
|
||||||
|
metodePenyampaian.setMetodePenyampaian(input.getMetodePenyampaian());
|
||||||
|
metodePenyampaian.setKeterangan(input.getKeterangan());
|
||||||
|
metodePenyampaian.setIsActive(input.getIsActive());
|
||||||
|
metodePenyampaianRepository.save(metodePenyampaian);
|
||||||
|
log.info("Success edit metode penyampaian id {}", metodePenyampaian.getId());
|
||||||
|
return MetodePenyampaianResponse.builder()
|
||||||
|
.id(metodePenyampaian.getId())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package com.iconplus.smartproc.service.strategipengadaan;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.exception.BusinessException;
|
||||||
|
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
|
import com.iconplus.smartproc.helper.service.BaseService;
|
||||||
|
import com.iconplus.smartproc.model.request.StrategiPengadaanRequest;
|
||||||
|
import com.iconplus.smartproc.repository.StrategiPengadaanRepository;
|
||||||
|
import com.iconplus.smartproc.util.Constants;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class DeleteStrategiPengadaanService implements BaseService<StrategiPengadaanRequest, EmptyResponse> {
|
||||||
|
|
||||||
|
private StrategiPengadaanRepository strategiPengadaanRepository;
|
||||||
|
|
||||||
|
public DeleteStrategiPengadaanService(StrategiPengadaanRepository strategiPengadaanRepository) {
|
||||||
|
this.strategiPengadaanRepository = strategiPengadaanRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EmptyResponse execute(StrategiPengadaanRequest input) {
|
||||||
|
|
||||||
|
var strategiPengadaan = strategiPengadaanRepository.findByIdAndIsDeleteFalse(input.getId())
|
||||||
|
.orElseThrow(() -> new BusinessException(HttpStatus.CONFLICT,
|
||||||
|
Constants.ERR_CODE_10001,
|
||||||
|
Constants.ERR_TTL_10001,
|
||||||
|
String.format(Constants.ERR_MSG_10001, input.getId())));
|
||||||
|
|
||||||
|
strategiPengadaan.setIsDelete(true);
|
||||||
|
strategiPengadaanRepository.save(strategiPengadaan);
|
||||||
|
log.info("success delete strategi pengadaan id {}", strategiPengadaan.getIsDelete());
|
||||||
|
return new EmptyResponse();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
package com.iconplus.smartproc.service.strategipengadaan;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.model.Pagination;
|
||||||
|
import com.iconplus.smartproc.helper.service.BaseService;
|
||||||
|
import com.iconplus.smartproc.model.projection.StrategiPengadaanView;
|
||||||
|
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.repository.StrategiPengadaanRepository;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class GetListStrategiPengadaanService implements BaseService<StrategiPengadaanRequest, GetListStrategiPengadaanResponse> {
|
||||||
|
|
||||||
|
private StrategiPengadaanRepository strategiPengadaanRepository;
|
||||||
|
|
||||||
|
public GetListStrategiPengadaanService(StrategiPengadaanRepository strategiPengadaanRepository) {
|
||||||
|
this.strategiPengadaanRepository = strategiPengadaanRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GetListStrategiPengadaanResponse execute(StrategiPengadaanRequest input) {
|
||||||
|
validateRequest(input);
|
||||||
|
List<StrategiPengadaanResponse> strategiPengadaanResponseList = new ArrayList<>();
|
||||||
|
Page<StrategiPengadaanView> strategiPengadaanViews = strategiPengadaanRepository.getAllStrategiPengadaan(input.getSearch(), input.getPageable());
|
||||||
|
|
||||||
|
for (StrategiPengadaanView strategiPengadaanView : strategiPengadaanViews) {
|
||||||
|
StrategiPengadaanResponse strategiPengadaanResponse = StrategiPengadaanResponse.builder()
|
||||||
|
.id(strategiPengadaanView.getId())
|
||||||
|
.strategiPengadaan(strategiPengadaanView.getStrategiPengadaan())
|
||||||
|
.keterangan(strategiPengadaanView.getKeterangan())
|
||||||
|
.isActive(strategiPengadaanView.getIsActive())
|
||||||
|
.isDelete(strategiPengadaanView.getIsDelete())
|
||||||
|
.build();
|
||||||
|
strategiPengadaanResponseList.add(strategiPengadaanResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetListStrategiPengadaanResponse.builder()
|
||||||
|
.data(strategiPengadaanResponseList)
|
||||||
|
.pagination(Pagination.builder()
|
||||||
|
.pageSize(input.getPageable().getPageSize())
|
||||||
|
.currentPage(input.getPageable().getPageNumber())
|
||||||
|
.totalPages(strategiPengadaanViews.getTotalPages())
|
||||||
|
.totalRecords(strategiPengadaanViews.getTotalElements())
|
||||||
|
.isFirstPage(strategiPengadaanViews.isFirst())
|
||||||
|
.isLastPage(strategiPengadaanViews.isLast())
|
||||||
|
.build())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateRequest(StrategiPengadaanRequest input) {
|
||||||
|
if (StringUtils.isNotBlank(input.getSearch())) {
|
||||||
|
input.setSearch('%'+ input.getSearch().toUpperCase()+'%');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
package com.iconplus.smartproc.service.strategipengadaan;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.exception.BusinessException;
|
||||||
|
import com.iconplus.smartproc.helper.service.BaseService;
|
||||||
|
import com.iconplus.smartproc.model.request.StrategiPengadaanRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.StrategiPengadaanResponse;
|
||||||
|
import com.iconplus.smartproc.repository.StrategiPengadaanRepository;
|
||||||
|
import com.iconplus.smartproc.util.Constants;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class GetStrategiPengadaanByIdService implements BaseService<StrategiPengadaanRequest, StrategiPengadaanResponse> {
|
||||||
|
|
||||||
|
private final StrategiPengadaanRepository strategiPengadaanRepository;
|
||||||
|
|
||||||
|
public GetStrategiPengadaanByIdService(StrategiPengadaanRepository strategiPengadaanRepository) {
|
||||||
|
this.strategiPengadaanRepository = strategiPengadaanRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StrategiPengadaanResponse execute(StrategiPengadaanRequest input) {
|
||||||
|
var strategiPengadaanView = strategiPengadaanRepository.findByIdAndIsDeleteFalse(input.getId());
|
||||||
|
if (strategiPengadaanView.isEmpty()) {
|
||||||
|
throw new BusinessException(HttpStatus.CONFLICT,
|
||||||
|
Constants.ERR_CODE_10001,
|
||||||
|
Constants.ERR_TTL_10001,
|
||||||
|
String.format(Constants.ERR_MSG_10001, input.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return StrategiPengadaanResponse.builder()
|
||||||
|
.id(strategiPengadaanView.get().getId())
|
||||||
|
.strategiPengadaan(strategiPengadaanView.get().getStrategiPengadaan())
|
||||||
|
.keterangan(strategiPengadaanView.get().getKeterangan())
|
||||||
|
.isActive(strategiPengadaanView.get().getIsActive())
|
||||||
|
.isDelete(strategiPengadaanView.get().getIsDelete())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
package com.iconplus.smartproc.service.strategipengadaan;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.exception.BusinessException;
|
||||||
|
import com.iconplus.smartproc.helper.service.BaseService;
|
||||||
|
import com.iconplus.smartproc.model.entity.StrategiPengadaan;
|
||||||
|
import com.iconplus.smartproc.model.request.StrategiPengadaanRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.StrategiPengadaanResponse;
|
||||||
|
import com.iconplus.smartproc.repository.StrategiPengadaanRepository;
|
||||||
|
import com.iconplus.smartproc.util.Constants;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class PostCreateStrategiPengadaanService implements BaseService<StrategiPengadaanRequest, StrategiPengadaanResponse> {
|
||||||
|
|
||||||
|
private final StrategiPengadaanRepository strategiPengadaanRepository;
|
||||||
|
|
||||||
|
public PostCreateStrategiPengadaanService(StrategiPengadaanRepository strategiPengadaanRepository) {
|
||||||
|
this.strategiPengadaanRepository = strategiPengadaanRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StrategiPengadaanResponse execute(StrategiPengadaanRequest input) {
|
||||||
|
|
||||||
|
var existStrategiPengadaan = strategiPengadaanRepository.findByStrategiPengadaanAndIsDeleteFalse(input.getStrategiPengadaan());
|
||||||
|
if (existStrategiPengadaan.isPresent()) {
|
||||||
|
throw new BusinessException(HttpStatus.CONFLICT,
|
||||||
|
Constants.ERR_CODE_10002,
|
||||||
|
Constants.ERR_TTL_10002,
|
||||||
|
String.format(Constants.ERR_MSG_10002, input.getStrategiPengadaan()));
|
||||||
|
}
|
||||||
|
|
||||||
|
StrategiPengadaan strategiPengadaan = StrategiPengadaan.builder()
|
||||||
|
.strategiPengadaan(input.getStrategiPengadaan())
|
||||||
|
.keterangan(input.getKeterangan())
|
||||||
|
.isActive(input.getIsActive())
|
||||||
|
.isDelete(false)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
var result = strategiPengadaanRepository.save(strategiPengadaan);
|
||||||
|
log.info("success insert strategi pengadaan id : {}", result.getId());
|
||||||
|
return StrategiPengadaanResponse.builder()
|
||||||
|
.id(result.getId())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package com.iconplus.smartproc.service.strategipengadaan;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.exception.BusinessException;
|
||||||
|
import com.iconplus.smartproc.helper.service.BaseService;
|
||||||
|
import com.iconplus.smartproc.model.request.StrategiPengadaanRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.StrategiPengadaanResponse;
|
||||||
|
import com.iconplus.smartproc.repository.StrategiPengadaanRepository;
|
||||||
|
import com.iconplus.smartproc.util.Constants;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.BooleanUtils;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class PutUpdateStrategiPengadaanService implements BaseService<StrategiPengadaanRequest, StrategiPengadaanResponse> {
|
||||||
|
|
||||||
|
private StrategiPengadaanRepository strategiPengadaanRepository;
|
||||||
|
|
||||||
|
public PutUpdateStrategiPengadaanService(StrategiPengadaanRepository strategiPengadaanRepository) {
|
||||||
|
this.strategiPengadaanRepository = strategiPengadaanRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StrategiPengadaanResponse execute(StrategiPengadaanRequest input) {
|
||||||
|
|
||||||
|
var strategiPengadaan = strategiPengadaanRepository.findByIdAndIsDeleteFalse(input.getId())
|
||||||
|
.orElseThrow(() -> new BusinessException(HttpStatus.CONFLICT,
|
||||||
|
Constants.ERR_CODE_10001,
|
||||||
|
Constants.ERR_TTL_10001,
|
||||||
|
String.format(Constants.ERR_MSG_10001, input.getId())));
|
||||||
|
|
||||||
|
strategiPengadaan.setStrategiPengadaan(input.getStrategiPengadaan());
|
||||||
|
strategiPengadaan.setKeterangan(input.getKeterangan());
|
||||||
|
strategiPengadaan.setIsActive(input.getIsActive());
|
||||||
|
strategiPengadaanRepository.save(strategiPengadaan);
|
||||||
|
log.info("Success edit strategi pengadaan id {}", strategiPengadaan.getId());
|
||||||
|
return StrategiPengadaanResponse.builder()
|
||||||
|
.id(strategiPengadaan.getId())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package com.iconplus.smartproc.service.supplypositioningmatrix;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.exception.BusinessException;
|
||||||
|
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||||
|
import com.iconplus.smartproc.helper.service.BaseService;
|
||||||
|
import com.iconplus.smartproc.model.request.SupplyPositioningMatrixRequest;
|
||||||
|
import com.iconplus.smartproc.repository.SupplyPositioningMatrixRepository;
|
||||||
|
import com.iconplus.smartproc.util.Constants;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class DeleteSupplyPositioningMatrixService implements BaseService<SupplyPositioningMatrixRequest, EmptyResponse> {
|
||||||
|
|
||||||
|
private SupplyPositioningMatrixRepository supplyPositioningMatrixRepository;
|
||||||
|
|
||||||
|
public DeleteSupplyPositioningMatrixService(SupplyPositioningMatrixRepository supplyPositioningMatrixRepository) {
|
||||||
|
this.supplyPositioningMatrixRepository = supplyPositioningMatrixRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EmptyResponse execute(SupplyPositioningMatrixRequest input) {
|
||||||
|
|
||||||
|
var supplyPositioningMatrix = supplyPositioningMatrixRepository.findByIdAndIsDeleteFalse(input.getId())
|
||||||
|
.orElseThrow(() -> new BusinessException(HttpStatus.CONFLICT,
|
||||||
|
Constants.ERR_CODE_10001,
|
||||||
|
Constants.ERR_TTL_10001,
|
||||||
|
String.format(Constants.ERR_MSG_10001, input.getId())));
|
||||||
|
|
||||||
|
supplyPositioningMatrix.setIsDelete(true);
|
||||||
|
supplyPositioningMatrixRepository.save(supplyPositioningMatrix);
|
||||||
|
log.info("success delete supply positioning matrix id {}", supplyPositioningMatrix.getIsDelete());
|
||||||
|
return new EmptyResponse();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
package com.iconplus.smartproc.service.supplypositioningmatrix;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.helper.model.Pagination;
|
||||||
|
import com.iconplus.smartproc.helper.service.BaseService;
|
||||||
|
import com.iconplus.smartproc.model.projection.SupplyPositioningMatrixView;
|
||||||
|
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 org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class GetListSupplyPositioningMatrixService implements BaseService<SupplyPositioningMatrixRequest, GetListSupplyPositioningMatrixResponse> {
|
||||||
|
|
||||||
|
private SupplyPositioningMatrixRepository supplyPositioningMatrixRepository;
|
||||||
|
|
||||||
|
public GetListSupplyPositioningMatrixService(SupplyPositioningMatrixRepository supplyPositioningMatrixRepository) {
|
||||||
|
this.supplyPositioningMatrixRepository = supplyPositioningMatrixRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GetListSupplyPositioningMatrixResponse execute(SupplyPositioningMatrixRequest input) {
|
||||||
|
validateRequest(input);
|
||||||
|
List<SupplyPositioningMatrixResponse> supplyPositioningMatrixResponseList = new ArrayList<>();
|
||||||
|
Page<SupplyPositioningMatrixView> supplyPositioningMatrixViews = supplyPositioningMatrixRepository.getAllSupplyPositioningMatrix(input.getSearch(), input.getPageable());
|
||||||
|
|
||||||
|
for (SupplyPositioningMatrixView supplyPositioningMatrixView : supplyPositioningMatrixViews) {
|
||||||
|
SupplyPositioningMatrixResponse supplyPositioningMatrixResponse = SupplyPositioningMatrixResponse.builder()
|
||||||
|
.id(supplyPositioningMatrixView.getId())
|
||||||
|
.supplyPositioningMatrix(supplyPositioningMatrixView.getSupplyPositioningMatrix())
|
||||||
|
.keterangan(supplyPositioningMatrixView.getKeterangan())
|
||||||
|
.isActive(supplyPositioningMatrixView.getIsActive())
|
||||||
|
.isDelete(supplyPositioningMatrixView.getIsDelete())
|
||||||
|
.build();
|
||||||
|
supplyPositioningMatrixResponseList.add(supplyPositioningMatrixResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetListSupplyPositioningMatrixResponse.builder()
|
||||||
|
.data(supplyPositioningMatrixResponseList)
|
||||||
|
.pagination(Pagination.builder()
|
||||||
|
.pageSize(input.getPageable().getPageSize())
|
||||||
|
.currentPage(input.getPageable().getPageNumber())
|
||||||
|
.totalPages(supplyPositioningMatrixViews.getTotalPages())
|
||||||
|
.totalRecords(supplyPositioningMatrixViews.getTotalElements())
|
||||||
|
.isFirstPage(supplyPositioningMatrixViews.isFirst())
|
||||||
|
.isLastPage(supplyPositioningMatrixViews.isLast())
|
||||||
|
.build())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateRequest(SupplyPositioningMatrixRequest input) {
|
||||||
|
if (StringUtils.isNotBlank(input.getSearch())) {
|
||||||
|
input.setSearch('%'+ input.getSearch().toUpperCase()+'%');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
package com.iconplus.smartproc.service.supplypositioningmatrix;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.exception.BusinessException;
|
||||||
|
import com.iconplus.smartproc.helper.service.BaseService;
|
||||||
|
import com.iconplus.smartproc.model.request.SupplyPositioningMatrixRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.SupplyPositioningMatrixResponse;
|
||||||
|
import com.iconplus.smartproc.repository.SupplyPositioningMatrixRepository;
|
||||||
|
import com.iconplus.smartproc.util.Constants;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class GetSupplyPositioningMatrixByIdService implements BaseService<SupplyPositioningMatrixRequest, SupplyPositioningMatrixResponse> {
|
||||||
|
|
||||||
|
private final SupplyPositioningMatrixRepository supplyPositioningMatrixRepository;
|
||||||
|
|
||||||
|
public GetSupplyPositioningMatrixByIdService(SupplyPositioningMatrixRepository supplyPositioningMatrixRepository) {
|
||||||
|
this.supplyPositioningMatrixRepository = supplyPositioningMatrixRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SupplyPositioningMatrixResponse execute(SupplyPositioningMatrixRequest input) {
|
||||||
|
var supplyPositioningMatrixView = supplyPositioningMatrixRepository.findByIdAndIsDeleteFalse(input.getId());
|
||||||
|
if (supplyPositioningMatrixView.isEmpty()) {
|
||||||
|
throw new BusinessException(HttpStatus.CONFLICT,
|
||||||
|
Constants.ERR_CODE_10001,
|
||||||
|
Constants.ERR_TTL_10001,
|
||||||
|
String.format(Constants.ERR_MSG_10001, input.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return SupplyPositioningMatrixResponse.builder()
|
||||||
|
.id(supplyPositioningMatrixView.get().getId())
|
||||||
|
.supplyPositioningMatrix(supplyPositioningMatrixView.get().getSupplyPositioningMatrix())
|
||||||
|
.keterangan(supplyPositioningMatrixView.get().getKeterangan())
|
||||||
|
.isActive(supplyPositioningMatrixView.get().getIsActive())
|
||||||
|
.isDelete(supplyPositioningMatrixView.get().getIsDelete())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
package com.iconplus.smartproc.service.supplypositioningmatrix;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.exception.BusinessException;
|
||||||
|
import com.iconplus.smartproc.helper.service.BaseService;
|
||||||
|
import com.iconplus.smartproc.model.entity.SupplyPositioningMatrix;
|
||||||
|
import com.iconplus.smartproc.model.request.SupplyPositioningMatrixRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.SupplyPositioningMatrixResponse;
|
||||||
|
import com.iconplus.smartproc.repository.SupplyPositioningMatrixRepository;
|
||||||
|
import com.iconplus.smartproc.util.Constants;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class PostCreateSupplyPositioningMatrixService implements BaseService<SupplyPositioningMatrixRequest, SupplyPositioningMatrixResponse> {
|
||||||
|
|
||||||
|
private final SupplyPositioningMatrixRepository supplyPositioningMatrixRepository;
|
||||||
|
|
||||||
|
public PostCreateSupplyPositioningMatrixService(SupplyPositioningMatrixRepository supplyPositioningMatrixRepository) {
|
||||||
|
this.supplyPositioningMatrixRepository = supplyPositioningMatrixRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SupplyPositioningMatrixResponse execute(SupplyPositioningMatrixRequest input) {
|
||||||
|
|
||||||
|
var existSupplyPositioningMatrix = supplyPositioningMatrixRepository.findBySupplyPositioningMatrixAndIsDeleteFalse(input.getSupplyPositioningMatrix());
|
||||||
|
if (existSupplyPositioningMatrix.isPresent()) {
|
||||||
|
throw new BusinessException(HttpStatus.CONFLICT,
|
||||||
|
Constants.ERR_CODE_10002,
|
||||||
|
Constants.ERR_TTL_10002,
|
||||||
|
String.format(Constants.ERR_MSG_10002, input.getSupplyPositioningMatrix()));
|
||||||
|
}
|
||||||
|
|
||||||
|
SupplyPositioningMatrix supplyPositioningMatrix = SupplyPositioningMatrix.builder()
|
||||||
|
.supplyPositioningMatrix(input.getSupplyPositioningMatrix())
|
||||||
|
.keterangan(input.getKeterangan())
|
||||||
|
.isActive(input.getIsActive())
|
||||||
|
.isDelete(false)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
var result = supplyPositioningMatrixRepository.save(supplyPositioningMatrix);
|
||||||
|
log.info("success insert supply positioning matrix id : {}", result.getId());
|
||||||
|
return SupplyPositioningMatrixResponse.builder()
|
||||||
|
.id(result.getId())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package com.iconplus.smartproc.service.supplypositioningmatrix;
|
||||||
|
|
||||||
|
import com.iconplus.smartproc.exception.BusinessException;
|
||||||
|
import com.iconplus.smartproc.helper.service.BaseService;
|
||||||
|
import com.iconplus.smartproc.model.request.SupplyPositioningMatrixRequest;
|
||||||
|
import com.iconplus.smartproc.model.response.SupplyPositioningMatrixResponse;
|
||||||
|
import com.iconplus.smartproc.repository.SupplyPositioningMatrixRepository;
|
||||||
|
import com.iconplus.smartproc.util.Constants;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.BooleanUtils;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class PutUpdateSupplyPositioningMatrixService implements BaseService<SupplyPositioningMatrixRequest, SupplyPositioningMatrixResponse> {
|
||||||
|
|
||||||
|
private SupplyPositioningMatrixRepository supplyPositioningMatrixRepository;
|
||||||
|
|
||||||
|
public PutUpdateSupplyPositioningMatrixService(SupplyPositioningMatrixRepository supplyPositioningMatrixRepository) {
|
||||||
|
this.supplyPositioningMatrixRepository = supplyPositioningMatrixRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SupplyPositioningMatrixResponse execute(SupplyPositioningMatrixRequest input) {
|
||||||
|
|
||||||
|
var supplyPositioningMatrix = supplyPositioningMatrixRepository.findByIdAndIsDeleteFalse(input.getId())
|
||||||
|
.orElseThrow(() -> new BusinessException(HttpStatus.CONFLICT,
|
||||||
|
Constants.ERR_CODE_10001,
|
||||||
|
Constants.ERR_TTL_10001,
|
||||||
|
String.format(Constants.ERR_MSG_10001, input.getId())));
|
||||||
|
|
||||||
|
supplyPositioningMatrix.setSupplyPositioningMatrix(input.getSupplyPositioningMatrix());
|
||||||
|
supplyPositioningMatrix.setKeterangan(input.getKeterangan());
|
||||||
|
supplyPositioningMatrix.setIsActive(input.getIsActive());
|
||||||
|
supplyPositioningMatrixRepository.save(supplyPositioningMatrix);
|
||||||
|
log.info("Success edit supply positioning matrix id {}", supplyPositioningMatrix.getId());
|
||||||
|
return SupplyPositioningMatrixResponse.builder()
|
||||||
|
.id(supplyPositioningMatrix.getId())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user