293 lines
12 KiB
Java
293 lines
12 KiB
Java
package com.point.strategy.oaDocking.controller;
|
||
|
||
import com.bstek.ureport.Utils;
|
||
import com.bstek.ureport.export.ExportConfigure;
|
||
import com.bstek.ureport.export.ExportConfigureImpl;
|
||
import com.bstek.ureport.export.ExportManager;
|
||
import com.github.pagehelper.PageInfo;
|
||
import com.point.strategy.common.AjaxJson;
|
||
import com.point.strategy.docTraditionArrange.docVolume.bean.DocTraditionArrangeVolume;
|
||
import com.point.strategy.docTraditionArrange.docVolume.bean.DocVolumeOriginalEntity;
|
||
import com.point.strategy.oaDocking.bean.DocTraditionArrangeOaVolume;
|
||
import com.point.strategy.oaDocking.service.DocTraditionVolumeOaService;
|
||
import io.swagger.annotations.Api;
|
||
import io.swagger.annotations.ApiImplicitParam;
|
||
import io.swagger.annotations.ApiImplicitParams;
|
||
import io.swagger.annotations.ApiOperation;
|
||
import org.slf4j.Logger;
|
||
import org.slf4j.LoggerFactory;
|
||
import org.springframework.beans.factory.annotation.Autowired;
|
||
import org.springframework.web.bind.annotation.*;
|
||
|
||
import javax.servlet.http.HttpServletRequest;
|
||
import javax.servlet.http.HttpServletResponse;
|
||
import java.io.*;
|
||
import java.util.HashMap;
|
||
import java.util.List;
|
||
import java.util.Map;
|
||
|
||
@RestController
|
||
@RequestMapping("/v/docVolumeOa")
|
||
@Api(tags = "预归档文书传统整理-卷内", value = "DocTraditionVolumeOaController")
|
||
public class DocTraditionVolumeOaController {
|
||
|
||
private static final Logger logger = LoggerFactory.getLogger(DocTraditionVolumeOaController.class);
|
||
@Autowired
|
||
private DocTraditionVolumeOaService docTraditionVolumeService;
|
||
|
||
@RequestMapping(value="/getDocVolumeWithPage" , method= RequestMethod.POST)
|
||
@ApiOperation(value = "分页查询传统方法整理卷内信息")
|
||
public AjaxJson getDocVolumeWithPage(String fondsNo,String fondsNoCode,String pid,Integer page,Integer limit) {
|
||
AjaxJson json = null;
|
||
try {
|
||
DocTraditionArrangeOaVolume docTraditionArrangeVolume = new DocTraditionArrangeOaVolume();
|
||
docTraditionArrangeVolume.setFondsNo(fondsNo);
|
||
docTraditionArrangeVolume.setFondsNoCode(fondsNoCode);
|
||
docTraditionArrangeVolume.setPid(pid);
|
||
if(page!=null) {
|
||
docTraditionArrangeVolume.setPage(page);
|
||
}
|
||
if(limit!=null) {
|
||
docTraditionArrangeVolume.setLimit(limit);
|
||
}
|
||
List list = docTraditionVolumeService.getDocVolumeWithPage(docTraditionArrangeVolume);
|
||
PageInfo pageInfo = new PageInfo(list);
|
||
long total = pageInfo.getTotal();
|
||
json = new AjaxJson();
|
||
json.put("list", list);
|
||
json.put("total", total);
|
||
}catch(Exception e) {
|
||
json = AjaxJson.returnExceptionInfo("分页查询传统方法整理卷内信息失败"+e);
|
||
}
|
||
return json;
|
||
}
|
||
|
||
@RequestMapping(value="/saveDocVolume" , method= RequestMethod.POST)
|
||
@ApiOperation(value = "保存传统方法整理卷内信息")
|
||
@ApiImplicitParams({
|
||
|
||
})
|
||
public AjaxJson saveDocVolume(@RequestBody DocTraditionArrangeOaVolume docTraditionArrangeVolume) {
|
||
AjaxJson json = null;
|
||
try {
|
||
docTraditionArrangeVolume.setFileStatus(1);
|
||
int num = docTraditionVolumeService.saveDocVolume(docTraditionArrangeVolume);
|
||
json = new AjaxJson();
|
||
}catch(Exception e) {
|
||
json = AjaxJson.returnExceptionInfo("保存传统方法整理卷内信息失败"+e);
|
||
}
|
||
return json;
|
||
}
|
||
|
||
@RequestMapping(value="/deleteDocVolume" , method= RequestMethod.POST)
|
||
@ApiOperation(value = "删除传统方法整理卷内信息,批量删除用逗号隔开id值")
|
||
@ApiImplicitParams({
|
||
@ApiImplicitParam(paramType = "query", name = "ids", value = "逗号拼接的id字符串", required = true, dataType = "String"),
|
||
})
|
||
public AjaxJson deleteDocVolume(String ids) {
|
||
AjaxJson json = null;
|
||
try {
|
||
int num = docTraditionVolumeService.deleteDocVolume(ids);
|
||
json = AjaxJson.returnInfo("成功删除"+num+"条记录");
|
||
}catch(Exception e) {
|
||
json = AjaxJson.returnExceptionInfo("删除传统方法整理卷内信息失败"+e);
|
||
}
|
||
return json;
|
||
}
|
||
|
||
|
||
@RequestMapping(value="/updateDocVolume" , method= RequestMethod.POST)
|
||
@ApiOperation(value = "修改传统方法整理卷内信息")
|
||
@ApiImplicitParams({
|
||
|
||
})
|
||
public AjaxJson updateDocVolume(@RequestBody DocTraditionArrangeOaVolume docTraditionArrangeVolume) {
|
||
AjaxJson json = null;
|
||
try {
|
||
docTraditionVolumeService.updateDocVolume(docTraditionArrangeVolume);
|
||
json = new AjaxJson();
|
||
}catch(Exception e) {
|
||
json = AjaxJson.returnExceptionInfo("修改传统方法整理卷内信息失败"+e);
|
||
}
|
||
return json;
|
||
}
|
||
|
||
|
||
@RequestMapping(value="/downLoadDocVolumePdf" , method= RequestMethod.POST)
|
||
@ApiOperation(value = "导出文书传统卷内pdf文件")
|
||
public void downLoadPdf(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||
request.setCharacterEncoding("UTF-8");
|
||
String fileName = "创建文书传统卷内pdf文件.pdf";
|
||
String downLoadPath = "C:\\\\ureportfiles\\\\"+fileName;
|
||
response.setContentType("application/pdf");
|
||
FileInputStream in = new FileInputStream(new File(downLoadPath));
|
||
OutputStream out = response.getOutputStream();
|
||
byte[] b = new byte[1024];
|
||
while ((in.read(b))!=-1) {
|
||
out.write(b);
|
||
}
|
||
out.flush();
|
||
in.close();
|
||
out.close();
|
||
}
|
||
|
||
|
||
@RequestMapping(value="/createDocVolumePdf" , method= RequestMethod.POST)
|
||
@ApiOperation(value = "创建文书传统卷内pdf文件")
|
||
public void createDocVolumePdf(String fondsNo,String fondsNoCode) throws IOException {
|
||
Map<String, Object> map = new HashMap<String, Object>();
|
||
map.put("fondsNo",fondsNo);
|
||
map.put("fondsNoCode",fondsNoCode);
|
||
OutputStream outputStream = null;
|
||
try {
|
||
String fileName = "创建文书传统卷内pdf文件.pdf";
|
||
outputStream = new FileOutputStream(new File("C:\\ureportfiles\\"+fileName));
|
||
ExportConfigure config = new ExportConfigureImpl("file:" + "创建文书传统卷内pdf文件.ureport.xml", map, outputStream);
|
||
ExportManager exportManager = (ExportManager) Utils.getApplicationContext().getBean(ExportManager.BEAN_ID);
|
||
exportManager.exportPdf(config);
|
||
}catch (Exception e) {
|
||
e.printStackTrace();
|
||
}
|
||
}
|
||
|
||
|
||
@RequestMapping(value="/queryDocVolumeOriginalEntity" , method= RequestMethod.POST)
|
||
@ApiOperation(value = "查询原文信息")
|
||
public AjaxJson queryDocVolumeOriginalEntity(@RequestParam(value = "recId",required = true)Integer recId) {
|
||
AjaxJson json = null;
|
||
try {
|
||
List list = docTraditionVolumeService.queryDocVolumeOriginalEntity(recId);
|
||
json = new AjaxJson();
|
||
json.put("list", list);
|
||
}catch(Exception e) {
|
||
json = AjaxJson.returnExceptionInfo("查询原文信息失败"+e);
|
||
}
|
||
return json;
|
||
}
|
||
|
||
@RequestMapping(value="/updateDocVolumeOriginalEntity" , method= RequestMethod.POST)
|
||
@ApiOperation(value = "原文入回收站")
|
||
@ApiImplicitParams({
|
||
@ApiImplicitParam(paramType = "query", name = "ids", value = "原文主键ids", required = true, dataType = "String"),
|
||
})
|
||
public AjaxJson updateDocVolumeOriginalEntity(String ids) {
|
||
AjaxJson json = null;
|
||
try {
|
||
String[] idAarray=ids.split(",");
|
||
for (String id:idAarray) {
|
||
docTraditionVolumeService.updateDocVolumeOriginalEntity(Integer.parseInt(id));
|
||
}
|
||
json = new AjaxJson();
|
||
}catch(Exception e) {
|
||
json = AjaxJson.returnExceptionInfo("原文入回收站失败"+e);
|
||
}
|
||
return json;
|
||
}
|
||
|
||
@RequestMapping(value="/queryDocVolumeOriginalEntityRecycle" , method= RequestMethod.POST)
|
||
@ApiOperation(value = "查询原文回收站信息")
|
||
public AjaxJson queryDocVolumeOriginalEntityRecycle(@RequestParam(value = "recId",required = true)Integer recId) {
|
||
AjaxJson json = null;
|
||
try {
|
||
List list = docTraditionVolumeService.queryDocVolumeOriginalEntityRecycle(recId);
|
||
json = new AjaxJson();
|
||
json.put("list", list);
|
||
}catch(Exception e) {
|
||
json = AjaxJson.returnExceptionInfo("查询原文回收站信息失败"+e);
|
||
}
|
||
return json;
|
||
}
|
||
|
||
|
||
@RequestMapping(value="/queryDocVolumeOriginalEntityRecycle2" , method= RequestMethod.POST)
|
||
@ApiImplicitParams({
|
||
@ApiImplicitParam(name = "recId", example = "1", value = "recId", dataType = "String", paramType = "query"),
|
||
@ApiImplicitParam(name = "fileStatus", example = "1", value = "文件状态(1-上传文件数据,2-回收站数据)", dataType = "String", paramType = "query"),
|
||
})
|
||
@ApiOperation(value = "查询原文文件信息")
|
||
public AjaxJson queryDocVolumeOriginalEntityRecycle2(
|
||
@RequestParam(value = "recId",required = true)Integer recId,
|
||
@RequestParam(value = "fileStatus",required = true)Integer fileStatus
|
||
) {
|
||
AjaxJson json = null;
|
||
try {
|
||
Map<String,Object> map=new HashMap<>();
|
||
map.put("recId",recId);
|
||
map.put("fileStatus",fileStatus);
|
||
List list = docTraditionVolumeService.queryDocVolumeOriginalEntityRecycle2(map);
|
||
json = new AjaxJson();
|
||
json.put("list", list);
|
||
}catch(Exception e) {
|
||
json = AjaxJson.returnExceptionInfo("查询原文回收站信息失败"+e);
|
||
}
|
||
return json;
|
||
}
|
||
|
||
|
||
|
||
@RequestMapping(value="/updateDocVolumeOriginalEntityRecycle" , method= RequestMethod.POST)
|
||
@ApiOperation(value = "原文回收站恢复")
|
||
@ApiImplicitParams({
|
||
@ApiImplicitParam(paramType = "query", name = "id", value = "原文主键id", required = true, dataType = "String"),
|
||
})
|
||
public AjaxJson updateDocVolumeOriginalEntityRecycle(Integer id) {
|
||
AjaxJson json = null;
|
||
try {
|
||
docTraditionVolumeService.updateDocVolumeOriginalEntityRecycle(id);
|
||
json = new AjaxJson();
|
||
}catch(Exception e) {
|
||
json = AjaxJson.returnExceptionInfo("原文回收站恢复失败"+e);
|
||
}
|
||
return json;
|
||
}
|
||
|
||
@RequestMapping(value="/deleteDocVolumeOriginalEntityRecycle" , method= RequestMethod.POST)
|
||
@ApiOperation(value = "删除原文回收站,批量删除用逗号隔开id值")
|
||
@ApiImplicitParams({
|
||
@ApiImplicitParam(paramType = "query", name = "ids", value = "逗号拼接的id字符串", required = true, dataType = "String"),
|
||
})
|
||
public AjaxJson deleteDocVolumeOriginalEntityRecycle(String ids) {
|
||
AjaxJson json = null;
|
||
try {
|
||
int num = docTraditionVolumeService.deleteDocVolumeOriginalEntityRecycle(ids);
|
||
json = AjaxJson.returnInfo("成功删除"+num+"条记录");
|
||
}catch(Exception e) {
|
||
json = AjaxJson.returnExceptionInfo("删除原文回收站信息失败"+e);
|
||
}
|
||
return json;
|
||
}
|
||
|
||
|
||
@RequestMapping(value="/updateTempFile" , method= RequestMethod.POST)
|
||
@ApiOperation(value = "把文件删除到回收站以及恢复")
|
||
@ApiImplicitParams({
|
||
@ApiImplicitParam(name = "ids", example = "1,2", value = "支持批量操作", dataType = "String", paramType = "query"),
|
||
@ApiImplicitParam(name = "fileStatus", example = "1", value = "文件状态(1-上传文件数据,2-回收站数据)", dataType = "String", paramType = "query"),
|
||
})
|
||
public AjaxJson updateTempFile(
|
||
@RequestParam(value = "ids",required = true)String ids,
|
||
@RequestParam(value = "fileStatus",required = true)Integer fileStatus
|
||
) {
|
||
AjaxJson json = null;
|
||
try {
|
||
String[] idArray=ids.split(",");
|
||
for (String id:idArray) {
|
||
DocVolumeOriginalEntity entity=new DocVolumeOriginalEntity();
|
||
entity.setId(Integer.parseInt(id));
|
||
entity.setFileStatus(fileStatus);
|
||
docTraditionVolumeService.updateTempFile(entity);
|
||
json = new AjaxJson();
|
||
}
|
||
DocVolumeOriginalEntity entity=docTraditionVolumeService.selectFileOneById(Integer.parseInt(idArray[0]));
|
||
docTraditionVolumeService.wsjnmlTempCount(entity.getRecid());
|
||
}catch(Exception e) {
|
||
json = AjaxJson.returnExceptionInfo("操作失败"+e);
|
||
}
|
||
return json;
|
||
}
|
||
|
||
|
||
|
||
|
||
}
|