Commit 903d8f40 authored by wangxl's avatar wangxl

1

parent d417aa48
...@@ -123,12 +123,6 @@ ...@@ -123,12 +123,6 @@
<version>2.3.28</version> <version>2.3.28</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
<dependency> <dependency>
<groupId>cn.hutool</groupId> <groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId> <artifactId>hutool-all</artifactId>
...@@ -163,6 +157,7 @@ ...@@ -163,6 +157,7 @@
<artifactId>poi-tl</artifactId> <artifactId>poi-tl</artifactId>
<version>1.10.0</version> <version>1.10.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.poi</groupId> <groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId> <artifactId>poi</artifactId>
...@@ -180,6 +175,18 @@ ...@@ -180,6 +175,18 @@
<version>4.1.2</version> <version>4.1.2</version>
</dependency> </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> <dependency>
<groupId>commons-io</groupId> <groupId>commons-io</groupId>
<artifactId>commons-io</artifactId> <artifactId>commons-io</artifactId>
...@@ -218,6 +225,17 @@ ...@@ -218,6 +225,17 @@
<artifactId>spring-boot-starter-thymeleaf</artifactId> <artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency> </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 --> <!-- https://mvnrepository.com/artifact/com.itextpdf/itextpdf -->
<dependency> <dependency>
<groupId>com.itextpdf</groupId> <groupId>com.itextpdf</groupId>
...@@ -286,6 +304,28 @@ ...@@ -286,6 +304,28 @@
<scope>compile</scope> <scope>compile</scope>
</dependency> </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> <dependency>
<groupId>com.belerweb</groupId> <groupId>com.belerweb</groupId>
<artifactId>pinyin4j</artifactId> <artifactId>pinyin4j</artifactId>
......
...@@ -13,7 +13,7 @@ import org.apache.ibatis.annotations.Param; ...@@ -13,7 +13,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.List; 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); List<String> getIdListByExpertId(String expertId);
...@@ -23,7 +23,7 @@ public interface ComExpertSpecDAO extends BaseMapper<ComExpertSpec>, BaseDAO<Com ...@@ -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> 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);
} }
...@@ -22,4 +22,5 @@ public interface ComProjectGroupDetailDAO extends BaseMapper<ComProjectGroupDeta ...@@ -22,4 +22,5 @@ public interface ComProjectGroupDetailDAO extends BaseMapper<ComProjectGroupDeta
Page<ComProjectGroupDetailDTO> getProjectDetailListbyPage(Page<ComProjectGroupDetailQueryVO> page, @Param("ew") Wrapper<ComProjectGroupDetailQueryVO> queryWrapper); Page<ComProjectGroupDetailDTO> getProjectDetailListbyPage(Page<ComProjectGroupDetailQueryVO> page, @Param("ew") Wrapper<ComProjectGroupDetailQueryVO> queryWrapper);
List<ComProjectGroupDetailDTO> getProjectListByGroupIds(@Param("groupIds") List<String> groupList); List<ComProjectGroupDetailDTO> getProjectListByGroupIds(@Param("groupIds") List<String> groupList);
List<ComProjectGroupDetailDTO> getMembersListByGroupIds(@Param("groupIds") List<String> groupList);
} }
...@@ -16,8 +16,6 @@ import java.util.List; ...@@ -16,8 +16,6 @@ import java.util.List;
*/ */
public interface ComProjectMembersDAO extends BaseMapper<ComProjectMembers>, BaseDAO<ComProjectMembersQueryVO,ComProjectMembersDTO, ComProjectMembers> { public interface ComProjectMembersDAO extends BaseMapper<ComProjectMembers>, BaseDAO<ComProjectMembersQueryVO,ComProjectMembersDTO, ComProjectMembers> {
List<ComProjectMembersDTO> getListByObjectId(String objectId); List<ComProjectMembersDTO> getListByObjectId(String objectId);
ComProjectMembersDTO getMemCountById(String objectId); ComProjectMembersDTO getMemCountById(String objectId);
Integer getMemWorkCountByObjectId(String objectId); Integer getMemWorkCountByObjectId(String objectId);
} }
\ No newline at end of file
...@@ -53,30 +53,31 @@ public class ComProjectGroupDetailDTO extends BaseDTO { ...@@ -53,30 +53,31 @@ public class ComProjectGroupDetailDTO extends BaseDTO {
@ApiModelProperty(value = "学科", position = 6) @ApiModelProperty(value = "学科", position = 6)
private String knowledgeName; private String knowledgeName;
/** 证件号 */ /** 申报人Id */
@ApiModelProperty(value = "证件号", position = 2) @ApiModelProperty(value = "项目名称", position = 5)
private String certId; private String appPersonId;
/** 姓名 */ /** 姓名 */
@ApiModelProperty(value = "姓名", position = 4) @ApiModelProperty(value = "姓名", position = 4)
private String personName; private String personName;
/** 证件号 */
@ApiModelProperty(value = "证件号", position = 2)
private String certId;
/** 申报单位Id */ /** 申报单位Id */
@ApiModelProperty(value = "申报单位Id", position = 6) @ApiModelProperty(value = "申报单位Id", position = 6)
@Length(max=36, message = "申报单位Id不能大于36")
private String appUnitId; private String appUnitId;
/** 申报单位名称 */ /** 申报单位名称 */
@ApiModelProperty(value = "申报单位名称", position = 7) @ApiModelProperty(value = "申报单位名称", position = 7)
private String appUnitName; private String appUnitName;
/** key */
@ApiModelProperty(value = "key", position = 1)
@Length(max=36, message = "key不能大于36")
private String key; private String key;
private String title; private String title;
private String description; private String description;
private String pkey;
private String ppkey;
} }
...@@ -5,17 +5,18 @@ import com.yiboshi.arch.base.ResponseDataModel; ...@@ -5,17 +5,18 @@ import com.yiboshi.arch.base.ResponseDataModel;
import com.yiboshi.science.entity.ComExpertSpec; import com.yiboshi.science.entity.ComExpertSpec;
import com.yiboshi.science.entity.SelectListItem; import com.yiboshi.science.entity.SelectListItem;
import com.yiboshi.science.param.dto.ComExpertSpecDTO; 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.param.query.ComExpertSpecQueryVO;
import com.yiboshi.science.rest.BaseController; import com.yiboshi.science.rest.BaseController;
import com.yiboshi.science.service.ComExpertSpecService; 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.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Arrays; import java.util.*;
import java.util.List;
import java.util.Map;
@Api(tags = "com-expert-spec", description = "项目分配表") @Api(tags = "com-expert-spec", description = "项目分配表")
...@@ -25,10 +26,14 @@ public class ComExpertSpecController extends BaseController<ComExpertSpecService ...@@ -25,10 +26,14 @@ public class ComExpertSpecController extends BaseController<ComExpertSpecService
@Autowired @Autowired
private ComExpertSpecService comExpertSpecService; private ComExpertSpecService comExpertSpecService;
@ApiOperation(value = "根据类型参数列表", httpMethod = "GET", notes = "根据类型参数列表") @ApiOperation(value = "根据类型参数列表", httpMethod = "GET", notes = "根据类型参数列表")
@GetMapping @GetMapping
@RequestMapping("/getExpertListBySpecId") @RequestMapping("/getExpertListBySpecId")
public ResponseDataModel<List<SelectListItem>> getExpertListBySpecId(@RequestBody Map<String, Object> specId) { public ResponseDataModel<List<SelectListItem>> getExpertListBySpecId(@RequestBody Map<String, Object> specId) {
return ResponseDataModel.ok(comExpertSpecService.getExpertListBySpecId(specId)); return ResponseDataModel.ok(comExpertSpecService.getExpertListBySpecId(specId));
} }
...@@ -51,21 +56,8 @@ public class ComExpertSpecController extends BaseController<ComExpertSpecService ...@@ -51,21 +56,8 @@ public class ComExpertSpecController extends BaseController<ComExpertSpecService
@ApiOperation(value = "根据类型参数列表", httpMethod = "GET", notes = "根据类型参数列表") @ApiOperation(value = "根据类型参数列表", httpMethod = "GET", notes = "根据类型参数列表")
@GetMapping @GetMapping
@RequestMapping("/getExpertListByExpertSpecIds") @RequestMapping("/getExpertListByExpertSpecIds")
public ResponseDataModel<List<SelectListItem>> getExpertListByExpertSpecIds(String specIds, String parentIds, String personName) { public ResponseDataModel<List<SelectListItem>> getExpertListByExpertSpecIds(@RequestBody Map<String, Object> params) {
String[] split; return ResponseDataModel.ok(comExpertSpecService.getExpertListByExpertSpecIds((List<String>) params.get("specIds"),(List<String>) params.get("groupIds"), (String) params.get("personName")));
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));
} }
......
...@@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map;
@Api(tags = "com-project-group", description = "项目分组表") @Api(tags = "com-project-group", description = "项目分组表")
@RestController @RestController
...@@ -164,4 +165,13 @@ public class ComProjectGroupController extends BaseController<ComProjectGroupSer ...@@ -164,4 +165,13 @@ public class ComProjectGroupController extends BaseController<ComProjectGroupSer
else else
return ResponseDataModel.ok("项目组移除项目失败,请检查!"); 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));
}
} }
...@@ -39,7 +39,6 @@ public class ComProjectGroupDetailController extends BaseController<ComProjectGr ...@@ -39,7 +39,6 @@ public class ComProjectGroupDetailController extends BaseController<ComProjectGr
public ResponseDataModel<List<ComProjectGroupDetailDTO>> getProjectListByGroupIds(@RequestParam String groupIds) { public ResponseDataModel<List<ComProjectGroupDetailDTO>> getProjectListByGroupIds(@RequestParam String groupIds) {
String[] split = groupIds.split(","); String[] split = groupIds.split(",");
List<String> GroupList = Arrays.asList(split); List<String> GroupList = Arrays.asList(split);
List<ComProjectGroupDetailDTO> list = comProjectGroupDetailService.getProjectListByGroupIds(GroupList); List<ComProjectGroupDetailDTO> list = comProjectGroupDetailService.getProjectListByGroupIds(GroupList);
list.forEach(e -> { list.forEach(e -> {
e.setKey(e.getId()); e.setKey(e.getId());
......
...@@ -14,19 +14,20 @@ import com.yiboshi.science.param.dto.DataStatisticsDTO; ...@@ -14,19 +14,20 @@ import com.yiboshi.science.param.dto.DataStatisticsDTO;
import com.yiboshi.science.param.query.ComProjectTaskQueryVO; import com.yiboshi.science.param.query.ComProjectTaskQueryVO;
import com.yiboshi.science.rest.BaseController; import com.yiboshi.science.rest.BaseController;
import com.yiboshi.science.service.ComProjectTaskService; import com.yiboshi.science.service.ComProjectTaskService;
import com.yiboshi.science.utils.StringUtil; import com.yiboshi.science.utils.*;
import com.yiboshi.science.utils.TaskInfoToPDFUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 功能:任务书表 接口 * 功能:任务书表 接口
...@@ -42,6 +43,7 @@ public class ComProjectTaskController extends BaseController<ComProjectTaskServi ...@@ -42,6 +43,7 @@ public class ComProjectTaskController extends BaseController<ComProjectTaskServi
@Autowired @Autowired
private ComProjectTaskService ComProjectTaskService; private ComProjectTaskService ComProjectTaskService;
/** /**
* 功能:分页查询 * 功能:分页查询
* *
...@@ -146,9 +148,15 @@ public class ComProjectTaskController extends BaseController<ComProjectTaskServi ...@@ -146,9 +148,15 @@ public class ComProjectTaskController extends BaseController<ComProjectTaskServi
@PostMapping @PostMapping
public void export(@PathVariable String id) throws DocumentException, IOException { public void export(@PathVariable String id) throws DocumentException, IOException {
try { try {
ComProjectTaskDTO dto=ComProjectTaskService.getTaskByProjId(id);
ComProjectTaskDTO dto = ComProjectTaskService.getTaskByProjId(id);
// WordUtils.getHtmlContent(dto, "C:\\Users\\kylin\\Desktop\\导出Pdf\\output.docx");
// 生成PDF文件字节数组 // 生成PDF文件字节数组
byte[] pdfBytes = TaskInfoToPDFUtil.createContractPdf(ComProjectTaskService.getTaskByProjId(id)); byte[] pdfBytes = TaskToPDF.createContractPdf(dto);
// 设置响应头 // 设置响应头
response.setContentType("application/pdf"); response.setContentType("application/pdf");
String fileName = new String((dto.getProjName() + ".pdf").getBytes("UTF-8"), "ISO-8859-1"); String fileName = new String((dto.getProjName() + ".pdf").getBytes("UTF-8"), "ISO-8859-1");
......
...@@ -50,9 +50,9 @@ public interface ComExpertSpecService extends BaseService<ComExpertSpecQueryVO, ...@@ -50,9 +50,9 @@ public interface ComExpertSpecService extends BaseService<ComExpertSpecQueryVO,
List<SelectListItem> getExpertListBySpecIdProjId(List<String> SpecList, List<String> ProjList); List<SelectListItem> getExpertListBySpecIdProjId(List<String> SpecList, List<String> ProjList);
/** 根据 项目Id 获取专家列表 /** 根据 项目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获取专家列表 * 根据学科Id获取专家列表
......
...@@ -18,5 +18,6 @@ public interface ComProjectGroupDetailService extends BaseService<ComProjectGrou ...@@ -18,5 +18,6 @@ public interface ComProjectGroupDetailService extends BaseService<ComProjectGrou
Pagination<ComProjectGroupDetailDTO> getProjectDetailListbyPage(ComProjectGroupDetailQueryVO vo); 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);
} }
...@@ -9,6 +9,7 @@ import com.yiboshi.science.param.query.ComProjectAuditQueryVO; ...@@ -9,6 +9,7 @@ import com.yiboshi.science.param.query.ComProjectAuditQueryVO;
import com.yiboshi.science.param.query.ComProjectGroupQueryVO; import com.yiboshi.science.param.query.ComProjectGroupQueryVO;
import java.util.List; import java.util.List;
import java.util.Map;
public interface ComProjectGroupService extends BaseService<ComProjectGroupQueryVO, ComProjectGroupDTO, ComProjectGroup> { public interface ComProjectGroupService extends BaseService<ComProjectGroupQueryVO, ComProjectGroupDTO, ComProjectGroup> {
...@@ -45,4 +46,5 @@ public interface ComProjectGroupService extends BaseService<ComProjectGroupQuery ...@@ -45,4 +46,5 @@ public interface ComProjectGroupService extends BaseService<ComProjectGroupQuery
boolean deleteProjectGroupKnowledge(String groupId, String knowledgeId); boolean deleteProjectGroupKnowledge(String groupId, String knowledgeId);
boolean deleteProjectGroupDetail(String groupId, String knowledgeId); boolean deleteProjectGroupDetail(String groupId, String knowledgeId);
Map<String, Object> getGroupProjectInfo(List<String> groupIds);
} }
...@@ -20,6 +20,7 @@ public interface ComProjectMembersService extends BaseService<ComProjectMembersQ ...@@ -20,6 +20,7 @@ public interface ComProjectMembersService extends BaseService<ComProjectMembersQ
*/ */
List<ComProjectMembersDTO> getListByObjectId(String objectId); List<ComProjectMembersDTO> getListByObjectId(String objectId);
/**插入项目组成员 /**插入项目组成员
* *
* @param list * @param list
......
...@@ -9,8 +9,11 @@ import com.yiboshi.science.entity.SystemMenu; ...@@ -9,8 +9,11 @@ import com.yiboshi.science.entity.SystemMenu;
import com.yiboshi.science.entity.SelectListItem; import com.yiboshi.science.entity.SelectListItem;
import com.yiboshi.science.param.dto.ComExpertDTO; import com.yiboshi.science.param.dto.ComExpertDTO;
import com.yiboshi.science.param.dto.ComExpertSpecDTO; 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.param.query.ComExpertSpecQueryVO;
import com.yiboshi.science.service.ComExpertSpecService; 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 com.yiboshi.science.utils.AgeUtil;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -31,6 +34,9 @@ public class ComExpertSpecServiceImpl extends BaseServiceImpl<ComExpertSpecDAO, ...@@ -31,6 +34,9 @@ public class ComExpertSpecServiceImpl extends BaseServiceImpl<ComExpertSpecDAO,
@Autowired @Autowired
private ComExpertSpecDAO comExpertSpecDAO; private ComExpertSpecDAO comExpertSpecDAO;
@Autowired
private ComProjectGroupDetailService comProjectGroupDetailService;
@Override @Override
protected void setCriteriaForQuery(ComExpertSpecQueryVO vo, QueryWrapper<ComExpertSpecQueryVO> criteria) { protected void setCriteriaForQuery(ComExpertSpecQueryVO vo, QueryWrapper<ComExpertSpecQueryVO> criteria) {
if (Objects.nonNull(vo.getExpertId())) { if (Objects.nonNull(vo.getExpertId())) {
...@@ -113,17 +119,43 @@ public class ComExpertSpecServiceImpl extends BaseServiceImpl<ComExpertSpecDAO, ...@@ -113,17 +119,43 @@ public class ComExpertSpecServiceImpl extends BaseServiceImpl<ComExpertSpecDAO,
return allItem; return allItem;
} }
public List<SelectListItem> getExpertListByExpertSpecIds(List<String> SpecList, List<String> ParentList, String personName) { public List<SelectListItem> getExpertListByExpertSpecIds(List<String> specIds, List<String> groupIds, String personName) {
List<ComExpertDTO> list = comExpertSpecDAO.getExpertListByExpertSpecIds(SpecList, ParentList, personName); List<ComExpertDTO> list = new ArrayList<>();
List<SelectListItem> allItem = new ArrayList<>(); if ((specIds != null && specIds.size() > 0) || null != personName)
list = comExpertSpecDAO.getExpertListByExpertSpecIds(specIds, personName);
if (null != list && list.size() > 0) { 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) -> { list.forEach((e) -> {
boolean isDisabled = false;
String description = e.getSex() + "/" + AgeUtil.getResidentAge(e.getBirthday()) + "岁/" + e.getWorkUnit(); String description = e.getSex() + "/" + AgeUtil.getResidentAge(e.getBirthday()) + "岁/" + e.getWorkUnit();
SelectListItem treeListItem = new SelectListItem(e.getPersonName(), e.getId(), description, false, false, new ArrayList<>()); isDisabled = units.contains(e.getUnitId());
allItem.add(treeListItem); // 检查专家的证件号是否在 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) { public List<SelectListItem> getExpertListByExpertSpecIdOrParentId(String specId, String pkey, String ppkey, String personName) {
......
...@@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
...@@ -63,7 +64,17 @@ public class ComProjectGroupDetailServiceImpl extends BaseServiceImpl<ComProject ...@@ -63,7 +64,17 @@ public class ComProjectGroupDetailServiceImpl extends BaseServiceImpl<ComProject
return new Pagination<>(dtoList, page.getTotal(), vo.getPageSize()); return new Pagination<>(dtoList, page.getTotal(), vo.getPageSize());
} }
public List<ComProjectGroupDetailDTO> getProjectListByGroupIds(List<String> SpecList) { public List<ComProjectGroupDetailDTO> getProjectListByGroupIds(List<String> groupIds) {
return comProjectGroupDetailDAO.getProjectListByGroupIds(SpecList); 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<>();
} }
} }
...@@ -2,6 +2,7 @@ package com.yiboshi.science.service.impl; ...@@ -2,6 +2,7 @@ package com.yiboshi.science.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yiboshi.arch.base.ResponseDataModel;
import com.yiboshi.arch.exception.BusinessException; import com.yiboshi.arch.exception.BusinessException;
import com.yiboshi.science.base.BaseServiceImpl; import com.yiboshi.science.base.BaseServiceImpl;
import com.yiboshi.science.base.Pagination; import com.yiboshi.science.base.Pagination;
...@@ -17,9 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -17,9 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.Objects;
@Service @Service
@AllArgsConstructor @AllArgsConstructor
...@@ -48,6 +47,9 @@ public class ComProjectGroupServiceImpl extends BaseServiceImpl<ComProjectGroupD ...@@ -48,6 +47,9 @@ public class ComProjectGroupServiceImpl extends BaseServiceImpl<ComProjectGroupD
@Autowired @Autowired
private ComProjectAuditService comProjectAuditService; private ComProjectAuditService comProjectAuditService;
@Autowired
private ComProjectMembersService comProjectMembersService;
@Override @Override
protected void setCriteriaForQuery(ComProjectGroupQueryVO vo, QueryWrapper<ComProjectGroupQueryVO> criteria) { protected void setCriteriaForQuery(ComProjectGroupQueryVO vo, QueryWrapper<ComProjectGroupQueryVO> criteria) {
...@@ -149,7 +151,6 @@ public class ComProjectGroupServiceImpl extends BaseServiceImpl<ComProjectGroupD ...@@ -149,7 +151,6 @@ public class ComProjectGroupServiceImpl extends BaseServiceImpl<ComProjectGroupD
} }
public void CalculateGroupProjectCount(String groupId) { public void CalculateGroupProjectCount(String groupId) {
List<ComProjectGroupDetailDTO> list = comProjectGroupDetailService.getProjectDetailList(groupId); List<ComProjectGroupDetailDTO> list = comProjectGroupDetailService.getProjectDetailList(groupId);
ComProjectGroup model = new ComProjectGroup(); ComProjectGroup model = new ComProjectGroup();
...@@ -168,8 +169,7 @@ public class ComProjectGroupServiceImpl extends BaseServiceImpl<ComProjectGroupD ...@@ -168,8 +169,7 @@ public class ComProjectGroupServiceImpl extends BaseServiceImpl<ComProjectGroupD
if (null == list || list.size() == 0) { if (null == list || list.size() == 0) {
model.setExpertCount(0); model.setExpertCount(0);
model.setAssignState(0); model.setAssignState(0);
} } else {
else {
model.setExpertCount(list.size()); model.setExpertCount(list.size());
model.setAssignState(1); model.setAssignState(1);
} }
...@@ -423,6 +423,7 @@ public class ComProjectGroupServiceImpl extends BaseServiceImpl<ComProjectGroupD ...@@ -423,6 +423,7 @@ public class ComProjectGroupServiceImpl extends BaseServiceImpl<ComProjectGroupD
/** /**
* 项目专家分配 * 项目专家分配
*
* @param groupId * @param groupId
* @return * @return
*/ */
...@@ -461,6 +462,7 @@ public class ComProjectGroupServiceImpl extends BaseServiceImpl<ComProjectGroupD ...@@ -461,6 +462,7 @@ public class ComProjectGroupServiceImpl extends BaseServiceImpl<ComProjectGroupD
/** /**
* 项目二级学科统计 * 项目二级学科统计
*
* @param groupId * @param groupId
* @return * @return
*/ */
...@@ -468,5 +470,26 @@ public class ComProjectGroupServiceImpl extends BaseServiceImpl<ComProjectGroupD ...@@ -468,5 +470,26 @@ public class ComProjectGroupServiceImpl extends BaseServiceImpl<ComProjectGroupD
List<ComProjectKnowledgeStatisticDTO> list = comProjectGroupDAO.getProjectKnowledgeStatisticByGroupId(groupId); List<ComProjectKnowledgeStatisticDTO> list = comProjectGroupDAO.getProjectKnowledgeStatisticByGroupId(groupId);
return list; 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;
}
} }
...@@ -66,10 +66,6 @@ public class ComProjectMembersServiceImpl extends BaseServiceImpl<ComProjectMemb ...@@ -66,10 +66,6 @@ public class ComProjectMembersServiceImpl extends BaseServiceImpl<ComProjectMemb
@Override @Override
public List<ComProjectMembersDTO> getListByObjectId(String objectId) { public List<ComProjectMembersDTO> getListByObjectId(String objectId) {
List<ComProjectMembersDTO> list = comProjectMembersDAO.getListByObjectId(objectId); List<ComProjectMembersDTO> list = comProjectMembersDAO.getListByObjectId(objectId);
// if (null != list && list.size() > 0)
// list.forEach((e) -> {
// e.setCertId(hideAllIdCardNum(e.getCertId()));
// });
return list; return list;
} }
......
...@@ -962,58 +962,6 @@ public class ComProjectServiceImpl extends BaseServiceImpl<ComProjectDAO, ComPro ...@@ -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) { public void export(@PathVariable String id, HttpServletRequest request, HttpServletResponse response) {
String filename = System.currentTimeMillis() + ".pdf"; String filename = System.currentTimeMillis() + ".pdf";
response.reset(); response.reset();
......
...@@ -126,7 +126,7 @@ public class HtmlBuilder { ...@@ -126,7 +126,7 @@ public class HtmlBuilder {
* *
* @return 模板字符串 * @return 模板字符串
*/ */
public String getHtmlText(String templateName,Map<String, Object> map) { public String getHtmlText(String templateName,Map<String, Object> map) {
String htmlText = ""; String htmlText = "";
try { try {
// 通过指定模板名获取FreeMarker模板实例 // 通过指定模板名获取FreeMarker模板实例
......
...@@ -156,7 +156,9 @@ public class TaskInfoToPDFUtil { ...@@ -156,7 +156,9 @@ public class TaskInfoToPDFUtil {
table.setWidths(new float[]{80f, 80f, 30f, 60f, 60f, 80f, 30f, 100f}); table.setWidths(new float[]{80f, 80f, 30f, 60f, 60f, 80f, 30f, 100f});
table.setWidthPercentage(100); 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); addValueCell(table, "单位名称:", null, dto.getAppUnitName(), 7, normalFont, null, null, null);
...@@ -1035,11 +1037,13 @@ public class TaskInfoToPDFUtil { ...@@ -1035,11 +1037,13 @@ public class TaskInfoToPDFUtil {
valueCell.setRowspan(valueRowspan); valueCell.setRowspan(valueRowspan);
if (Objects.nonNull(valueColspan)) if (Objects.nonNull(valueColspan))
valueCell.setColspan(valueColspan); valueCell.setColspan(valueColspan);
valueCell.setCellEvent(new UniformBorderEvent());
valueCell.setPadding(5f); valueCell.setPadding(5f);
valueCell.setMinimumHeight(height); valueCell.setMinimumHeight(height);
valueCell.setVerticalAlignment(vertical); valueCell.setVerticalAlignment(vertical);
valueCell.setHorizontalAlignment(horizontal); valueCell.setHorizontalAlignment(horizontal);
valueCell.setBorderWidth(0.5f); // 设置边框宽度 valueCell.setBorderWidth(0.1f); // 设置边框宽度
valueCell.setBorderColor(new BaseColor(0, 0, 0));
table.addCell(valueCell); table.addCell(valueCell);
} }
......
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 = {20f, 20f, 20f, 40f};
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(40f);
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;
}
}
}
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(1f);
canvas.rectangle(position.getLeft(), position.getBottom(), position.getWidth(), position.getHeight());
canvas.stroke();
}
}
\ No newline at end of file
package com.yiboshi.science.utils;
public class WordUtil {
}
...@@ -2,121 +2,32 @@ package com.yiboshi.science.utils; ...@@ -2,121 +2,32 @@ package com.yiboshi.science.utils;
import freemarker.cache.ClassTemplateLoader; import freemarker.cache.ClassTemplateLoader;
import freemarker.template.Configuration; import freemarker.template.Configuration;
import freemarker.template.Template; import freemarker.template.TemplateExceptionHandler;
import freemarker.template.TemplateException; import java.io.StringWriter;
import org.springframework.core.io.ByteArrayResource; import java.util.Map;
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;
public class WordUtils { public class WordUtils {
public void export( Object dataModel,HttpServletResponse response,String templateName) { /**
Configuration configuration = new Configuration(); * 从模板文件生成Word
configuration.setDefaultEncoding("utf-8"); *
configuration.setEncoding(Locale.getDefault(), "utf-8"); * @param outputPath 输出文件路径
try { * @throws Exception 转换异常
response.setContentType("application/msword; charset=UTF-8");// application/x-download */
response.setHeader("content-disposition", "attachment;filename=document.doc"); public static void getHtmlContent(Object obj, String outputPath) throws Exception {
response.setHeader("Accept-Ranges", "bytes"); Map<String, Object> data1 = HtmlBuilder.obj2Map(obj);
// response.setHeader("Content-Disposition", "attachment; " + encodeFileName(request, fileName + ".doc")); Configuration cfg = new Configuration(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS);
OutputStream outputStream = response.getOutputStream(); cfg.setDefaultEncoding("utf-8");
Writer out = new OutputStreamWriter(outputStream); cfg.setClassLoaderForTemplateLoading(PdfUtil.class.getClassLoader(), "template");
cfg.setTemplateLoader(new ClassTemplateLoader(PdfUtil.class.getClassLoader(), "/template"));
configuration.setClassicCompatible(true);//处理dataModel中如果为null的情况 cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
//既能保证本地运行找得到模板文件,又能保证jar包运行能找到得到模板文件
configuration.setClassForTemplateLoading(this.getClass(), "/template"); // 获取模板
configuration.setTemplateLoader(new ClassTemplateLoader(this.getClass(), "/template")); freemarker.template.Template template = cfg.getTemplate("tmp-task.html", "utf-8");
Template template = configuration.getTemplate(templateName, "utf-8");
template.process(dataModel, out); // 处理模板,生成HTML内容
StringWriter tmpText = new StringWriter();
outputStream.close(); template.process(data1, tmpText);
out.close(); String htmlContent = tmpText.toString();
} 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 + "\"";
}
} }
} }
...@@ -48,28 +48,24 @@ ...@@ -48,28 +48,24 @@
</foreach> </foreach>
</if> </if>
</select> </select>
<select id="getExpertListByExpertSpecIds" resultType="com.yiboshi.science.param.dto.ComExpertDTO"> <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 from com_expert_spec a
left join com_expert b on a.expert_id=b.id left join com_expert b on a.expert_id=b.id
left join com_person c on b.person_id=c.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 system_parameter d on a.spec_id=d.id
left join com_unit e on c.unit_id = e.id left join com_unit e on c.unit_id = e.id
<if test=' specIds != null '> where b.id is not null
where a.spec_id in <if test=' specIds != null and specIds.size() &gt; 0'>
and a.spec_id in
<foreach collection="specIds" index="index" item="item" open="(" separator="," close=")"> <foreach collection="specIds" index="index" item="item" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
</if> </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"> <if test="personName != null">
where c.person_name like CONCAT('%',#{personName},'%') and c.person_name like CONCAT('%',#{personName},'%')
</if> </if>
</select> </select>
<select id="getExpertListByExpertSpecIdOrParentId" resultType="com.yiboshi.science.param.dto.ComExpertDTO"> <select id="getExpertListByExpertSpecIdOrParentId" resultType="com.yiboshi.science.param.dto.ComExpertDTO">
......
...@@ -34,10 +34,25 @@ ...@@ -34,10 +34,25 @@
</select> </select>
<select id="getProjectListByGroupIds" resultType="com.yiboshi.science.param.dto.ComProjectGroupDetailDTO"> <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_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 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 where a.group_id in
<foreach collection="groupIds" index="index" item="item" open="(" separator="," close=")"> <foreach collection="groupIds" index="index" item="item" open="(" separator="," close=")">
#{item} #{item}
......
...@@ -10,19 +10,6 @@ ...@@ -10,19 +10,6 @@
margin: 2cm 0; 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; box-sizing: border-box;
} }
...@@ -40,6 +27,7 @@ ...@@ -40,6 +27,7 @@
background-color: white; background-color: white;
box-shadow: 0 0 1px rgba(0, 0, 0, 0.1); box-shadow: 0 0 1px rgba(0, 0, 0, 0.1);
padding: 0 20mm; padding: 0 20mm;
page-break-after: always;
} }
table { table {
...@@ -102,7 +90,7 @@ ...@@ -102,7 +90,7 @@
<span style='font-size:16.0pt;font-weight:normal'>附件<span>4</span></span> <span style='font-size:16.0pt;font-weight:normal'>附件<span>4</span></span>
</h1> </h1>
<p class="MsoNormal" style='margin-top:7.8pt;line-height:21.0pt'> <p class="MsoNormal" style='margin-top:7.8pt;line-height:21.0pt'>
<span>&nbsp;</span> <span></span>
</p> </p>
<p class="MsoNormal" style='line-height:150%'> <p class="MsoNormal" style='line-height:150%'>
<span style='font-size:16.0pt;line-height:100%;'>项目编号:</span> <span style='font-size:16.0pt;line-height:100%;'>项目编号:</span>
...@@ -113,22 +101,22 @@ ...@@ -113,22 +101,22 @@
</u> </u>
</p> </p>
<p class="MsoNormal" style='text-align:left;line-height:150%;'> <p class="MsoNormal" style='text-align:left;line-height:150%;'>
<span>&nbsp;</span> <span></span>
</p> </p>
<p class="MsoNormal" style='text-align:left;line-height:150%;'> <p class="MsoNormal" style='text-align:left;line-height:150%;'>
<span>&nbsp;</span> <span></span>
</p> </p>
<p class="MsoNormal" style='text-align:left;line-height:150%;'> <p class="MsoNormal" style='text-align:left;line-height:150%;'>
<span>&nbsp;</span> <span></span>
</p> </p>
<p class="MsoNormal" style='text-align:center;'> <p class="MsoNormal" style='text-align:center;'>
<span style='font-size:22.0pt;'>省级临床医学中心科研项目合同书</span> <span style='font-size:22.0pt;'>省级临床医学中心科研项目合同书</span>
</p> </p>
<p class="MsoNormal" style='font-size:16.0pt;text-align:left;line-height:150%;'> <p class="MsoNormal" style='font-size:16.0pt;text-align:left;line-height:150%;'>
<span>&nbsp;</span> <span></span>
</p> </p>
<p class="MsoNormal" style='font-size:16.0pt;text-align:left;line-height:150%;'> <p class="MsoNormal" style='font-size:16.0pt;text-align:left;line-height:150%;'>
<span>&nbsp;</span> <span></span>
</p> </p>
<table class="head-tab"> <table class="head-tab">
<tr> <tr>
...@@ -152,11 +140,11 @@ ...@@ -152,11 +140,11 @@
<td colspan="2" class="border-B">${(startDate?string('yyyy年MM月dd日'))!}至 ${(endDate?string('yyyy年MM月dd日'))!}</td> <td colspan="2" class="border-B">${(startDate?string('yyyy年MM月dd日'))!}至 ${(endDate?string('yyyy年MM月dd日'))!}</td>
</tr> </tr>
<tr> <tr>
<td style="width: 90px;">&nbsp;</td> <td style="width: 90px;"></td>
<td style="width: 20px;">&nbsp;</td> <td style="width: 20px;"></td>
<td style="width: 20px;">&nbsp;</td> <td style="width: 20px;"></td>
<td style="width: 80px;">&nbsp;</td> <td style="width: 80px;"></td>
<td>&nbsp;</td> <td></td>
</tr> </tr>
</table> </table>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment