Commit c38fbefe authored by 赵啸非's avatar 赵啸非

添加初始化数据库脚本

parent 004c9356
...@@ -62,17 +62,20 @@ ...@@ -62,17 +62,20 @@
<profile> <profile>
<id>product</id> <id>product</id>
<properties> <properties>
<profiles.active>product</profiles.active> <profiles.active>test</profiles.active>
<profiles.server.port>19211</profiles.server.port> <profiles.server.port>17211</profiles.server.port>
<profiles.queue.type>rabbitmq</profiles.queue.type> <profiles.queue.type>rabbitmq</profiles.queue.type>
<profiles.kafka.brokers>192.168.0.100:9092</profiles.kafka.brokers> <profiles.kafka.brokers>192.168.0.251:9092</profiles.kafka.brokers>
<profiles.rabbitmq.host>192.168.0.100</profiles.rabbitmq.host> <profiles.rabbitmq.host>192.168.0.251</profiles.rabbitmq.host>
<profiles.rabbitmq.port>5672</profiles.rabbitmq.port> <profiles.rabbitmq.port>5672</profiles.rabbitmq.port>
<profiles.nacos.server-addr>192.168.0.100:8848</profiles.nacos.server-addr> <profiles.rabbitmq.username>root_mq</profiles.rabbitmq.username>
<profiles.rabbitmq.password>xhx@2022</profiles.rabbitmq.password>
<profiles.rabbitmq.virtualhost>/</profiles.rabbitmq.virtualhost>
<profiles.nacos.server-addr>127.0.0.1:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group> <profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>stp</profiles.nacos.namespace> <profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<profiles.log.path>/mortals/app/logs</profiles.log.path> <profiles.log.path>/mortals/app/logs</profiles.log.path>
<profiles.log.level>INFO</profiles.log.level> <profiles.log.level>DEBUG</profiles.log.level>
</properties> </properties>
</profile> </profile>
</profiles> </profiles>
......
...@@ -78,6 +78,7 @@ public class RequestDataController { ...@@ -78,6 +78,7 @@ public class RequestDataController {
setting.putAll(sqclInfoMap); setting.putAll(sqclInfoMap);
setting.store("E://sqclinfo.setting"); setting.store("E://sqclinfo.setting");
return respPdu; return respPdu;
} }
......
...@@ -61,4 +61,11 @@ public interface AreaService extends ICRUDCacheService<AreaEntity,Long> { ...@@ -61,4 +61,11 @@ public interface AreaService extends ICRUDCacheService<AreaEntity,Long> {
* @return * @return
*/ */
List<AreaTreeSelect> getListByRootId(String rootId, Context context); List<AreaTreeSelect> getListByRootId(String rootId, Context context);
/**
* 根据顶点名称生成sql
* @param rootName
* @param context
*/
void genSqlByRootName(String rootName, Context context);
} }
\ No newline at end of file
...@@ -5,6 +5,7 @@ import com.mortals.xhx.module.area.model.AreaEntity; ...@@ -5,6 +5,7 @@ import com.mortals.xhx.module.area.model.AreaEntity;
import com.mortals.xhx.module.area.model.AreaQuery; import com.mortals.xhx.module.area.model.AreaQuery;
import com.mortals.xhx.module.area.model.AreaTreeSelect; import com.mortals.xhx.module.area.model.AreaTreeSelect;
import com.mortals.xhx.module.site.service.SiteService; import com.mortals.xhx.module.site.service.SiteService;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
...@@ -199,6 +200,7 @@ public class AreaServiceImpl extends AbstractCRUDCacheServiceImpl<AreaDao, AreaE ...@@ -199,6 +200,7 @@ public class AreaServiceImpl extends AbstractCRUDCacheServiceImpl<AreaDao, AreaE
return areaTreeSelectList; return areaTreeSelectList;
} }
private void rebuildList(AreaTreeSelect areaTreeSelect) { private void rebuildList(AreaTreeSelect areaTreeSelect) {
List<AreaTreeSelect> list = this.cacheService.lrange(super.getCacheName() + ":" + areaTreeSelect.getId(), AreaEntity.class).stream().map(item -> new AreaTreeSelect(item)).collect(Collectors.toList()); List<AreaTreeSelect> list = this.cacheService.lrange(super.getCacheName() + ":" + areaTreeSelect.getId(), AreaEntity.class).stream().map(item -> new AreaTreeSelect(item)).collect(Collectors.toList());
list.stream().forEach(item -> { list.stream().forEach(item -> {
...@@ -243,4 +245,27 @@ public class AreaServiceImpl extends AbstractCRUDCacheServiceImpl<AreaDao, AreaE ...@@ -243,4 +245,27 @@ public class AreaServiceImpl extends AbstractCRUDCacheServiceImpl<AreaDao, AreaE
} }
@Override
public void genSqlByRootName(String rootName, Context context) {
AreaEntity areaEntity = this.selectOne(new AreaQuery().name(rootName));
//INSERT INTO `mortals_sys_area` VALUES (1, '', '四川省', '6182157d00ce41559e001a89d87f4057', '0', 'True', 'True', 'true', 'true', '510000000000', 1, '四川省', 'www.sczwfw.gov.cn', 1, '2021-07-19 11:28:28', NULL, '2022-03-17 13:39:30');
StringBuilder sql = new StringBuilder();
if (!ObjectUtils.isEmpty(areaEntity)) {
//生成当前节点下的sql
List<AreaEntity> areaList = new ArrayList<>();
recursionFn(areaList,areaEntity);
areaList.forEach(area->{
String str= String.format("INSERT INTO `mortals_sys_area` VALUES (null, '', '%s', '%s', '%s', " +
"'%s', '%s', '%s', '%s', '%s', %d, '%s', '%s', %d," +
" now(), NULL, NULL);", area.getName(),area.getIid(),area.getPid(),area.getHaveSonArea(),area.getHaveSonDept(),area.getHaveGetDept(),area.getHaveGetMatterList(),area.getAreaCode(),area.getAreaLevel(),area.getShortName(),area.getDomain(),area.getStatus());
sql.append(str);
});
log.info(sql.toString());
}
}
} }
\ No newline at end of file
package com.mortals.xhx.module.matter.web; package com.mortals.xhx.module.matter.web;
import cn.hutool.setting.Setting;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.util.DataUtil; import com.mortals.framework.util.DataUtil;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.framework.web.BasePhpCRUDJsonMappingController; import com.mortals.framework.web.BasePhpCRUDJsonMappingController;
import com.mortals.xhx.base.framework.config.InterceptorConfig;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.matter.model.MatterEntity; import com.mortals.xhx.module.matter.model.MatterEntity;
import com.mortals.xhx.module.matter.service.MatterService; import com.mortals.xhx.module.matter.service.MatterService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -16,6 +19,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -16,6 +19,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* 基础事项 * 基础事项
...@@ -29,6 +33,8 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe ...@@ -29,6 +33,8 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe
@Autowired @Autowired
private ParamService paramService; private ParamService paramService;
@Autowired
private InterceptorConfig interceptorConfig;
public MatterController() { public MatterController() {
super.setFormClass(MatterForm.class); super.setFormClass(MatterForm.class);
...@@ -70,6 +76,25 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe ...@@ -70,6 +76,25 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe
this.addDict(model, "parson", paramService.getParamBySecondOrganize("Matter", "parson")); this.addDict(model, "parson", paramService.getParamBySecondOrganize("Matter", "parson"));
this.addDict(model, "lengal", paramService.getParamBySecondOrganize("Matter", "lengal")); this.addDict(model, "lengal", paramService.getParamBySecondOrganize("Matter", "lengal"));
this.addDict(model, "source", paramService.getParamBySecondOrganize("Matter", "source")); this.addDict(model, "source", paramService.getParamBySecondOrganize("Matter", "source"));
Setting baseInfoSetting = interceptorConfig.getBaseInfoSetting();
Map<String, String> baseInfoMap = new HashMap<>();
baseInfoSetting.entrySet().stream().forEach(item->{
if(!ObjectUtils.isEmpty(item.getValue())){
baseInfoMap.put( item.getValue(), item.getKey());
}
});
this.addDict(model, "baseInfo", baseInfoMap);
Setting sqclInfoSetting = interceptorConfig.getSqclInfoSetting();
Map<String, String> sqclInfoMap = new HashMap<>();
sqclInfoSetting.entrySet().stream().forEach(item->{
if(!ObjectUtils.isEmpty(item.getValue())){
sqclInfoMap.put( item.getValue(), item.getKey());
}
});
this.addDict(model, "sqclInfo", sqclInfoMap);
super.init(model, context); super.init(model, context);
} }
......
...@@ -19,12 +19,12 @@ ...@@ -19,12 +19,12 @@
<encoder> <encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%X{traceId}] [%thread] [%.50c\(%L\)] - %msg%n</pattern> <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%X{traceId}] [%thread] [%.50c\(%L\)] - %msg%n</pattern>
</encoder> </encoder>
<file>${logFilePath}/${springApplicationName:-default}/${serverPort:-default}-info.log</file> <file>${logFilePath}/${springApplicationName:-default}/${springApplicationName:-default}-info.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 文件保存策略--> <!-- 文件保存策略-->
<fileNamePattern>${logFilePath}/${springApplicationName:-default}/${serverPort:-default}-info.log.%d{yyyyMMdd}</fileNamePattern> <fileNamePattern>${logFilePath}/${springApplicationName:-default}/${springApplicationName:-default}-info.log.%d{yyyyMMdd}</fileNamePattern>
<!--日志文件保留天数--> <!--日志文件保留天数-->
<MaxHistory>15</MaxHistory> <MaxHistory>7</MaxHistory>
</rollingPolicy> </rollingPolicy>
</appender> </appender>
<!-- 异常文件输出策略--> <!-- 异常文件输出策略-->
...@@ -35,11 +35,11 @@ ...@@ -35,11 +35,11 @@
<encoder> <encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%X{traceId}] [%thread] [%.50c\(%L\)] - %msg%n</pattern> <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%X{traceId}] [%thread] [%.50c\(%L\)] - %msg%n</pattern>
</encoder> </encoder>
<file>${logFilePath}/${springApplicationName:-default}/${serverPort:-default}-error.log</file> <file>${logFilePath}/${springApplicationName:-default}/${springApplicationName:-default}-error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${logFilePath}/${springApplicationName:-default}/${serverPort:-default}-error.log.%d{yyyyMMdd}</fileNamePattern> <fileNamePattern>${logFilePath}/${springApplicationName:-default}/${springApplicationName:-default}-error.log.%d{yyyyMMdd}</fileNamePattern>
<!--日志文件保留天数--> <!--日志文件保留天数-->
<MaxHistory>15</MaxHistory> <MaxHistory>7</MaxHistory>
</rollingPolicy> </rollingPolicy>
</appender> </appender>
......
...@@ -3,7 +3,7 @@ POST {{baseUrl}}/workman/doLogin ...@@ -3,7 +3,7 @@ POST {{baseUrl}}/workman/doLogin
Content-Type: application/json Content-Type: application/json
{ {
"loginName":"rsju" , "loginName":"gxj" ,
"loginPwd":"123456" "loginPwd":"123456"
} }
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
<profiles.kafka.brokers>192.168.0.251:9092</profiles.kafka.brokers> <profiles.kafka.brokers>192.168.0.251:9092</profiles.kafka.brokers>
<profiles.rabbitmq.host>127.0.0.1</profiles.rabbitmq.host> <profiles.rabbitmq.host>127.0.0.1</profiles.rabbitmq.host>
<profiles.rabbitmq.port>5672</profiles.rabbitmq.port> <profiles.rabbitmq.port>5672</profiles.rabbitmq.port>
<profiles.rabbitmq.username>taxi_mq</profiles.rabbitmq.username> <profiles.rabbitmq.username>root_mq</profiles.rabbitmq.username>
<profiles.rabbitmq.password>xhx@2022</profiles.rabbitmq.password> <profiles.rabbitmq.password>xhx@2022</profiles.rabbitmq.password>
<profiles.rabbitmq.virtualhost>/</profiles.rabbitmq.virtualhost> <profiles.rabbitmq.virtualhost>/</profiles.rabbitmq.virtualhost>
<profiles.nacos.server-addr>127.0.0.1:8848</profiles.nacos.server-addr> <profiles.nacos.server-addr>127.0.0.1:8848</profiles.nacos.server-addr>
......
...@@ -19,12 +19,12 @@ ...@@ -19,12 +19,12 @@
<encoder> <encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%X{traceId}] [%thread] [%.50c\(%L\)] - %msg%n</pattern> <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%X{traceId}] [%thread] [%.50c\(%L\)] - %msg%n</pattern>
</encoder> </encoder>
<file>${logFilePath}/${springApplicationName:-default}/${serverPort:-default}-info.log</file> <file>${logFilePath}/${springApplicationName:-default}/${springApplicationName:-default}-info.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 文件保存策略--> <!-- 文件保存策略-->
<fileNamePattern>${logFilePath}/${springApplicationName:-default}/${serverPort:-default}-info.log.%d{yyyyMMdd}</fileNamePattern> <fileNamePattern>${logFilePath}/${springApplicationName:-default}/${springApplicationName:-default}-info.log.%d{yyyyMMdd}</fileNamePattern>
<!--日志文件保留天数--> <!--日志文件保留天数-->
<MaxHistory>15</MaxHistory> <MaxHistory>7</MaxHistory>
</rollingPolicy> </rollingPolicy>
</appender> </appender>
<!-- 异常文件输出策略--> <!-- 异常文件输出策略-->
...@@ -35,11 +35,11 @@ ...@@ -35,11 +35,11 @@
<encoder> <encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%X{traceId}] [%thread] [%.50c\(%L\)] - %msg%n</pattern> <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%X{traceId}] [%thread] [%.50c\(%L\)] - %msg%n</pattern>
</encoder> </encoder>
<file>${logFilePath}/${springApplicationName:-default}/${serverPort:-default}-error.log</file> <file>${logFilePath}/${springApplicationName:-default}/${springApplicationName:-default}-error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${logFilePath}/${springApplicationName:-default}/${serverPort:-default}-error.log.%d{yyyyMMdd}</fileNamePattern> <fileNamePattern>${logFilePath}/${springApplicationName:-default}/${springApplicationName:-default}-error.log.%d{yyyyMMdd}</fileNamePattern>
<!--日志文件保留天数--> <!--日志文件保留天数-->
<MaxHistory>15</MaxHistory> <MaxHistory>7</MaxHistory>
</rollingPolicy> </rollingPolicy>
</appender> </appender>
......
...@@ -19,12 +19,12 @@ ...@@ -19,12 +19,12 @@
<encoder> <encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%X{traceId}] [%thread] [%.50c\(%L\)] - %msg%n</pattern> <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%X{traceId}] [%thread] [%.50c\(%L\)] - %msg%n</pattern>
</encoder> </encoder>
<file>${logFilePath}/${springApplicationName:-default}/${serverPort:-default}-info.log</file> <file>${logFilePath}/${springApplicationName:-default}/${springApplicationName:-default}-info.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 文件保存策略--> <!-- 文件保存策略-->
<fileNamePattern>${logFilePath}/${springApplicationName:-default}/${serverPort:-default}-info.log.%d{yyyyMMdd}</fileNamePattern> <fileNamePattern>${logFilePath}/${springApplicationName:-default}/${serspringApplicationNameverPort:-default}-info.log.%d{yyyyMMdd}</fileNamePattern>
<!--日志文件保留天数--> <!--日志文件保留天数-->
<MaxHistory>15</MaxHistory> <MaxHistory>7</MaxHistory>
</rollingPolicy> </rollingPolicy>
</appender> </appender>
<!-- 异常文件输出策略--> <!-- 异常文件输出策略-->
...@@ -35,11 +35,11 @@ ...@@ -35,11 +35,11 @@
<encoder> <encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%X{traceId}] [%thread] [%.50c\(%L\)] - %msg%n</pattern> <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%X{traceId}] [%thread] [%.50c\(%L\)] - %msg%n</pattern>
</encoder> </encoder>
<file>${logFilePath}/${springApplicationName:-default}/${serverPort:-default}-error.log</file> <file>${logFilePath}/${springApplicationName:-default}/${springApplicationName:-default}-error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${logFilePath}/${springApplicationName:-default}/${serverPort:-default}-error.log.%d{yyyyMMdd}</fileNamePattern> <fileNamePattern>${logFilePath}/${springApplicationName:-default}/${springApplicationName:-default}-error.log.%d{yyyyMMdd}</fileNamePattern>
<!--日志文件保留天数--> <!--日志文件保留天数-->
<MaxHistory>15</MaxHistory> <MaxHistory>7</MaxHistory>
</rollingPolicy> </rollingPolicy>
</appender> </appender>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment