Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
ddms-masterdata-h3-module-slave
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Arie Valdano
ddms-masterdata-h3-module-slave
Commits
48748760
Commit
48748760
authored
Feb 21, 2025
by
akbar fauzi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
service /orafin/workorder/dgi-api/v1/inv2/add
parent
b2706f2d
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
456 additions
and
1 deletion
+456
-1
ddms-masterdata-h3-module-slave.iml
ddms-masterdata-h3-module-slave.iml
+302
-0
pom.xml
pom.xml
+11
-0
DGIInvoiceNjbNscRESTController.java
.../apidgi/invoicenjbnsc/DGIInvoiceNjbNscRESTController.java
+11
-1
DGIInvoiceNjbNscService.java
...erdata/service/invoicenjbnsc/DGIInvoiceNjbNscService.java
+132
-0
No files found.
ddms-masterdata-h3-module-slave.iml
0 → 100644
View file @
48748760
This diff is collapsed.
Click to expand it.
pom.xml
View file @
48748760
...
...
@@ -86,6 +86,12 @@
<version>
1.18.30
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
com.netflix.hystrix
</groupId>
<artifactId>
hystrix-javanica
</artifactId>
<version>
1.5.12
</version>
<type>
jar
</type>
</dependency>
<dependency>
<groupId>
com.eksad.ddms
</groupId>
<artifactId>
ddms-common
</artifactId>
...
...
@@ -98,6 +104,11 @@
<version>
1.0-SNAPSHOT
</version>
<type>
jar
</type>
</dependency>
<dependency>
<groupId>
com.eksad.ddms
</groupId>
<artifactId>
ddms-masterdata-h3-svc
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
</dependencies>
<build>
...
...
src/main/java/com/eksad/masterdata/controller/apidgi/invoicenjbnsc/DGIInvoiceNjbNscRESTController.java
View file @
48748760
package
com
.
eksad
.
masterdata
.
controller
.
apidgi
.
invoicenjbnsc
;
import
com.eksad.ddms.common.dto.*
;
import
com.eksad.masterdata.service.invoicenjbnsc.DGIInvoiceNjbNscService
;
import
com.eksad.ddms.common.h2.dto.apigateway.request.PullNotaJBSCRequestDTO
;
import
com.eksad.ddms.common.h2.dto.ui.ResponseErrorDTO
;
...
...
@@ -12,6 +13,7 @@ import org.springframework.http.ResponseEntity;
import
org.springframework.web.bind.annotation.*
;
import
lombok.extern.slf4j.Slf4j
;
import
java.io.IOException
;
import
java.text.DateFormat
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
...
...
@@ -19,7 +21,9 @@ import java.time.Duration;
import
java.time.LocalDateTime
;
import
java.time.ZoneId
;
import
java.time.format.DateTimeFormatter
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
...
...
@@ -78,6 +82,12 @@ public class DGIInvoiceNjbNscRESTController {
return
pullService
.
postRequestPullNJBNSC
(
dto
);
}
@RequestMapping
(
value
=
"/dgi-api/v1/inv2/add"
,
method
=
RequestMethod
.
POST
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
Object
>
postWorkOrderOrafin
(
@RequestHeader
(
"GvtDealerId"
)
String
dealerid
,
@RequestBody
GatewayOrafinDTO
dto
)
throws
IOException
{
return
pullService
.
postWorkOrderOrafin
(
dto
,
dealerid
);
}
}
src/main/java/com/eksad/masterdata/service/invoicenjbnsc/DGIInvoiceNjbNscService.java
View file @
48748760
package
com
.
eksad
.
masterdata
.
service
.
invoicenjbnsc
;
import
com.eksad.ddms.common.dto.GatewayOrafinDTO
;
import
com.eksad.ddms.common.dto.GatewayPartOrafinDTO
;
import
com.eksad.ddms.common.dto.GatewayServiceOrafinDTO
;
import
com.eksad.ddms.common.dto.ResponseOrafinDTO
;
import
com.eksad.ddms.common.h2.dto.apigateway.request.PullNotaJBSCRequestDTO
;
import
com.eksad.ddms.common.h2.dto.ui.ResponseErrorDTO
;
import
com.eksad.ddms.common.uri.apigateway.APIGatewayURI
;
import
com.eksad.masterdata.common.RequestUtil
;
import
com.eksad.masterdata.controller.apidgi.invoicenjbnsc.DGIInvoiceNjbNscRESTController
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.HttpEntity
;
...
...
@@ -12,6 +21,7 @@ import org.springframework.http.ResponseEntity;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.client.RestTemplate
;
import
java.io.IOException
;
import
java.text.DateFormat
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
...
...
@@ -19,8 +29,12 @@ import java.time.Duration;
import
java.time.LocalDateTime
;
import
java.time.ZoneId
;
import
java.time.format.DateTimeFormatter
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
@Service
public
class
DGIInvoiceNjbNscService
{
...
...
@@ -114,4 +128,122 @@ public class DGIInvoiceNjbNscService {
}
}
}
@HystrixCommand
(
fallbackMethod
=
"defaultPostFallback"
)
public
ResponseEntity
<
Object
>
postWorkOrderOrafin
(
GatewayOrafinDTO
dto
,
String
dealerid
)
throws
IOException
{
try
{
System
.
out
.
println
(
new
ObjectMapper
().
writeValueAsString
(
dto
));
List
<
String
>
pass
=
new
ArrayList
<>();
if
(
dto
.
getNoWorkOrder
().
contains
(
"WO"
))
{
//kalo wo njb wajib
if
(
dto
.
getNoNJB
()
==
null
||
dto
.
getNoNJB
().
isEmpty
())
{
throw
new
Exception
(
"No NJB Tidak Boleh Kosong, Mohon Periksa Kembali Data"
);
}
if
(
dto
.
getTanggalNJB
()
==
null
||
dto
.
getTanggalNJB
().
isEmpty
())
{
throw
new
Exception
(
"Tanggal NJB Tidak Boleh Kosong, Mohon Periksa Kembali Data"
);
}
if
(
dto
.
getTotalHargaNJB
()
==
null
||
dto
.
getTotalHargaNJB
()
==
0
||
dto
.
getTotalHargaNJB
().
isNaN
())
{
throw
new
Exception
(
"Total Harga NJB Tidak Boleh Kosong, Mohon Periksa Kembali Data"
);
}
if
(
dto
.
getHondaIdSA
()
==
null
||
dto
.
getHondaIdSA
().
isEmpty
())
{
throw
new
Exception
(
"Honda Id SA Tidak Boleh Kosong, Mohon Periksa Kembali Data"
);
}
if
(
dto
.
getHondaIdMekanik
()
==
null
||
dto
.
getHondaIdMekanik
().
isEmpty
())
{
throw
new
Exception
(
"Honda Id Mekanik Tidak Boleh Kosong, Mohon Periksa Kembali Data"
);
}
if
(
dto
.
getNjb
().
isEmpty
()
||
dto
.
getNjb
()
==
null
)
{
throw
new
Exception
(
"NJB Tidak Boleh Kosong, Mohon Periksa Kembali Data"
);
}
if
(
dto
.
getNoNSC
()
==
null
||
dto
.
getNoNSC
().
isEmpty
()
&&
!
dto
.
getTanggalNSC
().
isEmpty
())
{
throw
new
Exception
(
"No NSC harus dilengkapi"
);
}
else
if
(
dto
.
getNoNSC
()
==
null
||
dto
.
getNoNSC
().
isEmpty
()
&&
dto
.
getTotalHargaNSC
()
!=
0
)
{
throw
new
Exception
(
"NO NSC harus dilengkapi"
);
}
else
if
(
dto
.
getNoNSC
()
==
null
||
dto
.
getNoNSC
().
isEmpty
()
&&
!
dto
.
getNsc
().
isEmpty
())
{
throw
new
Exception
(
"No NSC harus dilengkapi"
);
}
else
if
(!
dto
.
getNoNSC
().
isEmpty
()
&&
dto
.
getTanggalNSC
().
isEmpty
())
{
throw
new
Exception
(
"Tanggal NSC harus dilengkapi"
);
}
else
if
(!
dto
.
getNoNSC
().
isEmpty
()
&&
dto
.
getTotalHargaNSC
()
==
0
)
{
throw
new
Exception
(
"Total Harga NSC harus dilengkapi"
);
}
else
if
(!
dto
.
getNoNSC
().
isEmpty
()
&&
dto
.
getNsc
().
isEmpty
())
{
throw
new
Exception
(
"NSC harus dilengkapi"
);
}
}
if
(
dto
.
getNoWorkOrder
().
contains
(
"SO"
))
{
//kalo so nsc wajib
if
(
dto
.
getNoNSC
()
==
null
||
dto
.
getNoNSC
().
isEmpty
())
{
throw
new
Exception
(
"No NSC Tidak Boleh Kosong, Mohon Periksa Kembali Data"
);
}
if
(
dto
.
getTanggalNSC
()
==
null
||
dto
.
getTanggalNSC
().
isEmpty
())
{
throw
new
Exception
(
"Tanggal NSC Tidak Boleh Kosong, Mohon Periksa Kembali Data"
);
}
if
(
dto
.
getTotalHargaNSC
()
==
null
||
dto
.
getTotalHargaNSC
()
==
0
||
dto
.
getTotalHargaNSC
().
isNaN
())
{
throw
new
Exception
(
"Total Harga Tidak Boleh Kosong, Mohon Periksa Kembali Data"
);
}
if
(
dto
.
getNoNJB
()
==
null
||
dto
.
getNoNJB
().
isEmpty
()
&&
!
dto
.
getTanggalNJB
().
isEmpty
())
{
throw
new
Exception
(
"No NJB harus dilengkapi"
);
}
else
if
(
dto
.
getNoNJB
()
==
null
||
dto
.
getNoNJB
().
isEmpty
()
&&
dto
.
getTotalHargaNJB
()
!=
0
)
{
throw
new
Exception
(
"No NJB harus dilengkapi"
);
}
else
if
(
dto
.
getNoNJB
()
==
null
||
dto
.
getNoNJB
().
isEmpty
()
&&
!
dto
.
getHondaIdMekanik
().
isEmpty
())
{
throw
new
Exception
(
"No NJB harus dilengkapi"
);
}
else
if
(
dto
.
getNoNJB
()
==
null
||
dto
.
getNoNJB
().
isEmpty
()
&&
!
dto
.
getHondaIdSA
().
isEmpty
())
{
throw
new
Exception
(
"No NJB harus dilengkapi"
);
}
else
if
(
dto
.
getNoNJB
()
==
null
||
dto
.
getNoNJB
().
isEmpty
()
&&
!
dto
.
getNjb
().
isEmpty
())
{
throw
new
Exception
(
"No NJB harus dilengkapi"
);
}
else
if
(!
dto
.
getNoNJB
().
isEmpty
()
&&
dto
.
getTanggalNJB
().
isEmpty
())
{
throw
new
Exception
(
"Tanggal NJB harus dilengkapi"
);
}
else
if
(!
dto
.
getNoNJB
().
isEmpty
()
&&
dto
.
getTotalHargaNJB
()
==
0
)
{
throw
new
Exception
(
"Total Harga NJB harus dilengkapi"
);
}
else
if
(!
dto
.
getNoNJB
().
isEmpty
()
&&
dto
.
getHondaIdMekanik
().
isEmpty
())
{
throw
new
Exception
(
"Honda Id Mekanik harus dilengkapi"
);
}
else
if
(!
dto
.
getNoNJB
().
isEmpty
()
&&
dto
.
getHondaIdSA
().
isEmpty
())
{
throw
new
Exception
(
"Honda Id SA harus dilengkapi"
);
}
else
if
(!
dto
.
getNoNJB
().
isEmpty
()
&&
dto
.
getNjb
().
isEmpty
())
{
throw
new
Exception
(
"NJB harus dilengkapi"
);
}
}
// nullEmptyExceptionHelper(dto,pass);
exceptionHelperNotMandatory
(
dto
.
getCreatedTime
(),
"dd/MM/yyyy HH:mm:ss"
,
"createdTime"
);
exceptionHelperNotMandatory
(
dto
.
getModifiedTime
(),
"dd/MM/yyyy HH:mm:ss"
,
"modifiedTime"
);
exceptionHelperNotMandatory
(
dto
.
getTanggalNJB
(),
"dd/MM/yyyy HH:mm:ss"
,
"tanggalNJB"
);
exceptionHelperNotMandatory
(
dto
.
getTanggalNSC
(),
"dd/MM/yyyy HH:mm:ss"
,
"tanggalNSC"
);
dealerValidation
(
dealerid
,
dto
.
getDealerId
());
if
(!
dto
.
getNjb
().
isEmpty
()
||
dto
.
getNjb
()
!=
null
)
{
for
(
GatewayServiceOrafinDTO
njb
:
dto
.
getNjb
())
{
exceptionHelperNotMandatory
(
njb
.
getCreatedTime
(),
"dd/MM/yyyy HH:mm:ss"
,
"njb createdTime"
);
exceptionHelperNotMandatory
(
njb
.
getModifiedTime
(),
"dd/MM/yyyy HH:mm:ss"
,
"njb modifiedTime"
);
}
}
if
(!
dto
.
getNsc
().
isEmpty
()
||
dto
.
getNsc
()
!=
null
)
{
for
(
GatewayPartOrafinDTO
nsc
:
dto
.
getNsc
())
{
exceptionHelperNotMandatory
(
nsc
.
getCreatedTime
(),
"dd/MM/yyyy HH:mm:ss"
,
"nsc createdTime"
);
exceptionHelperNotMandatory
(
nsc
.
getModifiedTime
(),
"dd/MM/yyyy HH:mm:ss"
,
"nsc modifiedTime"
);
}
}
}
catch
(
Exception
ex
)
{
Logger
.
getLogger
(
DGIInvoiceNjbNscRESTController
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
ResponseErrorDTO
res
=
new
ResponseErrorDTO
();
res
.
setMessage
(
ex
.
getMessage
());
res
.
setStatus
(
HttpStatus
.
BAD_REQUEST
.
value
());
res
.
setError
(
HttpStatus
.
BAD_REQUEST
.
getReasonPhrase
());
return
ResponseEntity
.
badRequest
().
body
(
res
);
}
Object
data
=
pushNJBNSC
(
dto
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
data
);
}
private
Object
pushNJBNSC
(
GatewayOrafinDTO
dto
)
throws
IOException
{
ObjectMapper
obm
=
new
ObjectMapper
();
ResponseEntity
<
String
>
response
=
restTemplate
.
exchange
(
md_h2_url
+
APIGatewayURI
.
PUSH_NSC_NJB
.
getUri
(),
HttpMethod
.
POST
,
new
HttpEntity
<>(
dto
,
requestUtil
.
getPreFormattedRequestWithToken
().
getHeaders
()),
String
.
class
);
ResponseOrafinDTO
resOra
=
obm
.
readValue
(
response
.
getBody
(),
new
TypeReference
<
ResponseOrafinDTO
>()
{
});
return
resOra
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment