箱变-启源-质检报告回传接口-增加审批收回逻辑、增行逻辑、回传标识、调整子表字段
This commit is contained in:
		
							parent
							
								
									832e648ee9
								
							
						
					
					
						commit
						91928b4a6f
					
				|  | @ -1,29 +1,23 @@ | |||
| package nc.api.qc.resource; | ||||
| 
 | ||||
| import nc.bs.dao.BaseDAO; | ||||
| import nc.bs.framework.common.InvocationInfoProxy; | ||||
| import nc.bs.framework.common.NCLocator; | ||||
| import nc.bs.trade.business.HYSuperDMO; | ||||
| import nc.impl.qc.c003.maintain.ReportMaintainImpl; | ||||
| import nc.itf.qc.c003.approve.IReportApprove; | ||||
| import nc.itf.qc.c003.maintain.IReportMaintain; | ||||
| import nc.jdbc.framework.processor.ColumnProcessor; | ||||
| import nc.vo.pub.BusinessException; | ||||
| import nc.vo.pub.VOStatus; | ||||
| import nc.vo.pub.lang.UFBoolean; | ||||
| import nc.vo.pub.lang.UFDouble; | ||||
| import nc.vo.pubapp.pattern.model.transfer.bill.ClientBillCombinServer; | ||||
| import nc.vo.qc.c003.entity.ReportHeaderVO; | ||||
| import nc.vo.qc.c003.entity.ReportItemVO; | ||||
| import nc.vo.qc.c003.entity.ReportVO; | ||||
| import nc.vo.qc.c003.util.ReportVOInfoUtils; | ||||
| import nc.vo.scmpub.res.billtype.QCBillType; | ||||
| import nc.vo.scmpub.util.ArrayUtil; | ||||
| import nc.vo.scmpub.util.CollectionUtils; | ||||
| import nc.vo.util.CloneUtil; | ||||
| import nccloud.api.rest.utils.NCCRestUtils; | ||||
| import nccloud.api.rest.utils.ResultMessageUtil; | ||||
| import nccloud.base.exception.ExceptionUtils; | ||||
| import nccloud.dto.scmpub.script.entity.SCMScriptResultDTO; | ||||
| import nccloud.framework.service.ServiceLocator; | ||||
| import nccloud.pubitf.arap.arappub.IArapBillPubUtilService; | ||||
| import nccloud.pubitf.riart.pflow.CloudPFlowContext; | ||||
| import nccloud.pubitf.riart.pflow.ICloudScriptPFlowService; | ||||
| import nccloud.pubitf.scmpub.commit.service.IBatchRunScriptService; | ||||
| import nccloud.pubitf.scmpub.pub.service.ISCMPubQueryService; | ||||
| import org.json.JSONString; | ||||
|  | @ -32,10 +26,7 @@ import javax.ws.rs.Consumes; | |||
| import javax.ws.rs.POST; | ||||
| import javax.ws.rs.Path; | ||||
| import javax.ws.rs.Produces; | ||||
| import java.util.ArrayList; | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.*; | ||||
| 
 | ||||
