Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
李苗
/
Vion-DevOps
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 954001d7
authored
Dec 14, 2023
by
HlQ
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[add] 发票管理添加流水号字段
[chg] 1.用户列表按照状态排序 2.发货记录列表添加合同相关字段,原项目字段废弃
1 parent
b1e4ef50
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
87 additions
and
44 deletions
src/main/java/vion/dto/ContractDTO.java
src/main/java/vion/dto/DeliveryRecordDTO.java
src/main/java/vion/dto/FileInfoDTO.java
src/main/java/vion/dto/InvoiceDTO.java
src/main/java/vion/model/Contract.java
src/main/java/vion/model/ContractLog.java
src/main/java/vion/model/DeliveryRecord.java
src/main/java/vion/model/FileInfo.java
src/main/java/vion/model/Invoice.java
src/main/java/vion/service/IContractPaymentService.java
src/main/java/vion/service/impl/ContractPaymentServiceImpl.java
src/main/java/vion/service/impl/ContractServiceImpl.java
src/main/java/vion/service/impl/DeliveryRecordServiceImpl.java
src/main/java/vion/service/impl/PaymentServiceImpl.java
src/main/java/vion/service/impl/UserServiceImpl.java
src/main/java/vion/vo/DeliveryRecordVO.java
src/main/java/vion/vo/InvoiceVO.java
src/main/java/vion/dto/ContractDTO.java
View file @
954001d
...
...
@@ -28,7 +28,7 @@ public class ContractDTO extends BaseDTO {
private
Integer
type
;
/**
* 合同进度:1-签订 2-
发货 3-货到 4-安装 5-验收 6-质保
* 合同进度:1-签订 2-
到货 3-系统验收(初验) 4-项目验收(终验) 5-质保 6-第一笔维保款 7-第二笔维保款 8-第三笔维保款
*/
private
Integer
status
;
...
...
src/main/java/vion/dto/DeliveryRecordDTO.java
View file @
954001d
...
...
@@ -18,10 +18,16 @@ public class DeliveryRecordDTO extends BaseDTO {
*/
private
String
contractNo
;
/**
* 合同id
*/
private
Long
contractId
;
/**
*
项目id
*
合同名称
*/
private
Long
storeId
;
private
String
contractName
;
/**
* 客户名称
...
...
src/main/java/vion/dto/FileInfoDTO.java
View file @
954001d
...
...
@@ -15,6 +15,8 @@ public class FileInfoDTO extends BaseDTO {
private
Integer
sourceType
;
/** 文件来源id */
private
Long
sourceId
;
/** 合同id */
private
Long
contractId
;
/** 文件名称 */
private
String
name
;
/** 文件地址 */
...
...
src/main/java/vion/dto/InvoiceDTO.java
View file @
954001d
...
...
@@ -39,4 +39,9 @@ public class InvoiceDTO extends BaseDTO {
*/
private
String
remark
;
/**
* 流水号
*/
private
String
serialNo
;
}
\ No newline at end of file
src/main/java/vion/model/Contract.java
View file @
954001d
...
...
@@ -61,7 +61,7 @@ public class Contract {
private
Date
maintainEdate
;
/**
* 合同进度:1-签订 2-
发货 3-货到 4-安装 5-验收 6-质保
* 合同进度:1-签订 2-
到货 3-系统验收(初验) 4-项目验收(终验) 5-质保 6-第一笔维保款 7-第二笔维保款 8-第三笔维保款
*/
@TableField
(
value
=
"\"status\""
)
private
Integer
status
;
...
...
src/main/java/vion/model/ContractLog.java
View file @
954001d
...
...
@@ -17,10 +17,10 @@ public class ContractLog {
private
Long
id
;
/**
* 合同
id
* 合同
编号
*/
@TableField
(
value
=
"contract_
id
"
)
private
Long
contractId
;
@TableField
(
value
=
"contract_
no
"
)
private
String
contractNo
;
/**
* 操作人
...
...
@@ -40,6 +40,13 @@ public class ContractLog {
@TableField
(
value
=
"remark"
)
private
String
remark
;
/**
* 确认日期
*/
@TableField
(
value
=
"rec_time"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
recTime
;
@TableField
(
value
=
"create_time"
,
fill
=
FieldFill
.
INSERT
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createTime
;
...
...
src/main/java/vion/model/DeliveryRecord.java
View file @
954001d
...
...
@@ -29,10 +29,10 @@ public class DeliveryRecord {
private
String
contractNo
;
/**
*
项目
id
*
合同
id
*/
@TableField
(
value
=
"
store
_id"
)
private
Long
store
Id
;
@TableField
(
value
=
"
contract
_id"
)
private
Long
contract
Id
;
/**
* 客户名称
...
...
src/main/java/vion/model/FileInfo.java
View file @
954001d
...
...
@@ -20,7 +20,7 @@ import java.util.Date;
public
class
FileInfo
{
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Long
id
;
/**
门店
id */
/**
项目
id */
private
Long
storeId
;
/** 文件扩展名 */
private
String
type
;
...
...
@@ -28,6 +28,8 @@ public class FileInfo {
private
Integer
sourceType
;
/** 文件来源id */
private
Long
sourceId
;
/** 合同id */
private
Long
contractId
;
/** 文件名称 */
private
String
name
;
/** 文件地址 */
...
...
src/main/java/vion/model/Invoice.java
View file @
954001d
...
...
@@ -54,6 +54,12 @@ public class Invoice {
@TableField
(
value
=
"remark"
)
private
String
remark
;
/**
* 流水号
*/
@TableField
(
value
=
"serial_no"
)
private
String
serialNo
;
@TableField
(
value
=
"create_time"
,
fill
=
FieldFill
.
INSERT
)
private
Date
createTime
;
...
...
src/main/java/vion/service/IContractPaymentService.java
View file @
954001d
...
...
@@ -10,5 +10,5 @@ import vion.model.ContractPayment;
*/
public
interface
IContractPaymentService
extends
MPJBaseService
<
ContractPayment
>
{
void
calMoney
(
Contract
exitContract
,
Contract
dto
);
void
calMoney
(
Contract
exi
s
tContract
,
Contract
dto
);
}
src/main/java/vion/service/impl/ContractPaymentServiceImpl.java
View file @
954001d
...
...
@@ -25,24 +25,24 @@ public class ContractPaymentServiceImpl extends MPJBaseServiceImpl<ContractPayme
/**
* 当合同状态变化或者应收款变化时,重新计算款项
*
* @param exitContract
* @param exi
s
tContract
* @param dto
*/
@Override
public
void
calMoney
(
Contract
exitContract
,
Contract
dto
)
{
List
<
ContractPayment
>
contractPaymentList
=
this
.
lambdaQuery
().
eq
(
ContractPayment:
:
getContractId
,
exitContract
.
getId
()).
list
();
public
void
calMoney
(
Contract
exi
s
tContract
,
Contract
dto
)
{
List
<
ContractPayment
>
contractPaymentList
=
this
.
lambdaQuery
().
eq
(
ContractPayment:
:
getContractId
,
exi
s
tContract
.
getId
()).
list
();
Map
<
Integer
,
BigDecimal
>
type2RatioMap
=
contractPaymentList
.
stream
().
collect
(
Collectors
.
toMap
(
ContractPayment:
:
getPaymentType
,
ContractPayment:
:
getPaymentRatio
));
Integer
status
=
dto
.
getStatus
()
==
null
?
exitContract
.
getStatus
()
:
dto
.
getStatus
();
Integer
status
=
dto
.
getStatus
()
==
null
?
exi
s
tContract
.
getStatus
()
:
dto
.
getStatus
();
BigDecimal
sumRatio
=
new
BigDecimal
(
0
);
for
(
int
i
=
1
;
i
<=
status
;
i
++)
{
BigDecimal
ratio
=
type2RatioMap
.
get
(
i
);
sumRatio
=
NumberUtil
.
add
(
ratio
,
sumRatio
);
}
BigDecimal
totalAmount
=
exitContract
.
getTotalAmount
();
BigDecimal
totalAmount
=
exi
s
tContract
.
getTotalAmount
();
BigDecimal
curAmount
=
NumberUtil
.
mul
(
totalAmount
,
sumRatio
);
BigDecimal
paidAmount
=
dto
.
getPaidAmount
()
==
null
?
exitContract
.
getPaidAmount
()
:
dto
.
getPaidAmount
();
BigDecimal
paidAmount
=
dto
.
getPaidAmount
()
==
null
?
exi
s
tContract
.
getPaidAmount
()
:
dto
.
getPaidAmount
();
BigDecimal
recAmount
=
NumberUtil
.
sub
(
curAmount
,
paidAmount
);
BigDecimal
outsideAmount
=
NumberUtil
.
sub
(
totalAmount
,
NumberUtil
.
add
(
paidAmount
,
recAmount
)
);
BigDecimal
outsideAmount
=
NumberUtil
.
sub
(
totalAmount
,
paidAmount
);
dto
.
setReceivableAmount
(
recAmount
);
dto
.
setOutstandingAmount
(
outsideAmount
);
}
...
...
src/main/java/vion/service/impl/ContractServiceImpl.java
View file @
954001d
...
...
@@ -115,7 +115,7 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
MPJLambdaWrapper
<
Contract
>
wrapper
=
new
MPJLambdaWrapper
<
Contract
>()
.
selectAll
(
Contract
.
class
)
.
selectCollection
(
ContractLog
.
class
,
ContractVO:
:
getContractLogs
)
.
leftJoin
(
ContractLog
.
class
,
ContractLog:
:
getContract
Id
,
Contract:
:
getId
)
.
leftJoin
(
ContractLog
.
class
,
ContractLog:
:
getContract
No
,
Contract:
:
getContractNo
)
.
eq
(
Contract:
:
getId
,
id
);
return
this
.
selectJoinOne
(
ContractVO
.
class
,
wrapper
);
}
...
...
@@ -140,22 +140,22 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
String
updateById
(
Long
id
,
String
contractNo
,
ContractDTO
dto
)
{
Contract
exitContract
=
null
;
Contract
exi
s
tContract
=
null
;
if
(
ObjUtil
.
isNotNull
(
id
))
{
exitContract
=
this
.
getById
(
id
);
exi
s
tContract
=
this
.
getById
(
id
);
}
else
if
(
StrUtil
.
isNotBlank
(
contractNo
))
{
exitContract
=
this
.
lambdaQuery
().
eq
(
Contract:
:
getContractNo
,
contractNo
).
one
();
exi
s
tContract
=
this
.
lambdaQuery
().
eq
(
Contract:
:
getContractNo
,
contractNo
).
one
();
}
Assert
.
notNull
(
exitContract
,
"合同不存在"
);
Assert
.
notNull
(
exi
s
tContract
,
"合同不存在"
);
Contract
contract
=
converter
.
convert
(
dto
,
new
Contract
());
contract
.
setId
(
exitContract
.
getId
());
contractPaymentService
.
calMoney
(
exitContract
,
contract
);
contract
.
setId
(
exi
s
tContract
.
getId
());
contractPaymentService
.
calMoney
(
exi
s
tContract
,
contract
);
if
(
this
.
updateById
(
contract
))
{
UserVO
userVO
=
(
UserVO
)
StpUtil
.
getTokenSession
().
get
(
"curLoginUser"
);
ContractLog
contractLog
=
new
ContractLog
();
contractLog
.
setContract
Id
(
contract
.
getId
());
contractLog
.
setContract
No
(
existContract
.
getContractNo
());
if
(
dto
.
getStatus
()
==
1
)
{
contractLog
.
setContent
(
"合同:已签订"
);
}
else
if
(
dto
.
getStatus
()
==
2
)
{
...
...
@@ -167,7 +167,11 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
}
else
if
(
dto
.
getStatus
()
==
5
)
{
contractLog
.
setContent
(
"合同:质保"
);
}
else
if
(
dto
.
getStatus
()
==
6
)
{
contractLog
.
setContent
(
"合同:维保"
);
contractLog
.
setContent
(
"合同:第一笔维保款"
);
}
else
if
(
dto
.
getStatus
()
==
7
)
{
contractLog
.
setContent
(
"合同:第二笔维保款"
);
}
else
if
(
dto
.
getStatus
()
==
8
)
{
contractLog
.
setContent
(
"合同:第三笔维保款"
);
}
contractLog
.
setOperator
(
userVO
.
getId
());
contractLogService
.
save
(
contractLog
);
...
...
src/main/java/vion/service/impl/DeliveryRecordServiceImpl.java
View file @
954001d
...
...
@@ -4,7 +4,7 @@ import cn.dev33.satoken.stp.StpUtil;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.lang.Opt
;
import
cn.hutool.core.util.
Obj
Util
;
import
cn.hutool.core.util.
Str
Util
;
import
cn.hutool.crypto.SecureUtil
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.github.yulichang.base.MPJBaseServiceImpl
;
...
...
@@ -16,9 +16,9 @@ import org.springframework.stereotype.Service;
import
vion.dto.ContractDTO
;
import
vion.dto.DeliveryRecordDTO
;
import
vion.mapper.DeliveryRecordMapper
;
import
vion.model.Contract
;
import
vion.model.DeliveryRecord
;
import
vion.model.FileInfo
;
import
vion.model.Store
;
import
vion.service.IContractService
;
import
vion.service.IDeliveryRecordService
;
import
vion.service.IFileService
;
...
...
@@ -49,8 +49,10 @@ public class DeliveryRecordServiceImpl extends MPJBaseServiceImpl<DeliveryRecord
public
Page
<
DeliveryRecordVO
>
list
(
DeliveryRecordDTO
dto
)
{
MPJLambdaWrapper
<
DeliveryRecord
>
wrapper
=
new
MPJLambdaWrapper
<>(
converter
.
convert
(
dto
,
new
DeliveryRecord
()))
.
selectAll
(
DeliveryRecord
.
class
)
.
selectAs
(
Store:
:
getName
,
DeliveryRecordVO:
:
getStoreName
)
.
leftJoin
(
Store
.
class
,
Store:
:
getId
,
DeliveryRecord:
:
getStoreId
);
.
selectAs
(
Contract:
:
getName
,
DeliveryRecordVO:
:
getContractName
)
.
leftJoin
(
Contract
.
class
,
Contract:
:
getContractNo
,
DeliveryRecord:
:
getContractNo
)
.
like
(
StrUtil
.
isNotBlank
(
dto
.
getContractName
()),
Contract:
:
getName
,
dto
.
getContractName
())
.
orderByDesc
(
DeliveryRecord:
:
getShipDate
);
return
this
.
selectJoinListPage
(
Page
.
of
(
dto
.
getPageNum
(),
dto
.
getPageSize
()),
DeliveryRecordVO
.
class
,
wrapper
);
}
...
...
@@ -71,8 +73,7 @@ public class DeliveryRecordServiceImpl extends MPJBaseServiceImpl<DeliveryRecord
String
fileName
=
orgName
.
substring
(
0
,
orgName
.
lastIndexOf
(
"."
));
String
fileExt
=
orgName
.
substring
(
orgName
.
lastIndexOf
(
"."
));
String
filename
=
fileName
+
"_"
+
DateUtil
.
format
(
new
Date
(),
"yyyyMMdd_HHmmss"
)
+
fileExt
;
Long
storeId
=
ObjUtil
.
isNull
(
dto
.
getStoreId
())
?
0L
:
dto
.
getStoreId
();
String
path
=
fileUrl
+
FileUtil
.
FILE_SEPARATOR
+
"/delivery"
+
FileUtil
.
FILE_SEPARATOR
+
storeId
+
FileUtil
.
FILE_SEPARATOR
+
record
.
getId
()
+
FileUtil
.
FILE_SEPARATOR
+
filename
;
String
path
=
fileUrl
+
FileUtil
.
FILE_SEPARATOR
+
"/delivery"
+
FileUtil
.
FILE_SEPARATOR
+
dto
.
getContractId
()
+
FileUtil
.
FILE_SEPARATOR
+
record
.
getId
()
+
FileUtil
.
FILE_SEPARATOR
+
filename
;
File
file
=
FileUtil
.
touch
(
path
);
try
{
infile
.
transferTo
(
file
);
...
...
@@ -81,8 +82,9 @@ public class DeliveryRecordServiceImpl extends MPJBaseServiceImpl<DeliveryRecord
}
FileInfo
fileInfo
=
new
FileInfo
();
fileInfo
.
setStoreId
(
storeId
);
fileInfo
.
setStoreId
(
0L
);
fileInfo
.
setSourceId
(
record
.
getId
());
fileInfo
.
setContractId
(
dto
.
getContractId
());
fileInfo
.
setSourceType
(
6
);
fileInfo
.
setName
(
filename
);
fileInfo
.
setUrl
(
path
);
...
...
@@ -102,6 +104,7 @@ public class DeliveryRecordServiceImpl extends MPJBaseServiceImpl<DeliveryRecord
public
String
updateById
(
DeliveryRecordDTO
dto
)
{
DeliveryRecord
record
=
converter
.
convert
(
dto
,
new
DeliveryRecord
());
if
(
this
.
updateById
(
record
))
{
DeliveryRecord
deliveryRecord
=
this
.
getById
(
dto
.
getId
());
Opt
.
ofNullable
(
dto
.
getFiles
())
.
ifPresent
(
fileList
->
{
UserVO
userVO
=
(
UserVO
)
StpUtil
.
getTokenSession
().
get
(
"curLoginUser"
);
...
...
@@ -111,7 +114,7 @@ public class DeliveryRecordServiceImpl extends MPJBaseServiceImpl<DeliveryRecord
String
fileName
=
orgName
.
substring
(
0
,
orgName
.
lastIndexOf
(
"."
));
String
fileExt
=
orgName
.
substring
(
orgName
.
lastIndexOf
(
"."
));
String
filename
=
fileName
+
"_"
+
DateUtil
.
format
(
new
Date
(),
"yyyyMMdd_HHmmss"
)
+
fileExt
;
String
path
=
fileUrl
+
FileUtil
.
FILE_SEPARATOR
+
"/delivery"
+
FileUtil
.
FILE_SEPARATOR
+
d
to
.
getStore
Id
()
+
FileUtil
.
FILE_SEPARATOR
+
record
.
getId
()
+
FileUtil
.
FILE_SEPARATOR
+
filename
;
String
path
=
fileUrl
+
FileUtil
.
FILE_SEPARATOR
+
"/delivery"
+
FileUtil
.
FILE_SEPARATOR
+
d
eliveryRecord
.
getContract
Id
()
+
FileUtil
.
FILE_SEPARATOR
+
record
.
getId
()
+
FileUtil
.
FILE_SEPARATOR
+
filename
;
File
file
=
FileUtil
.
touch
(
path
);
try
{
infile
.
transferTo
(
file
);
...
...
@@ -120,8 +123,9 @@ public class DeliveryRecordServiceImpl extends MPJBaseServiceImpl<DeliveryRecord
}
FileInfo
fileInfo
=
new
FileInfo
();
fileInfo
.
setStoreId
(
dto
.
getStoreId
()
);
fileInfo
.
setStoreId
(
0L
);
fileInfo
.
setSourceId
(
record
.
getId
());
fileInfo
.
setContractId
(
deliveryRecord
.
getContractId
());
fileInfo
.
setSourceType
(
6
);
fileInfo
.
setName
(
filename
);
fileInfo
.
setUrl
(
path
);
...
...
src/main/java/vion/service/impl/PaymentServiceImpl.java
View file @
954001d
...
...
@@ -56,12 +56,12 @@ public class PaymentServiceImpl extends MPJBaseServiceImpl<PaymentMapper, Paymen
no2PaymentMap
.
forEach
((
no
,
list
)
->
{
BigDecimal
sumAmount
=
list
.
stream
().
map
(
Payment:
:
getPaymentAmount
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
Contract
exitContract
=
contractService
.
lambdaQuery
().
eq
(
Contract:
:
getContractNo
,
no
).
one
();
Contract
exi
s
tContract
=
contractService
.
lambdaQuery
().
eq
(
Contract:
:
getContractNo
,
no
).
one
();
// 最新的应收款去计算
Contract
updDto
=
new
Contract
();
updDto
.
setId
(
exitContract
.
getId
());
updDto
.
setId
(
exi
s
tContract
.
getId
());
updDto
.
setPaidAmount
(
sumAmount
);
contractPaymentService
.
calMoney
(
exitContract
,
updDto
);
contractPaymentService
.
calMoney
(
exi
s
tContract
,
updDto
);
contractService
.
updateById
(
updDto
);
});
return
"成功"
;
...
...
src/main/java/vion/service/impl/UserServiceImpl.java
View file @
954001d
...
...
@@ -42,7 +42,8 @@ public class UserServiceImpl extends MPJBaseServiceImpl<UserMapper, User> implem
MPJLambdaWrapper
<
User
>
wrapper
=
new
MPJLambdaWrapper
<>(
converter
.
convert
(
dto
,
new
User
()))
.
selectAll
(
User
.
class
)
.
select
(
Dept:
:
getDeptName
)
.
leftJoin
(
Dept
.
class
,
Dept:
:
getDeptId
,
User:
:
getDeptId
);
.
leftJoin
(
Dept
.
class
,
Dept:
:
getDeptId
,
User:
:
getDeptId
)
.
orderByAsc
(
User:
:
getStatus
);
Page
<
UserVO
>
userVOS
=
this
.
selectJoinListPage
(
Page
.
of
(
dto
.
getPageNum
(),
dto
.
getPageSize
()),
UserVO
.
class
,
wrapper
);
MPJLambdaWrapper
<
Role
>
roleWrapper
=
new
MPJLambdaWrapper
<
Role
>()
.
selectAll
(
Role
.
class
)
...
...
src/main/java/vion/vo/DeliveryRecordVO.java
View file @
954001d
...
...
@@ -17,12 +17,13 @@ public class DeliveryRecordVO {
* 合同编号
*/
private
String
contractNo
;
private
String
contractName
;
/**
*
项目
id
*
合同
id
*/
private
Long
store
Id
;
private
String
storeName
;
private
Long
contract
Id
;
/**
* 客户名称
...
...
src/main/java/vion/vo/InvoiceVO.java
View file @
954001d
...
...
@@ -39,6 +39,11 @@ public class InvoiceVO {
*/
private
String
remark
;
/**
* 流水号
*/
private
String
serialNo
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createTime
;
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment