Commit 78d8dabc authored by 赵啸非's avatar 赵啸非

添加目录字段

parent 88b351ce
......@@ -11,7 +11,6 @@ package com.mortals.xhx.base.system.param.dao.ibatis;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import com.mortals.xhx.base.system.param.dao.ParamDao;
import com.mortals.xhx.base.system.param.model.ParamEntity;
import org.springframework.stereotype.Repository;
/**
......
......@@ -21,7 +21,7 @@ import java.util.Date;
* @author
* @version 1.0.0
*/
public class ParamEntity extends ParamEntityExt implements IParam {
public class ParamEntity extends BaseEntityLong implements IParam {
private static final long serialVersionUID = 1536307966363L;
/** 参数名称 */
......
package com.mortals.xhx.base.system.param.model;
import com.mortals.framework.model.BaseEntityLong;
import lombok.Data;
@Data
public class ParamEntityExt extends BaseEntityLong {
/** 素材分组名称 */
private String pictureGroupName;
}
......@@ -5,7 +5,6 @@ import com.mortals.framework.service.ICRUDCacheService;
import com.mortals.framework.service.IParamService;
import com.mortals.xhx.base.system.param.model.ParamEntity;
import java.util.List;
import java.util.Map;
/**
......@@ -45,35 +44,4 @@ public interface ParamService extends ICRUDCacheService<ParamEntity, Long>, IPar
*/
Map<String, String> getParamBySecondOrganize(String firstOrganize,String secondOrganize, String... excludeParamKeys);
/**
* 获取热词列表
* @return
*/
String getHotWords();
/**
* 设置热词列表
* @return
*/
void setHotWords(String value);
/**
* 空白打印材料展示数量
* @return
*/
int getPrintDisplayQuantity();
/**
* 设置空白打印材料展示数量
* @return
*/
void setPrintDisplayQuantity(int value);
/**
* 通过Key设置参数值 value
* @param key
* @param value
* @return
*/
void setValueByKey(String key,String value);
}
\ No newline at end of file
package com.mortals.xhx.base.system.param.service.impl;
import com.mortals.framework.common.code.YesNo;
import cn.hutool.core.util.StrUtil;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.IParam;
import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
import com.mortals.framework.util.DataUtil;
import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.system.param.dao.ParamDao;
import com.mortals.xhx.base.system.param.model.ParamEntity;
import com.mortals.xhx.base.system.param.model.ParamQuery;
import com.mortals.xhx.base.system.param.service.ParamService;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
......@@ -30,14 +29,21 @@ import java.util.stream.Collectors;
@Service("paramService")
public class ParamServiceImpl extends AbstractCRUDCacheServiceImpl<ParamDao, ParamEntity, Long>
implements ParamService {
private final String HOT_WORDS = "HotWords";
private final String PRINT_QUANTITY = "PrintDisplayQuantity";
@Override
protected String getCacheName() {
return "ParamEntity.paramKey";
}
@Override
protected void saveBefore(ParamEntity entity, Context context) throws AppException {
//过滤换行符
entity.setParamKey(StrUtil.removeAllLineBreaks(entity.getParamKey()));
entity.setParamValue(StrUtil.removeAllLineBreaks(entity.getParamValue()));
super.saveBefore(entity, context);
}
@Override
public String getValueByKey(String key) {
List<ParamEntity> list = this.getCacheList();
......@@ -65,92 +71,6 @@ public class ParamServiceImpl extends AbstractCRUDCacheServiceImpl<ParamDao, Par
).collect(Collectors.toMap(ParamEntity::getParamKey, ParamEntity::getParamValue, (o, n) -> n));
}
@Override
public String getHotWords() {
return this.getParamValue(HOT_WORDS);
}
@Override
public void setHotWords(String value) {
List<ParamEntity> list = this.getCacheList();
ParamEntity entity = null;
for(ParamEntity paramEntity:list){
if(HOT_WORDS.equals(paramEntity.getParamKey())){
entity = paramEntity;
break;
}
}
if(entity!=null){
entity.setParamValue(value);
this.update(entity);
}else {
entity = new ParamEntity();
entity.setParamValue(value);
entity.setParamKey(HOT_WORDS);
entity.setName("热门搜索词汇");
entity.setCreateTime(new Date());
entity.setCreateUserId(1l);
entity.setCreateUserName("系统管理员");
this.save(entity);
}
}
@Override
public int getPrintDisplayQuantity() {
String printV = this.getParamValue(PRINT_QUANTITY);
return DataUtil.converStr2Int(printV,20);
}
@Override
public void setPrintDisplayQuantity(int value) {
List<ParamEntity> list = this.getCacheList();
ParamEntity entity = null;
for(ParamEntity paramEntity:list){
if(PRINT_QUANTITY.equals(paramEntity.getParamKey())){
entity = paramEntity;
break;
}
}
if(entity!=null){
entity.setParamValue(String.valueOf(value));
this.update(entity);
}else {
entity = new ParamEntity();
entity.setParamValue(String.valueOf(value));
entity.setParamKey(PRINT_QUANTITY);
entity.setName("空白打印材料展示数量");
entity.setCreateTime(new Date());
entity.setCreateUserId(1l);
entity.setCreateUserName("系统管理员");
this.save(entity);
}
}
@Override
public void setValueByKey(String key, String value) {
List<ParamEntity> list = this.getCacheList();
ParamEntity entity = null;
for(ParamEntity paramEntity:list){
if(key.equals(paramEntity.getParamKey())){
entity = paramEntity;
break;
}
}
if(entity!=null){
entity.setParamValue(String.valueOf(value));
this.update(entity);
}else {
entity = new ParamEntity();
entity.setParamValue(String.valueOf(value));
entity.setParamKey(key);
entity.setName("key");
entity.setCreateTime(new Date());
entity.setCreateUserId(1l);
entity.setCreateUserName("系统管理员");
this.save(entity);
}
}
@Override
public boolean needRefresh() {
......
package com.mortals.xhx.base.system.param.web;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.RepeatSubmit;
import com.mortals.framework.common.code.PageDisplayType;
import com.mortals.framework.model.Context;
import com.mortals.framework.util.FileUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.mortals.framework.web.BaseCRUDJsonMappingController;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.model.ParamEntity;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.DataSatusEnum;
import com.mortals.xhx.common.code.ModStatusEnum;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;
/**
*
* 参数信息
*
* @author: zxfei
* @date: 2021/11/30 10:04
* @date: 2022/5/7 15:38
*/
@RestController
@RequestMapping("param")
public class ParamController extends BaseCRUDJsonMappingController<ParamService, ParamForm, ParamEntity, Long> {
public class ParamController extends BaseCRUDJsonBodyMappingController<ParamService, ParamEntity, Long> {
public ParamController() {
super.setFormClass(ParamForm.class);
......@@ -39,21 +31,17 @@ public class ParamController extends BaseCRUDJsonMappingController<ParamService,
}
@Override
protected void init(HttpServletRequest request, HttpServletResponse response, ParamForm form,
Map<String, Object> model, Context context) {
protected void init(Map<String, Object> model, Context context) {
Map<String, Object> status = new HashMap<String, Object>();
status.put("validStatus", DataSatusEnum.getEnumMap(DataSatusEnum.CLOSE.getValue(),
DataSatusEnum.DELETE.getValue(), DataSatusEnum.OVERDUE.getValue(), DataSatusEnum.USEOUT.getValue()));
status.put("modStatus", ModStatusEnum.getEnumMap());
status.put("displayType", getPageDisplayType());
model.put(KEY_RESULT_DICT, status);
super.init(request, response, form, model, context);
}
private Map<String, Object> getPageDisplayType() {
PageDisplayType[] pageDisplayTypes = PageDisplayType.values();
Map<String, Object> result = new HashMap<>(pageDisplayTypes.length);
for (PageDisplayType pageDisplayType : pageDisplayTypes) {
......@@ -62,7 +50,6 @@ public class ParamController extends BaseCRUDJsonMappingController<ParamService,
return result;
}
public static void main(String[] args) {
FileUtil.delete("E:\\pic\\1.png");
}
......
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