|
|
|
@@ -4,22 +4,27 @@ package com.iformall.service.impl; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.context.annotation.Lazy; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; |
|
|
|
import com.iformall.common.ErrorCode; |
|
|
|
import com.iformall.common.IdWorker; |
|
|
|
import com.iformall.domain.po.WxFinancePrintData; |
|
|
|
import com.iformall.domain.po.WxFinancePrintTemplate; |
|
|
|
import com.iformall.enums.EnumYesOrNo; |
|
|
|
import com.iformall.domain.po.WxFinanceReceive; |
|
|
|
import com.iformall.domain.po.base.TenantEntity; |
|
|
|
import com.iformall.enums.EnumFinancePrintDataType; |
|
|
|
import com.iformall.exception.MallinkException; |
|
|
|
import com.iformall.mapper.WxFinancePrintDataMapper; |
|
|
|
import com.iformall.mapper.WxFinancePrintTemplateMapper; |
|
|
|
import com.iformall.service.WxFinancePrintService; |
|
|
|
|
|
|
|
import com.iformall.service.WxFinanceService; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
/** |
|
|
|
*/ |
|
|
|
@@ -32,6 +37,10 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { |
|
|
|
@Autowired |
|
|
|
WxFinancePrintTemplateMapper wxFinancePrintTemplateMapper; |
|
|
|
|
|
|
|
@Lazy |
|
|
|
@Autowired |
|
|
|
WxFinanceService wxFinanceService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<WxFinancePrintData> printDataList(WxFinancePrintData record) { |
|
|
|
return wxFinancePrintDataMapper.findList(record); |
|
|
|
@@ -49,19 +58,30 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public void saveOrUpdate(WxFinancePrintTemplate record) { |
|
|
|
boolean isGenarated = false; |
|
|
|
if (StringUtils.isBlank(record.getContent())) { |
|
|
|
Map map = new HashMap(); |
|
|
|
map.put("title", record.getName()); |
|
|
|
map.put("type", record.getType()); |
|
|
|
map.put("width", 770); |
|
|
|
map.put("height", 500); |
|
|
|
map.put("pageWidth", 215); |
|
|
|
map.put("pageHeight", 140); |
|
|
|
map.put("id", String.valueOf(record.getId())); |
|
|
|
map.put("defaultValue", 0); |
|
|
|
record.setContent(JSON.toJSONString(map)); |
|
|
|
isGenarated = true; |
|
|
|
} |
|
|
|
Date date = new Date(); |
|
|
|
if (record.getId() == null) { |
|
|
|
final IdWorker idWorker = IdWorker.get(); |
|
|
|
record.setId(idWorker.nextId()); |
|
|
|
record.setCreateTime(date); |
|
|
|
record.setUpdateTime(date); |
|
|
|
if (null != record.getContentJson()) { |
|
|
|
JSONObject o = record.getContentJson(); |
|
|
|
o.put("type", record.getType()); |
|
|
|
o.put("id", String.valueOf(record.getId())); |
|
|
|
o.put("defaultValue", 0); |
|
|
|
record.setContent(JSON.toJSONString(o)); |
|
|
|
} |
|
|
|
JSONObject o = record.getContentJson(); |
|
|
|
o.put("defaultValue", 0); |
|
|
|
o.put("title", record.getName()); |
|
|
|
record.setContent(JSON.toJSONString(o)); |
|
|
|
try { |
|
|
|
wxFinancePrintTemplateMapper.insert(record); |
|
|
|
} catch (Exception e) { |
|
|
|
@@ -71,9 +91,8 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { |
|
|
|
} else { |
|
|
|
if (null != record.getContentJson()) { |
|
|
|
JSONObject o = record.getContentJson(); |
|
|
|
o.put("type", record.getType()); |
|
|
|
o.put("id", String.valueOf(record.getId())); |
|
|
|
o.put("defaultValue", 0); |
|
|
|
o.put("title", record.getName()); |
|
|
|
record.setContent(JSON.toJSONString(o)); |
|
|
|
} |
|
|
|
record.setUpdateTime(date); |
|
|
|
@@ -87,5 +106,17 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { |
|
|
|
wxFinancePrintTemplateMapper.updateById(record); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<Map> parseTemplateData(String tenantId, Integer type, List<Long> dataIds) { |
|
|
|
EnumFinancePrintDataType printDatatype = EnumFinancePrintDataType.getEnum(type); |
|
|
|
// //付款单 |
|
|
|
// if (printDatatype.getCode().intValue() == EnumFinancePrintDataType.FINANCE_RECEIVE.getCode()) { |
|
|
|
// TenantEntity tenantEntity = new TenantEntity(); |
|
|
|
// tenantEntity.setTenantId(tenantId); |
|
|
|
// WxFinanceReceive receive = wxFinanceService.getReceiveById(tenantEntity, id); |
|
|
|
// } |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |