206 lines
6.2 KiB
Java
206 lines
6.2 KiB
Java
package com.point.strategy.oaDocking.service;
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.point.strategy.docSimpleArrange.bean.DocOriginalEntity;
|
|
import com.point.strategy.oaDocking.bean.DocOriginalOaEntity;
|
|
import com.point.strategy.oaDocking.bean.DocSimpleArrangeOa;
|
|
import com.point.strategy.oaDocking.mapper.DocSimpleOaMapper;
|
|
import jxl.Cell;
|
|
import jxl.Sheet;
|
|
import jxl.Workbook;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import java.io.InputStream;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
//文书简化
|
|
@Service
|
|
@Transactional
|
|
public class DocSimpleOaService {
|
|
// @Resource
|
|
@Autowired
|
|
public DocSimpleOaMapper docSimpleMapper;
|
|
|
|
public List getDocSimpleWithPage(DocSimpleArrangeOa docSimpleArrange) {
|
|
PageHelper.startPage(docSimpleArrange.getPage(), docSimpleArrange.getLimit());
|
|
List docSimpleArranges= docSimpleMapper.getDocSimpleWithPage(docSimpleArrange);
|
|
return docSimpleArranges;
|
|
}
|
|
|
|
public int saveDocSimple(DocSimpleArrangeOa docSimpleArrange) {
|
|
return docSimpleMapper.saveDocSimple(docSimpleArrange);
|
|
}
|
|
|
|
public int deleteDocSimple(String ids) {
|
|
int num = 0;
|
|
if(ids!=null && !"".equals(ids) && ids.length()>0){
|
|
String id[] = ids.split(",");
|
|
for(int i=0;i<id.length;i++){
|
|
String index = id[i];
|
|
Integer t = Integer.valueOf(index);
|
|
int j = docSimpleMapper.deleteDocSimple(t);
|
|
docSimpleMapper.deleteDocSimpleCascadeRecycle(t);
|
|
if(j>0) {
|
|
num = num + 1;
|
|
}
|
|
}
|
|
}
|
|
return num;
|
|
}
|
|
|
|
public int updateDocSimple(DocSimpleArrangeOa docSimpleArrange) {
|
|
return docSimpleMapper.updateDocSimple(docSimpleArrange);
|
|
}
|
|
|
|
public DocOriginalOaEntity queryDocOriginalEntityById(Integer id){
|
|
return docSimpleMapper.queryDocOriginalEntityById(id);
|
|
}
|
|
|
|
//下载文件url写法http://localhost:8081/ureport/pdf?_u=file:rr.ureport.xml&name=du,name值在第三个参数map里面
|
|
public List docSimplePdf(String dataSourceName,String dataSetName,Map paramMap) {
|
|
DocSimpleArrangeOa docSimpleArrange = new DocSimpleArrangeOa();
|
|
docSimpleArrange.setFondsNo((String)paramMap.get("fondsNo"));
|
|
docSimpleArrange.setFondsNoCode((String)paramMap.get("fondsNoCode"));
|
|
List docSimpleArranges= docSimpleMapper.getDocSimpleWithPage(docSimpleArrange);
|
|
return docSimpleArranges;
|
|
}
|
|
|
|
public int getDocOriginalEntityCount(Integer recId) {
|
|
return docSimpleMapper.getDocOriginalEntityCount(recId);
|
|
}
|
|
|
|
|
|
|
|
public void saveDocOriginalEntity(DocOriginalOaEntity docOriginalEntity) {
|
|
docSimpleMapper.saveDocOriginalEntity(docOriginalEntity);
|
|
}
|
|
|
|
public void saveDocOriginalJnEntity(DocOriginalOaEntity docOriginalEntity) {
|
|
docSimpleMapper.saveDocOriginalJnEntity(docOriginalEntity);
|
|
}
|
|
|
|
|
|
public List queryDocOriginalEntity(Integer recId) {
|
|
return docSimpleMapper.queryDocOriginalEntity(recId);
|
|
}
|
|
|
|
|
|
public int updateDocOriginalEntity(String ids){
|
|
int num = 0;
|
|
if(ids!=null && !"".equals(ids) && ids.length()>0){
|
|
String id[] = ids.split(",");
|
|
for(int i=0;i<id.length;i++){
|
|
String index = id[i];
|
|
Integer t = Integer.valueOf(index);
|
|
int j = docSimpleMapper.updateDocOriginalEntity(t);
|
|
if(j>0) {
|
|
num = num + 1;
|
|
}
|
|
}
|
|
}
|
|
return num;
|
|
|
|
}
|
|
|
|
public List queryDocOriginalEntityRecycle(Integer recId) {
|
|
return docSimpleMapper.queryDocOriginalEntityRecycle(recId);
|
|
}
|
|
|
|
public void updateDocOriginalEntityRecycle(Integer id){
|
|
docSimpleMapper.updateDocOriginalEntityRecycle(id);
|
|
}
|
|
|
|
|
|
public int deleteDocOriginalEntityRecycle(String ids) {
|
|
int num = 0;
|
|
if(ids!=null && !"".equals(ids) && ids.length()>0){
|
|
String id[] = ids.split(",");
|
|
for(int i=0;i<id.length;i++){
|
|
String index = id[i];
|
|
Integer t = Integer.valueOf(index);
|
|
int j = docSimpleMapper.deleteDocOriginalEntityRecycle(t);
|
|
if(j>0) {
|
|
num = num + 1;
|
|
}
|
|
}
|
|
}
|
|
return num;
|
|
}
|
|
|
|
public void saveBatchDocSimple(MultipartFile file)throws Exception {
|
|
String tableName = "wsda_20190528111300933_temp_oa";
|
|
String fieldName = "case_no," +
|
|
" mlh," +
|
|
" archive_no," +
|
|
" note ," +
|
|
" pigeonhole_date," +
|
|
" archive_ctg_no," +
|
|
" archive_ctg_no_code," +
|
|
" retention," +
|
|
" retention_code," +
|
|
" filing_year," +
|
|
" fonds_no," +
|
|
" fonds_no_code," +
|
|
" sbt_word," +
|
|
" doc_no," +
|
|
" dagdm," +
|
|
" dagdm_code," +
|
|
" created_date," +
|
|
" object_quantity," +
|
|
" security_class," +
|
|
" security_class_code," +
|
|
" quantity," +
|
|
" piece_no," +
|
|
" kzbs," +
|
|
" kzbs_code," +
|
|
" folder_location," +
|
|
" damldm," +
|
|
" damldm_code," +
|
|
" maintitle," +
|
|
" responsibleby," +
|
|
" create_person," +
|
|
" create_date," +
|
|
" is_packeep," +
|
|
" is_packeep_code," +
|
|
" md5_code," +
|
|
" md5_check_date," +
|
|
" batch_id," +
|
|
" batch_name," +
|
|
" back_to_update_state," +
|
|
" is_process," +
|
|
" testtest_code," +
|
|
" archive_file_num," +
|
|
" departname," +
|
|
" departname_code," +
|
|
" lb," +
|
|
" lb_code," +
|
|
" lm," +
|
|
" lm_code," +
|
|
" archive_flag";
|
|
InputStream in = file.getInputStream();
|
|
Workbook boxExcel = Workbook.getWorkbook(in);
|
|
Sheet boxSheet = boxExcel.getSheet(0);
|
|
for (int i = 1; i < boxSheet.getRows(); i++) {
|
|
StringBuffer valueNameBuffer = new StringBuffer();
|
|
Map map = new HashMap();
|
|
for (int j = 0; j <boxSheet.getColumns(); j++) {
|
|
Cell boxCell = boxSheet.getCell(j, i);
|
|
String val = boxCell.getContents();
|
|
if("".equals(val))val=null;
|
|
if(j==0)valueNameBuffer.append(val);
|
|
else valueNameBuffer.append(","+val);
|
|
}
|
|
String valueName = valueNameBuffer.toString();
|
|
map.put("tableName", tableName);
|
|
map.put("fieldName", fieldName);
|
|
map.put("valueName", valueName);
|
|
docSimpleMapper.saveBatchDocSimple(map);
|
|
}
|
|
}
|
|
}
|