forked from integrated_whb/integrated_whb
交通类型档案生成
parent
beea93a80f
commit
a0b68504a6
|
@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||
import com.zcloud.controller.base.BaseController;
|
||||
import com.zcloud.entity.Result;
|
||||
import com.zcloud.service.eduArchives.ArchivesPdfFileService;
|
||||
import com.zcloud.service.eduArchives.ArchivesReviewRecordService;
|
||||
import com.zcloud.service.eduArchives.ArchivesService;
|
||||
import com.zcloud.service.eduArchives.TrainingScheduleService;
|
||||
import com.zcloud.service.eduStudy.*;
|
||||
|
@ -24,6 +25,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
|
@ -32,6 +34,7 @@ import java.io.InputStream;
|
|||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 说明:档案管理
|
||||
|
@ -63,6 +66,10 @@ public class ArchivesController extends BaseController {
|
|||
private StageStudentRelationService stageStudentRelationService;
|
||||
@Autowired
|
||||
private TrainingScheduleService trainingscheduleService;
|
||||
@Autowired
|
||||
private ClassPostService classPostService;
|
||||
@Resource
|
||||
private ArchivesReviewRecordService archivesReviewRecordService;
|
||||
|
||||
/**
|
||||
* 获取班级列表
|
||||
|
@ -240,7 +247,7 @@ public class ArchivesController extends BaseController {
|
|||
DecimalFormat classhourF = new DecimalFormat("0.0"); //保留一位小数
|
||||
rpd.put("SUMCLASSHOUR", classhour == 0.0 ? 0 : classhourF.format(classhour));
|
||||
rpd.put("CURRICULUMNAMES", CURRICULUMNAMES);
|
||||
rpd.put("CORPINFO_NAME", corpinfo.getString("NAME"));
|
||||
rpd.put("CORPINFO_NAME", corpinfo.getString("CORP_NAME"));
|
||||
|
||||
map.put("studentList", studentList);
|
||||
map.put("clazz", clazz);
|
||||
|
@ -1252,4 +1259,226 @@ public class ArchivesController extends BaseController {
|
|||
result.put("pd", data);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询班级课件
|
||||
*
|
||||
* @param
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/getTraining")
|
||||
@ResponseBody
|
||||
public Object getTraining() throws Exception {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
String errInfo = "success";
|
||||
PageData pd = new PageData();
|
||||
pd = this.getPageData();
|
||||
PageData clazz = classService.findById(pd);
|
||||
List<PageData> studentList = archivesService.getStudents(pd);
|
||||
List<String> ArrayDATA_IDS = new ArrayList<String>();
|
||||
|
||||
SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd"); //日期格式
|
||||
SimpleDateFormat dayformat = new SimpleDateFormat("yyyy.MM.dd"); //日期格式
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("MM.dd");
|
||||
|
||||
|
||||
List<PageData> byClass = classPostService.findByClass(pd);
|
||||
Set<String> postNameSet = new HashSet<>();
|
||||
|
||||
for (PageData aClass : byClass) {
|
||||
postNameSet.add(aClass.getString("POST_NAME"));
|
||||
}
|
||||
|
||||
pd.put("ArrayDATA_IDS", ArrayDATA_IDS);
|
||||
List<PageData> coursewaresList = archivesService.getCoursewares(pd);
|
||||
|
||||
double CLASSHOUR = 0;
|
||||
Set<String> TEACHERNAME = new HashSet<>();
|
||||
for (PageData pageData : coursewaresList ) {
|
||||
CLASSHOUR += (Double) pageData.get("CLASSHOUR");
|
||||
TEACHERNAME.add(pageData.get("TEACHERNAME").toString());
|
||||
}
|
||||
|
||||
StringBuilder COURSEWARENAME = new StringBuilder();
|
||||
List<PageData> curriculums = archivesService.getCurriculums(pd);
|
||||
for (PageData curriculum : curriculums) {
|
||||
COURSEWARENAME.append(curriculum.getString("CURRICULUMNAME")).append(",");
|
||||
}
|
||||
|
||||
List<PageData> sdrs = studentList.stream().filter(item ->
|
||||
"2".equals(item.getString("STUDYSTATE")) ||
|
||||
"3".equals(item.getString("STUDYSTATE")) ||
|
||||
"5".equals(item.getString("STUDYSTATE")) ||
|
||||
"6".equals(item.getString("STUDYSTATE"))
|
||||
).collect(Collectors.toList());
|
||||
|
||||
PageData pageData = new PageData();
|
||||
pageData.put("START_TIME", dayformat.format(dateformat.parse(clazz.getString("START_TIME"))) + "-" + formatter.format(dateformat.parse(clazz.getString("END_TIME"))));
|
||||
pageData.put("CORP_NAME", clazz.getString("CORP_NAME"));
|
||||
pageData.put("POST_NAME", String.join(",", postNameSet));
|
||||
pageData.put("PLAN_DEPARTMENT", Tools.notEmpty(clazz.getString("PLAN_DEPARTMENT"))?clazz.getString("PLAN_DEPARTMENT"):"");
|
||||
pageData.put("SAFETYDEPTOR_URL", clazz.get("SAFETYDEPTOR_URL"));
|
||||
pageData.put("TEACHERNAME", String.join(",", TEACHERNAME));
|
||||
pageData.put("CLASSHOUR", CLASSHOUR);
|
||||
pageData.put("stuYDNum", studentList.size());
|
||||
pageData.put("stuSDNum", sdrs.size());
|
||||
pageData.put("COURSEWARENAME", COURSEWARENAME.toString().substring(0,COURSEWARENAME.length()-1));
|
||||
|
||||
List<PageData> curList = archivesService.getCurriculums(pd);
|
||||
for (PageData c : curList) {
|
||||
PageData cha = new PageData();
|
||||
cha.put("PARENT_ID", "0");
|
||||
cha.put("CURRICULUM_ID", c.get("CURRICULUM_ID"));
|
||||
cha.put("CLASS_ID", pd.get("CLASS_ID"));
|
||||
|
||||
List<PageData> chapterList = archivesService.getCoursewares(cha, false);
|
||||
for (PageData chapterdt:chapterList) {
|
||||
if (Tools.isEmpty(chapterdt.getString("COURSEWAREINTRODUCE")) || "undefined".equals(chapterdt.getString("COURSEWAREINTRODUCE"))) {
|
||||
chapterdt.put("COURSEWAREINTRODUCE", chapterdt.getString("COURSEWARENAME"));
|
||||
}
|
||||
}
|
||||
|
||||
// 二级目录结构时,查询子级目录
|
||||
if (c != null && c.get("CATALOGUELEVEL") != null
|
||||
&& Tools.notEmpty(c.get("CATALOGUELEVEL").toString())
|
||||
&& "2".equals(c.get("CATALOGUELEVEL").toString())
|
||||
&& chapterList != null && chapterList.size() > 0) {
|
||||
for (PageData chapter : chapterList) {
|
||||
PageData firstChapter = new PageData();
|
||||
firstChapter.put("CURRICULUM_ID", c.get("CURRICULUM_ID"));
|
||||
firstChapter.put("PARENT_ID", chapter.get("CHAPTER_ID"));
|
||||
firstChapter.put("CLASS_ID", pd.get("CLASS_ID"));
|
||||
List<PageData> nodesList = archivesService.getCoursewares(firstChapter);
|
||||
for (PageData chapterdt:nodesList) {
|
||||
if (Tools.isEmpty(chapterdt.getString("COURSEWAREINTRODUCE")) || "undefined".equals(chapterdt.getString("COURSEWAREINTRODUCE"))) {
|
||||
chapterdt.put("COURSEWAREINTRODUCE", chapterdt.getString("COURSEWARENAME"));
|
||||
}
|
||||
}
|
||||
chapter.put("nodes", nodesList);
|
||||
}
|
||||
}
|
||||
c.put("chapterList", chapterList);
|
||||
}
|
||||
|
||||
PageData trainingData = archivesReviewRecordService.getTraining(pd);
|
||||
if (trainingData == null) {
|
||||
trainingData = new PageData();
|
||||
}
|
||||
map.put("data", pageData);
|
||||
map.put("trainingData", trainingData);
|
||||
map.put("curList", curList);
|
||||
map.put("result", errInfo);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 教育培训记录
|
||||
* @Author: dearLin
|
||||
* @Date: 2023/3/17/017 16:34
|
||||
* @Param:
|
||||
* @Return:
|
||||
*/
|
||||
@RequestMapping("/trainingAsTraffic")
|
||||
@ResponseBody
|
||||
public Object trainingAsTraffic(HttpServletResponse response) throws Exception {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
String errInfo = "success";
|
||||
PageData pd = this.getPageData();
|
||||
PageData apf = new PageData();
|
||||
apf.put("ARCHIVES_PDF_FILE_ID", this.get32UUID());
|
||||
apf.put("TABLE_NAME", "bus_class");
|
||||
apf.put("TABLE_ID", pd.get("CLASS_ID"));
|
||||
apf.put("TYPE", "2");
|
||||
apf.put("STATUS", "0");
|
||||
apf.put("CREATOR", Jurisdiction.getUsername());
|
||||
apf.put("CREATTIME", DateUtil.date2Str(new Date()));
|
||||
PageData classInfo = classService.findById(pd);
|
||||
apf.put("DESCR", classInfo.getString("NAME") + "-一期一档-教育培训记录");
|
||||
apf.put("METHOD_NAME", "sign"); //方法名
|
||||
apf.put("CLASS_NAME", PageData.class.getName()); //方法名中参数的类型 --如方法类型有多个,使类型用逗号连接,格式:xx,yyy
|
||||
pd.put("ARCHIVES_PDF_FILE_ID", apf.get("ARCHIVES_PDF_FILE_ID"));
|
||||
map.put("result", errInfo);
|
||||
pd.put("projectPath", PathUtil.getProjectpath());
|
||||
pd.put("CLASS_NAME", classInfo.getString("NAME"));
|
||||
pd.put("USERNAME", Jurisdiction.getUsername());
|
||||
apf.put("PARAM_NAME", JSONObject.toJSON(pd).toString());//方法名中参数的值 --如方法中参数有多个,使参数用逗号连接,格式:{"a":a},{"b":b}
|
||||
archivesPdfFileService.save(apf);
|
||||
// 异步生成档案
|
||||
archivesPdfFileService.trainingAsTraffic(pd);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 安全知识培训签到表
|
||||
* @Author: dearLin
|
||||
* @Date: 2023/3/17/017 16:34
|
||||
* @Param:
|
||||
* @Return:
|
||||
*/
|
||||
@RequestMapping("/signAsTraffic")
|
||||
@ResponseBody
|
||||
public Object signAsTraffic(HttpServletResponse response) throws Exception {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
String errInfo = "success";
|
||||
PageData pd = this.getPageData();
|
||||
PageData apf = new PageData();
|
||||
apf.put("ARCHIVES_PDF_FILE_ID", this.get32UUID());
|
||||
apf.put("TABLE_NAME", "bus_class");
|
||||
apf.put("TABLE_ID", pd.get("CLASS_ID"));
|
||||
apf.put("TYPE", "2");
|
||||
apf.put("STATUS", "0");
|
||||
apf.put("CREATOR", Jurisdiction.getUsername());
|
||||
apf.put("CREATTIME", DateUtil.date2Str(new Date()));
|
||||
PageData classInfo = classService.findById(pd);
|
||||
apf.put("DESCR", classInfo.getString("NAME") + "-一期一档-安全培训教育记录及签字表");
|
||||
apf.put("METHOD_NAME", "sign"); //方法名
|
||||
apf.put("CLASS_NAME", PageData.class.getName()); //方法名中参数的类型 --如方法类型有多个,使类型用逗号连接,格式:xx,yyy
|
||||
pd.put("ARCHIVES_PDF_FILE_ID", apf.get("ARCHIVES_PDF_FILE_ID"));
|
||||
map.put("result", errInfo);
|
||||
pd.put("projectPath", PathUtil.getProjectpath());
|
||||
pd.put("CLASS_NAME", classInfo.getString("NAME"));
|
||||
pd.put("USERNAME", Jurisdiction.getUsername());
|
||||
apf.put("PARAM_NAME", JSONObject.toJSON(pd).toString());//方法名中参数的值 --如方法中参数有多个,使参数用逗号连接,格式:{"a":a},{"b":b}
|
||||
archivesPdfFileService.save(apf);
|
||||
// 异步生成档案
|
||||
archivesPdfFileService.signAsTraffic(pd);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 学员考核成绩统计表
|
||||
*
|
||||
* @param
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/studentsumtableAsTraffic")
|
||||
@ResponseBody
|
||||
public Object studentsumtableAsTraffic(HttpServletResponse response) throws Exception {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
String errInfo = "success";
|
||||
PageData pd = this.getPageData();
|
||||
PageData apf = new PageData();
|
||||
apf.put("ARCHIVES_PDF_FILE_ID", this.get32UUID());
|
||||
apf.put("TABLE_NAME", "bus_class");
|
||||
apf.put("TABLE_ID", pd.get("CLASS_ID"));
|
||||
apf.put("TYPE", "2");
|
||||
apf.put("STATUS", "0");
|
||||
apf.put("CREATOR", Jurisdiction.getUsername());
|
||||
apf.put("CREATTIME", DateUtil.date2Str(new Date()));
|
||||
PageData clazz = classService.findById(pd);
|
||||
apf.put("DESCR", clazz.getString("NAME") + "-一期一档-学员考核成绩统计表");
|
||||
apf.put("METHOD_NAME", "studentsumtable"); //方法名
|
||||
apf.put("CLASS_NAME", PageData.class.getName()); //方法名中参数的类型 --如方法类型有多个,使类型用逗号连接,格式:xx,yyy
|
||||
pd.put("ARCHIVES_PDF_FILE_ID", apf.get("ARCHIVES_PDF_FILE_ID"));
|
||||
map.put("result", errInfo);
|
||||
pd.put("projectPath", PathUtil.getProjectpath());
|
||||
apf.put("PARAM_NAME", JSONObject.toJSON(pd).toString());//方法名中参数的值 --如方法中参数有多个,使参数用逗号连接,格式:{"a":a},{"b":b}
|
||||
archivesPdfFileService.save(apf);
|
||||
// 异步生成档案
|
||||
archivesPdfFileService.studentsumtableAsTraffic(pd);
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -148,4 +148,28 @@ public class ArchivesReviewRecordController extends BaseController {
|
|||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/editTraining")
|
||||
@ResponseBody
|
||||
public Object editTraining() throws Exception {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
String errInfo = "success";
|
||||
PageData pd = new PageData();
|
||||
pd = this.getPageData();
|
||||
PageData data = archivesReviewRecordService.getTraining(pd);
|
||||
pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人
|
||||
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
|
||||
if (data != null) {
|
||||
archivesReviewRecordService.editTraining(pd);
|
||||
} else {
|
||||
archivesReviewRecordService.saveTraining(pd);
|
||||
}
|
||||
map.put("result", errInfo);
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,13 +65,11 @@ public interface ArchivesReviewRecordMapper {
|
|||
*/
|
||||
PageData getInfo(PageData pd);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ArrayDATA_IDS
|
||||
* @throws Exception
|
||||
*/
|
||||
void deleteAll(String[] ArrayDATA_IDS);
|
||||
|
||||
PageData getTraining(PageData pd);
|
||||
|
||||
void editTraining(PageData pd);
|
||||
|
||||
void saveTraining(PageData pd);
|
||||
}
|
||||
|
||||
|
|
|
@ -258,5 +258,26 @@ public interface ArchivesPdfFileService{
|
|||
*/
|
||||
@Async("downloadArchivesAsync")
|
||||
void downloadPlanFile(PageData pd) throws Exception;
|
||||
|
||||
/**
|
||||
* 一期一档--教育培训记录
|
||||
* @throws Exception
|
||||
*/
|
||||
@Async("downloadArchivesAsync")
|
||||
void trainingAsTraffic(PageData pd) throws Exception;
|
||||
|
||||
/**
|
||||
* 一期一档--安全知识培训签到表
|
||||
* @throws Exception
|
||||
*/
|
||||
@Async("downloadArchivesAsync")
|
||||
void signAsTraffic(PageData pd);
|
||||
|
||||
/**
|
||||
* 一期一档--学员考核成绩统计表导出(交通班级)
|
||||
* @throws Exception
|
||||
*/
|
||||
@Async("downloadArchivesAsync")
|
||||
void studentsumtableAsTraffic(PageData pd);
|
||||
}
|
||||
|
||||
|
|
|
@ -68,13 +68,10 @@ public interface ArchivesReviewRecordService {
|
|||
*/
|
||||
public PageData getInfo(PageData pd) throws Exception;
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ArrayDATA_IDS
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteAll(String[] ArrayDATA_IDS) throws Exception;
|
||||
PageData getTraining(PageData pd) throws Exception;
|
||||
|
||||
void editTraining(PageData pd) throws Exception;
|
||||
|
||||
void saveTraining(PageData pd) throws Exception;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
|
|||
import com.zcloud.mapper.dsno3.eduArchives.*;
|
||||
import com.zcloud.mapper.dsno3.eduStudy.*;
|
||||
import com.zcloud.service.eduArchives.ArchivesPdfFileService;
|
||||
import com.zcloud.service.eduArchives.ArchivesReviewRecordService;
|
||||
import com.zcloud.service.eduArchives.ArchivesService;
|
||||
import com.zcloud.service.eduArchives.ArchivesStudentService;
|
||||
import com.zcloud.mapper.dsno3.eduTrain.TrainingScheduleMapper;
|
||||
|
@ -37,6 +38,7 @@ import java.nio.file.Files;
|
|||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 说明:档案文件
|
||||
|
@ -102,6 +104,10 @@ public class ArchivesPdfFileServiceImpl implements ArchivesPdfFileService {
|
|||
private ArchivesFilesMapper archivesfilesMapper;
|
||||
@Autowired
|
||||
private Smb smb;
|
||||
@Autowired
|
||||
private ClassPostMapper classPostMapper;
|
||||
@Resource
|
||||
private ArchivesReviewRecordService archivesReviewRecordService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
|
@ -969,6 +975,19 @@ public class ArchivesPdfFileServiceImpl implements ArchivesPdfFileService {
|
|||
List<PageData> data = JSONArray.parseArray((String) pd.get("typeList"), PageData.class);
|
||||
ArrayList<File> files = new ArrayList<>();
|
||||
String now = "";
|
||||
if (
|
||||
data.size() == 5 &&
|
||||
(Integer) data.get(0).get("TYPE") == 110 &&
|
||||
(Integer) data.get(1).get("TYPE") == 106 &&
|
||||
(Integer) data.get(2).get("TYPE") == 112 &&
|
||||
(Integer) data.get(3).get("TYPE") == 107 &&
|
||||
(Integer) data.get(4).get("TYPE") == 113
|
||||
) {
|
||||
PageData pageData = new PageData();
|
||||
pageData.put("TYPE", "111");
|
||||
pageData.put("NAME", "首页");
|
||||
data.add(pageData);
|
||||
}
|
||||
for (PageData item : data) {
|
||||
AbsHandlerBatchExport handler = BatchExportFactory.getInvokeStrategy("archives" + item.get("TYPE"));
|
||||
if (handler != null) {
|
||||
|
@ -3522,5 +3541,465 @@ public class ArchivesPdfFileServiceImpl implements ArchivesPdfFileService {
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trainingAsTraffic(PageData pd) {
|
||||
try {
|
||||
String projectPath = pd.getString("projectPath");
|
||||
String now = DateUtil.getSdfTimesSSS();
|
||||
ArrayList<File> files = new ArrayList<>(); //最外层
|
||||
PageData clazz = classMapper.findById(pd);
|
||||
SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd"); //日期格式
|
||||
SimpleDateFormat dayformat = new SimpleDateFormat("yyyy.MM.dd"); //日期格式
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("MM.dd");
|
||||
|
||||
List<PageData> byClass = classPostMapper.findByClass(pd);
|
||||
Set<String> postNameSet = new HashSet<>();
|
||||
|
||||
for (PageData aClass : byClass) {
|
||||
postNameSet.add(aClass.getString("POST_NAME"));
|
||||
}
|
||||
|
||||
List<PageData> studentList = archivesService.getStudents(pd);
|
||||
List<String> ArrayDATA_IDS = new ArrayList<String>();
|
||||
|
||||
pd.put("ArrayDATA_IDS", ArrayDATA_IDS);
|
||||
List<PageData> coursewaresList = archivesService.getCoursewares(pd);
|
||||
|
||||
double CLASSHOUR = 0;
|
||||
Set<String> TEACHER_NAME = new HashSet<>();
|
||||
for (PageData pageData : coursewaresList ) {
|
||||
CLASSHOUR += (Double) pageData.get("CLASSHOUR");
|
||||
TEACHER_NAME.add(pageData.get("TEACHERNAME").toString());
|
||||
}
|
||||
|
||||
StringBuilder COURSEWARENAME = new StringBuilder();
|
||||
List<PageData> curriculums = archivesService.getCurriculums(pd);
|
||||
for (PageData curriculum : curriculums) {
|
||||
COURSEWARENAME.append(curriculum.getString("CURRICULUMNAME")).append(",");
|
||||
}
|
||||
|
||||
List<PageData> sdrs = studentList.stream().filter(item ->
|
||||
"2".equals(item.getString("STUDYSTATE")) ||
|
||||
"3".equals(item.getString("STUDYSTATE")) ||
|
||||
"5".equals(item.getString("STUDYSTATE")) ||
|
||||
"6".equals(item.getString("STUDYSTATE"))
|
||||
).collect(Collectors.toList());
|
||||
|
||||
List<PageData> curList = archivesService.getCurriculums(pd);
|
||||
for (PageData c : curList) {
|
||||
PageData cha = new PageData();
|
||||
PageData itemInfo = new PageData();
|
||||
cha.put("PARENT_ID", "0");
|
||||
itemInfo.put("var0", c.get("CURRICULUMNAME"));
|
||||
itemInfo.put("var1", c.get("CATALOGUELEVEL"));
|
||||
cha.put("CURRICULUM_ID", c.get("CURRICULUM_ID"));
|
||||
cha.put("CLASS_ID", pd.get("CLASS_ID"));
|
||||
List<PageData> chapterList = archivesService.getCoursewares(cha, false);
|
||||
|
||||
// 二级目录结构时,查询子级目录
|
||||
// 二级目录结构时,查询子级目录
|
||||
if (c != null && c.get("CATALOGUELEVEL") != null
|
||||
&& Tools.notEmpty(c.get("CATALOGUELEVEL").toString())
|
||||
&& "2".equals(c.get("CATALOGUELEVEL").toString())
|
||||
&& chapterList != null && chapterList.size() > 0) {
|
||||
for (int i = 0; i < chapterList.size(); i++) {
|
||||
chapterList.get(i).put("NUM", NumToChinese.arabicNumToChineseNum((i + 1)));
|
||||
PageData firstChapter = new PageData();
|
||||
firstChapter.put("CURRICULUM_ID", c.get("CURRICULUM_ID"));
|
||||
firstChapter.put("PARENT_ID", chapterList.get(i).get("CHAPTER_ID"));
|
||||
firstChapter.put("CLASS_ID", pd.get("CLASS_ID"));
|
||||
List<PageData> nodesList = archivesService.getCoursewares(firstChapter);
|
||||
for (PageData chapter2 : nodesList) {
|
||||
String COURSEWAREINTRODUCE = chapter2.getString("COURSEWAREINTRODUCE").replaceAll("\\\n", "");
|
||||
chapter2.put("COURSEWAREINTRODUCE", COURSEWAREINTRODUCE);
|
||||
if (org.apache.commons.lang.StringUtils.isEmpty(String.valueOf(chapter2.get("INDUSTRY_ALL_NAME")))) {
|
||||
chapter2.put("INDUSTRY_ALL_NAME", " ");
|
||||
} else {
|
||||
chapter2.put("INDUSTRY_ALL_NAME", " ");
|
||||
}
|
||||
String TEACHERNAME = (String) chapter2.get("TEACHERNAME");
|
||||
if (org.apache.commons.lang.StringUtils.isEmpty(TEACHERNAME)) {
|
||||
chapter2.put("TEACHERNAME", " ");
|
||||
}
|
||||
String TRAININGTYPE_NAME = (String) chapter2.get("TRAININGTYPE_NAME");
|
||||
if (org.apache.commons.lang.StringUtils.isEmpty(TRAININGTYPE_NAME)) {
|
||||
chapter2.put("TRAININGTYPE_NAME", " ");
|
||||
}
|
||||
String POSTTYPE_NAME = (String) chapter2.get("POSTTYPE_NAME");
|
||||
if (org.apache.commons.lang.StringUtils.isEmpty(POSTTYPE_NAME)) {
|
||||
chapter2.put("POSTTYPE_NAME", " ");
|
||||
}
|
||||
chapterList.get(i).put("nodes", nodesList);
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < chapterList.size(); i++) {
|
||||
chapterList.get(i).put("NUM", NumToChinese.arabicNumToChineseNum((i + 1)));
|
||||
String industryAllName = (String) chapterList.get(i).get("INDUSTRY_ALL_NAME");
|
||||
if (org.apache.commons.lang.StringUtils.isEmpty(industryAllName)) {
|
||||
chapterList.get(i).put("INDUSTRY_ALL_NAME", " ");
|
||||
}
|
||||
|
||||
String TEACHERNAME = (String) chapterList.get(i).get("TEACHERNAME");
|
||||
if (org.apache.commons.lang.StringUtils.isEmpty(TEACHERNAME)) {
|
||||
chapterList.get(i).put("TEACHERNAME", " ");
|
||||
}
|
||||
String TRAININGTYPE_NAME = (String) chapterList.get(i).get("TRAININGTYPE_NAME");
|
||||
if (org.apache.commons.lang.StringUtils.isEmpty(TRAININGTYPE_NAME)) {
|
||||
chapterList.get(i).put("TRAININGTYPE_NAME", " ");
|
||||
}
|
||||
String POSTTYPE_NAME = (String) chapterList.get(i).get("POSTTYPE_NAME");
|
||||
if (org.apache.commons.lang.StringUtils.isEmpty(POSTTYPE_NAME)) {
|
||||
chapterList.get(i).put("POSTTYPE_NAME", " ");
|
||||
}
|
||||
}
|
||||
}
|
||||
c.put("chapterList", chapterList);
|
||||
}
|
||||
|
||||
File file = new File(projectPath + Const.FILEPATHWORDTEMPLATE + "traffic-records2.docx");
|
||||
InputStream mbwj = new FileInputStream(file);
|
||||
//注册xdocreport实例并加载FreeMarker模板引擎
|
||||
IXDocReport report = XDocReportRegistry.getRegistry().loadReport(mbwj, TemplateEngineKind.Freemarker);
|
||||
//创建xdocreport上下文对象
|
||||
IContext context = report.createContext();
|
||||
|
||||
context.put("curList", curList);
|
||||
context.put("value1", dayformat.format(dateformat.parse(clazz.getString("START_TIME"))) + "-" + formatter.format(dateformat.parse(clazz.getString("END_TIME"))));
|
||||
context.put("value2", clazz.get("CORP_NAME"));
|
||||
context.put("value3", String.join(",", postNameSet));
|
||||
context.put("value4", String.join(",", TEACHER_NAME));
|
||||
context.put("value5", CLASSHOUR);
|
||||
context.put("value6", Tools.notEmpty(clazz.getString("PLAN_DEPARTMENT"))?clazz.getString("PLAN_DEPARTMENT"):"");
|
||||
context.put("value7", studentList.size());
|
||||
context.put("value8", sdrs.size());
|
||||
context.put("value9", sdrs.size());
|
||||
context.put("value10", COURSEWARENAME.toString().substring(0,COURSEWARENAME.length()-1));
|
||||
|
||||
PageData trainingData = archivesReviewRecordService.getTraining(pd);
|
||||
if (trainingData == null) {
|
||||
trainingData = new PageData();
|
||||
}
|
||||
if (trainingData.get("IS_SELECT1") != null && "是".equals(trainingData.getString("IS_SELECT1"))) {
|
||||
context.put("value12", "☑是 □否");
|
||||
} else if (trainingData.get("IS_SELECT1") != null && "否".equals(trainingData.getString("IS_SELECT1"))) {
|
||||
context.put("value12", "□是 ☑否");
|
||||
} else {
|
||||
context.put("value12", "□是 □否");
|
||||
}
|
||||
if (trainingData.get("IS_SELECT2") != null && "是".equals(trainingData.getString("IS_SELECT2"))) {
|
||||
context.put("value13", "☑是 □否");
|
||||
} else if (trainingData.get("IS_SELECT2") != null && "否".equals(trainingData.getString("IS_SELECT2"))) {
|
||||
context.put("value13", "□是 ☑否");
|
||||
} else {
|
||||
context.put("value13", "□是 □否");
|
||||
}
|
||||
if (trainingData.get("IS_SELECT3") != null && "是".equals(trainingData.getString("IS_SELECT3"))) {
|
||||
context.put("value14", "☑是 □否");
|
||||
} else if (trainingData.get("IS_SELECT3") != null && "否".equals(trainingData.getString("IS_SELECT3"))) {
|
||||
context.put("value14", "□是 ☑否");
|
||||
} else {
|
||||
context.put("value14", "□是 □否");
|
||||
}
|
||||
if (trainingData.get("IS_SELECT4") != null && "是".equals(trainingData.getString("IS_SELECT4"))) {
|
||||
context.put("value15", "☑是 □否");
|
||||
} else if (trainingData.get("IS_SELECT4") != null && "否".equals(trainingData.getString("IS_SELECT4"))) {
|
||||
context.put("value15", "□是 ☑否");
|
||||
} else {
|
||||
context.put("value15", "□是 □否");
|
||||
}
|
||||
if (trainingData.get("IS_SELECT5") != null && "是".equals(trainingData.getString("IS_SELECT5"))) {
|
||||
context.put("value16", "☑是 □否");
|
||||
} else if (trainingData.get("IS_SELECT5") != null && "否".equals(trainingData.getString("IS_SELECT5"))) {
|
||||
context.put("value16", "□是 ☑否");
|
||||
} else {
|
||||
context.put("value16", "□是 □否");
|
||||
}
|
||||
context.put("value18", trainingData.get("MEASURE") != null ? trainingData.get("MEASURE") : "");
|
||||
|
||||
String path = Const.HTTPFILEURL + clazz.get("SAFETYDEPTOR_URL");
|
||||
URL url = new URL(path);
|
||||
ByteArrayImageProvider byteArrayImageProvider = new ByteArrayImageProvider(url.openStream());//照片 读取网络路径
|
||||
context.put("pic", byteArrayImageProvider);
|
||||
context.put("pic2", byteArrayImageProvider);
|
||||
FieldsMetadata fm = report.createFieldsMetadata();
|
||||
fm.addFieldAsImage("pic", "pic", NullImageBehaviour.RemoveImageTemplate);
|
||||
fm.addFieldAsImage("pic2", "pic2", NullImageBehaviour.RemoveImageTemplate);
|
||||
|
||||
FileOutputStream out = new FileOutputStream(projectPath + Const.TEMPZIPFILES + "教育培训记录-" + now + ".docx");
|
||||
report.process(context, out);
|
||||
out.close();
|
||||
WordToPdfUtil.docToPdf(projectPath + Const.TEMPZIPFILES + "教育培训记录-" + now + ".docx",
|
||||
projectPath + Const.TEMPZIPFILES + pd.getString("CLASS_NAME") + "-教育培训记录-" + now + ".pdf");
|
||||
//删除本地word pdf
|
||||
File word = new File(projectPath + Const.TEMPZIPFILES + "教育培训记录-" + now + ".docx");
|
||||
word.delete();
|
||||
File pdf = new File(projectPath + Const.TEMPZIPFILES + pd.getString("CLASS_NAME") + "-教育培训记录-" + now + ".pdf");
|
||||
files.add(pdf);
|
||||
FileZip.zipList(projectPath + Const.TEMPZIPFILES + pd.getString("CLASS_NAME") + "-一期一档-教育培训记录-" + now + ".zip", files);
|
||||
for (File filepath : files) {
|
||||
filepath.delete(); //删除缓存文件
|
||||
}
|
||||
|
||||
String fileName = pd.getString("CLASS_NAME") + "-一期一档-教育培训记录-" + now + ".zip";
|
||||
String filePath = Const.ARCHIVESPDFFILE + DateUtil.getDays();
|
||||
// 上传OSS
|
||||
File zip = new File(projectPath + Const.TEMPZIPFILES + fileName);
|
||||
smb.sshSftp(zip, fileName, filePath);
|
||||
// 修改上传状态
|
||||
uploadResult(pd, "1", "", filePath + "/" + fileName);
|
||||
System.out.println("-----------------------------trainingAsTraffic 上传完成----------------------------------");
|
||||
zip.delete();
|
||||
} catch (Exception e) {
|
||||
uploadResult(pd, "-1", e.toString(), "");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void signAsTraffic(PageData pd) {
|
||||
try {
|
||||
String projectPath = pd.getString("projectPath");
|
||||
String now = DateUtil.getSdfTimesSSS();
|
||||
ArrayList<File> files = new ArrayList<>(); //最外层
|
||||
PageData clazz = classMapper.findById(pd);
|
||||
|
||||
SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd"); //日期格式
|
||||
SimpleDateFormat dayformat = new SimpleDateFormat("yyyy.MM.dd"); //日期格式
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("MM.dd");
|
||||
|
||||
List<PageData> curList = archivesService.getCurriculums(pd);
|
||||
String CURRICULUMNAMES = "";
|
||||
for (PageData c : curList) {
|
||||
CURRICULUMNAMES += c.getString("CURRICULUMNAME") + ';';
|
||||
}
|
||||
CURRICULUMNAMES = CURRICULUMNAMES.substring(0, CURRICULUMNAMES.length() - 1);
|
||||
|
||||
|
||||
List<PageData> studentList = archivesService.getStudents(pd);
|
||||
|
||||
|
||||
File file = new File(projectPath + Const.FILEPATHWORDTEMPLATE + "traffic-records3.docx");
|
||||
InputStream mbwj = new FileInputStream(file);
|
||||
//注册xdocreport实例并加载FreeMarker模板引擎
|
||||
IXDocReport report = XDocReportRegistry.getRegistry().loadReport(mbwj, TemplateEngineKind.Freemarker);
|
||||
//创建xdocreport上下文对象
|
||||
IContext context = report.createContext();
|
||||
|
||||
context.put("value1",CURRICULUMNAMES);
|
||||
context.put("value2",dayformat.format(dateformat.parse(clazz.getString("START_TIME"))) + "-" + formatter.format(dateformat.parse(clazz.getString("END_TIME"))));
|
||||
context.put("value3",clazz.get("CORP_NAME"));
|
||||
List<TrainingPlanDao> list1 = new ArrayList<>(); //一共多少行
|
||||
for (int i = 0; i < studentList.size(); i++) {
|
||||
|
||||
if (i % 3 == 0) {
|
||||
TrainingPlanDao trainingPlanDao = new TrainingPlanDao(); //每行的内容实体类
|
||||
trainingPlanDao.setValue1(String.valueOf(i + 1)); //序号
|
||||
trainingPlanDao.setValue2(studentList.get(i).getString("NAME")); //序号
|
||||
{
|
||||
String path = Const.HTTPFILEURL + studentList.get(i).getString("SIGNATURE_PATH");
|
||||
ByteArrayImageProvider byteArrayImageProvider;
|
||||
URL url;
|
||||
try {
|
||||
url = new URL(path);
|
||||
HttpURLConnection connection = (HttpURLConnection) new URL(path).openConnection();
|
||||
int state = connection.getResponseCode();
|
||||
if (state == 200) {
|
||||
byteArrayImageProvider = new ByteArrayImageProvider(url.openStream());//照片 读取网络路径
|
||||
trainingPlanDao.setPic(byteArrayImageProvider);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
if ((i + 1) < studentList.size()) {
|
||||
trainingPlanDao.setValue4(String.valueOf(i + 2)); //序号
|
||||
trainingPlanDao.setValue5(studentList.get(i + 1).getString("NAME")); //序号
|
||||
String path = Const.HTTPFILEURL + studentList.get(i + 1).getString("SIGNATURE_PATH");
|
||||
ByteArrayImageProvider byteArrayImageProvider;
|
||||
URL url;
|
||||
try {
|
||||
url = new URL(path);
|
||||
HttpURLConnection connection = (HttpURLConnection) new URL(path).openConnection();
|
||||
int state = connection.getResponseCode();
|
||||
if (state == 200) {
|
||||
byteArrayImageProvider = new ByteArrayImageProvider(url.openStream());//照片 读取网络路径
|
||||
trainingPlanDao.setPic2(byteArrayImageProvider);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
} else {
|
||||
trainingPlanDao.setValue4("");
|
||||
trainingPlanDao.setValue5("");
|
||||
}
|
||||
|
||||
if ((i + 2) < studentList.size()) {
|
||||
trainingPlanDao.setValue7(String.valueOf(i + 3)); //序号
|
||||
trainingPlanDao.setValue8(studentList.get(i + 2).getString("NAME")); //序号
|
||||
String path = Const.HTTPFILEURL + studentList.get(i + 2).getString("SIGNATURE_PATH");
|
||||
ByteArrayImageProvider byteArrayImageProvider;
|
||||
URL url;
|
||||
try {
|
||||
url = new URL(path);
|
||||
HttpURLConnection connection = (HttpURLConnection) new URL(path).openConnection();
|
||||
int state = connection.getResponseCode();
|
||||
if (state == 200) {
|
||||
byteArrayImageProvider = new ByteArrayImageProvider(url.openStream());//照片 读取网络路径
|
||||
trainingPlanDao.setPic3(byteArrayImageProvider);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
} else {
|
||||
trainingPlanDao.setValue7("");
|
||||
trainingPlanDao.setValue8("");
|
||||
}
|
||||
|
||||
list1.add(trainingPlanDao);
|
||||
}
|
||||
}
|
||||
context.put("list1", list1);
|
||||
|
||||
FieldsMetadata fm = report.createFieldsMetadata();
|
||||
fm.addFieldAsImage("pic", "item.pic", NullImageBehaviour.RemoveImageTemplate);
|
||||
fm.addFieldAsImage("pic2", "item.pic2", NullImageBehaviour.RemoveImageTemplate);
|
||||
fm.addFieldAsImage("pic3", "item.pic3", NullImageBehaviour.RemoveImageTemplate);
|
||||
fm.load("list1", TrainingPlanDao.class, true);
|
||||
FileOutputStream out = new FileOutputStream(projectPath + Const.TEMPZIPFILES + "安全知识培训签到表-" + now + ".docx");
|
||||
report.process(context, out);
|
||||
out.close();
|
||||
WordToPdfUtil.docToPdf(projectPath + Const.TEMPZIPFILES + "安全知识培训签到表-" + now + ".docx",
|
||||
projectPath + Const.TEMPZIPFILES + pd.getString("CLASS_NAME") + "-安全知识培训签到表-" + now + ".pdf");
|
||||
//删除本地word pdf
|
||||
File word = new File(projectPath + Const.TEMPZIPFILES + "安全知识培训签到表-" + now + ".docx");
|
||||
word.delete();
|
||||
File pdf = new File(projectPath + Const.TEMPZIPFILES + pd.getString("CLASS_NAME") + "-安全知识培训签到表-" + now + ".pdf");
|
||||
files.add(pdf);
|
||||
FileZip.zipList(projectPath + Const.TEMPZIPFILES + pd.getString("CLASS_NAME") + "-一期一档-安全知识培训签到表-" + now + ".zip", files);
|
||||
for (File filepath : files) {
|
||||
filepath.delete(); //删除缓存文件
|
||||
}
|
||||
|
||||
String fileName = pd.getString("CLASS_NAME") + "-一期一档-安全知识培训签到表-" + now + ".zip";
|
||||
String filePath = Const.ARCHIVESPDFFILE + DateUtil.getDays();
|
||||
// 上传OSS
|
||||
File zip = new File(projectPath + Const.TEMPZIPFILES + fileName);
|
||||
smb.sshSftp(zip, fileName, filePath);
|
||||
// 修改上传状态
|
||||
uploadResult(pd, "1", "", filePath + "/" + fileName);
|
||||
System.out.println("-----------------------------signAsTraffic 上传完成----------------------------------");
|
||||
zip.delete();
|
||||
} catch (Exception e) {
|
||||
uploadResult(pd, "-1", e.toString(), "");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void studentsumtableAsTraffic(PageData pd) {
|
||||
try {
|
||||
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);
|
||||
|
||||
File file = new File(projectPath + Const.FILEPATHWORDTEMPLATE + "traffic-records4.docx");
|
||||
InputStream mbwj = new FileInputStream(file);
|
||||
//注册xdocreport实例并加载FreeMarker模板引擎
|
||||
IXDocReport report = XDocReportRegistry.getRegistry().loadReport(mbwj, TemplateEngineKind.Freemarker);
|
||||
//创建xdocreport上下文对象
|
||||
IContext context = report.createContext();
|
||||
List<TrainingPlanDao> list1 = new ArrayList<>(); //一共多少行
|
||||
|
||||
for (int i = 0; i < studentList.size(); i++) {
|
||||
|
||||
if (i % 3 == 0) {
|
||||
TrainingPlanDao trainingPlanDao = new TrainingPlanDao(); //每行的内容实体类
|
||||
trainingPlanDao.setValue1(String.valueOf(i + 1)); //序号
|
||||
trainingPlanDao.setValue2(studentList.get(i).getString("NAME")); //序号
|
||||
if ("1".equals(clazz.get("EXAMINATION").toString())) {
|
||||
if (Integer.parseInt(String.valueOf(studentList.get(i).get("examnum"))) > 0) {
|
||||
trainingPlanDao.setValue3(Double.parseDouble(studentList.get(i).getString("STAGEEXAMSCORE")) > -1 ? studentList.get(i).getString("STAGEEXAMSCORE") : "0分");
|
||||
} else {
|
||||
trainingPlanDao.setValue3(Double.parseDouble(studentList.get(i).getString("STAGEEXAMSCORE")) > -1 ? studentList.get(i).getString("STAGEEXAMSCORE") : "未参加");
|
||||
}
|
||||
} else {
|
||||
trainingPlanDao.setValue3("不考试");
|
||||
}
|
||||
|
||||
if ((i + 1) < studentList.size()) {
|
||||
trainingPlanDao.setValue4(String.valueOf(i + 2)); //序号
|
||||
trainingPlanDao.setValue5(studentList.get(i + 1).getString("NAME")); //序号
|
||||
if ("1".equals(clazz.get("EXAMINATION").toString())) {
|
||||
if (Integer.parseInt(String.valueOf(studentList.get(i + 1).get("examnum"))) > 0) {
|
||||
trainingPlanDao.setValue6(Double.parseDouble(studentList.get(i + 1).getString("STAGEEXAMSCORE")) > -1 ? studentList.get(i + 1).getString("STAGEEXAMSCORE") : "0分");
|
||||
} else {
|
||||
trainingPlanDao.setValue6(Double.parseDouble(studentList.get(i + 1).getString("STAGEEXAMSCORE")) > -1 ? studentList.get(i + 1).getString("STAGEEXAMSCORE") : "未参加");
|
||||
}
|
||||
} else {
|
||||
trainingPlanDao.setValue6("不考试");
|
||||
}
|
||||
} else {
|
||||
trainingPlanDao.setValue4("");
|
||||
trainingPlanDao.setValue5("");
|
||||
trainingPlanDao.setValue6("");
|
||||
}
|
||||
|
||||
if ((i + 2) < studentList.size()) {
|
||||
trainingPlanDao.setValue7(String.valueOf(i + 3)); //序号
|
||||
trainingPlanDao.setValue8(studentList.get(i + 2).getString("NAME")); //序号
|
||||
if ("1".equals(clazz.get("EXAMINATION").toString())) {
|
||||
if (Integer.parseInt(String.valueOf(studentList.get(i + 2).get("examnum"))) > 0) {
|
||||
trainingPlanDao.setValue9(Double.parseDouble(studentList.get(i + 2).getString("STAGEEXAMSCORE")) > -1 ? studentList.get(i + 2).getString("STAGEEXAMSCORE") : "0分");
|
||||
} else {
|
||||
trainingPlanDao.setValue9(Double.parseDouble(studentList.get(i + 2).getString("STAGEEXAMSCORE")) > -1 ? studentList.get(i + 2).getString("STAGEEXAMSCORE") : "未参加");
|
||||
}
|
||||
} else {
|
||||
trainingPlanDao.setValue9("不考试");
|
||||
}
|
||||
} else {
|
||||
trainingPlanDao.setValue7("");
|
||||
trainingPlanDao.setValue8("");
|
||||
trainingPlanDao.setValue9("");
|
||||
}
|
||||
|
||||
list1.add(trainingPlanDao);
|
||||
}
|
||||
}
|
||||
context.put("list1", list1);
|
||||
FieldsMetadata fm = report.createFieldsMetadata();
|
||||
fm.load("list1", TrainingPlanDao.class, true);
|
||||
//输出到本地目录
|
||||
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 + clazz.getString("NAME") + "-安全知识培训成绩表-" + now + ".pdf");
|
||||
//删除本地word pdf
|
||||
File word = new File(projectPath + Const.FILEPATHFILE + "安全知识培训成绩表-" + now + ".docx");
|
||||
word.delete();
|
||||
File pdf = new File(projectPath + Const.FILEPATHFILE + clazz.getString("NAME") + "-安全知识培训成绩表-" + now + ".pdf");
|
||||
files.add(pdf);
|
||||
FileZip.zipList(projectPath + Const.TEMPZIPFILES + clazz.getString("NAME") + "-一期一档-安全知识培训成绩表-" + now + ".zip", files);
|
||||
for (File filepath : files) {
|
||||
filepath.delete(); //删除缓存文件
|
||||
}
|
||||
|
||||
String fileName = clazz.getString("NAME") + "-一期一档-安全知识培训成绩表-" + now + ".zip";
|
||||
String filePath = Const.ARCHIVESPDFFILE + DateUtil.getDays();
|
||||
// 上传OSS
|
||||
File zip = new File(projectPath + Const.TEMPZIPFILES + fileName);
|
||||
smb.sshSftp(zip, fileName, filePath);
|
||||
// 修改上传状态
|
||||
uploadResult(pd, "1", "", filePath + "/" + fileName);
|
||||
System.out.println("-----------------------------studentsumtableAsTraffic 上传完成----------------------------------");
|
||||
zip.delete();
|
||||
} catch (Exception e) {
|
||||
uploadResult(pd, "-1", e.toString(), "");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -89,15 +89,19 @@ public class ArchivesReviewRecordServiceImpl implements ArchivesReviewRecordServ
|
|||
return archivesReviewRecordMapper.getInfo(pd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ArrayDATA_IDS
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteAll(String[] ArrayDATA_IDS) throws Exception {
|
||||
archivesReviewRecordMapper.deleteAll(ArrayDATA_IDS);
|
||||
@Override
|
||||
public PageData getTraining(PageData pd) {
|
||||
return archivesReviewRecordMapper.getTraining(pd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void editTraining(PageData pd) {
|
||||
archivesReviewRecordMapper.editTraining(pd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveTraining(PageData pd) {
|
||||
archivesReviewRecordMapper.saveTraining(pd);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -517,7 +517,11 @@ public class ArchivesServiceImpl implements ArchivesService {
|
|||
trainingPlanDao.setValue4((String) coursewaresList.get(i).get("COURSEWARENAME")); //主要内容
|
||||
DecimalFormat df = new DecimalFormat("0.0"); //保留一位小数
|
||||
Double hour = (Double) coursewaresList.get(i).get("CLASSHOUR");
|
||||
trainingPlanDao.setValue5(hour == 0.0 ? "0" : df.format(hour) + "学时"); //学时
|
||||
if (classInfo.getString("TRAINTYPE").equals("bd2a3b7767db49968e26cfccc3c2b4a4")) {
|
||||
trainingPlanDao.setValue5(hour == 0.0 ? "0" : df.format(hour) + "学时"); //学时
|
||||
} else {
|
||||
trainingPlanDao.setValue5("1学时"); //学时
|
||||
}
|
||||
if (coursewaresList.get(i).get("TEACHERNAME") != null) {
|
||||
trainingPlanDao.setValue6((String) coursewaresList.get(i).get("TEACHERNAME")); //教师
|
||||
} else {
|
||||
|
@ -593,6 +597,12 @@ public class ArchivesServiceImpl implements ArchivesService {
|
|||
context.put("examinevalue14", "生产经营单位从业人员" + classInfo.getString("POSTTYPE_NAME") + "考核记录");
|
||||
} else if (classInfo.getString("POSTTYPE").equals("d73636e7a9ca4e71922bca305ee67cbb")) { //岗位类型:班组长
|
||||
context.put("examinevalue14", "生产经营单位从业人员年度安全再培训考核记录");
|
||||
} else if (classInfo.getString("POSTTYPE").equals("d476966c4ddd485d9cd55fd9af56fda2")) { //交通运输的岗位类型:三级教育
|
||||
context.put("examinevalue14", classInfo.getString("TRAINLEVEL_NAME") + "安全培训考核记录");
|
||||
} else if (classInfo.getString("POSTTYPE").equals("316179c2538946af97675c92e0b16f5c")) { //交通运输的岗位类型:年度再培训
|
||||
context.put("examinevalue14", "生产经营单位从业人员年度安全再培训考核记录");
|
||||
} else if (classInfo.getString("POSTTYPE").equals("bb5170f52dcd4183aa67a2053163ae29")) { //交通运输的岗位类型:调岗和重新上岗培训
|
||||
context.put("examinevalue14", "生产经营单位从业人员" + classInfo.getString("POSTTYPE_NAME") + "考核记录");
|
||||
} else {
|
||||
context.put("examinevalue14", "");
|
||||
}
|
||||
|
|
|
@ -0,0 +1,136 @@
|
|||
package com.zcloud.util.archivesUtil;
|
||||
|
||||
import com.zcloud.entity.PageData;
|
||||
import com.zcloud.entity.TrainingPlanDao;
|
||||
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.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 说明:安全培训教材会审表
|
||||
* 作者:wangxuan
|
||||
* 官网:www.zcloudchina.com
|
||||
*
|
||||
* @author wangxuan
|
||||
*/
|
||||
@Component
|
||||
public class AchievementAbsHandler extends AbsHandlerBatchExport {
|
||||
@Autowired
|
||||
private ClassMapper classMapper;
|
||||
|
||||
@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);
|
||||
|
||||
File file = new File(projectPath + Const.FILEPATHWORDTEMPLATE + "traffic-records4.docx");
|
||||
InputStream mbwj = new FileInputStream(file);
|
||||
//注册xdocreport实例并加载FreeMarker模板引擎
|
||||
IXDocReport report = XDocReportRegistry.getRegistry().loadReport(mbwj, TemplateEngineKind.Freemarker);
|
||||
//创建xdocreport上下文对象
|
||||
IContext context = report.createContext();
|
||||
List<TrainingPlanDao> list1 = new ArrayList<>(); //一共多少行
|
||||
|
||||
for (int i = 0; i < studentList.size(); i++) {
|
||||
|
||||
if (i % 3 == 0) {
|
||||
TrainingPlanDao trainingPlanDao = new TrainingPlanDao(); //每行的内容实体类
|
||||
trainingPlanDao.setValue1(String.valueOf(i + 1)); //序号
|
||||
trainingPlanDao.setValue2(studentList.get(i).getString("NAME")); //序号
|
||||
if ("1".equals(clazz.get("EXAMINATION").toString())) {
|
||||
if (Integer.parseInt(String.valueOf(studentList.get(i).get("examnum"))) > 0) {
|
||||
trainingPlanDao.setValue3(Double.parseDouble(studentList.get(i).getString("STAGEEXAMSCORE")) > -1 ? studentList.get(i).getString("STAGEEXAMSCORE") : "0分");
|
||||
} else {
|
||||
trainingPlanDao.setValue3(Double.parseDouble(studentList.get(i).getString("STAGEEXAMSCORE")) > -1 ? studentList.get(i).getString("STAGEEXAMSCORE") : "未参加");
|
||||
}
|
||||
} else {
|
||||
trainingPlanDao.setValue3("不考试");
|
||||
}
|
||||
|
||||
if ((i + 1) < studentList.size()) {
|
||||
trainingPlanDao.setValue4(String.valueOf(i + 2)); //序号
|
||||
trainingPlanDao.setValue5(studentList.get(i + 1).getString("NAME")); //序号
|
||||
if ("1".equals(clazz.get("EXAMINATION").toString())) {
|
||||
if (Integer.parseInt(String.valueOf(studentList.get(i + 1).get("examnum"))) > 0) {
|
||||
trainingPlanDao.setValue6(Double.parseDouble(studentList.get(i + 1).getString("STAGEEXAMSCORE")) > -1 ? studentList.get(i + 1).getString("STAGEEXAMSCORE") : "0分");
|
||||
} else {
|
||||
trainingPlanDao.setValue6(Double.parseDouble(studentList.get(i + 1).getString("STAGEEXAMSCORE")) > -1 ? studentList.get(i + 1).getString("STAGEEXAMSCORE") : "未参加");
|
||||
}
|
||||
} else {
|
||||
trainingPlanDao.setValue6("不考试");
|
||||
}
|
||||
} else {
|
||||
trainingPlanDao.setValue4("");
|
||||
trainingPlanDao.setValue5("");
|
||||
trainingPlanDao.setValue6("");
|
||||
}
|
||||
|
||||
if ((i + 2) < studentList.size()) {
|
||||
trainingPlanDao.setValue7(String.valueOf(i + 3)); //序号
|
||||
trainingPlanDao.setValue8(studentList.get(i + 2).getString("NAME")); //序号
|
||||
if ("1".equals(clazz.get("EXAMINATION").toString())) {
|
||||
if (Integer.parseInt(String.valueOf(studentList.get(i + 2).get("examnum"))) > 0) {
|
||||
trainingPlanDao.setValue9(Double.parseDouble(studentList.get(i + 2).getString("STAGEEXAMSCORE")) > -1 ? studentList.get(i + 2).getString("STAGEEXAMSCORE") : "0分");
|
||||
} else {
|
||||
trainingPlanDao.setValue9(Double.parseDouble(studentList.get(i + 2).getString("STAGEEXAMSCORE")) > -1 ? studentList.get(i + 2).getString("STAGEEXAMSCORE") : "未参加");
|
||||
}
|
||||
} else {
|
||||
trainingPlanDao.setValue9("不考试");
|
||||
}
|
||||
} else {
|
||||
trainingPlanDao.setValue7("");
|
||||
trainingPlanDao.setValue8("");
|
||||
trainingPlanDao.setValue9("");
|
||||
}
|
||||
|
||||
list1.add(trainingPlanDao);
|
||||
}
|
||||
}
|
||||
context.put("list1", list1);
|
||||
FieldsMetadata fm = report.createFieldsMetadata();
|
||||
fm.load("list1", TrainingPlanDao.class, true);
|
||||
//输出到本地目录
|
||||
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("archives113", this);
|
||||
}
|
||||
}
|
|
@ -24,6 +24,9 @@ public class BatchExportFactory {
|
|||
{ NAME: '培训考核试卷', TYPE: 103 },
|
||||
{ NAME: '学员考核成绩统计表', TYPE: 104 },
|
||||
{ NAME: '本期综合考评报告', TYPE: 105 },
|
||||
{ NAME: '教育培训记录', TYPE: 110 },
|
||||
{ NAME: '安全知识培训签到表', TYPE: 112 },
|
||||
{ NAME: '安全知识培训成绩表', TYPE: 113 },
|
||||
{ NAME: '与培训机构签订的服务合同或者协议复印件', TYPE: 6 }],
|
||||
* */
|
||||
public static AbsHandlerBatchExport getInvokeStrategy(String type) {
|
||||
|
|
|
@ -0,0 +1,172 @@
|
|||
package com.zcloud.util.archivesUtil;
|
||||
|
||||
import com.zcloud.entity.PageData;
|
||||
import com.zcloud.entity.TrainingPlanDao;
|
||||
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.images.ByteArrayImageProvider;
|
||||
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 fr.opensagres.xdocreport.template.formatter.NullImageBehaviour;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 说明:安全知识培训签到表
|
||||
* 作者:wangxuan
|
||||
* 官网:www.zcloudchina.com
|
||||
*
|
||||
* @author wangxuan
|
||||
*/
|
||||
@Component
|
||||
public class SignAsTrafficAbsHandler extends AbsHandlerBatchExport {
|
||||
|
||||
@Autowired
|
||||
private ClassMapper classMapper;
|
||||
|
||||
@Autowired
|
||||
private ArchivesService archivesService;
|
||||
|
||||
/**
|
||||
* @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();
|
||||
PageData clazz = classMapper.findById(pd);
|
||||
SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd"); //日期格式
|
||||
SimpleDateFormat dayformat = new SimpleDateFormat("yyyy.MM.dd"); //日期格式
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("MM.dd");
|
||||
|
||||
List<PageData> curList = archivesService.getCurriculums(pd);
|
||||
String CURRICULUMNAMES = "";
|
||||
for (PageData c : curList) {
|
||||
CURRICULUMNAMES += c.get("CURRICULUMNAME").toString() + ';';
|
||||
}
|
||||
CURRICULUMNAMES = CURRICULUMNAMES.substring(0, CURRICULUMNAMES.length() - 1);
|
||||
|
||||
List<PageData> studentList = archivesService.getStudents(pd);
|
||||
|
||||
|
||||
File file = new File(projectPath + Const.FILEPATHWORDTEMPLATE + "traffic-records3.docx");
|
||||
InputStream mbwj = new FileInputStream(file);
|
||||
//注册xdocreport实例并加载FreeMarker模板引擎
|
||||
IXDocReport report = XDocReportRegistry.getRegistry().loadReport(mbwj, TemplateEngineKind.Freemarker);
|
||||
//创建xdocreport上下文对象
|
||||
IContext context = report.createContext();
|
||||
|
||||
context.put("value1",CURRICULUMNAMES);
|
||||
context.put("value2",dayformat.format(dateformat.parse(clazz.getString("START_TIME"))) + "-" + formatter.format(dateformat.parse(clazz.getString("END_TIME"))));
|
||||
context.put("value3",clazz.get("CORP_NAME"));
|
||||
List<TrainingPlanDao> list1 = new ArrayList<>(); //一共多少行
|
||||
for (int i = 0; i < studentList.size(); i++) {
|
||||
|
||||
if (i % 3 == 0) {
|
||||
TrainingPlanDao trainingPlanDao = new TrainingPlanDao(); //每行的内容实体类
|
||||
trainingPlanDao.setValue1(String.valueOf(i + 1)); //序号
|
||||
trainingPlanDao.setValue2(studentList.get(i).getString("NAME")); //序号
|
||||
{
|
||||
String path = Const.HTTPFILEURL + studentList.get(i).getString("SIGNATURE_PATH");
|
||||
ByteArrayImageProvider byteArrayImageProvider;
|
||||
URL url;
|
||||
try {
|
||||
url = new URL(path);
|
||||
HttpURLConnection connection = (HttpURLConnection) new URL(path).openConnection();
|
||||
int state = connection.getResponseCode();
|
||||
if (state == 200) {
|
||||
byteArrayImageProvider = new ByteArrayImageProvider(url.openStream());//照片 读取网络路径
|
||||
trainingPlanDao.setPic(byteArrayImageProvider);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
if ((i + 1) < studentList.size()) {
|
||||
trainingPlanDao.setValue4(String.valueOf(i + 2)); //序号
|
||||
trainingPlanDao.setValue5(studentList.get(i + 1).getString("NAME")); //序号
|
||||
String path = Const.HTTPFILEURL + studentList.get(i + 1).getString("SIGNATURE_PATH");
|
||||
ByteArrayImageProvider byteArrayImageProvider;
|
||||
URL url;
|
||||
try {
|
||||
url = new URL(path);
|
||||
HttpURLConnection connection = (HttpURLConnection) new URL(path).openConnection();
|
||||
int state = connection.getResponseCode();
|
||||
if (state == 200) {
|
||||
byteArrayImageProvider = new ByteArrayImageProvider(url.openStream());//照片 读取网络路径
|
||||
trainingPlanDao.setPic2(byteArrayImageProvider);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
} else {
|
||||
trainingPlanDao.setValue4("");
|
||||
trainingPlanDao.setValue5("");
|
||||
}
|
||||
|
||||
if ((i + 2) < studentList.size()) {
|
||||
trainingPlanDao.setValue7(String.valueOf(i + 3)); //序号
|
||||
trainingPlanDao.setValue8(studentList.get(i + 2).getString("NAME")); //序号
|
||||
String path = Const.HTTPFILEURL + studentList.get(i + 2).getString("SIGNATURE_PATH");
|
||||
ByteArrayImageProvider byteArrayImageProvider;
|
||||
URL url;
|
||||
try {
|
||||
url = new URL(path);
|
||||
HttpURLConnection connection = (HttpURLConnection) new URL(path).openConnection();
|
||||
int state = connection.getResponseCode();
|
||||
if (state == 200) {
|
||||
byteArrayImageProvider = new ByteArrayImageProvider(url.openStream());//照片 读取网络路径
|
||||
trainingPlanDao.setPic3(byteArrayImageProvider);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
} else {
|
||||
trainingPlanDao.setValue7("");
|
||||
trainingPlanDao.setValue8("");
|
||||
}
|
||||
|
||||
list1.add(trainingPlanDao);
|
||||
}
|
||||
}
|
||||
context.put("list1", list1);
|
||||
|
||||
FieldsMetadata fm = report.createFieldsMetadata();
|
||||
fm.addFieldAsImage("pic", "item.pic", NullImageBehaviour.RemoveImageTemplate);
|
||||
fm.addFieldAsImage("pic2", "item.pic2", NullImageBehaviour.RemoveImageTemplate);
|
||||
fm.addFieldAsImage("pic3", "item.pic3", NullImageBehaviour.RemoveImageTemplate);
|
||||
fm.load("list1", TrainingPlanDao.class, true);
|
||||
FileOutputStream out = new FileOutputStream(projectPath + Const.TEMPZIPFILES + "安全知识培训签到表-" + now + ".docx");
|
||||
report.process(context, out);
|
||||
out.close();
|
||||
WordToPdfUtil.docToPdf(projectPath + Const.TEMPZIPFILES + "安全知识培训签到表-" + now + ".docx",
|
||||
projectPath + Const.TEMPZIPFILES + "安全知识培训签到表-" + now + ".pdf");
|
||||
//删除本地word pdf
|
||||
File word = new File(projectPath + Const.TEMPZIPFILES + "安全知识培训签到表-" + now + ".docx");
|
||||
word.delete();
|
||||
return new File(projectPath + Const.TEMPZIPFILES + "安全知识培训签到表-" + now + ".pdf");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
BatchExportFactory.register("archives112", this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,263 @@
|
|||
package com.zcloud.util.archivesUtil;
|
||||
|
||||
import com.zcloud.entity.PageData;
|
||||
import com.zcloud.mapper.dsno3.eduStudy.ClassMapper;
|
||||
import com.zcloud.mapper.dsno3.eduStudy.ClassPostMapper;
|
||||
import com.zcloud.service.eduArchives.ArchivesReviewRecordService;
|
||||
import com.zcloud.service.eduArchives.ArchivesService;
|
||||
import com.zcloud.util.*;
|
||||
import fr.opensagres.xdocreport.document.IXDocReport;
|
||||
import fr.opensagres.xdocreport.document.images.ByteArrayImageProvider;
|
||||
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 fr.opensagres.xdocreport.template.formatter.NullImageBehaviour;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 说明:安全培训教材会审表
|
||||
* 作者:wangxuan
|
||||
* 官网:www.zcloudchina.com
|
||||
*
|
||||
* @author wangxuan
|
||||
*/
|
||||
@Component
|
||||
public class TrainingAbsHandler extends AbsHandlerBatchExport {
|
||||
|
||||
@Resource
|
||||
private ArchivesReviewRecordService archivesReviewRecordService;
|
||||
|
||||
@Autowired
|
||||
private ClassMapper classMapper;
|
||||
|
||||
@Autowired
|
||||
private ArchivesService archivesService;
|
||||
|
||||
@Autowired
|
||||
private ClassPostMapper classPostMapper;
|
||||
|
||||
|
||||
/**
|
||||
* @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();
|
||||
PageData clazz = classMapper.findById(pd);
|
||||
SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd"); //日期格式
|
||||
SimpleDateFormat dayformat = new SimpleDateFormat("yyyy.MM.dd"); //日期格式
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("MM.dd");
|
||||
|
||||
List<PageData> byClass = classPostMapper.findByClass(pd);
|
||||
Set<String> postNameSet = new HashSet<>();
|
||||
|
||||
for (PageData aClass : byClass) {
|
||||
postNameSet.add(aClass.getString("POST_NAME"));
|
||||
}
|
||||
|
||||
|
||||
List<PageData> studentList = archivesService.getStudents(pd);
|
||||
List<String> ArrayDATA_IDS = new ArrayList<String>();
|
||||
|
||||
pd.put("ArrayDATA_IDS", ArrayDATA_IDS);
|
||||
List<PageData> coursewaresList = archivesService.getCoursewares(pd);
|
||||
|
||||
double CLASSHOUR = 0;
|
||||
Set<String> TEACHER_NAME = new HashSet<>();
|
||||
for (PageData pageData : coursewaresList) {
|
||||
CLASSHOUR += (Double) pageData.get("CLASSHOUR");
|
||||
TEACHER_NAME.add(pageData.get("TEACHERNAME").toString());
|
||||
}
|
||||
|
||||
StringBuilder COURSEWARENAME = new StringBuilder();
|
||||
List<PageData> curriculums = archivesService.getCurriculums(pd);
|
||||
for (PageData curriculum : curriculums) {
|
||||
COURSEWARENAME.append(curriculum.getString("CURRICULUMNAME")).append(",");
|
||||
}
|
||||
|
||||
List<PageData> sdrs = studentList.stream().filter(item ->
|
||||
"2".equals(item.getString("STUDYSTATE")) ||
|
||||
"3".equals(item.getString("STUDYSTATE")) ||
|
||||
"5".equals(item.getString("STUDYSTATE")) ||
|
||||
"6".equals(item.getString("STUDYSTATE"))
|
||||
).collect(Collectors.toList());
|
||||
|
||||
List<PageData> curList = archivesService.getCurriculums(pd);
|
||||
for (PageData c : curList) {
|
||||
PageData cha = new PageData();
|
||||
PageData itemInfo = new PageData();
|
||||
cha.put("PARENT_ID", "0");
|
||||
itemInfo.put("var0", c.get("CURRICULUMNAME"));
|
||||
itemInfo.put("var1", c.get("CATALOGUELEVEL"));
|
||||
cha.put("CURRICULUM_ID", c.get("CURRICULUM_ID"));
|
||||
cha.put("CLASS_ID", pd.get("CLASS_ID"));
|
||||
List<PageData> chapterList = archivesService.getCoursewares(cha, false);
|
||||
|
||||
// 二级目录结构时,查询子级目录
|
||||
// 二级目录结构时,查询子级目录
|
||||
if (c != null && c.get("CATALOGUELEVEL") != null
|
||||
&& Tools.notEmpty(c.get("CATALOGUELEVEL").toString())
|
||||
&& "2".equals(c.get("CATALOGUELEVEL").toString())
|
||||
&& chapterList != null && chapterList.size() > 0) {
|
||||
for (int i = 0; i < chapterList.size(); i++) {
|
||||
chapterList.get(i).put("NUM", NumToChinese.arabicNumToChineseNum((i + 1)));
|
||||
PageData firstChapter = new PageData();
|
||||
firstChapter.put("CURRICULUM_ID", c.get("CURRICULUM_ID"));
|
||||
firstChapter.put("PARENT_ID", chapterList.get(i).get("CHAPTER_ID"));
|
||||
firstChapter.put("CLASS_ID", pd.get("CLASS_ID"));
|
||||
List<PageData> nodesList = archivesService.getCoursewares(firstChapter);
|
||||
for (PageData chapter2 : nodesList) {
|
||||
String COURSEWAREINTRODUCE = chapter2.getString("COURSEWAREINTRODUCE").replaceAll("\\\n", "");
|
||||
chapter2.put("COURSEWAREINTRODUCE", COURSEWAREINTRODUCE);
|
||||
if (org.apache.commons.lang.StringUtils.isEmpty(String.valueOf(chapter2.get("INDUSTRY_ALL_NAME")))) {
|
||||
chapter2.put("INDUSTRY_ALL_NAME", " ");
|
||||
} else {
|
||||
chapter2.put("INDUSTRY_ALL_NAME", " ");
|
||||
}
|
||||
String TEACHERNAME = (String) chapter2.get("TEACHERNAME");
|
||||
if (org.apache.commons.lang.StringUtils.isEmpty(TEACHERNAME)) {
|
||||
chapter2.put("TEACHERNAME", " ");
|
||||
}
|
||||
String TRAININGTYPE_NAME = (String) chapter2.get("TRAININGTYPE_NAME");
|
||||
if (org.apache.commons.lang.StringUtils.isEmpty(TRAININGTYPE_NAME)) {
|
||||
chapter2.put("TRAININGTYPE_NAME", " ");
|
||||
}
|
||||
String POSTTYPE_NAME = (String) chapter2.get("POSTTYPE_NAME");
|
||||
if (org.apache.commons.lang.StringUtils.isEmpty(POSTTYPE_NAME)) {
|
||||
chapter2.put("POSTTYPE_NAME", " ");
|
||||
}
|
||||
chapterList.get(i).put("nodes", nodesList);
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < chapterList.size(); i++) {
|
||||
chapterList.get(i).put("NUM", NumToChinese.arabicNumToChineseNum((i + 1)));
|
||||
String industryAllName = (String) chapterList.get(i).get("INDUSTRY_ALL_NAME");
|
||||
if (org.apache.commons.lang.StringUtils.isEmpty(industryAllName)) {
|
||||
chapterList.get(i).put("INDUSTRY_ALL_NAME", " ");
|
||||
}
|
||||
|
||||
String TEACHERNAME = (String) chapterList.get(i).get("TEACHERNAME");
|
||||
if (org.apache.commons.lang.StringUtils.isEmpty(TEACHERNAME)) {
|
||||
chapterList.get(i).put("TEACHERNAME", " ");
|
||||
}
|
||||
String TRAININGTYPE_NAME = (String) chapterList.get(i).get("TRAININGTYPE_NAME");
|
||||
if (org.apache.commons.lang.StringUtils.isEmpty(TRAININGTYPE_NAME)) {
|
||||
chapterList.get(i).put("TRAININGTYPE_NAME", " ");
|
||||
}
|
||||
String POSTTYPE_NAME = (String) chapterList.get(i).get("POSTTYPE_NAME");
|
||||
if (org.apache.commons.lang.StringUtils.isEmpty(POSTTYPE_NAME)) {
|
||||
chapterList.get(i).put("POSTTYPE_NAME", " ");
|
||||
}
|
||||
}
|
||||
}
|
||||
c.put("chapterList", chapterList);
|
||||
}
|
||||
|
||||
File file = new File(projectPath + Const.FILEPATHWORDTEMPLATE + "traffic-records2.docx");
|
||||
InputStream mbwj = new FileInputStream(file);
|
||||
//注册xdocreport实例并加载FreeMarker模板引擎
|
||||
IXDocReport report = XDocReportRegistry.getRegistry().loadReport(mbwj, TemplateEngineKind.Freemarker);
|
||||
//创建xdocreport上下文对象
|
||||
IContext context = report.createContext();
|
||||
|
||||
context.put("curList", curList);
|
||||
context.put("value1", dayformat.format(dateformat.parse(clazz.getString("START_TIME"))) + "-" + formatter.format(dateformat.parse(clazz.getString("END_TIME"))));
|
||||
context.put("value2", clazz.get("CORP_NAME"));
|
||||
context.put("value3", String.join(",", postNameSet));
|
||||
context.put("value4", String.join(",", TEACHER_NAME));
|
||||
context.put("value5", CLASSHOUR);
|
||||
context.put("value6", Tools.notEmpty(clazz.getString("PLAN_DEPARTMENT"))?clazz.getString("PLAN_DEPARTMENT"):"");
|
||||
context.put("value7", studentList.size());
|
||||
context.put("value8", sdrs.size());
|
||||
context.put("value9", sdrs.size());
|
||||
context.put("value10", COURSEWARENAME.toString().substring(0, COURSEWARENAME.length() - 1));
|
||||
|
||||
PageData trainingData = archivesReviewRecordService.getTraining(pd);
|
||||
if (trainingData == null) {
|
||||
trainingData = new PageData();
|
||||
}
|
||||
if (trainingData.get("IS_SELECT1") != null && "是".equals(trainingData.getString("IS_SELECT1"))) {
|
||||
context.put("value12", "☑是 □否");
|
||||
} else if (trainingData.get("IS_SELECT1") != null && "否".equals(trainingData.getString("IS_SELECT1"))) {
|
||||
context.put("value12", "□是 ☑否");
|
||||
} else {
|
||||
context.put("value12", "□是 □否");
|
||||
}
|
||||
if (trainingData.get("IS_SELECT2") != null && "是".equals(trainingData.getString("IS_SELECT2"))) {
|
||||
context.put("value13", "☑是 □否");
|
||||
} else if (trainingData.get("IS_SELECT2") != null && "否".equals(trainingData.getString("IS_SELECT1"))) {
|
||||
context.put("value13", "□是 ☑否");
|
||||
} else {
|
||||
context.put("value13", "□是 □否");
|
||||
}
|
||||
if (trainingData.get("IS_SELECT3") != null && "是".equals(trainingData.getString("IS_SELECT3"))) {
|
||||
context.put("value14", "☑是 □否");
|
||||
} else if (trainingData.get("IS_SELECT3") != null && "否".equals(trainingData.getString("IS_SELECT3"))) {
|
||||
context.put("value14", "□是 ☑否");
|
||||
} else {
|
||||
context.put("value14", "□是 □否");
|
||||
}
|
||||
if (trainingData.get("IS_SELECT4") != null && "是".equals(trainingData.getString("IS_SELECT4"))) {
|
||||
context.put("value15", "☑是 □否");
|
||||
} else if (trainingData.get("IS_SELECT4") != null && "否".equals(trainingData.getString("IS_SELECT4"))) {
|
||||
context.put("value15", "□是 ☑否");
|
||||
} else {
|
||||
context.put("value15", "□是 □否");
|
||||
}
|
||||
if (trainingData.get("IS_SELECT5") != null && "是".equals(trainingData.getString("IS_SELECT5"))) {
|
||||
context.put("value16", "☑是 □否");
|
||||
} else if (trainingData.get("IS_SELECT5") != null && "否".equals(trainingData.getString("IS_SELECT5"))) {
|
||||
context.put("value16", "□是 ☑否");
|
||||
} else {
|
||||
context.put("value16", "□是 □否");
|
||||
}
|
||||
context.put("value18", trainingData.get("MEASURE") != null ? trainingData.get("MEASURE") : "");
|
||||
|
||||
String path = Const.HTTPFILEURL + clazz.get("SAFETYDEPTOR_URL");
|
||||
URL url = new URL(path);
|
||||
ByteArrayImageProvider byteArrayImageProvider = new ByteArrayImageProvider(url.openStream());//照片 读取网络路径
|
||||
context.put("pic", byteArrayImageProvider);
|
||||
context.put("pic2", byteArrayImageProvider);
|
||||
FieldsMetadata fm = report.createFieldsMetadata();
|
||||
fm.addFieldAsImage("pic", "pic", NullImageBehaviour.RemoveImageTemplate);
|
||||
fm.addFieldAsImage("pic2", "pic2", NullImageBehaviour.RemoveImageTemplate);
|
||||
|
||||
FileOutputStream out = new FileOutputStream(projectPath + Const.TEMPZIPFILES + "教育培训记录-" + now + ".docx");
|
||||
report.process(context, out);
|
||||
out.close();
|
||||
WordToPdfUtil.docToPdf(projectPath + Const.TEMPZIPFILES + "教育培训记录-" + now + ".docx",
|
||||
projectPath + Const.TEMPZIPFILES + "教育培训记录-" + now + ".pdf");
|
||||
//删除本地word pdf
|
||||
File word = new File(projectPath + Const.TEMPZIPFILES + "教育培训记录-" + now + ".docx");
|
||||
word.delete();
|
||||
File pdf = new File(projectPath + Const.TEMPZIPFILES + "教育培训记录-" + now + ".pdf");
|
||||
return pdf;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
BatchExportFactory.register("archives110", this);
|
||||
}
|
||||
}
|
|
@ -96,7 +96,8 @@
|
|||
f.REGULARTYPE,
|
||||
f.OFFICIAL_SEAL_PATH,
|
||||
f.INDUSTRY_TYPE,
|
||||
f.INDUSTRY_NAME
|
||||
f.INDUSTRY_NAME,
|
||||
f.PLAN_DEPARTMENT
|
||||
</sql>
|
||||
|
||||
<!-- 字段用于新增 -->
|
||||
|
@ -154,7 +155,8 @@
|
|||
REGULARTYPE,
|
||||
OFFICIAL_SEAL_PATH,
|
||||
INDUSTRY_TYPE,
|
||||
INDUSTRY_NAME
|
||||
INDUSTRY_NAME,
|
||||
PLAN_DEPARTMENT
|
||||
</sql>
|
||||
|
||||
<!-- 字段值 -->
|
||||
|
@ -212,7 +214,8 @@
|
|||
#{REGULARTYPE},
|
||||
#{OFFICIAL_SEAL_PATH},
|
||||
#{INDUSTRY_TYPE},
|
||||
#{INDUSTRY_NAME}
|
||||
#{INDUSTRY_NAME},
|
||||
#{PLAN_DEPARTMENT}
|
||||
</sql>
|
||||
|
||||
<!-- 新增-->
|
||||
|
@ -460,6 +463,9 @@
|
|||
<if test="INDUSTRY_NAME != null and INDUSTRY_NAME != ''">
|
||||
INDUSTRY_NAME = #{INDUSTRY_NAME},
|
||||
</if>
|
||||
<if test="PLAN_DEPARTMENT != null and PLAN_DEPARTMENT != ''">
|
||||
PLAN_DEPARTMENT = #{PLAN_DEPARTMENT},
|
||||
</if>
|
||||
CORPINFO_ID = CORPINFO_ID
|
||||
where
|
||||
CORPINFO_ID = #{CORPINFO_ID}
|
||||
|
|
|
@ -144,4 +144,32 @@
|
|||
where
|
||||
f.ARCHIVES_REVIEW_RECORD_ID = #{ARCHIVES_REVIEW_RECORD_ID}
|
||||
</select>
|
||||
<select id="getTraining" resultType="com.zcloud.entity.PageData">
|
||||
select * from bus_archives_training where CLASS_ID = #{CLASS_ID}
|
||||
</select>
|
||||
<update id="editTraining">
|
||||
update
|
||||
bus_archives_training
|
||||
set
|
||||
IS_SELECT1 = #{IS_SELECT1},
|
||||
IS_SELECT2 = #{IS_SELECT2},
|
||||
IS_SELECT3 = #{IS_SELECT3},
|
||||
IS_SELECT4 = #{IS_SELECT4},
|
||||
IS_SELECT5 = #{IS_SELECT5},
|
||||
ASSESSOR = #{ASSESSOR},
|
||||
MEASURE = #{MEASURE},
|
||||
CREATOR = #{CREATOR}
|
||||
where
|
||||
CLASS_ID = #{CLASS_ID}
|
||||
</update>
|
||||
|
||||
<insert id="saveTraining">
|
||||
insert into
|
||||
bus_archives_training
|
||||
(
|
||||
CLASS_ID,IS_SELECT1,IS_SELECT2,IS_SELECT3,IS_SELECT4,IS_SELECT5,ASSESSOR,MEASURE,CREATOR
|
||||
) values (
|
||||
#{CLASS_ID},#{IS_SELECT1},#{IS_SELECT2},#{IS_SELECT3},#{IS_SELECT4},#{IS_SELECT5},#{ASSESSOR},#{MEASURE},#{CREATOR}
|
||||
)
|
||||
</insert>
|
||||
</mapper>
|
||||
|
|
|
@ -301,7 +301,9 @@
|
|||
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,
|
||||
tlt.NAME TRAINLEVEL_NAME,
|
||||
bci.CORP_NAME
|
||||
bci.CORP_NAME,
|
||||
bci.PLAN_DEPARTMENT,
|
||||
us.SIGN_PICTURE AS SAFETYDEPTOR_URL
|
||||
from
|
||||
<include refid="tableName"></include>
|
||||
f
|
||||
|
@ -310,6 +312,7 @@
|
|||
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_industry_type lei ON lei.INDUSTRYTYPE_ID = f.INDUSTRY_END_ID
|
||||
left join sys_user_sign us on us.USERSIGNID = f.SAFETYDEPTOR
|
||||
WHERE
|
||||
f.CLASS_ID = #{CLASS_ID}
|
||||
</select>
|
||||
|
|
|
@ -2995,7 +2995,7 @@
|
|||
<w:vertAlign w:val="baseline"/>
|
||||
<w:lang w:val="EN-US" w:fareast="ZH-CN"/>
|
||||
</w:rPr>
|
||||
<w:t>1学时</w:t>
|
||||
<w:t>${list2.value5}</w:t>
|
||||
</w:r>
|
||||
</w:p>
|
||||
</w:tc>
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
|
||||
<<${value1}>>
|
||||
|
||||
|
||||
安全生产教育培训记录
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
编制单位:<<${value2}>>
|
||||
<<${value3}>>
|
|
@ -0,0 +1,42 @@
|
|||
教育培训记录
|
||||
培训时间
|
||||
<<${value1}>>
|
||||
培训地点
|
||||
<<${value2}>>
|
||||
培训对象
|
||||
<<${value3}>>
|
||||
培 训 人
|
||||
<<${value4}>>
|
||||
培训课时
|
||||
<<${value5}>>
|
||||
组织部门
|
||||
<<${value6}>>
|
||||
应到人数
|
||||
<<${value7}>>
|
||||
实到人数
|
||||
<<${value8}>>
|
||||
线上培训人数
|
||||
<<${value9}>>
|
||||
培训主题
|
||||
<<${value10}>>
|
||||
培训内容:<<[#list>><<[#if>>
|
||||
<<[#list>> <<${item.NUM}>>.<<${item.CHAPTER_NAME}>>
|
||||
课件描述:<<${item.COURSEWAREINTRODUCE}>><<[/#list]>>
|
||||
<<[#else]>>
|
||||
<<[#list>>
|
||||
<<${item.NUM}>>.<<${item.CHAPTER_NAME}>><<[#list>>
|
||||
<<${item_nodes_index+1}>>.<<${item_nodes.CHAPTER_NAME}>>
|
||||
课件描述:<<${item_nodes.COURSEWAREINTRODUCE}>><<[/#list]>><<[/#list]>>
|
||||
<<[/#if]>><<[/#list]>>
|
||||
培训效果评估
|
||||
培训内容编制是否符合行业要求: <<${value12}>>
|
||||
员工是否能够理解培训内容: <<${value13}>>
|
||||
是否结合公司实际情况或行业案例: <<${value14}>>
|
||||
是否完成规定课时,达到培训目标: <<${value15}>>
|
||||
|
||||
是否需要制定整改措施: <<${value16}>> 评估人:
|
||||
培训不足整改措施
|
||||
|
||||
<<${value18}>>
|
||||
制定人:
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
安全知识培训签到表
|
||||
培训主题
|
||||
<<${value1}>>
|
||||
培训时间
|
||||
<<${value2}>>
|
||||
地 点
|
||||
<<${value3}>>
|
||||
序号
|
||||
姓名
|
||||
签名
|
||||
序号
|
||||
姓名
|
||||
签名
|
||||
序号
|
||||
姓名
|
||||
签名
|
||||
<<@before-row[#list list1 as item]>><<@after-row[/#list]>><<${item.value1}>>
|
||||
<<${item.value2}>>
|
||||
|
||||
<<${item.value4}>>
|
||||
<<${item.value5}>>
|
||||
|
||||
<<${item.value7}>>
|
||||
<<${item.value8}>>
|
||||
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
安全知识培训成绩表
|
||||
序号
|
||||
姓名
|
||||
成绩
|
||||
序号
|
||||
姓名
|
||||
成绩
|
||||
序号
|
||||
姓名
|
||||
成绩
|
||||
<<${list1.value1}>>
|
||||
<<${list1.value2}>>
|
||||
<<${list1.value3}>>
|
||||
<<${list1.value4}>>
|
||||
<<${list1.value5}>>
|
||||
<<${list1.value6}>>
|
||||
<<${list1.value7}>>
|
||||
<<${list1.value8}>>
|
||||
<<${list1.value9}>>
|
||||
|
Loading…
Reference in New Issue