| | |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.annotation.Java110Transactional; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.AbstractServiceCmdListener; |
| | | import com.java110.core.event.cmd.Cmd; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | | import com.java110.intf.report.IReportCustomComponentV1InnerServiceSMO; |
| | | 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; |
| | | import com.java110.core.log.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | /** |
| | |
| | | * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行 |
| | | */ |
| | | @Java110Cmd(serviceCode = "reportCustomComponent.saveReportCustomComponent") |
| | | public class SaveReportCustomComponentCmd extends AbstractServiceCmdListener { |
| | | public class SaveReportCustomComponentCmd extends Cmd { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(SaveReportCustomComponentCmd.class); |
| | | |
| | |
| | | @Override |
| | | public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) { |
| | | Assert.hasKeyAndValue(reqJson, "name", "请求报文中未包含name"); |
| | | Assert.hasKeyAndValue(reqJson, "componentGroup", "请求报文中未包含componentGroup"); |
| | | Assert.hasKeyAndValue(reqJson, "componentType", "请求报文中未包含componentType"); |
| | | Assert.hasKeyAndValue(reqJson, "queryModel", "请求报文中未包含queryModel"); |
| | | |
| | |
| | | |
| | | 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) { |