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

添加生成markdown

parent 3e4854b7
...@@ -58,6 +58,7 @@ build_service() { ...@@ -58,6 +58,7 @@ build_service() {
echo "[Service]" >>${SERVICE} echo "[Service]" >>${SERVICE}
echo "Environment=\"JAVA_HOME=$JAVA_HOME\"" >>${SERVICE} echo "Environment=\"JAVA_HOME=$JAVA_HOME\"" >>${SERVICE}
echo "Type=forking" >>${SERVICE} echo "Type=forking" >>${SERVICE}
echo "ExecStartPre=-/bin/sleep 5s" >>${SERVICE}
echo "ExecStart=${EXECPATH}/bin/start.sh" >>${SERVICE} echo "ExecStart=${EXECPATH}/bin/start.sh" >>${SERVICE}
echo "ExecStop=${EXECPATH}/bin/shutdown.sh" >>${SERVICE} echo "ExecStop=${EXECPATH}/bin/shutdown.sh" >>${SERVICE}
echo "PrivateTmp=true" >>${SERVICE} echo "PrivateTmp=true" >>${SERVICE}
......
package com.mortals.xhx.module.base.service; package com.mortals.xhx.module.base.service;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.base.model.BaseAreaEntity; import com.mortals.xhx.module.base.model.BaseAreaEntity;
import java.util.List;
/** /**
* BaseAreaService * BaseAreaService
* * <p>
* 区域 service接口 * 区域 service接口
* *
* @author zxfei * @author zxfei
* @date 2022-11-22 * @date 2022-11-22
*/ */
public interface BaseAreaService extends ICRUDService<BaseAreaEntity,Long>{ public interface BaseAreaService extends ICRUDService<BaseAreaEntity, Long> {
/** /**
* 根据顶点名称生成子节点 * 根据顶点名称生成子节点
*
* @param baseAreaEntity * @param baseAreaEntity
* @param context * @param context
*/ */
Rest<String> genSubAreaByRootName(BaseAreaEntity baseAreaEntity, Context context); Rest<String> genSubAreaByRootName(BaseAreaEntity baseAreaEntity, Context context);
Rest<List<String>> getSubAreaByRootName(BaseAreaEntity baseAreaEntity, Context context);
} }
\ No newline at end of file
...@@ -69,37 +69,24 @@ public class BaseAreaServiceImpl extends AbstractCRUDServiceImpl<BaseAreaDao, Ba ...@@ -69,37 +69,24 @@ public class BaseAreaServiceImpl extends AbstractCRUDServiceImpl<BaseAreaDao, Ba
return Rest.ok("初始化区域数据成功!"); return Rest.ok("初始化区域数据成功!");
} }
/** /**
* 递归列表 * @param baseAreaEntity
* @param context
* @return
*/ */
private void recursionFn(List<BaseAreaEntity> list, BaseAreaEntity t) { @Override
// 得到子节点列表 public Rest<List<String>> getSubAreaByRootName(BaseAreaEntity baseAreaEntity, Context context) {
List<BaseAreaEntity> childList = getChildList(list, t);
t.setChildren(childList);
for (BaseAreaEntity tChild : childList) {
if (hasChild(list, tChild)) {
recursionFn(list, tChild);
}
}
}
/** String areaCode = baseAreaEntity.getAreaCode();
* 得到子节点列表 String matchCode = areaCode.replaceAll("(0)+$", "");
*/ matchCode = AreaMatchCodeUtil.getMatchCode(matchCode, baseAreaEntity.getAreaLevel());
private List<BaseAreaEntity> getChildList(List<BaseAreaEntity> list, BaseAreaEntity t) { BaseAreaQuery baseAreaQuery = new BaseAreaQuery();
return list.stream().map(item -> { baseAreaQuery.setAreaCode(matchCode + "%");
if (!ObjectUtils.isEmpty(item.getPid()) && item.getPid() == t.getIid()) { List<BaseAreaEntity> baseAreaEntityList =this.find(baseAreaQuery);
return item; List<String> areaCodeList = baseAreaEntityList.stream().map(i -> i.getAreaCode()).collect(Collectors.toList());
}
return null;
}).filter(f -> f != null).collect(Collectors.toList());
}
/**
* 判断是否有子节点 return Rest.ok(areaCodeList);
*/
private boolean hasChild(List<BaseAreaEntity> list, BaseAreaEntity t) {
return getChildList(list, t).size() > 0 ? true : false;
} }
} }
\ No newline at end of file
...@@ -22,6 +22,11 @@ public class MatterVo extends BaseEntityLong { ...@@ -22,6 +22,11 @@ public class MatterVo extends BaseEntityLong {
private List <String> eventTypeShowNotList; private List <String> eventTypeShowNotList;
private Integer isSub;
private String genFilePath;
} }
\ No newline at end of file
...@@ -44,6 +44,7 @@ import com.mortals.xhx.module.site.service.SiteThemeService; ...@@ -44,6 +44,7 @@ import com.mortals.xhx.module.site.service.SiteThemeService;
import com.mortals.xhx.module.window.model.WindowMatterQuery; import com.mortals.xhx.module.window.model.WindowMatterQuery;
import com.mortals.xhx.module.window.service.WindowMatterService; import com.mortals.xhx.module.window.service.WindowMatterService;
import io.netty.handler.timeout.ReadTimeoutException; import io.netty.handler.timeout.ReadTimeoutException;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
...@@ -51,6 +52,7 @@ import org.jsoup.Jsoup; ...@@ -51,6 +52,7 @@ import org.jsoup.Jsoup;
import org.jsoup.nodes.Document; import org.jsoup.nodes.Document;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -1725,7 +1727,14 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter ...@@ -1725,7 +1727,14 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
fileName = baseAreaEntity.getName() + page + ".md"; fileName = baseAreaEntity.getName() + page + ".md";
} }
String path = "E:\\md\\" + fileName; String genFilePath = matterQuery.getGenFilePath();
String path = "";
if (ObjectUtils.isEmpty(genFilePath)) {
path = genFilePath + fileName;
} else {
path = "E:\\md\\" + fileName;
}
FileUtil.writeUtf8Lines(strList, path); FileUtil.writeUtf8Lines(strList, path);
page++; page++;
strList = new ArrayList<>(); strList = new ArrayList<>();
......
...@@ -14,6 +14,9 @@ import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; ...@@ -14,6 +14,9 @@ import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.framework.config.InterceptorConfig; 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.common.code.JointInfoShowEnum; import com.mortals.xhx.common.code.JointInfoShowEnum;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.module.base.model.BaseAreaEntity;
import com.mortals.xhx.module.base.service.BaseAreaService;
import com.mortals.xhx.module.matter.model.MatterEntity; import com.mortals.xhx.module.matter.model.MatterEntity;
import com.mortals.xhx.module.matter.model.MatterQuery; import com.mortals.xhx.module.matter.model.MatterQuery;
import com.mortals.xhx.module.matter.service.MatterService; import com.mortals.xhx.module.matter.service.MatterService;
...@@ -29,6 +32,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -29,6 +32,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -53,6 +57,8 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe ...@@ -53,6 +57,8 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe
private SiteThemeService siteThemeService; private SiteThemeService siteThemeService;
@Autowired @Autowired
private MatterService matterService; private MatterService matterService;
@Autowired
private BaseAreaService baseAreaService;
public MatterController() { public MatterController() {
super.setModuleDesc("基础事项"); super.setModuleDesc("基础事项");
...@@ -239,7 +245,19 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe ...@@ -239,7 +245,19 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe
int code = VALUE_RESULT_SUCCESS; int code = VALUE_RESULT_SUCCESS;
try { try {
if (!ObjectUtils.isEmpty(query.getIsSub()) && YesNoEnum.YES.getValue() == query.getIsSub()) {
BaseAreaEntity baseAreaEntity = new BaseAreaEntity();
baseAreaEntity.setAreaCode(query.getAreaCode());
List<String> subAreaCodeList = baseAreaService.getSubAreaByRootName(baseAreaEntity, context).getData();
for (String subAreaCode : subAreaCodeList) {
MatterQuery matterEntity = new MatterQuery();
matterEntity.setAreaCode(subAreaCode);
this.service.genMatterMarkdown(matterEntity, getContext());
}
}else{
this.service.genMatterMarkdown(query, getContext()); this.service.genMatterMarkdown(query, getContext());
}
model.put(MESSAGE_INFO, busiDesc + "成功"); model.put(MESSAGE_INFO, busiDesc + "成功");
} catch (Exception e) { } catch (Exception e) {
......
...@@ -65,6 +65,7 @@ build_service() { ...@@ -65,6 +65,7 @@ build_service() {
echo "[Service]" >>${SERVICE} echo "[Service]" >>${SERVICE}
echo "Environment=\"JAVA_HOME=$JAVA_HOME\"" >>${SERVICE} echo "Environment=\"JAVA_HOME=$JAVA_HOME\"" >>${SERVICE}
echo "Type=forking" >>${SERVICE} echo "Type=forking" >>${SERVICE}
echo "ExecStartPre=-/bin/sleep 5s" >>${SERVICE}
echo "ExecStart=${EXECPATH}/bin/start.sh" >>${SERVICE} echo "ExecStart=${EXECPATH}/bin/start.sh" >>${SERVICE}
echo "ExecStop=${EXECPATH}/bin/shutdown.sh" >>${SERVICE} echo "ExecStop=${EXECPATH}/bin/shutdown.sh" >>${SERVICE}
echo "PrivateTmp=true" >>${SERVICE} echo "PrivateTmp=true" >>${SERVICE}
......
...@@ -51,6 +51,7 @@ build_service() { ...@@ -51,6 +51,7 @@ build_service() {
echo "[Service]" >>${SERVICE} echo "[Service]" >>${SERVICE}
echo "Environment=\"JAVA_HOME=$JAVA_HOME\"" >>${SERVICE} echo "Environment=\"JAVA_HOME=$JAVA_HOME\"" >>${SERVICE}
echo "Type=forking" >>${SERVICE} echo "Type=forking" >>${SERVICE}
echo "ExecStartPre=-/bin/sleep 5s" >>${SERVICE}
echo "ExecStart=${EXECPATH}/bin/start.sh" >>${SERVICE} echo "ExecStart=${EXECPATH}/bin/start.sh" >>${SERVICE}
echo "ExecStop=${EXECPATH}/bin/shutdown.sh" >>${SERVICE} echo "ExecStop=${EXECPATH}/bin/shutdown.sh" >>${SERVICE}
echo "PrivateTmp=true" >>${SERVICE} echo "PrivateTmp=true" >>${SERVICE}
......
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