| /** | ||||
|  * QMS将检验结果回传至ERP质检报告中 | ||||
|  | @ -43,14 +34,7 @@ import java.util.Map; | |||
| @Path("qc/qcconclusion") | ||||
| public class QcconclusionRestResource extends QcBaseRestResource { | ||||
| 
 | ||||
|     HYSuperDMO dmo = null; | ||||
| 
 | ||||
|     public HYSuperDMO getSuperDMO() { | ||||
|         if (dmo == null) { | ||||
|             dmo = new HYSuperDMO(); | ||||
|         } | ||||
|         return dmo; | ||||
|     } | ||||
|     private static BaseDAO dao = new BaseDAO(); | ||||
| 
 | ||||
|     /** | ||||
|      * QMS将检验结果回传至ERP质检报告中 | ||||
|  | @ -68,197 +52,241 @@ public class QcconclusionRestResource extends QcBaseRestResource { | |||
|         NCCRestUtils.initInvocationInfo(); | ||||
|         String json = str.toJSONString(); | ||||
|         Map<String, Object> billMap = (Map) fromJson(json, Map.class); | ||||
| //        List<ReportVO> list = (List<ReportVO>) billMap.get("list"); | ||||
|         //获取全部质检报告 | ||||
|         String flag = (String) billMap.get("flag"); | ||||
|         if (!"Y".equals(flag) && !"N".equals(flag)) { | ||||
|             return ResultMessageUtil.exceptionToJSON(new BusinessException("flag字段未正确传值!")); | ||||
|         } | ||||
|         // 获取全部质检报告 | ||||
|         List<Map<String, Object>> itemMaps = (List) billMap.get("items"); | ||||
|         List<String> list=new ArrayList<String>(); | ||||
|         List<String> list = new ArrayList<>(); | ||||
|         for (Map<String, Object> itemMap : itemMaps) { | ||||
|             list.add((String) itemMap.get("id")); | ||||
|         } | ||||
|         ReportVO[] vos = (ReportVO[])((ISCMPubQueryService) NCLocator.getInstance().lookup(ISCMPubQueryService.class)).billquery(ReportVO.class, list.toArray(new String[list.size()])); | ||||
|         // 1. 创建新数组(长度与原数组一致) | ||||
|         ReportVO[] updatevos = new ReportVO[vos.length]; | ||||
| 
 | ||||
| // 2. 遍历原数组,对每个元素进行深度克隆 | ||||
|         for (int i = 0; i < vos.length; i++) { | ||||
|             if (vos[i] != null) { | ||||
|                 // 假设ReportVO重写了clone()方法,实现深度克隆 | ||||
|                 updatevos[i] = (ReportVO) vos[i].clone(); | ||||
|             } | ||||
|         String[] idArr = list.toArray(new String[0]); | ||||
|         ReportVO[] vos = NCLocator.getInstance().lookup(ISCMPubQueryService.class).billquery(ReportVO.class, idArr); | ||||
|         if (vos == null || vos.length == 0) { | ||||
|             return ResultMessageUtil.exceptionToJSON(new BusinessException("未查询到质检报告")); | ||||
|         } | ||||
|         for (ReportVO vo : vos) { | ||||
|             // 先判断vo和其HVO是否为null(避免NPE) | ||||
|             if (vo == null || vo.getHVO() == null) { | ||||
|                 continue; | ||||
|         ReportVO[] resultVos = null; | ||||
|         if ("Y".equals(flag)) { | ||||
|             // 1. 创建新数组(长度与原数组一致) | ||||
|             ReportVO[] updatevos = new ReportVO[vos.length]; | ||||
| 
 | ||||
|             // 2. 遍历原数组,对每个元素进行深度克隆 | ||||
|             for (int i = 0; i < vos.length; i++) { | ||||
|                 if (vos[i] != null) { | ||||
|                     // 假设ReportVO重写了clone()方法,实现深度克隆 | ||||
|                     updatevos[i] = (ReportVO) vos[i].clone(); | ||||
|                 } | ||||
|             } | ||||
|             Object pkReportbill = vo.getHVO().getPk_reportbill(); | ||||
|             // 校验HVO的pk_reportbill是否为必填(不为null) | ||||
|             if (pkReportbill == null) { | ||||
|                 continue; | ||||
|             } | ||||
| 
 | ||||
|             for (Map<String, Object> itemMap : itemMaps) { | ||||
|                 // 校验itemMap的id是否为必填(存在且不为null) | ||||
|                 if (itemMap == null || !itemMap.containsKey("id") || itemMap.get("id") == null) { | ||||
|             for (ReportVO vo : vos) { | ||||
|                 // 先判断vo和其HVO是否为null(避免NPE) | ||||
|                 ReportHeaderVO hvo = vo.getHVO(); | ||||
|                 if (vo == null || hvo == null) { | ||||
|                     continue; | ||||
|                 } | ||||
|                 // 比较id是否匹配(双方都已校验非null) | ||||
|                 if (!itemMap.get("id").equals(pkReportbill)) { | ||||
|                 String pkReportbill = (String) hvo.getPk_reportbill(); | ||||
|                 // 校验HVO的pk_reportbill是否为必填(不为null) | ||||
|                 if (pkReportbill == null) { | ||||
|                     continue; | ||||
|                 } | ||||
| 
 | ||||
|                 // 匹配成功,更新状态 | ||||
|                 vo.getHVO().setStatus(VOStatus.UPDATED); | ||||
| 
 | ||||
|                 // 处理数量字段(存在且不为null才赋值) | ||||
|                 // 检验主数量 | ||||
|                 if (itemMap.containsKey("nchecknum") && itemMap.get("nchecknum") instanceof Double) { | ||||
|                     vo.getHVO().setNchecknum(new UFDouble((Double) itemMap.get("nchecknum"))); | ||||
|                 } | ||||
|                 // 检验数量 | ||||
|                 if (itemMap.containsKey("ncheckastnum") && itemMap.get("ncheckastnum") instanceof Double) { | ||||
|                     vo.getHVO().setNcheckastnum(new UFDouble((Double) itemMap.get("ncheckastnum"))); | ||||
|                 } | ||||
|                 // 合格主数量 | ||||
|                 if (itemMap.containsKey("neliginum") && itemMap.get("neliginum") instanceof Double) { | ||||
|                     vo.getHVO().setNeliginum(new UFDouble((Double) itemMap.get("neliginum"))); | ||||
|                 } | ||||
|                 // 合格数量 | ||||
|                 if (itemMap.containsKey("neligiastnum") && itemMap.get("neligiastnum") instanceof Double) { | ||||
|                     vo.getHVO().setNeligiastnum(new UFDouble((Double) itemMap.get("neligiastnum"))); | ||||
|                 } | ||||
|                 // 不合格主数量 | ||||
|                 if (itemMap.containsKey("nuneliginum") && itemMap.get("nuneliginum") instanceof Double) { | ||||
|                     vo.getHVO().setNuneliginum(new UFDouble((Double) itemMap.get("nuneliginum"))); | ||||
|                 } | ||||
|                 // 不合格数量 | ||||
|                 if (itemMap.containsKey("nuneligiastnum") && itemMap.get("nuneligiastnum") instanceof Double) { | ||||
|                     vo.getHVO().setNuneligiastnum(new UFDouble((Double) itemMap.get("nuneligiastnum"))); | ||||
|                 } | ||||
| 
 | ||||
|                 this.appendPseudoColumn(vo); | ||||
| 
 | ||||
|                 // 处理子列表(先判断是否为有效列表) | ||||
|                 Object childrenObj = itemMap.get("children"); | ||||
|                 if (!(childrenObj instanceof List)) { | ||||
|                     continue; | ||||
|                 } | ||||
|                 List<Map<String, Object>> mapList = (List<Map<String, Object>>) childrenObj; | ||||
|                 if (mapList.isEmpty()) { | ||||
|                     continue; | ||||
|                 } | ||||
| 
 | ||||
|                 // 处理BVO数组(先判断数组是否为null) | ||||
|                 ReportItemVO[] bvos = vo.getBVO(); | ||||
|                 if (bvos == null) { | ||||
|                     continue; | ||||
|                 } | ||||
| 
 | ||||
|                 for (int i = 0; i < bvos.length; i++) { | ||||
|                     ReportItemVO bvo = bvos[i]; | ||||
|                     // 跳过null的BVO | ||||
|                     if (bvo == null) { | ||||
|                 for (Map<String, Object> itemMap : itemMaps) { | ||||
|                     // 校验itemMap的id是否为必填(存在且不为null) | ||||
|                     if (itemMap == null || !itemMap.containsKey("id") || itemMap.get("id") == null) { | ||||
|                         continue; | ||||
|                     } | ||||
|                     // 校验BVO的reportbill_b是否为必填(不为null) | ||||
|                     String bvoCrowno = bvo.getPk_reportbill_b(); | ||||
|                     if (bvoCrowno == null) { | ||||
|                     // 比较id是否匹配(双方都已校验非null) | ||||
|                     if (!itemMap.get("id").equals(pkReportbill)) { | ||||
|                         continue; | ||||
|                     } | ||||
| 
 | ||||
|                     for (Map<String, Object> childMap : mapList) { | ||||
|                         // 校验childMap的reportbill_b是否为必填(存在且不为null) | ||||
|                         if (childMap == null || !childMap.containsKey("reportbill_b") || childMap.get("reportbill_b") == null) { | ||||
|                     // 匹配成功,更新状态 | ||||
|                     hvo.setStatus(VOStatus.UPDATED); | ||||
|                     hvo.setVdef10(flag);// 回传标识 | ||||
| 
 | ||||
|                     // 处理数量字段(存在且不为null才赋值) | ||||
|                     // 检验主数量 | ||||
|                     if (itemMap.containsKey("nchecknum") && itemMap.get("nchecknum") instanceof Double) { | ||||
|                         hvo.setNchecknum(new UFDouble((Double) itemMap.get("nchecknum"))); | ||||
|                     } | ||||
|                     // 检验数量 | ||||
|                     if (itemMap.containsKey("ncheckastnum") && itemMap.get("ncheckastnum") instanceof Double) { | ||||
|                         hvo.setNcheckastnum(new UFDouble((Double) itemMap.get("ncheckastnum"))); | ||||
|                     } | ||||
|                     // 合格主数量 | ||||
|                     if (itemMap.containsKey("neliginum") && itemMap.get("neliginum") instanceof Double) { | ||||
|                         hvo.setNeliginum(new UFDouble((Double) itemMap.get("neliginum"))); | ||||
|                     } | ||||
|                     // 合格数量 | ||||
|                     if (itemMap.containsKey("neligiastnum") && itemMap.get("neligiastnum") instanceof Double) { | ||||
|                         hvo.setNeligiastnum(new UFDouble((Double) itemMap.get("neligiastnum"))); | ||||
|                     } | ||||
|                     // 不合格主数量 | ||||
|                     if (itemMap.containsKey("nuneliginum") && itemMap.get("nuneliginum") instanceof Double) { | ||||
|                         hvo.setNuneliginum(new UFDouble((Double) itemMap.get("nuneliginum"))); | ||||
|                     } | ||||
|                     // 不合格数量 | ||||
|                     if (itemMap.containsKey("nuneligiastnum") && itemMap.get("nuneligiastnum") instanceof Double) { | ||||
|                         hvo.setNuneligiastnum(new UFDouble((Double) itemMap.get("nuneligiastnum"))); | ||||
|                     } | ||||
| 
 | ||||
|                     this.appendPseudoColumn(vo); | ||||
| 
 | ||||
|                     // 处理子列表(先判断是否为有效列表) | ||||
|                     Object childrenObj = itemMap.get("children"); | ||||
|                     if (!(childrenObj instanceof List)) { | ||||
|                         continue; | ||||
|                     } | ||||
|                     List<Map<String, Object>> mapList = (List<Map<String, Object>>) childrenObj; | ||||
|                     if (mapList.isEmpty()) { | ||||
|                         continue; | ||||
|                     } | ||||
| 
 | ||||
|                     // 处理BVO数组(先判断数组是否为null) | ||||
|                     ReportItemVO[] bvos = vo.getBVO(); | ||||
|                     if (bvos == null) { | ||||
|                         continue; | ||||
|                     } | ||||
|                     List<Map<String, Object>> newList = new ArrayList<>(); | ||||
|                     for (int i = 0; i < bvos.length; i++) { | ||||
|                         ReportItemVO bvo = bvos[i]; | ||||
|                         // 跳过null的BVO | ||||
|                         if (bvo == null) { | ||||
|                             continue; | ||||
|                         } | ||||
|                         // 比较reportbill_b是否匹配 | ||||
|                         if (!bvoCrowno.equals(childMap.get("reportbill_b"))) { | ||||
|                         // 校验BVO的reportbill_b是否为必填(不为null) | ||||
|                         String bvoCrowno = bvo.getPk_reportbill_b(); | ||||
|                         if (bvoCrowno == null) { | ||||
|                             continue; | ||||
|                         } | ||||
| 
 | ||||
|                         // 匹配成功,更新子项字段(存在且不为null才赋值) | ||||
|                         bvo.setStatus(VOStatus.UPDATED); | ||||
|                         // 子项数量 | ||||
|                         if (childMap.containsKey("nnum") && childMap.get("nnum") instanceof Double) { | ||||
|                             bvo.setNnum(new UFDouble((Double) childMap.get("nnum"))); | ||||
|                         } | ||||
|                         // 处理判断状态 | ||||
|                         if (childMap.containsKey("fprocessjudge") && childMap.get("fprocessjudge") instanceof Double) { | ||||
|                             bvo.setFprocessjudge(((Double) childMap.get("fprocessjudge")).intValue()); | ||||
|                         for (Map<String, Object> childMap : mapList) { | ||||
|                             // 校验childMap的reportbill_b是否为必填(存在且不为null) | ||||
|                             if (childMap == null || !childMap.containsKey("reportbill_b") || childMap.get("reportbill_b") == null || "".equals(childMap.get("reportbill_b"))) { | ||||
|                                 // 走新增逻辑 | ||||
|                                 newList.add(childMap); | ||||
|                             } else { | ||||
|                                 // 走修改逻辑 | ||||
|                                 // 比较reportbill_b是否匹配 | ||||
|                                 if (!bvoCrowno.equals(childMap.get("reportbill_b"))) { | ||||
|                                     continue; | ||||
|                                 } | ||||
| 
 | ||||
|                                 // 匹配成功,更新子项字段(存在且不为null才赋值) | ||||
|                                 bvo.setStatus(VOStatus.UPDATED); | ||||
|                                 // 子项数量 | ||||
|                                 if (childMap.containsKey("nnum") && childMap.get("nnum") instanceof Double) { | ||||
|                                     UFDouble nnum = new UFDouble((Double) childMap.get("nnum")); | ||||
|                                     bvo.setNnum(nnum);// 主数量 | ||||
|                                     bvo.setNastnum(nnum);// 数量 | ||||
|                                 } | ||||
|                                 // 处理判断状态 | ||||
|                                 if (childMap.containsKey("fprocessjudge") && childMap.get("fprocessjudge") instanceof Double) { | ||||
|                                     bvo.setFprocessjudge(((Double) childMap.get("fprocessjudge")).intValue()); | ||||
|                                 } | ||||
|                                 // 质量等级 | ||||
|                                 if (childMap.containsKey("pk_qualitylv_b") && childMap.get("pk_qualitylv_b") instanceof String pkQualitylvB) { | ||||
|                                     String zldjSql = "select pk_qualitylv_b from scm_qualitylevel_b where dr = 0 and cqualitylvcode = '" + pkQualitylvB + "'"; | ||||
|                                     Object zldj = dao.executeQuery(zldjSql, new ColumnProcessor()); | ||||
|                                     if (zldj != null) { | ||||
|                                         bvo.setPk_qualitylv_b(zldj.toString()); | ||||
|                                     } | ||||
|                                 } | ||||
|                                 // 质量等级 | ||||
|                                 if (childMap.containsKey("beligible") && childMap.get("beligible") instanceof String beligible) { | ||||
|                                     UFBoolean beligible1 = new UFBoolean(beligible); | ||||
|                                     bvo.setBeligible(beligible1); | ||||
|                                 } | ||||
|                             } | ||||
|                         } | ||||
|                     } | ||||
|                     List<ReportItemVO> itemVOList = new ArrayList<>(Arrays.asList(bvos)); | ||||
|                     if (!newList.isEmpty()) { | ||||
|                         ReportItemVO bvo1 = bvos[0]; | ||||
|                         for (Map<String, Object> childMap : newList) { | ||||
|                             ReportItemVO bvo = (ReportItemVO) CloneUtil.deepClone(bvo1); | ||||
|                             bvo.setPk_reportbill_b(null); | ||||
|                             bvo.setStatus(VOStatus.NEW); | ||||
|                             bvo.setPk_reportbill(pkReportbill); | ||||
|                             bvo.setCrowno("20"); | ||||
|                             // 子项数量 | ||||
|                             if (childMap.containsKey("nnum") && childMap.get("nnum") instanceof Double) { | ||||
|                                 UFDouble nnum = new UFDouble((Double) childMap.get("nnum")); | ||||
|                                 bvo.setNnum(nnum);// 主数量 | ||||
|                                 bvo.setNastnum(nnum);// 数量 | ||||
|                             } | ||||
|                             // 处理判断状态 | ||||
|                             if (childMap.containsKey("fprocessjudge") && childMap.get("fprocessjudge") instanceof Double) { | ||||
|                                 bvo.setFprocessjudge(((Double) childMap.get("fprocessjudge")).intValue()); | ||||
|                             } | ||||
|                             // 质量等级 | ||||
|                             if (childMap.containsKey("pk_qualitylv_b") && childMap.get("pk_qualitylv_b") instanceof String pkQualitylvB) { | ||||
|                                 String zldjSql = "select pk_qualitylv_b from scm_qualitylevel_b where dr = 0 and cqualitylvcode = '" + pkQualitylvB + "'"; | ||||
|                                 Object zldj = dao.executeQuery(zldjSql, new ColumnProcessor()); | ||||
|                                 if (zldj != null) { | ||||
|                                     bvo.setPk_qualitylv_b(zldj.toString()); | ||||
|                                 } | ||||
|                             } | ||||
|                             // 质量等级 | ||||
|                             if (childMap.containsKey("beligible") && childMap.get("beligible") instanceof String beligible) { | ||||
|                                 UFBoolean beligible1 = new UFBoolean(beligible); | ||||
|                                 bvo.setBeligible(beligible1); | ||||
|                             } | ||||
|                             itemVOList.add(bvo); | ||||
|                         } | ||||
| 
 | ||||
|                     } | ||||
|                     vo.setBVO(itemVOList.toArray(new ReportItemVO[0])); | ||||
|                 } | ||||
|             } | ||||
|             IReportMaintain reportMaintain = NCLocator.getInstance().lookup(IReportMaintain.class); | ||||
|             try { | ||||
|                 resultVos = reportMaintain.saveBase(vos, new Object(), updatevos); | ||||
|             } catch (BusinessException e) { | ||||
|                 return ResultMessageUtil.exceptionToJSON(e); | ||||
|             } | ||||
|         } else { | ||||
|             for (ReportVO vo : vos) { | ||||
|                 ReportHeaderVO hvo = vo.getHVO(); | ||||
|                 hvo.setVdef10(flag); | ||||
|                 // 回传标识 | ||||
|                 String updateSql = "update scm_report_b set vdef10 = '" + flag + "' where pk_reportbill = '" + hvo.getPk_reportbill() + "'"; | ||||
|                 int num = dao.executeUpdate(updateSql); | ||||
|             } | ||||
|             resultVos = vos; | ||||
|         } | ||||
| //        this.doSaveAndCombine(vos); | ||||
|         IReportMaintain reportMaintain=((IReportMaintain) NCLocator.getInstance().lookup(IReportMaintain.class)); | ||||
|         ReportVO[] resultVos=  reportMaintain.saveBase(vos,new Object(),updatevos); | ||||
| //        IReportApprove iReportApprove=((IReportApprove) NCLocator.getInstance().lookup(IReportApprove.class)); | ||||
| //        iReportApprove.approveReport(resultVos,); | ||||
| 
 | ||||
|         CloudPFlowContext context = this.generatePFContext(resultVos); | ||||
|         IBatchRunScriptService iReportApprove=((IBatchRunScriptService) NCLocator.getInstance().lookup(IBatchRunScriptService.class)); | ||||
|         // 审批 | ||||
|         String actionName = "SAVE"; | ||||
|         if ("N".equals(flag)) { | ||||
|             actionName = "UNSAVE"; | ||||
|         } | ||||
|         CloudPFlowContext context = this.generatePFContext(resultVos, actionName); | ||||
|         IBatchRunScriptService iReportApprove = NCLocator.getInstance().lookup(IBatchRunScriptService.class); | ||||
| 
 | ||||
|         SCMScriptResultDTO obj = iReportApprove.runBacth(context, ReportVO.class); | ||||
| 
 | ||||
|         //质检报告更新 | ||||
|         Map<String, Object> returnMap = new HashMap<String, Object>(); | ||||
|         // 质检报告更新 | ||||
|         Map<String, Object> returnMap = new HashMap<>(); | ||||
|         returnMap.put("data", resultVos); | ||||
|         returnMap.put("success", true); | ||||
|         return ResultMessageUtil.toJSON(returnMap); | ||||
|     } | ||||
| 
 | ||||
|     private void doSaveAndCombine(ReportVO[] billVos) { | ||||
|         CloudPFlowContext context = new CloudPFlowContext(); | ||||
|         context.setBillType(QCBillType.ReportBill.getCode()); | ||||
|         context.setTrantype(billVos[0].getHVO().getVtrantypecode()); | ||||
|         context.setBillVos(billVos); | ||||
|         context.setActionName("SAVEBASE"); | ||||
|         ICloudScriptPFlowService service = (ICloudScriptPFlowService) NCLocator.getInstance().lookup(ICloudScriptPFlowService.class); | ||||
|         ReportVO[] retVOs = null; | ||||
|         try { | ||||
|             Object ret = service.exeScriptPFlow(context); | ||||
|             if (ret instanceof ReportVO[]) { | ||||
|                 retVOs = (ReportVO[]) ret; | ||||
|             } else { | ||||
|                 retVOs = (ReportVO[]) ((Object[]) ret)[0]; | ||||
|             } | ||||
|         } catch (Exception e) { | ||||
|             ExceptionUtils.wrapException(e); | ||||
|         } | ||||
|         if (!ArrayUtil.isEmpty(retVOs)) { | ||||
|             ClientBillCombinServer<ReportVO> util = new ClientBillCombinServer(); | ||||
|             this.processDelBody(billVos); | ||||
|             util.combine(billVos, retVOs); | ||||
|             retVOs = ReportVOInfoUtils.synchBatchCodeData(billVos); | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
|     private void processDelBody(ReportVO[] vos) { | ||||
|         ReportItemVO[] bodys = vos[0].getBVO(); | ||||
|         List<ReportItemVO> realbody = new ArrayList(); | ||||
| 
 | ||||
|         for(ReportItemVO body : bodys) { | ||||
|             if (body.getStatus() != 3) { | ||||
|                 realbody.add(body); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         vos[0].setBVO((ReportItemVO[]) CollectionUtils.listToArray(realbody)); | ||||
|     } | ||||
|     private void appendPseudoColumn(ReportVO vo) { | ||||
|         ReportItemVO[] bodyvos = vo.getBVO(); | ||||
|         if (bodyvos != null && bodyvos.length > 0) { | ||||
|             for(int i = 0; i < bodyvos.length; ++i) { | ||||
|             for (int i = 0; i < bodyvos.length; ++i) { | ||||
|                 bodyvos[i].setAttributeValue("pseudocolumn", i); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
|     private CloudPFlowContext generatePFContext(ReportVO[] reports) { | ||||
| 
 | ||||
|     private CloudPFlowContext generatePFContext(ReportVO[] reports, String actionName) { | ||||
|         CloudPFlowContext context = new CloudPFlowContext(); | ||||
|         context.setBillType(QCBillType.ReportBill.getCode()); | ||||
|         context.setActionName("N_C003_APPROVE"); | ||||
|         context.setActionName(actionName); | ||||
|         context.setBillVos(reports); | ||||
|         return context; | ||||
|     } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue