POrdersActivitiTools.java 4.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. package cn.com.lzt.purchase.util;
  2. import cn.com.lzt.common.util.DictUtil;
  3. import cn.com.lzt.cost.activiti.payinneruser.entity.TBActivitiCostPayInnerUserDetailEntity;
  4. import cn.com.lzt.cost.activiti.payinneruser.entity.TBActivitiCostPayInnerUserEntity;
  5. import cn.com.lzt.cost.type.entity.TBCostTypeEntity;
  6. import cn.com.lzt.purchase.entity.POrdersEntity;
  7. import cn.com.lzt.purchasedetails.entity.OrderDetailsEntity;
  8. import cn.com.lzt.useractiviti.data.util.ActivitiPdfExport;
  9. import cn.com.lzt.useractiviti.data.util.ActivitiTools;
  10. import cn.com.lzt.useractiviti.data.util.tools.DefaultActivitiTools;
  11. import com.lowagie.text.DocumentException;
  12. import com.lowagie.text.pdf.PdfPCell;
  13. import com.lowagie.text.pdf.PdfPTable;
  14. import org.jeecgframework.core.util.DataUtils;
  15. import org.jeecgframework.core.util.MoneyUtils;
  16. import org.jeecgframework.core.util.oConvertUtils;
  17. import java.util.HashMap;
  18. import java.util.List;
  19. import java.util.Map;
  20. //费用报销签报
  21. public class POrdersActivitiTools extends DefaultActivitiTools {
  22. @Override
  23. protected void printBusinessInfo() {
  24. String entityId=getBusId();
  25. POrdersEntity entity = systemService.getEntity(POrdersEntity.class,entityId);
  26. if(!entity.getBpmStatus().equals("1")){
  27. pdfExport.requestTime(entity.getCreateDate());
  28. }
  29. pdfExport.table(1);
  30. PdfPTable infoTable = pdfExport.createTable(2);
  31. pdfExport.cell(infoTable,"申请人:"+ entity.getCreateName() ,false );
  32. pdfExport.cell(infoTable,"总金额:"+ entity.getTotalMoney() ,false );
  33. pdfExport.cell(infoTable);
  34. List<OrderDetailsEntity> detailEntityList = systemService.findByProperty(OrderDetailsEntity.class, "fkId", entityId);
  35. pdfExport.cell("采购货品");
  36. PdfPTable detailTableHeader = pdfExport.createTable(9);
  37. detailTableHeader.setWidthPercentage(100);
  38. pdfExport.cell(detailTableHeader, "", true);
  39. pdfExport.cell(detailTableHeader, "货品名称", true);
  40. pdfExport.cell(detailTableHeader, "规格型号", true);
  41. pdfExport.cell(detailTableHeader, "计量单位", true);
  42. pdfExport.cell(detailTableHeader, "数量", true);
  43. pdfExport.cell(detailTableHeader, "采购单价(元)", true);
  44. pdfExport.cell(detailTableHeader, "金额(元)", true);
  45. pdfExport.cell(detailTableHeader, "供应商", true);
  46. pdfExport.cell(detailTableHeader, "备注", true);
  47. pdfExport.cell(detailTableHeader);
  48. String sql = "select detail.*, supplier.id as supplierId, supplier.unit_name as supplierName from t_b_porder_details detail "
  49. + "left join t_b_goods_info goods on goods.id=detail.goods_id "
  50. + "left join t_b_related_units supplier on supplier.id = goods.default_provider where fk_id =? ";
  51. List<Map<String,Object>> result = systemService.findForJdbc(sql, entityId);
  52. HashMap<String, Map<String,Object>> hm_id2map = new HashMap<>();
  53. if(result != null && result.size()>0) {
  54. for(Map<String,Object> map : result) {
  55. hm_id2map.put((String)map.get("id"), map);
  56. }
  57. }
  58. int i=0;
  59. for(OrderDetailsEntity detailEntity:detailEntityList){
  60. i++;
  61. PdfPTable detailTable = pdfExport.createTable(9);
  62. pdfExport.cell(detailTable,"明细"+i,true);
  63. pdfExport.cell(detailTable,detailEntity.getPname(),false);//货品名称
  64. pdfExport.cell(detailTable, detailEntity.getSpecType(),false);//规格型号
  65. pdfExport.cell(detailTable, DictUtil.formatToTypeName(detailEntity.getMeasureUnit(),"metering_calcu_unit"),false);//计量单位
  66. pdfExport.cell(detailTable, detailEntity.getQuantity().toString(), false);//数量
  67. pdfExport.cell(detailTable,detailEntity.getPurchasePrice().toString(), false);//采购单价
  68. pdfExport.cell(detailTable, detailEntity.getMoney().toString(), false);//金额
  69. String supplierName ="";
  70. Map<String,Object> detailMap= hm_id2map.get(detailEntity.getId());
  71. if(detailMap!=null){
  72. supplierName=oConvertUtils.getString(detailMap.get("supplierName"));
  73. }
  74. pdfExport.cell(detailTable,supplierName , false);//供应商
  75. pdfExport.cell(detailTable, detailEntity.getRemark(), false);//备注
  76. pdfExport.cell(detailTable);
  77. }
  78. }
  79. }