From 17c94afc50e7957b8fd98413cdc9cbbdc4c7967a Mon Sep 17 00:00:00 2001 From: KKSU <15274802129@163.com> Date: Thu, 18 Jul 2024 17:41:19 +0800 Subject: [PATCH] 逻辑 --- src/main/java/cc/mrbird/febs/FebsShiroApplication.java | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 59 insertions(+), 0 deletions(-) diff --git a/src/main/java/cc/mrbird/febs/FebsShiroApplication.java b/src/main/java/cc/mrbird/febs/FebsShiroApplication.java index 1766c6b..b5dc981 100644 --- a/src/main/java/cc/mrbird/febs/FebsShiroApplication.java +++ b/src/main/java/cc/mrbird/febs/FebsShiroApplication.java @@ -1,25 +1,84 @@ package cc.mrbird.febs; +import cc.mrbird.febs.common.contants.AppContants; +import cc.mrbird.febs.dapp.dto.SystemConstants; +import cc.mrbird.febs.dapp.dto.SystemConstantsAddress; +import cc.mrbird.febs.dapp.entity.DataDictionaryCustom; +import cc.mrbird.febs.dapp.enumerate.DataDictionaryEnum; +import cc.mrbird.febs.dapp.mapper.DataDictionaryCustomMapper; +import cn.hutool.core.util.StrUtil; import org.mybatis.spring.annotation.MapperScan; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.WebApplicationType; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.transaction.annotation.EnableTransactionManagement; + +import javax.annotation.PostConstruct; +import java.lang.reflect.Field; /** * @author MrBird */ @EnableAsync +@EnableScheduling @SpringBootApplication @EnableTransactionManagement @MapperScan("cc.mrbird.febs.*.mapper") public class FebsShiroApplication { + + @Autowired + private DataDictionaryCustomMapper dataDictionaryCustomMapper; + + @Autowired + private SystemConstants systemConstants; + + @Autowired + private SystemConstantsAddress systemConstantsAddress; + public static void main(String[] args) { new SpringApplicationBuilder(FebsShiroApplication.class) .web(WebApplicationType.SERVLET) .run(args); } + @PostConstruct + public void systemConstantsInit() { + DataDictionaryCustom dataDictionaryCustom = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( + DataDictionaryEnum.FEE_ADDRESS_KEY.getType(), + DataDictionaryEnum.FEE_ADDRESS_KEY.getCode()); + String key = dataDictionaryCustom.getCode(); + key = StrUtil.toCamelCase(key); + String value = dataDictionaryCustom.getValue(); + try { + Field field = systemConstants.getClass().getDeclaredField(key); + field.set(systemConstants, value); + AppContants.FEE_ADDRESS_KEY.put("feeAddressKey",systemConstants.getFeeAddressKey()); + dataDictionaryCustom.setValue("isReady"); + dataDictionaryCustomMapper.updateById(dataDictionaryCustom); + } catch (Exception e) { + e.printStackTrace(); + } + + + DataDictionaryCustom addressDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( + DataDictionaryEnum.FEE_ADDRESS.getType(), + DataDictionaryEnum.FEE_ADDRESS.getCode()); + String addressKey = addressDic.getCode(); + addressKey = StrUtil.toCamelCase(addressKey); + String valueAddress = addressDic.getValue(); + try { + Field field = systemConstantsAddress.getClass().getDeclaredField(addressKey); + field.set(systemConstantsAddress, valueAddress); + AppContants.FEE_ADDRESS.put("feeAddress",systemConstantsAddress.getFeeAddress()); + addressDic.setValue("isReady"); + dataDictionaryCustomMapper.updateById(addressDic); + } catch (Exception e) { + e.printStackTrace(); + } + } + } -- Gitblit v1.9.1