---修复callservice无法正常调用bug
This commit is contained in:
@ -64,6 +64,19 @@
|
|||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
<!-- <exclusions>
|
||||||
|
排除JUnit 4引擎(若存在)
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.junit.vintage</groupId>
|
||||||
|
<artifactId>junit-vintage-engine</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions> -->
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
<finalName>app</finalName>
|
<finalName>app</finalName>
|
||||||
|
|||||||
@ -0,0 +1,31 @@
|
|||||||
|
package com.xjrsoft.config;
|
||||||
|
|
||||||
|
import org.springframework.beans.BeansException;
|
||||||
|
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||||
|
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||||
|
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
|
||||||
|
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class AppConfig {
|
||||||
|
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public static BeanDefinitionRegistryPostProcessor allowCircularReferences() {
|
||||||
|
return new BeanDefinitionRegistryPostProcessor() {
|
||||||
|
@Override
|
||||||
|
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) {
|
||||||
|
// 不直接强转 registry,而是在 postProcessBeanFactory 中操作 BeanFactory
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
|
||||||
|
// 此处的 beanFactory 一定是 ConfigurableListableBeanFactory 实例
|
||||||
|
((DefaultListableBeanFactory)beanFactory).setAllowCircularReferences(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
package com.xjrsoft.module.test.controller;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.xjrsoft.common.model.result.R;
|
||||||
|
import com.xjrsoft.module.common.db.service.CommonCallService;
|
||||||
|
import com.xjrsoft.module.dev.entity.Testfrom3;
|
||||||
|
import com.xjrsoft.module.dev.vo.Testfrom3Vo;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/test/call")
|
||||||
|
public class CallTest {
|
||||||
|
|
||||||
|
|
||||||
|
// 注入待测试的服务
|
||||||
|
@Autowired
|
||||||
|
private CommonCallService callService;
|
||||||
|
|
||||||
|
@GetMapping(value = "/fSave")
|
||||||
|
@ApiOperation(value="根据id查询Testfrom3信息")
|
||||||
|
public R info(){
|
||||||
|
String out = callService.saveAfter("lng_b_price_term", 12);
|
||||||
|
System.out.println(out);
|
||||||
|
return R.ok(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
spring:
|
||||||
|
cloud:
|
||||||
|
nacos: #nacos监控
|
||||||
|
config:
|
||||||
|
server-addr: 47.94.165.164:8848 # nacos 配置中心地址
|
||||||
|
namespace: ITC-MS
|
||||||
|
group: DNE
|
||||||
|
username: nacos
|
||||||
|
password: Lng@123
|
||||||
|
extension-configs:
|
||||||
|
- data-id: global-dev.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
- data-id: discovery-dev.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
- data-id: datasource-dev.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
- data-id: seata-dev.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
- data-id: redis-dev.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
- data-id: magic-api.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
- data-id: sa-token.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
- data-id: camunda.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
- data-id: sentinel-dev.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
@ -7,7 +7,7 @@ spring:
|
|||||||
main:
|
main:
|
||||||
allow-bean-definition-overriding: true
|
allow-bean-definition-overriding: true
|
||||||
profiles:
|
profiles:
|
||||||
active: dev
|
active: remote
|
||||||
cloud:
|
cloud:
|
||||||
nacos: #nacos监控
|
nacos: #nacos监控
|
||||||
config:
|
config:
|
||||||
|
|||||||
@ -0,0 +1,25 @@
|
|||||||
|
package com.xjrsoft;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
import com.xjrsoft.module.common.db.service.CommonCallService;
|
||||||
|
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest(classes = ITCDemoApplication.class)
|
||||||
|
public class CallTest {
|
||||||
|
|
||||||
|
// 注入待测试的服务
|
||||||
|
@Autowired
|
||||||
|
private CommonCallService callService;
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCallSave() {
|
||||||
|
String out = callService.saveAfter("Ing_b_price_term", 12);
|
||||||
|
System.out.println(out);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -7,7 +7,7 @@ spring:
|
|||||||
main:
|
main:
|
||||||
allow-bean-definition-overriding: true
|
allow-bean-definition-overriding: true
|
||||||
profiles:
|
profiles:
|
||||||
active: dev
|
active: remote
|
||||||
cloud:
|
cloud:
|
||||||
nacos: #nacos监控
|
nacos: #nacos监控
|
||||||
config:
|
config:
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import com.google.api.client.util.Lists;
|
||||||
import com.pictc.jdbc.JdbcTools;
|
import com.pictc.jdbc.JdbcTools;
|
||||||
import com.pictc.jdbc.model.JdbcParam;
|
import com.pictc.jdbc.model.JdbcParam;
|
||||||
import com.pictc.utils.ListUtils;
|
import com.pictc.utils.ListUtils;
|
||||||
@ -37,7 +38,7 @@ public class CommonCallService {
|
|||||||
*/
|
*/
|
||||||
public String saveAfter(String table,long id) {
|
public String saveAfter(String table,long id) {
|
||||||
String sql = StringUtils.format("{? = call pc_{0}.f_save(?)}",table);
|
String sql = StringUtils.format("{? = call pc_{0}.f_save(?)}",table);
|
||||||
List<JdbcParam> params = ListUtils.newArrayList(JdbcParam.ofLong(id));
|
List<JdbcParam> params = Lists.newArrayList();
|
||||||
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
|
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
|
||||||
params.add(outParam);
|
params.add(outParam);
|
||||||
params.add(JdbcParam.ofLong(id));
|
params.add(JdbcParam.ofLong(id));
|
||||||
@ -55,7 +56,7 @@ public class CommonCallService {
|
|||||||
*/
|
*/
|
||||||
public String deleteBefore(String table,Long id) {
|
public String deleteBefore(String table,Long id) {
|
||||||
String sql = StringUtils.format("{? = call pc_{0}.f_delete(?)}",table);
|
String sql = StringUtils.format("{? = call pc_{0}.f_delete(?)}",table);
|
||||||
List<JdbcParam> params = ListUtils.newArrayList(JdbcParam.ofLong(id));
|
List<JdbcParam> params = Lists.newArrayList();
|
||||||
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
|
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
|
||||||
params.add(outParam);
|
params.add(outParam);
|
||||||
params.add(JdbcParam.ofLong(id));
|
params.add(JdbcParam.ofLong(id));
|
||||||
@ -74,7 +75,7 @@ public class CommonCallService {
|
|||||||
*/
|
*/
|
||||||
public String disableBefore(String table,Long id) {
|
public String disableBefore(String table,Long id) {
|
||||||
String sql = StringUtils.format("{? = call pc_{0}.f_off(?)}",table);
|
String sql = StringUtils.format("{? = call pc_{0}.f_off(?)}",table);
|
||||||
List<JdbcParam> params = ListUtils.newArrayList(JdbcParam.ofLong(id));
|
List<JdbcParam> params = Lists.newArrayList();
|
||||||
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
|
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
|
||||||
params.add(outParam);
|
params.add(outParam);
|
||||||
params.add(JdbcParam.ofLong(id));
|
params.add(JdbcParam.ofLong(id));
|
||||||
@ -92,7 +93,7 @@ public class CommonCallService {
|
|||||||
*/
|
*/
|
||||||
public String enableBefore(String table,Long id) {
|
public String enableBefore(String table,Long id) {
|
||||||
String sql = StringUtils.format("{? = call pc_{0}.f_on(?)}",table);
|
String sql = StringUtils.format("{? = call pc_{0}.f_on(?)}",table);
|
||||||
List<JdbcParam> params = ListUtils.newArrayList(JdbcParam.ofLong(id));
|
List<JdbcParam> params = Lists.newArrayList();
|
||||||
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
|
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
|
||||||
params.add(outParam);
|
params.add(outParam);
|
||||||
params.add(JdbcParam.ofLong(id));
|
params.add(JdbcParam.ofLong(id));
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.geg</groupId>
|
<groupId>com.geg</groupId>
|
||||||
<artifactId>itc-ms-system-service</artifactId>
|
<artifactId>itc-pcitc-mdm-service</artifactId>
|
||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|||||||
@ -1,5 +0,0 @@
|
|||||||
package com.xjrsoft.test;
|
|
||||||
|
|
||||||
public class CallTest {
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user