2018-02-22 12:46:50 +08:00
|
|
|
|
package com.nis.web.service.configuration;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
|
import com.google.common.collect.Lists;
|
|
|
|
|
|
import com.nis.domain.Page;
|
2018-03-01 19:13:57 +08:00
|
|
|
|
import com.nis.domain.SysMenu;
|
2018-02-22 12:46:50 +08:00
|
|
|
|
import com.nis.domain.SysUser;
|
|
|
|
|
|
import com.nis.domain.configuration.ServiceDictInfo;
|
2018-02-25 18:43:20 +08:00
|
|
|
|
import com.nis.util.Constants;
|
2018-02-22 12:46:50 +08:00
|
|
|
|
import com.nis.util.StringUtil;
|
|
|
|
|
|
import com.nis.web.dao.configuration.ServiceDictInfoDao;
|
|
|
|
|
|
import com.nis.web.security.UserUtils;
|
|
|
|
|
|
import com.nis.web.service.BaseService;
|
|
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
|
|
public class ServiceDictInfoService extends BaseService{
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
private ServiceDictInfoDao serviceDictInfoDao;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-01 19:13:57 +08:00
|
|
|
|
* 查询分类性质字典分页(无条件查询)
|
2018-02-22 12:46:50 +08:00
|
|
|
|
* @param page
|
|
|
|
|
|
* @param serviceDictInfo
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
2018-03-01 19:13:57 +08:00
|
|
|
|
public Page<ServiceDictInfo> findTopDictList(Page<ServiceDictInfo> page, ServiceDictInfo serviceDictInfo) {
|
2018-02-22 12:46:50 +08:00
|
|
|
|
// 设置分页参数
|
|
|
|
|
|
serviceDictInfo.setPage(page);
|
2018-03-01 19:13:57 +08:00
|
|
|
|
//查出顶层分页查询
|
|
|
|
|
|
List<ServiceDictInfo> parentList = serviceDictInfoDao.findTopDictList(serviceDictInfo);
|
|
|
|
|
|
page.setList(parentList);
|
2018-02-22 12:46:50 +08:00
|
|
|
|
return page;
|
|
|
|
|
|
}
|
2018-03-01 19:13:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 查询所有有效字典配置
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public List<ServiceDictInfo> findAllDictList() {
|
|
|
|
|
|
|
|
|
|
|
|
return serviceDictInfoDao.findAllDictList(new ServiceDictInfo());
|
|
|
|
|
|
}
|
2018-02-22 12:46:50 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-01 19:13:57 +08:00
|
|
|
|
* 查询所有的非叶子配置
|
|
|
|
|
|
*/
|
|
|
|
|
|
public List<ServiceDictInfo> findAllNoLeafDictList() {
|
|
|
|
|
|
return serviceDictInfoDao.findAllNoLeafDictList();
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 查询分类性质字典分页(含条件查询)
|
2018-02-22 12:46:50 +08:00
|
|
|
|
* @param page
|
|
|
|
|
|
* @param serviceDictInfo
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
2018-03-01 19:13:57 +08:00
|
|
|
|
public Page<ServiceDictInfo> findDictSearchList(Page<ServiceDictInfo> page, ServiceDictInfo serviceDictInfo) {
|
2018-02-22 12:46:50 +08:00
|
|
|
|
// 设置分页参数
|
2018-03-01 19:13:57 +08:00
|
|
|
|
serviceDictInfo.setPage(page);
|
|
|
|
|
|
List<ServiceDictInfo> parentList = serviceDictInfoDao.findDictSearchList(serviceDictInfo);
|
|
|
|
|
|
page.setList(parentList);
|
|
|
|
|
|
return page;
|
2018-02-22 12:46:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-03-01 19:13:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
2018-02-22 12:46:50 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 根据主键查询字典详细信息
|
|
|
|
|
|
* @param serviceDictId
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public ServiceDictInfo getDictById(Integer serviceDictId) {
|
|
|
|
|
|
return serviceDictInfoDao.getDictById(serviceDictId);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 新增或修改业务字典表
|
|
|
|
|
|
* @param serviceDictInfo
|
|
|
|
|
|
*/
|
|
|
|
|
|
public void saveOrUpdate(ServiceDictInfo serviceDictInfo) {
|
|
|
|
|
|
SysUser user = UserUtils.getUser();
|
|
|
|
|
|
if(StringUtil.isEmpty(serviceDictInfo.getServiceDictId())) {//新增
|
|
|
|
|
|
serviceDictInfo.setIsValid(1);
|
|
|
|
|
|
serviceDictInfo.setServiceDictCreator(user);
|
|
|
|
|
|
serviceDictInfo.setCreateTime(new Date());
|
|
|
|
|
|
serviceDictInfo.setServiceDictEditor(user);
|
|
|
|
|
|
serviceDictInfo.setEditTime(serviceDictInfo.getCreateTime());
|
|
|
|
|
|
if(serviceDictInfo.getParent()==null||(serviceDictInfo.getParent()!=null&&serviceDictInfo.getParent().getServiceDictId()==null)){
|
|
|
|
|
|
ServiceDictInfo parent = new ServiceDictInfo();
|
|
|
|
|
|
parent.setServiceDictId(0);
|
|
|
|
|
|
serviceDictInfo.setParent(parent);
|
|
|
|
|
|
}
|
|
|
|
|
|
serviceDictInfoDao.insertDict(serviceDictInfo);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
else {//修改
|
|
|
|
|
|
serviceDictInfo.setServiceDictEditor(user);
|
|
|
|
|
|
serviceDictInfo.setEditTime(new Date());
|
|
|
|
|
|
serviceDictInfoDao.update(serviceDictInfo);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 查询所有非叶子节点字典配置信息
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
2018-03-01 19:13:57 +08:00
|
|
|
|
/* public List<ServiceDictInfo> findAllDict() {
|
2018-02-22 12:46:50 +08:00
|
|
|
|
|
|
|
|
|
|
return serviceDictInfoDao.findAllDict();
|
2018-03-01 19:13:57 +08:00
|
|
|
|
}*/
|
2018-02-22 12:46:50 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 删除
|
|
|
|
|
|
* @param serviceDictInfo
|
|
|
|
|
|
*/
|
|
|
|
|
|
public void deleteDict(ServiceDictInfo serviceDictInfo) {
|
2018-03-01 19:13:57 +08:00
|
|
|
|
List<ServiceDictInfo> list = Lists.newArrayList();
|
|
|
|
|
|
//找出所有下级
|
|
|
|
|
|
//查出所有节点
|
|
|
|
|
|
ServiceDictInfo.sortList(list, serviceDictInfoDao.findAllDictList(new ServiceDictInfo()), serviceDictInfo.getServiceDictId(), true);
|
|
|
|
|
|
list.add(serviceDictInfo);
|
|
|
|
|
|
for(ServiceDictInfo se:list){
|
|
|
|
|
|
se.setIsValid(0);
|
|
|
|
|
|
serviceDictInfoDao.delete(se);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-02-22 12:46:50 +08:00
|
|
|
|
}
|
2018-03-01 19:13:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//标签管理
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 查询标签分页(无条件查询)
|
|
|
|
|
|
* @param page
|
|
|
|
|
|
* @param serviceDictInfo
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public Page<ServiceDictInfo> findTopDictMarkList(Page<ServiceDictInfo> page, ServiceDictInfo serviceDictInfo) {
|
|
|
|
|
|
// 设置分页参数
|
|
|
|
|
|
serviceDictInfo.setPage(page);
|
|
|
|
|
|
//查出顶层分页查询
|
|
|
|
|
|
List<ServiceDictInfo> parentList = serviceDictInfoDao.findTopDictMarkList(serviceDictInfo);
|
|
|
|
|
|
page.setList(parentList);
|
|
|
|
|
|
return page;
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 查询所有有效标签配置
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public List<ServiceDictInfo> findAllDictMarkList() {
|
|
|
|
|
|
|
|
|
|
|
|
return serviceDictInfoDao.findAllDictMarkList(new ServiceDictInfo());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 查询标签字典分页(含条件查询)
|
|
|
|
|
|
* @param page
|
|
|
|
|
|
* @param serviceDictInfo
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public Page<ServiceDictInfo> findDictSearchMarkList(Page<ServiceDictInfo> page, ServiceDictInfo serviceDictInfo) {
|
|
|
|
|
|
// 设置分页参数
|
|
|
|
|
|
serviceDictInfo.setPage(page);
|
|
|
|
|
|
List<ServiceDictInfo> parentList = serviceDictInfoDao.findDictSearchMarkList(serviceDictInfo);
|
|
|
|
|
|
page.setList(parentList);
|
|
|
|
|
|
return page;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 查询所有的非叶子配置
|
|
|
|
|
|
*/
|
|
|
|
|
|
public List<ServiceDictInfo> findAllNoLeafDictMarkList() {
|
|
|
|
|
|
return serviceDictInfoDao.findAllNoLeafDictMarkList();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-02-25 18:43:20 +08:00
|
|
|
|
/**
|
|
|
|
|
|
*
|
|
|
|
|
|
* findFlDict(查找所有有效的分类)
|
|
|
|
|
|
* (这里描述这个方法适用条件 – 可选)
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*List<ServiceDictInfo>
|
|
|
|
|
|
* @exception
|
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
|
*/
|
|
|
|
|
|
public List<ServiceDictInfo> findFlDict() {
|
|
|
|
|
|
return serviceDictInfoDao.findItemDict(Constants.ITEM_TYPE_FL,Constants.VALID_YES);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
*
|
|
|
|
|
|
* findFlDict(查找所有有效的分类)
|
|
|
|
|
|
* (这里描述这个方法适用条件 – 可选)
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*List<ServiceDictInfo>
|
|
|
|
|
|
* @exception
|
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
|
*/
|
|
|
|
|
|
public List<ServiceDictInfo> findAllFlDict() {
|
|
|
|
|
|
return serviceDictInfoDao.findAllItemDict(Constants.ITEM_TYPE_FL);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
*
|
|
|
|
|
|
* findFlDict(查找所有有效的性质)
|
|
|
|
|
|
* (这里描述这个方法适用条件 – 可选)
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*List<ServiceDictInfo>
|
|
|
|
|
|
* @exception
|
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
|
*/
|
|
|
|
|
|
public List<ServiceDictInfo> findXzDict() {
|
|
|
|
|
|
return serviceDictInfoDao.findItemDict(Constants.ITEM_TYPE_XZ,Constants.VALID_YES);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
*
|
|
|
|
|
|
* findFlDict(查找所有有效的性质)
|
|
|
|
|
|
* (这里描述这个方法适用条件 – 可选)
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*List<ServiceDictInfo>
|
|
|
|
|
|
* @exception
|
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
|
*/
|
|
|
|
|
|
public List<ServiceDictInfo> findAllXzDict() {
|
|
|
|
|
|
return serviceDictInfoDao.findAllItemDict(Constants.ITEM_TYPE_XZ);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
*
|
|
|
|
|
|
* findFlDict(查找所有有效的标签)
|
|
|
|
|
|
* (这里描述这个方法适用条件 – 可选)
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*List<ServiceDictInfo>
|
|
|
|
|
|
* @exception
|
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
|
*/
|
|
|
|
|
|
public List<ServiceDictInfo> findLableDict() {
|
|
|
|
|
|
return serviceDictInfoDao.findItemDict(Constants.ITEM_TYPE_LABEL,Constants.VALID_YES);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
*
|
|
|
|
|
|
* findFlDict(查找所有有效的标签)
|
|
|
|
|
|
* (这里描述这个方法适用条件 – 可选)
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*List<ServiceDictInfo>
|
|
|
|
|
|
* @exception
|
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
|
*/
|
|
|
|
|
|
public List<ServiceDictInfo> findAllLableDict() {
|
|
|
|
|
|
return serviceDictInfoDao.findAllItemDict(Constants.ITEM_TYPE_LABEL);
|
|
|
|
|
|
}
|
2018-03-01 19:13:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-02-22 12:46:50 +08:00
|
|
|
|
|
|
|
|
|
|
}
|