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
c4742a0f
Commit
c4742a0f
authored
Jan 04, 2021
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
dd49d703
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
88 additions
and
44 deletions
+88
-44
ProjectConstant.java
...com/blt/other/common/config/property/ProjectConstant.java
+14
-0
CostApiController.java
...m/blt/other/module/cost/controller/CostApiController.java
+2
-1
CostTypeDao.java
.../main/java/com/blt/other/module/cost/dao/CostTypeDao.java
+4
-1
CostApiServiceImpl.java
...lt/other/module/cost/service/impl/CostApiServiceImpl.java
+39
-30
application-prod.yml
bailuntec-cost-core/src/main/resources/application-prod.yml
+2
-2
CostTypeMapper.xml
...ec-cost-core/src/main/resources/mapper/CostTypeMapper.xml
+7
-0
OtherApplicationTests.java
...re/src/test/java/com/blt/other/OtherApplicationTests.java
+20
-10
No files found.
bailuntec-cost-core/src/main/java/com/blt/other/common/config/property/ProjectConstant.java
0 → 100644
View file @
c4742a0f
package
com
.
blt
.
other
.
common
.
config
.
property
;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2021/1/4 1:16 下午
*/
public
class
ProjectConstant
{
public
static
final
String
CNY
=
"CNY"
;
}
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/controller/CostApiController.java
View file @
c4742a0f
...
@@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
...
@@ -30,7 +31,7 @@ import java.util.stream.Collectors;
...
@@ -30,7 +31,7 @@ import java.util.stream.Collectors;
@RequestMapping
(
"/cost/api"
)
@RequestMapping
(
"/cost/api"
)
public
class
CostApiController
implements
CostApi
{
public
class
CostApiController
implements
CostApi
{
@
Autowired
@
Resource
private
CostApiService
costApiService
;
private
CostApiService
costApiService
;
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
CostApiController
.
class
);
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
CostApiController
.
class
);
...
...
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/dao/CostTypeDao.java
View file @
c4742a0f
...
@@ -2,9 +2,9 @@ package com.blt.other.module.cost.dao;
...
@@ -2,9 +2,9 @@ package com.blt.other.module.cost.dao;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.blt.other.database.model.CostTypeDomain
;
import
com.blt.other.module.cost.dto.request.CostTypeQueryPageReq
;
import
com.blt.other.module.cost.dto.request.CostTypeQueryPageReq
;
import
com.blt.other.module.cost.dto.response.CostTypeResult
;
import
com.blt.other.module.cost.dto.response.CostTypeResult
;
import
com.blt.other.database.model.CostTypeDomain
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
...
@@ -25,4 +25,7 @@ public interface CostTypeDao extends BaseMapper<CostTypeDomain> {
...
@@ -25,4 +25,7 @@ public interface CostTypeDao extends BaseMapper<CostTypeDomain> {
//获取费用类型详情
//获取费用类型详情
CostTypeResult
queryByNo
(
String
typeNo
);
CostTypeResult
queryByNo
(
String
typeNo
);
//根据费用类型名称和类型查询
CostTypeDomain
selectByNameAndType
(
@Param
(
"name"
)
String
name
,
@Param
(
"type"
)
Integer
type
);
}
}
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/impl/CostApiServiceImpl.java
View file @
c4742a0f
...
@@ -6,21 +6,24 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
...
@@ -6,21 +6,24 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.blt.other.common.config.property.CostUrlProperties
;
import
com.blt.other.common.config.property.CostUrlProperties
;
import
com.blt.other.common.config.property.ProjectConstant
;
import
com.blt.other.common.exception.BizRuntimeException
;
import
com.blt.other.common.util.CurUtils
;
import
com.blt.other.common.util.CurUtils
;
import
com.blt.other.common.util.HttpUtil
;
import
com.blt.other.common.util.HttpUtil
;
import
com.blt.other.common.util.PathUtil
;
import
com.blt.other.common.util.PathUtil
;
import
com.blt.other.database.model.CostCompanyDomain
;
import
com.blt.other.database.model.CostLogDomain
;
import
com.blt.other.database.model.CostTypeDomain
;
import
com.blt.other.database.model.UserDomain
;
import
com.blt.other.module.auth.dao.UserDao
;
import
com.blt.other.module.auth.dao.UserDao
;
import
com.blt.other.module.cost.dao.*
;
import
com.blt.other.module.cost.dao.*
;
import
com.blt.other.module.cost.model.AccountingSubject
;
import
com.blt.other.module.cost.model.CostDetailDomain
;
import
com.blt.other.module.cost.model.CostDetailDomain
;
import
com.blt.other.module.cost.model.CostDomain
;
import
com.blt.other.module.cost.model.CostDomain
;
import
com.blt.other.module.cost.service.CostApiService
;
import
com.blt.other.module.cost.service.CostApiService
;
import
com.blt.other.module.cost.service.UserCostFinansysService
;
import
com.blt.other.module.cost.service.UserCostFinansysService
;
import
com.blt.other.module.cost.utils.CostFileUtil
;
import
com.blt.other.module.cost.utils.CostFileUtil
;
import
com.blt.other.module.cost.utils.CostUtils
;
import
com.blt.other.module.cost.utils.CostUtils
;
import
com.blt.other.database.model.CostCompanyDomain
;
import
com.blt.other.database.model.CostLogDomain
;
import
com.blt.other.database.model.CostTypeKindDomain
;
import
com.blt.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
;
...
@@ -260,68 +263,74 @@ public class CostApiServiceImpl implements CostApiService {
...
@@ -260,68 +263,74 @@ public class CostApiServiceImpl implements CostApiService {
.
in
(
CostDomain:
:
getCostNo
,
costNoList
));
.
in
(
CostDomain:
:
getCostNo
,
costNoList
));
}
}
@Override
@Override
public
CostDomain
getCostDetails
(
String
costNo
)
{
public
CostDomain
getCostDetails
(
String
costNo
)
{
return
costDao
.
selectByCostNo
(
costNo
);
return
costDao
.
selectByCostNo
(
costNo
);
}
}
@Resource
CostTypeDao
costTypeDao
;
@Resource
AccountingSubjectMapper
accountingSubjectMapper
;
@Override
@Override
public
String
pushWageCost
(
WageCostDto
wageCostDto
)
throws
IOException
{
public
String
pushWageCost
(
WageCostDto
wageCostDto
)
throws
IOException
{
CostDomain
costDomain
=
new
CostDomain
();
CostDomain
costDomain
=
new
CostDomain
();
String
costNo
=
CostUtils
.
getIdNum
();
String
costNo
=
CostUtils
.
getIdNum
();
costDomain
.
setCostNo
(
costNo
);
costDomain
.
setCostNo
(
costNo
);
// 付款费用单 1付款 2收款 3借支/借还
// 付款费用单 1付款 2收款 3借支/借还
costDomain
.
setCostForm
(
1
);
costDomain
.
setCostForm
(
CostDomain
.
COST_FROM_
1
);
// 0 待提交 1待审核 2待出纳付款 3被驳回 4已支付 5已作废
// 0 待提交 1待审核 2待出纳付款 3被驳回 4已支付 5已作废
costDomain
.
setCostStatus
(
7
);
costDomain
.
setCostStatus
(
CostDomain
.
STATUS_FINANCIAL_CHECK
);
costDomain
.
setCostRemark
(
wageCostDto
.
getCostRemark
());
costDomain
.
setCostReason
(
wageCostDto
.
getCostReason
());
// CostTypeDomain costTypeDomain = costTypeDao.selectByCompanyNameAndTypeName(wageCostDto.getCompanyName(), "人工支出");
CostTypeKindDomain
sqlParam
=
new
CostTypeKindDomain
();
// sqlParam.setTypeNo(costTypeDomain.getTypeNo());
sqlParam
.
setKindName
(
"工资"
);
sqlParam
.
setCompanyName
(
wageCostDto
.
getCompanyName
());
//类型信息
CostTypeDomain
costTypeDomain
=
costTypeDao
.
selectByNameAndType
(
"工资"
,
CostTypeDomain
.
feeType
);
AccountingSubject
accountingSubject
=
accountingSubjectMapper
.
selectByNo
(
costTypeDomain
.
getAccountingSubjectNo
());
costDomain
.
setTypeNo
(
costTypeDomain
.
getTypeName
());
costDomain
.
setTypeName
(
costTypeDomain
.
getTypeName
());
costDomain
.
setAccountingSubjectNo
(
accountingSubject
.
getSubjectNo
());
costDomain
.
setAccountingSubjectName
(
accountingSubject
.
getName
());
//公司
CostCompanyDomain
costCompany
=
costCompanyDao
.
selectByName
(
wageCostDto
.
getCompanyName
());
CostCompanyDomain
costCompany
=
costCompanyDao
.
selectByName
(
wageCostDto
.
getCompanyName
());
CostTypeKindDomain
costTypeKindDomain
=
costTypeKindDao
.
selectByKindNameAndCompanyNo
(
"工资"
,
costCompany
.
getCompanyNo
());
costDomain
.
setCompanyNo
(
costCompany
.
getCompanyNo
());
costDomain
.
setTypeNo
(
costTypeKindDomain
.
getTypeNo
());
//财务主体信息
costDomain
.
setTypeName
(
costTypeKindDomain
.
getTypeName
());
costDomain
.
setCompanyName
(
wageCostDto
.
getCompanyName
());
// costDomain.setSubjectCode(costTypeKindDomain.getSubjectCode());
costDomain
.
setCompanyNo
(
costTypeKindDomain
.
getCompanyNo
());
costDomain
.
setCompanyName
(
wageCostDto
.
getCompanyName
());
//dy
costDomain
.
setCompanyValue
(
wageCostDto
.
getCompanyValue
());
costDomain
.
setCompanyValue
(
wageCostDto
.
getCompanyValue
());
//银行卡四要素
costDomain
.
setBankCard
(
wageCostDto
.
getBankCard
());
costDomain
.
setBankCard
(
wageCostDto
.
getBankCard
());
costDomain
.
setBankCardUser
(
wageCostDto
.
getBankCardUser
());
costDomain
.
setBankCardUser
(
wageCostDto
.
getBankCardUser
());
costDomain
.
setBankCompany
(
wageCostDto
.
getBankCompany
());
costDomain
.
setBankCompany
(
wageCostDto
.
getBankCompany
());
costDomain
.
setBankName
(
wageCostDto
.
getBankName
());
costDomain
.
setBankName
(
wageCostDto
.
getBankName
());
//金额信息
// costDomain.setKindNo(costTypeKindDomain.getKindNo());
// costDomain.setKindName(costTypeKindDomain.getKindName());
costDomain
.
setAmount
(
wageCostDto
.
getAmount
());
costDomain
.
setAmount
(
wageCostDto
.
getAmount
());
costDomain
.
setDic
(
wageCostDto
.
getCurrency
());
costDomain
.
setDic
(
wageCostDto
.
getCurrency
());
//费用单来源
costDomain
.
setSourceFrom
(
wageCostDto
.
getSourceFrom
());
costDomain
.
setSourceFrom
(
wageCostDto
.
getSourceFrom
());
BigDecimal
toRmbRate
=
null
;
costDomain
.
setCostRemark
(
wageCostDto
.
getCostRemark
());
if
(
"CNY"
.
equals
(
wageCostDto
.
getCurrency
()))
{
costDomain
.
setCostReason
(
wageCostDto
.
getCostReason
());
BigDecimal
toRmbRate
;
//todo simplify
if
(
ProjectConstant
.
CNY
.
equals
(
wageCostDto
.
getCurrency
()))
{
toRmbRate
=
BigDecimal
.
ONE
;
toRmbRate
=
BigDecimal
.
ONE
;
costDomain
.
setAmountRmb
(
wageCostDto
.
getAmount
());
costDomain
.
setAmountRmb
(
wageCostDto
.
getAmount
());
}
else
{
}
else
{
toRmbRate
=
CurUtils
.
getCur
(
wageCostDto
.
getCurrency
(),
"CNY"
);
toRmbRate
=
CurUtils
.
getCur
(
wageCostDto
.
getCurrency
(),
ProjectConstant
.
CNY
);
costDomain
.
setAmountRmb
(
wageCostDto
.
getAmount
().
multiply
(
toRmbRate
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
));
costDomain
.
setAmountRmb
(
wageCostDto
.
getAmount
().
multiply
(
toRmbRate
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
));
}
}
costDomain
.
setToRmbRate
(
toRmbRate
);
costDomain
.
setToRmbRate
(
toRmbRate
);
UserDomain
user
=
userDao
.
selectByuserid
(
wageCostDto
.
getUserId
());
UserDomain
user
=
userDao
.
selectByuserid
(
wageCostDto
.
getUserId
());
if
(
user
==
null
)
{
if
(
user
==
null
)
{
throw
new
RuntimeException
(
"费用系统中没有该用户信息,请先登录一次费用系统再进行推送!"
);
throw
new
Biz
RuntimeException
(
"费用系统中没有该用户信息,请先登录一次费用系统再进行推送!"
);
}
else
{
}
else
{
costDomain
.
setCreateUserid
(
user
.
getUserid
());
costDomain
.
setCreateUserid
(
user
.
getUserid
());
costDomain
.
setCreateUsername
(
user
.
getUsername
());
costDomain
.
setCreateUsername
(
user
.
getUsername
());
...
...
bailuntec-cost-core/src/main/resources/application-prod.yml
View file @
c4742a0f
...
@@ -2,8 +2,8 @@ spring:
...
@@ -2,8 +2,8 @@ spring:
# 数据源配置
# 数据源配置
datasource
:
datasource
:
driver-class-name
:
com.mysql.jdbc.Driver
driver-class-name
:
com.mysql.jdbc.Driver
url
:
jdbc:mysql://gz-cdb-lnrmt5zh.sql.tencentcdb.com:61369/bailun_other?useUnicode=true&characterEncoding=UTF-8&useSSL=false&rewriteBatchedStatements=true
#
url
:
jdbc:mysql://gz-cdb-lnrmt5zh.sql.tencentcdb.com:61369/bailun_other?useUnicode=true&characterEncoding=UTF-8&useSSL=false&rewriteBatchedStatements=true
#
url: jdbc:mysql://10.0.8.2:3306/bailun_other?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true
url
:
jdbc:mysql://10.0.8.2:3306/bailun_other?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true
username
:
root
username
:
root
password
:
"
#7kfnymAM$Y9-Ntf"
password
:
"
#7kfnymAM$Y9-Ntf"
hikari
:
hikari
:
...
...
bailuntec-cost-core/src/main/resources/mapper/CostTypeMapper.xml
View file @
c4742a0f
...
@@ -65,4 +65,11 @@
...
@@ -65,4 +65,11 @@
where t1.type_no = #{typeNo}
where t1.type_no = #{typeNo}
</select>
</select>
<select
id=
"selectByNameAndType"
resultType=
"com.blt.other.database.model.CostTypeDomain"
>
select *
from cost_type
where cost_template_type = #{type}
and type_name = #{name}
</select>
</mapper>
</mapper>
bailuntec-cost-core/src/test/java/com/blt/other/OtherApplicationTests.java
View file @
c4742a0f
...
@@ -42,6 +42,7 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -42,6 +42,7 @@ import org.springframework.transaction.annotation.Transactional;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -227,6 +228,12 @@ public class OtherApplicationTests {
...
@@ -227,6 +228,12 @@ public class OtherApplicationTests {
}
}
private
void
syncData
()
{
private
void
syncData
()
{
Map
<
Integer
,
Integer
>
map
=
new
HashMap
<>();
map
.
put
(
1
,
CostTypeDomain
.
feeType
);
map
.
put
(
2
,
CostTypeDomain
.
incomeType
);
map
.
put
(
3
,
CostTypeDomain
.
borrow
);
list
.
forEach
(
item
->
{
list
.
forEach
(
item
->
{
AccountingSubjectMapper
accountingSubjectMapper
=
SpringContextUtil
.
getBean
(
AccountingSubjectMapper
.
class
);
AccountingSubjectMapper
accountingSubjectMapper
=
SpringContextUtil
.
getBean
(
AccountingSubjectMapper
.
class
);
AccountingSubject
accountingSubject
=
accountingSubjectMapper
.
selectByName
(
item
.
getAccountType
());
AccountingSubject
accountingSubject
=
accountingSubjectMapper
.
selectByName
(
item
.
getAccountType
());
...
@@ -237,21 +244,24 @@ public class OtherApplicationTests {
...
@@ -237,21 +244,24 @@ public class OtherApplicationTests {
accountingSubjectMapper
.
insert
(
accountingSubject
);
accountingSubjectMapper
.
insert
(
accountingSubject
);
}
}
CostTypeDao
costTypeDao
=
SpringContextUtil
.
getBean
(
CostTypeDao
.
class
);
CostTypeDao
costTypeDao
=
SpringContextUtil
.
getBean
(
CostTypeDao
.
class
);
CostTypeDomain
costTypeDomain
=
new
CostTypeDomain
();
if
(
item
.
getCostType
()
==
1
)
{
CostTypeDomain
costTypeDomain
=
costTypeDao
.
selectOne
(
new
LambdaQueryWrapper
<
CostTypeDomain
>()
costTypeDomain
.
setCostTemplateType
(
CostTypeDomain
.
feeType
);
.
eq
(
CostTypeDomain:
:
getTypeName
,
item
.
getType
())
}
.
eq
(
CostTypeDomain:
:
getCostTemplateType
,
map
.
get
(
item
.
getCostType
()))
if
(
item
.
getCostType
()
==
2
)
{
.
eq
(
CostTypeDomain:
:
getAccountingSubjectNo
,
accountingSubject
.
getSubjectNo
()));
costTypeDomain
.
setCostTemplateType
(
CostTypeDomain
.
incomeType
);
}
if
(
costTypeDomain
==
null
)
{
if
(
item
.
getCostType
()
==
3
)
{
costTypeDomain
=
new
CostTypeDomain
();
costTypeDomain
.
setCostTemplateType
(
CostTypeDomain
.
borrow
);
}
}
costTypeDomain
.
setCostTemplateType
(
map
.
get
(
item
.
getCostType
()));
costTypeDomain
.
setTypeName
(
item
.
getType
());
costTypeDomain
.
setTypeName
(
item
.
getType
());
costTypeDomain
.
setTypeNo
(
IdWorker
.
getIdStr
());
costTypeDomain
.
setTypeNo
(
IdWorker
.
getIdStr
());
costTypeDomain
.
setDescription
(
item
.
getDesc
());
costTypeDomain
.
setDescription
(
item
.
getDesc
());
costTypeDomain
.
setAccountingSubjectNo
(
accountingSubject
.
getSubjectNo
());
costTypeDomain
.
setAccountingSubjectNo
(
accountingSubject
.
getSubjectNo
());
costTypeDao
.
insert
(
costTypeDomain
);
boolean
b
=
costTypeDao
.
updateById
(
costTypeDomain
)
>
0
||
costTypeDao
.
insert
(
costTypeDomain
)
>
0
;
});
});
}
}
}
}
...
...
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