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 a6cfb4b8
authored
Jul 12, 2024
by
HlQ
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[add]
1.项目资料文件导出 2.新增合同列表接口 [fix] 合同更新bug修改
1 parent
8112bb65
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
103 additions
and
2 deletions
src/main/java/vion/controller/ContractController.java
src/main/java/vion/controller/StoreController.java
src/main/java/vion/cron/ContractRunner.java
src/main/java/vion/service/IContractService.java
src/main/java/vion/service/IStoreService.java
src/main/java/vion/service/impl/ContractServiceImpl.java
src/main/java/vion/service/impl/StoreServiceImpl.java
src/main/java/vion/controller/ContractController.java
View file @
a6cfb4b
...
@@ -59,6 +59,12 @@ public class ContractController {
...
@@ -59,6 +59,12 @@ public class ContractController {
return
contractService
.
listPart
(
dto
);
return
contractService
.
listPart
(
dto
);
}
}
@GetMapping
(
"/contractMain"
)
@SaCheckPermission
(
value
=
"contract:listMain"
,
orRole
=
"admin"
)
public
Page
<
ContractVO
>
listMain
(
ContractDTO
dto
)
{
return
contractService
.
listByMain
(
dto
);
}
@GetMapping
(
"/contract/{id}"
)
@GetMapping
(
"/contract/{id}"
)
@SaCheckPermission
(
value
=
"contract:query"
,
orRole
=
"admin"
)
@SaCheckPermission
(
value
=
"contract:query"
,
orRole
=
"admin"
)
public
ContractVO
getById
(
@PathVariable
Long
id
)
{
public
ContractVO
getById
(
@PathVariable
Long
id
)
{
...
@@ -73,7 +79,7 @@ public class ContractController {
...
@@ -73,7 +79,7 @@ public class ContractController {
@PostMapping
(
"/contract/{id}"
)
@PostMapping
(
"/contract/{id}"
)
@SaCheckPermission
(
value
=
"contract:edit"
,
orRole
=
"admin"
)
@SaCheckPermission
(
value
=
"contract:edit"
,
orRole
=
"admin"
)
public
String
updateById
(
@PathVariable
Long
id
,
@RequestBody
ContractDTO
dto
)
{
public
String
updateById
(
@PathVariable
Long
id
,
ContractDTO
dto
)
{
return
contractService
.
updateById
(
id
,
null
,
dto
);
return
contractService
.
updateById
(
id
,
null
,
dto
);
}
}
...
...
src/main/java/vion/controller/StoreController.java
View file @
a6cfb4b
...
@@ -5,6 +5,7 @@ import cn.dev33.satoken.stp.StpUtil;
...
@@ -5,6 +5,7 @@ import cn.dev33.satoken.stp.StpUtil;
import
com.baomidou.mybatisplus.core.metadata.OrderItem
;
import
com.baomidou.mybatisplus.core.metadata.OrderItem
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
io.github.linpeilie.Converter
;
import
io.github.linpeilie.Converter
;
import
jakarta.servlet.http.HttpServletResponse
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.dromara.hutool.core.array.ArrayUtil
;
import
org.dromara.hutool.core.array.ArrayUtil
;
...
@@ -239,4 +240,11 @@ public class StoreController {
...
@@ -239,4 +240,11 @@ public class StoreController {
Assert
.
notEmpty
(
userIdStr
,
"未选择提醒人"
);
Assert
.
notEmpty
(
userIdStr
,
"未选择提醒人"
);
return
storeService
.
fileNotify
(
storeName
,
contractNo
,
sourceName
,
fileNameArr
,
userIdStr
)
?
"钉钉提醒成功"
:
"钉钉提醒失败"
;
return
storeService
.
fileNotify
(
storeName
,
contractNo
,
sourceName
,
fileNameArr
,
userIdStr
)
?
"钉钉提醒成功"
:
"钉钉提醒失败"
;
}
}
@PostMapping
(
"/store/file/export"
)
@SaCheckPermission
(
value
=
"store:file:export"
,
orRole
=
"admin"
)
public
void
storeFileExport
(
StoreDTO
data
,
@RequestBody
(
required
=
false
)
List
<
OrderItem
>
orderItemList
,
HttpServletResponse
response
)
{
storeService
.
storeFileExport
(
data
,
orderItemList
,
response
);
}
}
}
src/main/java/vion/cron/ContractRunner.java
View file @
a6cfb4b
...
@@ -340,7 +340,7 @@ public class ContractRunner {
...
@@ -340,7 +340,7 @@ public class ContractRunner {
var
jsonR
=
JSONUtil
.
ofObj
()
var
jsonR
=
JSONUtil
.
ofObj
()
.
set
(
"sortMap"
,
JSONUtil
.
ofObj
()
.
set
(
"sortMap"
,
JSONUtil
.
ofObj
()
.
set
(
"field"
,
"updateTime"
)
.
set
(
"field"
,
"updateTime"
)
.
set
(
"
order
"
,
"desc"
))
.
set
(
"
sort
"
,
"desc"
))
.
set
(
"conditions"
,
JSONUtil
.
ofArray
()
.
set
(
"conditions"
,
JSONUtil
.
ofArray
()
.
put
(
JSONUtil
.
ofObj
()
.
put
(
JSONUtil
.
ofObj
()
.
set
(
"attr"
,
"date_3"
)
.
set
(
"attr"
,
"date_3"
)
...
...
src/main/java/vion/service/IContractService.java
View file @
a6cfb4b
...
@@ -25,6 +25,8 @@ public interface IContractService extends MPJBaseService<Contract> {
...
@@ -25,6 +25,8 @@ public interface IContractService extends MPJBaseService<Contract> {
Page
<
ContractVO
>
listPart
(
ContractDTO
dto
);
Page
<
ContractVO
>
listPart
(
ContractDTO
dto
);
Page
<
ContractVO
>
listByMain
(
ContractDTO
dto
);
ContractVO
getVOById
(
Long
id
);
ContractVO
getVOById
(
Long
id
);
ContractVO
getByNo
(
@PathVariable
String
no
);
ContractVO
getByNo
(
@PathVariable
String
no
);
...
...
src/main/java/vion/service/IStoreService.java
View file @
a6cfb4b
...
@@ -3,6 +3,7 @@ package vion.service;
...
@@ -3,6 +3,7 @@ package vion.service;
import
com.baomidou.mybatisplus.core.metadata.OrderItem
;
import
com.baomidou.mybatisplus.core.metadata.OrderItem
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.github.yulichang.base.MPJBaseService
;
import
com.github.yulichang.base.MPJBaseService
;
import
jakarta.servlet.http.HttpServletResponse
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
vion.dto.StatusDTO
;
import
vion.dto.StatusDTO
;
import
vion.dto.StoreDTO
;
import
vion.dto.StoreDTO
;
...
@@ -38,4 +39,8 @@ public interface IStoreService extends MPJBaseService<Store> {
...
@@ -38,4 +39,8 @@ public interface IStoreService extends MPJBaseService<Store> {
Boolean
fileNotify
(
String
storeName
,
String
contractNo
,
String
sourceName
,
String
[]
fileNameArr
,
String
[]
userIdStr
);
Boolean
fileNotify
(
String
storeName
,
String
contractNo
,
String
sourceName
,
String
[]
fileNameArr
,
String
[]
userIdStr
);
void
storeFileExport
(
StoreDTO
data
,
List
<
OrderItem
>
orderItemList
,
HttpServletResponse
response
);
}
}
src/main/java/vion/service/impl/ContractServiceImpl.java
View file @
a6cfb4b
This diff is collapsed.
Click to expand it.
src/main/java/vion/service/impl/StoreServiceImpl.java
View file @
a6cfb4b
...
@@ -5,9 +5,13 @@ import com.baomidou.mybatisplus.core.metadata.OrderItem;
...
@@ -5,9 +5,13 @@ import com.baomidou.mybatisplus.core.metadata.OrderItem;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.toolkit.Db
;
import
com.baomidou.mybatisplus.extension.toolkit.Db
;
import
com.github.liaochong.myexcel.core.DefaultExcelBuilder
;
import
com.github.liaochong.myexcel.core.watermark.Watermark
;
import
com.github.liaochong.myexcel.utils.WatermarkUtil
;
import
com.github.yulichang.base.MPJBaseServiceImpl
;
import
com.github.yulichang.base.MPJBaseServiceImpl
;
import
com.github.yulichang.wrapper.MPJLambdaWrapper
;
import
com.github.yulichang.wrapper.MPJLambdaWrapper
;
import
io.github.linpeilie.Converter
;
import
io.github.linpeilie.Converter
;
import
jakarta.servlet.http.HttpServletResponse
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.dromara.hutool.core.array.ArrayUtil
;
import
org.dromara.hutool.core.array.ArrayUtil
;
...
@@ -39,13 +43,16 @@ import vion.mapper.TaskMapper;
...
@@ -39,13 +43,16 @@ import vion.mapper.TaskMapper;
import
vion.model.*
;
import
vion.model.*
;
import
vion.service.*
;
import
vion.service.*
;
import
vion.third.DingMod
;
import
vion.third.DingMod
;
import
vion.utils.excel.AttachmentExportUtil
;
import
vion.vo.ContractVO
;
import
vion.vo.ContractVO
;
import
vion.vo.StoreVO
;
import
vion.vo.StoreVO
;
import
vion.vo.TagVO
;
import
vion.vo.TagVO
;
import
vion.vo.UserVO
;
import
vion.vo.UserVO
;
import
java.awt.*
;
import
java.io.File
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.*
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -541,6 +548,79 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
...
@@ -541,6 +548,79 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
return
StrUtil
.
containsIgnoreCase
(
pushRes
,
"ok"
);
return
StrUtil
.
containsIgnoreCase
(
pushRes
,
"ok"
);
}
}
@Override
public
void
storeFileExport
(
StoreDTO
data
,
List
<
OrderItem
>
orderItemList
,
HttpServletResponse
response
)
{
UserVO
user
=
(
UserVO
)
StpUtil
.
getTokenSession
().
get
(
"curLoginUser"
);
Page
<
StoreVO
>
voPage
=
this
.
getStoreList
(
data
,
orderItemList
);
try
(
DefaultExcelBuilder
<
Map
>
defaultExcelBuilder
=
DefaultExcelBuilder
.
of
(
Map
.
class
))
{
var
records
=
voPage
.
getRecords
();
var
storeIds
=
records
.
stream
().
map
(
StoreVO:
:
getId
).
toList
();
var
titles
=
List
.
of
(
"项目"
,
"合同编号"
,
"前期勘察"
,
"点位表"
,
"竣工图纸"
,
"验收报告"
,
"项目总结"
,
"巡检报告"
,
"结算资料"
,
"其它"
);
var
files
=
fileService
.
lambdaQuery
()
.
in
(
FileInfo:
:
getSourceId
,
storeIds
)
.
in
(
FileInfo:
:
getStoreId
,
storeIds
)
.
in
(
FileInfo:
:
getSourceType
,
1
,
24
,
25
,
26
,
27
,
28
,
29
,
30
)
.
list
();
var
contractId2NoMap
=
Opt
.
ofEmptyAble
(
files
)
.
map
(
f
->
f
.
stream
().
map
(
FileInfo:
:
getContractId
).
toList
())
.
map
(
contractService:
:
listByIds
)
.
filter
(
CollUtil:
:
isNotEmpty
)
.
map
(
contractList
->
contractList
.
stream
().
collect
(
Collectors
.
toMap
(
Contract:
:
getId
,
Contract:
:
getContractNo
)))
.
orElse
(
Map
.
of
());
// storeId -> <contractId -> <sourceType -> cnt>>
var
storeId2CntMap
=
Opt
.
ofEmptyAble
(
files
)
.
map
(
fs
->
fs
.
stream
().
collect
(
Collectors
.
groupingBy
(
FileInfo:
:
getStoreId
,
Collectors
.
groupingBy
(
f
->
Opt
.
ofNullable
(
f
.
getContractId
()).
orElse
(-
1L
),
Collectors
.
groupingBy
(
FileInfo:
:
getSourceType
,
Collectors
.
counting
())))))
.
orElse
(
Map
.
of
());
List
<
Map
>
dataList
=
new
ArrayList
<>();
storeId2CntMap
.
forEach
((
storeId
,
contractMap
)
->
{
var
store
=
records
.
stream
().
filter
(
v
->
v
.
getId
().
equals
(
storeId
)).
findFirst
().
orElse
(
null
);
if
(
ObjUtil
.
isNull
(
store
))
{
return
;
}
contractMap
.
forEach
((
contractId
,
typeCntMap
)
->
{
var
map
=
MapUtil
.<
String
,
Object
>
builder
(
"a"
,
store
.
getName
())
.
put
(
"b"
,
contractId2NoMap
.
getOrDefault
(
contractId
,
"暂无"
))
.
put
(
"c"
,
typeCntMap
.
getOrDefault
(
28
,
0L
))
.
put
(
"d"
,
typeCntMap
.
getOrDefault
(
26
,
0L
))
.
put
(
"e"
,
typeCntMap
.
getOrDefault
(
25
,
0L
))
.
put
(
"f"
,
typeCntMap
.
getOrDefault
(
24
,
0L
))
.
put
(
"g"
,
typeCntMap
.
getOrDefault
(
27
,
0L
))
.
put
(
"h"
,
typeCntMap
.
getOrDefault
(
29
,
0L
))
.
put
(
"i"
,
typeCntMap
.
getOrDefault
(
30
,
0L
))
.
put
(
"j"
,
typeCntMap
.
getOrDefault
(
1
,
0L
))
.
build
();
dataList
.
add
(
map
);
});
});
var
workbook
=
defaultExcelBuilder
.
sheetName
(
"项目资料"
)
.
titles
(
titles
)
.
widths
(
10
,
20
)
.
fieldDisplayOrder
(
List
.
of
(
"a"
,
"b"
,
"c"
,
"d"
,
"e"
,
"f"
,
"g"
,
"h"
,
"i"
,
"j"
))
.
build
(
dataList
);
// 水印添加指定字体,并在服务器上安装 SimSun 字体,解决中文字体变成方块的问题
Watermark
watermark
=
new
Watermark
();
watermark
.
setText
(
user
.
getUsername
()
+
"-"
+
user
.
getPhone
());
watermark
.
setFont
(
new
Font
(
"SimSun"
,
Font
.
PLAIN
,
16
));
WatermarkUtil
.
addWatermark
(
workbook
,
watermark
);
AttachmentExportUtil
.
export
(
workbook
,
StrUtil
.
format
(
"项目资料_{}"
,
DateUtil
.
formatDateTime
(
new
Date
())),
response
);
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
JSONObject
buildMsg
(
String
storeName
,
String
userid
)
{
JSONObject
buildMsg
(
String
storeName
,
String
userid
)
{
var
jsonObj
=
JSONUtil
.
ofObj
()
var
jsonObj
=
JSONUtil
.
ofObj
()
.
set
(
"agent_id"
,
2358374016L
)
.
set
(
"agent_id"
,
2358374016L
)
...
...
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