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
202d13b4
Commit
202d13b4
authored
Sep 18, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
工资系统推送费用单
parent
a8b91444
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
217 additions
and
13 deletions
+217
-13
CostApiController.java
...om/blt/other/other_cost/controller/CostApiController.java
+27
-0
WageCostDto.java
...c/main/java/com/blt/other/other_cost/dto/WageCostDto.java
+42
-0
CostApiService.java
...java/com/blt/other/other_cost/service/CostApiService.java
+12
-0
UserCostFinansysService.java
...blt/other/other_cost/service/UserCostFinansysService.java
+4
-0
CostApiServiceImpl.java
...blt/other/other_cost/service/impl/CostApiServiceImpl.java
+93
-7
CostFileUtil.java
...ain/java/com/blt/other/other_cost/utils/CostFileUtil.java
+39
-6
No files found.
cost-core/src/main/java/com/blt/other/other_cost/controller/CostApiController.java
View file @
202d13b4
...
@@ -2,6 +2,7 @@ package com.blt.other.other_cost.controller;
...
@@ -2,6 +2,7 @@ package com.blt.other.other_cost.controller;
import
com.blt.other.other_cost.dto.LogisticsCostDto
;
import
com.blt.other.other_cost.dto.LogisticsCostDto
;
import
com.blt.other.other_cost.dto.ManageCostDto
;
import
com.blt.other.other_cost.dto.ManageCostDto
;
import
com.blt.other.other_cost.dto.WageCostDto
;
import
com.blt.other.other_cost.service.CostApiService
;
import
com.blt.other.other_cost.service.CostApiService
;
import
com.blt.other.other_database.model.CostDomain
;
import
com.blt.other.other_database.model.CostDomain
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -26,6 +27,32 @@ public class CostApiController {
...
@@ -26,6 +27,32 @@ public class CostApiController {
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
CostApiController
.
class
);
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
CostApiController
.
class
);
/**
* <p>
* 接受工资单,自动生成付款费用单到财务审核
* </p>
*
* @param wageCostDto 工资单入参
* @return 费用单No
*/
@PostMapping
(
"/pushWageCost"
)
public
Map
<
String
,
Object
>
pushWageCost
(
@RequestBody
WageCostDto
wageCostDto
)
{
logger
.
warn
(
"接收推送而来的工资单信息:"
+
wageCostDto
);
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
try
{
String
costNo
=
costApiService
.
pushWageCost
(
wageCostDto
);
result
.
put
(
"success"
,
true
);
result
.
put
(
"message"
,
costNo
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
result
.
put
(
"success"
,
false
);
result
.
put
(
"message"
,
"生成物流付款费用单发生错误:"
+
e
.
getMessage
());
logger
.
error
(
"生成物流付款费用单发生错误:"
+
e
.
getMessage
());
}
return
result
;
}
/**
/**
* 接收物流单,自动生成付款费用单到财务审核
* 接收物流单,自动生成付款费用单到财务审核
*
*
...
...
cost-core/src/main/java/com/blt/other/other_cost/dto/WageCostDto.java
0 → 100644
View file @
202d13b4
package
com
.
blt
.
other
.
other_cost
.
dto
;
import
lombok.Data
;
import
java.math.BigDecimal
;
/**
* <p>
* 工资费用单入参
* </p>
*
* @author robbendev
* @since 2020/9/18 11:30 上午
*/
@Data
public
class
WageCostDto
{
//用户ID
private
Integer
userId
;
// 费用单金额
private
BigDecimal
amount
;
// 币种
private
String
currency
;
// 费用单备注
private
String
costRemark
;
// 付款理由
private
String
costReason
;
//费用来源 1-默认 2-WMS 3-调拨系统 4-工资系统
private
String
sourceFrom
;
private
String
companyName
;
private
Integer
companyValue
;
//附件外链地址
private
String
fileUrl
}
cost-core/src/main/java/com/blt/other/other_cost/service/CostApiService.java
View file @
202d13b4
...
@@ -2,8 +2,10 @@ package com.blt.other.other_cost.service;
...
@@ -2,8 +2,10 @@ package com.blt.other.other_cost.service;
import
com.blt.other.other_cost.dto.LogisticsCostDto
;
import
com.blt.other.other_cost.dto.LogisticsCostDto
;
import
com.blt.other.other_cost.dto.ManageCostDto
;
import
com.blt.other.other_cost.dto.ManageCostDto
;
import
com.blt.other.other_cost.dto.WageCostDto
;
import
com.blt.other.other_database.model.CostDomain
;
import
com.blt.other.other_database.model.CostDomain
;
import
java.io.IOException
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -55,4 +57,14 @@ public interface CostApiService {
...
@@ -55,4 +57,14 @@ public interface CostApiService {
CostDomain
getCostDetails
(
String
costNo
);
CostDomain
getCostDetails
(
String
costNo
);
/**
* <p>
* 接受工资单,自动生成付款费用单到财务审核
* </p>
*
* @param wageCostDto 工资单入参
* @return 费用单costNo
*/
String
pushWageCost
(
WageCostDto
wageCostDto
)
throws
IOException
;
}
}
cost-core/src/main/java/com/blt/other/other_cost/service/UserCostFinansysService.java
View file @
202d13b4
...
@@ -12,12 +12,14 @@ public interface UserCostFinansysService {
...
@@ -12,12 +12,14 @@ public interface UserCostFinansysService {
/**
/**
* 保存用户填写的账户信息
* 保存用户填写的账户信息
*
* @param userCostFinansysDomain
* @param userCostFinansysDomain
* @return
* @return
*/
*/
Integer
saveFinansysRecord
(
UserCostFinansysDomain
userCostFinansysDomain
);
Integer
saveFinansysRecord
(
UserCostFinansysDomain
userCostFinansysDomain
);
UserCostFinansysDomain
createFinansyRecordByCostPlanDomain
(
CostPlanDomain
planDomain
);
UserCostFinansysDomain
createFinansyRecordByCostPlanDomain
(
CostPlanDomain
planDomain
);
UserCostFinansysDomain
createFinansyRecordByCostDomain
(
CostDomain
costDomain
);
UserCostFinansysDomain
createFinansyRecordByCostDomain
(
CostDomain
costDomain
);
List
<
UserCostFinansysDomain
>
getByUsercode
(
String
usercode
);
List
<
UserCostFinansysDomain
>
getByUsercode
(
String
usercode
);
...
@@ -34,12 +36,14 @@ public interface UserCostFinansysService {
...
@@ -34,12 +36,14 @@ public interface UserCostFinansysService {
/**
/**
* 获取所有一级物流供应商财务信息
* 获取所有一级物流供应商财务信息
*
* @return
* @return
*/
*/
List
<
LogisticsFinansysDto
>
getAllLogisticsFinansys
();
List
<
LogisticsFinansysDto
>
getAllLogisticsFinansys
();
/**
/**
* 获取所有二级物流供应商财务信息
* 获取所有二级物流供应商财务信息
*
* @return
* @return
*/
*/
List
<
SubLogisticsFinansysDto
>
getAllSubLogisticsFinansys
();
List
<
SubLogisticsFinansysDto
>
getAllSubLogisticsFinansys
();
...
...
cost-core/src/main/java/com/blt/other/other_cost/service/impl/CostApiServiceImpl.java
View file @
202d13b4
...
@@ -5,17 +5,18 @@ import com.blt.other.other_auth.dao.UserDao;
...
@@ -5,17 +5,18 @@ import com.blt.other.other_auth.dao.UserDao;
import
com.blt.other.other_commons.utils.CurUtils
;
import
com.blt.other.other_commons.utils.CurUtils
;
import
com.blt.other.other_commons.utils.DateTimeUtil
;
import
com.blt.other.other_commons.utils.DateTimeUtil
;
import
com.blt.other.other_commons.utils.HttpUtil
;
import
com.blt.other.other_commons.utils.HttpUtil
;
import
com.blt.other.other_commons.utils.PathUtil
;
import
com.blt.other.other_cost.dao.CostDao
;
import
com.blt.other.other_cost.dao.CostDao
;
import
com.blt.other.other_cost.dao.CostDetailDao
;
import
com.blt.other.other_cost.dao.CostDetailDao
;
import
com.blt.other.other_cost.dao.CostTypeDao
;
import
com.blt.other.other_cost.dao.CostTypeKindDao
;
import
com.blt.other.other_cost.dto.*
;
import
com.blt.other.other_cost.dto.*
;
import
com.blt.other.other_cost.service.CostApiService
;
import
com.blt.other.other_cost.service.CostApiService
;
import
com.blt.other.other_cost.service.CostService
;
import
com.blt.other.other_cost.service.CostService
;
import
com.blt.other.other_cost.service.CostTypeKindService
;
import
com.blt.other.other_cost.service.UserCostFinansysService
;
import
com.blt.other.other_cost.service.UserCostFinansysService
;
import
com.blt.other.other_cost.utils.CostFileUtil
;
import
com.blt.other.other_cost.utils.CostUtils
;
import
com.blt.other.other_cost.utils.CostUtils
;
import
com.blt.other.other_database.model.CostDetailDomain
;
import
com.blt.other.other_database.model.*
;
import
com.blt.other.other_database.model.CostDomain
;
import
com.blt.other.other_database.model.UserDomain
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
...
@@ -25,6 +26,7 @@ import org.springframework.stereotype.Service;
...
@@ -25,6 +26,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.math.RoundingMode
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -42,7 +44,9 @@ public class CostApiServiceImpl implements CostApiService {
...
@@ -42,7 +44,9 @@ public class CostApiServiceImpl implements CostApiService {
private
CostService
costService
;
private
CostService
costService
;
@Autowired
@Autowired
private
CostTypeKindService
costTypeKindService
;
private
CostTypeKindDao
costTypeKindDao
;
@Autowired
private
CostTypeDao
costTypeDao
;
@Autowired
@Autowired
private
UserDao
userDao
;
private
UserDao
userDao
;
...
@@ -75,8 +79,8 @@ public class CostApiServiceImpl implements CostApiService {
...
@@ -75,8 +79,8 @@ public class CostApiServiceImpl implements CostApiService {
costDomain
.
setKindName
(
"物流费"
);
costDomain
.
setKindName
(
"物流费"
);
costDomain
.
setSubjectCode
(
"660104"
);
costDomain
.
setSubjectCode
(
"660104"
);
costDomain
.
setCompanyNo
(
"COM1806191800013"
);
costDomain
.
setCompanyNo
(
"COM1806191800013"
);
costDomain
.
setCompanyValue
(
2
);
costDomain
.
setCompanyValue
(
2
);
//dy
costDomain
.
setCompanyName
(
"香港百伦科技有限公司"
);
costDomain
.
setCompanyName
(
"香港百伦科技有限公司"
);
//dy
costDomain
.
setAmount
(
logisticsCostDto
.
getAmount
());
costDomain
.
setAmount
(
logisticsCostDto
.
getAmount
());
costDomain
.
setDic
(
logisticsCostDto
.
getCurrency
());
costDomain
.
setDic
(
logisticsCostDto
.
getCurrency
());
costDomain
.
setSourceFrom
(
logisticsCostDto
.
getSourceFrom
());
costDomain
.
setSourceFrom
(
logisticsCostDto
.
getSourceFrom
());
...
@@ -260,4 +264,86 @@ public class CostApiServiceImpl implements CostApiService {
...
@@ -260,4 +264,86 @@ public class CostApiServiceImpl implements CostApiService {
public
CostDomain
getCostDetails
(
String
costNo
)
{
public
CostDomain
getCostDetails
(
String
costNo
)
{
return
costDao
.
selectByCostNo
(
costNo
);
return
costDao
.
selectByCostNo
(
costNo
);
}
}
@Override
public
String
pushWageCost
(
WageCostDto
wageCostDto
)
throws
IOException
{
CostDomain
costDomain
=
new
CostDomain
();
String
costNo
=
CostUtils
.
getIdNum
(
costService
);
costDomain
.
setCostNo
(
costNo
);
// 付款费用单 1付款 2收款 3借支/借还
costDomain
.
setCostForm
(
1
);
// 0 待提交 1待审核 2待出纳付款 3被驳回 4已支付 5已作废
costDomain
.
setCostStatus
(
1
);
costDomain
.
setCostRemark
(
wageCostDto
.
getCostRemark
());
costDomain
.
setCostReason
(
wageCostDto
.
getCostReason
());
CostTypeDomain
costTypeDomain
=
costTypeDao
.
selectByCompanyNameAndTypeName
(
wageCostDto
.
getCompanyName
(),
"人工支出"
);
CostTypeKindDomain
sqlParam
=
new
CostTypeKindDomain
();
sqlParam
.
setTypeNo
(
costTypeDomain
.
getTypeNo
());
sqlParam
.
setKindName
(
"工资"
);
CostTypeKindDomain
costTypeKindDomain
=
costTypeKindDao
.
selectByTypeNoAndKindName
(
sqlParam
);
costDomain
.
setTypeNo
(
costTypeDomain
.
getTypeNo
());
costDomain
.
setTypeName
(
costTypeDomain
.
getTypeName
());
costDomain
.
setSubjectCode
(
costTypeDomain
.
getSubjectCode
());
costDomain
.
setCompanyNo
(
costTypeDomain
.
getCompanyNo
());
costDomain
.
setCompanyName
(
wageCostDto
.
getCompanyName
());
//dy
costDomain
.
setCompanyValue
(
wageCostDto
.
getCompanyValue
());
costDomain
.
setKindNo
(
costTypeKindDomain
.
getKindNo
());
costDomain
.
setKindName
(
costTypeKindDomain
.
getKindName
());
costDomain
.
setAmount
(
wageCostDto
.
getAmount
());
costDomain
.
setDic
(
wageCostDto
.
getCurrency
());
costDomain
.
setSourceFrom
(
wageCostDto
.
getSourceFrom
());
BigDecimal
toRmbRate
=
null
;
if
(
"CNY"
.
equals
(
wageCostDto
.
getCurrency
()))
{
toRmbRate
=
BigDecimal
.
ONE
;
costDomain
.
setAmountRmb
(
wageCostDto
.
getAmount
());
}
else
{
toRmbRate
=
CurUtils
.
getCur
(
wageCostDto
.
getCurrency
(),
"CNY"
,
getExchangeRateApi
);
costDomain
.
setAmountRmb
(
wageCostDto
.
getAmount
().
multiply
(
toRmbRate
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
));
}
costDomain
.
setToRmbRate
(
toRmbRate
);
UserDomain
user
=
userDao
.
selectByuserid
(
wageCostDto
.
getUserId
());
if
(
user
==
null
)
{
throw
new
RuntimeException
(
"费用系统中没有该用户信息,请先登录一次费用系统再进行推送!"
);
}
else
{
costDomain
.
setCreateUserid
(
user
.
getUserid
());
costDomain
.
setCreateUsercode
(
user
.
getUsercode
());
costDomain
.
setCreateUsername
(
user
.
getUsername
());
costDomain
.
setCreateTime
(
new
Date
());
}
//写入费用单
costDao
.
insert
(
costDomain
);
//写入费用单详情
CostDetailDomain
costDetailDomain
=
new
CostDetailDomain
();
// 文件上传的路径
String
filePath
=
PathUtil
.
getBasePath
()
+
PathUtil
.
getPath
(
"cost/"
+
costDomain
.
getCostNo
()
+
"/"
);
// 调用工具类执行保存,并返回 path
String
path
=
CostFileUtil
.
upload
(
wageCostDto
.
getFileUrl
(),
filePath
);
BeanUtils
.
copyProperties
(
costDomain
,
costDetailDomain
);
costDetailDomain
.
setDetailNo
(
costNo
+
"-1"
);
costDetailDomain
.
setFilePath
(
path
);
costDetailDao
.
insert
(
costDetailDomain
);
CostLogDomain
costLogDomain
=
new
CostLogDomain
();
costLogDomain
.
setCostNo
(
costNo
);
costLogDomain
.
setUpdateUserid
(
user
.
getUserid
());
costLogDomain
.
setUpdateUsername
(
user
.
getUsername
());
costLogDomain
.
setUpdateTime
(
new
Date
());
costLogDomain
.
setUpdateNote
(
"老板已经审批通过了"
);
costLogDomain
.
setUpdateUsercode
(
user
.
getUsercode
());
return
costNo
;
}
}
}
cost-core/src/main/java/com/blt/other/other_cost/utils/CostFileUtil.java
View file @
202d13b4
package
com
.
blt
.
other
.
other_cost
.
utils
;
package
com
.
blt
.
other
.
other_cost
.
utils
;
import
com.blt.other.other_commons.utils.PathUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.UUID
;
import
java.util.UUID
;
/**
/**
* 费用模块文件上传、下载工具类
* 费用模块文件上传、下载工具类
*/
*/
@Slf4j
public
class
CostFileUtil
{
public
class
CostFileUtil
{
public
static
String
upload
(
MultipartFile
file
,
String
filePath
)
{
public
static
String
upload
(
MultipartFile
file
,
String
filePath
)
{
// 获取文件名
// 获取文件名
String
fileName
=
file
.
getOriginalFilename
();
String
fileName
=
file
.
getOriginalFilename
();
// 获取后缀
String
suffixName
=
fileName
.
substring
(
fileName
.
lastIndexOf
(
"."
));
// fileName处理
// fileName处理
fileName
=
filePath
+
UUID
.
randomUUID
()+
"&"
+
fileName
;
fileName
=
filePath
+
UUID
.
randomUUID
()
+
"&"
+
fileName
;
// 文件对象
// 文件对象
File
dest
=
new
File
(
fileName
);
File
dest
=
new
File
(
fileName
);
// 创建路径
// 创建路径
if
(!
dest
.
getParentFile
().
exists
())
{
if
(!
dest
.
getParentFile
().
exists
())
{
dest
.
getParentFile
().
mkdirs
();
dest
.
getParentFile
().
mkdirs
();
}
}
try
{
try
{
...
@@ -34,4 +36,35 @@ public class CostFileUtil {
...
@@ -34,4 +36,35 @@ public class CostFileUtil {
}
}
return
fileName
;
return
fileName
;
}
}
public
static
String
upload
(
String
netUrl
,
String
filePath
)
throws
IOException
{
RestTemplate
restTemplate
=
new
RestTemplate
();
byte
[]
bytes
=
restTemplate
.
getForObject
(
netUrl
,
byte
[].
class
);
if
(
bytes
==
null
||
bytes
.
length
==
0
)
{
throw
new
RuntimeException
(
"附件内容为空"
);
}
int
dotIndex
=
netUrl
.
lastIndexOf
(
"."
);
String
fileName
=
filePath
+
UUID
.
randomUUID
()
+
"."
+
netUrl
.
substring
(
dotIndex
+
1
);
File
dest
=
new
File
(
fileName
);
// 创建路径
if
(!
dest
.
getParentFile
().
exists
())
{
boolean
b
=
dest
.
getParentFile
().
mkdirs
();
if
(!
b
)
{
throw
new
RuntimeException
(
"上传附件失败"
);
}
}
InputStream
inputStream
=
new
FileInputStream
(
fileName
);
int
size
=
inputStream
.
read
(
bytes
);
log
.
info
(
"文件大小:{}"
,
size
);
inputStream
.
close
();
return
fileName
;
}
}
}
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