|
|
@@ -90,8 +90,10 @@ public class SealServiceImpl implements SealService {
|
|
|
|
|
|
/** 文件夹按年/月/日分层,便于长期运行时管理文件。 */
|
|
|
private static final DateTimeFormatter DIRECTORY_DATE = DateTimeFormatter.ofPattern("yyyy/MM/dd");
|
|
|
- /** 图片中显示的审批日期格式。 */
|
|
|
+ /** 接口返回的审批日期格式。 */
|
|
|
private static final DateTimeFormatter FILE_DATE = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
+ /** 印章上显示的日期,例如 26.10.20。 */
|
|
|
+ private static final DateTimeFormatter STAMP_DATE = DateTimeFormatter.ofPattern("yy.MM.dd");
|
|
|
|
|
|
@Autowired
|
|
|
private AccessTokenService accessTokenService;
|
|
|
@@ -151,7 +153,7 @@ public class SealServiceImpl implements SealService {
|
|
|
// 获取底图、叠加日期、保存文件,最后把文件 URL 写回宜搭。
|
|
|
byte[] templateBytes = loadTemplateBytes(request.getTemplateImageUrl(), appType, accessToken);
|
|
|
log.info("[seal] 印章底图读取完成,bytes={}", templateBytes.length);
|
|
|
- byte[] stampedBytes = renderSeal(templateBytes, approvalDate);
|
|
|
+ byte[] stampedBytes = renderSeal(templateBytes, LocalDate.parse(approvalDate).format(STAMP_DATE));
|
|
|
log.info("[seal] 日期绘制完成,approvalDate={}, outputBytes={}", approvalDate, stampedBytes.length);
|
|
|
StoredFile storedFile = store(stampedBytes, instanceId, approvalDate);
|
|
|
log.info("[seal] 印章文件保存完成,path={}, url={}", storedFile.path, storedFile.url);
|
|
|
@@ -197,7 +199,7 @@ public class SealServiceImpl implements SealService {
|
|
|
Map<String, byte[]> templateCache = new HashMap<>();
|
|
|
List<SealApprovalRecordResult> results = new ArrayList<>();
|
|
|
DateTimeFormatter timestamp = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(zone);
|
|
|
- DateTimeFormatter stampDate = FILE_DATE.withZone(zone);
|
|
|
+ DateTimeFormatter stampDate = STAMP_DATE.withZone(zone);
|
|
|
for (ApprovalRecordParser.ApprovalRecord record : records) {
|
|
|
byte[] template = templateCache.get(record.getUserId());
|
|
|
if (template == null) {
|