package cn.com.lzt.purchase.util; import cn.com.lzt.common.util.DictUtil; import cn.com.lzt.cost.activiti.payinneruser.entity.TBActivitiCostPayInnerUserDetailEntity; import cn.com.lzt.cost.activiti.payinneruser.entity.TBActivitiCostPayInnerUserEntity; import cn.com.lzt.cost.type.entity.TBCostTypeEntity; import cn.com.lzt.purchase.entity.POrdersEntity; import cn.com.lzt.purchasedetails.entity.OrderDetailsEntity; import cn.com.lzt.useractiviti.data.util.ActivitiPdfExport; import cn.com.lzt.useractiviti.data.util.ActivitiTools; import cn.com.lzt.useractiviti.data.util.tools.DefaultActivitiTools; import com.lowagie.text.DocumentException; import com.lowagie.text.pdf.PdfPCell; import com.lowagie.text.pdf.PdfPTable; import org.jeecgframework.core.util.DataUtils; import org.jeecgframework.core.util.MoneyUtils; import org.jeecgframework.core.util.oConvertUtils; import java.util.HashMap; import java.util.List; import java.util.Map; //费用报销签报 public class POrdersActivitiTools extends DefaultActivitiTools { @Override protected void printBusinessInfo() { String entityId=getBusId(); POrdersEntity entity = systemService.getEntity(POrdersEntity.class,entityId); if(!entity.getBpmStatus().equals("1")){ pdfExport.requestTime(entity.getCreateDate()); } pdfExport.table(1); PdfPTable infoTable = pdfExport.createTable(2); pdfExport.cell(infoTable,"申请人:"+ entity.getCreateName() ,false ); pdfExport.cell(infoTable,"总金额:"+ entity.getTotalMoney() ,false ); pdfExport.cell(infoTable); List detailEntityList = systemService.findByProperty(OrderDetailsEntity.class, "fkId", entityId); pdfExport.cell("采购货品"); PdfPTable detailTableHeader = pdfExport.createTable(9); detailTableHeader.setWidthPercentage(100); pdfExport.cell(detailTableHeader, "", true); pdfExport.cell(detailTableHeader, "货品名称", true); pdfExport.cell(detailTableHeader, "规格型号", true); pdfExport.cell(detailTableHeader, "计量单位", true); pdfExport.cell(detailTableHeader, "数量", true); pdfExport.cell(detailTableHeader, "采购单价(元)", true); pdfExport.cell(detailTableHeader, "金额(元)", true); pdfExport.cell(detailTableHeader, "供应商", true); pdfExport.cell(detailTableHeader, "备注", true); pdfExport.cell(detailTableHeader); String sql = "select detail.*, supplier.id as supplierId, supplier.unit_name as supplierName from t_b_porder_details detail " + "left join t_b_goods_info goods on goods.id=detail.goods_id " + "left join t_b_related_units supplier on supplier.id = goods.default_provider where fk_id =? "; List> result = systemService.findForJdbc(sql, entityId); HashMap> hm_id2map = new HashMap<>(); if(result != null && result.size()>0) { for(Map map : result) { hm_id2map.put((String)map.get("id"), map); } } int i=0; for(OrderDetailsEntity detailEntity:detailEntityList){ i++; PdfPTable detailTable = pdfExport.createTable(9); pdfExport.cell(detailTable,"明细"+i,true); pdfExport.cell(detailTable,detailEntity.getPname(),false);//货品名称 pdfExport.cell(detailTable, detailEntity.getSpecType(),false);//规格型号 pdfExport.cell(detailTable, DictUtil.formatToTypeName(detailEntity.getMeasureUnit(),"metering_calcu_unit"),false);//计量单位 pdfExport.cell(detailTable, detailEntity.getQuantity().toString(), false);//数量 pdfExport.cell(detailTable,detailEntity.getPurchasePrice().toString(), false);//采购单价 pdfExport.cell(detailTable, detailEntity.getMoney().toString(), false);//金额 String supplierName =""; Map detailMap= hm_id2map.get(detailEntity.getId()); if(detailMap!=null){ supplierName=oConvertUtils.getString(detailMap.get("supplierName")); } pdfExport.cell(detailTable,supplierName , false);//供应商 pdfExport.cell(detailTable, detailEntity.getRemark(), false);//备注 pdfExport.cell(detailTable); } } }