|
|
|
@@ -58,15 +58,13 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public void saveOrUpdate(WxFinancePrintTemplate record) { |
|
|
|
boolean isGenarated = false; |
|
|
|
Map map = new HashMap(); |
|
|
|
if (StringUtils.isBlank(record.getContent())) { |
|
|
|
Map map = new HashMap(); |
|
|
|
map.put("width", 770); |
|
|
|
map.put("height", 500); |
|
|
|
map.put("pageWidth", 215); |
|
|
|
map.put("pageHeight", 140); |
|
|
|
record.setContent(JSON.toJSONString(map)); |
|
|
|
isGenarated = true; |
|
|
|
} |
|
|
|
Date date = new Date(); |
|
|
|
if (record.getId() == null) { |
|
|
|
@@ -74,10 +72,12 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { |
|
|
|
record.setId(idWorker.nextId()); |
|
|
|
record.setCreateTime(date); |
|
|
|
record.setUpdateTime(date); |
|
|
|
record.setName(record.getTitle()); |
|
|
|
JSONObject o = record.getContentJson(); |
|
|
|
o.put("id", String.valueOf(record.getId())); |
|
|
|
o.put("title", record.getName()); |
|
|
|
o.put("type", record.getType()); |
|
|
|
o.put("tempItems", record.getTempItems()); |
|
|
|
record.setContent(JSON.toJSONString(o)); |
|
|
|
try { |
|
|
|
wxFinancePrintTemplateMapper.insert(record); |
|
|
|
@@ -86,13 +86,13 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { |
|
|
|
throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (null != record.getContentJson()) { |
|
|
|
JSONObject o = record.getContentJson(); |
|
|
|
o.put("id", String.valueOf(record.getId())); |
|
|
|
o.put("title", record.getName()); |
|
|
|
o.put("type", record.getType()); |
|
|
|
record.setContent(JSON.toJSONString(o)); |
|
|
|
} |
|
|
|
JSONObject o = record.getContentJson(); |
|
|
|
o.put("id", String.valueOf(record.getId())); |
|
|
|
o.put("title", record.getName()); |
|
|
|
o.put("type", record.getType()); |
|
|
|
o.put("tempItems", record.getTempItems()); |
|
|
|
record.setContent(JSON.toJSONString(o)); |
|
|
|
record.setName(record.getTitle()); |
|
|
|
record.setUpdateTime(date); |
|
|
|
wxFinancePrintTemplateMapper.updateById(record); |
|
|
|
} |
|
|
|
|