Commit 0817953d authored by 赵啸非's avatar 赵啸非

删除门户无用类

parent 4523eb5c
......@@ -73,4 +73,21 @@ public class SkinBaseServiceImpl extends AbstractCRUDServiceImpl<SkinBaseDao, Sk
skinFieldService.save(entity.getSkinFieldList(), context);
}
}
@Override
protected void saveBefore(SkinBaseEntity entity, Context context) throws AppException {
//todo 合成实现css模板文件
super.saveBefore(entity, context);
}
private void genTemplateCss(SkinBaseEntity entity, Context context) {
//加载模板,合成模板数据
//更新时候删除
}
}
\ No newline at end of file
No preview for this file type
package com.mortals.xhx.module.area.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.area.model.AreaEntity;
import java.util.List;
/**
* 区域Dao
* 区域 DAO接口
*
* @author zxfei
* @date 2022-01-12
*/
public interface AreaDao extends ICRUDDao<AreaEntity,Long>{
/**
* 查询子节点
*
* @param
* @return
*/
List<AreaEntity> selectChildrenAreaById(String areaId);
}
package com.mortals.xhx.module.area.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.area.dao.AreaDao;
import com.mortals.xhx.module.area.model.AreaEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 区域DaoImpl DAO接口
*
* @author zxfei
* @date 2022-01-12
*/
@Repository("areaDao")
public class AreaDaoImpl extends BaseCRUDDaoMybatis<AreaEntity,Long> implements AreaDao {
@Override
public List<AreaEntity> selectChildrenAreaById(String areaId) {
return getSqlSession().selectList(getSqlId("selectChildrenAreaById"), areaId);
}
}
package com.mortals.xhx.module.area.model;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.area.model.vo.AreaVo;
/**
* 区域实体对象
*
* @author zxfei
* @date 2022-01-12
*/
public class AreaEntity extends AreaVo {
private static final long serialVersionUID = 1L;
/**
* 祖级列表,逗号分隔
*/
private String ancestors;
/**
* 区域名称
*/
private String name;
/**
* 一体化的ID号
*/
private String iid;
/**
* 一体化的父id
*/
private String pid;
/**
* 是否有下级区域(True.是,False.否)
*/
private String haveSonArea;
/**
* 是否有下级部门(True.是,False.否)
*/
private String haveSonDept;
/**
* 是否获取部门(true.是,false.否)
*/
private String haveGetDept;
/**
* 是否获取事项列表(true.是,false.否)
*/
private String haveGetMatterList;
/**
* 区域编码
*/
private String areaCode;
/**
* 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)
*/
private Integer areaLevel;
/**
* 名称简称
*/
private String shortName;
/**
* 访问地址
*/
private String domain;
/**
* 区域状态 (0.停用,1.正常)
*/
private Integer status;
public AreaEntity(){}
/**
* 获取 祖级列表,逗号分隔
* @return String
*/
public String getAncestors(){
return ancestors;
}
/**
* 设置 祖级列表,逗号分隔
* @param ancestors
*/
public void setAncestors(String ancestors){
this.ancestors = ancestors;
}
/**
* 获取 区域名称
* @return String
*/
public String getName(){
return name;
}
/**
* 设置 区域名称
* @param name
*/
public void setName(String name){
this.name = name;
}
/**
* 获取 一体化的ID号
* @return String
*/
public String getIid(){
return iid;
}
/**
* 设置 一体化的ID号
* @param iid
*/
public void setIid(String iid){
this.iid = iid;
}
/**
* 获取 一体化的父id
* @return String
*/
public String getPid(){
return pid;
}
/**
* 设置 一体化的父id
* @param pid
*/
public void setPid(String pid){
this.pid = pid;
}
/**
* 获取 是否有下级区域(True.是,False.否)
* @return String
*/
public String getHaveSonArea(){
return haveSonArea;
}
/**
* 设置 是否有下级区域(True.是,False.否)
* @param haveSonArea
*/
public void setHaveSonArea(String haveSonArea){
this.haveSonArea = haveSonArea;
}
/**
* 获取 是否有下级部门(True.是,False.否)
* @return String
*/
public String getHaveSonDept(){
return haveSonDept;
}
/**
* 设置 是否有下级部门(True.是,False.否)
* @param haveSonDept
*/
public void setHaveSonDept(String haveSonDept){
this.haveSonDept = haveSonDept;
}
/**
* 获取 是否获取部门(true.是,false.否)
* @return String
*/
public String getHaveGetDept(){
return haveGetDept;
}
/**
* 设置 是否获取部门(true.是,false.否)
* @param haveGetDept
*/
public void setHaveGetDept(String haveGetDept){
this.haveGetDept = haveGetDept;
}
/**
* 获取 是否获取事项列表(true.是,false.否)
* @return String
*/
public String getHaveGetMatterList(){
return haveGetMatterList;
}
/**
* 设置 是否获取事项列表(true.是,false.否)
* @param haveGetMatterList
*/
public void setHaveGetMatterList(String haveGetMatterList){
this.haveGetMatterList = haveGetMatterList;
}
/**
* 获取 区域编码
* @return String
*/
public String getAreaCode(){
return areaCode;
}
/**
* 设置 区域编码
* @param areaCode
*/
public void setAreaCode(String areaCode){
this.areaCode = areaCode;
}
/**
* 获取 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)
* @return Integer
*/
public Integer getAreaLevel(){
return areaLevel;
}
/**
* 设置 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)
* @param areaLevel
*/
public void setAreaLevel(Integer areaLevel){
this.areaLevel = areaLevel;
}
/**
* 获取 名称简称
* @return String
*/
public String getShortName(){
return shortName;
}
/**
* 设置 名称简称
* @param shortName
*/
public void setShortName(String shortName){
this.shortName = shortName;
}
/**
* 获取 访问地址
* @return String
*/
public String getDomain(){
return domain;
}
/**
* 设置 访问地址
* @param domain
*/
public void setDomain(String domain){
this.domain = domain;
}
/**
* 获取 区域状态 (0.停用,1.正常)
* @return Integer
*/
public Integer getStatus(){
return status;
}
/**
* 设置 区域状态 (0.停用,1.正常)
* @param status
*/
public void setStatus(Integer status){
this.status = status;
}
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof AreaEntity) {
AreaEntity tmp = (AreaEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",ancestors:").append(getAncestors());
sb.append(",name:").append(getName());
sb.append(",iid:").append(getIid());
sb.append(",pid:").append(getPid());
sb.append(",haveSonArea:").append(getHaveSonArea());
sb.append(",haveSonDept:").append(getHaveSonDept());
sb.append(",haveGetDept:").append(getHaveGetDept());
sb.append(",haveGetMatterList:").append(getHaveGetMatterList());
sb.append(",areaCode:").append(getAreaCode());
sb.append(",areaLevel:").append(getAreaLevel());
sb.append(",shortName:").append(getShortName());
sb.append(",domain:").append(getDomain());
sb.append(",status:").append(getStatus());
return sb.toString();
}
public void initAttrValue(){
this.ancestors = "";
this.name = null;
this.iid = null;
this.pid = null;
this.haveSonArea = null;
this.haveSonDept = null;
this.haveGetDept = null;
this.haveGetMatterList = null;
this.areaCode = null;
this.areaLevel = 1;
this.shortName = null;
this.domain = null;
this.status = 1;
}
}
\ No newline at end of file
package com.mortals.xhx.module.area.model;
import java.util.List;
import java.util.ArrayList;
import com.mortals.framework.common.code.YesNo;
import com.mortals.xhx.module.area.model.vo.AreaVo;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.mortals.xhx.module.site.model.SiteEntity;
import lombok.Data;
import java.io.Serializable;
import java.util.stream.Collectors;
/**
* 区域前端映射树结构实体类
*
* @author zxfei
* @date 2022-01-12
*/
@Data
public class AreaTreeSelect implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 节点ID
*/
private String id;
/**
* 节点名称
*/
private String label;
/**
* 区域编码
*/
private String areaCode;
/**
* 是否叶子节点
*/
private Boolean isLeaf;
/**
* 节点类型
*/
private String type;
/**
* 图标
*/
private String icon;
/**
* 子节点
*/
private List<AreaTreeSelect> children;
public AreaTreeSelect(AreaEntity entity) {
this.id = entity.getIid();
this.label = entity.getName();
if ("False".equalsIgnoreCase(entity.getHaveSonArea())) {
this.isLeaf = true;
this.children = new ArrayList();
} else {
this.isLeaf = false;
}
this.areaCode=entity.getAreaCode();
this.type = "area";
this.icon = "el-icon-folder";
}
public AreaTreeSelect(SiteEntity entity) {
this.id = entity.getId().toString();
this.label = entity.getSiteName();
this.isLeaf = true;
this.type = "site";
this.icon = "el-icon-document";
}
}
\ No newline at end of file
package com.mortals.xhx.module.area.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.area.model.AreaEntity;
import com.mortals.xhx.module.site.model.SiteEntity;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* 区域视图对象
*
* @author zxfei
* @date 2022-01-12
*/
@Data
public class AreaVo extends BaseEntityLong {
/** 子区域 */
private List<AreaEntity> children = new ArrayList<>();
}
\ No newline at end of file
package com.mortals.xhx.module.area.service;
import com.mortals.framework.service.ICRUDCacheService;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.area.model.AreaEntity;
import com.mortals.xhx.module.area.model.AreaQuery;
import com.mortals.xhx.module.area.model.AreaTreeSelect;
import java.util.List;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
/**
* AreaService
*
* 区域 service接口
*
* @author zxfei
* @date 2022-01-12
*/
public interface AreaService extends ICRUDCacheService<AreaEntity,Long> {
/**
* 是否存在区域节点
*
* @param areaId 区域ID
* @return 结果
*/
boolean hasChildByAreaId(String areaId);
/**
* 查询区域数据
*
* @param area 区域
* @return 区域集合
*/
List<AreaEntity> selectAreaList(AreaEntity area);
/**
* 构建前端所需要下拉树结构
*
* @param areaList 区域列表
* @return 下拉树结构列表
*/
List<AreaTreeSelect> buildAreaTreeSelect(List<AreaEntity> areaList);
/**
* 根据父id查询子节点
* @param parentId
* @param context
* @return
*/
List<AreaTreeSelect> getListByParentId(String parentId,Context context);
}
\ No newline at end of file
package com.mortals.xhx.module.area.service.impl;
import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
import com.mortals.xhx.module.site.model.SiteQuery;
import com.mortals.xhx.module.site.service.SiteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.common.code.SatusEnum;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.module.area.dao.AreaDao;
import com.mortals.xhx.module.area.model.AreaEntity;
import com.mortals.xhx.module.area.model.AreaQuery;
import com.mortals.xhx.module.area.service.AreaService;
import com.mortals.xhx.module.area.model.AreaTreeSelect;
import org.springframework.util.ObjectUtils;
import java.util.*;
import java.util.stream.Collectors;
/**
* AreaService
* 区域 service实现
*
* @author zxfei
* @date 2022-01-12
*/
@Service("areaService")
public class AreaServiceImpl extends AbstractCRUDCacheServiceImpl<AreaDao, AreaEntity, Long> implements AreaService {
@Autowired
private SiteService siteService;
@Override
protected String getExtKey(AreaEntity data) {
return data.getAreaCode();
}
@Override
protected void saveBefore(AreaEntity entity, Context context) throws AppException {
AreaEntity parentAreaEntity = this.selectOne(new AreaQuery().pid(entity.getPid()));
if (!ObjectUtils.isEmpty(parentAreaEntity) && SatusEnum.DISENABLE.getValue() == parentAreaEntity.getStatus()) {
throw new AppException("区域停用,不允许新增");
}
if (!ObjectUtils.isEmpty(parentAreaEntity)) {
entity.setAncestors(parentAreaEntity.getAncestors() + "," + entity.getPid());
}
super.saveBefore(entity, context);
}
@Override
protected void updateBefore(AreaEntity entity, Context context) throws AppException {
AreaEntity newParentEntity = this.selectOne(new AreaQuery().pid(entity.getPid()));
AreaEntity oldEntity = this.get(entity.getId());
if (!ObjectUtils.isEmpty(newParentEntity) && !ObjectUtils.isEmpty(oldEntity)) {
String newAncestors = newParentEntity.getAncestors() + "," + newParentEntity.getId();
String oldAncestors = oldEntity.getAncestors();
entity.setAncestors(newAncestors);
updateAreaChildren(entity.getId(), newAncestors, oldAncestors, context);
}
super.updateBefore(entity, context);
}
@Override
protected void updateAfter(AreaEntity entity, Context context) throws AppException {
if (SatusEnum.ENABLE.getValue() == entity.getStatus()) {
updateParentAreaStatus(entity, context);
}
super.updateAfter(entity, context);
}
/**
* 修改该区域的父级区域状态
*
* @param area 当前区域
*/
private void updateParentAreaStatus(AreaEntity area, Context context) {
AreaEntity areaEntity = this.selectOne(new AreaQuery().pid(area.getPid()));
areaEntity.setStatus(SatusEnum.ENABLE.getValue());
areaEntity.setUpdateTime(new Date());
areaEntity.setUpdateUser(context.getUser().getLoginName());
AreaEntity condition = new AreaEntity();
condition.setId(areaEntity.getId());
this.updateBatch(areaEntity, condition, context);
}
/**
* 修改子元素关系
*
* @param areaId 被修改的区域ID
* @param newAncestors 新的父ID集合
* @param oldAncestors 旧的父ID集合
*/
public void updateAreaChildren(Long areaId, String newAncestors, String oldAncestors, Context context) {
List<AreaEntity> children = getDao().selectChildrenAreaById(areaId.toString());
for (AreaEntity child : children) {
child.setAncestors(child.getAncestors().replace(oldAncestors, newAncestors));
}
if (children.size() > 0) {
this.updateAfter(children, context);
}
}
@Override
protected void removeBefore(Long[] ids, Context context) throws AppException {
//有子节点 禁止删除 todo
// if (hasChildByAreaId(ids[0])) {
// throw new AppException("存在下级区域,不允许删除");
// }
super.removeBefore(ids, context);
}
@Override
public boolean hasChildByAreaId(String areaId) {
List<AreaEntity> list = this.find(new AreaQuery().pid(areaId));
return list.size() > 0 ? true : false;
}
@Override
public List<AreaEntity> selectAreaList(AreaEntity area) {
return this.find(new AreaQuery());
}
@Override
public List<AreaTreeSelect> buildAreaTreeSelect(List<AreaEntity> list) {
List<AreaEntity> returnList = new ArrayList<>();
List<Long> tempList = list.stream().map(AreaEntity::getId).collect(Collectors.toList());
for (AreaEntity areaEntity : list) {
// 如果是顶级节点, 遍历该父节点的所有子节点
if (!tempList.contains(areaEntity.getPid())) {
recursionFn(list, areaEntity);
returnList.add(areaEntity);
}
}
if (returnList.isEmpty()) {
returnList = list;
}
return returnList.stream().map(AreaTreeSelect::new).collect(Collectors.toList());
}
@Override
public List<AreaTreeSelect> getListByParentId(String parentId, Context context) {
if (ObjectUtils.isEmpty(parentId)) {
parentId = "0";
}
//只做一层
List<AreaTreeSelect> collect = this.find(new AreaQuery().pid(parentId), context).stream().map(item -> new AreaTreeSelect(item)
).collect(Collectors.toList());
if ("0".equals(parentId)) {
return collect;
}
// AreaEntity areaEntity = this.selectOne(new AreaQuery().iid(parentId));
// if (!ObjectUtils.isEmpty(areaEntity)) {
// //查询当前区域是否有站点。
// List<AreaTreeSelect> collect1 = siteService.find(new SiteQuery().areaCode(areaEntity.getAreaCode()))
// .stream().map(site -> new AreaTreeSelect(site)).collect(Collectors.toList());
// collect.addAll(collect1);
//
// }
return collect;
}
/**
* 递归列表
*/
private void recursionFn(List<AreaEntity> list, AreaEntity t) {
// 得到子节点列表
List<AreaEntity> childList = getChildList(list, t);
t.setChildren(childList);
for (AreaEntity tChild : childList) {
if (hasChild(list, tChild)) {
recursionFn(list, tChild);
}
}
}
/**
* 得到子节点列表
*/
private List<AreaEntity> getChildList(List<AreaEntity> list, AreaEntity t) {
return list.stream().map(item -> {
if (!ObjectUtils.isEmpty(item.getPid()) && item.getPid() == t.getIid()) {
return item;
}
return null;
}).filter(f -> f != null).collect(Collectors.toList());
}
/**
* 判断是否有子节点
*/
private boolean hasChild(List<AreaEntity> list, AreaEntity t) {
return getChildList(list, t).size() > 0 ? true : false;
}
}
\ No newline at end of file
package com.mortals.xhx.module.area.web;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.model.Context;
import com.mortals.framework.util.StringUtils;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.framework.web.BasePhpCRUDJsonMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.area.model.AreaEntity;
import com.mortals.xhx.module.area.model.AreaQuery;
import com.mortals.xhx.module.area.model.AreaTreeSelect;
import com.mortals.xhx.module.area.service.AreaService;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
*
* 区域
*
* @author zxfei
* @date 2022-01-19
*/
@RestController
@RequestMapping("area")
public class AreaController extends BaseCRUDJsonBodyMappingController<AreaService,AreaEntity,Long> {
@Autowired
private ParamService paramService;
public AreaController(){
super.setFormClass(AreaForm.class);
super.setModuleDesc( "区域");
}
@Override
protected void init( Map<String, Object> model, Context context) {
this.addDict(model, "haveSonArea", paramService.getParamBySecondOrganize("Area","haveSonArea"));
this.addDict(model, "haveSonDept", paramService.getParamBySecondOrganize("Area","haveSonDept"));
this.addDict(model, "haveGetDept", paramService.getParamBySecondOrganize("Area","haveGetDept"));
this.addDict(model, "haveGetMatterList", paramService.getParamBySecondOrganize("Area","haveGetMatterList"));
this.addDict(model, "areaLevel", paramService.getParamBySecondOrganize("Area","areaLevel"));
this.addDict(model, "status", paramService.getParamBySecondOrganize("Area","status"));
super.init( model, context);
}
@PostMapping("list/exclude")
public String excludeList(AreaForm form) {
Map<String, Object> model = new HashMap<>();
JSONObject ret = new JSONObject();
String busiDesc = "查询" + this.getModuleDesc();
Long id = form.getId()[0];
int code=VALUE_RESULT_SUCCESS;
try {
List<AreaEntity> collect = this.service.find(new AreaQuery()).stream().map(item -> {
if (item.getId().intValue() == id || ArrayUtils.contains(StringUtils.split(item.getAncestors(), ","), id + "")) {
return null;
}
return item;
}).filter(f -> f != null).collect(Collectors.toList());
model.put("result", collect);
recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) {
code = VALUE_RESULT_FAILURE;
this.doException(request, busiDesc, model, e);
}
ret.put(KEY_RESULT_DATA, model);
ret.put(KEY_RESULT_CODE, code);
return ret.toJSONString();
}
/**
* 获取站点下拉树列表
*/
@PostMapping("treeselect")
public String treeselect() {
Map<String, Object> model = new HashMap<>();
JSONObject ret = new JSONObject();
String busiDesc = "查询" + this.getModuleDesc();
int code=VALUE_RESULT_SUCCESS;
try {
List<AreaEntity> list = this.service.find(new AreaQuery());
List<AreaTreeSelect> treeSelects = this.service.buildAreaTreeSelect(list);
model.put(KEY_RESULT_DATA, treeSelects);
recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) {
code = VALUE_RESULT_FAILURE;
this.doException(request, busiDesc, model, e);
}
ret.put(KEY_RESULT_DATA, model);
ret.put(KEY_RESULT_CODE, code);
return ret.toJSONString();
}
/**
* 根据parentId查询子信息
*/
@GetMapping(value = "getListByParentId")
public String getListByParentId(String parentId) {
JSONObject ret = new JSONObject();
Map<String, Object> model = new HashMap<>();
String busiDesc = "查询" + this.getModuleDesc()+"子节点";
try {
List<AreaTreeSelect> treeList = this.service.getListByParentId(parentId, getContext());
model.put(KEY_RESULT_DATA,treeList);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_DATA, model);
recordSysLog(request, busiDesc+"【成功】");
} catch (Exception e) {
log.error("根据parentId查询子信息错误", e);
this.doException(request, busiDesc, model, e);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, e.getMessage());
}
return ret.toJSONString();
}
}
\ No newline at end of file
package com.mortals.xhx.module.area.web;
import com.mortals.framework.web.BaseCRUDFormLong;
import com.mortals.xhx.module.area.model.AreaEntity;
import com.mortals.xhx.module.area.model.AreaQuery;
/**
* Area
*
* 区域 Form
*
* @author zxfei
* @date 2022-01-12
*/
public class AreaForm extends BaseCRUDFormLong<AreaEntity> {
private AreaEntity entity = new AreaEntity();
private AreaQuery query = new AreaQuery();
public AreaForm(){
}
@Override
public AreaEntity getEntity() {
return entity;
}
public void setArea(AreaEntity entity) {
this.entity = entity;
}
@Override
public AreaQuery getQuery() {
return query;
}
public void setQuery(AreaQuery query) {
this.query = query;
}
}
\ No newline at end of file
package com.mortals.xhx.module.business.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.business.model.BusinessEntity;
import java.util.List;
/**
* 站点业务Dao
* 站点业务 DAO接口
*
* @author zxfei
* @date 2022-01-13
*/
public interface BusinessDao extends ICRUDDao<BusinessEntity,Long>{
/**
* 查询子节点
*
* @param
* @return
*/
List<BusinessEntity> selectChildrenBusinessById(String businessId);
}
package com.mortals.xhx.module.business.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.xhx.module.business.model.BusinessMatterEntity;
import com.mortals.xhx.module.business.model.BusinessMatterQuery;
import java.util.List;
/**
* 业务事项关联Dao
* 业务事项关联 DAO接口
*
* @author zxfei
* @date 2022-01-12
*/
public interface BusinessMatterDao extends ICRUDDao<BusinessMatterEntity,Long>{
Result<BusinessMatterEntity> getListByBusiness(BusinessMatterQuery params, PageInfo pageInfo);
Result<BusinessMatterEntity> getListByMatter(BusinessMatterQuery params, PageInfo pageInfo);
}
package com.mortals.xhx.module.business.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.business.dao.BusinessDao;
import com.mortals.xhx.module.business.model.BusinessEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 站点业务DaoImpl DAO接口
*
* @author zxfei
* @date 2022-01-13
*/
@Repository("businessDao")
public class BusinessDaoImpl extends BaseCRUDDaoMybatis<BusinessEntity,Long> implements BusinessDao {
@Override
public List<BusinessEntity> selectChildrenBusinessById(String businessId) {
return getSqlSession().selectList(getSqlId("selectChildrenBusinessById"), businessId);
}
}
package com.mortals.xhx.module.business.dao.ibatis;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.xhx.module.business.model.BusinessMatterQuery;
import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.business.dao.BusinessMatterDao;
import com.mortals.xhx.module.business.model.BusinessMatterEntity;
import java.util.ArrayList;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 业务事项关联DaoImpl DAO接口
*
* @author zxfei
* @date 2022-01-12
*/
@Repository("businessMatterDao")
public class BusinessMatterDaoImpl extends BaseCRUDDaoMybatis<BusinessMatterEntity, Long> implements BusinessMatterDao {
@Override
public Result<BusinessMatterEntity> getListByBusiness(BusinessMatterQuery params, PageInfo pageInfo) {
Result<BusinessMatterEntity> result = new Result();
List list = null;
//判断是否计算总页数与总条数
int count =this.getSqlSession().selectOne(this.getSqlId("getListByBusinessCount"), getQueryParam(params));
if (count == 0) {
list = new ArrayList();
} else if (pageInfo.getPrePageResult() == -1) {
list = this.getSqlSession().selectList(this.getSqlId("getListByBusiness"), getQueryParam(params));
} else {
RowBounds rowBounds = new RowBounds(pageInfo.getBeginIndex(), pageInfo.getPrePageResult());
list = this.getSqlSession().selectList(this.getSqlId("getListByBusiness"), getQueryParam(params), rowBounds);
}
pageInfo.setTotalResult(count);
result.setPageInfo(pageInfo);
result.setList(list);
return result;
}
@Override
public Result<BusinessMatterEntity> getListByMatter(BusinessMatterQuery params, PageInfo pageInfo) {
Result<BusinessMatterEntity> result = new Result();
List list = null;
//判断是否计算总页数与总条数
int count =this.getSqlSession().selectOne(this.getSqlId("getListByMatterCount"), getQueryParam(params));
if (count == 0) {
list = new ArrayList();
} else if (pageInfo.getPrePageResult() == -1) {
list = this.getSqlSession().selectList(this.getSqlId("getListByMatter"), getQueryParam(params));
} else {
RowBounds rowBounds = new RowBounds(pageInfo.getBeginIndex(), pageInfo.getPrePageResult());
list = this.getSqlSession().selectList(this.getSqlId("getListByMatter"), getQueryParam(params), rowBounds);
}
pageInfo.setTotalResult(count);
result.setPageInfo(pageInfo);
result.setList(list);
return result;
}
}
package com.mortals.xhx.module.business.model;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.business.model.vo.BusinessVo;
/**
* 站点业务实体对象
*
* @author zxfei
* @date 2022-01-13
*/
public class BusinessEntity extends BusinessVo {
private static final long serialVersionUID = 1L;
/**
* 父级ID
*/
private Long parentId;
/**
* 祖级列表,逗号分隔
*/
private String ancestors;
/**
* 业务类型(0.一级业务,1.二级业务)
*/
private Integer isBusiness;
/**
* 业务名称
*/
private String name;
/**
* 备注
*/
private String remark;
/**
* 是否允许预约(1.允许,0.不允许)
*/
private Integer canorder;
/**
* 是否允许取号(1.允许,0.不允许)
*/
private Integer cantake;
/**
* 大厅情况展示 (1.展示,0.不展示)
*/
private Integer datashow;
/**
* 英语业务名
*/
private String englishname;
/**
* 流水编号如A、B
*/
private String flownum;
/**
* 业务状态 (0.停用,1.正常)
*/
private Integer status;
/**
* 业务类型 (0.一体化业务,1.自建业务)
*/
private Integer businessType;
public BusinessEntity(){}
/**
* 获取 父级ID
* @return Long
*/
public Long getParentId(){
return parentId;
}
/**
* 设置 父级ID
* @param parentId
*/
public void setParentId(Long parentId){
this.parentId = parentId;
}
/**
* 获取 祖级列表,逗号分隔
* @return String
*/
public String getAncestors(){
return ancestors;
}
/**
* 设置 祖级列表,逗号分隔
* @param ancestors
*/
public void setAncestors(String ancestors){
this.ancestors = ancestors;
}
/**
* 获取 业务类型(0.一级业务,1.二级业务)
* @return Integer
*/
public Integer getIsBusiness(){
return isBusiness;
}
/**
* 设置 业务类型(0.一级业务,1.二级业务)
* @param isBusiness
*/
public void setIsBusiness(Integer isBusiness){
this.isBusiness = isBusiness;
}
/**
* 获取 业务名称
* @return String
*/
public String getName(){
return name;
}
/**
* 设置 业务名称
* @param name
*/
public void setName(String name){
this.name = name;
}
/**
* 获取 备注
* @return String
*/
public String getRemark(){
return remark;
}
/**
* 设置 备注
* @param remark
*/
public void setRemark(String remark){
this.remark = remark;
}
/**
* 获取 是否允许预约(1.允许,0.不允许)
* @return Integer
*/
public Integer getCanorder(){
return canorder;
}
/**
* 设置 是否允许预约(1.允许,0.不允许)
* @param canorder
*/
public void setCanorder(Integer canorder){
this.canorder = canorder;
}
/**
* 获取 是否允许取号(1.允许,0.不允许)
* @return Integer
*/
public Integer getCantake(){
return cantake;
}
/**
* 设置 是否允许取号(1.允许,0.不允许)
* @param cantake
*/
public void setCantake(Integer cantake){
this.cantake = cantake;
}
/**
* 获取 大厅情况展示 (1.展示,0.不展示)
* @return Integer
*/
public Integer getDatashow(){
return datashow;
}
/**
* 设置 大厅情况展示 (1.展示,0.不展示)
* @param datashow
*/
public void setDatashow(Integer datashow){
this.datashow = datashow;
}
/**
* 获取 英语业务名
* @return String
*/
public String getEnglishname(){
return englishname;
}
/**
* 设置 英语业务名
* @param englishname
*/
public void setEnglishname(String englishname){
this.englishname = englishname;
}
/**
* 获取 流水编号如A、B
* @return String
*/
public String getFlownum(){
return flownum;
}
/**
* 设置 流水编号如A、B
* @param flownum
*/
public void setFlownum(String flownum){
this.flownum = flownum;
}
/**
* 获取 业务状态 (0.停用,1.正常)
* @return Integer
*/
public Integer getStatus(){
return status;
}
/**
* 设置 业务状态 (0.停用,1.正常)
* @param status
*/
public void setStatus(Integer status){
this.status = status;
}
/**
* 获取 业务类型 (0.一体化业务,1.自建业务)
* @return Integer
*/
public Integer getBusinessType(){
return businessType;
}
/**
* 设置 业务类型 (0.一体化业务,1.自建业务)
* @param businessType
*/
public void setBusinessType(Integer businessType){
this.businessType = businessType;
}
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof BusinessEntity) {
BusinessEntity tmp = (BusinessEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",parentId:").append(getParentId());
sb.append(",ancestors:").append(getAncestors());
sb.append(",isBusiness:").append(getIsBusiness());
sb.append(",name:").append(getName());
sb.append(",remark:").append(getRemark());
sb.append(",canorder:").append(getCanorder());
sb.append(",cantake:").append(getCantake());
sb.append(",datashow:").append(getDatashow());
sb.append(",englishname:").append(getEnglishname());
sb.append(",flownum:").append(getFlownum());
sb.append(",status:").append(getStatus());
sb.append(",businessType:").append(getBusinessType());
return sb.toString();
}
public void initAttrValue(){
this.parentId = null;
this.ancestors = "";
this.isBusiness =0;
this.name = null;
this.remark = null;
this.canorder = 1;
this.cantake = 1;
this.datashow = 1;
this.englishname = null;
this.flownum = null;
this.status = 1;
this.businessType = 1;
}
}
\ No newline at end of file
package com.mortals.xhx.module.business.model;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.business.model.vo.BusinessMatterVo;
/**
* 业务事项关联实体对象
*
* @author zxfei
* @date 2022-01-20
*/
public class BusinessMatterEntity extends BusinessMatterVo {
private static final long serialVersionUID = 1L;
/**
* 站点ID
*/
private Long siteId;
/**
* 站点名称
*/
private String siteName;
/**
* 业务id
*/
private Long siteBusinessId;
/**
* 业务名称
*/
private String siteBusinessName;
/**
* 事项id
*/
private Long matterId;
/**
* 事项名称
*/
private String matterName;
public BusinessMatterEntity(){}
/**
* 获取 站点ID
* @return Long
*/
public Long getSiteId(){
return siteId;
}
/**
* 设置 站点ID
* @param siteId
*/
public void setSiteId(Long siteId){
this.siteId = siteId;
}
/**
* 获取 站点名称
* @return String
*/
public String getSiteName(){
return siteName;
}
/**
* 设置 站点名称
* @param siteName
*/
public void setSiteName(String siteName){
this.siteName = siteName;
}
/**
* 获取 业务id
* @return Long
*/
public Long getSiteBusinessId(){
return siteBusinessId;
}
/**
* 设置 业务id
* @param siteBusinessId
*/
public void setSiteBusinessId(Long siteBusinessId){
this.siteBusinessId = siteBusinessId;
}
/**
* 获取 业务名称
* @return String
*/
public String getSiteBusinessName(){
return siteBusinessName;
}
/**
* 设置 业务名称
* @param siteBusinessName
*/
public void setSiteBusinessName(String siteBusinessName){
this.siteBusinessName = siteBusinessName;
}
/**
* 获取 事项id
* @return Long
*/
public Long getMatterId(){
return matterId;
}
/**
* 设置 事项id
* @param matterId
*/
public void setMatterId(Long matterId){
this.matterId = matterId;
}
/**
* 获取 事项名称
* @return String
*/
public String getMatterName(){
return matterName;
}
/**
* 设置 事项名称
* @param matterName
*/
public void setMatterName(String matterName){
this.matterName = matterName;
}
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof BusinessMatterEntity) {
BusinessMatterEntity tmp = (BusinessMatterEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",siteId:").append(getSiteId());
sb.append(",siteName:").append(getSiteName());
sb.append(",siteBusinessId:").append(getSiteBusinessId());
sb.append(",siteBusinessName:").append(getSiteBusinessName());
sb.append(",matterId:").append(getMatterId());
sb.append(",matterName:").append(getMatterName());
return sb.toString();
}
public void initAttrValue(){
this.siteId = null;
this.siteName = null;
this.siteBusinessId = null;
this.siteBusinessName = null;
this.matterId = null;
this.matterName = null;
}
}
\ No newline at end of file
package com.mortals.xhx.module.business.model;
import java.util.List;
import java.util.ArrayList;
import com.mortals.xhx.module.business.model.vo.BusinessVo;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.io.Serializable;
import java.util.stream.Collectors;
/**
* 站点业务前端映射树结构实体类
*
* @author zxfei
* @date 2022-01-13
*/
@Data
public class BusinessTreeSelect implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 节点ID
*/
private Long id;
/**
* 节点名称
*/
private String label;
/**
* 子节点
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<BusinessTreeSelect> children;
public BusinessTreeSelect(BusinessEntity entity) {
this.id = entity.getId();
this.label = entity.getName();
this.children = entity.getChildren().stream().map(BusinessTreeSelect::new).collect(Collectors.toList());
}
}
\ No newline at end of file
package com.mortals.xhx.module.business.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.business.model.BusinessMatterEntity;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* 业务事项关联视图对象
*
* @author zxfei
* @date 2022-01-12
*/
@Data
public class BusinessMatterVo extends BaseEntityLong {
}
\ No newline at end of file
package com.mortals.xhx.module.business.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.business.model.BusinessEntity;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* 站点业务视图对象
*
* @author zxfei
* @date 2022-01-13
*/
@Data
public class BusinessVo extends BaseEntityLong {
/** 子站点业务 */
private List<BusinessEntity> children = new ArrayList<>();
}
\ No newline at end of file
package com.mortals.xhx.module.business.service;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.business.model.BusinessMatterEntity;
import com.mortals.xhx.module.business.model.BusinessMatterQuery;
/**
* BusinessMatterService
*
* 业务事项关联 service接口
*
* @author zxfei
* @date 2022-01-12
*/
public interface BusinessMatterService extends ICRUDService<BusinessMatterEntity,Long>{
Result<BusinessMatterEntity> getListByBusiness(BusinessMatterQuery query, PageInfo pageInfo, Context context);
Result<BusinessMatterEntity> getListByMatter(BusinessMatterQuery query, PageInfo pageInfo, Context context);
}
\ No newline at end of file
package com.mortals.xhx.module.business.service;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.service.ICRUDCacheService;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.business.model.BusinessEntity;
import com.mortals.xhx.module.business.model.BusinessTreeSelect;
import java.util.List;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import org.springframework.web.bind.annotation.RequestParam;
/**
* BusinessService
*
* 站点业务 service接口
*
* @author zxfei
* @date 2022-01-13
*/
public interface BusinessService extends ICRUDCacheService<BusinessEntity,Long> {
/**
* 添加业务到站点
* @param businessIds
* @param siteId
* @param context
*/
void addBusinessToSite(String businessIds, Long siteId,Context context);
Result<BusinessEntity> flatList(BusinessEntity query, PageInfo pageInfo, Context context);
}
\ No newline at end of file
package com.mortals.xhx.module.dept.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.dept.model.DeptEntity;
import java.util.List;
/**
* 部门Dao
* 部门 DAO接口
*
* @author zxfei
* @date 2022-01-12
*/
public interface DeptDao extends ICRUDDao<DeptEntity,Long>{
}
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