package com.glxp.mipsdl.controller; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.glxp.mipsdl.client.ClientProcessor; import com.glxp.mipsdl.dao.basic.BasicBussinessTypeDao; import com.glxp.mipsdl.entity.basic.BasicBussinessTypeEntity; import com.glxp.mipsdl.entity.njxyy.BasicCorpEntity; import com.glxp.mipsdl.req.base.UdiwmsQueryUdiInvProductsRequest; import com.glxp.mipsdl.res.BaseResponse; import com.glxp.mipsdl.thirddao.njxyy.TestDataMapper; import com.glxp.mipsdl.util.ResultVOUtils; import com.jacob.activeX.ActiveXComponent; import com.jacob.com.ComThread; import com.jacob.com.Dispatch; import com.jacob.com.Variant; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.List; @Slf4j @RestController public class TestController { @Resource TestDataMapper testDataMapper; @Resource BasicBussinessTypeDao bussinessTypeDao; @GetMapping("/test/nj") public BaseResponse filterInv() { for (int i = 0; i < 100000; i++) { List data = testDataMapper.selectList(new QueryWrapper().last("limit 10")); log.info(i+""); } return ResultVOUtils.success(); } @GetMapping("/test/ct") public BaseResponse filterCt() { for (int i = 0; i < 100000; i++) { List data = bussinessTypeDao.selectList(new QueryWrapper()); log.info(i+""); } return ResultVOUtils.success(); } @GetMapping("/test/yh") public BaseResponse yh() { Variant result = this.yhHttp(); return ResultVOUtils.success(result.toString()) ; } public Variant yhHttp() { ComThread.InitSTA(false); ActiveXComponent component = new ActiveXComponent("YinHai.CHS.InterfaceSCS"); // ActiveXComponent component = new ActiveXComponent("Excel.Application"); Variant result = null; try { // 获取 COM 组件的 Dispatch 对象 Dispatch dispatch = (Dispatch) component.getObject(); String rest = null; String input = "{}"; // 直接调用方法 result = Dispatch.invoke(dispatch, "yh_CHS_init", Dispatch.Method, new Object[]{"1101", input, rest}, new int[1]); } finally { // 关闭 COM 组件,释放资源 component.safeRelease(); } return result; } }