forked from integrated_whb/integrated_whb
交通类型一期一档档案首页追加
parent
f1d83a7bd8
commit
f9097fe38a
|
@ -0,0 +1,87 @@
|
||||||
|
package com.zcloud.util.archivesUtil;
|
||||||
|
|
||||||
|
import com.zcloud.entity.PageData;
|
||||||
|
import com.zcloud.mapper.dsno3.eduArchives.ArchivesMapper;
|
||||||
|
import com.zcloud.mapper.dsno3.eduStudy.ClassMapper;
|
||||||
|
import com.zcloud.service.eduArchives.ArchivesService;
|
||||||
|
import com.zcloud.util.Const;
|
||||||
|
import com.zcloud.util.DateUtil;
|
||||||
|
import com.zcloud.util.WordToPdfUtil;
|
||||||
|
import fr.opensagres.xdocreport.document.IXDocReport;
|
||||||
|
import fr.opensagres.xdocreport.document.registry.XDocReportRegistry;
|
||||||
|
import fr.opensagres.xdocreport.template.IContext;
|
||||||
|
import fr.opensagres.xdocreport.template.TemplateEngineKind;
|
||||||
|
import fr.opensagres.xdocreport.template.formatter.FieldsMetadata;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 说明:安全培训教材会审表
|
||||||
|
* 作者:wangxuan
|
||||||
|
* 官网:www.zcloudchina.com
|
||||||
|
*
|
||||||
|
* @author wangxuan
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class HomeAbsHandler extends AbsHandlerBatchExport {
|
||||||
|
@Autowired
|
||||||
|
private ClassMapper classMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ArchivesService archivesService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ArchivesMapper archivesMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 返回pdf路径
|
||||||
|
* @Author: dearLin
|
||||||
|
* @Date: 2023/3/20/020 10:41
|
||||||
|
* @Param: [com.zcloud.entity.PageData] [pageData]
|
||||||
|
* @Return: java.lang.String
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public File batchExport(PageData pd, String nowZip) throws Exception {
|
||||||
|
String projectPath = pd.getString("projectPath");
|
||||||
|
String now = DateUtil.getSdfTimesSSS();
|
||||||
|
ArrayList<File> files = new ArrayList<>(); //最外层
|
||||||
|
PageData clazz = classMapper.findById(pd);
|
||||||
|
List<PageData> studentList = archivesMapper.getStudents(pd);
|
||||||
|
|
||||||
|
SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd"); //日期格式
|
||||||
|
SimpleDateFormat dayformat = new SimpleDateFormat("yyyy年MM月"); //日期格式
|
||||||
|
|
||||||
|
File file = new File(projectPath + Const.FILEPATHWORDTEMPLATE + "traffic-records1.docx");
|
||||||
|
InputStream mbwj = new FileInputStream(file);
|
||||||
|
//注册xdocreport实例并加载FreeMarker模板引擎
|
||||||
|
IXDocReport report = XDocReportRegistry.getRegistry().loadReport(mbwj, TemplateEngineKind.Freemarker);
|
||||||
|
//创建xdocreport上下文对象
|
||||||
|
IContext context = report.createContext();
|
||||||
|
|
||||||
|
context.put("value1", clazz.get("INDUSTRY_END_NAME") + "企业");
|
||||||
|
context.put("value2", clazz.get("CORP_NAME"));
|
||||||
|
context.put("value3", dayformat.format(dateformat.parse(clazz.getString("START_TIME"))));
|
||||||
|
FieldsMetadata fm = report.createFieldsMetadata();
|
||||||
|
//输出到本地目录
|
||||||
|
FileOutputStream out = new FileOutputStream(new File(projectPath + Const.FILEPATHFILE + "首页-" + now + ".docx"));
|
||||||
|
report.process(context, out);
|
||||||
|
WordToPdfUtil.docToPdf(projectPath + Const.FILEPATHFILE + "首页-" + now + ".docx", projectPath + Const.FILEPATHFILE + "首页-" + now + ".pdf");
|
||||||
|
//删除本地word pdf
|
||||||
|
File word = new File(projectPath + Const.FILEPATHFILE + "首页-" + now + ".docx");
|
||||||
|
word.delete();
|
||||||
|
return new File(projectPath + Const.FILEPATHFILE + "首页-" + now + ".pdf");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterPropertiesSet() throws Exception {
|
||||||
|
BatchExportFactory.register("archives111", this);
|
||||||
|
}
|
||||||
|
}
|
|
@ -323,6 +323,8 @@
|
||||||
corp.CORP_NAME,
|
corp.CORP_NAME,
|
||||||
corp.CORP_TYPE_NAME,
|
corp.CORP_TYPE_NAME,
|
||||||
corp.CORP_TYPE4,
|
corp.CORP_TYPE4,
|
||||||
|
corp.INDUSTRY_TYPE as INDUSTRY_ALL_TYPE,
|
||||||
|
corp.INDUSTRY_NAME as INDUSTRY_ALL_NAME,
|
||||||
us1.SIGN_PICTURE RECORDOR_SIGN,
|
us1.SIGN_PICTURE RECORDOR_SIGN,
|
||||||
us2.SIGN_PICTURE ASSESSOR_SIGN,
|
us2.SIGN_PICTURE ASSESSOR_SIGN,
|
||||||
us3.SIGN_PICTURE SAFETYDEPTOR_SIGN
|
us3.SIGN_PICTURE SAFETYDEPTOR_SIGN
|
||||||
|
@ -424,14 +426,14 @@
|
||||||
BUS_STAGESTUDENTRELATION s ON s.STUDENT_ID = f.STUDENT_ID
|
BUS_STAGESTUDENTRELATION s ON s.STUDENT_ID = f.STUDENT_ID
|
||||||
left join bus_class c on f.class_id = c.class_id
|
left join bus_class c on f.class_id = c.class_id
|
||||||
LEFT JOIN BUS_POST_TYPE p on p.POSTTYPE_ID = c.POSTTYPE
|
LEFT JOIN BUS_POST_TYPE p on p.POSTTYPE_ID = c.POSTTYPE
|
||||||
|
LEFT JOIN BUS_CORP_INFO ci on ci.CORPINFO_ID = c.CORPINFO_ID
|
||||||
LEFT JOIN BUS_TRAINING_TYPE t on t.TRAININGTYPE_ID = c.TRAINTYPE
|
LEFT JOIN BUS_TRAINING_TYPE t on t.TRAININGTYPE_ID = c.TRAINTYPE
|
||||||
LEFT JOIN BUS_INDUSTRY_TYPE iei on iei.INDUSTRYTYPE_ID = c.INDUSTRY_END_ID
|
LEFT JOIN BUS_INDUSTRY_TYPE iei on iei.INDUSTRYTYPE_ID = SUBSTRING_INDEX(ci.INDUSTRY_TYPE,',',-1)
|
||||||
LEFT JOIN BUS_TRAIN_LEVEL_TYPE tlt on tlt.TRAINLEVEL_ID = c.TRAINLEVEL
|
LEFT JOIN BUS_TRAIN_LEVEL_TYPE tlt on tlt.TRAINLEVEL_ID = c.TRAINLEVEL
|
||||||
LEFT JOIN SYS_USERINFO ui on ui.USER_ID = f.USER_ID
|
LEFT JOIN SYS_USERINFO ui on ui.USER_ID = f.USER_ID
|
||||||
LEFT JOIN SYS_DICTIONARIES cl on cl.DICTIONARIES_ID = ui.DEGREE_OF_EDUCATION
|
LEFT JOIN SYS_DICTIONARIES cl on cl.DICTIONARIES_ID = ui.DEGREE_OF_EDUCATION
|
||||||
LEFT JOIN SYS_DICTIONARIES_CORP dd on dd.DICTIONARIES_ID = ui.DUTIES
|
LEFT JOIN SYS_DICTIONARIES_CORP dd on dd.DICTIONARIES_ID = ui.DUTIES
|
||||||
LEFT JOIN SYS_DICTIONARIES_CORP dt on dt.DICTIONARIES_ID = ui.TITLE
|
LEFT JOIN SYS_DICTIONARIES_CORP dt on dt.DICTIONARIES_ID = ui.TITLE
|
||||||
LEFT JOIN BUS_CORP_INFO ci on ci.CORPINFO_ID = c.CORPINFO_ID
|
|
||||||
left join BUS_INDUSTRY_TYPE it on it.INDUSTRYTYPE_ID = ci.INDUSTRY_TYPE
|
left join BUS_INDUSTRY_TYPE it on it.INDUSTRYTYPE_ID = ci.INDUSTRY_TYPE
|
||||||
WHERE f.STUDENT_ID = #{STUDENT_ID}
|
WHERE f.STUDENT_ID = #{STUDENT_ID}
|
||||||
AND s.ISDELETE = '0'
|
AND s.ISDELETE = '0'
|
||||||
|
|
|
@ -301,6 +301,7 @@
|
||||||
CONCAT_WS('-',IF( t.NAME= '',null ,t.NAME ),IF( lei.NAME= '',null , lei.NAME ),IF( p.NAME= '',null , p.NAME
|
CONCAT_WS('-',IF( t.NAME= '',null ,t.NAME ),IF( lei.NAME= '',null , lei.NAME ),IF( p.NAME= '',null , p.NAME
|
||||||
),IF( tlt.NAME= '',null , tlt.NAME )) TYPENAME,
|
),IF( tlt.NAME= '',null , tlt.NAME )) TYPENAME,
|
||||||
tlt.NAME TRAINLEVEL_NAME,
|
tlt.NAME TRAINLEVEL_NAME,
|
||||||
|
lei.NAME as INDUSTRY_END_NAME,
|
||||||
bci.CORP_NAME,
|
bci.CORP_NAME,
|
||||||
bci.PLAN_DEPARTMENT,
|
bci.PLAN_DEPARTMENT,
|
||||||
us.SIGN_PICTURE AS SAFETYDEPTOR_URL
|
us.SIGN_PICTURE AS SAFETYDEPTOR_URL
|
||||||
|
@ -311,7 +312,7 @@
|
||||||
left join bus_corp_info bci on f.CORPINFO_ID = bci.CORPINFO_ID
|
left join bus_corp_info bci on f.CORPINFO_ID = bci.CORPINFO_ID
|
||||||
LEFT JOIN BUS_TRAINING_TYPE t on t.TRAININGTYPE_ID = f.TRAINTYPE
|
LEFT JOIN BUS_TRAINING_TYPE t on t.TRAININGTYPE_ID = f.TRAINTYPE
|
||||||
LEFT JOIN BUS_TRAIN_LEVEL_TYPE tlt on tlt.TRAINLEVEL_ID = f.TRAINLEVEL
|
LEFT JOIN BUS_TRAIN_LEVEL_TYPE tlt on tlt.TRAINLEVEL_ID = f.TRAINLEVEL
|
||||||
LEFT JOIN bus_industry_type lei ON lei.INDUSTRYTYPE_ID = f.INDUSTRY_END_ID
|
LEFT JOIN bus_industry_type lei ON lei.INDUSTRYTYPE_ID = SUBSTRING_INDEX(bci.INDUSTRY_TYPE,',',-1)
|
||||||
left join sys_user_sign us on us.USERSIGNID = f.SAFETYDEPTOR
|
left join sys_user_sign us on us.USERSIGNID = f.SAFETYDEPTOR
|
||||||
WHERE
|
WHERE
|
||||||
f.CLASS_ID = #{CLASS_ID}
|
f.CLASS_ID = #{CLASS_ID}
|
||||||
|
|
Loading…
Reference in New Issue