Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
Y
yn-health-science
Project
Project
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
徐俊
yn-health-science
Commits
903d8f40
Commit
903d8f40
authored
Mar 11, 2025
by
wangxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
d417aa48
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
359 additions
and
276 deletions
+359
-276
pom.xml
science-admin/pom.xml
+46
-6
ComExpertSpecDAO.java
...c/main/java/com/yiboshi/science/dao/ComExpertSpecDAO.java
+3
-3
ComProjectGroupDetailDAO.java
...ava/com/yiboshi/science/dao/ComProjectGroupDetailDAO.java
+1
-0
ComProjectMembersDAO.java
...in/java/com/yiboshi/science/dao/ComProjectMembersDAO.java
+0
-3
ComProjectGroupDetailDTO.java
...m/yiboshi/science/param/dto/ComProjectGroupDetailDTO.java
+10
-9
ComExpertSpecController.java
.../com/yiboshi/science/rest/v1/ComExpertSpecController.java
+10
-18
ComProjectGroupController.java
...om/yiboshi/science/rest/v1/ComProjectGroupController.java
+10
-0
ComProjectGroupDetailController.java
...oshi/science/rest/v1/ComProjectGroupDetailController.java
+0
-1
ComProjectTaskController.java
...com/yiboshi/science/rest/v1/ComProjectTaskController.java
+12
-4
ComExpertSpecService.java
...ava/com/yiboshi/science/service/ComExpertSpecService.java
+2
-2
ComProjectGroupDetailService.java
...yiboshi/science/service/ComProjectGroupDetailService.java
+2
-1
ComProjectGroupService.java
...a/com/yiboshi/science/service/ComProjectGroupService.java
+2
-0
ComProjectMembersService.java
...com/yiboshi/science/service/ComProjectMembersService.java
+1
-0
ComExpertSpecServiceImpl.java
...iboshi/science/service/impl/ComExpertSpecServiceImpl.java
+38
-6
ComProjectGroupDetailServiceImpl.java
...cience/service/impl/ComProjectGroupDetailServiceImpl.java
+13
-2
ComProjectGroupServiceImpl.java
...oshi/science/service/impl/ComProjectGroupServiceImpl.java
+30
-7
ComProjectMembersServiceImpl.java
...hi/science/service/impl/ComProjectMembersServiceImpl.java
+0
-4
ComProjectServiceImpl.java
...m/yiboshi/science/service/impl/ComProjectServiceImpl.java
+0
-52
HtmlBuilder.java
.../src/main/java/com/yiboshi/science/utils/HtmlBuilder.java
+1
-1
TaskInfoToPDFUtil.java
...ain/java/com/yiboshi/science/utils/TaskInfoToPDFUtil.java
+6
-2
TaskToPDF.java
...in/src/main/java/com/yiboshi/science/utils/TaskToPDF.java
+93
-0
UniformBorderEvent.java
...in/java/com/yiboshi/science/utils/UniformBorderEvent.java
+18
-0
WordUtil.java
...min/src/main/java/com/yiboshi/science/utils/WordUtil.java
+0
-4
WordUtils.java
...in/src/main/java/com/yiboshi/science/utils/WordUtils.java
+25
-114
ComExpertSpecDAO.xml
science-admin/src/main/resources/mapper/ComExpertSpecDAO.xml
+7
-11
ComProjectGroupDetailDAO.xml
...in/src/main/resources/mapper/ComProjectGroupDetailDAO.xml
+17
-2
tmp-task.html
science-admin/src/main/resources/template/tmp-task.html
+12
-24
No files found.
science-admin/pom.xml
View file @
903d8f40
...
...
@@ -123,12 +123,6 @@
<version>
2.3.28
</version>
</dependency>
<dependency>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi-ooxml
</artifactId>
<version>
3.17
</version>
</dependency>
<dependency>
<groupId>
cn.hutool
</groupId>
<artifactId>
hutool-all
</artifactId>
...
...
@@ -163,6 +157,7 @@
<artifactId>
poi-tl
</artifactId>
<version>
1.10.0
</version>
</dependency>
<dependency>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi
</artifactId>
...
...
@@ -180,6 +175,18 @@
<version>
4.1.2
</version>
</dependency>
<dependency>
<groupId>
fr.opensagres.xdocreport
</groupId>
<artifactId>
fr.opensagres.poi.xwpf.converter.core
</artifactId>
<version>
2.0.2
</version>
</dependency>
<dependency>
<groupId>
fr.opensagres.xdocreport
</groupId>
<artifactId>
fr.opensagres.poi.xwpf.converter.xhtml
</artifactId>
<version>
2.0.2
</version>
</dependency>
<dependency>
<groupId>
commons-io
</groupId>
<artifactId>
commons-io
</artifactId>
...
...
@@ -218,6 +225,17 @@
<artifactId>
spring-boot-starter-thymeleaf
</artifactId>
</dependency>
<dependency>
<groupId>
org.thymeleaf
</groupId>
<artifactId>
thymeleaf
</artifactId>
<version>
3.0.11.RELEASE
</version>
</dependency>
<dependency>
<groupId>
org.thymeleaf
</groupId>
<artifactId>
thymeleaf-spring5
</artifactId>
<version>
3.0.11.RELEASE
</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.itextpdf/itextpdf -->
<dependency>
<groupId>
com.itextpdf
</groupId>
...
...
@@ -286,6 +304,28 @@
<scope>
compile
</scope>
</dependency>
<!-- docx4j for Word processing -->
<dependency>
<groupId>
org.docx4j
</groupId>
<artifactId>
docx4j-JAXB-Internal
</artifactId>
<version>
8.3.3
</version>
</dependency>
<dependency>
<groupId>
org.docx4j
</groupId>
<artifactId>
docx4j-ImportXHTML
</artifactId>
<version>
8.0.0
</version>
</dependency>
<!-- Apache Commons IO -->
<dependency>
<groupId>
commons-io
</groupId>
<artifactId>
commons-io
</artifactId>
<version>
2.11.0
</version>
</dependency>
<dependency>
<groupId>
com.belerweb
</groupId>
<artifactId>
pinyin4j
</artifactId>
...
...
science-admin/src/main/java/com/yiboshi/science/dao/ComExpertSpecDAO.java
View file @
903d8f40
...
...
@@ -13,7 +13,7 @@ import org.apache.ibatis.annotations.Param;
import
java.util.List
;
public
interface
ComExpertSpecDAO
extends
BaseMapper
<
ComExpertSpec
>,
BaseDAO
<
ComExpertSpecQueryVO
,
ComExpertSpecDTO
,
ComExpertSpec
>
{
public
interface
ComExpertSpecDAO
extends
BaseMapper
<
ComExpertSpec
>,
BaseDAO
<
ComExpertSpecQueryVO
,
ComExpertSpecDTO
,
ComExpertSpec
>
{
List
<
String
>
getIdListByExpertId
(
String
expertId
);
...
...
@@ -23,7 +23,7 @@ public interface ComExpertSpecDAO extends BaseMapper<ComExpertSpec>, BaseDAO<Com
List
<
ComExpertDTO
>
getExpertListBySpecIdProjId
(
@Param
(
"specIds"
)
List
<
String
>
SpecList
,
@Param
(
"porjIds"
)
List
<
String
>
ProjList
);
List
<
ComExpertDTO
>
getExpertListByExpertSpecIds
(
@Param
(
"specIds"
)
List
<
String
>
SpecList
,
@Param
(
"parentIds"
)
List
<
String
>
ParentList
,
@Param
(
"personName"
)
String
personName
);
List
<
ComExpertDTO
>
getExpertListByExpertSpecIds
(
@Param
(
"specIds"
)
List
<
String
>
specIds
,
@Param
(
"personName"
)
String
personName
);
List
<
ComExpertDTO
>
getExpertListByExpertSpecIdOrParentId
(
@Param
(
"specId"
)
String
specId
,
@Param
(
"pkey"
)
String
pkey
,
@Param
(
"ppkey"
)
String
ppkey
,
@Param
(
"personName"
)
String
personName
);
List
<
ComExpertDTO
>
getExpertListByExpertSpecIdOrParentId
(
@Param
(
"specId"
)
String
specId
,
@Param
(
"pkey"
)
String
pkey
,
@Param
(
"ppkey"
)
String
ppkey
,
@Param
(
"personName"
)
String
personName
);
}
science-admin/src/main/java/com/yiboshi/science/dao/ComProjectGroupDetailDAO.java
View file @
903d8f40
...
...
@@ -22,4 +22,5 @@ public interface ComProjectGroupDetailDAO extends BaseMapper<ComProjectGroupDeta
Page
<
ComProjectGroupDetailDTO
>
getProjectDetailListbyPage
(
Page
<
ComProjectGroupDetailQueryVO
>
page
,
@Param
(
"ew"
)
Wrapper
<
ComProjectGroupDetailQueryVO
>
queryWrapper
);
List
<
ComProjectGroupDetailDTO
>
getProjectListByGroupIds
(
@Param
(
"groupIds"
)
List
<
String
>
groupList
);
List
<
ComProjectGroupDetailDTO
>
getMembersListByGroupIds
(
@Param
(
"groupIds"
)
List
<
String
>
groupList
);
}
science-admin/src/main/java/com/yiboshi/science/dao/ComProjectMembersDAO.java
View file @
903d8f40
...
...
@@ -16,8 +16,6 @@ import java.util.List;
*/
public
interface
ComProjectMembersDAO
extends
BaseMapper
<
ComProjectMembers
>,
BaseDAO
<
ComProjectMembersQueryVO
,
ComProjectMembersDTO
,
ComProjectMembers
>
{
List
<
ComProjectMembersDTO
>
getListByObjectId
(
String
objectId
);
ComProjectMembersDTO
getMemCountById
(
String
objectId
);
Integer
getMemWorkCountByObjectId
(
String
objectId
);
}
\ No newline at end of file
science-admin/src/main/java/com/yiboshi/science/param/dto/ComProjectGroupDetailDTO.java
View file @
903d8f40
...
...
@@ -53,30 +53,31 @@ public class ComProjectGroupDetailDTO extends BaseDTO {
@ApiModelProperty
(
value
=
"学科"
,
position
=
6
)
private
String
knowledgeName
;
/**
证件号
*/
@ApiModelProperty
(
value
=
"
证件号"
,
position
=
2
)
private
String
cert
Id
;
/**
申报人Id
*/
@ApiModelProperty
(
value
=
"
项目名称"
,
position
=
5
)
private
String
appPerson
Id
;
/** 姓名 */
@ApiModelProperty
(
value
=
"姓名"
,
position
=
4
)
private
String
personName
;
/** 证件号 */
@ApiModelProperty
(
value
=
"证件号"
,
position
=
2
)
private
String
certId
;
/** 申报单位Id */
@ApiModelProperty
(
value
=
"申报单位Id"
,
position
=
6
)
@Length
(
max
=
36
,
message
=
"申报单位Id不能大于36"
)
private
String
appUnitId
;
/** 申报单位名称 */
@ApiModelProperty
(
value
=
"申报单位名称"
,
position
=
7
)
private
String
appUnitName
;
/** key */
@ApiModelProperty
(
value
=
"key"
,
position
=
1
)
@Length
(
max
=
36
,
message
=
"key不能大于36"
)
private
String
key
;
private
String
title
;
private
String
description
;
private
String
pkey
;
private
String
ppkey
;
}
science-admin/src/main/java/com/yiboshi/science/rest/v1/ComExpertSpecController.java
View file @
903d8f40
...
...
@@ -5,17 +5,18 @@ import com.yiboshi.arch.base.ResponseDataModel;
import
com.yiboshi.science.entity.ComExpertSpec
;
import
com.yiboshi.science.entity.SelectListItem
;
import
com.yiboshi.science.param.dto.ComExpertSpecDTO
;
import
com.yiboshi.science.param.dto.ComProjectGroupDetailDTO
;
import
com.yiboshi.science.param.query.ComExpertSpecQueryVO
;
import
com.yiboshi.science.rest.BaseController
;
import
com.yiboshi.science.service.ComExpertSpecService
;
import
com.yiboshi.science.service.ComProjectGroupDetailService
;
import
com.yiboshi.science.service.ComProjectGroupService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
@Api
(
tags
=
"com-expert-spec"
,
description
=
"项目分配表"
)
...
...
@@ -25,10 +26,14 @@ public class ComExpertSpecController extends BaseController<ComExpertSpecService
@Autowired
private
ComExpertSpecService
comExpertSpecService
;
@ApiOperation
(
value
=
"根据类型参数列表"
,
httpMethod
=
"GET"
,
notes
=
"根据类型参数列表"
)
@GetMapping
@RequestMapping
(
"/getExpertListBySpecId"
)
public
ResponseDataModel
<
List
<
SelectListItem
>>
getExpertListBySpecId
(
@RequestBody
Map
<
String
,
Object
>
specId
)
{
return
ResponseDataModel
.
ok
(
comExpertSpecService
.
getExpertListBySpecId
(
specId
));
}
...
...
@@ -51,21 +56,8 @@ public class ComExpertSpecController extends BaseController<ComExpertSpecService
@ApiOperation
(
value
=
"根据类型参数列表"
,
httpMethod
=
"GET"
,
notes
=
"根据类型参数列表"
)
@GetMapping
@RequestMapping
(
"/getExpertListByExpertSpecIds"
)
public
ResponseDataModel
<
List
<
SelectListItem
>>
getExpertListByExpertSpecIds
(
String
specIds
,
String
parentIds
,
String
personName
)
{
String
[]
split
;
List
<
String
>
SpecList
=
null
;
if
(
null
!=
specIds
)
{
split
=
specIds
.
split
(
","
);
SpecList
=
Arrays
.
asList
(
split
);
}
List
<
String
>
ParentList
=
null
;
if
(
null
!=
parentIds
)
{
split
=
parentIds
.
split
(
","
);
ParentList
=
Arrays
.
asList
(
split
);
}
return
ResponseDataModel
.
ok
(
comExpertSpecService
.
getExpertListByExpertSpecIds
(
SpecList
,
ParentList
,
personName
));
public
ResponseDataModel
<
List
<
SelectListItem
>>
getExpertListByExpertSpecIds
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
return
ResponseDataModel
.
ok
(
comExpertSpecService
.
getExpertListByExpertSpecIds
((
List
<
String
>)
params
.
get
(
"specIds"
),(
List
<
String
>)
params
.
get
(
"groupIds"
),
(
String
)
params
.
get
(
"personName"
)));
}
...
...
science-admin/src/main/java/com/yiboshi/science/rest/v1/ComProjectGroupController.java
View file @
903d8f40
...
...
@@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.*;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
@Api
(
tags
=
"com-project-group"
,
description
=
"项目分组表"
)
@RestController
...
...
@@ -164,4 +165,13 @@ public class ComProjectGroupController extends BaseController<ComProjectGroupSer
else
return
ResponseDataModel
.
ok
(
"项目组移除项目失败,请检查!"
);
}
@ApiOperation
(
value
=
"项目信息"
,
httpMethod
=
"GET"
,
notes
=
"项目信息"
)
@GetMapping
@RequestMapping
(
"/getGroupProjectInfo"
)
public
ResponseDataModel
<
Map
<
String
,
Object
>>
getGroupProjectInfo
(
@RequestParam
String
groupIds
)
{
String
[]
split
=
groupIds
.
split
(
","
);
List
<
String
>
groupList
=
Arrays
.
asList
(
split
);
return
ResponseDataModel
.
ok
(
comProjectGroupService
.
getGroupProjectInfo
(
groupList
));
}
}
science-admin/src/main/java/com/yiboshi/science/rest/v1/ComProjectGroupDetailController.java
View file @
903d8f40
...
...
@@ -39,7 +39,6 @@ public class ComProjectGroupDetailController extends BaseController<ComProjectGr
public
ResponseDataModel
<
List
<
ComProjectGroupDetailDTO
>>
getProjectListByGroupIds
(
@RequestParam
String
groupIds
)
{
String
[]
split
=
groupIds
.
split
(
","
);
List
<
String
>
GroupList
=
Arrays
.
asList
(
split
);
List
<
ComProjectGroupDetailDTO
>
list
=
comProjectGroupDetailService
.
getProjectListByGroupIds
(
GroupList
);
list
.
forEach
(
e
->
{
e
.
setKey
(
e
.
getId
());
...
...
science-admin/src/main/java/com/yiboshi/science/rest/v1/ComProjectTaskController.java
View file @
903d8f40
...
...
@@ -14,19 +14,20 @@ import com.yiboshi.science.param.dto.DataStatisticsDTO;
import
com.yiboshi.science.param.query.ComProjectTaskQueryVO
;
import
com.yiboshi.science.rest.BaseController
;
import
com.yiboshi.science.service.ComProjectTaskService
;
import
com.yiboshi.science.utils.StringUtil
;
import
com.yiboshi.science.utils.TaskInfoToPDFUtil
;
import
com.yiboshi.science.utils.*
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer
;
import
javax.servlet.ServletOutputStream
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
/**
* 功能:任务书表 接口
...
...
@@ -42,6 +43,7 @@ public class ComProjectTaskController extends BaseController<ComProjectTaskServi
@Autowired
private
ComProjectTaskService
ComProjectTaskService
;
/**
* 功能:分页查询
*
...
...
@@ -146,9 +148,15 @@ public class ComProjectTaskController extends BaseController<ComProjectTaskServi
@PostMapping
public
void
export
(
@PathVariable
String
id
)
throws
DocumentException
,
IOException
{
try
{
ComProjectTaskDTO
dto
=
ComProjectTaskService
.
getTaskByProjId
(
id
);
ComProjectTaskDTO
dto
=
ComProjectTaskService
.
getTaskByProjId
(
id
);
// WordUtils.getHtmlContent(dto, "C:\\Users\\kylin\\Desktop\\导出Pdf\\output.docx");
// 生成PDF文件字节数组
byte
[]
pdfBytes
=
Task
InfoToPDFUtil
.
createContractPdf
(
ComProjectTaskService
.
getTaskByProjId
(
id
)
);
byte
[]
pdfBytes
=
Task
ToPDF
.
createContractPdf
(
dto
);
// 设置响应头
response
.
setContentType
(
"application/pdf"
);
String
fileName
=
new
String
((
dto
.
getProjName
()
+
".pdf"
).
getBytes
(
"UTF-8"
),
"ISO-8859-1"
);
...
...
science-admin/src/main/java/com/yiboshi/science/service/ComExpertSpecService.java
View file @
903d8f40
...
...
@@ -50,9 +50,9 @@ public interface ComExpertSpecService extends BaseService<ComExpertSpecQueryVO,
List
<
SelectListItem
>
getExpertListBySpecIdProjId
(
List
<
String
>
SpecList
,
List
<
String
>
ProjList
);
/** 根据 项目Id 获取专家列表
*
* @param
SpecList
* @param
groupIds
*/
List
<
SelectListItem
>
getExpertListByExpertSpecIds
(
List
<
String
>
SpecList
,
List
<
String
>
ParentList
,
String
personName
);
List
<
SelectListItem
>
getExpertListByExpertSpecIds
(
List
<
String
>
specIds
,
List
<
String
>
groupIds
,
String
personName
);
/**
* 根据学科Id获取专家列表
...
...
science-admin/src/main/java/com/yiboshi/science/service/ComProjectGroupDetailService.java
View file @
903d8f40
...
...
@@ -18,5 +18,6 @@ public interface ComProjectGroupDetailService extends BaseService<ComProjectGrou
Pagination
<
ComProjectGroupDetailDTO
>
getProjectDetailListbyPage
(
ComProjectGroupDetailQueryVO
vo
);
List
<
ComProjectGroupDetailDTO
>
getProjectListByGroupIds
(
@Param
(
"groupIds"
)
List
<
String
>
groupList
);
List
<
ComProjectGroupDetailDTO
>
getProjectListByGroupIds
(
List
<
String
>
groupIds
);
List
<
ComProjectGroupDetailDTO
>
getMembersListByGroupIds
(
List
<
String
>
groupIds
);
}
science-admin/src/main/java/com/yiboshi/science/service/ComProjectGroupService.java
View file @
903d8f40
...
...
@@ -9,6 +9,7 @@ import com.yiboshi.science.param.query.ComProjectAuditQueryVO;
import
com.yiboshi.science.param.query.ComProjectGroupQueryVO
;
import
java.util.List
;
import
java.util.Map
;
public
interface
ComProjectGroupService
extends
BaseService
<
ComProjectGroupQueryVO
,
ComProjectGroupDTO
,
ComProjectGroup
>
{
...
...
@@ -45,4 +46,5 @@ public interface ComProjectGroupService extends BaseService<ComProjectGroupQuery
boolean
deleteProjectGroupKnowledge
(
String
groupId
,
String
knowledgeId
);
boolean
deleteProjectGroupDetail
(
String
groupId
,
String
knowledgeId
);
Map
<
String
,
Object
>
getGroupProjectInfo
(
List
<
String
>
groupIds
);
}
science-admin/src/main/java/com/yiboshi/science/service/ComProjectMembersService.java
View file @
903d8f40
...
...
@@ -20,6 +20,7 @@ public interface ComProjectMembersService extends BaseService<ComProjectMembersQ
*/
List
<
ComProjectMembersDTO
>
getListByObjectId
(
String
objectId
);
/**插入项目组成员
*
* @param list
...
...
science-admin/src/main/java/com/yiboshi/science/service/impl/ComExpertSpecServiceImpl.java
View file @
903d8f40
...
...
@@ -9,8 +9,11 @@ import com.yiboshi.science.entity.SystemMenu;
import
com.yiboshi.science.entity.SelectListItem
;
import
com.yiboshi.science.param.dto.ComExpertDTO
;
import
com.yiboshi.science.param.dto.ComExpertSpecDTO
;
import
com.yiboshi.science.param.dto.ComProjectGroupDetailDTO
;
import
com.yiboshi.science.param.query.ComExpertSpecQueryVO
;
import
com.yiboshi.science.service.ComExpertSpecService
;
import
com.yiboshi.science.service.ComProjectGroupDetailService
;
import
com.yiboshi.science.service.ComProjectGroupService
;
import
com.yiboshi.science.utils.AgeUtil
;
import
lombok.AllArgsConstructor
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -31,6 +34,9 @@ public class ComExpertSpecServiceImpl extends BaseServiceImpl<ComExpertSpecDAO,
@Autowired
private
ComExpertSpecDAO
comExpertSpecDAO
;
@Autowired
private
ComProjectGroupDetailService
comProjectGroupDetailService
;
@Override
protected
void
setCriteriaForQuery
(
ComExpertSpecQueryVO
vo
,
QueryWrapper
<
ComExpertSpecQueryVO
>
criteria
)
{
if
(
Objects
.
nonNull
(
vo
.
getExpertId
()))
{
...
...
@@ -113,17 +119,43 @@ public class ComExpertSpecServiceImpl extends BaseServiceImpl<ComExpertSpecDAO,
return
allItem
;
}
public
List
<
SelectListItem
>
getExpertListByExpertSpecIds
(
List
<
String
>
SpecList
,
List
<
String
>
ParentList
,
String
personName
)
{
List
<
ComExpertDTO
>
list
=
comExpertSpecDAO
.
getExpertListByExpertSpecIds
(
SpecList
,
ParentList
,
personName
);
List
<
SelectListItem
>
allItem
=
new
ArrayList
<>();
public
List
<
SelectListItem
>
getExpertListByExpertSpecIds
(
List
<
String
>
specIds
,
List
<
String
>
groupIds
,
String
personName
)
{
List
<
ComExpertDTO
>
list
=
new
ArrayList
<>();
if
((
specIds
!=
null
&&
specIds
.
size
()
>
0
)
||
null
!=
personName
)
list
=
comExpertSpecDAO
.
getExpertListByExpertSpecIds
(
specIds
,
personName
);
if
(
null
!=
list
&&
list
.
size
()
>
0
)
{
List
<
SelectListItem
>
array
=
new
ArrayList
<>();
List
<
String
>
units
=
new
ArrayList
<>();
List
<
ComProjectGroupDetailDTO
>
project
=
comProjectGroupDetailService
.
getProjectListByGroupIds
(
groupIds
);
List
<
ComProjectGroupDetailDTO
>
members
=
comProjectGroupDetailService
.
getMembersListByGroupIds
(
groupIds
);
if
(
null
==
members
)
{
members
=
new
ArrayList
<>();
}
List
<
ComProjectGroupDetailDTO
>
finalMembers
=
members
;
project
.
forEach
(
e
->
{
if
(!
units
.
contains
(
e
.
getAppUnitId
()))
units
.
add
(
e
.
getAppUnitId
());
ComProjectGroupDetailDTO
dto
=
new
ComProjectGroupDetailDTO
();
dto
.
setPersonName
(
e
.
getPersonName
());
dto
.
setCertId
(
e
.
getCertId
());
dto
.
setAppUnitName
(
e
.
getAppUnitName
());
finalMembers
.
add
(
dto
);
});
List
<
ComProjectGroupDetailDTO
>
finalMembers1
=
members
;
list
.
forEach
((
e
)
->
{
boolean
isDisabled
=
false
;
String
description
=
e
.
getSex
()
+
"/"
+
AgeUtil
.
getResidentAge
(
e
.
getBirthday
())
+
"岁/"
+
e
.
getWorkUnit
();
SelectListItem
treeListItem
=
new
SelectListItem
(
e
.
getPersonName
(),
e
.
getId
(),
description
,
false
,
false
,
new
ArrayList
<>());
allItem
.
add
(
treeListItem
);
isDisabled
=
units
.
contains
(
e
.
getUnitId
());
// 检查专家的证件号是否在 members 列表中
if
(!
isDisabled
)
isDisabled
=
finalMembers1
.
stream
().
anyMatch
(
member
->
Objects
.
equals
(
member
.
getCertId
(),
e
.
getCertId
()));
SelectListItem
treeListItem
=
new
SelectListItem
(
e
.
getPersonName
(),
e
.
getId
(),
description
,
false
,
isDisabled
,
new
ArrayList
<>());
array
.
add
(
treeListItem
);
});
return
array
;
}
return
allItem
;
return
new
ArrayList
<>()
;
}
public
List
<
SelectListItem
>
getExpertListByExpertSpecIdOrParentId
(
String
specId
,
String
pkey
,
String
ppkey
,
String
personName
)
{
...
...
science-admin/src/main/java/com/yiboshi/science/service/impl/ComProjectGroupDetailServiceImpl.java
View file @
903d8f40
...
...
@@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Objects
;
...
...
@@ -63,7 +64,17 @@ public class ComProjectGroupDetailServiceImpl extends BaseServiceImpl<ComProject
return
new
Pagination
<>(
dtoList
,
page
.
getTotal
(),
vo
.
getPageSize
());
}
public
List
<
ComProjectGroupDetailDTO
>
getProjectListByGroupIds
(
List
<
String
>
SpecList
)
{
return
comProjectGroupDetailDAO
.
getProjectListByGroupIds
(
SpecList
);
public
List
<
ComProjectGroupDetailDTO
>
getProjectListByGroupIds
(
List
<
String
>
groupIds
)
{
if
(
groupIds
!=
null
&&
groupIds
.
size
()
>
0
)
return
comProjectGroupDetailDAO
.
getProjectListByGroupIds
(
groupIds
);
else
return
new
ArrayList
<>();
}
public
List
<
ComProjectGroupDetailDTO
>
getMembersListByGroupIds
(
List
<
String
>
groupIds
)
{
if
(
groupIds
!=
null
&&
groupIds
.
size
()
>
0
)
return
comProjectGroupDetailDAO
.
getMembersListByGroupIds
(
groupIds
);
else
return
new
ArrayList
<>();
}
}
science-admin/src/main/java/com/yiboshi/science/service/impl/ComProjectGroupServiceImpl.java
View file @
903d8f40
...
...
@@ -2,6 +2,7 @@ package com.yiboshi.science.service.impl;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yiboshi.arch.base.ResponseDataModel
;
import
com.yiboshi.arch.exception.BusinessException
;
import
com.yiboshi.science.base.BaseServiceImpl
;
import
com.yiboshi.science.base.Pagination
;
...
...
@@ -17,9 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.*
;
@Service
@AllArgsConstructor
...
...
@@ -48,6 +47,9 @@ public class ComProjectGroupServiceImpl extends BaseServiceImpl<ComProjectGroupD
@Autowired
private
ComProjectAuditService
comProjectAuditService
;
@Autowired
private
ComProjectMembersService
comProjectMembersService
;
@Override
protected
void
setCriteriaForQuery
(
ComProjectGroupQueryVO
vo
,
QueryWrapper
<
ComProjectGroupQueryVO
>
criteria
)
{
...
...
@@ -149,7 +151,6 @@ public class ComProjectGroupServiceImpl extends BaseServiceImpl<ComProjectGroupD
}
public
void
CalculateGroupProjectCount
(
String
groupId
)
{
List
<
ComProjectGroupDetailDTO
>
list
=
comProjectGroupDetailService
.
getProjectDetailList
(
groupId
);
ComProjectGroup
model
=
new
ComProjectGroup
();
...
...
@@ -168,8 +169,7 @@ public class ComProjectGroupServiceImpl extends BaseServiceImpl<ComProjectGroupD
if
(
null
==
list
||
list
.
size
()
==
0
)
{
model
.
setExpertCount
(
0
);
model
.
setAssignState
(
0
);
}
else
{
}
else
{
model
.
setExpertCount
(
list
.
size
());
model
.
setAssignState
(
1
);
}
...
...
@@ -423,6 +423,7 @@ public class ComProjectGroupServiceImpl extends BaseServiceImpl<ComProjectGroupD
/**
* 项目专家分配
*
* @param groupId
* @return
*/
...
...
@@ -461,6 +462,7 @@ public class ComProjectGroupServiceImpl extends BaseServiceImpl<ComProjectGroupD
/**
* 项目二级学科统计
*
* @param groupId
* @return
*/
...
...
@@ -468,5 +470,26 @@ public class ComProjectGroupServiceImpl extends BaseServiceImpl<ComProjectGroupD
List
<
ComProjectKnowledgeStatisticDTO
>
list
=
comProjectGroupDAO
.
getProjectKnowledgeStatisticByGroupId
(
groupId
);
return
list
;
}
@Transactional
public
Map
<
String
,
Object
>
getGroupProjectInfo
(
List
<
String
>
groupIds
)
{
List
<
ComProjectGroupDetailDTO
>
project
=
comProjectGroupDetailService
.
getProjectListByGroupIds
(
groupIds
);
List
<
String
>
expanded
=
new
ArrayList
<>();
List
<
String
>
specs
=
new
ArrayList
<>();
project
.
forEach
(
e
->
{
if
(!
expanded
.
contains
(
e
.
getPpkey
()))
expanded
.
add
(
e
.
getPpkey
());
if
(!
expanded
.
contains
(
e
.
getPkey
()))
expanded
.
add
(
e
.
getPkey
());
if
(!
specs
.
contains
(
e
.
getKnowledgeId
()))
specs
.
add
(
e
.
getKnowledgeId
());
});
Map
<
String
,
Object
>
projInfo
=
new
HashMap
<
String
,
Object
>(
4
)
{
{
put
(
"expanded"
,
expanded
);
put
(
"spec"
,
specs
);
}
};
return
projInfo
;
}
}
science-admin/src/main/java/com/yiboshi/science/service/impl/ComProjectMembersServiceImpl.java
View file @
903d8f40
...
...
@@ -66,10 +66,6 @@ public class ComProjectMembersServiceImpl extends BaseServiceImpl<ComProjectMemb
@Override
public
List
<
ComProjectMembersDTO
>
getListByObjectId
(
String
objectId
)
{
List
<
ComProjectMembersDTO
>
list
=
comProjectMembersDAO
.
getListByObjectId
(
objectId
);
// if (null != list && list.size() > 0)
// list.forEach((e) -> {
// e.setCertId(hideAllIdCardNum(e.getCertId()));
// });
return
list
;
}
...
...
science-admin/src/main/java/com/yiboshi/science/service/impl/ComProjectServiceImpl.java
View file @
903d8f40
...
...
@@ -962,58 +962,6 @@ public class ComProjectServiceImpl extends BaseServiceImpl<ComProjectDAO, ComPro
}
public
void
export1
(
@PathVariable
String
id
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
ComProjectDTO
p
=
this
.
getProjectById
(
id
);
if
(
null
!=
p
)
{
String
strDateFormat
=
p
.
getProjType
().
equals
(
1
)
?
"yyyy-MM-dd HH:mm:ss"
:
"yyyy-MM-dd"
;
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
strDateFormat
);
p
.
getMembers
().
forEach
((
e
)
->
{
// e.setAge(IDCardUtil.getAge(e.getCertId()));
e
.
setSex
(
IDCardUtil
.
getSex
(
e
.
getCertId
()));
});
final
String
[]
unit
=
{
""
};
p
.
getCooperativeUnits
().
forEach
(
e
->
{
if
(
Objects
.
nonNull
(
e
.
getUnitName
()))
{
unit
[
0
]
=
unit
[
0
]
+
" "
+
e
.
getUnitName
();
}
});
if
(
null
==
p
.
getCooperativeUnits
()
||
p
.
getCooperativeUnits
().
size
()
<
3
)
{
int
count
=
p
.
getCooperativeUnits
()
==
null
?
0
:
p
.
getCooperativeUnits
().
size
();
List
<
ComProjectCooperativeUnitsDTO
>
item
=
p
.
getCooperativeUnits
()
==
null
?
new
ArrayList
<>()
:
p
.
getCooperativeUnits
();
for
(
int
i
=
1
;
i
<=
3
-
count
;
i
++)
{
item
.
add
(
new
ComProjectCooperativeUnitsDTO
());
}
p
.
setCooperativeUnits
(
item
);
}
if
(
null
==
p
.
getMembers
()
||
p
.
getMembers
().
size
()
<
6
)
{
int
count
=
p
.
getMembers
()
==
null
?
0
:
p
.
getMembers
().
size
();
List
<
ComProjectMembersDTO
>
item
=
p
.
getMembers
()
==
null
?
new
ArrayList
<>()
:
p
.
getMembers
();
for
(
int
i
=
1
;
i
<=
6
-
count
;
i
++)
{
item
.
add
(
new
ComProjectMembersDTO
());
}
p
.
setMembers
(
item
);
}
if
(
null
==
p
.
getBudget
()
||
p
.
getBudget
().
size
()
<
13
)
{
int
count
=
p
.
getBudget
()
==
null
?
0
:
p
.
getBudget
().
size
();
List
<
ComProjectBudgetDTO
>
item
=
p
.
getBudget
()
==
null
?
new
ArrayList
<>()
:
p
.
getBudget
();
for
(
int
i
=
1
;
i
<=
13
-
count
;
i
++)
{
item
.
add
(
new
ComProjectBudgetDTO
());
}
p
.
setBudget
(
item
);
}
List
<
String
>
str
=
comProjectResultsService
.
getNameByObjectId
(
p
.
getId
());
if
(
p
.
getProjType
().
equals
(
1
))
{
WordUtils
utl
=
new
WordUtils
();
utl
.
export
(
p
,
response
,
"word.ftl"
);
}
else
{
htmlBuilder
.
exportWord
(
p
,
request
,
response
);
}
}
}
public
void
export
(
@PathVariable
String
id
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
String
filename
=
System
.
currentTimeMillis
()
+
".pdf"
;
response
.
reset
();
...
...
science-admin/src/main/java/com/yiboshi/science/utils/HtmlBuilder.java
View file @
903d8f40
...
...
@@ -126,7 +126,7 @@ public class HtmlBuilder {
*
* @return 模板字符串
*/
public
String
getHtmlText
(
String
templateName
,
Map
<
String
,
Object
>
map
)
{
public
String
getHtmlText
(
String
templateName
,
Map
<
String
,
Object
>
map
)
{
String
htmlText
=
""
;
try
{
// 通过指定模板名获取FreeMarker模板实例
...
...
science-admin/src/main/java/com/yiboshi/science/utils/TaskInfoToPDFUtil.java
View file @
903d8f40
...
...
@@ -156,7 +156,9 @@ public class TaskInfoToPDFUtil {
table
.
setWidths
(
new
float
[]{
80
f
,
80
f
,
30
f
,
60
f
,
60
f
,
80
f
,
30
f
,
100
f
});
table
.
setWidthPercentage
(
100
);
// 设置表格默认边框宽度
table
.
getDefaultCell
().
setBorderWidth
(
0.5f
);
// table.getDefaultCell().setBorderWidth(0.1f);
table
.
setSplitLate
(
false
);
// 避免拆分时边框异
table
.
isInline
();
// 添加表格内容
addValueCell
(
table
,
"单位名称:"
,
null
,
dto
.
getAppUnitName
(),
7
,
normalFont
,
null
,
null
,
null
);
...
...
@@ -1035,11 +1037,13 @@ public class TaskInfoToPDFUtil {
valueCell
.
setRowspan
(
valueRowspan
);
if
(
Objects
.
nonNull
(
valueColspan
))
valueCell
.
setColspan
(
valueColspan
);
valueCell
.
setCellEvent
(
new
UniformBorderEvent
());
valueCell
.
setPadding
(
5
f
);
valueCell
.
setMinimumHeight
(
height
);
valueCell
.
setVerticalAlignment
(
vertical
);
valueCell
.
setHorizontalAlignment
(
horizontal
);
valueCell
.
setBorderWidth
(
0.5f
);
// 设置边框宽度
valueCell
.
setBorderWidth
(
0.1f
);
// 设置边框宽度
valueCell
.
setBorderColor
(
new
BaseColor
(
0
,
0
,
0
));
table
.
addCell
(
valueCell
);
}
...
...
science-admin/src/main/java/com/yiboshi/science/utils/TaskToPDF.java
0 → 100644
View file @
903d8f40
package
com
.
yiboshi
.
science
.
utils
;
import
com.itextpdf.kernel.colors.DeviceRgb
;
import
com.itextpdf.layout.borders.SolidBorder
;
import
com.itextpdf.layout.element.Cell
;
import
com.itextpdf.layout.element.Table
;
import
com.itextpdf.layout.properties.TextAlignment
;
import
com.itextpdf.layout.element.Paragraph
;
import
com.itextpdf.layout.properties.UnitValue
;
import
com.itextpdf.kernel.pdf.PdfDocument
;
import
com.itextpdf.kernel.pdf.PdfWriter
;
import
com.itextpdf.layout.Document
;
import
com.itextpdf.text.pdf.BaseFont
;
import
com.yiboshi.science.param.dto.*
;
import
com.itextpdf.kernel.font.PdfFont
;
import
com.itextpdf.kernel.font.PdfFontFactory
;
import
com.itextpdf.io.font.PdfEncodings
;
import
java.io.ByteArrayOutputStream
;
import
java.math.BigDecimal
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Objects
;
import
static
com
.
yiboshi
.
science
.
utils
.
ProjectInfoToPDF
.
getCurrentOperatingSystem
;
public
class
TaskToPDF
{
static
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
static
SimpleDateFormat
sdfM
=
new
SimpleDateFormat
(
"yyyy年MM月"
);
private
static
PdfFont
createFont
(
String
fontName
)
{
try
{
if
(
"linux"
.
equals
(
getCurrentOperatingSystem
()))
{
if
(
fontName
.
toLowerCase
().
endsWith
(
".ttc"
))
return
PdfFontFactory
.
createFont
(
"/usr/share/fonts/"
+
fontName
+
",0"
,
PdfEncodings
.
IDENTITY_H
);
else
return
PdfFontFactory
.
createFont
(
"/usr/share/fonts/"
+
fontName
,
PdfEncodings
.
IDENTITY_H
);
}
else
{
if
(
fontName
.
toLowerCase
().
endsWith
(
".ttc"
))
return
PdfFontFactory
.
createFont
(
"c:/Windows/Fonts/"
+
fontName
+
",0"
,
PdfEncodings
.
IDENTITY_H
);
else
return
PdfFontFactory
.
createFont
(
"c:/Windows/Fonts/"
+
fontName
,
PdfEncodings
.
IDENTITY_H
);
}
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"加载字体文件失败,请确保系统中存在字体文件 "
+
fontName
+
":"
+
e
.
getMessage
(),
e
);
}
}
/**
* 生成项目合同书PDF
*
* @param dto 项目任务信息
* @return PDF文件字节数组
*/
public
static
byte
[]
createContractPdf
(
ComProjectTaskDTO
dto
)
{
try
{
ByteArrayOutputStream
baos
=
new
ByteArrayOutputStream
();
PdfDocument
pdfDoc
=
new
PdfDocument
(
new
PdfWriter
(
baos
));
Document
document
=
new
Document
(
pdfDoc
);
// 添加中文字体支持
// 宋体
PdfFont
sfChinese
=
createFont
(
"simsun.ttc"
);
// 仿宋
PdfFont
fsChinese
=
createFont
(
"simfang.ttf"
);
document
.
setFont
(
sfChinese
);
float
[]
columnWidths
=
{
20
f
,
20
f
,
20
f
,
40
f
};
Table
table
=
new
Table
(
columnWidths
);
table
.
setWidth
(
UnitValue
.
createPercentValue
(
100
));
// 设置单元格样式
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
for
(
int
j
=
0
;
j
<
4
;
j
++)
{
Cell
cell
=
new
Cell
();
cell
.
setHeight
(
40
f
);
cell
.
setBorder
(
new
SolidBorder
(
new
DeviceRgb
(
0
,
0
,
0
),
0.5f
));
cell
.
setTextAlignment
(
TextAlignment
.
CENTER
);
// 使用中文测试文本
cell
.
add
(
new
Paragraph
(
"单元格 "
+
(
i
+
1
)
+
"-"
+
(
j
+
1
)).
setFont
(
sfChinese
));
table
.
addCell
(
cell
);
}
}
// 添加表格到文档
document
.
add
(
table
);
// 关闭文档
document
.
close
();
return
baos
.
toByteArray
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
null
;
}
}
}
science-admin/src/main/java/com/yiboshi/science/utils/UniformBorderEvent.java
0 → 100644
View file @
903d8f40
package
com
.
yiboshi
.
science
.
utils
;
import
com.itextpdf.text.Rectangle
;
import
com.itextpdf.text.pdf.PdfContentByte
;
import
com.itextpdf.text.pdf.PdfPCell
;
import
com.itextpdf.text.pdf.PdfPCellEvent
;
import
com.itextpdf.text.pdf.PdfPTable
;
public
class
UniformBorderEvent
implements
PdfPCellEvent
{
@Override
public
void
cellLayout
(
PdfPCell
cell
,
Rectangle
position
,
PdfContentByte
[]
canvases
)
{
PdfContentByte
canvas
=
canvases
[
PdfPTable
.
LINECANVAS
];
canvas
.
setLineWidth
(
1
f
);
canvas
.
rectangle
(
position
.
getLeft
(),
position
.
getBottom
(),
position
.
getWidth
(),
position
.
getHeight
());
canvas
.
stroke
();
}
}
\ No newline at end of file
science-admin/src/main/java/com/yiboshi/science/utils/WordUtil.java
deleted
100644 → 0
View file @
d417aa48
package
com
.
yiboshi
.
science
.
utils
;
public
class
WordUtil
{
}
science-admin/src/main/java/com/yiboshi/science/utils/WordUtils.java
View file @
903d8f40
...
...
@@ -2,121 +2,32 @@ package com.yiboshi.science.utils;
import
freemarker.cache.ClassTemplateLoader
;
import
freemarker.template.Configuration
;
import
freemarker.template.Template
;
import
freemarker.template.TemplateException
;
import
org.springframework.core.io.ByteArrayResource
;
import
org.springframework.core.io.InputStreamSource
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.*
;
import
java.net.URLEncoder
;
import
java.nio.charset.StandardCharsets
;
import
java.util.Locale
;
import
freemarker.template.TemplateExceptionHandler
;
import
java.io.StringWriter
;
import
java.util.Map
;
public
class
WordUtils
{
public
void
export
(
Object
dataModel
,
HttpServletResponse
response
,
String
templateName
)
{
Configuration
configuration
=
new
Configuration
();
configuration
.
setDefaultEncoding
(
"utf-8"
);
configuration
.
setEncoding
(
Locale
.
getDefault
(),
"utf-8"
);
try
{
response
.
setContentType
(
"application/msword; charset=UTF-8"
);
// application/x-download
response
.
setHeader
(
"content-disposition"
,
"attachment;filename=document.doc"
);
response
.
setHeader
(
"Accept-Ranges"
,
"bytes"
);
// response.setHeader("Content-Disposition", "attachment; " + encodeFileName(request, fileName + ".doc"));
OutputStream
outputStream
=
response
.
getOutputStream
();
Writer
out
=
new
OutputStreamWriter
(
outputStream
);
configuration
.
setClassicCompatible
(
true
);
//处理dataModel中如果为null的情况
//既能保证本地运行找得到模板文件,又能保证jar包运行能找到得到模板文件
configuration
.
setClassForTemplateLoading
(
this
.
getClass
(),
"/template"
);
configuration
.
setTemplateLoader
(
new
ClassTemplateLoader
(
this
.
getClass
(),
"/template"
));
Template
template
=
configuration
.
getTemplate
(
templateName
,
"utf-8"
);
template
.
process
(
dataModel
,
out
);
outputStream
.
close
();
out
.
close
();
}
catch
(
IOException
|
TemplateException
e
)
{
e
.
printStackTrace
();
}
}
public
void
exportStream
(
HttpServletResponse
response
,
Object
dataModel
)
{
Configuration
configuration
=
new
Configuration
();
configuration
.
setDefaultEncoding
(
"utf-8"
);
configuration
.
setEncoding
(
Locale
.
getDefault
(),
"utf-8"
);
try
{
configuration
.
setClassicCompatible
(
true
);
//处理dataModel中如果为null的情况
//既能保证本地运行找得到模板文件,又能保证jar包运行能找到得到模板文件
configuration
.
setClassForTemplateLoading
(
this
.
getClass
(),
"/template"
);
configuration
.
setTemplateLoader
(
new
ClassTemplateLoader
(
this
.
getClass
(),
"/template"
));
Template
template
=
configuration
.
getTemplate
(
"word.ftl"
,
"utf-8"
);
InputStreamSource
file
=
createDoc
(
dataModel
,
template
);
InputStream
fin
=
file
.
getInputStream
();
ServletOutputStream
out
;
response
.
setContentType
(
"application/x-msdownload"
);
response
.
setHeader
(
"content-disposition"
,
"attachment;filename=document.doc"
);
response
.
setHeader
(
"Accept-Ranges"
,
"bytes"
);
out
=
response
.
getOutputStream
();
// 缓冲区
byte
[]
buffer
=
new
byte
[
1024
];
int
bytesToRead
;
while
((
bytesToRead
=
fin
.
read
(
buffer
))
!=
-
1
)
{
out
.
write
(
buffer
,
0
,
bytesToRead
);
}
out
.
flush
();
fin
.
close
();
}
catch
(
IOException
|
TemplateException
e
)
{
e
.
printStackTrace
();
}
}
public
static
InputStreamSource
createDoc
(
Object
dataModel
,
Template
template
)
throws
TemplateException
,
IOException
,
TemplateException
{
StringWriter
out1
=
new
StringWriter
();
Writer
out
=
new
BufferedWriter
(
out1
,
10240
);
//将数据输出到模板
template
.
process
(
dataModel
,
out
);
out
.
close
();
out1
.
close
();
return
new
ByteArrayResource
(
out1
.
toString
().
getBytes
(
StandardCharsets
.
UTF_8
));
}
public
String
encodeFileName
(
HttpServletRequest
request
,
String
fileName
)
throws
UnsupportedEncodingException
{
String
new_filename
=
URLEncoder
.
encode
(
fileName
,
"UTF8"
).
replaceAll
(
"\\+"
,
"%20"
);
String
agent
=
request
.
getHeader
(
"USER-AGENT"
).
toLowerCase
();
if
(
null
!=
agent
&&
-
1
!=
agent
.
indexOf
(
"msie"
))
{
/**
* IE浏览器,只能采用URLEncoder编码
*/
return
"filename=\""
+
new_filename
+
"\""
;
}
else
if
(
null
!=
agent
&&
-
1
!=
agent
.
indexOf
(
"applewebkit"
))
{
/**
* Chrome浏览器,只能采用ISO编码的中文输出
*/
return
"filename=\""
+
new
String
(
fileName
.
getBytes
(
"UTF-8"
),
"ISO8859-1"
)
+
"\""
;
}
else
if
(
null
!=
agent
&&
-
1
!=
agent
.
indexOf
(
"opera"
))
{
/**
* Opera浏览器只可以使用filename*的中文输出
* RFC2231规定的标准
*/
return
"filename*="
+
new_filename
;
}
else
if
(
null
!=
agent
&&
-
1
!=
agent
.
indexOf
(
"safari"
))
{
/**
* Safani浏览器,只能采用iso编码的中文输出
*/
return
"filename=\""
+
new
String
(
fileName
.
getBytes
(
"UTF-8"
),
"ISO8859-1"
)
+
"\""
;
}
else
if
(
null
!=
agent
&&
-
1
!=
agent
.
indexOf
(
"firefox"
))
{
/**
* Firfox浏览器,可以使用filename*的中文输出
* RFC2231规定的标准
*/
return
"filename*="
+
new_filename
;
}
else
{
return
"filename=\""
+
new_filename
+
"\""
;
}
/**
* 从模板文件生成Word
*
* @param outputPath 输出文件路径
* @throws Exception 转换异常
*/
public
static
void
getHtmlContent
(
Object
obj
,
String
outputPath
)
throws
Exception
{
Map
<
String
,
Object
>
data1
=
HtmlBuilder
.
obj2Map
(
obj
);
Configuration
cfg
=
new
Configuration
(
Configuration
.
DEFAULT_INCOMPATIBLE_IMPROVEMENTS
);
cfg
.
setDefaultEncoding
(
"utf-8"
);
cfg
.
setClassLoaderForTemplateLoading
(
PdfUtil
.
class
.
getClassLoader
(),
"template"
);
cfg
.
setTemplateLoader
(
new
ClassTemplateLoader
(
PdfUtil
.
class
.
getClassLoader
(),
"/template"
));
cfg
.
setTemplateExceptionHandler
(
TemplateExceptionHandler
.
RETHROW_HANDLER
);
// 获取模板
freemarker
.
template
.
Template
template
=
cfg
.
getTemplate
(
"tmp-task.html"
,
"utf-8"
);
// 处理模板,生成HTML内容
StringWriter
tmpText
=
new
StringWriter
();
template
.
process
(
data1
,
tmpText
);
String
htmlContent
=
tmpText
.
toString
();
}
}
science-admin/src/main/resources/mapper/ComExpertSpecDAO.xml
View file @
903d8f40
...
...
@@ -48,28 +48,24 @@
</foreach>
</if>
</select>
<select
id=
"getExpertListByExpertSpecIds"
resultType=
"com.yiboshi.science.param.dto.ComExpertDTO"
>
select distinct a.expert_id id,c.person_name,c.cert_id,c.sex,c.birthday,e.unit_name as work_unit
select distinct a.expert_id id,c.person_name,c.cert_id,c.sex,c.birthday,e.id unit_id,
(case when e.unit_name is null then c.work_unit else e.unit_name end) as work_unit
from com_expert_spec a
left join com_expert b on a.expert_id=b.id
left join com_person c on b.person_id=c.id
left join system_parameter d on a.spec_id=d.id
left join com_unit e on c.unit_id = e.id
<if
test=
' specIds != null '
>
where a.spec_id in
where b.id is not null
<if
test=
' specIds != null and specIds.size() > 0'
>
and a.spec_id in
<foreach
collection=
"specIds"
index=
"index"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
<if
test=
"parentIds != null"
>
where d.parent_id in
<foreach
collection=
"parentIds"
index=
"index"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
<if
test=
"personName != null"
>
where
c.person_name like CONCAT('%',#{personName},'%')
and
c.person_name like CONCAT('%',#{personName},'%')
</if>
</select>
<select
id=
"getExpertListByExpertSpecIdOrParentId"
resultType=
"com.yiboshi.science.param.dto.ComExpertDTO"
>
...
...
science-admin/src/main/resources/mapper/ComProjectGroupDetailDAO.xml
View file @
903d8f40
...
...
@@ -34,10 +34,25 @@
</select>
<select
id=
"getProjectListByGroupIds"
resultType=
"com.yiboshi.science.param.dto.ComProjectGroupDetailDTO"
>
select a.*, b.proj_no, b.proj_name, d.name as knowledge_name from com_project_group_detail a
select a.id, a.group_id, a.proj_id, a.remark, a.created, a.updated,
g.unit_name app_unit_name,h.person_name person_name,h.cert_id,
b.knowledge_id, b.proj_no, b.proj_name,b.app_unit_id,b.app_person_id, d.name as knowledge_name,
e.id pkey,e.parent_id ppkey
from com_project_group_detail a
left join com_project b on a.proj_id = b.id
left join com_unit g on b.app_unit_id=g.id
left join com_person h on b.app_person_id=h.id
left join system_parameter d on b.knowledge_id = d.id
left join system_parameter e on d.parent_id = e.id
left join system_parameter e on e.id=d.parent_id
where a.group_id in
<foreach
collection=
"groupIds"
index=
"index"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</select>
<select
id=
"getMembersListByGroupIds"
resultType=
"com.yiboshi.science.param.dto.ComProjectGroupDetailDTO"
>
SELECT b.name personName,b.cert_id,b.work_unit appUnitName
from com_project_group_detail a
left join com_project_members b on a.proj_id = b.object_id
where a.group_id in
<foreach
collection=
"groupIds"
index=
"index"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
...
...
science-admin/src/main/resources/template/tmp-task.html
View file @
903d8f40
...
...
@@ -10,19 +10,6 @@
margin
:
2cm
0
;
}
@media
print
{
.page
{
margin
:
0
;
border
:
initial
;
border-radius
:
initial
;
width
:
initial
;
min-height
:
initial
;
box-shadow
:
initial
;
background
:
initial
;
page-break-after
:
always
;
}
}
*
{
box-sizing
:
border-box
;
}
...
...
@@ -40,6 +27,7 @@
background-color
:
white
;
box-shadow
:
0
0
1px
rgba
(
0
,
0
,
0
,
0.1
);
padding
:
0
20mm
;
page-break-after
:
always
;
}
table
{
...
...
@@ -102,7 +90,7 @@
<span
style=
'font-size:16.0pt;font-weight:normal'
>
附件
<span>
4
</span></span>
</h1>
<p
class=
"MsoNormal"
style=
'margin-top:7.8pt;line-height:21.0pt'
>
<span>
</span>
<span></span>
</p>
<p
class=
"MsoNormal"
style=
'line-height:150%'
>
<span
style=
'font-size:16.0pt;line-height:100%;'
>
项目编号:
</span>
...
...
@@ -113,22 +101,22 @@
</u>
</p>
<p
class=
"MsoNormal"
style=
'text-align:left;line-height:150%;'
>
<span>
</span>
<span></span>
</p>
<p
class=
"MsoNormal"
style=
'text-align:left;line-height:150%;'
>
<span>
</span>
<span></span>
</p>
<p
class=
"MsoNormal"
style=
'text-align:left;line-height:150%;'
>
<span>
</span>
<span></span>
</p>
<p
class=
"MsoNormal"
style=
'text-align:center;'
>
<span
style=
'font-size:22.0pt;'
>
省级临床医学中心科研项目合同书
</span>
</p>
<p
class=
"MsoNormal"
style=
'font-size:16.0pt;text-align:left;line-height:150%;'
>
<span>
</span>
<span></span>
</p>
<p
class=
"MsoNormal"
style=
'font-size:16.0pt;text-align:left;line-height:150%;'
>
<span>
</span>
<span></span>
</p>
<table
class=
"head-tab"
>
<tr>
...
...
@@ -152,11 +140,11 @@
<td
colspan=
"2"
class=
"border-B"
>
${(startDate?string('yyyy年MM月dd日'))!}至 ${(endDate?string('yyyy年MM月dd日'))!}
</td>
</tr>
<tr>
<td
style=
"width: 90px;"
>
</td>
<td
style=
"width: 20px;"
>
</td>
<td
style=
"width: 20px;"
>
</td>
<td
style=
"width: 80px;"
>
</td>
<td>
</td>
<td
style=
"width: 90px;"
></td>
<td
style=
"width: 20px;"
></td>
<td
style=
"width: 20px;"
></td>
<td
style=
"width: 80px;"
></td>
<td></td>
</tr>
</table>
</div>
...
...
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