Commit 237ee3b6 authored by liuyang's avatar liuyang

修改证书模板

parent 9a6c9942
......@@ -65,7 +65,7 @@ public class MdpController extends BaseController<Object> {
return propertis.getConfigs().get(1).getAppid();
}
private String uploadAvatarPath = File.separator + "mdp" + File.separator + "uploadAvatar";
private String certificateTemplate = "classpath:certificate.jpeg";
private String certificateTemplate = "classpath:certificate.png";
private String userCertificatePath = File.separator + "mdp" + File.separator + "certificate";
@Auth(verifyLogin = false,verifyURL = false)
......@@ -484,14 +484,17 @@ public class MdpController extends BaseController<Object> {
List<CertificateVo> addTexts = Lists.newArrayList();
Calendar now = Calendar.getInstance();
addTexts.add(new CertificateVo(user.getName(),new Font("宋体",Font.BOLD,50),200,600));
addTexts.add(new CertificateVo(code,new Font("宋体",Font.BOLD,30),280,1310));
addTexts.add(new CertificateVo(now.get(Calendar.YEAR)+"",new Font("宋体",Font.PLAIN,30),550,1245));
addTexts.add(new CertificateVo(now.get(Calendar.MONTH) +1+"",new Font("宋体",Font.PLAIN,30),680,1245));
addTexts.add(new CertificateVo(now.get(Calendar.DATE)+"",new Font("宋体",Font.PLAIN,30),790,1245));
String outputFilePath = rb.getString("file_path") + this.userCertificatePath + File.separator + user.getId() + ".jpeg";
String year = now.get(Calendar.YEAR) + "";
String month = now.get(Calendar.MONTH) + 1 >=10 ? "" + (now.get(Calendar.MONTH) + 1) : "0" + (now.get(Calendar.MONTH) + 1);
String day = now.get(Calendar.DATE) >=10 ? "" + now.get(Calendar.DATE) : "0" + now.get(Calendar.DATE);
addTexts.add(new CertificateVo(user.getName(),new Font("宋体",Font.BOLD,50),190,570));
addTexts.add(new CertificateVo(code,new Font("宋体",Font.BOLD,30),270,1265));
addTexts.add(new CertificateVo(year,new Font("宋体",Font.PLAIN,30),525,1200));
addTexts.add(new CertificateVo(month,new Font("宋体",Font.PLAIN,30),650,1200));
addTexts.add(new CertificateVo(day,new Font("宋体",Font.PLAIN,30),740,1200));
String outputFilePath = rb.getString("file_path") + this.userCertificatePath + File.separator + user.getId() + ".png";
UserUtils.generateCertificate(this.certificateTemplate,outputFilePath,addTexts);
user.setCerfificatePath(this.userCertificatePath + File.separator + user.getId() + ".jpeg");
user.setCerfificatePath(this.userCertificatePath + File.separator + user.getId() + ".png");
}
private String getCollectBloodCode(User user) {
......
......@@ -111,16 +111,19 @@ public class UserUtils {
// }
List<CertificateVo> addTexts = Lists.newArrayList();
Calendar now = Calendar.getInstance();
addTexts.add(new CertificateVo("刘扬",new Font("宋体",Font.PLAIN,50),200,600));
addTexts.add(new CertificateVo("0222189765",new Font("宋体",Font.PLAIN,30),280,1310));
addTexts.add(new CertificateVo(now.get(Calendar.YEAR)+"",new Font("宋体",Font.PLAIN,30),550,1245));
addTexts.add(new CertificateVo(now.get(Calendar.MONTH) +1+"",new Font("宋体",Font.PLAIN,30),690,1245));
addTexts.add(new CertificateVo(now.get(Calendar.DATE)+"",new Font("宋体",Font.PLAIN,30),790,1245));
UserUtils.generateCertificate("classpath:certificate.jpeg","/Users/liuyang/Pictures/certificate.jpeg",addTexts);
String year = now.get(Calendar.YEAR) + "";
String month = now.get(Calendar.MONTH) + 1 >=10 ? "" + (now.get(Calendar.MONTH) + 1) : "0" + (now.get(Calendar.MONTH) + 1);
String day = now.get(Calendar.DATE) >=10 ? "" + now.get(Calendar.DATE) : "0" + now.get(Calendar.DATE);
addTexts.add(new CertificateVo("刘扬",new Font("宋体",Font.BOLD,50),190,570));
addTexts.add(new CertificateVo("02223456",new Font("宋体",Font.BOLD,30),270,1265));
addTexts.add(new CertificateVo(year,new Font("宋体",Font.PLAIN,30),525,1200));
addTexts.add(new CertificateVo(month,new Font("宋体",Font.PLAIN,30),650,1200));
addTexts.add(new CertificateVo(day,new Font("宋体",Font.PLAIN,30),740,1200));
UserUtils.generateCertificate("classpath:certificate.png","/Users/liuyang/Pictures/certificate.png",addTexts);
}catch (IOException e){
e.printStackTrace();;
}
}
*/
*/
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment