|
@@ -0,0 +1,71 @@
|
|
|
+import cn.hutool.core.lang.Assert;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
+import com.dayou.BaseApplication;
|
|
|
+import com.dayou.brokerage.config.BrokerageMarketerRatioSet;
|
|
|
+import com.dayou.brokerage.validator.BrokerageValidator;
|
|
|
+import com.dayou.common.BaseEntity;
|
|
|
+import com.dayou.dto.ItemDTO;
|
|
|
+import com.dayou.entity.GlobalConfig;
|
|
|
+import com.dayou.entity.ItemBrokerageDetail;
|
|
|
+import com.dayou.service.IGlobalConfigService;
|
|
|
+import com.dayou.service.IItemBrokerageDetailService;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.checkerframework.checker.units.qual.A;
|
|
|
+import org.junit.Test;
|
|
|
+import org.junit.runner.RunWith;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
|
|
+import org.springframework.boot.test.context.SpringBootTest;
|
|
|
+import org.springframework.context.ApplicationContext;
|
|
|
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 类说明:
|
|
|
+ *
|
|
|
+ * @author: wucl
|
|
|
+ * @since: 2023/3/6
|
|
|
+ * created with IntelliJ IDEA.
|
|
|
+ */
|
|
|
+@Slf4j
|
|
|
+@SpringBootTest(classes = BaseApplication.class)
|
|
|
+@RunWith(SpringJUnit4ClassRunner.class)
|
|
|
+public class BrokerageTest {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ApplicationContext applicationContext;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IGlobalConfigService globalConfigService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IItemBrokerageDetailService iItemBrokerageDetailService;
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testBrokerageValidator(){
|
|
|
+ DefaultListableBeanFactory defaultListableBeanFactory = (DefaultListableBeanFactory) applicationContext.getAutowireCapableBeanFactory();
|
|
|
+ BrokerageValidator brokerageValidator = defaultListableBeanFactory.getBean("brokerageValidator",BrokerageValidator.class);
|
|
|
+ log.info("brokerageValidator ===="+ brokerageValidator.monthOfYear.toPlainString());
|
|
|
+ log.info("brokerageValidator ===="+ brokerageValidator.nonMarketerMonthBrokerage.toPlainString());
|
|
|
+ System.out.println(brokerageValidator);
|
|
|
+ globalConfigService.update(new LambdaUpdateWrapper<GlobalConfig>().eq(BaseEntity::getId,18).set(GlobalConfig::getValue,"100"));
|
|
|
+ globalConfigService.update(new LambdaUpdateWrapper<GlobalConfig>().eq(BaseEntity::getId,17).set(GlobalConfig::getValue,"999"));
|
|
|
+ brokerageValidator.reloadBrokerageValidator();
|
|
|
+ BrokerageValidator brokerageValidatorNew = defaultListableBeanFactory.getBean("brokerageValidator",BrokerageValidator.class);
|
|
|
+ log.info("brokerageValidatorNew ===="+ brokerageValidatorNew.monthOfYear.toPlainString());
|
|
|
+ log.info("brokerageValidatorNew ===="+ brokerageValidatorNew.nonMarketerMonthBrokerage.toPlainString());
|
|
|
+ System.out.println(brokerageValidatorNew);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testBrokerageMarketerRatioSet(){
|
|
|
+ DefaultListableBeanFactory defaultListableBeanFactory = (DefaultListableBeanFactory) applicationContext.getAutowireCapableBeanFactory();
|
|
|
+ BrokerageMarketerRatioSet brokerageMarketerRatioSet = defaultListableBeanFactory.getBean("brokerageMarketerRatioSet", BrokerageMarketerRatioSet.class);
|
|
|
+ System.out.println(brokerageMarketerRatioSet);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testCreate(){
|
|
|
+ ItemDTO itemDTO = new ItemDTO();
|
|
|
+ iItemBrokerageDetailService.crateBrokerageDetail(itemDTO);
|
|
|
+ }
|
|
|
+}
|