|
|
|
@@ -11,17 +11,24 @@ 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.WxAllBill; |
|
|
|
import com.iformall.domain.po.WxFinancePrintData; |
|
|
|
import com.iformall.domain.po.WxFinancePrintTemplate; |
|
|
|
import com.iformall.domain.po.WxFinanceReceive; |
|
|
|
import com.iformall.domain.po.base.TenantEntity; |
|
|
|
import com.iformall.domain.vo.PrintVo; |
|
|
|
import com.iformall.enums.EnumFinancePrintDataType; |
|
|
|
import com.iformall.enums.EnumYesOrNo; |
|
|
|
import com.iformall.exception.MallinkException; |
|
|
|
import com.iformall.mapper.WxFinancePrintDataMapper; |
|
|
|
import com.iformall.mapper.WxFinancePrintTemplateMapper; |
|
|
|
import com.iformall.print.data.PrintBillDataHandler; |
|
|
|
import com.iformall.print.data.PrintFinanceReceiveDataHandler; |
|
|
|
import com.iformall.service.WxAllBillService; |
|
|
|
import com.iformall.service.WxFinancePrintService; |
|
|
|
import com.iformall.service.WxFinanceService; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
@@ -42,6 +49,10 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { |
|
|
|
@Autowired |
|
|
|
WxFinanceService wxFinanceService; |
|
|
|
|
|
|
|
@Lazy |
|
|
|
@Autowired |
|
|
|
WxAllBillService wxAllBillService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<WxFinancePrintData> printDataList(WxFinancePrintData record) { |
|
|
|
return wxFinancePrintDataMapper.findList(record); |
|
|
|
@@ -128,14 +139,48 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { |
|
|
|
} |
|
|
|
|
|
|
|
@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); |
|
|
|
// } |
|
|
|
public List<PrintVo> parseTemplateData(String tenantId, Long templateId, List<Long> dataIds) { |
|
|
|
WxFinancePrintTemplate template = this.getTemplateById(templateId); |
|
|
|
if (null == template) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
EnumFinancePrintDataType printDatatype = EnumFinancePrintDataType.getEnum(template.getType()); |
|
|
|
//付款单 |
|
|
|
if (printDatatype.getCode().intValue() == EnumFinancePrintDataType.FINANCE_RECEIVE.getCode()) { |
|
|
|
WxFinanceReceive receiveq = new WxFinanceReceive(); |
|
|
|
receiveq.setTenantId(tenantId); |
|
|
|
receiveq.setIds(dataIds); |
|
|
|
List<WxFinanceReceive> receiveList = wxFinanceService.findReceiveList(receiveq); |
|
|
|
if (null == receiveList || receiveList.size() <= 0 ) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
List<PrintVo> voList = new ArrayList<PrintVo>(); |
|
|
|
for (int i = 0 ; i < receiveList.size(); i ++) { |
|
|
|
WxFinanceReceive re = receiveList.get(i); |
|
|
|
PrintVo vo = new PrintVo(); |
|
|
|
vo.setDataId(templateId); |
|
|
|
vo.setTemplate(PrintFinanceReceiveDataHandler.parse(template.getContent(), re)); |
|
|
|
voList.add(vo); |
|
|
|
} |
|
|
|
return voList; |
|
|
|
}else if (printDatatype.getCode().intValue() == EnumFinancePrintDataType.BILL.getCode()) { |
|
|
|
WxAllBill bq = new WxAllBill(); |
|
|
|
bq.setTenantId(tenantId); |
|
|
|
bq.setIds(dataIds); |
|
|
|
List<WxAllBill> billAllList = wxAllBillService.list(bq); |
|
|
|
if (null == billAllList || billAllList.size() <= 0 ) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
List<PrintVo> voList = new ArrayList<PrintVo>(); |
|
|
|
for (int i = 0 ; i < billAllList.size(); i ++) { |
|
|
|
WxAllBill re = billAllList.get(i); |
|
|
|
PrintVo vo = new PrintVo(); |
|
|
|
vo.setDataId(templateId); |
|
|
|
vo.setTemplate(PrintBillDataHandler.parse(template.getContent(), re)); |
|
|
|
voList.add(vo); |
|
|
|
} |
|
|
|
return voList; |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
|