Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dc-cost-system
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
bltdc
dc-cost-system
Commits
d3b6f6b4
Commit
d3b6f6b4
authored
Apr 28, 2020
by
yinyong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
付款单-拉取财务出纳附件信息
parent
09814895
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
152 additions
and
0 deletions
+152
-0
CashierAnnexSyncConfiguration.java
...ther/other_cost/config/CashierAnnexSyncConfiguration.java
+27
-0
CostCheckController.java
.../blt/other/other_cost/controller/CostCheckController.java
+10
-0
CashierAnnexSyncJob.java
...ava/com/blt/other/other_cost/job/CashierAnnexSyncJob.java
+21
-0
CostCashiercallbackService.java
.../other/other_cost/service/CostCashiercallbackService.java
+4
-0
CostService.java
...in/java/com/blt/other/other_cost/service/CostService.java
+4
-0
CostCashiercallbackServiceImpl.java
...her_cost/service/impl/CostCashiercallbackServiceImpl.java
+65
-0
CostServiceImpl.java
...om/blt/other/other_cost/service/impl/CostServiceImpl.java
+11
-0
application-prod.yml
cost-core/src/main/resources/application-prod.yml
+1
-0
Cost.xml
cost-core/src/main/resources/mapper/Cost.xml
+9
-0
No files found.
cost-core/src/main/java/com/blt/other/other_cost/config/CashierAnnexSyncConfiguration.java
0 → 100644
View file @
d3b6f6b4
package
com
.
blt
.
other
.
other_cost
.
config
;
import
com.blt.other.other_cost.job.CashierAnnexSyncJob
;
import
org.quartz.*
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
@Configuration
public
class
CashierAnnexSyncConfiguration
{
// 扫描主体列表时间间隔:(秒)
private
static
final
int
TIME
=
86400
;
@Bean
public
JobDetail
cashierAnnexSyncJobDetail
()
{
return
JobBuilder
.
newJob
(
CashierAnnexSyncJob
.
class
).
withIdentity
(
"cashierAnnexSyncJob"
).
storeDurably
().
build
();
}
@Bean
public
Trigger
cashierAnnexSyncJobTrigger
()
{
SimpleScheduleBuilder
simpleScheduleBuilder
=
SimpleScheduleBuilder
.
simpleSchedule
()
.
withIntervalInSeconds
(
TIME
).
repeatForever
();
return
TriggerBuilder
.
newTrigger
().
forJob
(
cashierAnnexSyncJobDetail
())
.
withIdentity
(
"cashierAnnexSyncTrigger"
)
.
withSchedule
(
simpleScheduleBuilder
).
build
();
}
}
cost-core/src/main/java/com/blt/other/other_cost/controller/CostCheckController.java
View file @
d3b6f6b4
...
...
@@ -590,4 +590,14 @@ public class CostCheckController {
costLogService
.
save
(
costNo
,
Integer
.
parseInt
(
updateuserid
),
"操作结清"
);
return
result
;
}
@GetMapping
(
"downCashierAnnex"
)
public
Map
<
String
,
Object
>
downCashierAnnex
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
AxiosUtil
.
setCors
(
response
,
request
);
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
List
<
String
>
list
=
costCashiercallbackService
.
downCashierAnnex
();
result
.
put
(
"success"
,
true
);
result
.
put
(
"msg"
,
"出纳单附件下载完成"
);
return
result
;
}
}
cost-core/src/main/java/com/blt/other/other_cost/job/CashierAnnexSyncJob.java
0 → 100644
View file @
d3b6f6b4
package
com
.
blt
.
other
.
other_cost
.
job
;
import
com.blt.other.other_cost.service.CostCashiercallbackService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.quartz.JobExecutionContext
;
import
org.quartz.JobExecutionException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.quartz.QuartzJobBean
;
@Slf4j
public
class
CashierAnnexSyncJob
extends
QuartzJobBean
{
@Autowired
private
CostCashiercallbackService
costCashiercallbackService
;
@Override
protected
void
executeInternal
(
JobExecutionContext
jobExecutionContext
)
throws
JobExecutionException
{
costCashiercallbackService
.
downCashierAnnex
();
}
}
cost-core/src/main/java/com/blt/other/other_cost/service/CostCashiercallbackService.java
View file @
d3b6f6b4
...
...
@@ -2,7 +2,11 @@ package com.blt.other.other_cost.service;
import
com.blt.other.other_database.model.CostCashiercallbackDomain
;
import
java.util.List
;
public
interface
CostCashiercallbackService
{
Integer
saveCostCashiercallbackResponse
(
CostCashiercallbackDomain
costCashiercallbackDomain
);
List
<
String
>
downCashierAnnex
();
}
cost-core/src/main/java/com/blt/other/other_cost/service/CostService.java
View file @
d3b6f6b4
...
...
@@ -101,4 +101,8 @@ public interface CostService {
Integer
getCostStatusByNo
(
String
costNo
);
List
<
CostDto
>
getCostByRejectStatus
();
List
<
String
>
listCostNo
();
Integer
updateCashierAnnex
(
String
costNo
,
String
filePath
,
String
downloadUrl
);
}
cost-core/src/main/java/com/blt/other/other_cost/service/impl/CostCashiercallbackServiceImpl.java
View file @
d3b6f6b4
package
com
.
blt
.
other
.
other_cost
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.blt.other.other_commons.utils.PathUtil
;
import
com.blt.other.other_cost.dao.CostCashiercallbackDao
;
import
com.blt.other.other_cost.service.CostCashiercallbackService
;
import
com.blt.other.other_cost.service.CostService
;
import
com.blt.other.other_database.model.CashiercallbackDomain
;
import
com.blt.other.other_database.model.CostCashiercallbackDomain
;
import
com.blt.other.other_purchasing.dao.CashiercallbackDao
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.io.Resource
;
import
org.springframework.http.HttpEntity
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.client.RestTemplate
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.UUID
;
@Service
public
class
CostCashiercallbackServiceImpl
implements
CostCashiercallbackService
{
@Autowired
CostCashiercallbackDao
costCashiercallbackDao
;
@Autowired
private
CostService
costService
;
@Value
(
"${url.api.getCashierAnnexApi}"
)
private
String
getCashierAnnexApi
;
@Autowired
private
RestTemplate
restTemplate
;
@Override
public
Integer
saveCostCashiercallbackResponse
(
CostCashiercallbackDomain
costCashiercallbackDomain
)
{
return
costCashiercallbackDao
.
insert
(
costCashiercallbackDomain
);
}
@Override
public
List
<
String
>
downCashierAnnex
()
{
List
<
String
>
costNoList
=
costService
.
listCostNo
();
HttpHeaders
headers
=
new
HttpHeaders
();
HttpEntity
<
Resource
>
httpEntity
=
new
HttpEntity
<
Resource
>(
headers
);
for
(
String
costNo:
costNoList
)
{
String
baseUrl
=
getCashierAnnexApi
+
"?sourceCode=newCost&detailName="
+
costNo
;
String
downloadStr
=
""
;
try
{
ResponseEntity
<
String
>
download
=
restTemplate
.
getForEntity
(
baseUrl
,
String
.
class
);
downloadStr
=
download
.
getBody
();
}
catch
(
Exception
e
){
continue
;
}
Map
<
String
,
String
>
map
=
JSONObject
.
parseObject
(
downloadStr
,
Map
.
class
);
String
downloadUrl
=
map
.
get
(
"annex"
);
if
(!
downloadUrl
.
contains
(
"uploadfile"
))
{
continue
;
}
ResponseEntity
<
byte
[]>
response
=
restTemplate
.
exchange
(
downloadUrl
,
HttpMethod
.
GET
,
httpEntity
,
byte
[].
class
);
try
{
String
filePath
=
PathUtil
.
getBasePath
()+
PathUtil
.
getPath
(
"cashier/"
+
costNo
+
"/"
+
UUID
.
randomUUID
()+
"."
+
response
.
getHeaders
().
getContentType
().
getSubtype
());
File
file
=
new
File
(
filePath
);
if
(!
file
.
getParentFile
().
exists
()){
file
.
getParentFile
().
mkdirs
();
}
FileOutputStream
fos
=
new
FileOutputStream
(
file
);
fos
.
write
(
response
.
getBody
());
fos
.
flush
();
fos
.
close
();
costService
.
updateCashierAnnex
(
costNo
,
filePath
,
downloadUrl
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
return
costNoList
;
}
}
cost-core/src/main/java/com/blt/other/other_cost/service/impl/CostServiceImpl.java
View file @
d3b6f6b4
...
...
@@ -362,6 +362,17 @@ public class CostServiceImpl implements CostService {
}
@Override
public
List
<
String
>
listCostNo
()
{
return
costDao
.
listCostNo
();
}
@Override
public
Integer
updateCashierAnnex
(
String
costNo
,
String
filePath
,
String
downloadUrl
)
{
return
costDao
.
updateCashierAnnex
(
costNo
,
filePath
,
downloadUrl
);
}
@Override
public
CostDomain
getCostDomainByNo
(
String
costNo
)
{
CostDomain
costDomain
=
costDao
.
selectByCostNo
(
costNo
);
return
costDomain
;
...
...
cost-core/src/main/resources/application-prod.yml
View file @
d3b6f6b4
...
...
@@ -70,6 +70,7 @@ url:
getAllSubLogisticsFinansysApi
:
http://supplier.bailuntec.com/Api/GetSubLogisticsSupplier
# 获取耗材
getConsumablesApi
:
${url.api.baseFinansysUrl}/Cashier/Cashier/BuyCashierRecordList
getCashierAnnexApi
:
${url.api.baseFinansysUrl}/API/API/GetCashierAnnex
cookie
:
...
...
cost-core/src/main/resources/mapper/Cost.xml
View file @
d3b6f6b4
...
...
@@ -559,4 +559,12 @@
<select
id=
"getCostByRejectStatus"
resultType=
"com.blt.other.other_cost.dto.CostDto"
>
select * from cost where cost_status = 3 and reject_type = 1 and reject_time
<![CDATA[<]]>
date_sub(now(),INTERVAL 1 DAY)
</select>
<select
id=
"listCostNo"
resultType=
"java.lang.String"
>
select cost_no from cost where cost_form = 1 and cost_status = 4 and cashier_file_path = ''
</select>
<update
id=
"updateCashierAnnex"
>
update cost set cashier_file_path = #{filePath}, cashier_download_path = #{downloadUrl} where cost_no = #{costNo}
</update>
</mapper>
\ No newline at end of file
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