service-report/src/main/java/com/java110/report/cmd/reportCustomComponent/ListReportCustomComponentCmd.java
@@ -23,7 +23,9 @@ import com.java110.dto.reportCustomComponent.ReportCustomComponentDto; import com.java110.intf.report.IReportCustomComponentV1InnerServiceSMO; import com.java110.utils.exception.CmdException; import com.java110.utils.util.Base64Convert; import com.java110.utils.util.BeanConvertUtil; import com.java110.utils.util.StringUtil; import com.java110.vo.ResultVo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -68,6 +70,7 @@ if (count > 0) { reportCustomComponentDtos = reportCustomComponentV1InnerServiceSMOImpl.queryReportCustomComponents(reportCustomComponentDto); desCode(reportCustomComponentDtos); } else { reportCustomComponentDtos = new ArrayList<>(); } @@ -78,4 +81,22 @@ cmdDataFlowContext.setResponseEntity(responseEntity); } private void desCode(List<ReportCustomComponentDto> reportCustomComponentDtos) { if (reportCustomComponentDtos == null || reportCustomComponentDtos.size() < 1) { return; } for(ReportCustomComponentDto reportCustomComponentDto: reportCustomComponentDtos) { try { if (!StringUtil.isEmpty(reportCustomComponentDto.getComponentSql())) { reportCustomComponentDto.setComponentSql(new String(Base64Convert.base64ToByte(reportCustomComponentDto.getComponentSql()),"UTF-8")); } if (!StringUtil.isEmpty(reportCustomComponentDto.getJavaScript())) { reportCustomComponentDto.setJavaScript(new String(Base64Convert.base64ToByte(reportCustomComponentDto.getJavaScript()),"UTF-8")); } } catch (Exception e) { logger.error("编码失败", e); } } } } service-report/src/main/java/com/java110/report/cmd/reportCustomComponent/SaveReportCustomComponentCmd.java
@@ -26,7 +26,9 @@ import com.java110.po.reportCustomComponent.ReportCustomComponentPo; import com.java110.utils.exception.CmdException; import com.java110.utils.util.Assert; import com.java110.utils.util.Base64Convert; import com.java110.utils.util.BeanConvertUtil; import com.java110.utils.util.StringUtil; import com.java110.vo.ResultVo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -67,6 +69,17 @@ ReportCustomComponentPo reportCustomComponentPo = BeanConvertUtil.covertBean(reqJson, ReportCustomComponentPo.class); reportCustomComponentPo.setComponentId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID)); reportCustomComponentPo.setComponentGroup("C"); try { if (!StringUtil.isEmpty(reportCustomComponentPo.getComponentSql())) { reportCustomComponentPo.setComponentSql(Base64Convert.byteToBase64(reportCustomComponentPo.getComponentSql().getBytes("UTF-8"))); } if (!StringUtil.isEmpty(reportCustomComponentPo.getJavaScript())) { reportCustomComponentPo.setJavaScript(Base64Convert.byteToBase64(reportCustomComponentPo.getJavaScript().getBytes("UTF-8"))); } } catch (Exception e) { logger.error("编码失败", e); } int flag = reportCustomComponentV1InnerServiceSMOImpl.saveReportCustomComponent(reportCustomComponentPo); if (flag < 1) { service-report/src/main/java/com/java110/report/cmd/reportCustomComponent/UpdateReportCustomComponentCmd.java
@@ -25,7 +25,9 @@ import com.java110.po.reportCustomComponent.ReportCustomComponentPo; import com.java110.utils.exception.CmdException; import com.java110.utils.util.Assert; import com.java110.utils.util.Base64Convert; import com.java110.utils.util.BeanConvertUtil; import com.java110.utils.util.StringUtil; import com.java110.vo.ResultVo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -63,6 +65,16 @@ public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException { ReportCustomComponentPo reportCustomComponentPo = BeanConvertUtil.covertBean(reqJson, ReportCustomComponentPo.class); try { if (!StringUtil.isEmpty(reportCustomComponentPo.getComponentSql())) { reportCustomComponentPo.setComponentSql(Base64Convert.byteToBase64(reportCustomComponentPo.getComponentSql().getBytes("UTF-8"))); } if (!StringUtil.isEmpty(reportCustomComponentPo.getJavaScript())) { reportCustomComponentPo.setJavaScript(Base64Convert.byteToBase64(reportCustomComponentPo.getJavaScript().getBytes("UTF-8"))); } } catch (Exception e) { logger.error("编码失败", e); } int flag = reportCustomComponentV1InnerServiceSMOImpl.updateReportCustomComponent(reportCustomComponentPo); if (flag < 1) {