66 lines
2.7 KiB
Java
66 lines
2.7 KiB
Java
package cn.com.tenlion.util;
|
|
|
|
import cn.com.tenlion.buildingpictures.service.picturestemplatebuilding.IPicturesTemplateBuildingService;
|
|
import cn.com.tenlion.pojo.dtos.applystudents.ApplyStudentsDTO;
|
|
import cn.com.tenlion.pojo.dtos.applystudentsnew.ApplyStudentsNewDTO;
|
|
import cn.com.tenlion.pojo.dtos.cardential.CardentialDTO;
|
|
import cn.com.tenlion.service.applystudents.IApplyStudentsService;
|
|
import ink.wgink.module.dictionary.pojo.dtos.DataDTO;
|
|
import ink.wgink.module.dictionary.service.IDataService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* 生成证书的工具类
|
|
* @author xwangs
|
|
* @create 2021-06-25 10:42
|
|
* @description
|
|
*/
|
|
@Component
|
|
public class CertificateUtil {
|
|
|
|
@Autowired
|
|
private IApplyStudentsService studentsService;
|
|
@Autowired
|
|
private IDataService dataService;
|
|
@Autowired
|
|
private IPicturesTemplateBuildingService picService;
|
|
|
|
public String getTS0002(ApplyStudentsNewDTO applyStudentsNewDTO){
|
|
Map<String, Object> query = new HashMap<>(8);
|
|
query.put("applyClassId", applyStudentsNewDTO.getClassPlanId());
|
|
query.put("creator",applyStudentsNewDTO.getUserId());
|
|
ApplyStudentsDTO studentsDTO = studentsService.get(query);
|
|
CardentialDTO cardentialDTO = new CardentialDTO();
|
|
cardentialDTO.setPhoto(studentsDTO.getApplyUserCardPhoto());
|
|
cardentialDTO.setName(applyStudentsNewDTO.getName());
|
|
cardentialDTO.setSex(applyStudentsNewDTO.getSex());
|
|
// 查询文化程度
|
|
if(applyStudentsNewDTO.getEducation() == null
|
|
|| applyStudentsNewDTO.getEducation().length() == 0){
|
|
cardentialDTO.setEducationDegree("-");
|
|
} else {
|
|
DataDTO educationData = dataService.get(applyStudentsNewDTO.getEducation());
|
|
cardentialDTO.setEducationDegree(educationData.getDataName());
|
|
}
|
|
cardentialDTO.setIdentity(applyStudentsNewDTO.getCardNumber());
|
|
cardentialDTO.setDepartment(applyStudentsNewDTO.getWorkUnit());
|
|
cardentialDTO.setPosition(applyStudentsNewDTO.getWorkTitle());
|
|
cardentialDTO.setSueDate(applyStudentsNewDTO.getCardTime().substring(0,10));
|
|
cardentialDTO.setStartDate(applyStudentsNewDTO.getCardValidity());
|
|
cardentialDTO.setEndDate(applyStudentsNewDTO.getCardValidityEnd());
|
|
cardentialDTO.setNumber(applyStudentsNewDTO.getIdCard());
|
|
cardentialDTO.setQrCode("");
|
|
String certificateB64;
|
|
try {
|
|
certificateB64 = picService.buildingPictures("TS0002",cardentialDTO);
|
|
} catch (Exception e){
|
|
return "";
|
|
}
|
|
return certificateB64;
|
|
}
|
|
}
|