|
@@ -1,591 +0,0 @@
|
|
|
-package cn.iocoder.yudao.module.as.service.exportwordmanage;
|
|
|
-import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
-import cn.iocoder.yudao.module.as.controller.admin.exportWordManage.Constant.*;
|
|
|
-import cn.iocoder.yudao.module.as.controller.admin.exportWordManage.config.MinioConfig;
|
|
|
-import cn.iocoder.yudao.module.as.controller.admin.exportWordManage.utils.FileUtil;
|
|
|
-import cn.iocoder.yudao.module.as.controller.admin.exportWordManage.utils.ZipUtil;
|
|
|
-import cn.iocoder.yudao.module.as.dal.dataobject.exportwordmanage.AsFamilyDifficultDO;
|
|
|
-import cn.iocoder.yudao.module.as.dal.dataobject.exportwordmanage.AsFamilyNumberOfFamilyDifficult;
|
|
|
-import cn.iocoder.yudao.module.as.dal.mysql.exportwordmanage.AsFamilyNumberOfFamilyDifficultMapper;
|
|
|
-import cn.iocoder.yudao.module.as.dal.mysql.exportwordmanage.ExportFamilyDifficultWordManageMapper;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import io.minio.BucketExistsArgs;
|
|
|
-import io.minio.MakeBucketArgs;
|
|
|
-import io.minio.MinioClient;
|
|
|
-import io.minio.PutObjectArgs;
|
|
|
-import io.minio.errors.ErrorResponseException;
|
|
|
-import io.minio.errors.InvalidResponseException;
|
|
|
-import io.minio.errors.XmlParserException;
|
|
|
-import jdk.nashorn.internal.runtime.regexp.joni.exception.InternalException;
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.commons.math3.exception.InsufficientDataException;
|
|
|
-import org.apache.pdfbox.pdmodel.PDDocument;
|
|
|
-import org.apache.pdfbox.pdmodel.PDPage;
|
|
|
-import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
|
|
-import org.apache.poi.xwpf.usermodel.XWPFParagraph;
|
|
|
-import org.apache.poi.xwpf.usermodel.XWPFRun;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.core.io.ByteArrayResource;
|
|
|
-import org.springframework.http.HttpHeaders;
|
|
|
-import org.springframework.http.MediaType;
|
|
|
-import org.springframework.http.ResponseEntity;
|
|
|
-import org.springframework.mock.web.MockMultipartFile;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.web.multipart.MultipartFile;
|
|
|
-
|
|
|
-import java.io.*;
|
|
|
-import java.lang.reflect.Field;
|
|
|
-import java.security.NoSuchAlgorithmException;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
-import java.time.LocalDateTime;
|
|
|
-import java.time.format.DateTimeFormatter;
|
|
|
-import java.util.*;
|
|
|
-
|
|
|
-/**
|
|
|
- * @autor WoVoM
|
|
|
- * @data 2024/7/6 9:51
|
|
|
- * @@version 1.0
|
|
|
- */
|
|
|
-
|
|
|
-@Service
|
|
|
-@Slf4j
|
|
|
-public class ExportFamilyDifficultWordManageServiceImpl extends ServiceImpl<ExportFamilyDifficultWordManageMapper, AsFamilyDifficultDO> implements ExportFamilyDifficultWordManageService{
|
|
|
-
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private ExportFamilyDifficultWordManageMapper exportFamilyDifficultWordManageMapper;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private AsFamilyNumberOfFamilyDifficultMapper asFamilyNumberOfFamilyDifficultMapper;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private SysFileServiceImpl sysFileService;
|
|
|
-
|
|
|
- /**
|
|
|
- * 通过ids获取家庭经济困难认定表单的集合压缩包
|
|
|
- * @param ids
|
|
|
- * @return
|
|
|
- */
|
|
|
- @Override
|
|
|
- public ResponseEntity<ByteArrayResource> getFamilyDifficultWordByIds(List<Integer> ids) {
|
|
|
- try {
|
|
|
- List<File> docFiles = new ArrayList<>();
|
|
|
- List<Map<String, Object>> dataList = fillInData(ids);
|
|
|
- // 生成两个Word文档
|
|
|
- String templateFilePath = "word/FamilyDifficult.ftl";
|
|
|
- for (int i = 0; i < dataList.size(); i++) {
|
|
|
- File doc = FileUtil.exportWordDoc(templateFilePath, dataList.get(i));
|
|
|
- docFiles.add(doc);
|
|
|
- }
|
|
|
- // 打包压缩生成的文档
|
|
|
- String zipFileName = "documents.zip";
|
|
|
- ZipUtil.zipFiles(zipFileName, docFiles.toArray(new File[0]));
|
|
|
- // 删除临时生成的文档文件
|
|
|
- for (File doc : docFiles) {
|
|
|
- doc.delete();
|
|
|
- }
|
|
|
- // 读取生成的ZIP文件并将其作为响应体返回给前端
|
|
|
- File zipFile = new File(zipFileName);
|
|
|
- ByteArrayResource resource = new ByteArrayResource(ZipUtil.readBytes(zipFile));
|
|
|
- // 设置响应头
|
|
|
- HttpHeaders headers = new HttpHeaders();
|
|
|
- headers.add(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=FamilyDifficultTable.zip");
|
|
|
- return ResponseEntity.ok()
|
|
|
- .headers(headers)
|
|
|
- .contentType(MediaType.parseMediaType("application/zip"))
|
|
|
- .contentLength(zipFile.length())
|
|
|
- .body(resource);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- return ResponseEntity.status(500).build(); // 返回服务器错误(等待更改)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // TODO 未完成
|
|
|
- /**
|
|
|
- * 预览家庭经济困难认定表单
|
|
|
- * @param id
|
|
|
- * @return
|
|
|
- */
|
|
|
- @Override
|
|
|
- public String getFamilyDifficultPDFById(Integer id) {
|
|
|
- log.info("进入预览家庭经济困难认定表单界面");
|
|
|
- try {
|
|
|
- List<Integer> ids = new ArrayList<>();
|
|
|
- ids.add(id);
|
|
|
- List<Map<String, Object>> dataList = fillInData(ids);
|
|
|
- // 生成Word文档
|
|
|
- String templateFilePath = "word/FamilyDifficult.ftl";
|
|
|
- File doc = FileUtil.exportWordDoc(templateFilePath, dataList.get(0));
|
|
|
- log.info("第一步:生成Word文档 完成");
|
|
|
- // word转成ptf
|
|
|
- try {
|
|
|
- // word 转成 pdf
|
|
|
- log.info("文件名称如下{}", doc.getName());
|
|
|
- File pdfFile = null;
|
|
|
- pdfFile = FileUtil.invoke(doc);
|
|
|
- log.info("。。。。{}", pdfFile.getAbsoluteFile());
|
|
|
- // 上传到 minio 中
|
|
|
- String url = sysFileService.upload(FileUtil.fileToMultipartFile(pdfFile));
|
|
|
- // 删除临时文件
|
|
|
- doc.delete();
|
|
|
- // 返回路径
|
|
|
- log.info("url = {}", url);
|
|
|
- return url;
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取并封装数据
|
|
|
- * @param ids
|
|
|
- * @return
|
|
|
- */
|
|
|
- private List<Map<String, Object>> fillInData(List<Integer> ids) {
|
|
|
- List<Map<String, Object>> dataList = new ArrayList<>();
|
|
|
- List<AsFamilyDifficultDO> asFamilyDifficultList = exportFamilyDifficultWordManageMapper.selectBatchIds(ids);
|
|
|
- for (int i = 0; i < asFamilyDifficultList.size(); i++) {
|
|
|
- AsFamilyDifficultDO asFamilyDifficultDO = asFamilyDifficultList.get(i);
|
|
|
- log.info("第{}个学生信息如下{}", i + 1, asFamilyDifficultDO);
|
|
|
- // 将家庭成员信息找出
|
|
|
- // TODO 存在一个隐患,如果有两次的申请的话,成员数量翻倍
|
|
|
- List<AsFamilyNumberOfFamilyDifficult> NumberList = asFamilyNumberOfFamilyDifficultMapper
|
|
|
- .selectList(new QueryWrapper<AsFamilyNumberOfFamilyDifficult>()
|
|
|
- .eq("student_sno", asFamilyDifficultDO.getStudentId()));
|
|
|
-
|
|
|
- log.info("第{}个学生的家庭成员信息如下{}", i + 1, NumberList);
|
|
|
- // 实体类转成map
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
- Class<?> clazz = asFamilyDifficultDO.getClass();
|
|
|
- for (Field field : clazz.getDeclaredFields()) {
|
|
|
- field.setAccessible(true); // 设置可访问私有字段
|
|
|
- try {
|
|
|
- map.put(field.getName(), field.get(asFamilyDifficultDO)); // 将属性名和属性值放入Map
|
|
|
- } catch (IllegalAccessException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- //特殊处理
|
|
|
- //时间
|
|
|
- LocalDateTime asBirthday = asFamilyDifficultDO.getBirthday();
|
|
|
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy.MM");
|
|
|
- String formattedDate = asBirthday.format(formatter);
|
|
|
- map.put("birthday", formattedDate);
|
|
|
- log.info("时间处理正常");
|
|
|
- //身份号
|
|
|
- String asIdCard = asFamilyDifficultDO.getIdCard();
|
|
|
- for (int j = 0; j < asIdCard.length(); j++) {
|
|
|
- map.put("ic_" + j, asIdCard.charAt(j));
|
|
|
- }
|
|
|
- log.info("身份证处理正常");
|
|
|
-
|
|
|
- // TODO 家庭情况(后面的勾选没做)
|
|
|
- //实体类是一个String类型,假设困难类型以,隔开--->
|
|
|
- //脱贫家庭学生(2014/2015年),脱贫不稳定户家庭
|
|
|
- /**
|
|
|
- * 有个很重要的前提:
|
|
|
- * 常量的顺序,必须跟表格的顺序保持一致
|
|
|
- */
|
|
|
- String[] parts = asFamilyDifficultDO.getHouseholdType().split(",");
|
|
|
- for (String part : parts) {
|
|
|
- log.info("家庭情况如下:{}", part);
|
|
|
- }
|
|
|
- log.info("有{}种家庭情况", parts.length);
|
|
|
- Class<FamilySituationTypeConstant> clazz2 = FamilySituationTypeConstant.class;
|
|
|
- Field[] fields = clazz2.getDeclaredFields();
|
|
|
- int index = 0;
|
|
|
- for (Field field : fields) {
|
|
|
- field.setAccessible(true);
|
|
|
- if (field.getType() == String.class) {
|
|
|
- try {
|
|
|
- String value = (String) field.get(null);
|
|
|
- map.put("dt_" + index, "☐");
|
|
|
- for (int j = 0; j < parts.length; j++) {
|
|
|
- if (parts[j].contains(value)) {
|
|
|
- map.put("dt_" + index, "☑");
|
|
|
- // 特殊处理六类
|
|
|
- //1.脱贫家庭学生 (脱贫年度:2014年/2015年 2016年及以后)
|
|
|
- if (parts[j].contains("脱贫家庭学生")) {
|
|
|
- if (parts[j].contains("2016年及以后")) {
|
|
|
- map.put("ts_0", "☐");
|
|
|
- map.put("ts_1", "☑");
|
|
|
- } else if (parts[j].contains("2014/2015年")) {
|
|
|
- map.put("ts_0", "☑");
|
|
|
- map.put("ts_1", "☐");
|
|
|
- } else {
|
|
|
- map.put("ts_0", "☐");
|
|
|
- map.put("ts_1", "☐");
|
|
|
- }
|
|
|
- }
|
|
|
- //2.未消除风险监测对象家庭学生(脱贫不稳定家庭学生 边缘易致贫家庭学生 突发严重困难家庭学生)
|
|
|
- if (parts[j].contains("未消除风险监测对象家庭学生")) {
|
|
|
- if (parts[j].contains("脱贫不稳定家庭学生")) {
|
|
|
- map.put("ts_2", "☑");
|
|
|
- map.put("ts_3", "☐");
|
|
|
- map.put("ts_4", "☐");
|
|
|
- } else if (parts[j].contains("边缘易致贫家庭学生")) {
|
|
|
- map.put("ts_2", "☐");
|
|
|
- map.put("ts_3", "☑");
|
|
|
- map.put("ts_4", "☐");
|
|
|
- } else if (parts[j].contains("突发严重困难家庭学生")) {
|
|
|
- map.put("ts_2", "☐");
|
|
|
- map.put("ts_3", "☐");
|
|
|
- map.put("ts_4", "☑");
|
|
|
- } else {
|
|
|
- map.put("ts_2", "☐");
|
|
|
- map.put("ts_3", "☐");
|
|
|
- map.put("ts_4", "☐");
|
|
|
- }
|
|
|
- }
|
|
|
- //3.已消除风险监测对象家庭学生(脱贫不稳定家庭学生 边缘易致贫家庭学生 突发严重困难家庭学生)
|
|
|
- if (parts[j].contains("已消除风险监测对象家庭学生")) {
|
|
|
- if (parts[j].contains("脱贫不稳定家庭学生")) {
|
|
|
- map.put("ts_5", "☑");
|
|
|
- map.put("ts_6", "☐");
|
|
|
- map.put("ts_7", "☐");
|
|
|
- } else if (parts[j].contains("边缘易致贫家庭学生")) {
|
|
|
- map.put("ts_5", "☐");
|
|
|
- map.put("ts_6", "☑");
|
|
|
- map.put("ts_7", "☐");
|
|
|
- } else if (parts[j].contains("突发严重困难家庭学生")) {
|
|
|
- map.put("ts_5", "☐");
|
|
|
- map.put("ts_6", "☐");
|
|
|
- map.put("ts_7", "☑");
|
|
|
- } else {
|
|
|
- map.put("ts_5", "☐");
|
|
|
- map.put("ts_6", "☐");
|
|
|
- map.put("ts_7", "☐");
|
|
|
- }
|
|
|
- }
|
|
|
- //4.最低生活保障家庭学生(城市 农村)
|
|
|
- if (parts[j].contains("最低生活保障家庭学生")) {
|
|
|
- if (parts[j].contains("城市")) {
|
|
|
- map.put("ts_8", "☑");
|
|
|
- map.put("ts_9", "☐");
|
|
|
- } else if (parts[j].contains("农村")) {
|
|
|
- map.put("ts_8", "☐");
|
|
|
- map.put("ts_9", "☑");
|
|
|
- } else {
|
|
|
- map.put("ts_8", "☐");
|
|
|
- map.put("ts_9", "☐");
|
|
|
- }
|
|
|
- }
|
|
|
- //5.特困救助供养学生(城市 农村)
|
|
|
- if (parts[j].contains("特困救助供养学生")) {
|
|
|
- if (parts[j].contains("城市")) {
|
|
|
- map.put("ts_10", "☑");
|
|
|
- map.put("ts_11", "☐");
|
|
|
- } else if (parts[j].contains("农村")) {
|
|
|
- map.put("ts_10", "☐");
|
|
|
- map.put("ts_11", "☑");
|
|
|
- } else {
|
|
|
- map.put("ts_10", "☐");
|
|
|
- map.put("ts_11", "☐");
|
|
|
- }
|
|
|
- }
|
|
|
- //6.低收入对象(低保边缘家庭学生 支出型困难家庭学生)
|
|
|
- if (parts[j].contains("低收入对象")) {
|
|
|
- if (parts[j].contains("低保边缘家庭学生")) {
|
|
|
- map.put("ts_12", "☑");
|
|
|
- map.put("ts_13", "☐");
|
|
|
- } else if (parts[j].contains("支出型困难家庭学生")) {
|
|
|
- map.put("ts_12", "☐");
|
|
|
- map.put("ts_13", "☑");
|
|
|
- } else {
|
|
|
- map.put("ts_12", "☐");
|
|
|
- map.put("ts_13", "☐");
|
|
|
- }
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- index++;
|
|
|
- } catch (IllegalAccessException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- log.info("家庭情况正常");
|
|
|
-
|
|
|
- // TODO 户籍性质(魔法数字)
|
|
|
- if (asFamilyDifficultDO.getRegistrationType().equals("城镇")) {
|
|
|
- map.put("hj_0", "☑");
|
|
|
- map.put("hj_1", "☐");
|
|
|
- } else if (asFamilyDifficultDO.getRegistrationType().equals("农村")) {
|
|
|
- map.put("hj_0", "☐");
|
|
|
- map.put("hj_1", "☑");
|
|
|
- } else {
|
|
|
- map.put("hj_0", "☐");
|
|
|
- map.put("hj_1", "☐");
|
|
|
- }
|
|
|
- log.info("户籍性质正常");
|
|
|
-
|
|
|
- //TODO 户籍所在地(魔法数字)(如果有省,市,县的关键字的话,容易有BUG)
|
|
|
- String registrationLocation = asFamilyDifficultDO.getRegistrationLocation();
|
|
|
- String temp = "";
|
|
|
- for (int j = 0; j < registrationLocation.length(); j++) {
|
|
|
- if (registrationLocation.charAt(j) == '省') {
|
|
|
- map.put("p_name", temp);
|
|
|
- temp = "";
|
|
|
- } else if (registrationLocation.charAt(j) == '市') {
|
|
|
- map.put("m_name", temp);
|
|
|
- temp = "";
|
|
|
- } else if (registrationLocation.charAt(j) == '县') {
|
|
|
- map.put("c_name", temp);
|
|
|
- temp = "";
|
|
|
- } else {
|
|
|
- temp += registrationLocation.charAt(j);
|
|
|
- }
|
|
|
- }
|
|
|
- log.info("户籍所在地处理正常");
|
|
|
-
|
|
|
- // TODO 住房情况(魔法数字)
|
|
|
- String housingSituation = asFamilyDifficultDO.getHousingSituation();
|
|
|
- if (housingSituation.equals("商品房")) {
|
|
|
- map.put("zf_0", "☑");
|
|
|
- map.put("zf_1", "☐");
|
|
|
- map.put("zf_2", "☐");
|
|
|
- map.put("zf_3", "☐");
|
|
|
- map.put("zf_4", "☐");
|
|
|
- } else if (housingSituation.equals("单位福利住房")) {
|
|
|
- map.put("zf_0", "☐");
|
|
|
- map.put("zf_1", "☑");
|
|
|
- map.put("zf_2", "☐");
|
|
|
- map.put("zf_3", "☐");
|
|
|
- map.put("zf_4", "☐");
|
|
|
- } else if (housingSituation.equals("自建房")) {
|
|
|
- map.put("zf_0", "☐");
|
|
|
- map.put("zf_1", "☐");
|
|
|
- map.put("zf_2", "☑");
|
|
|
- map.put("zf_3", "☐");
|
|
|
- map.put("zf_4", "☐");
|
|
|
-
|
|
|
- } else if (housingSituation.equals("租房、无房")) {
|
|
|
- map.put("zf_0", "☐");
|
|
|
- map.put("zf_1", "☐");
|
|
|
- map.put("zf_2", "☐");
|
|
|
- map.put("zf_3", "☑");
|
|
|
- map.put("zf_4", "☐");
|
|
|
- } else if (housingSituation.equals("其他")) {
|
|
|
- map.put("zf_0", "☐");
|
|
|
- map.put("zf_1", "☐");
|
|
|
- map.put("zf_2", "☐");
|
|
|
- map.put("zf_3", "☐");
|
|
|
- map.put("zf_4", "☑");
|
|
|
- } else {
|
|
|
- map.put("zf_0", "☐");
|
|
|
- map.put("zf_1", "☐");
|
|
|
- map.put("zf_2", "☐");
|
|
|
- map.put("zf_3", "☐");
|
|
|
- map.put("zf_4", "☐");
|
|
|
- }
|
|
|
- log.info("住房处理正常");
|
|
|
-
|
|
|
- // TODO 家中有汽车情况(魔法数字)
|
|
|
- String housingCar = asFamilyDifficultDO.getHousingCar();
|
|
|
- if (housingCar.equals("自用")) {
|
|
|
- map.put("car_0", "☑");
|
|
|
- map.put("car_1", "☐");
|
|
|
- map.put("car_2", "☐");
|
|
|
- } else if (housingCar.equals("经营用")) {
|
|
|
- map.put("car_0", "☐");
|
|
|
- map.put("car_1", "☑");
|
|
|
- map.put("car_2", "☐");
|
|
|
- } else if (housingCar.equals("无汽车")) {
|
|
|
- map.put("car_0", "☐");
|
|
|
- map.put("car_1", "☐");
|
|
|
- map.put("car_2", "☑");
|
|
|
- } else {
|
|
|
- map.put("car_0", "☐");
|
|
|
- map.put("car_1", "☐");
|
|
|
- map.put("car_2", "☐");
|
|
|
- }
|
|
|
- log.info("家中汽车情况处理正常");
|
|
|
-
|
|
|
-
|
|
|
- // 家庭成员情况
|
|
|
- for (int j = 0; j < NumberList.size(); j++) {
|
|
|
- AsFamilyNumberOfFamilyDifficult asFamilyNumberOfFamilyDifficult = NumberList.get(j);
|
|
|
- map.put("name_" + j, asFamilyNumberOfFamilyDifficult.getName());
|
|
|
- map.put("age_" + j, asFamilyNumberOfFamilyDifficult.getAge());
|
|
|
- map.put("re_" + j, asFamilyNumberOfFamilyDifficult.getRelationShip());
|
|
|
- map.put("work_" + j, asFamilyNumberOfFamilyDifficult.getWorkUnit());
|
|
|
- map.put("c_" + j, asFamilyNumberOfFamilyDifficult.getCareer());
|
|
|
- map.put("inc_" + j, asFamilyNumberOfFamilyDifficult.getAnnualIncome());
|
|
|
- //健康状况的判断
|
|
|
- if (asFamilyNumberOfFamilyDifficult.getHealth().equals("健康")) {
|
|
|
- map.put("jk_" + j, "√");
|
|
|
- map.put("cj_" + j, " ");
|
|
|
- map.put("zb_" + j, " ");
|
|
|
- } else if (asFamilyNumberOfFamilyDifficult.getHealth().equals("残疾")) {
|
|
|
- map.put("jk_" + j, " ");
|
|
|
- map.put("cj_" + j, "√");
|
|
|
- map.put("zb_" + j, " ");
|
|
|
- } else if (asFamilyNumberOfFamilyDifficult.getHealth().equals("患重大疾病")) {
|
|
|
- map.put("jk_" + j, " ");
|
|
|
- map.put("cj_" + j, " ");
|
|
|
- map.put("zb_" + j, "√");
|
|
|
- } else {
|
|
|
- map.put("jk_" + j, " ");
|
|
|
- map.put("cj_" + j, " ");
|
|
|
- map.put("zb_" + j, " ");
|
|
|
- }
|
|
|
- }
|
|
|
- //成员不够就补充空格
|
|
|
- for (int j = NumberList.size(); j < FamilyNumberSizeConstant.FAMILY_DIFFICULT_NUMBER_MAX_SIZE; j++) {
|
|
|
- map.put("name_" + j, " ");
|
|
|
- map.put("age_" + j, " ");
|
|
|
- map.put("re_" + j, " ");
|
|
|
- map.put("work_" + j, " ");
|
|
|
- map.put("c_" + j, " ");
|
|
|
- map.put("inc_" + j, " ");
|
|
|
- map.put("jk_" + j, " ");
|
|
|
- map.put("cj_" + j, " ");
|
|
|
- map.put("zb_" + j, " ");
|
|
|
- }
|
|
|
- log.info("家庭成员处理正常");
|
|
|
- // TODO 家庭主要经济收入来源
|
|
|
- String incomeSource = asFamilyDifficultDO.getIncomeSource();
|
|
|
- String[] splits3 = incomeSource.split(",");
|
|
|
- //按照定义顺序
|
|
|
- Class<IncomeSourceConstant> clazz3 = IncomeSourceConstant.class;
|
|
|
- Field[] fields3 = clazz3.getDeclaredFields();
|
|
|
- int index3 = 0;
|
|
|
- for (Field field : fields3) {
|
|
|
- field.setAccessible(true);
|
|
|
- if (field.getType() == String.class) {
|
|
|
- try {
|
|
|
- String value = (String) field.get(null);
|
|
|
- map.put("income_" + index3, "☐");
|
|
|
- for (int j = 0; j < splits3.length; j++) {
|
|
|
- if (value.equals(splits3[j])) {
|
|
|
- map.put("income_" + index3, "☑");
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- index3++;
|
|
|
- } catch (IllegalAccessException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- log.info("家庭主要经济处理正常");
|
|
|
- // TODO 突发情况
|
|
|
- String familyEmergency = asFamilyDifficultDO.getFamilyEmergency();
|
|
|
- log.info("familyEmergency = {}", familyEmergency);
|
|
|
- if (familyEmergency != null) {
|
|
|
- String[] splits4 = familyEmergency.split(",");
|
|
|
- //按照定义顺序
|
|
|
- Class<EmergenciesConstant> clazz4 = EmergenciesConstant.class;
|
|
|
- Field[] fields4 = clazz4.getDeclaredFields();
|
|
|
- int index4 = 0;
|
|
|
- for (Field field : fields4) {
|
|
|
- field.setAccessible(true);
|
|
|
- if (field.getType() == String.class) {
|
|
|
- try {
|
|
|
- String value = (String) field.get(null);
|
|
|
- map.put("oth_" + index4, "☐");
|
|
|
- for (int j = 0; j < splits4.length; j++) {
|
|
|
- if (value.equals(splits4[j])) {
|
|
|
- map.put("oth_" + index4, "☑");
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- index4++;
|
|
|
- } catch (IllegalAccessException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- log.info("突发情况正常");
|
|
|
- }
|
|
|
-
|
|
|
- //班级民主
|
|
|
- if (asFamilyDifficultDO.getClassReviewGroupOpinion().equals(DifficultLevelConstant.ESPECIALLY_DIFFICULT)) {
|
|
|
- map.put("cl_0", "☑");
|
|
|
- map.put("cl_1", "☐");
|
|
|
- map.put("cl_2", "☐");
|
|
|
- } else if (asFamilyDifficultDO.getClassReviewGroupOpinion().equals(DifficultLevelConstant.COMPARATIVE_DIFFICULT)) {
|
|
|
- map.put("cl_0", "☐");
|
|
|
- map.put("cl_1", "☑");
|
|
|
- map.put("cl_2", "☐");
|
|
|
- } else if (asFamilyDifficultDO.getClassReviewGroupOpinion().equals(DifficultLevelConstant.GENERAL_DIFFICULT)) {
|
|
|
- map.put("cl_0", "☐");
|
|
|
- map.put("cl_1", "☐");
|
|
|
- map.put("cl_2", "☑");
|
|
|
- } else {
|
|
|
- map.put("cl_0", "☐");
|
|
|
- map.put("cl_1", "☐");
|
|
|
- map.put("cl_2", "☐");
|
|
|
- }
|
|
|
- log.info("班级民主处理正常");
|
|
|
-
|
|
|
- //学院
|
|
|
- if (asFamilyDifficultDO.getDepartmentOpinion().equals(DifficultLevelConstant.ESPECIALLY_DIFFICULT)) {
|
|
|
- map.put("dp_0", "☑");
|
|
|
- map.put("dp_1", "☐");
|
|
|
- map.put("dp_2", "☐");
|
|
|
- } else if (asFamilyDifficultDO.getDepartmentOpinion().equals(DifficultLevelConstant.COMPARATIVE_DIFFICULT)) {
|
|
|
- map.put("dp_0", "☐");
|
|
|
- map.put("dp_1", "☑");
|
|
|
- map.put("dp_2", "☐");
|
|
|
- } else if (asFamilyDifficultDO.getDepartmentOpinion().equals(DifficultLevelConstant.GENERAL_DIFFICULT)) {
|
|
|
- map.put("dp_0", "☐");
|
|
|
- map.put("dp_1", "☐");
|
|
|
- map.put("dp_2", "☑");
|
|
|
- } else {
|
|
|
- map.put("dp_0", "☐");
|
|
|
- map.put("dp_1", "☐");
|
|
|
- map.put("dp_2", "☐");
|
|
|
- }
|
|
|
- log.info("学院处理正常");
|
|
|
-
|
|
|
- //学校
|
|
|
- if (asFamilyDifficultDO.getSchoolApprovalOpinion().equals(DifficultLevelConstant.ESPECIALLY_DIFFICULT)) {
|
|
|
- map.put("sc_0", "☑");
|
|
|
- map.put("sc_1", "☐");
|
|
|
- map.put("sc_2", "☐");
|
|
|
- } else if (asFamilyDifficultDO.getSchoolApprovalOpinion().equals(DifficultLevelConstant.COMPARATIVE_DIFFICULT)) {
|
|
|
- map.put("sc_0", "☐");
|
|
|
- map.put("sc_1", "☑");
|
|
|
- map.put("sc_2", "☐");
|
|
|
- } else if (asFamilyDifficultDO.getSchoolApprovalOpinion().equals(DifficultLevelConstant.GENERAL_DIFFICULT)) {
|
|
|
- map.put("sc_0", "☐");
|
|
|
- map.put("sc_1", "☐");
|
|
|
- map.put("sc_2", "☑");
|
|
|
- } else {
|
|
|
- map.put("sc_0", "☐");
|
|
|
- map.put("sc_1", "☐");
|
|
|
- map.put("sc_2", "☐");
|
|
|
- }
|
|
|
- log.info("学校处理正常");
|
|
|
-
|
|
|
- // 最后的特殊处理:横线消失问题,补上对应长度的横线
|
|
|
- //1.otherInfo = null
|
|
|
- if (map.get("otherInfo") == null) {
|
|
|
- map.put("otherInfo", " ");
|
|
|
- }
|
|
|
- //2.otherPrief = null
|
|
|
- if (map.get("otherPrief") == null) {
|
|
|
- map.put("otherPrief", " ");
|
|
|
- }
|
|
|
- //3.emergencySituations = null
|
|
|
- if (map.get("emergencySituations") == null) {
|
|
|
- map.put("emergencySituations", " ");
|
|
|
- }
|
|
|
- //4.otherCircumstances = null
|
|
|
- if (map.get("otherCircumstances") == null) {
|
|
|
- map.put("otherCircumstances", " ");
|
|
|
- }
|
|
|
- log.info("第{}个学生的map信息如下{}", i + 1, map);
|
|
|
- dataList.add(map);
|
|
|
- }
|
|
|
- return dataList;
|
|
|
- }
|
|
|
-}
|