|
@@ -0,0 +1,1407 @@
|
|
|
+package com.jpsoft.ipcps.controller;
|
|
|
+
|
|
|
+import com.github.pagehelper.Page;
|
|
|
+import com.jpsoft.ipcps.common.PojoUtils;
|
|
|
+import com.jpsoft.ipcps.common.Sort;
|
|
|
+import com.jpsoft.ipcps.dto.MessageResult;
|
|
|
+import com.jpsoft.ipcps.entity.*;
|
|
|
+import com.jpsoft.ipcps.service.*;
|
|
|
+import com.jpsoft.ipcps.utils.FileUtils;
|
|
|
+import com.jpsoft.ipcps.utils.ServerConfig;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.apache.poi.ss.usermodel.*;
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.util.ResourceUtils;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.io.*;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/project")
|
|
|
+public class ProjectController {
|
|
|
+ private Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ProjectService projectService;
|
|
|
+ @Autowired
|
|
|
+ private ProjectFileService projectFileService;
|
|
|
+ @Autowired
|
|
|
+ private ServerConfig serverConfig;
|
|
|
+ @Autowired
|
|
|
+ private JpAdminService jpAdminService;
|
|
|
+ @Autowired
|
|
|
+ private AdminRoleService adminRoleService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ProjectTaskService projectTaskService;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value="添加信息")
|
|
|
+ @PostMapping("add")
|
|
|
+ public MessageResult<Project> add(@ModelAttribute Project project,@RequestAttribute String subject,HttpServletRequest req) {
|
|
|
+ MessageResult<Project> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ if(StringUtils.isEmpty(project.getTownshipAdminId())){
|
|
|
+ project.setTownshipAdminId(null);
|
|
|
+ }
|
|
|
+
|
|
|
+ project.setProjectId(UUID.randomUUID().toString());
|
|
|
+ project.setDelFlag(false);
|
|
|
+ project.setCreateBy(subject);
|
|
|
+ project.setCreateDate(new Date());
|
|
|
+ //字段太长保存报错,先取出赋空值
|
|
|
+ String files = project.getFileUrls();
|
|
|
+ project.setFileUrls(null);
|
|
|
+ int affectCount = projectService.insert(project);
|
|
|
+ if (affectCount > 0) {
|
|
|
+ if(StringUtils.isNotBlank(files)){
|
|
|
+ String [] fileUrls = files.split("\\*");
|
|
|
+ for (String fileUrl : fileUrls){
|
|
|
+ String [] url = fileUrl.split("\\?");
|
|
|
+ String ext = url[1].substring(url[1].lastIndexOf(".")+1);
|
|
|
+ ProjectFile projectFile = new ProjectFile();
|
|
|
+ projectFile.setFileId(UUID.randomUUID().toString());
|
|
|
+ projectFile.setProjectId(project.getProjectId());
|
|
|
+ projectFile.setFileName(url[0]);
|
|
|
+ projectFile.setFileAddress(url[1]);
|
|
|
+ projectFile.setFileType(ext.toUpperCase());//文件后缀 转大写
|
|
|
+ projectFile.setDelFlag(false);
|
|
|
+ projectFile.setCreateBy(subject);
|
|
|
+ projectFile.setCreateDate(new Date());
|
|
|
+ projectFile.setFileSource("project");//文件来源
|
|
|
+ projectFileService.insert(projectFile);
|
|
|
+ }
|
|
|
+ }
|
|
|
+// if (uploadFile != null && uploadFile.length > 0) {
|
|
|
+// for (int i = 0; i < uploadFile.length; i++) {
|
|
|
+// MultipartFile file = uploadFile[i];
|
|
|
+// String[] ret = FileUtils.saveFile(serverConfig,file,"/project", req);
|
|
|
+// if (StringUtils.isBlank(ret[1])) {
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// String ext = ret[1].substring(ret[1].lastIndexOf(".")+1);
|
|
|
+// ProjectFile projectFile = new ProjectFile();
|
|
|
+// projectFile.setFileId(UUID.randomUUID().toString());
|
|
|
+// projectFile.setProjectId(project.getProjectId());
|
|
|
+// projectFile.setFileName(ret[0]);
|
|
|
+// projectFile.setFileAddress(ret[1]);
|
|
|
+// projectFile.setFileType(ext.toUpperCase());//文件后缀 转大写
|
|
|
+// projectFile.setDelFlag(false);
|
|
|
+// projectFile.setCreateBy(subject);
|
|
|
+// projectFile.setCreateDate(new Date());
|
|
|
+// projectFile.setFileSource("project");//文件来源
|
|
|
+// projectFileService.insert(projectFile);
|
|
|
+// }
|
|
|
+// }
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(project);
|
|
|
+ } else {
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage("数据库添加失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="获取信息")
|
|
|
+ @GetMapping("detail/{id}")
|
|
|
+ public MessageResult<Project> detail(@PathVariable("id") String id){
|
|
|
+ MessageResult<Project> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ Project project = projectService.get(id);
|
|
|
+ Map<String,Object> searchParms = new HashMap<>();
|
|
|
+ searchParms.put("projectId",project.getProjectId());
|
|
|
+ searchParms.put("fileSource","project");
|
|
|
+ searchParms.put("delFlag","0");
|
|
|
+
|
|
|
+ List<ProjectFile> lstFile = projectFileService.list(searchParms);
|
|
|
+ List<ProjectFile> lstRealFile = new ArrayList<ProjectFile>();
|
|
|
+ for(ProjectFile pf : lstFile){
|
|
|
+ lstRealFile.add(pf);
|
|
|
+ }
|
|
|
+ project.setPfList(lstRealFile);
|
|
|
+
|
|
|
+ String townshipAdminId = project.getTownshipAdminId();
|
|
|
+ if(StringUtils.isNotEmpty(townshipAdminId)) {
|
|
|
+ String[] townIds = townshipAdminId.split(",");
|
|
|
+ String townNames = "";
|
|
|
+ String townIdsNew = "";
|
|
|
+ for (String townId : townIds) {
|
|
|
+ JpAdmin jpAdmin = jpAdminService.get(townId);
|
|
|
+ if(jpAdmin != null) {
|
|
|
+ townNames = townNames + jpAdmin.getRealName() + ",";
|
|
|
+ townIdsNew = townIdsNew + jpAdmin.getId() + ",";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ project.setTownshipAdminId(townIdsNew);
|
|
|
+ project.setTownshipAdminName(townNames);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (project != null) {
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(project);
|
|
|
+ } else {
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage("数据库不存在该记录!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value="更新用户")
|
|
|
+ @PostMapping("update")
|
|
|
+ public MessageResult<Project> update(@ModelAttribute Project project,@RequestAttribute String subject,HttpServletRequest req) {
|
|
|
+ MessageResult<Project> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ if(StringUtils.isEmpty(project.getTownshipAdminId())){
|
|
|
+ project.setTownshipAdminId(null);
|
|
|
+ }
|
|
|
+
|
|
|
+ project.setUpdateBy(subject);
|
|
|
+ project.setUpdateDate(new Date());
|
|
|
+ if(StringUtils.isNotBlank(project.getFileUrls())){
|
|
|
+ String [] fileUrls = project.getFileUrls().split("\\*");
|
|
|
+ for (String fileUrl : fileUrls){
|
|
|
+ String [] url = fileUrl.split("\\?");
|
|
|
+ String ext = url[1].substring(url[1].lastIndexOf(".")+1);
|
|
|
+ ProjectFile projectFile = new ProjectFile();
|
|
|
+ projectFile.setFileId(UUID.randomUUID().toString());
|
|
|
+ projectFile.setProjectId(project.getProjectId());
|
|
|
+ projectFile.setFileName(url[0]);
|
|
|
+ projectFile.setFileAddress(url[1]);
|
|
|
+ projectFile.setFileType(ext.toUpperCase());//文件后缀 转大写
|
|
|
+ projectFile.setDelFlag(false);
|
|
|
+ projectFile.setCreateBy(subject);
|
|
|
+ projectFile.setCreateDate(new Date());
|
|
|
+ projectFile.setFileSource("project");//文件来源
|
|
|
+ projectFileService.insert(projectFile);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+// if (uploadFile != null && uploadFile.length > 0) {
|
|
|
+// //先删除
|
|
|
+// Map<String,Object> searchParms = new HashMap<>();
|
|
|
+// if (StringUtils.isNotEmpty(project.getProjectId())) {
|
|
|
+// searchParms.put("projectId",project.getProjectId());
|
|
|
+// }
|
|
|
+// searchParms.put("fileSource","project");
|
|
|
+// searchParms.put("delFlag","0");
|
|
|
+// List<ProjectFile> pfList = projectFileService.list(searchParms);
|
|
|
+// for(ProjectFile pf : pfList){
|
|
|
+// pf.setDelFlag(true);
|
|
|
+// projectFileService.update(pf);
|
|
|
+// }
|
|
|
+// for (int i = 0; i < uploadFile.length; i++) {
|
|
|
+// MultipartFile file = uploadFile[i];
|
|
|
+// String[] ret = FileUtils.saveFile(serverConfig,file,"/project", req);
|
|
|
+// if (StringUtils.isBlank(ret[1])) {
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// String ext = ret[1].substring(ret[1].lastIndexOf(".")+1);
|
|
|
+// ProjectFile projectFile = new ProjectFile();
|
|
|
+// projectFile.setFileId(UUID.randomUUID().toString());
|
|
|
+// projectFile.setProjectId(project.getProjectId());
|
|
|
+// projectFile.setFileName(ret[0]);
|
|
|
+// projectFile.setFileAddress(ret[1]);
|
|
|
+// projectFile.setFileType(ext.toUpperCase());//文件后缀 转大写
|
|
|
+// projectFile.setDelFlag(false);
|
|
|
+// projectFile.setCreateBy(subject);
|
|
|
+// projectFile.setCreateDate(new Date());
|
|
|
+// projectFile.setFileSource("project");//文件来源
|
|
|
+// projectFileService.insert(projectFile);
|
|
|
+// }
|
|
|
+// }
|
|
|
+ String townId = project.getTownshipAdminId();
|
|
|
+ if(townId == null){
|
|
|
+ project.setTownshipAdminId("");
|
|
|
+ }else{
|
|
|
+ if (townId.endsWith(",")) {
|
|
|
+ townId = townId.substring(0,townId.length() - 1);
|
|
|
+ project.setTownshipAdminId(townId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ int affectCount = projectService.update(project);
|
|
|
+
|
|
|
+ if (affectCount > 0) {
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(project);
|
|
|
+ } else {
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage("数据库更新失败");
|
|
|
+ }
|
|
|
+ }catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(), ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "删除用户-通用")
|
|
|
+ @PostMapping("delete/{id}")
|
|
|
+ public MessageResult<Project> delete (@PathVariable("id") String id){
|
|
|
+ MessageResult<Project> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ //int affectCount = projectService.delete(id);
|
|
|
+ Project project = projectService.get(id);
|
|
|
+ project.setDelFlag(true);
|
|
|
+ int affectCount = projectService.update(project);
|
|
|
+
|
|
|
+ if (affectCount > 0) {
|
|
|
+ msgResult.setResult(true);
|
|
|
+ } else {
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage("数据库删除失败");
|
|
|
+ }
|
|
|
+ } catch (Exception ex) {
|
|
|
+ logger.error(ex.getMessage(), ex);
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value = "批量删除-通用")
|
|
|
+ @PostMapping("batchDelete")
|
|
|
+ public MessageResult<Project> batchDelete (@RequestParam(value = "ids", defaultValue = "") String ids){
|
|
|
+ MessageResult<Project> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try{
|
|
|
+ String[] arr = ids.split(",");
|
|
|
+ for(String id : arr){
|
|
|
+ Project project = projectService.get(id);
|
|
|
+ project.setDelFlag(true);
|
|
|
+ projectService.update(project);
|
|
|
+ }
|
|
|
+ msgResult.setResult(true);
|
|
|
+ }catch (Exception ex) {
|
|
|
+ logger.error(ex.getMessage(), ex);
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "列表-手机页面")
|
|
|
+ @RequestMapping(value = "list", method = RequestMethod.POST)
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "projectName", paramType = "query", value = "项目名称"),
|
|
|
+ @ApiImplicitParam(name = "startTime", paramType = "query", value = "开始时间"),
|
|
|
+ @ApiImplicitParam(name = "endTime", paramType = "query", value = "结束时间"),
|
|
|
+ @ApiImplicitParam(name = "status", paramType = "query", value = "流程当前步骤状态"),
|
|
|
+ @ApiImplicitParam(name = "isStart", paramType = "query", value = "是否已开启流程"),
|
|
|
+ @ApiImplicitParam(name = "procDefKey", paramType = "query", value = "流程定义key"),
|
|
|
+ @ApiImplicitParam(name = "roleId", paramType = "query", value = "角色ID"),
|
|
|
+ @ApiImplicitParam(name = "parkId", paramType = "query", value = "园区ID")
|
|
|
+ })
|
|
|
+ public MessageResult<Map> list (
|
|
|
+ @RequestParam(value = "projectName", defaultValue = "") String projectName,
|
|
|
+ @RequestParam(value = "startTime", defaultValue = "") String startTime,
|
|
|
+ @RequestParam(value = "endTime", defaultValue = "") String endTime,
|
|
|
+ @RequestParam(value = "procDefKey", defaultValue = "") String procDefKey,
|
|
|
+ @RequestParam(value = "parkId", defaultValue = "") String parkId,
|
|
|
+ @RequestParam(value = "isStart", defaultValue = "false") boolean isStart,
|
|
|
+ @RequestParam(value = "status", defaultValue = "") String status,
|
|
|
+ @RequestParam(value = "start", defaultValue = "0") int start,
|
|
|
+ @RequestParam(value = "length", defaultValue = "20") int length,
|
|
|
+ @RequestParam(value = "roleId", defaultValue = "") String roleId,
|
|
|
+ @RequestAttribute String subject,
|
|
|
+ HttpServletRequest request){
|
|
|
+ //当前用户ID
|
|
|
+ System.out.println(subject);
|
|
|
+
|
|
|
+ MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ Map<String, Object> searchParms = new HashMap<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("create_date_", "desc"));
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(projectName)) {
|
|
|
+ //标题
|
|
|
+ searchParms.put("projectName", "%" + projectName + "%");
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(startTime)) {
|
|
|
+ //起始时间-起
|
|
|
+ searchParms.put("startTime", startTime);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(endTime)) {
|
|
|
+ //起始时间-止
|
|
|
+ searchParms.put("endTime", endTime);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(procDefKey)) {
|
|
|
+ //项目进度
|
|
|
+ searchParms.put("procDefKey", procDefKey);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(status)) {
|
|
|
+ if("-1".equals(status)){
|
|
|
+ //未发起流程
|
|
|
+ searchParms.put("isNotStart", status);
|
|
|
+ }else if("0".equals(status)){
|
|
|
+ searchParms.put("isStart", status);//流程不为空
|
|
|
+ searchParms.put("statusNull", status);//状态为null
|
|
|
+ }else {
|
|
|
+ searchParms.put("status", status);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(parkId)) {
|
|
|
+ //园区ID
|
|
|
+ searchParms.put("parkId", parkId);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isStart) {
|
|
|
+ //是否启动
|
|
|
+ searchParms.put("isStart", isStart);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isEmpty(roleId)){
|
|
|
+ //用户IDZLD
|
|
|
+ JpAdmin queryUser = jpAdminService.get(subject);
|
|
|
+
|
|
|
+ //List<AdminRole> roleList = queryUser.getAdminRoleList();
|
|
|
+ List<AdminRole> roleList = adminRoleService.listByAdminId(subject);
|
|
|
+
|
|
|
+ if(roleList!=null && roleList.size()>0){
|
|
|
+ roleId = roleList.get(0).getRoleId();
|
|
|
+ }
|
|
|
+ else if(StringUtils.isNotEmpty(queryUser.getRoleId())){
|
|
|
+ roleId = queryUser.getRoleId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //根据用户和角色查询
|
|
|
+ AdminRole adminRole = adminRoleService.findByAIdAndRId(subject,roleId);
|
|
|
+ //Role role = roleService.get(roleId);
|
|
|
+ if (adminRole != null) {
|
|
|
+ if ("XMF".equals(adminRole.getRoleName())) {
|
|
|
+ searchParms.put("XMF", subject);
|
|
|
+ } else if ("QYMS".equals(adminRole.getRoleName())) {
|
|
|
+ searchParms.put("QYMS", subject);
|
|
|
+ } else if ("BLLD".equals(adminRole.getRoleName())) {
|
|
|
+ searchParms.put("BLLD", subject);
|
|
|
+ } else if ("YQB".equals(adminRole.getRoleName())) {
|
|
|
+ //园区办 YQB
|
|
|
+ searchParms.put("YQB", subject);
|
|
|
+ } else if ("SYSADMIN".equals(adminRole.getRoleName())) {
|
|
|
+ //项目管理员查全部
|
|
|
+ } else if ("ZLD".equals(adminRole.getRoleName())) {
|
|
|
+ //总领导查全部
|
|
|
+ } else if ("TZCJZX".equals(adminRole.getRoleName())) {
|
|
|
+ //CXQBXM查全部
|
|
|
+ } else {
|
|
|
+ //否则都不能看到
|
|
|
+ searchParms.put("XMF", "NO");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //否则都不能看到
|
|
|
+ searchParms.put("XMF", "NO");
|
|
|
+ }
|
|
|
+
|
|
|
+ //未删除条件
|
|
|
+ searchParms.put("delFlag", "0");
|
|
|
+
|
|
|
+ int pageNum = start / length;
|
|
|
+ pageNum++;
|
|
|
+ int pageSize = length;
|
|
|
+
|
|
|
+ Page<Project> page = projectService.pageSearch(searchParms, pageNum, pageSize, sortList);
|
|
|
+ List<Project> lstProject = new ArrayList<>();
|
|
|
+ for(Project project : page.getResult()){
|
|
|
+ //查询项目异常状态
|
|
|
+ Integer count = projectTaskService.warningCountByProjectId(project.getProjectId());
|
|
|
+ project.setWarningCount(count);
|
|
|
+
|
|
|
+ String townshipAdminId = project.getTownshipAdminId();
|
|
|
+ if(StringUtils.isNotEmpty(townshipAdminId)) {
|
|
|
+ String[] townIds = townshipAdminId.split(",");
|
|
|
+ String townNames = "";
|
|
|
+ String townIdsNew = "";
|
|
|
+ for (String townId : townIds) {
|
|
|
+ JpAdmin jpAdmin = jpAdminService.get(townId);
|
|
|
+
|
|
|
+ if(townNames.length()>0){
|
|
|
+ townNames += ",";
|
|
|
+ townIdsNew += ",";
|
|
|
+ }
|
|
|
+
|
|
|
+ if(jpAdmin != null) {
|
|
|
+ townNames += jpAdmin.getRealName();
|
|
|
+ townIdsNew += jpAdmin.getId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ project.setTownshipAdminId(townIdsNew);
|
|
|
+ project.setTownshipAdminName(townNames);
|
|
|
+ }
|
|
|
+
|
|
|
+ lstProject.add(project);
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String,Object> pageMap = new HashMap<>();
|
|
|
+ pageMap.put("recordsTotal",page.getTotal());
|
|
|
+ pageMap.put("recordsFiltered",page.getTotal());
|
|
|
+ pageMap.put("totalPage",page.getPages());
|
|
|
+ pageMap.put("pageNumber",page.getPageNum());
|
|
|
+ pageMap.put("pageSize",page.getPageSize());
|
|
|
+ pageMap.put("data", lstProject);
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(pageMap);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ logger.error(ex.getMessage(), ex);
|
|
|
+ msgResult.setResult(false);
|
|
|
+ }
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "列表-后台")
|
|
|
+ @RequestMapping(value = "projectList", method = RequestMethod.POST)
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "projectName", paramType = "query", value = "项目名称"),
|
|
|
+ @ApiImplicitParam(name = "startTime", paramType = "query", value = "开始时间"),
|
|
|
+ @ApiImplicitParam(name = "endTime", paramType = "query", value = "结束时间"),
|
|
|
+ @ApiImplicitParam(name = "status", paramType = "query", value = "流程当前步骤状态"),
|
|
|
+ @ApiImplicitParam(name = "isStart", paramType = "query", value = "是否已开启流程"),
|
|
|
+ @ApiImplicitParam(name = "procDefKey", paramType = "query", value = "流程定义key"),
|
|
|
+ @ApiImplicitParam(name = "roleId", paramType = "query", value = "角色ID"),
|
|
|
+ @ApiImplicitParam(name = "parkId", paramType = "query", value = "园区ID")
|
|
|
+ })
|
|
|
+ public MessageResult<Map> projectList (
|
|
|
+ @RequestParam(value = "projectName", defaultValue = "") String projectName,
|
|
|
+ @RequestParam(value = "startTime", defaultValue = "") String startTime,
|
|
|
+ @RequestParam(value = "endTime", defaultValue = "") String endTime,
|
|
|
+ @RequestParam(value = "procDefKey", defaultValue = "") String procDefKey,
|
|
|
+ @RequestParam(value = "parkId", defaultValue = "") String parkId,
|
|
|
+ @RequestParam(value = "isStart", defaultValue = "false") boolean isStart,
|
|
|
+ @RequestParam(value = "status", defaultValue = "") String status,
|
|
|
+ @RequestParam(value = "start", defaultValue = "0") int start,
|
|
|
+ @RequestParam(value = "length", defaultValue = "20") int length,
|
|
|
+ @RequestParam(value = "roleId", defaultValue = "") String roleId,
|
|
|
+ @RequestAttribute String subject,
|
|
|
+ HttpServletRequest request){
|
|
|
+ //当前用户ID
|
|
|
+ System.out.println(subject);
|
|
|
+
|
|
|
+ MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ Map<String, Object> searchParms = new HashMap<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("create_date_", "desc"));
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(projectName)) {
|
|
|
+ //标题
|
|
|
+ searchParms.put("projectName", "%" + projectName + "%");
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(startTime)) {
|
|
|
+ //起始时间-起
|
|
|
+ searchParms.put("startTime", startTime);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(endTime)) {
|
|
|
+ //起始时间-止
|
|
|
+ searchParms.put("endTime", endTime);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(procDefKey)) {
|
|
|
+ //项目进度
|
|
|
+ searchParms.put("procDefKey", procDefKey);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(status)) {
|
|
|
+ if("-1".equals(status)){
|
|
|
+ //未发起流程
|
|
|
+ searchParms.put("isNotStart", status);
|
|
|
+ }else if("0".equals(status)){
|
|
|
+ searchParms.put("isStart", status);//流程不为空
|
|
|
+ searchParms.put("statusNull", status);//状态为null
|
|
|
+ }else {
|
|
|
+ searchParms.put("status", status);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(parkId)) {
|
|
|
+ //园区ID
|
|
|
+ searchParms.put("parkId", parkId);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isStart) {
|
|
|
+ //是否启动
|
|
|
+ searchParms.put("isStart", isStart);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isEmpty(roleId)){
|
|
|
+ //用户IDZLD
|
|
|
+ JpAdmin queryUser = jpAdminService.get(subject);
|
|
|
+
|
|
|
+ //List<AdminRole> roleList = queryUser.getAdminRoleList();
|
|
|
+ List<AdminRole> roleList = adminRoleService.listByAdminId(subject);
|
|
|
+
|
|
|
+ if(roleList!=null && roleList.size()>0){
|
|
|
+ roleId = roleList.get(0).getRoleId();
|
|
|
+ }
|
|
|
+ else if(StringUtils.isNotEmpty(queryUser.getRoleId())){
|
|
|
+ roleId = queryUser.getRoleId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //根据用户和角色查询
|
|
|
+ AdminRole adminRole = adminRoleService.findByAIdAndRId(subject,roleId);
|
|
|
+
|
|
|
+ int count1 = adminRoleService.findCountByAIdAndRName(subject,"SYSADMIN");
|
|
|
+ int count2 = adminRoleService.findCountByAIdAndRName(subject,"ZLD");
|
|
|
+ int count3 = adminRoleService.findCountByAIdAndRName(subject,"TZCJZX");
|
|
|
+ if(count1 > 0){
|
|
|
+ //查全部
|
|
|
+ }else if(count2 > 0){
|
|
|
+ //查全部
|
|
|
+ }else if(count3 > 0){
|
|
|
+ //查全部
|
|
|
+ }else {
|
|
|
+ //Role role = roleService.get(roleId);
|
|
|
+ if (adminRole != null) {
|
|
|
+ if ("XMF".equals(adminRole.getRoleName())) {
|
|
|
+ searchParms.put("XMF", subject);
|
|
|
+ } else if ("QYMS".equals(adminRole.getRoleName())) {
|
|
|
+ searchParms.put("QYMS", subject);
|
|
|
+ } else if ("BLLD".equals(adminRole.getRoleName())) {
|
|
|
+ searchParms.put("BLLD", subject);
|
|
|
+ } else if ("YQB".equals(adminRole.getRoleName())) {
|
|
|
+ //园区办 YQB
|
|
|
+ searchParms.put("YQB", subject);
|
|
|
+ } else if ("SYSADMIN".equals(adminRole.getRoleName())) {
|
|
|
+ //项目管理员查全部
|
|
|
+ } else if ("ZLD".equals(adminRole.getRoleName())) {
|
|
|
+ //总领导查全部
|
|
|
+ } else if ("TZCJZX".equals(adminRole.getRoleName())) {
|
|
|
+ //CXQBXM查全部
|
|
|
+ } else {
|
|
|
+ //否则都不能看到
|
|
|
+ searchParms.put("XMF", "NO");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //否则都不能看到
|
|
|
+ searchParms.put("XMF", "NO");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //未删除条件
|
|
|
+ searchParms.put("delFlag", "0");
|
|
|
+
|
|
|
+ int pageNum = start / length;
|
|
|
+ pageNum++;
|
|
|
+ int pageSize = length;
|
|
|
+
|
|
|
+ Page<Project> page = projectService.pageSearch(searchParms, pageNum, pageSize, sortList);
|
|
|
+ List<Project> lstProject = new ArrayList<>();
|
|
|
+ for(Project project : page.getResult()){
|
|
|
+ //查询项目异常状态
|
|
|
+ Integer count = projectTaskService.warningCountByProjectId(project.getProjectId());
|
|
|
+ project.setWarningCount(count);
|
|
|
+
|
|
|
+ String townshipAdminId = project.getTownshipAdminId();
|
|
|
+ if(StringUtils.isNotEmpty(townshipAdminId)) {
|
|
|
+ String[] townIds = townshipAdminId.split(",");
|
|
|
+ String townNames = "";
|
|
|
+ String townIdsNew = "";
|
|
|
+ for (String townId : townIds) {
|
|
|
+ JpAdmin jpAdmin = jpAdminService.get(townId);
|
|
|
+
|
|
|
+ if(townNames.length()>0){
|
|
|
+ townNames += ",";
|
|
|
+ townIdsNew += ",";
|
|
|
+ }
|
|
|
+
|
|
|
+ if(jpAdmin != null) {
|
|
|
+ townNames += jpAdmin.getRealName();
|
|
|
+ townIdsNew += jpAdmin.getId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ project.setTownshipAdminId(townIdsNew);
|
|
|
+ project.setTownshipAdminName(townNames);
|
|
|
+ }
|
|
|
+
|
|
|
+ lstProject.add(project);
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String,Object> pageMap = new HashMap<>();
|
|
|
+ pageMap.put("recordsTotal",page.getTotal());
|
|
|
+ pageMap.put("recordsFiltered",page.getTotal());
|
|
|
+ pageMap.put("totalPage",page.getPages());
|
|
|
+ pageMap.put("pageNumber",page.getPageNum());
|
|
|
+ pageMap.put("pageSize",page.getPageSize());
|
|
|
+ pageMap.put("data", lstProject);
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(pageMap);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ logger.error(ex.getMessage(), ex);
|
|
|
+ msgResult.setResult(false);
|
|
|
+ }
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 搜索
|
|
|
+ * @return
|
|
|
+ *//*
|
|
|
+ @RequestMapping(value = "/projectData", produces = "text/html;charset=UTF-8")
|
|
|
+ @ResponseBody
|
|
|
+ public HashMap<String,Object> projectData(@RequestParam(value = "pageIndex", defaultValue = "1") Integer pageIndex,
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "15") Integer pageSize,
|
|
|
+ String project){
|
|
|
+ HashMap<String,Object> retMap = new HashMap<String,Object>();
|
|
|
+ try{
|
|
|
+ if(!StringUtils.isNotBlank(orgName)){
|
|
|
+ throw new CustomException("工会智能搜索姓名不能为空!");
|
|
|
+ }
|
|
|
+ Page<OrgInfo> page = orgInfoService.pageSearchByOrgName(orgName, pageIndex, pageSize, "name asc");
|
|
|
+ List<OrgInfo> orgInfoList = page.getContent();
|
|
|
+ List<Map> dataMapList = new ArrayList<Map>();//封装的数据列表,一般为分页查询出来的entity列表
|
|
|
+ if(orgInfoList != null && orgInfoList.size()>0){
|
|
|
+ for (int i = 0; i < orgInfoList.size(); i++) {
|
|
|
+ HashMap<String,Object> dataMap = new HashMap<String,Object>();
|
|
|
+
|
|
|
+ dataMap.put("id", orgInfoList.get(i).getId());//序号
|
|
|
+ dataMap.put("text", orgInfoList.get(i).getName());//文本
|
|
|
+
|
|
|
+ dataMapList.add(dataMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ retMap.put("dataMapList", dataMapList);
|
|
|
+ retMap.put("totalRows", page.getTotalElements());//总条数
|
|
|
+ }catch (Exception e) {
|
|
|
+ logger.error(e.getMessage(),e);
|
|
|
+ }
|
|
|
+ return retMap;
|
|
|
+ }*/
|
|
|
+
|
|
|
+ @ApiOperation(value="全部项目列表")
|
|
|
+ @RequestMapping(value = "allList",method = RequestMethod.POST)
|
|
|
+ public MessageResult<List<Project>> allList(HttpServletRequest request){
|
|
|
+ MessageResult<List<Project>> msgResult = new MessageResult<>();
|
|
|
+ List<Project> list = projectService.list();
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(list);
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="获取项目信息-手机页面")
|
|
|
+ @GetMapping("detailMethod")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "projectId", paramType = "query", value = "项目ID"),
|
|
|
+ @ApiImplicitParam(name = "taskDefKey", paramType = "query", value = "流程步骤"),
|
|
|
+ })
|
|
|
+ public MessageResult<Project> detailMethod(
|
|
|
+ @RequestParam(value = "projectId", defaultValue = "") String projectId,
|
|
|
+ @RequestParam(value = "taskDefKey", defaultValue = "") String taskDefKey
|
|
|
+ ){
|
|
|
+ MessageResult<Project> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ if(!StringUtils.isNoneBlank(projectId)){
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage("项目编号不能为空");
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ Project project = projectService.get(projectId);
|
|
|
+ Map<String,Object> searchParms = new HashMap<>();
|
|
|
+ searchParms.put("projectId",project.getProjectId());
|
|
|
+ searchParms.put("fileSource","project");
|
|
|
+ searchParms.put("delFlag","0");
|
|
|
+ List<ProjectFile> lstFile = projectFileService.list(searchParms);
|
|
|
+ List<ProjectFile> lstRealFile = new ArrayList<ProjectFile>();
|
|
|
+ for(ProjectFile pf : lstFile){
|
|
|
+ lstRealFile.add(pf);
|
|
|
+ }
|
|
|
+ project.setPfList(lstRealFile);
|
|
|
+
|
|
|
+ //存一下上传步骤
|
|
|
+ String taskName = "";
|
|
|
+ List<Map> taskList = new ArrayList<Map>();
|
|
|
+ if(!StringUtils.isNoneBlank(taskDefKey)){
|
|
|
+ taskList = projectTaskService.findByProjectId(projectId);
|
|
|
+ }else{
|
|
|
+ taskList = projectTaskService.findByPIdANDDefKey(projectId,taskDefKey);
|
|
|
+ }
|
|
|
+
|
|
|
+ for(int i = 0;i< taskList.size(); i ++){
|
|
|
+ Map map = taskList.get(i);
|
|
|
+ taskName += map.get("taskName");
|
|
|
+ if(i > 0 && i != taskList.size()){
|
|
|
+ taskName += ",";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ project.setTaskName(taskName);
|
|
|
+
|
|
|
+ if (project != null) {
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(project);
|
|
|
+ } else {
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage("数据库不存在该记录!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value="获取项目汇总")
|
|
|
+ @RequestMapping(value = "projectCollect",method = RequestMethod.POST)
|
|
|
+ public MessageResult<Map> projectCollect(){
|
|
|
+ MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ int num1 = projectService.getProjectByStatus("0");
|
|
|
+ int num2 = projectService.getProjectByStatus("1");
|
|
|
+ int num3 = projectService.getProjectByStatus("2");
|
|
|
+ int num4 = projectService.getProjectByStatus("3");
|
|
|
+
|
|
|
+ List<Project> list = projectService.list();
|
|
|
+
|
|
|
+ int total = list.size();
|
|
|
+
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+
|
|
|
+ map.put("num_", total);
|
|
|
+ map.put("0", num1);
|
|
|
+ map.put("1", num2);
|
|
|
+ map.put("2", num3);
|
|
|
+ map.put("3", num4);
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(map);
|
|
|
+ }
|
|
|
+ catch (Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="获取项目汇总列表")
|
|
|
+ @RequestMapping(value = "projectCollectList",method = RequestMethod.POST)
|
|
|
+ public MessageResult<List<Map<String, Object>>> projectCollectList(){
|
|
|
+ MessageResult<List<Map<String, Object>>> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ List<Map<String, Object>> list = projectService.groupByParkId();
|
|
|
+
|
|
|
+ List<Map<String, Object>> newList = new ArrayList<Map<String, Object>>();
|
|
|
+
|
|
|
+ for (Map<String, Object> map1:list) {
|
|
|
+ String parkId = map1.get("park_id_").toString();
|
|
|
+ List<Map<String, Object>> list1 = projectService.groupByStatus(parkId);
|
|
|
+ map1.put("datail_",list1);
|
|
|
+ newList.add(map1);
|
|
|
+ }
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(newList);
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="获取在建和拟建项目统计")
|
|
|
+ @RequestMapping(value = "projectConstructionList",method = RequestMethod.POST)
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "roleId", paramType = "query", value = "角色ID")
|
|
|
+ })
|
|
|
+ public MessageResult<Map> projectConstructionList(
|
|
|
+ @RequestAttribute String subject,
|
|
|
+ @RequestParam(value = "roleId", defaultValue = "") String roleId
|
|
|
+ ){
|
|
|
+ String userType = "";
|
|
|
+
|
|
|
+ if(StringUtils.isEmpty(roleId)){
|
|
|
+ //用户IDZLD
|
|
|
+ JpAdmin queryUser = jpAdminService.get(subject);
|
|
|
+
|
|
|
+ List<AdminRole> roleList = queryUser.getAdminRoleList();
|
|
|
+
|
|
|
+ if(roleList!=null && roleList.size()>0){
|
|
|
+ roleId = roleList.get(0).getRoleId();
|
|
|
+ }
|
|
|
+ else if(StringUtils.isNotEmpty(queryUser.getRoleId())){
|
|
|
+ roleId = queryUser.getRoleId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //根据用户和角色查询
|
|
|
+ AdminRole adminRole = adminRoleService.findByAIdAndRId(subject,roleId);
|
|
|
+ //用户ID
|
|
|
+ //JpAdmin queryUser = jpAdminService.get(subject);
|
|
|
+ int count1 = 0;
|
|
|
+ int count2 = 0;
|
|
|
+ int count3 = 0;
|
|
|
+ MessageResult<Map> msgResult = new MessageResult<Map>();
|
|
|
+ if(adminRole != null) {
|
|
|
+ userType = adminRole.getRoleName();
|
|
|
+
|
|
|
+ // int count00 = projectService.getProjectByStatusANDLAIdANDKey("0",userType,subject,"ProjectPerformanceTransfer");//履约转办阶段-拟建项目 ProjectPerformanceTransfer
|
|
|
+ count1 = projectService.getProjectByStatusANDLAIdANDKey(null,null,subject,"ProjectPerformanceTransfer");//履约转办阶段-拟建项目 ProjectPerformanceTransfer
|
|
|
+ count2 = projectService.getProjectByStatusANDLAIdANDKey("1",null,subject,"ProjectStartUpConstruction");//项目开工建设阶段 - 在建项目1 ProjectStartUpConstruction
|
|
|
+ count3 = projectService.getProjectByStatusANDLAIdANDKey("2",null,subject,"ProjectCompletedAndPutIntoOperation");//项目建成投产阶段 - 在建项目2 ProjectCompletedAndPutIntoOperation
|
|
|
+ //int over = projectService.getProjectByStatusANDProjectAdminId("3",subject);//已完成
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Object> rMap = new HashMap<String,Object>();
|
|
|
+ rMap.put("proposedNum", count1 + count2);//拟建项目 1未完成 2未完成
|
|
|
+ rMap.put("constructionNum", count3);//在建项目 2完成 3 未完成
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(rMap);
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "项目完成情况报表")
|
|
|
+ @RequestMapping(value = "completionReport", method = RequestMethod.POST)
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "projectName", paramType = "query", value = "项目名称"),
|
|
|
+ @ApiImplicitParam(name = "startTime", paramType = "query", value = "开始时间"),
|
|
|
+ @ApiImplicitParam(name = "endTime", paramType = "query", value = "结束时间"),
|
|
|
+ @ApiImplicitParam(name = "status", paramType = "query", value = "流程当前步骤状态"),
|
|
|
+ @ApiImplicitParam(name = "isStart", paramType = "query", value = "是否已开启流程"),
|
|
|
+ @ApiImplicitParam(name = "procDefKey", paramType = "query", value = "流程定义key"),
|
|
|
+ @ApiImplicitParam(name = "roleId", paramType = "query", value = "角色ID"),
|
|
|
+ @ApiImplicitParam(name = "parkId", paramType = "query", value = "园区ID"),
|
|
|
+ @ApiImplicitParam(name = "startDate", paramType = "query", value = "开始时间"),
|
|
|
+ @ApiImplicitParam(name = "endDate", paramType = "query", value = "结束")
|
|
|
+ })
|
|
|
+ public MessageResult<Map> completionReport(
|
|
|
+ @RequestParam(value = "projectName", defaultValue = "") String projectName,
|
|
|
+ @RequestParam(value = "startTime", defaultValue = "") String startTime,
|
|
|
+ @RequestParam(value = "endTime", defaultValue = "") String endTime,
|
|
|
+ @RequestParam(value = "procDefKey", defaultValue = "") String procDefKey,
|
|
|
+ @RequestParam(value = "parkId", defaultValue = "") String parkId,
|
|
|
+ @RequestParam(value = "isStart", defaultValue = "false") boolean isStart,
|
|
|
+ @RequestParam(value = "status", defaultValue = "") String status,
|
|
|
+ @RequestParam(value = "start", defaultValue = "0") int start,
|
|
|
+ @RequestParam(value = "length", defaultValue = "20") int length,
|
|
|
+ @RequestParam(value = "roleId", defaultValue = "") String roleId,
|
|
|
+ @RequestParam(value = "startDate", defaultValue = "") String startDate,
|
|
|
+ @RequestParam(value = "endDate", defaultValue = "") String endDate,
|
|
|
+ @RequestAttribute String subject,
|
|
|
+ HttpServletRequest request) {
|
|
|
+ //当前用户ID
|
|
|
+ System.out.println(subject);
|
|
|
+
|
|
|
+ MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ Map<String, Object> searchParms = new HashMap<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("park_id_", "asc"));
|
|
|
+ sortList.add(new Sort("start_time_", "asc"));
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(projectName)) {
|
|
|
+ //标题
|
|
|
+ searchParms.put("projectName", "%" + projectName + "%");
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(startTime)) {
|
|
|
+ //起始时间-起
|
|
|
+ searchParms.put("startTime", startTime);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(endTime)) {
|
|
|
+ //起始时间-止
|
|
|
+ searchParms.put("endTime", endTime);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(procDefKey)) {
|
|
|
+ //项目进度
|
|
|
+ searchParms.put("procDefKey", procDefKey);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(status)) {
|
|
|
+ if ("-1".equals(status)) {
|
|
|
+ //未发起流程
|
|
|
+ searchParms.put("isNotStart", status);
|
|
|
+ } else if ("0".equals(status)) {
|
|
|
+ searchParms.put("isStart", status);//流程不为空
|
|
|
+ searchParms.put("statusNull", status);//状态为null
|
|
|
+ } else if("1".equals(status)){
|
|
|
+ searchParms.put("status", status);
|
|
|
+ if (StringUtils.isNotEmpty(startDate)) {
|
|
|
+ searchParms.put("timeNode1startTime", startDate);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(endDate)) {
|
|
|
+ searchParms.put("timeNode1endTime", endDate);
|
|
|
+ }
|
|
|
+ } else if("2".equals(status)){
|
|
|
+ searchParms.put("status", status);
|
|
|
+ if (StringUtils.isNotEmpty(startDate)) {
|
|
|
+ searchParms.put("timeNode2startTime", startDate);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(endDate)) {
|
|
|
+ searchParms.put("timeNode2endTime", endDate);
|
|
|
+ }
|
|
|
+ } else if("3".equals(status)){
|
|
|
+ searchParms.put("status", status);
|
|
|
+ if (StringUtils.isNotEmpty(startDate)) {
|
|
|
+ searchParms.put("timeNode3startTime", startDate);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(endDate)) {
|
|
|
+ searchParms.put("timeNode3endTime", endDate);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if (StringUtils.isNotEmpty(startDate)) {
|
|
|
+ searchParms.put("startTime", startDate);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(endDate)) {
|
|
|
+ searchParms.put("endTime", endDate);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(parkId)) {
|
|
|
+ //园区ID
|
|
|
+ searchParms.put("parkId", parkId);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isStart) {
|
|
|
+ //是否启动
|
|
|
+ searchParms.put("isStart", isStart);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(roleId)) {
|
|
|
+ //用户IDZLD
|
|
|
+ JpAdmin queryUser = jpAdminService.get(subject);
|
|
|
+
|
|
|
+ //List<AdminRole> roleList = queryUser.getAdminRoleList();
|
|
|
+ List<AdminRole> roleList = adminRoleService.listByAdminId(subject);
|
|
|
+
|
|
|
+ if (roleList != null && roleList.size() > 0) {
|
|
|
+ roleId = roleList.get(0).getRoleId();
|
|
|
+ } else if (StringUtils.isNotEmpty(queryUser.getRoleId())) {
|
|
|
+ roleId = queryUser.getRoleId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //根据用户和角色查询
|
|
|
+ AdminRole adminRole = adminRoleService.findByAIdAndRId(subject, roleId);
|
|
|
+
|
|
|
+ int count1 = adminRoleService.findCountByAIdAndRName(subject, "SYSADMIN");
|
|
|
+ int count2 = adminRoleService.findCountByAIdAndRName(subject, "ZLD");
|
|
|
+ int count3 = adminRoleService.findCountByAIdAndRName(subject, "TZCJZX");
|
|
|
+ if (count1 > 0) {
|
|
|
+ //查全部
|
|
|
+ } else if (count2 > 0) {
|
|
|
+ //查全部
|
|
|
+ } else if (count3 > 0) {
|
|
|
+ //查全部
|
|
|
+ } else {
|
|
|
+ //Role role = roleService.get(roleId);
|
|
|
+ if (adminRole != null) {
|
|
|
+ if ("XMF".equals(adminRole.getRoleName())) {
|
|
|
+ searchParms.put("XMF", subject);
|
|
|
+ } else if ("QYMS".equals(adminRole.getRoleName())) {
|
|
|
+ searchParms.put("QYMS", subject);
|
|
|
+ } else if ("BLLD".equals(adminRole.getRoleName())) {
|
|
|
+ searchParms.put("BLLD", subject);
|
|
|
+ } else if ("YQB".equals(adminRole.getRoleName())) {
|
|
|
+ //园区办 YQB
|
|
|
+ searchParms.put("YQB", subject);
|
|
|
+ } else if ("SYSADMIN".equals(adminRole.getRoleName())) {
|
|
|
+ //项目管理员查全部
|
|
|
+ } else if ("ZLD".equals(adminRole.getRoleName())) {
|
|
|
+ //总领导查全部
|
|
|
+ } else if ("TZCJZX".equals(adminRole.getRoleName())) {
|
|
|
+ //CXQBXM查全部
|
|
|
+ } else {
|
|
|
+ //否则都不能看到
|
|
|
+ searchParms.put("XMF", "NO");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //否则都不能看到
|
|
|
+ searchParms.put("XMF", "NO");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //未删除条件
|
|
|
+ searchParms.put("delFlag", "0");
|
|
|
+
|
|
|
+ int pageNum = start / length;
|
|
|
+ pageNum++;
|
|
|
+ int pageSize = length;
|
|
|
+
|
|
|
+ Page<Project> page = projectService.pageSearch(searchParms, pageNum, pageSize, sortList);
|
|
|
+ List<Project> lstProject = new ArrayList<>();
|
|
|
+ for (Project project : page.getResult()) {
|
|
|
+ String townshipAdminId = project.getTownshipAdminId();
|
|
|
+ if (StringUtils.isNotEmpty(townshipAdminId)) {
|
|
|
+ String[] townIds = townshipAdminId.split(",");
|
|
|
+ String townNames = "";
|
|
|
+ String townIdsNew = "";
|
|
|
+ for (String townId : townIds) {
|
|
|
+ JpAdmin jpAdmin = jpAdminService.get(townId);
|
|
|
+
|
|
|
+ if (townNames.length() > 0) {
|
|
|
+ townNames += ",";
|
|
|
+ townIdsNew += ",";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (jpAdmin != null) {
|
|
|
+ townNames += jpAdmin.getRealName();
|
|
|
+ townIdsNew += jpAdmin.getId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ project.setTownshipAdminId(townIdsNew);
|
|
|
+ project.setTownshipAdminName(townNames);
|
|
|
+ }
|
|
|
+
|
|
|
+ String pAdminId = project.getProjectAdminId();
|
|
|
+ if (StringUtils.isNotEmpty(townshipAdminId)) {
|
|
|
+ JpAdmin jpAdmin= jpAdminService.get(pAdminId);
|
|
|
+ if(jpAdmin != null) {
|
|
|
+ project.setProjectAdmin(jpAdmin);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ lstProject.add(project);
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Object> pageMap = new HashMap<>();
|
|
|
+ pageMap.put("recordsTotal", page.getTotal());
|
|
|
+ pageMap.put("recordsFiltered", page.getTotal());
|
|
|
+ pageMap.put("totalPage", page.getPages());
|
|
|
+ pageMap.put("pageNumber", page.getPageNum());
|
|
|
+ pageMap.put("pageSize", page.getPageSize());
|
|
|
+ pageMap.put("data", lstProject);
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(pageMap);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ logger.error(ex.getMessage(), ex);
|
|
|
+ msgResult.setResult(false);
|
|
|
+ }
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "导出项目完成情况报表")
|
|
|
+ @RequestMapping(value = "exportCompletionXls", method = RequestMethod.POST)
|
|
|
+ public MessageResult<String> exportCompletionXls(
|
|
|
+ @RequestParam(value = "projectName", defaultValue = "") String projectName,
|
|
|
+ @RequestParam(value = "startTime", defaultValue = "") String startTime,
|
|
|
+ @RequestParam(value = "endTime", defaultValue = "") String endTime,
|
|
|
+ @RequestParam(value = "procDefKey", defaultValue = "") String procDefKey,
|
|
|
+ @RequestParam(value = "parkId", defaultValue = "") String parkId,
|
|
|
+ @RequestParam(value = "isStart", defaultValue = "false") boolean isStart,
|
|
|
+ @RequestParam(value = "status", defaultValue = "") String status,
|
|
|
+ @RequestParam(value = "start", defaultValue = "0") int start,
|
|
|
+ @RequestParam(value = "length", defaultValue = "100000") int length,
|
|
|
+ @RequestParam(value = "roleId", defaultValue = "") String roleId,
|
|
|
+ @RequestParam(value = "startDate", defaultValue = "") String startDate,
|
|
|
+ @RequestParam(value = "endDate", defaultValue = "") String endDate,
|
|
|
+ @RequestAttribute String subject, HttpServletRequest req) throws Exception {
|
|
|
+ MessageResult<String> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("park_id_", "asc"));
|
|
|
+ sortList.add(new Sort("start_time_", "asc"));
|
|
|
+
|
|
|
+ Map<String, Object> searchParms = new HashMap<>();
|
|
|
+ if (StringUtils.isNotEmpty(projectName)) {
|
|
|
+ //标题
|
|
|
+ searchParms.put("projectName", "%" + projectName + "%");
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(startTime)) {
|
|
|
+ //起始时间-起
|
|
|
+ searchParms.put("startTime", startTime);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(endTime)) {
|
|
|
+ //起始时间-止
|
|
|
+ searchParms.put("endTime", endTime);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(procDefKey)) {
|
|
|
+ //项目进度
|
|
|
+ searchParms.put("procDefKey", procDefKey);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(status)) {
|
|
|
+ if ("-1".equals(status)) {
|
|
|
+ //未发起流程
|
|
|
+ searchParms.put("isNotStart", status);
|
|
|
+ } else if ("0".equals(status)) {
|
|
|
+ searchParms.put("isStart", status);//流程不为空
|
|
|
+ searchParms.put("statusNull", status);//状态为null
|
|
|
+ } else if("1".equals(status)){
|
|
|
+ searchParms.put("status", status);
|
|
|
+ if (StringUtils.isNotEmpty(startDate)) {
|
|
|
+ searchParms.put("timeNode1startTime", startDate);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(endDate)) {
|
|
|
+ searchParms.put("timeNode1endTime", endDate);
|
|
|
+ }
|
|
|
+ } else if("2".equals(status)){
|
|
|
+ searchParms.put("status", status);
|
|
|
+ if (StringUtils.isNotEmpty(startDate)) {
|
|
|
+ searchParms.put("timeNode2startTime", startDate);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(endDate)) {
|
|
|
+ searchParms.put("timeNode2endTime", endDate);
|
|
|
+ }
|
|
|
+ } else if("3".equals(status)){
|
|
|
+ searchParms.put("status", status);
|
|
|
+ if (StringUtils.isNotEmpty(startDate)) {
|
|
|
+ searchParms.put("timeNode3startTime", startDate);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(endDate)) {
|
|
|
+ searchParms.put("timeNode3endTime", endDate);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if (StringUtils.isNotEmpty(startDate)) {
|
|
|
+ searchParms.put("startTime", startDate);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(endDate)) {
|
|
|
+ searchParms.put("endTime", endDate);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(parkId)) {
|
|
|
+ //园区ID
|
|
|
+ searchParms.put("parkId", parkId);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isStart) {
|
|
|
+ //是否启动
|
|
|
+ searchParms.put("isStart", isStart);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(roleId)) {
|
|
|
+ //用户IDZLD
|
|
|
+ JpAdmin queryUser = jpAdminService.get(subject);
|
|
|
+
|
|
|
+ //List<AdminRole> roleList = queryUser.getAdminRoleList();
|
|
|
+ List<AdminRole> roleList = adminRoleService.listByAdminId(subject);
|
|
|
+
|
|
|
+ if (roleList != null && roleList.size() > 0) {
|
|
|
+ roleId = roleList.get(0).getRoleId();
|
|
|
+ } else if (StringUtils.isNotEmpty(queryUser.getRoleId())) {
|
|
|
+ roleId = queryUser.getRoleId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //根据用户和角色查询
|
|
|
+ AdminRole adminRole = adminRoleService.findByAIdAndRId(subject, roleId);
|
|
|
+
|
|
|
+ int count1 = adminRoleService.findCountByAIdAndRName(subject, "SYSADMIN");
|
|
|
+ int count2 = adminRoleService.findCountByAIdAndRName(subject, "ZLD");
|
|
|
+ int count3 = adminRoleService.findCountByAIdAndRName(subject, "TZCJZX");
|
|
|
+ if (count1 > 0) {
|
|
|
+ //查全部
|
|
|
+ } else if (count2 > 0) {
|
|
|
+ //查全部
|
|
|
+ } else if (count3 > 0) {
|
|
|
+ //查全部
|
|
|
+ } else {
|
|
|
+ //Role role = roleService.get(roleId);
|
|
|
+ if (adminRole != null) {
|
|
|
+ if ("XMF".equals(adminRole.getRoleName())) {
|
|
|
+ searchParms.put("XMF", subject);
|
|
|
+ } else if ("QYMS".equals(adminRole.getRoleName())) {
|
|
|
+ searchParms.put("QYMS", subject);
|
|
|
+ } else if ("BLLD".equals(adminRole.getRoleName())) {
|
|
|
+ searchParms.put("BLLD", subject);
|
|
|
+ } else if ("YQB".equals(adminRole.getRoleName())) {
|
|
|
+ //园区办 YQB
|
|
|
+ searchParms.put("YQB", subject);
|
|
|
+ } else if ("SYSADMIN".equals(adminRole.getRoleName())) {
|
|
|
+ //项目管理员查全部
|
|
|
+ } else if ("ZLD".equals(adminRole.getRoleName())) {
|
|
|
+ //总领导查全部
|
|
|
+ } else if ("TZCJZX".equals(adminRole.getRoleName())) {
|
|
|
+ //CXQBXM查全部
|
|
|
+ } else {
|
|
|
+ //否则都不能看到
|
|
|
+ searchParms.put("XMF", "NO");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //否则都不能看到
|
|
|
+ searchParms.put("XMF", "NO");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //未删除条件
|
|
|
+ searchParms.put("delFlag", "0");
|
|
|
+
|
|
|
+ int pageNum = start / length;
|
|
|
+ pageNum++;
|
|
|
+ int pageSize = length;
|
|
|
+
|
|
|
+ Page<Project> page = projectService.pageSearch(searchParms, pageNum, pageSize, sortList);
|
|
|
+ List<Project> lstProject = new ArrayList<>();
|
|
|
+ for (Project project : page.getResult()) {
|
|
|
+ String townshipAdminId = project.getTownshipAdminId();
|
|
|
+ if (StringUtils.isNotEmpty(townshipAdminId)) {
|
|
|
+ String[] townIds = townshipAdminId.split(",");
|
|
|
+ String townNames = "";
|
|
|
+ String townIdsNew = "";
|
|
|
+ for (String townId : townIds) {
|
|
|
+ JpAdmin jpAdmin = jpAdminService.get(townId);
|
|
|
+
|
|
|
+ if (townNames.length() > 0) {
|
|
|
+ townNames += ",";
|
|
|
+ townIdsNew += ",";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (jpAdmin != null) {
|
|
|
+ townNames += jpAdmin.getRealName();
|
|
|
+ townIdsNew += jpAdmin.getId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ project.setTownshipAdminId(townIdsNew);
|
|
|
+ project.setTownshipAdminName(townNames);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ String pAdminId = project.getProjectAdminId();
|
|
|
+ if (StringUtils.isNotEmpty(townshipAdminId)) {
|
|
|
+ JpAdmin jpAdmin= jpAdminService.get(pAdminId);
|
|
|
+ if(jpAdmin != null) {
|
|
|
+ project.setProjectAdmin(jpAdmin);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ lstProject.add(project);
|
|
|
+ }
|
|
|
+ File file = ResourceUtils.getFile("classpath:static/projectCompletion.xlsx");
|
|
|
+ InputStream inputStream = new FileInputStream(file);
|
|
|
+
|
|
|
+ XSSFWorkbook wb = new XSSFWorkbook(inputStream);
|
|
|
+ Sheet sheet = wb.getSheetAt(0);
|
|
|
+ int startRowIndex = 2;
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
|
|
+ for (int i = 0; i < lstProject.size(); i++) {
|
|
|
+ Row row = sheet.createRow(startRowIndex + i);
|
|
|
+ Project project = lstProject.get(i);
|
|
|
+
|
|
|
+ row.createCell(0).setCellValue(project.getPark().getTitle());
|
|
|
+ row.createCell(1).setCellValue(project.getTitle());
|
|
|
+ String pStartTime = "";
|
|
|
+ if(project.getStartTime() != null){
|
|
|
+ pStartTime = sdf.format(project.getStartTime());
|
|
|
+ }
|
|
|
+ row.createCell(2).setCellValue(pStartTime);
|
|
|
+ row.createCell(3).setCellValue(project.getSize());
|
|
|
+ row.createCell(4).setCellValue(project.getAddress());
|
|
|
+ row.createCell(5).setCellValue(project.getLandScale());
|
|
|
+ row.createCell(6).setCellValue(project.getDetail());
|
|
|
+ row.createCell(7).setCellValue(project.getTownshipAdminName());
|
|
|
+ row.createCell(8).setCellValue(project.getSecretaryAdmin().getRealName());
|
|
|
+ row.createCell(9).setCellValue(project.getLeaderAdmin().getRealName());
|
|
|
+ row.createCell(10).setCellValue(project.getUnit());
|
|
|
+ row.createCell(11).setCellValue(project.getProjectAdmin().getRealName());
|
|
|
+ row.createCell(12).setCellValue(project.getProjectAdmin().getTel());
|
|
|
+ row.createCell(13).setCellValue(project.getProcessName());
|
|
|
+ String pTimeNode1 = "";
|
|
|
+ if(project.getTimeNode1() != null){
|
|
|
+ pTimeNode1 = sdf.format(project.getTimeNode1());
|
|
|
+ }
|
|
|
+ row.createCell(14).setCellValue(pTimeNode1);
|
|
|
+ String pTimeNode2 = "";
|
|
|
+ if(project.getTimeNode2() != null){
|
|
|
+ pTimeNode2 = sdf.format(project.getTimeNode2());
|
|
|
+ }
|
|
|
+ row.createCell(15).setCellValue(pTimeNode2);
|
|
|
+ String pTimeNode3 = "";
|
|
|
+ if(project.getTimeNode3() != null){
|
|
|
+ pTimeNode3 = sdf.format(project.getTimeNode3());
|
|
|
+ }
|
|
|
+ row.createCell(16).setCellValue(pTimeNode3);
|
|
|
+ }
|
|
|
+
|
|
|
+ CellStyle cellStyle1 = createCellStyle(wb);
|
|
|
+
|
|
|
+ for (int i = 0; i < lstProject.size(); i++) {
|
|
|
+ Row row = sheet.getRow(startRowIndex + i);
|
|
|
+
|
|
|
+ if (row != null) {
|
|
|
+ for (int j = 0; j < row.getLastCellNum(); j++) {
|
|
|
+ if (row.getCell(j) != null) {
|
|
|
+ row.getCell(j).setCellStyle(cellStyle1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //todo 将wb保存到oss
|
|
|
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
|
|
|
+ wb.write(output);
|
|
|
+
|
|
|
+ byte[] buffer = output.toByteArray();
|
|
|
+ ByteArrayInputStream input = new ByteArrayInputStream(buffer);
|
|
|
+ String fileName = "学生健康信息台账.xlsx";
|
|
|
+
|
|
|
+ String downloadUrl = FileUtils.uploadFile(serverConfig, fileName, input, "/report");
|
|
|
+ //String[] ret = FileUtils.saveFile(serverConfig,input,"/project", req);
|
|
|
+ wb.close();
|
|
|
+ output.close();
|
|
|
+
|
|
|
+ msgResult.setData(downloadUrl);
|
|
|
+ msgResult.setResult(true);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ logger.error(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ private CellStyle createCellStyle(Workbook wb) {
|
|
|
+ CellStyle cellStyle = wb.createCellStyle();
|
|
|
+
|
|
|
+ cellStyle.setBorderTop(BorderStyle.THIN);
|
|
|
+ cellStyle.setBorderBottom(BorderStyle.THIN);
|
|
|
+ cellStyle.setBorderLeft(BorderStyle.THIN);
|
|
|
+ cellStyle.setBorderRight(BorderStyle.THIN);
|
|
|
+ cellStyle.setWrapText(true);
|
|
|
+ cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
+
|
|
|
+ return cellStyle;
|
|
|
+ }
|
|
|
+}
|