Commit 1f245008 authored by akbar fauzi's avatar akbar fauzi

service :

modify url api and add new service
parent c7928c70
......@@ -38,4 +38,5 @@ public class PODealerDTO {
private String draftNumber;
private String uploadPO;
private Long version;
private String posServiceID;
}
package com.eksad.masterdata.common.dto;
import com.eksad.masterdata.common.listEnum.ReceiptCategory;
import com.eksad.masterdata.common.listEnum.ReceiptKind;
import com.eksad.masterdata.common.listEnum.ReceiptStatus;
import com.eksad.masterdata.common.listEnum.ReceiptType;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.io.Serializable;
import java.util.Date;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class ReceiptSOTunaiDTO implements Serializable {
/**
* Transactional Base Object
*/
private String createdBy;
private Date createdDate;
private String updatedBy;
private Date updatedDate;
private String recordID;
private Long version;
/**
* Receipt
*/
private String receiptID;
private Date receiptDocDate;
private ReceiptType receiptType;
private ReceiptCategory receiptCategory;
private ReceiptKind receiptKind;
private Double receiptAmount;
private String receiptNote;
private ReceiptStatus receiptStatus;
private Double receiptPaidAmount;
private Double receiptDpOutstandingAmount;
private Double receiptOutstandingAmount;
private String terbilang;
private String terbilangDPOutstandingAmount;
private String soID;
private Double kembalian;
private Double biayaTambahan;
private String ahasscode;
public ReceiptSOTunaiDTO(String createdBy, Date createdDate, String updatedBy, Date updatedDate, String recordID, Long version, String receiptID, Date receiptDocDate, ReceiptType receiptType, ReceiptCategory receiptCategory, ReceiptKind receiptKind, Double receiptAmount, String receiptNote, ReceiptStatus receiptStatus, Double receiptPaidAmount, Double receiptDpOutstandingAmount, Double receiptOutstandingAmount, String terbilang, String terbilangDPOutstandingAmount, String soID, Double kembalian, Double biayaTambahan) {
this.createdBy = createdBy;
this.createdDate = createdDate;
this.updatedBy = updatedBy;
this.updatedDate = updatedDate;
this.recordID = recordID;
this.version = version;
this.receiptID = receiptID;
this.receiptDocDate = receiptDocDate;
this.receiptType = receiptType;
this.receiptCategory = receiptCategory;
this.receiptKind = receiptKind;
this.receiptAmount = receiptAmount;
this.receiptNote = receiptNote;
this.receiptStatus = receiptStatus;
this.receiptPaidAmount = receiptPaidAmount;
this.receiptDpOutstandingAmount = receiptDpOutstandingAmount;
this.receiptOutstandingAmount = receiptOutstandingAmount;
this.terbilang = terbilang;
this.terbilangDPOutstandingAmount = terbilangDPOutstandingAmount;
this.soID = soID;
this.kembalian = kembalian;
this.biayaTambahan = biayaTambahan;
}
}
package com.eksad.masterdata.controller;
import com.eksad.ddms.common.util.response.ResponseDTO;
import com.eksad.ddms.common.util.status.ResponseStatus;
import com.eksad.masterdata.common.dto.ConfigurationDTO;
import com.eksad.masterdata.common.dto.responseDto.ResponseConfigurationGetDTO;
import com.eksad.masterdata.service.ConfigurationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
@RequestMapping("/configuration")
public class ConfigurationRESTController {
@Autowired
ConfigurationService configurationService;
@RequestMapping(value = "/get/{key}/{ahassId}",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<ResponseConfigurationGetDTO> getConfigurationByKeyAndAhassID(@PathVariable("key") String key, @PathVariable("ahassId") String ahassId) throws ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchFieldException {
ConfigurationDTO configurationDTO = configurationService.getConfigurationByKeyAndAhassID(key, ahassId);
ResponseConfigurationGetDTO responseConfigurationGetDTO = new ResponseConfigurationGetDTO();
responseConfigurationGetDTO.setResponse(new ResponseDTO(ResponseStatus.S, HttpStatus.OK.toString(), "Found Configuration"));
responseConfigurationGetDTO.setConfigurationDTO(configurationDTO);
return ResponseEntity.ok(responseConfigurationGetDTO);
}
}
......@@ -35,17 +35,11 @@ public class DPHLORestController {
private String URL_AHM_GET_DEALER = "/get.dealer.by.ahm.dealer.code/{ahmDealerCode}";
private static final String md_url = "http://api-cbr.daya-dms.id/masterdata/";
@Value("${dam.gigr.h3}")
public String GIGRH3_URL;
@Value("${dam.masterdata.h3}")
private String MD_URL;
@Value("${dam.receipt.command}")
private String RECEIPT_COMMAND_URL;
@Value("${dam.receipt.query}")
private String RECEIPT_QUERY_URL;
@Value("${ddms.h3.service.slave}")
private String DDMS_H3_SERVICE_SLAVE;
private ResponseDPHLOTempDTO responseDTO = new ResponseDPHLOTempDTO();
private ReceiptSOTunaiChangeCommandDTO receiptDTO = new ReceiptSOTunaiChangeCommandDTO();
......@@ -217,7 +211,7 @@ public class DPHLORestController {
public PODealerDTO getHotlineDatas(String poNumber) {
Map<String, String> params = new HashMap<>();
String url = GIGRH3_URL + "/get.podealer.with.ponumber/{poNumber}";
String url = DDMS_H3_SERVICE_SLAVE + "/get.podealer.with.ponumber/{poNumber}";
RestTemplate restTemplate = new RestTemplate();
params.put("poNumber", poNumber);
ResponseEntity<ResponsePODealerGetDTO> result = restTemplate.exchange(url, HttpMethod.GET, new HttpEntity<>(createHeaders()), ResponsePODealerGetDTO.class,
......@@ -248,7 +242,7 @@ public class DPHLORestController {
Map<String, String> params = new HashMap<String, String>();
params.put("key", "DP");
params.put("ahassId", ahassCode);
String url = MD_URL + "/" + ConfigurationURI.GET_CONFIGURATION_BY_ID_AND_AHASSID.getUri();
String url = DDMS_H3_SERVICE_SLAVE + "/" + ConfigurationURI.GET_CONFIGURATION_BY_ID_AND_AHASSID.getUri();
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<ResponseConfigurationGetDTO> resConfig = restTemplate.exchange(url, HttpMethod.GET, new HttpEntity<>(createHeaders()), ResponseConfigurationGetDTO.class,
params);
......@@ -319,7 +313,7 @@ public class DPHLORestController {
}
public Boolean isCustomerHotlineTrue(String noktp) {
String url = GIGRH3_URL + "/istrue.hotlinecustomer/{noktp}";
String url = DDMS_H3_SERVICE_SLAVE + "/istrue.hotlinecustomer/{noktp}";
RestTemplate restTemplate = new RestTemplate();
Map<String, String> params = new HashMap<String, String>();
params.put("noktp", noktp);
......@@ -470,7 +464,7 @@ public class DPHLORestController {
params.put("receiptType", ReceiptType.SO_DP);
params.put("receiptStatus", ReceiptStatus.COMPLETE);
String url = RECEIPT_QUERY_URL + "/api/receipt/so/task/query/getReceiptSOTaskForApiGateway/{reffPONumber}/{receiptType}/{receiptStatus}";
String url = DDMS_H3_SERVICE_SLAVE + "/api/receipt/so/task/query/getReceiptSOTaskForApiGateway/{reffPONumber}/{receiptType}/{receiptStatus}";
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<ReceiptSOTaskDTO> result = restTemplate.exchange(url, HttpMethod.GET, new HttpEntity<>(createHeaders()), ReceiptSOTaskDTO.class,
params);
......@@ -524,7 +518,7 @@ public class DPHLORestController {
params.put("receiptType", ReceiptType.SO_DP);
params.put("receiptStatus", ReceiptStatus.OUTSTANDING);
String url = RECEIPT_QUERY_URL + "/api/receipt/so/task/query/getReceiptSOTaskForApiGateway/{reffPONumber}/{receiptType}/{receiptStatus}";
String url = DDMS_H3_SERVICE_SLAVE + "/api/receipt/so/task/query/getReceiptSOTaskForApiGateway/{reffPONumber}/{receiptType}/{receiptStatus}";
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<ReceiptSOTaskDTO> result = restTemplate.exchange(url, HttpMethod.GET, new HttpEntity<>(createHeaders()), ReceiptSOTaskDTO.class,
params);
......
package com.eksad.masterdata.controller;
import com.eksad.masterdata.common.dto.responseDto.ResponsePODealerGetDTO;
import com.eksad.masterdata.service.PODealerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
@Slf4j
public class PODealerRestController {
@Autowired
private PODealerService pODealerService;
@RequestMapping(value = "/get.podealer.with.ponumber/{poNumber}",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<ResponsePODealerGetDTO> getPODealerWithPoNumber(@PathVariable String poNumber) {
return pODealerService.getPODealerByPoNumber(poNumber);
}
}
package com.eksad.masterdata.controller;
import com.eksad.masterdata.domain.POHotlineCustomer;
import com.eksad.masterdata.repository.POHotlineCustomerRepository;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@Slf4j
@PropertySource("classpath:error-message.properties")
public class POHotlineRESTController {
@Autowired
POHotlineCustomerRepository hotlineRepo;
@Autowired
Environment env;
private static String UPLOADED_FOLDER = "/home/h3/img/";
private final Logger logger = LoggerFactory.getLogger(POHotlineRESTController.class);
@RequestMapping(value = "/istrue.hotlinecustomer/{noktp}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Boolean> isTrueHotlineCustomer(@PathVariable("noktp") String noktp) {
Boolean isTrue = Boolean.FALSE;
List<POHotlineCustomer> datas = hotlineRepo.findAllByktp(noktp);
if (datas.size() > 0) {
isTrue = Boolean.TRUE;
}
return new ResponseEntity<>(isTrue, HttpStatus.OK);
}
}
package com.eksad.masterdata.controller;
import com.eksad.masterdata.common.dto.ReceiptSOTaskDTO;
import com.eksad.masterdata.common.dto.ReceiptSOTunaiDTO;
import com.eksad.masterdata.common.dto.ResponseReceiptSOTaskGetListDTO;
import com.eksad.masterdata.common.listEnum.ReceiptStatus;
import com.eksad.masterdata.common.listEnum.ReceiptType;
import com.eksad.masterdata.domain.ReceiptSOTask;
import com.eksad.masterdata.domain.assembler.ReceiptSOTaskAssembler;
import com.eksad.masterdata.domain.assembler.ReceiptSOTunaiAssembler;
import com.eksad.masterdata.repository.ReceiptSOTaskRepository;
import com.eksad.masterdata.repository.ReceiptSOTunaiRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
@RestController
@Slf4j
public class ReceiptSOTunaiQueryController {
@Autowired
private ReceiptSOTaskRepository receiptSOTaskRepository;
@Autowired
private ReceiptSOTunaiRepository receiptSOTunaiRepository;
@RequestMapping(value = "/api/receipt/so/task/query/getbyahasscodeandsoid/{ahassCode}/{soID}",
produces = MediaType.APPLICATION_JSON_VALUE,
method = RequestMethod.GET)
@ResponseBody
public ResponseReceiptSOTaskGetListDTO getReceiptSOTaskBySOID(
@PathVariable("ahassCode") String ahassCode,
@PathVariable("soID") String soID,
@RequestParam(defaultValue = "10", required = false) Integer pageSize,
@RequestParam(defaultValue = "0", required = false) Integer pageNum,
@RequestParam(defaultValue = "salesOrderDate", required = false) String sortBy,
@RequestParam(defaultValue = "DESC", required = false) String sortDirection) throws Exception {
ResponseReceiptSOTaskGetListDTO response = new ResponseReceiptSOTaskGetListDTO();
Pageable page = PageRequest.of(pageNum, pageSize, Sort.by(Sort.Direction.fromString(sortDirection), sortBy));
Page<ReceiptSOTask> domains = receiptSOTaskRepository.findAllByAhassCodeAndSoID(ahassCode, soID, page);
response.setDatas(new ReceiptSOTaskAssembler().toDTOs(domains.getContent()));
response.setTotalElements(domains.getTotalElements());
response.setTotalPage(domains.getTotalPages());
return response;
}
@GetMapping("/api/receipt/so/tunai/query/getByReceiptID/{receiptID}")
public @ResponseStatus(HttpStatus.OK)
ReceiptSOTunaiDTO getReceiptSOTunaiByReceiptID(@PathVariable("receiptID") String receiptID) {
return new ReceiptSOTunaiAssembler().toDTO(receiptSOTunaiRepository.findOneByReceiptID(receiptID));
}
@RequestMapping(value = "/api/receipt/so/task/query/getReceiptSOTaskForApiGateway/{reffPONumber}/{receiptType}/{receiptStatus}",
produces = MediaType.APPLICATION_JSON_VALUE,
method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<?> getReceiptSOTaskForApiGateway(
@PathVariable("reffPONumber") String reffPONumber,
@PathVariable("receiptStatus") ReceiptStatus receiptStatus,
@PathVariable("receiptType") ReceiptType receiptType) throws Exception {
ReceiptSOTask domains = receiptSOTaskRepository.findOneByReffPONumberAndReceiptTypeAndReceiptStatus(reffPONumber, receiptType, receiptStatus);
ReceiptSOTaskDTO receiptSOTaskDTO = new ReceiptSOTaskDTO();
if (domains == null) {
return new ResponseEntity<>(null, HttpStatus.OK);
} else {
receiptSOTaskDTO = new ReceiptSOTaskAssembler().toDTO(domains);
}
return new ResponseEntity<>(receiptSOTaskDTO, HttpStatus.OK);
}
}
package com.eksad.masterdata.domain;
import com.eksad.ddms.common.util.status.DataStatus;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
@Data
@Entity
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "MST_CONFIGURATION")
public class Configuration {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "mst_config_gen")
@SequenceGenerator(name = "mst_config_gen", sequenceName = "mst_config_seq", allocationSize = 1)
Integer id;
private String ahassId;
private String key;
private String value;
private String label;
private String description;
@Enumerated(EnumType.STRING)
@NotNull(message = "configuration status cannot be null")
private DataStatus dataStatus;
}
package com.eksad.masterdata.domain;
import com.eksad.ddms.common.util.object.EntityObject;
import com.eksad.masterdata.common.listEnum.LastKnownState;
import com.eksad.masterdata.common.listEnum.PurchaseOrderType;
import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.persistence.*;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
import java.util.Set;
@NamedStoredProcedureQueries({
@NamedStoredProcedureQuery(
name = "PODealer.generatePONumber",
procedureName = "generate_po_number",
parameters = {
@StoredProcedureParameter(name = "dealercode", type = String.class, mode = ParameterMode.IN),
@StoredProcedureParameter(name = "status", type = String.class, mode = ParameterMode.IN)
}
),
@NamedStoredProcedureQuery(
name = "PODealer.generatePONumberByPosService",
procedureName = "generate_po_number_by_posservice",
parameters = {
@StoredProcedureParameter(name = "dealercode", type = String.class, mode = ParameterMode.IN),
@StoredProcedureParameter(name = "status", type = String.class, mode = ParameterMode.IN),
@StoredProcedureParameter(name = "posservicecode", type = String.class, mode = ParameterMode.IN),
@StoredProcedureParameter(name = "posserviceprefix", type = String.class, mode = ParameterMode.IN)
}
)
})
@Entity
@Table(name = "TRX_PODEALER")
public class PODealer implements EntityObject<PODealer> {
/**
* Hibernate purpose
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "trx_po_dealer_gen")
@SequenceGenerator(name = "trx_po_dealer_gen", sequenceName = "trx_po_dealer_seq", allocationSize = 1)
Integer id;
@NotNull(message = "poNumber cannot be null")
private String poNumber;
@Version
private Long version;
@Temporal(TemporalType.TIMESTAMP)
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd-MM-yyyy hh:mm:ss")
private Date poDate;
private String dealerID;
private String customerID;
@Enumerated(EnumType.STRING)
@NotNull(message = "poType cannot be null")
private PurchaseOrderType poType;
private Integer totalPart;
private Integer totalQuantity;
private BigDecimal totalPrice;
private BigDecimal ppn;
private BigDecimal finalPrice;
@Enumerated(EnumType.STRING)
@NotNull(message = "poDealerLastKnowState cannot be null")
private LastKnownState poDealerLastKnownState;
@Embedded
private CreationalSpecification poDealerCreational;
@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@JoinColumn(name = "poDealerID", referencedColumnName = "id")
private Set<PODealerDetail> poDealerDetails;
private String refNumber;
private String dealerDestination;
private String draftNumber;
private String uploadPO;
private String posServiceID;
public PODealer() {
}
public PODealer(Integer id, Long version, String poNumber, String dealerID, Date poDate, String customerID, PurchaseOrderType poType, Integer totalPart, Integer totalQuantity, BigDecimal totalPrice, BigDecimal ppn, BigDecimal finalPrice, LastKnownState poDealerLastKnownState, CreationalSpecification poDealerCreational, Set<PODealerDetail> poDealerDetails, String refNumber, String dealerDestination, String draftNumber, String uploadPO, String posServiceID) {
this.id = id;
this.version = version;
this.poNumber = poNumber;
this.dealerID = dealerID;
this.poDate = poDate;
this.customerID = customerID;
this.poType = poType;
this.totalPart = totalPart;
this.totalQuantity = totalQuantity;
this.totalPrice = totalPrice;
this.ppn = ppn;
this.finalPrice = finalPrice;
this.poDealerLastKnownState = poDealerLastKnownState;
this.poDealerCreational = poDealerCreational;
this.poDealerDetails = poDealerDetails;
this.refNumber = refNumber;
this.dealerDestination = dealerDestination;
this.draftNumber = draftNumber;
this.uploadPO = uploadPO;
this.posServiceID = posServiceID;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Long getVersion() {
return version;
}
public void setVersion(Long version) {
this.version = version;
}
public String getPoNumber() {
return poNumber;
}
public void setPoNumber(String poNumber) {
this.poNumber = poNumber;
}
public String getDealerID() {
return dealerID;
}
public void setDealerID(String dealerID) {
this.dealerID = dealerID;
}
public Date getPoDate() {
return poDate;
}
public void setPoDate(Date poDate) {
this.poDate = poDate;
}
public String getCustomerID() {
return customerID;
}
public void setCustomerID(String customerID) {
this.customerID = customerID;
}
public PurchaseOrderType getPoType() {
return poType;
}
public void setPoType(PurchaseOrderType poType) {
this.poType = poType;
}
public Integer getTotalPart() {
return totalPart;
}
public void setTotalPart(Integer totalPart) {
this.totalPart = totalPart;
}
public Integer getTotalQuantity() {
return totalQuantity;
}
public void setTotalQuantity(Integer totalQuantity) {
this.totalQuantity = totalQuantity;
}
public BigDecimal getTotalPrice() {
return totalPrice;
}
public void setTotalPrice(BigDecimal totalPrice) {
this.totalPrice = totalPrice;
}
public BigDecimal getPpn() {
return ppn;
}
public void setPpn(BigDecimal ppn) {
this.ppn = ppn;
}
public BigDecimal getFinalPrice() {
return finalPrice;
}
public void setFinalPrice(BigDecimal finalPrice) {
this.finalPrice = finalPrice;
}
public LastKnownState getPoDealerLastKnownState() {
return poDealerLastKnownState;
}
public void setPoDealerLastKnownState(LastKnownState poDealerLastKnownState) {
this.poDealerLastKnownState = poDealerLastKnownState;
}
public CreationalSpecification getPoDealerCreational() {
return poDealerCreational;
}
public void setPoDealerCreational(CreationalSpecification poDealerCreational) {
this.poDealerCreational = poDealerCreational;
}
public Set<PODealerDetail> getPoDealerDetails() {
return poDealerDetails;
}
public void setPoDealerDetails(Set<PODealerDetail> poDealerDetails) {
this.poDealerDetails = poDealerDetails;
}
public String getRefNumber() {
return refNumber;
}
public void setRefNumber(String refNumber) {
this.refNumber = refNumber;
}
public String getDealerDestination() {
return dealerDestination;
}
public void setDealerDestination(String dealerDestination) {
this.dealerDestination = dealerDestination;
}
public String getDraftNumber() {
return draftNumber;
}
public void setDraftNumber(String draftNumber) {
this.draftNumber = draftNumber;
}
public String getUploadPO() {
return uploadPO;
}
public void setUploadPO(String uploadPO) {
this.uploadPO = uploadPO;
}
public String getPosServiceID() {
return posServiceID;
}
public void setPosServiceID(String posServiceID) {
this.posServiceID = posServiceID;
}
@Override
public boolean sameIdentityAs(PODealer other) {
return this.equals(other);
}
}
package com.eksad.masterdata.domain;
import com.eksad.ddms.common.util.object.EntityObject;
import com.eksad.ddms.common.util.status.DataStatus;
import jakarta.persistence.*;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
@Entity
@Table(name = "TRX_PODEALERDETAIL")
public class PODealerDetail implements EntityObject<PODealerDetail> {
/**
* Hibernate purpose
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
Integer id;
@NotNull(message = "partID cannot be null")
private String partID;
private String poCustomerID;
private Integer quantity;
private BigDecimal price;
private BigDecimal discount;
@Enumerated(EnumType.STRING)
@NotNull(message = "poDealerDetailStatus cannot be null")
private DataStatus poDealerDetailStatus;
@Embedded
private CreationalSpecification poDealerDetailCreational;
private String salesPackageMDID;
private Date etarevisi;
private Date etatercepat;
private Date etaterlama;
/*
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "poDealerID")
private PODealer poDealer;
*/
private Integer poDealerID;
public PODealerDetail() {
}
public PODealerDetail(Integer id, String partID, String poCustomerID, Integer quantity, BigDecimal price, BigDecimal discount, DataStatus poDealerDetailStatus, CreationalSpecification poDealerDetailCreational, String salesPackageMDID, Date etarevisi, Date etatercepat, Date etaterlama, Integer poDealerID) {
this.id = id;
this.partID = partID;
this.poCustomerID = poCustomerID;
this.quantity = quantity;
this.price = price;
this.discount = discount;
this.poDealerDetailStatus = poDealerDetailStatus;
this.poDealerDetailCreational = poDealerDetailCreational;
this.salesPackageMDID = salesPackageMDID;
this.etarevisi = etarevisi;
this.etatercepat = etatercepat;
this.etaterlama = etaterlama;
this.poDealerID = poDealerID;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getPartID() {
return partID;
}
public void setPartID(String partID) {
this.partID = partID;
}
public String getPoCustomerID() {
return poCustomerID;
}
public void setPoCustomerID(String poCustomerID) {
this.poCustomerID = poCustomerID;
}
public Integer getQuantity() {
return quantity;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public DataStatus getPoDealerDetailStatus() {
return poDealerDetailStatus;
}
public void setPoDealerDetailStatus(DataStatus poDealerDetailStatus) {
this.poDealerDetailStatus = poDealerDetailStatus;
}
public CreationalSpecification getPoDealerDetailCreational() {
return poDealerDetailCreational;
}
public void setPoDealerDetailCreational(CreationalSpecification poDealerDetailCreational) {
this.poDealerDetailCreational = poDealerDetailCreational;
}
/*
public PODealer getPoDealer() {
return poDealer;
}
public void setPoDealer(PODealer poDealer) {
this.poDealer = poDealer;
}
*/
@Override
public boolean sameIdentityAs(PODealerDetail other) {
return this.equals(other);
}
public String getSalesPackageMDID() {
return salesPackageMDID;
}
public void setSalesPackageMDID(String salesPackageMDID) {
this.salesPackageMDID = salesPackageMDID;
}
public Integer getPoDealerID() {
return poDealerID;
}
public void setPoDealerID(Integer poDealerID) {
this.poDealerID = poDealerID;
}
public BigDecimal getDiscount() {
return discount;
}
public void setDiscount(BigDecimal discount) {
this.discount = discount;
}
public Date getEtarevisi() {
return etarevisi;
}
public void setEtarevisi(Date etarevisi) {
this.etarevisi = etarevisi;
}
public Date getEtatercepat() {
return etatercepat;
}
public void setEtatercepat(Date etatercepat) {
this.etatercepat = etatercepat;
}
public Date getEtaterlama() {
return etaterlama;
}
public void setEtaterlama(Date etaterlama) {
this.etaterlama = etaterlama;
}
}
package com.eksad.masterdata.domain;
import com.eksad.masterdata.common.listEnum.*;
import jakarta.persistence.Entity;
import java.util.Date;
@Entity
public class ReceiptSOBankEntryProjection extends ReceiptEntryProjectionSO {
private String bankID;
private String bankAccID;
private String bankTrxID;
private String referenceNumber;
public ReceiptSOBankEntryProjection() {
}
public ReceiptSOBankEntryProjection(String bankID, String bankAccID, String bankTrxID, String referenceNumber) {
this.bankID = bankID;
this.bankAccID = bankAccID;
this.bankTrxID = bankTrxID;
this.referenceNumber = referenceNumber;
}
public ReceiptSOBankEntryProjection(String receiptID, Date receiptDocDate, ReceiptType receiptType,
ReceiptCategory receiptCategory, ReceiptKind receiptKind, Double receiptAmount, String receiptNote,
ReceiptStatus receiptStatus, Double receiptPaidAmount, Double receiptDpOutstandingAmount,
Double receiptOutstandingAmount, String terbilang, String terbilangDPOutstandingAmount, String soID, Double kembalian, String ahassCode, PaymentType paymentType, Double biayaTambahan, String bankID, String bankAccID, String bankTrxID, String referenceNumber, String reffNumber) {
super(receiptID, receiptDocDate, receiptType, receiptCategory, receiptKind, receiptAmount, receiptNote, receiptStatus, receiptPaidAmount, receiptDpOutstandingAmount, receiptOutstandingAmount, terbilang, terbilangDPOutstandingAmount, terbilangDPOutstandingAmount, soID, kembalian, ahassCode, paymentType, biayaTambahan, reffNumber);
this.bankID = bankID;
this.bankAccID = bankAccID;
this.bankTrxID = bankTrxID;
this.referenceNumber = referenceNumber;
}
public ReceiptSOBankEntryProjection(
String recordID, Long version, String receiptID, Date receiptDocDate, ReceiptType receiptType,
ReceiptCategory receiptCategory, ReceiptKind receiptKind, Double receiptAmount, String receiptNote,
ReceiptStatus receiptStatus, Double receiptPaidAmount, Double receiptDpOutstandingAmount,
Double receiptOutstandingAmount, String terbilang, String terbilangDPOutstandingAmount, String soID, Double kembalian, String ahassCode, PaymentType paymentType, Double biayaTambahan, String createdBy, Date createdDate, String updatedBy, Date updatedDate, String bankID, String bankAccID, String bankTrxID, String referenceNumber, String reffNumber) {
super(receiptID, receiptDocDate, receiptType, receiptCategory, receiptKind, receiptAmount, receiptNote, receiptStatus, receiptPaidAmount, receiptDpOutstandingAmount, receiptOutstandingAmount, terbilang, terbilangDPOutstandingAmount, terbilangDPOutstandingAmount, soID, kembalian, createdBy, createdDate, updatedBy, updatedDate, recordID, version, ahassCode, paymentType, biayaTambahan, reffNumber);
this.bankID = bankID;
this.bankAccID = bankAccID;
this.bankTrxID = bankTrxID;
this.referenceNumber = referenceNumber;
}
public String getBankID() {
return bankID;
}
public void setBankID(String bankID) {
this.bankID = bankID;
}
public String getBankAccID() {
return bankAccID;
}
public void setBankAccID(String bankAccID) {
this.bankAccID = bankAccID;
}
public String getBankTrxID() {
return bankTrxID;
}
public void setBankTrxID(String bankTrxID) {
this.bankTrxID = bankTrxID;
}
public String getReferenceNumber() {
return referenceNumber;
}
public void setReferenceNumber(String referenceNumber) {
this.referenceNumber = referenceNumber;
}
public Long getTotalElements() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
package com.eksad.masterdata.domain;
import com.eksad.masterdata.common.listEnum.ReceiptStatus;
import com.eksad.masterdata.common.listEnum.ReceiptType;
import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.persistence.*;
import org.hibernate.annotations.Immutable;
import java.io.Serializable;
import java.util.Date;
@Entity
@Immutable
@Table(name = "view_receiptso")
public class ReceiptSOTask implements Serializable {
@Id
private String receiptid;
private String ahassCode;
private String soID;
private String custName;
private Double receiptAmount;
@Temporal(TemporalType.TIMESTAMP)
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd-MM-yyyy hh:mm:ss")
private Date salesOrderDate;
private String customerid;
@Enumerated(EnumType.STRING)
private ReceiptStatus receiptStatus;
@Enumerated(EnumType.STRING)
private ReceiptType receiptType;
private Double biayaTambahan;
private Double receiptPaidAmount;
private String reffPONumber;
private String referenceNumber;
private String noNotaPenjualan;
private String receipt_obj_disc;
@Column(name = "namaekspedisi")
private String namaEkspedisi;
@Column(name = "noresi")
private String noResi;
@Column(name = "etaekspedisi")
private Date etaEkspedisi;
@Column(name = "tglpengambilan")
private Date tglPengambilan;
private String posServiceID;
public String getReceiptid() {
return receiptid;
}
public String getAhassCode() {
return ahassCode;
}
public String getSoID() {
return soID;
}
public String getCustName() {
return custName;
}
public Double getReceiptAmount() {
return receiptAmount;
}
public Date getSalesOrderDate() {
return salesOrderDate;
}
public String getCustomerid() {
return customerid;
}
public ReceiptStatus getReceiptStatus() {
return receiptStatus;
}
public ReceiptType getReceiptType() {
return receiptType;
}
public Double getBiayaTambahan() {
return biayaTambahan;
}
public Double getReceiptPaidAmount() {
return receiptPaidAmount;
}
public String getReffPONumber() {
return reffPONumber;
}
public String getReferenceNumber() {
return referenceNumber;
}
public void setReferenceNumber(String referenceNumber) {
this.referenceNumber = referenceNumber;
}
public String getNoNotaPenjualan() {
return noNotaPenjualan;
}
public void setNoNotaPenjualan(String noNotaPenjualan) {
this.noNotaPenjualan = noNotaPenjualan;
}
public String getPosServiceID() {
return posServiceID;
}
public void setPosServiceID(String posServiceID) {
this.posServiceID = posServiceID;
}
}
package com.eksad.masterdata.domain;
import com.eksad.masterdata.common.listEnum.*;
import jakarta.persistence.Entity;
import java.util.Date;
@Entity
public class ReceiptSOTunaiEntryProjection extends ReceiptEntryProjectionSO {
public ReceiptSOTunaiEntryProjection() {
}
public ReceiptSOTunaiEntryProjection(String receiptID, Date receiptDocDate, ReceiptType receiptType,
ReceiptCategory receiptCategory, ReceiptKind receiptKind, Double receiptAmount, String receiptNote,
ReceiptStatus receiptStatus, Double receiptPaidAmount, Double receiptDpOutstandingAmount,
Double receiptOutstandingAmount, String terbilang, String terbilangDPOutstandingAmount, String soID, Double kembalian, String ahassCode,
PaymentType paymentType, Double biayaTambahan, String reffPONumber) {
super(receiptID, receiptDocDate, receiptType, receiptCategory, receiptKind, receiptAmount, receiptNote, receiptStatus, receiptPaidAmount, receiptDpOutstandingAmount, receiptOutstandingAmount, terbilang, terbilangDPOutstandingAmount, terbilangDPOutstandingAmount, soID, kembalian, ahassCode, paymentType, biayaTambahan, reffPONumber);
}
public ReceiptSOTunaiEntryProjection(String recordID, Long version, String receiptID, Date receiptDocDate, ReceiptType receiptType,
ReceiptCategory receiptCategory, ReceiptKind receiptKind, Double receiptAmount, String receiptNote,
ReceiptStatus receiptStatus, Double receiptPaidAmount, Double receiptDpOutstandingAmount,
Double receiptOutstandingAmount, String terbilang, String terbilangDPOutstandingAmount, String soID,
Double kembalian, String ahassCode, PaymentType paymentType, Double biayaTambahan, String createdBy, Date createdDate, String updatedBy, Date updatedDate, String reffPONumber) {
super(receiptID, receiptDocDate, receiptType, receiptCategory, receiptKind, receiptAmount, receiptNote, receiptStatus, receiptPaidAmount, receiptDpOutstandingAmount, receiptOutstandingAmount, terbilang, terbilangDPOutstandingAmount, terbilangDPOutstandingAmount, soID, kembalian, createdBy, createdDate, updatedBy, updatedDate, recordID, version, ahassCode, paymentType, biayaTambahan, reffPONumber);
}
public ReceiptSOTunaiEntryProjection(String receiptID, Date receiptDocDate, ReceiptType receiptType,
ReceiptCategory receiptCategory, ReceiptKind receiptKind, Double receiptAmount, String receiptNote,
ReceiptStatus receiptStatus, Double receiptPaidAmount, Double receiptDpOutstandingAmount,
Double receiptOutstandingAmount, String terbilang, String terbilangDPOutstandingAmount, String soID, Double kembalian, String ahassCode,
PaymentType paymentType, Double biayaTambahan, String reffPONumber,
String namaEkspedisi, String noResi, Date etaEkspedisi, Date tglPengambilan) {
super(receiptID, receiptDocDate, receiptType, receiptCategory, receiptKind, receiptAmount, receiptNote, receiptStatus, receiptPaidAmount, receiptDpOutstandingAmount, receiptOutstandingAmount, terbilang, terbilangDPOutstandingAmount, terbilangDPOutstandingAmount, soID, kembalian, ahassCode, paymentType, biayaTambahan, reffPONumber, namaEkspedisi, noResi, etaEkspedisi, tglPengambilan);
}
public ReceiptSOTunaiEntryProjection(String recordID, Long version, String receiptID, Date receiptDocDate, ReceiptType receiptType,
ReceiptCategory receiptCategory, ReceiptKind receiptKind, Double receiptAmount, String receiptNote,
ReceiptStatus receiptStatus, Double receiptPaidAmount, Double receiptDpOutstandingAmount,
Double receiptOutstandingAmount, String terbilang, String terbilangDPOutstandingAmount, String soID,
Double kembalian, String ahassCode, PaymentType paymentType, Double biayaTambahan, String createdBy, Date createdDate, String updatedBy, Date updatedDate, String reffPONumber,
String namaEkspedisi, String noResi, Date etaEkspedisi, Date tglPengambilan) {
super(receiptID, receiptDocDate, receiptType, receiptCategory, receiptKind, receiptAmount, receiptNote, receiptStatus, receiptPaidAmount, receiptDpOutstandingAmount, receiptOutstandingAmount, terbilang, terbilangDPOutstandingAmount, terbilangDPOutstandingAmount, soID, kembalian, createdBy, createdDate, updatedBy, updatedDate, recordID, version, ahassCode, paymentType, biayaTambahan, reffPONumber, namaEkspedisi, noResi, etaEkspedisi, tglPengambilan);
}
}
package com.eksad.masterdata.domain;
import jakarta.persistence.*;
import java.io.Serializable;
import java.util.Date;
@Entity
@Inheritance
@DiscriminatorColumn(name = "receipt_obj_disc", length = 50)
@Table(name = "trx_receipt_so")
public abstract class TransactionBaseObjectSO implements Serializable {
@Id
@GeneratedValue
private Long id;
@Version
private Long version;
protected String createdBy;
@Temporal(TemporalType.TIMESTAMP)
protected Date createdDate;
protected String updatedBy;
@Temporal(TemporalType.TIMESTAMP)
protected Date updatedDate;
protected String recordID;
public TransactionBaseObjectSO() {
}
public TransactionBaseObjectSO(String createdBy, Date createdDate, String updatedBy, Date updatedDate, String recordID, Long version) {
this.createdBy = createdBy;
this.createdDate = createdDate;
this.updatedBy = updatedBy;
this.updatedDate = updatedDate;
this.recordID = recordID;
this.version = version;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public Date getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}
public String getUpdatedBy() {
return updatedBy;
}
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}
public Date getUpdatedDate() {
return updatedDate;
}
public void setUpdatedDate(Date updatedDate) {
this.updatedDate = updatedDate;
}
public String getRecordID() {
return recordID;
}
public void setRecordID(String recordID) {
this.recordID = recordID;
}
public Long getVersion() {
return version;
}
public void setVersion(Long version) {
this.version = version;
}
}
package com.eksad.masterdata.domain.assembler;
import com.eksad.ddms.common.util.object.IObjectAssembler;
import com.eksad.masterdata.common.dto.ConfigurationDTO;
import com.eksad.masterdata.domain.Configuration;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class ConfigurationAssembler implements IObjectAssembler<Configuration, ConfigurationDTO> {
@Override
public ConfigurationDTO toDTO(Configuration domainObject) {
ConfigurationDTO configurationDTO = new ConfigurationDTO();
configurationDTO.setAhassId(domainObject.getAhassId());
configurationDTO.setKey(domainObject.getKey());
configurationDTO.setValue(domainObject.getValue());
configurationDTO.setLabel(domainObject.getLabel());
configurationDTO.setDescription(domainObject.getDescription());
configurationDTO.setDataStatus(domainObject.getDataStatus());
return configurationDTO;
}
@Override
public Configuration toDomain(ConfigurationDTO dtoObject) {
Configuration configuration = new Configuration();
configuration.setAhassId(dtoObject.getAhassId());
configuration.setKey(dtoObject.getKey());
configuration.setValue(dtoObject.getValue());
configuration.setLabel(dtoObject.getLabel());
configuration.setDescription(dtoObject.getDescription());
configuration.setDataStatus(dtoObject.getDataStatus());
return configuration;
}
public List<ConfigurationDTO> toDTOs(Set<Configuration> configurations) {
List<ConfigurationDTO> configurationDTOS = new ArrayList<>();
configurations.forEach(configuration -> configurationDTOS.add(toDTO(configuration)));
return configurationDTOS;
}
public Set<Configuration> toDomain(List<ConfigurationDTO> configurationDTOS) {
Set<Configuration> configurations = new HashSet<>();
configurationDTOS.forEach(configurationDTO -> configurations.add(toDomain(configurationDTO)));
return configurations;
}
}
package com.eksad.masterdata.domain.assembler;
import com.eksad.ddms.common.util.object.IObjectAssembler;
import com.eksad.masterdata.common.dto.CreationalSpecificationDTO;
import com.eksad.masterdata.common.dto.PODealerDTO;
import com.eksad.masterdata.common.dto.PODealerDetailDTO;
import com.eksad.masterdata.domain.PODealer;
import com.eksad.masterdata.domain.PODealerDetail;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class PODealerAssembler implements IObjectAssembler<PODealer, PODealerDTO> {
@Override
public PODealerDTO toDTO(PODealer domainObject) {
PODealerDTO dto = new PODealerDTO();
dto.setPoNumber(domainObject.getPoNumber());
dto.setPoDate(domainObject.getPoDate());
dto.setCustomerID(domainObject.getCustomerID());
dto.setDealerID(domainObject.getDealerID());
dto.setPoType(domainObject.getPoType());
dto.setTotalPart(domainObject.getTotalPart());
dto.setTotalQuantity(domainObject.getTotalQuantity());
dto.setPpn(domainObject.getPpn());
dto.setFinalPrice(domainObject.getFinalPrice());
dto.setPoDealerLastKnowState(domainObject.getPoDealerLastKnownState());
dto.setRefNumber(domainObject.getRefNumber());
dto.setDealerDestination(domainObject.getDealerDestination());
dto.setPoDealerCreationalDTO(
domainObject.getPoDealerCreational() == null
? new CreationalSpecificationDTO() : new CreationalSpecificationDTOAssembler().toDTO(domainObject.getPoDealerCreational()));
dto.setPoDealerDetailDTOs(new ArrayList(domainObject.getPoDealerDetails()));
dto.setDraftNumber(domainObject.getDraftNumber());
dto.setUploadPO(domainObject.getUploadPO());
dto.setVersion(domainObject.getVersion());
dto.setPosServiceID(domainObject.getPosServiceID());
return dto;
}
@Override
public PODealer toDomain(PODealerDTO dtoObject) {
PODealer data = new PODealer();
data.setPoNumber(dtoObject.getPoNumber());
data.setPoDate(dtoObject.getPoDate());
data.setCustomerID(dtoObject.getCustomerID());
data.setDealerID(dtoObject.getDealerID());
data.setPoType(dtoObject.getPoType());
data.setTotalPart(dtoObject.getTotalPart());
data.setTotalQuantity(dtoObject.getTotalQuantity());
data.setTotalPrice(dtoObject.getTotalPrice());
data.setPpn(dtoObject.getPpn());
data.setFinalPrice(dtoObject.getFinalPrice());
data.setPoDealerLastKnownState(dtoObject.getPoDealerLastKnowState());
data.setPoDealerCreational(
dtoObject.getPoDealerCreationalDTO() == null
? new CreationalSpecificationDTOAssembler().toDomain(new CreationalSpecificationDTO().getInstance()) : new CreationalSpecificationDTOAssembler().toDomain(dtoObject.getPoDealerCreationalDTO()));
data.setPoDealerDetails(new HashSet<>(this.toDetailDomains(dtoObject.getPoDealerDetailDTOs())));
data.setRefNumber(dtoObject.getRefNumber());
data.setDealerDestination(dtoObject.getDealerDestination());
data.setDraftNumber(dtoObject.getDraftNumber());
data.setUploadPO(dtoObject.getUploadPO());
data.setVersion(dtoObject.getVersion());
data.setPosServiceID(dtoObject.getPosServiceID());
return data;
}
private PODealerDetailDTO toDTO(PODealerDetail domain) {
PODealerDetailDTO dto = new PODealerDetailDTO();
dto.setPartID(domain.getPartID());
dto.setPoCustomerID(domain.getPoCustomerID());
dto.setQuantity(domain.getQuantity());
dto.setPrice(domain.getPrice());
dto.setDiscount(domain.getDiscount());
dto.setPoDealerDetailStatus(domain.getPoDealerDetailStatus());
dto.setPoDealerDetailCreationalDTO(
domain.getPoDealerDetailCreational() == null
? new CreationalSpecificationDTO() : new CreationalSpecificationDTOAssembler().toDTO(domain.getPoDealerDetailCreational()));
dto.setSalesPackageMDID(domain.getSalesPackageMDID());
return dto;
}
private PODealerDetail toDomain(PODealerDetailDTO dto) {
PODealerDetail domain = new PODealerDetail();
domain.setPartID(dto.getPartID());
domain.setPoCustomerID(dto.getPoCustomerID());
domain.setQuantity(dto.getQuantity());
domain.setPrice(dto.getPrice());
domain.setDiscount(dto.getDiscount());
domain.setPoDealerDetailStatus(dto.getPoDealerDetailStatus());
domain.setPoDealerDetailCreational(
dto.getPoDealerDetailCreationalDTO() == null
? new CreationalSpecificationDTOAssembler().toDomain(new CreationalSpecificationDTO().getInstance()) : new CreationalSpecificationDTOAssembler().toDomain(dto.getPoDealerDetailCreationalDTO()));
domain.setSalesPackageMDID(dto.getSalesPackageMDID());
return domain;
}
public List<PODealerDTO> toDTOs(Set<PODealer> arg0) {
List<PODealerDTO> res = new ArrayList<>();
arg0.stream().forEach((o) -> {
res.add(toDTO(o));
});
return res;
}
public List<PODealerDTO> toDTOs(List<PODealer> arg0) {
List<PODealerDTO> res = new ArrayList<>();
arg0.stream().forEach((o) -> {
res.add(toDTO(o));
});
return res;
}
public List<PODealerDetailDTO> toDetailDTOs(List<PODealerDetail> arg0) {
List<PODealerDetailDTO> res = new ArrayList<>();
arg0.stream().forEach((o) -> {
res.add(toDTO(o));
});
return res;
}
public Set<PODealer> toDomains(List<PODealerDTO> arg0) {
Set<PODealer> res = new HashSet<>();
arg0.stream().forEach((o) -> {
res.add(toDomain(o));
});
return res;
}
public Set<PODealerDetail> toDetailDomains(List<PODealerDetailDTO> arg0) {
Set<PODealerDetail> res = new HashSet<>();
arg0.stream().forEach((o) -> {
res.add(toDomain(o));
});
return res;
}
}
package com.eksad.masterdata.domain.assembler;
import com.eksad.masterdata.common.dto.ReceiptSOTaskDTO;
import com.eksad.masterdata.domain.ReceiptSOTask;
import java.util.ArrayList;
import java.util.List;
public class ReceiptSOTaskAssembler {
public ReceiptSOTaskDTO toDTO(ReceiptSOTask domain) {
ReceiptSOTaskDTO dto = new ReceiptSOTaskDTO();
dto.setAhassCode(domain.getAhassCode());
dto.setCustomerName(domain.getCustName());
dto.setCustomerid(domain.getCustomerid());
dto.setReceiptAmount(domain.getReceiptAmount());
dto.setReceiptid(domain.getReceiptid());
dto.setSalesOrderDate(domain.getSalesOrderDate());
dto.setSoID(domain.getSoID());
dto.setReceiptStatus(domain.getReceiptStatus());
dto.setReceiptType(domain.getReceiptType());
dto.setBiayaTambahan(domain.getBiayaTambahan());
dto.setReceiptPaidAmount(domain.getReceiptPaidAmount());
dto.setReffPONumber(domain.getReffPONumber());
dto.setReferenceNumber(domain.getReferenceNumber());
dto.setNoNotaPenjualan(domain.getNoNotaPenjualan());
return dto;
}
public List<ReceiptSOTaskDTO> toDTOs(List<ReceiptSOTask> domains) {
List<ReceiptSOTaskDTO> dTOs = new ArrayList<>();
domains.forEach((domain) -> {
dTOs.add(toDTO(domain));
});
return dTOs;
}
}
package com.eksad.masterdata.domain.assembler;
import com.eksad.masterdata.common.dto.ReceiptSOTunaiDTO;
import com.eksad.masterdata.domain.ReceiptSOTunaiEntryProjection;
public class ReceiptSOTunaiAssembler {
public ReceiptSOTunaiDTO toDTO(ReceiptSOTunaiEntryProjection domain) {
ReceiptSOTunaiDTO dto = new ReceiptSOTunaiDTO();
dto.setCreatedBy(domain.getCreatedBy());
dto.setCreatedDate(domain.getCreatedDate());
dto.setUpdatedBy(domain.getUpdatedBy());
dto.setUpdatedDate(domain.getUpdatedDate());
dto.setRecordID(domain.getRecordID());
dto.setReceiptID(domain.getReceiptID());
dto.setReceiptDocDate(domain.getReceiptDocDate());
dto.setReceiptType(domain.getReceiptType());
dto.setReceiptCategory(domain.getReceiptCategory());
dto.setReceiptKind(domain.getReceiptKind());
dto.setReceiptAmount(domain.getReceiptAmount());
dto.setReceiptNote(domain.getReceiptNote());
dto.setReceiptStatus(domain.getReceiptStatus());
dto.setReceiptPaidAmount(domain.getReceiptPaidAmount());
dto.setReceiptDpOutstandingAmount(domain.getReceiptDpOutstandingAmount());
dto.setReceiptOutstandingAmount(domain.getReceiptOutstandingAmount());
dto.setTerbilang(domain.getTerbilang());
dto.setTerbilangDPOutstandingAmount(domain.getTerbilangDPOutstandingAmount());
dto.setSoID(domain.getSoID());
dto.setKembalian(domain.getKembalian());
dto.setBiayaTambahan(domain.getBiayaTambahan());
dto.setVersion(domain.getVersion());
dto.setAhasscode(domain.getAhassCode());
return dto;
}
}
package com.eksad.masterdata.repository;
import com.eksad.masterdata.domain.Configuration;
import jakarta.transaction.Transactional;
import org.springframework.stereotype.Repository;
@Repository
@Transactional
public interface ConfigurationRepository extends GenericRepository<Configuration> {
Configuration findOneByKeyAndAhassId(String key, String ahassId);
}
package com.eksad.masterdata.repository;
import com.eksad.masterdata.domain.PODealer;
import jakarta.transaction.Transactional;
import org.springframework.stereotype.Repository;
@Repository
@Transactional
public interface PODealerRepository extends GenericRepository<PODealer> {
PODealer findOneByPoNumber(String poNumber);
}
package com.eksad.masterdata.repository;
import com.eksad.masterdata.domain.POHotlineCustomer;
import jakarta.transaction.Transactional;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
@Transactional
public interface POHotlineCustomerRepository extends GenericRepository<POHotlineCustomer> {
@Query("SELECT po FROM POHotlineCustomer po where po.noKtp=:ktp")
List<POHotlineCustomer> findAllByktp(@Param("ktp") String ktp);
}
package com.eksad.masterdata.repository;
import org.springframework.data.repository.NoRepositoryBean;
import org.springframework.data.repository.PagingAndSortingRepository;
@NoRepositoryBean
public interface ReceiptGenericPagingAndSortingRepository<T> extends PagingAndSortingRepository<T, Long> {
}
package com.eksad.masterdata.repository;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.NoRepositoryBean;
@NoRepositoryBean
public interface ReceiptGenericRepository<T> extends CrudRepository<T, Long> {
}
package com.eksad.masterdata.repository;
import com.eksad.masterdata.common.listEnum.ReceiptStatus;
import com.eksad.masterdata.common.listEnum.ReceiptType;
import com.eksad.masterdata.domain.ReceiptSOTask;
import jakarta.transaction.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;
@Repository
@Transactional
public interface ReceiptSOTaskRepository extends ReceiptGenericPagingAndSortingRepository<ReceiptSOTask> {
Page<ReceiptSOTask> findAllByAhassCodeAndSoID(String ahassCode, String soID, Pageable pageable);
ReceiptSOTask findOneByReffPONumberAndReceiptTypeAndReceiptStatus(String reffPONumber, ReceiptType receiptType, ReceiptStatus receiptStatus);
}
package com.eksad.masterdata.repository;
import com.eksad.masterdata.common.listEnum.ReceiptStatus;
import com.eksad.masterdata.common.listEnum.ReceiptType;
import com.eksad.masterdata.domain.ReceiptSOBankEntryProjection;
import com.eksad.masterdata.domain.ReceiptSOTunaiEntryProjection;
import jakarta.transaction.Transactional;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
@Transactional
public interface ReceiptSOTunaiRepository extends ReceiptGenericRepository<ReceiptSOTunaiEntryProjection> {
ReceiptSOTunaiEntryProjection findOneById(Long receiptID);
ReceiptSOTunaiEntryProjection findOneByRecordID(String recordID);
List<ReceiptSOTunaiEntryProjection> findAllByOrderById();
List<ReceiptSOTunaiEntryProjection> findAllByReceiptStatus(ReceiptStatus receiptStatus);
ReceiptSOTunaiEntryProjection findOneByReceiptID(String receiptID);
ReceiptSOTunaiEntryProjection findOneByReceiptIDAndAhassCode(String receiptID, String ahassCode);
ReceiptSOTunaiEntryProjection findOneBySoID(String soID);
ReceiptSOTunaiEntryProjection findOneBySoIDAndReceiptType(String soID, ReceiptType receiptType);
List<ReceiptSOTunaiEntryProjection> findAllBySoID(String soID);
@Query("select rso from "
+ " ReceiptSOTunaiEntryProjection rso "
+ " where "
+ " rso.ahassCode=:ahassCode and "
+ " rso.receiptStatus=:receiptStatus "
+ " order by rso.id desc")
public List<ReceiptSOTunaiEntryProjection> findAllByReceiptStatusAndAhassCode(@Param("receiptStatus") ReceiptStatus receiptStatus,
@Param("ahassCode") String ahassCode);
@Query("select rso from "
+ " ReceiptSOBankEntryProjection rso "
+ " where "
+ " rso.ahassCode=:ahassCode and "
+ " rso.receiptStatus=:receiptStatus "
+ " order by rso.id desc")
public List<ReceiptSOBankEntryProjection> findAllReceiptBankByReceiptStatusAndAhassCode(@Param("receiptStatus") ReceiptStatus receiptStatus,
@Param("ahassCode") String ahassCode);
}
package com.eksad.masterdata.service;
import com.eksad.masterdata.common.dto.ConfigurationDTO;
import com.eksad.masterdata.domain.assembler.ConfigurationAssembler;
import com.eksad.masterdata.repository.ConfigurationRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class ConfigurationService {
@Autowired
ConfigurationRepository configurationRepository;
public ConfigurationDTO getConfigurationByKeyAndAhassID(String key, String ahassId) {
return new ConfigurationAssembler().toDTO(configurationRepository.findOneByKeyAndAhassId(key, ahassId));
}
}
package com.eksad.masterdata.service;
import com.eksad.ddms.common.util.response.ResponseDTO;
import com.eksad.masterdata.common.dto.responseDto.ResponsePODealerGetDTO;
import com.eksad.masterdata.domain.PODealer;
import com.eksad.masterdata.domain.assembler.PODealerAssembler;
import com.eksad.masterdata.repository.PODealerRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.PropertySource;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
@Service
@PropertySource("classpath:error-message.properties")
public class PODealerService {
@Autowired
private PODealerRepository pODealerRepository;
public ResponseEntity<ResponsePODealerGetDTO> getPODealerByPoNumber(String poNumber) {
PODealer data;
try {
data = pODealerRepository.findOneByPoNumber(poNumber);
if (data == null) {
return ResponseEntity.status(HttpStatus.FOUND).body(
new ResponsePODealerGetDTO(new ResponseDTO().noDataFoundResponse(), null));
}
return ResponseEntity.status(HttpStatus.FOUND).body(
new ResponsePODealerGetDTO(new ResponseDTO().defaultResponse(), new PODealerAssembler().toDTO(data)));
} catch (Exception e) {
return ResponseEntity.status(HttpStatus.FOUND).body(
new ResponsePODealerGetDTO(new ResponseDTO().failedRespose(String.valueOf(HttpStatus.INTERNAL_SERVER_ERROR.value()), e.getMessage()), null));
}
}
}
......@@ -13,9 +13,7 @@ spring.jpa.properties.hibernate.format_sql=true
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
dam.gigr.h3 = ${DAM_GIGR_H3:https://api-uat-b.eksad.com/gigr-h3/}
dam.masterdata.h3 = ${DAM_MASTERDATA_H3:https://api-uat-b.eksad.com/masterdata-h3/}
dam.receipt.query = ${DAM_RECEIPT_QUERY_H3:https://api-uat-b.eksad.com/receipt-query/}
ddms.h3.service.slave = ${DDMS_H2_SERVICE_SLAVE:http://localhost:8081/}
dam.receipt.command = ${DAM_RECEIPT_COMMAND_H3:https://api-uat-b.eksad.com/receipt-command/}
# KAFKA
......
......@@ -13,9 +13,7 @@ spring.jpa.properties.hibernate.format_sql=true
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
dam.gigr.h3 = ${DAM_GIGR_H3:https://api-uat-b.eksad.com/gigr-h3/}
dam.masterdata.h3 = ${DAM_MASTERDATA_H3:https://api-uat-b.eksad.com/masterdata-h3/}
dam.receipt.query = ${DAM_RECEIPT_QUERY_H3:https://api-uat-b.eksad.com/receipt-query/}
ddms.h3.service.slave = ${DDMS_H2_SERVICE_SLAVE:http://localhost:8081/}
dam.receipt.command = ${DAM_RECEIPT_COMMAND_H3:https://api-uat-b.eksad.com/receipt-command/}
# KAFKA
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment