| @@ -30,13 +30,6 @@ public class ImgYwsqhUtil { | |||||
| public static byte[] imgCeate(String contact_name,String contact_id_number,String contact_department,String contact_job, | public static byte[] imgCeate(String contact_name,String contact_id_number,String contact_department,String contact_job, | ||||
| String legal_person,String id_card_number,String card_period_begin,String card_period_end, | String legal_person,String id_card_number,String card_period_begin,String card_period_end, | ||||
| boolean isSeal,String merchant_name){ | boolean isSeal,String merchant_name){ | ||||
| if(StringUtils.isBlank(contact_name)){ | |||||
| logger.error("名字为空,无法生成证书"); | |||||
| return null; | |||||
| } | |||||
| if(contact_name.length() == 2){ | |||||
| contact_name = contact_name.replaceAll("(\\S)", "$0 "); | |||||
| } | |||||
| try { | try { | ||||
| @@ -55,9 +48,13 @@ public class ImgYwsqhUtil { | |||||
| FontMetrics metrics = g.getFontMetrics(fTxtBottom); | FontMetrics metrics = g.getFontMetrics(fTxtBottom); | ||||
| //图片加中文名 | //图片加中文名 | ||||
| int xName = 2955 - metrics.stringWidth(contact_name)/2 ; | |||||
| g.drawString(contact_name, xName , 1282);//g.drawString(文字, x 位置, y 位置); | |||||
| if(StringUtils.isNotBlank(contact_name)){ | |||||
| if(contact_name.length() == 2){ | |||||
| contact_name = contact_name.replace("", " ").trim(); | |||||
| } | |||||
| int xName = 2955 - metrics.stringWidth(contact_name)/2 ; | |||||
| g.drawString(contact_name, xName , 1282);//g.drawString(文字, x 位置, y 位置); | |||||
| } | |||||
| //图片加身份证号 | //图片加身份证号 | ||||
| if(StringUtils.isNotBlank(contact_id_number)){ | if(StringUtils.isNotBlank(contact_id_number)){ | ||||
| int xNumber = 1200 - metrics.stringWidth(contact_id_number) / 2; | int xNumber = 1200 - metrics.stringWidth(contact_id_number) / 2; | ||||
| @@ -75,6 +72,9 @@ public class ImgYwsqhUtil { | |||||
| } | } | ||||
| //图片加法人姓名 | //图片加法人姓名 | ||||
| if(StringUtils.isNotBlank(legal_person)){ | if(StringUtils.isNotBlank(legal_person)){ | ||||
| if(legal_person.length() == 2){ | |||||
| legal_person = legal_person.replace("", " ").trim(); | |||||
| } | |||||
| g.drawString(legal_person, 1250, 2590); | g.drawString(legal_person, 1250, 2590); | ||||
| } | } | ||||
| //图片加法人身份证号 | //图片加法人身份证号 | ||||