Commit 4aa06402 authored by 赵啸非's avatar 赵啸非

添加材料排序

parent 63645e73
Pipeline #2611 failed with stages
...@@ -11,7 +11,6 @@ package com.mortals.xhx.base.system.param.dao.ibatis; ...@@ -11,7 +11,6 @@ package com.mortals.xhx.base.system.param.dao.ibatis;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis; import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import com.mortals.xhx.base.system.param.dao.ParamDao; 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.ParamEntity;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
/** /**
......
...@@ -21,7 +21,7 @@ import java.util.Date; ...@@ -21,7 +21,7 @@ import java.util.Date;
* @author * @author
* @version 1.0.0 * @version 1.0.0
*/ */
public class ParamEntity extends ParamEntityExt implements IParam { public class ParamEntity extends BaseEntityLong implements IParam {
private static final long serialVersionUID = 1536307966363L; private static final long serialVersionUID = 1536307966363L;
/** 参数名称 */ /** 参数名称 */
......
...@@ -5,7 +5,6 @@ import com.mortals.framework.service.ICRUDCacheService; ...@@ -5,7 +5,6 @@ import com.mortals.framework.service.ICRUDCacheService;
import com.mortals.framework.service.IParamService; import com.mortals.framework.service.IParamService;
import com.mortals.xhx.base.system.param.model.ParamEntity; import com.mortals.xhx.base.system.param.model.ParamEntity;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -45,35 +44,4 @@ public interface ParamService extends ICRUDCacheService<ParamEntity, Long>, IPar ...@@ -45,35 +44,4 @@ public interface ParamService extends ICRUDCacheService<ParamEntity, Long>, IPar
*/ */
Map<String, String> getParamBySecondOrganize(String firstOrganize,String secondOrganize, String... excludeParamKeys); 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; package com.mortals.xhx.base.system.param.service.impl;
import com.mortals.framework.common.code.YesNo;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.IParam; import com.mortals.framework.service.IParam;
import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
...@@ -8,12 +7,10 @@ import com.mortals.framework.util.DataUtil; ...@@ -8,12 +7,10 @@ import com.mortals.framework.util.DataUtil;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.system.param.dao.ParamDao; 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.ParamEntity;
import com.mortals.xhx.base.system.param.model.ParamQuery;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -30,9 +27,6 @@ import java.util.stream.Collectors; ...@@ -30,9 +27,6 @@ import java.util.stream.Collectors;
@Service("paramService") @Service("paramService")
public class ParamServiceImpl extends AbstractCRUDCacheServiceImpl<ParamDao, ParamEntity, Long> public class ParamServiceImpl extends AbstractCRUDCacheServiceImpl<ParamDao, ParamEntity, Long>
implements ParamService { implements ParamService {
private final String HOT_WORDS = "HotWords";
private final String PRINT_QUANTITY = "PrintDisplayQuantity";
@Override @Override
protected String getCacheName() { protected String getCacheName() {
return "ParamEntity.paramKey"; return "ParamEntity.paramKey";
...@@ -65,92 +59,6 @@ public class ParamServiceImpl extends AbstractCRUDCacheServiceImpl<ParamDao, Par ...@@ -65,92 +59,6 @@ public class ParamServiceImpl extends AbstractCRUDCacheServiceImpl<ParamDao, Par
).collect(Collectors.toMap(ParamEntity::getParamKey, ParamEntity::getParamValue, (o, n) -> n)); ).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 @Override
public boolean needRefresh() { public boolean needRefresh() {
......
package com.mortals.xhx.base.system.param.web; 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.common.code.PageDisplayType;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.util.FileUtil; import com.mortals.framework.util.FileUtil;
import org.springframework.beans.factory.annotation.Autowired; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
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.xhx.base.system.param.model.ParamEntity; import com.mortals.xhx.base.system.param.model.ParamEntity;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.DataSatusEnum; import com.mortals.xhx.common.code.DataSatusEnum;
import com.mortals.xhx.common.code.ModStatusEnum; 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.HashMap;
import java.util.Map; import java.util.Map;
/** /**
*
* 参数信息 * 参数信息
*
* @author: zxfei * @author: zxfei
* @date: 2021/11/30 10:04 * @date: 2022/5/7 15:38
*/ */
@RestController @RestController
@RequestMapping("param") @RequestMapping("param")
public class ParamController extends BaseCRUDJsonMappingController<ParamService, ParamForm, ParamEntity, Long> { public class ParamController extends BaseCRUDJsonBodyMappingController<ParamService, ParamEntity, Long> {
public ParamController() { public ParamController() {
super.setFormClass(ParamForm.class); super.setFormClass(ParamForm.class);
...@@ -39,21 +31,17 @@ public class ParamController extends BaseCRUDJsonMappingController<ParamService, ...@@ -39,21 +31,17 @@ public class ParamController extends BaseCRUDJsonMappingController<ParamService,
} }
@Override @Override
protected void init(HttpServletRequest request, HttpServletResponse response, ParamForm form, protected void init(Map<String, Object> model, Context context) {
Map<String, Object> model, Context context) {
Map<String, Object> status = new HashMap<String, Object>(); Map<String, Object> status = new HashMap<String, Object>();
status.put("validStatus", DataSatusEnum.getEnumMap(DataSatusEnum.CLOSE.getValue(), status.put("validStatus", DataSatusEnum.getEnumMap(DataSatusEnum.CLOSE.getValue(),
DataSatusEnum.DELETE.getValue(), DataSatusEnum.OVERDUE.getValue(), DataSatusEnum.USEOUT.getValue())); DataSatusEnum.DELETE.getValue(), DataSatusEnum.OVERDUE.getValue(), DataSatusEnum.USEOUT.getValue()));
status.put("modStatus", ModStatusEnum.getEnumMap()); status.put("modStatus", ModStatusEnum.getEnumMap());
status.put("displayType", getPageDisplayType()); status.put("displayType", getPageDisplayType());
model.put(KEY_RESULT_DICT, status); model.put(KEY_RESULT_DICT, status);
super.init(request, response, form, model, context);
} }
private Map<String, Object> getPageDisplayType() { private Map<String, Object> getPageDisplayType() {
PageDisplayType[] pageDisplayTypes = PageDisplayType.values(); PageDisplayType[] pageDisplayTypes = PageDisplayType.values();
Map<String, Object> result = new HashMap<>(pageDisplayTypes.length); Map<String, Object> result = new HashMap<>(pageDisplayTypes.length);
for (PageDisplayType pageDisplayType : pageDisplayTypes) { for (PageDisplayType pageDisplayType : pageDisplayTypes) {
...@@ -62,7 +50,6 @@ public class ParamController extends BaseCRUDJsonMappingController<ParamService, ...@@ -62,7 +50,6 @@ public class ParamController extends BaseCRUDJsonMappingController<ParamService,
return result; return result;
} }
public static void main(String[] args) { public static void main(String[] args) {
FileUtil.delete("E:\\pic\\1.png"); 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