Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
baifang-java
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
单欣鑫
baifang-java
Commits
d3aa88d7
Commit
d3aa88d7
authored
Aug 25, 2025
by
lihulong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
李湖龙2025-8-25批量打印逻辑修改
parent
54fcf203
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
65 additions
and
26 deletions
+65
-26
InfoController.java
...ao/module/visit/controller/admin/info/InfoController.java
+3
-0
InfoServiceImpl.java
...oder/yudao/module/visit/service/info/InfoServiceImpl.java
+27
-15
.env.local
yudao-ui/yudao-ui-admin-vue3/.env.local
+2
-2
index.ts
yudao-ui/yudao-ui-admin-vue3/src/api/visit/info/index.ts
+1
-0
UploadImgs.vue
...i-admin-vue3/src/components/UploadFile/src/UploadImgs.vue
+11
-2
index.vue
...udao-ui-admin-vue3/src/views/visit/customerinfo/index.vue
+0
-1
PrintContent.vue
...yudao-ui-admin-vue3/src/views/visit/util/PrintContent.vue
+21
-6
No files found.
yudao-module-visit/src/main/java/cn/iocoder/yudao/module/visit/controller/admin/info/InfoController.java
View file @
d3aa88d7
...
...
@@ -153,6 +153,9 @@ public class InfoController {
@Operation
(
summary
=
"获得客户拜访打印信息根据公司名称"
)
@PreAuthorize
(
"@ss.hasPermission('visit:customer-info:print')"
)
public
CommonResult
<
List
<
InfoPrintVO
>>
getPrintListByCompanyName
(
@RequestParam
(
"companyName"
)
String
companyName
)
{
if
(
companyName
.
isEmpty
()){
throw
new
RuntimeException
(
"公司名称获取异常!"
);
}
InfoPrintVO
info
=
infoService
.
getInfoByCompanyName
(
companyName
);
List
<
InfoPrintVO
>
infoPrintVO
=
new
ArrayList
<>();
if
(
info
==
null
){
...
...
yudao-module-visit/src/main/java/cn/iocoder/yudao/module/visit/service/info/InfoServiceImpl.java
View file @
d3aa88d7
...
...
@@ -19,6 +19,8 @@ import org.apache.http.entity.ContentType;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.impl.client.HttpClients
;
import
org.apache.http.util.EntityUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.validation.annotation.Validated
;
...
...
@@ -46,6 +48,7 @@ import static java.nio.file.Files.createFile;
@Validated
public
class
InfoServiceImpl
implements
InfoService
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
InfoServiceImpl
.
class
);
@Resource
private
InfoMapper
infoMapper
;
...
...
@@ -243,11 +246,11 @@ public class InfoServiceImpl implements InfoService {
info
.
forEach
(
infoDO
->
{
InfoPrintVO
infoPrintVO
=
new
InfoPrintVO
();
infoPrintVO
.
setServiceContent
(
Collections
.
singletonList
(
infoDO
.
getServiceContent
()));
//本次服务内容
//服务图片(最多
四
张)
//服务图片(最多
10
张)
String
imagesStr
=
infoDO
.
getServiceImages
();
if
(
StringUtils
.
isNotBlank
(
imagesStr
))
{
String
limitedImagesStr
=
Arrays
.
stream
(
imagesStr
.
split
(
","
))
.
limit
(
4
)
.
limit
(
10
)
.
collect
(
Collectors
.
joining
(
","
));
infoPrintVO
.
setServiceImages
(
limitedImagesStr
);
}
else
{
...
...
@@ -271,9 +274,9 @@ public class InfoServiceImpl implements InfoService {
@Override
public
InfoPrintVO
getInfoByCompanyName
(
String
companyName
)
{
InfoPrintVO
infoPrintVO
=
new
InfoPrintVO
();
//服务内容(最近
四
次)
//服务内容(最近
五
次)
List
<
String
>
serviceContent
=
new
ArrayList
<>();
//服务图片(最多
四
张)
//服务图片(最多
十
张)
List
<
String
>
serviceImages
=
new
ArrayList
<>();
//拜访时间记录
List
<
LocalDate
>
visitDateList
=
new
ArrayList
<>();
...
...
@@ -281,26 +284,35 @@ public class InfoServiceImpl implements InfoService {
YearMonth
currentYearMonth
=
YearMonth
.
now
();
//现根据客户名称获取历史拜访记录
List
<
InfoDO
>
info
=
infoMapper
.
selectByCompanyName
(
companyName
);
System
.
out
.
println
(
"拜访信息"
+
info
);
if
(
info
!=
null
&&
!
info
.
isEmpty
()){
//取最近
四
次
//取最近
五
次
info
=
info
.
stream
()
// 筛选本月记录(基于 LocalDateTime)
.
filter
(
infoDO
->
{
LocalDateTime
visitDateTime
=
infoDO
.
getVisitDate
();
return
YearMonth
.
from
(
visitDateTime
.
toLocalDate
()).
equals
(
currentYearMonth
);
})
.
sorted
(
Comparator
.
comparing
(
InfoDO:
:
getVisitDate
).
reversed
()).
limit
(
4
).
collect
(
Collectors
.
toList
());
//取最多4张服务图片
int
maxImages
=
4
;
// .filter(infoDO -> {
// LocalDateTime visitDateTime = infoDO.getVisitDate();
// return YearMonth.from(visitDateTime.toLocalDate()).equals(currentYearMonth);
// })
.
sorted
(
Comparator
.
comparing
(
InfoDO:
:
getVisitDate
)).
limit
(
5
).
collect
(
Collectors
.
toList
());
//取最多10张服务图片
int
maxImages
=
10
;
int
maxObjects
=
5
;
// 最多处理5个对象
int
objectCount
=
0
;
// 对象计数器
for
(
InfoDO
infoDO
:
info
)
{
if
(
serviceImages
.
size
()
>=
maxImages
)
break
;
// 超过最大对象数或已收集足够图片则停止
if
(
objectCount
>=
maxObjects
||
serviceImages
.
size
()
>=
maxImages
)
break
;
String
imagesStr
=
infoDO
.
getServiceImages
();
if
(
StringUtils
.
isNotBlank
(
imagesStr
))
{
List
<
String
>
imageList
=
Arrays
.
asList
(
imagesStr
.
split
(
","
));
int
remaining
=
maxImages
-
serviceImages
.
size
();
serviceImages
.
addAll
(
imageList
.
stream
().
limit
(
remaining
).
collect
(
Collectors
.
toList
()));
// 每个对象最多取2张,同时不超过剩余需要数量
int
take
=
Math
.
min
(
2
,
remaining
);
serviceImages
.
addAll
(
imageList
.
stream
().
limit
(
take
).
collect
(
Collectors
.
toList
()));
}
objectCount
++;
}
//获取客户拜访记录成功,获取客户信息
info
.
forEach
(
infoDO
->
{
...
...
@@ -326,7 +338,7 @@ public class InfoServiceImpl implements InfoService {
//拜访次数
infoPrintVO
.
setServiceCount
(
info
.
size
());
}
else
{
return
null
;
return
infoPrintVO
;
}
return
infoPrintVO
;
}
...
...
yudao-ui/yudao-ui-admin-vue3/.env.local
View file @
d3aa88d7
...
...
@@ -4,8 +4,8 @@ NODE_ENV=development
VITE_DEV=true
# 请求路径
# VITE_BASE_URL='http://192.168.0.182
:48080'
VITE_BASE_URL='https://hntqwl.com'
VITE_BASE_URL='http://192.168.0.144
:48080'
#
VITE_BASE_URL='https://hntqwl.com'
# VITE_BASE_URL='http://localhost:48080'
# 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持 S3 服务
...
...
yudao-ui/yudao-ui-admin-vue3/src/api/visit/info/index.ts
View file @
d3aa88d7
...
...
@@ -84,6 +84,7 @@ export const InfoApi = {
//查询打印客户拜访记录
getPrintListByCompanyName
:
async
(
companyName
:
string
)
=>
{
console
.
log
(
companyName
)
return
await
request
.
get
({
url
:
`/visit/info/getPrintListByCompanyName`
,
params
:
{
companyName
}
})
},
...
...
yudao-ui/yudao-ui-admin-vue3/src/components/UploadFile/src/UploadImgs.vue
View file @
d3aa88d7
...
...
@@ -22,7 +22,7 @@
</slot>
</div>
<template
#file
="
{ file }">
<img
:src=
"file.url"
class=
"upload-image"
/>
<img
:src=
"file.url"
class=
"upload-image"
@
contextmenu
.
prevent
/>
<div
class=
"upload-handle"
@
click
.
stop
>
<div
class=
"handle-icon"
@
click=
"imagePreview(file.url!)"
>
<Icon
icon=
"ep:zoom-in"
/>
...
...
@@ -43,6 +43,7 @@
<
script
lang=
"ts"
setup
>
import
type
{
UploadFile
,
UploadProps
,
UploadUserFile
}
from
'
element-plus
'
import
{
ElNotification
}
from
'
element-plus
'
import
{
nextTick
}
from
'
vue
'
;
import
{
createImageViewer
}
from
'
@/components/ImageViewer
'
import
{
propTypes
}
from
'
@/utils/propTypes
'
...
...
@@ -56,7 +57,15 @@ const imagePreview = (imgUrl: string) => {
createImageViewer
({
zIndex
:
9999999
,
urlList
:
[
imgUrl
]
})
});
nextTick
(()
=>
{
// 禁止预览图右键
const
viewer
=
document
.
querySelector
(
'
.el-image-viewer__wrapper
'
);
if
(
viewer
)
{
viewer
.
addEventListener
(
'
contextmenu
'
,
(
e
)
=>
e
.
preventDefault
());
}
});
}
type
FileTypes
=
...
...
yudao-ui/yudao-ui-admin-vue3/src/views/visit/customerinfo/index.vue
View file @
d3aa88d7
...
...
@@ -242,7 +242,6 @@ const printComp = ref()
const
handlePrint
=
async
(
companyName
)
=>
{
printData
.
value
=
await
InfoApi
.
getPrintListByCompanyName
(
companyName
)
await
nextTick
()
console
.
log
(
printData
.
value
)
//判断是否有数据
if
(
printData
.
value
.
length
===
0
)
{
message
.
warning
(
'
该客户暂无拜访记录
'
)
...
...
yudao-ui/yudao-ui-admin-vue3/src/views/visit/util/PrintContent.vue
View file @
d3aa88d7
...
...
@@ -141,18 +141,23 @@
</div>
<div
style=
"display: flex;
flex-direction: column;
height: 800px; /* 父容器高度,按需设置 */"
/*flex-direction: column;*/
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
height: 160px; /* 父容器高度,按需设置 */"
>
<img
crossorigin=
"anonymous"
v-for=
"(url, i) in getSafeImages(item.serviceImages)"
:key=
"i"
:src=
"url"
style=
"width: 100%;
height: 25%;
style=
"
width: 48%;
height: 100%;
object-fit: fill;/* cover是切一部分 */
border: 1px solid #ccc;"
border: 1px solid #ccc;
margin: 5px 0"
/>
</div>
</div>
...
...
@@ -168,14 +173,24 @@ import {DICT_TYPE, getDictLabel} from "@/utils/dict";
const
props
=
defineProps
({
dataList
:
Array
})
const
printRef
=
ref
(
null
)
const
serviceImagesList
=
ref
([])
serviceImagesList
.
value
=
props
.
dataList
.
map
(
item
=>
item
.
serviceImages
)
const
formatDate
=
(
date
:
string
|
Date
)
=>
{
const
d
=
new
Date
(
date
)
return
d
.
toLocaleDateString
()
}
const
getSafeImages
=
(
val
?:
string
)
=>
{
if
(
!
val
||
val
===
''
)
return
[]
return
val
.
split
(
'
,
'
).
slice
(
0
,
4
)
console
.
log
(
val
)
return
val
.
split
(
'
,
'
).
slice
(
0
,
10
)
}
// const getSafeImages = (imageStr: string) => {
// if (!imageStr) return [];
// return imageStr.split(',').filter(url => url.trim() !== '').map(url => {
// return url;
// });
// };
defineExpose
({
printRef
})
...
...
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