导入及树图修改

This commit is contained in:
zhangheng 2024-02-27 15:13:42 +08:00
parent 500720f8b5
commit df838d2b3b
21 changed files with 743 additions and 286 deletions

View File

@ -134,8 +134,23 @@ public class Constants {
public static final String[] JOB_ERROR_STR = {"java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
"org.springframework", "org.apache", "com.xinelu.common.utils.file"};
/**
* Excel文件格式后缀
*/
public static final String XLSX = "xlsx";
/**
* Excel文件格式后缀
*/
public static final String XLS = "xls";
/**
* 机构类别编码前缀
*/
public static final String CATEGORY_CODE = "CC";
/**
* 机构信息导入标识
*/
public static final String AGENCY = "agency";
}

View File

@ -0,0 +1,63 @@
package com.xinelu.common.utils.regex;
import com.xinelu.common.exception.ServiceException;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import java.util.regex.Pattern;
/**
* @Description 正则表达式工具类
* @Author 纪寒
* @Date 2022-08-24 13:58:48
* @Version 1.0
*/
@Component
public class RegexUtil {
/**
* 校验手机号码
*
* @param phone 手机号码
* @return 校验结果
*/
public boolean regexPhone(String phone) {
if (StringUtils.isBlank(phone)) {
throw new ServiceException("手机号码不能为空!");
}
//校验手机号
String regex = "^(((13[0-9]{1})|(14[0-9]{1})|(15[0-9]{1})|(16[2567]{1})|(17[0-9]{1})|(18[0-9]{1})|(19[0-9]{1}))+\\d{8})$";
return Pattern.matches(regex, phone);
}
/**
* 校验身份证号码
*
* @param cardNo 身份证号码
* @return 校验结果
*/
public boolean regexCardNo(String cardNo) {
if (StringUtils.isBlank(cardNo)) {
throw new ServiceException("身份证号不能为空!");
}
//校验身份证号码
String regex = "(^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|" +
"(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)";
return Pattern.matches(regex, cardNo);
}
/**
* 校验座机手机号码
*
* @param seatNumber 座机手机号码
* @return 校验结果
*/
public boolean regexSeatNumber(String seatNumber) {
if (StringUtils.isBlank(seatNumber)) {
throw new ServiceException("手机号码不能为空!");
}
//校验座机手机号
String regex = "^(([0-9]{4,13}))";
return Pattern.matches(regex, seatNumber);
}
}

View File

@ -1,6 +1,7 @@
package com.xinelu.manage.controller.agency;
import com.xinelu.common.annotation.Log;
import com.xinelu.common.constant.Constants;
import com.xinelu.common.core.controller.BaseController;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.core.page.TableDataInfo;
@ -8,12 +9,15 @@ import com.xinelu.common.enums.BusinessType;
import com.xinelu.common.utils.poi.ExcelUtil;
import com.xinelu.manage.domain.agency.Agency;
import com.xinelu.manage.service.agency.IAgencyService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Objects;
/**
* 机构信息Controller
@ -96,4 +100,29 @@ public class AgencyController extends BaseController {
public AjaxResult agencyList() {
return AjaxResult.success(agencyService.agencyList());
}
/**
* 导入机构信息
*
* @param file 模板文件
* @return 导入结果
* @throws Exception 异常信息
*/
@PreAuthorize("@ss.hasPermi('system:agency:importStationInfo')")
@Log(title = "导入机构信息", businessType = BusinessType.IMPORT)
@PostMapping("/insertAgencyImportList")
public AjaxResult insertAgencyImportList(MultipartFile file) throws Exception {
//判断excel里面是否有数据/文件格式
if (Objects.isNull(file) || StringUtils.isBlank(file.getOriginalFilename())) {
return AjaxResult.error("请选择需要导入的文件!");
}
// 获取文件名
String orgName = file.getOriginalFilename();
if (!orgName.endsWith(Constants.XLSX) && !orgName.endsWith(Constants.XLS)) {
return AjaxResult.error("导入文件格式不正确请导入xlsx或xls格式的文件");
}
ExcelUtil<Agency> util = new ExcelUtil<>(Agency.class);
List<Agency> list = util.importExcel(file.getInputStream());
return agencyService.insertAgencyImportList(list);
}
}

View File

@ -0,0 +1,56 @@
package com.xinelu.manage.controller.importdownload;
import com.xinelu.common.constant.Constants;
import com.xinelu.common.exception.ServiceException;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.util.Objects;
/**
* 导入与下载Controller
*
* @author zh
* @date 2024-02-26
*/
@RestController
@RequestMapping("/system/importDownload")
public class ImportDownloadController {
/**
* 下载导入模板
*
* @param fileType 文件类型
* @param res http请求
**/
@RequestMapping("downloadTemplate")
public void download(@RequestParam(value = "fileType") String fileType, HttpServletResponse res) throws IOException {
if (StringUtils.isBlank(fileType)) {
throw new ServiceException("请选择文件类型!");
}
File file = null;
if (fileType.equals(Constants.AGENCY)) {
file = ResourceUtils.getFile("classpath:template/机构信息导入表.xlsx");
}
if (Objects.isNull(file)) {
throw new ServiceException("下载导入模板文件失败,请联系管理员!");
}
res.setCharacterEncoding("UTF-8");
res.setHeader("Content-Disposition", "inline;filename=" + fileType + ".txt");
res.setContentType("text/plain;UTF-8");
ServletOutputStream os = res.getOutputStream();
byte[] bytes = FileUtils.readFileToByteArray(file);
os.write(bytes);
os.flush();
os.close();
}
}

View File

@ -11,9 +11,6 @@ import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.ArrayList;
import java.util.List;
/**
* 机构信息对象 agency
*
@ -37,14 +34,14 @@ public class Agency extends BaseEntity {
* 上级机构id
*/
@ApiModelProperty(value = "上级机构id")
@Excel(name = "上级机构id")
@Excel(name = "上级机构")
private Long parentId;
/**
* 所属机构类别id
*/
@ApiModelProperty(value = "所属机构类别id")
@Excel(name = "所属机构类别id")
@Excel(name = "所属机构类别")
private Long agencyCategoryId;
/**
@ -100,7 +97,7 @@ public class Agency extends BaseEntity {
* 节点类型节点类型卫健委HEALTH_COMMISSION医保局MEDICAL_INSURANCE_BUREAU医院HOSPITAL院区CAMPUS药店PHARMACY科室DEPARTMENT病区WARD中国CHINA省份PROVINCE
*/
@ApiModelProperty(value = "节点类型节点类型卫健委HEALTH_COMMISSION医保局MEDICAL_INSURANCE_BUREAU医院HOSPITAL院区CAMPUS药店PHARMACY科室DEPARTMENT病区WARD中国CHINA省份PROVINCE")
@Excel(name = "节点类型节点类型卫健委HEALTH_COMMISSION医保局MEDICAL_INSURANCE_BUREAU医院HOSPITAL院区CAMPUS药店PHARMACY科室DEPARTMENT病区WARD中国CHINA省份PROVINCE")
@Excel(name = "节点类型")
private String nodeType;
/**
@ -114,7 +111,7 @@ public class Agency extends BaseEntity {
* 机构分类管理类别非营利性医疗机构NON_PROFIT_MEDICAL_AGENCY营利性医疗机构FOR_PROFIT_MEDICAL_AGENCY其他卫生机构OTHER_HEALTH_AGENCY
*/
@ApiModelProperty(value = "机构分类管理类别非营利性医疗机构NON_PROFIT_MEDICAL_AGENCY营利性医疗机构FOR_PROFIT_MEDICAL_AGENCY其他卫生机构OTHER_HEALTH_AGENCY")
@Excel(name = "机构分类管理类别非营利性医疗机构NON_PROFIT_MEDICAL_AGENCY营利性医疗机构FOR_PROFIT_MEDICAL_AGENCY其他卫生机构OTHER_HEALTH_AGENCY")
@Excel(name = "机构分类管理类别")
private String agencyCategoryManageLevel;
/**
@ -152,17 +149,6 @@ public class Agency extends BaseEntity {
@Excel(name = "机构排序")
private Integer agencySort;
private List<Agency> children = new ArrayList<Agency>();
public List<Agency> getChildren() {
return children;
}
public void setChildren(List<Agency> children) {
this.children = children;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -11,9 +11,6 @@ import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.ArrayList;
import java.util.List;
/**
* 机构类别对象 agency_category
*
@ -75,18 +72,6 @@ public class AgencyCategory extends BaseEntity {
@Excel(name = "类别概述")
private String categoryRemark;
private List<AgencyCategory> children = new ArrayList<AgencyCategory>();
public List<AgencyCategory> getChildren() {
return children;
}
public void setChildren(List<AgencyCategory> children) {
this.children = children;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -2,6 +2,7 @@ package com.xinelu.manage.mapper.agency;
import com.xinelu.manage.domain.agency.Agency;
import com.xinelu.manage.vo.agency.AgencyVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -37,6 +38,14 @@ public interface AgencyMapper {
*/
List<Agency> selectAgencyList(Agency agency);
/**
* 查询机构信息列表
*
* @param agency 机构信息
* @return 机构信息集合
*/
List<AgencyVO> selectAgencyVOList(Agency agency);
/**
* 新增机构信息
*
@ -68,4 +77,20 @@ public interface AgencyMapper {
* @return 结果
*/
int deleteAgencyByIds(Long[] ids);
/**
* 查询所有的机构信息
*
* @param agencyNames 机构信息集合
* @return 列表集合信息
*/
List<Agency> getAllAgencyInfo(@Param("agencyNames") List<String> agencyNames);
/**
* 机构信息导入
*
* @param agencyList 机构信息
* @return int
**/
int insertAgencyImportList(List<Agency> agencyList);
}

View File

@ -1,6 +1,7 @@
package com.xinelu.manage.mapper.agencycategory;
import com.xinelu.manage.domain.agencycategory.AgencyCategory;
import com.xinelu.manage.vo.agencycategory.AgencyCategoryVO;
import java.util.List;
@ -28,6 +29,14 @@ public interface AgencyCategoryMapper {
*/
List<AgencyCategory> selectAgencyCategoryList(AgencyCategory agencyCategory);
/**
* 查询机构类别列表
*
* @param agencyCategory 机构类别
* @return 机构类别集合
*/
List<AgencyCategoryVO> selectAgencyCategoryVOList(AgencyCategory agencyCategory);
/**
* 新增机构类别
*

View File

@ -1,7 +1,9 @@
package com.xinelu.manage.service.agency;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.manage.domain.agency.Agency;
import com.xinelu.manage.vo.agency.AgencyTreeVO;
import com.xinelu.manage.vo.agency.AgencyVO;
import java.util.List;
@ -19,7 +21,7 @@ public interface IAgencyService {
* @param id 机构信息主键
* @return 机构信息
*/
Agency selectAgencyById(Long id);
AgencyVO selectAgencyById(Long id);
/**
* 查询机构信息列表
@ -67,4 +69,13 @@ public interface IAgencyService {
* @return AgencyVO
*/
List<AgencyTreeVO> agencyList();
/**
* 机构信息导入
*
* @param agencyList 机构信息
* @return int
**/
AjaxResult insertAgencyImportList(List<Agency> agencyList);
}

View File

@ -1,15 +1,27 @@
package com.xinelu.manage.service.agency.impl;
import com.xinelu.common.constant.Constants;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.utils.DateUtils;
import com.xinelu.common.utils.SecurityUtils;
import com.xinelu.common.utils.StringUtils;
import com.xinelu.common.utils.bean.BeanUtils;
import com.xinelu.common.utils.codes.GenerateSystemCodeUtil;
import com.xinelu.common.utils.regex.RegexUtil;
import com.xinelu.manage.domain.agency.Agency;
import com.xinelu.manage.mapper.agency.AgencyMapper;
import com.xinelu.manage.service.agency.IAgencyService;
import com.xinelu.manage.vo.agency.AgencyTreeVO;
import com.xinelu.manage.vo.agency.AgencyVO;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
@ -25,6 +37,10 @@ import java.util.stream.Collectors;
public class AgencyServiceImpl implements IAgencyService {
@Resource
private AgencyMapper agencyMapper;
@Resource
private RegexUtil regexUtil;
@Resource
private GenerateSystemCodeUtil generateSystemCodeUtil;
/**
* 查询机构信息
@ -33,8 +49,8 @@ public class AgencyServiceImpl implements IAgencyService {
* @return 机构信息
*/
@Override
public Agency selectAgencyById(Long id) {
return agencyMapper.selectAgencyById(id);
public AgencyVO selectAgencyById(Long id) {
return agencyMapper.selectAgencyVOById(id);
}
/**
@ -101,18 +117,65 @@ public class AgencyServiceImpl implements IAgencyService {
*/
@Override
public List<AgencyTreeVO> agencyList() {
List<Agency> agencies = agencyMapper.selectAgencyList(null);
List<Agency> agenciesTree = buildDeptTree(agencies);
List<AgencyVO> agencies = agencyMapper.selectAgencyVOList(null);
for (AgencyVO agency : agencies) {
agency.setValue(agency.getId().toString());
}
List<AgencyVO> agenciesTree = buildDeptTree(agencies);
return agenciesTree.stream().map(AgencyTreeVO::new).collect(Collectors.toList());
}
public List<Agency> buildDeptTree(List<Agency> agencies) {
List<Agency> returnList = new ArrayList<Agency>();
/**
* 机构信息导入
*
* @param agencyList 机构信息
* @return 导入结果
**/
@Transactional(rollbackFor = Exception.class)
@Override
public AjaxResult insertAgencyImportList(List<Agency> agencyList) {
//判断添加的数据是否为空
if (CollectionUtils.isEmpty(agencyList)) {
return AjaxResult.error("请添加机构导入信息!");
}
//根据护理站名称做去除处理
List<Agency> importDataList = agencyList.stream().filter(item -> StringUtils.isNotBlank(item.getAgencyName())).distinct().collect(Collectors.toList());
//校验联系电话格式是否正确
Agency agency = importDataList.stream().filter(item -> StringUtils.isNotBlank(item.getAgencyPhone())).filter(item -> BooleanUtils.isFalse(regexUtil.regexPhone(item.getAgencyPhone()))).findFirst().orElse(new Agency());
if (StringUtils.isNotBlank(agency.getAgencyPhone())) {
return AjaxResult.error("当前机构联系电话:" + agency.getAgencyPhone() + " 格式不正确,请重新录入!");
}
List<String> agencyNames = importDataList.stream().filter(item -> StringUtils.isNotBlank(item.getAgencyName())).map(Agency::getAgencyName).distinct().collect(Collectors.toList());
//根据名称查询护理站基本信息
List<Agency> allNurseStationInfo = agencyMapper.getAllAgencyInfo(agencyNames);
//做差集去除数据库中已经存在的护理站信息
List<Agency> subtractList = new ArrayList<>(CollectionUtils.subtract(importDataList, allNurseStationInfo));
if (CollectionUtils.isEmpty(subtractList)) {
return AjaxResult.success();
}
List<Agency> saveAgencyList = new ArrayList<>();
for (Agency item : subtractList) {
item.setCreateBy(SecurityUtils.getUsername());
item.setCreateTime(new Date());
item.setAgencyCode(Constants.CATEGORY_CODE + generateSystemCodeUtil.generateSystemCode(Constants.CATEGORY_CODE));
Agency nurseStations = new Agency();
BeanUtils.copyProperties(item, nurseStations);
saveAgencyList.add(nurseStations);
}
int insertCount = agencyMapper.insertAgencyImportList(saveAgencyList);
if (insertCount <= 0) {
throw new ServiceException("导入护理站信息失败,请联系管理员!");
}
return AjaxResult.success();
}
public List<AgencyVO> buildDeptTree(List<AgencyVO> agencies) {
List<AgencyVO> returnList = new ArrayList<AgencyVO>();
List<Long> tempList = new ArrayList<Long>();
for (Agency agency : agencies) {
for (AgencyVO agency : agencies) {
tempList.add(agency.getId());
}
for (Agency agency : agencies) {
for (AgencyVO agency : agencies) {
// 如果是顶级节点, 遍历该父节点的所有子节点
if (!tempList.contains(agency.getParentId())) {
recursionFn(agencies, agency);
@ -125,22 +188,22 @@ public class AgencyServiceImpl implements IAgencyService {
return returnList;
}
private void recursionFn(List<Agency> list, Agency t) {
private void recursionFn(List<AgencyVO> list, AgencyVO t) {
// 得到子节点列表
List<Agency> childList = getChildList(list, t);
List<AgencyVO> childList = getChildList(list, t);
t.setChildren(childList);
for (Agency tChild : childList) {
for (AgencyVO tChild : childList) {
if (hasChild(list, tChild)) {
recursionFn(list, tChild);
}
}
}
private List<Agency> getChildList(List<Agency> list, Agency t) {
List<Agency> tlist = new ArrayList<Agency>();
Iterator<Agency> it = list.iterator();
private List<AgencyVO> getChildList(List<AgencyVO> list, AgencyVO t) {
List<AgencyVO> tlist = new ArrayList<AgencyVO>();
Iterator<AgencyVO> it = list.iterator();
while (it.hasNext()) {
Agency n = (Agency) it.next();
AgencyVO n = (AgencyVO) it.next();
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getId().longValue()) {
tlist.add(n);
}
@ -151,7 +214,7 @@ public class AgencyServiceImpl implements IAgencyService {
/**
* 判断是否有子节点
*/
private boolean hasChild(List<Agency> list, Agency t) {
private boolean hasChild(List<AgencyVO> list, AgencyVO t) {
return getChildList(list, t).size() > 0;
}
}

View File

@ -2,7 +2,7 @@ package com.xinelu.manage.service.agencycategory;
import com.xinelu.manage.domain.agencycategory.AgencyCategory;
import com.xinelu.manage.vo.agencycategory.AgencyCategoryVO;
import com.xinelu.manage.vo.agencycategory.AgencyCategoryTreeVO;
import java.util.List;
@ -66,5 +66,5 @@ public interface IAgencyCategoryService {
*
* @return AgencyVO
*/
List<AgencyCategoryVO> agencyCategoryList();
List<AgencyCategoryTreeVO> agencyCategoryList();
}

View File

@ -8,6 +8,7 @@ import com.xinelu.common.utils.codes.GenerateSystemCodeUtil;
import com.xinelu.manage.domain.agencycategory.AgencyCategory;
import com.xinelu.manage.mapper.agencycategory.AgencyCategoryMapper;
import com.xinelu.manage.service.agencycategory.IAgencyCategoryService;
import com.xinelu.manage.vo.agencycategory.AgencyCategoryTreeVO;
import com.xinelu.manage.vo.agencycategory.AgencyCategoryVO;
import org.springframework.stereotype.Service;
@ -111,19 +112,19 @@ public class AgencyCategoryServiceImpl implements IAgencyCategoryService {
* @return AgencyCategoryVO
*/
@Override
public List<AgencyCategoryVO> agencyCategoryList() {
List<AgencyCategory> agencyCategoryList = agencyCategoryMapper.selectAgencyCategoryList(null);
List<AgencyCategory> agencyTree = buildDeptTree(agencyCategoryList);
return agencyTree.stream().map(AgencyCategoryVO::new).collect(Collectors.toList());
public List<AgencyCategoryTreeVO> agencyCategoryList() {
List<AgencyCategoryVO> agencyCategoryList = agencyCategoryMapper.selectAgencyCategoryVOList(null);
List<AgencyCategoryVO> agencyTree = buildDeptTree(agencyCategoryList);
return agencyTree.stream().map(AgencyCategoryTreeVO::new).collect(Collectors.toList());
}
public List<AgencyCategory> buildDeptTree(List<AgencyCategory> agencyCategoryList) {
List<AgencyCategory> returnList = new ArrayList<AgencyCategory>();
public List<AgencyCategoryVO> buildDeptTree(List<AgencyCategoryVO> agencyCategoryList) {
List<AgencyCategoryVO> returnList = new ArrayList<AgencyCategoryVO>();
List<Long> tempList = new ArrayList<Long>();
for (AgencyCategory agencyCategory : agencyCategoryList) {
for (AgencyCategoryVO agencyCategory : agencyCategoryList) {
tempList.add(agencyCategory.getId());
}
for (AgencyCategory agencyCategory : agencyCategoryList) {
for (AgencyCategoryVO agencyCategory : agencyCategoryList) {
// 如果是顶级节点, 遍历该父节点的所有子节点
if (!tempList.contains(agencyCategory.getParentCategoryId())) {
recursionFn(agencyCategoryList, agencyCategory);
@ -136,22 +137,22 @@ public class AgencyCategoryServiceImpl implements IAgencyCategoryService {
return returnList;
}
private void recursionFn(List<AgencyCategory> list, AgencyCategory t) {
private void recursionFn(List<AgencyCategoryVO> list, AgencyCategoryVO t) {
// 得到子节点列表
List<AgencyCategory> childList = getChildList(list, t);
List<AgencyCategoryVO> childList = getChildList(list, t);
t.setChildren(childList);
for (AgencyCategory tChild : childList) {
for (AgencyCategoryVO tChild : childList) {
if (hasChild(list, tChild)) {
recursionFn(list, tChild);
}
}
}
private List<AgencyCategory> getChildList(List<AgencyCategory> list, AgencyCategory t) {
List<AgencyCategory> tlist = new ArrayList<AgencyCategory>();
Iterator<AgencyCategory> it = list.iterator();
private List<AgencyCategoryVO> getChildList(List<AgencyCategoryVO> list, AgencyCategoryVO t) {
List<AgencyCategoryVO> tlist = new ArrayList<AgencyCategoryVO>();
Iterator<AgencyCategoryVO> it = list.iterator();
while (it.hasNext()) {
AgencyCategory n = (AgencyCategory) it.next();
AgencyCategoryVO n = (AgencyCategoryVO) it.next();
if (StringUtils.isNotNull(n.getParentCategoryId()) && n.getParentCategoryId().longValue() == t.getId().longValue()) {
tlist.add(n);
}
@ -162,7 +163,7 @@ public class AgencyCategoryServiceImpl implements IAgencyCategoryService {
/**
* 判断是否有子节点
*/
private boolean hasChild(List<AgencyCategory> list, AgencyCategory t) {
private boolean hasChild(List<AgencyCategoryVO> list, AgencyCategoryVO t) {
return getChildList(list, t).size() > 0;
}
}

View File

@ -0,0 +1,10 @@
package com.xinelu.manage.service.importdownload;
/**
* 导入Service接口
*
* @author xinelu
* @date 2024-02-26
*/
public interface ImportDownloadService {
}

View File

@ -0,0 +1,15 @@
package com.xinelu.manage.service.importdownload.impl;
import com.xinelu.manage.service.importdownload.ImportDownloadService;
import org.springframework.stereotype.Service;
/**
* 导入Service业务层处理
*
* @author xinelu
* @date 2024-02-26
*/
@Service
public class ImportDownloadServiceImpl implements ImportDownloadService {
}

View File

@ -1,8 +1,6 @@
package com.xinelu.manage.vo.agency;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.xinelu.common.core.domain.entity.SysMenu;
import com.xinelu.manage.domain.agency.Agency;
import java.io.Serializable;
import java.util.List;
@ -27,6 +25,11 @@ public class AgencyTreeVO implements Serializable {
*/
private String label;
/**
* 节点名称
*/
private String value;
/**
* 子节点
*/
@ -37,18 +40,13 @@ public class AgencyTreeVO implements Serializable {
}
public AgencyTreeVO(Agency agency) {
public AgencyTreeVO(AgencyVO agency) {
this.id = agency.getId();
this.label = agency.getAgencyName();
this.value = agency.getValue();
this.children = agency.getChildren().stream().map(AgencyTreeVO::new).collect(Collectors.toList());
}
public AgencyTreeVO(SysMenu menu) {
this.id = menu.getMenuId();
this.label = menu.getMenuName();
this.children = menu.getChildren().stream().map(AgencyTreeVO::new).collect(Collectors.toList());
}
public Long getId() {
return id;
}
@ -65,6 +63,14 @@ public class AgencyTreeVO implements Serializable {
this.label = label;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public List<AgencyTreeVO> getChildren() {
return children;
}

View File

@ -1,6 +1,11 @@
package com.xinelu.manage.vo.agency;
import com.xinelu.manage.domain.agency.Agency;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.ArrayList;
import java.util.List;
/**
* 机构树图信息对象vo agency
@ -8,8 +13,25 @@ import com.xinelu.manage.domain.agency.Agency;
* @author xinelu
* @date 2024-02-26
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class AgencyVO extends Agency {
private String a;
/**
* 上级机构
*/
private String parentAgencyName;
private String value;
private List<AgencyVO> children = new ArrayList<AgencyVO>();
public List<AgencyVO> getChildren() {
return children;
}
public void setChildren(List<AgencyVO> children) {
this.children = children;
}
}

View File

@ -0,0 +1,69 @@
package com.xinelu.manage.vo.agencycategory;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
public class AgencyCategoryTreeVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 节点ID
*/
private Long id;
/**
* 节点名称
*/
private String label;
private String value;
/**
* 子节点
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<AgencyCategoryTreeVO> children;
public AgencyCategoryTreeVO(AgencyCategoryVO agencyCategory) {
this.id = agencyCategory.getId();
this.label = agencyCategory.getCategoryName();
this.value = agencyCategory.getValue();
this.children = agencyCategory.getChildren().stream().map(AgencyCategoryTreeVO::new).collect(Collectors.toList());
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public List<AgencyCategoryTreeVO> getChildren() {
return children;
}
public void setChildren(List<AgencyCategoryTreeVO> children) {
this.children = children;
}
}

View File

@ -1,43 +1,25 @@
package com.xinelu.manage.vo.agencycategory;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.xinelu.manage.domain.agencycategory.AgencyCategory;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
public class AgencyCategoryVO implements Serializable {
@EqualsAndHashCode(callSuper = true)
@Data
public class AgencyCategoryVO extends AgencyCategory {
private static final long serialVersionUID = 1L;
private String value;
/**
* 节点ID
*/
private Long id;
private List<AgencyCategoryVO> children = new ArrayList<AgencyCategoryVO>();
/**
* 节点名称
*/
private String label;
/**
* 子节点
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<AgencyCategoryVO> children;
public AgencyCategoryVO(AgencyCategory agencyCategory) {
this.id = agencyCategory.getId();
this.label = agencyCategory.getCategoryName();
this.children = agencyCategory.getChildren().stream().map(AgencyCategoryVO::new).collect(Collectors.toList());
public List<AgencyCategoryVO> getChildren() {
return children;
}
public Long getId() {
return id;
public void setChildren(List<AgencyCategoryVO> children) {
this.children = children;
}
public void setId(Long id) {
this.id = id;
}
}
}

View File

@ -5,32 +5,54 @@
<mapper namespace="com.xinelu.manage.mapper.agency.AgencyMapper">
<resultMap type="Agency" id="AgencyResult">
<result property="id" column="id"/>
<result property="parentId" column="parent_id"/>
<result property="agencyCategoryId" column="agency_category_id"/>
<result property="agencyCategoryName" column="agency_category_name"/>
<result property="areaCode" column="area_code"/>
<result property="areaName" column="area_name"/>
<result property="agencyName" column="agency_name"/>
<result property="agencyCode" column="agency_code"/>
<result property="agencyAbbreviation" column="agency_abbreviation"/>
<result property="agencyStatus" column="agency_status"/>
<result property="nodeType" column="node_type"/>
<result property="orgAgencyCode" column="org_agency_code"/>
<result property="agencyCategoryManageLevel" column="agency_category_manage_level"/>
<result property="agencyContacts" column="agency_contacts"/>
<result property="agencyPhone" column="agency_phone"/>
<result property="agencyAddress" column="agency_address"/>
<result property="agencyRemark" column="agency_remark"/>
<result property="agencySort" column="agency_sort"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="id" column="id"/>
<result property="parentId" column="parent_id"/>
<result property="agencyCategoryId" column="agency_category_id"/>
<result property="agencyCategoryName" column="agency_category_name"/>
<result property="areaCode" column="area_code"/>
<result property="areaName" column="area_name"/>
<result property="agencyName" column="agency_name"/>
<result property="agencyCode" column="agency_code"/>
<result property="agencyAbbreviation" column="agency_abbreviation"/>
<result property="agencyStatus" column="agency_status"/>
<result property="nodeType" column="node_type"/>
<result property="orgAgencyCode" column="org_agency_code"/>
<result property="agencyCategoryManageLevel" column="agency_category_manage_level"/>
<result property="agencyContacts" column="agency_contacts"/>
<result property="agencyPhone" column="agency_phone"/>
<result property="agencyAddress" column="agency_address"/>
<result property="agencyRemark" column="agency_remark"/>
<result property="agencySort" column="agency_sort"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectAgencyVo">
select id, parent_id, agency_category_id, agency_category_name, area_code, area_name, agency_name, agency_code, agency_abbreviation, agency_status, node_type, org_agency_code, agency_category_manage_level, agency_contacts, agency_phone, agency_address, agency_remark, agency_sort, create_by, create_time, update_by, update_time from agency
select id,
parent_id,
agency_category_id,
agency_category_name,
area_code,
area_name,
agency_name,
agency_code,
agency_abbreviation,
agency_status,
node_type,
org_agency_code,
agency_category_manage_level,
agency_contacts,
agency_phone,
agency_address,
agency_remark,
agency_sort,
create_by,
create_time,
update_by,
update_time
from agency
</sql>
<select id="selectAgencyList" parameterType="Agency" resultMap="AgencyResult">
@ -90,14 +112,19 @@
</where>
</select>
<select id="selectAgencyVOList" resultType="com.xinelu.manage.vo.agency.AgencyVO">
<include refid="selectAgencyVo"/>
</select>
<select id="selectAgencyById" parameterType="Long"
resultMap="AgencyResult">
<include refid="selectAgencyVo"/>
where id = #{id}
<include refid="selectAgencyVo"/>
where id = #{id}
</select>
<select id="selectAgencyVOById" resultType="com.xinelu.manage.vo.agency.AgencyVO">
select id,
parent_id,
ay.parent_id,
agency_category_id,
agency_category_name,
area_code,
@ -114,177 +141,178 @@
agency_address,
agency_remark,
agency_sort,
(select agency_name from agency where id = parent_id)
from agency
(select agency_name from agency where id = ay.parent_id) AS parentAgencyName
from agency ay
where id = #{id}
</select>
<insert id="insertAgency" parameterType="Agency" useGeneratedKeys="true"
keyProperty="id">
insert into agency
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="parentId != null">parent_id,
</if>
<if test="agencyCategoryId != null">agency_category_id,
</if>
<if test="agencyCategoryName != null">agency_category_name,
</if>
<if test="areaCode != null">area_code,
</if>
<if test="areaName != null">area_name,
</if>
<if test="agencyName != null">agency_name,
</if>
<if test="agencyCode != null">agency_code,
</if>
<if test="agencyAbbreviation != null">agency_abbreviation,
</if>
<if test="agencyStatus != null">agency_status,
</if>
<if test="nodeType != null">node_type,
</if>
<if test="orgAgencyCode != null">org_agency_code,
</if>
<if test="agencyCategoryManageLevel != null">agency_category_manage_level,
</if>
<if test="agencyContacts != null">agency_contacts,
</if>
<if test="agencyPhone != null">agency_phone,
</if>
<if test="agencyAddress != null">agency_address,
</if>
<if test="agencyRemark != null">agency_remark,
</if>
<if test="agencySort != null">agency_sort,
</if>
<if test="createBy != null">create_by,
</if>
<if test="createTime != null">create_time,
</if>
<if test="updateBy != null">update_by,
</if>
<if test="updateTime != null">update_time,
</if>
<if test="parentId != null">parent_id,
</if>
<if test="agencyCategoryId != null">agency_category_id,
</if>
<if test="agencyCategoryName != null">agency_category_name,
</if>
<if test="areaCode != null">area_code,
</if>
<if test="areaName != null">area_name,
</if>
<if test="agencyName != null">agency_name,
</if>
<if test="agencyCode != null">agency_code,
</if>
<if test="agencyAbbreviation != null">agency_abbreviation,
</if>
<if test="agencyStatus != null">agency_status,
</if>
<if test="nodeType != null">node_type,
</if>
<if test="orgAgencyCode != null">org_agency_code,
</if>
<if test="agencyCategoryManageLevel != null">agency_category_manage_level,
</if>
<if test="agencyContacts != null">agency_contacts,
</if>
<if test="agencyPhone != null">agency_phone,
</if>
<if test="agencyAddress != null">agency_address,
</if>
<if test="agencyRemark != null">agency_remark,
</if>
<if test="agencySort != null">agency_sort,
</if>
<if test="createBy != null">create_by,
</if>
<if test="createTime != null">create_time,
</if>
<if test="updateBy != null">update_by,
</if>
<if test="updateTime != null">update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="parentId != null">#{parentId},
</if>
<if test="agencyCategoryId != null">#{agencyCategoryId},
</if>
<if test="agencyCategoryName != null">#{agencyCategoryName},
</if>
<if test="areaCode != null">#{areaCode},
</if>
<if test="areaName != null">#{areaName},
</if>
<if test="agencyName != null">#{agencyName},
</if>
<if test="agencyCode != null">#{agencyCode},
</if>
<if test="agencyAbbreviation != null">#{agencyAbbreviation},
</if>
<if test="agencyStatus != null">#{agencyStatus},
</if>
<if test="nodeType != null">#{nodeType},
</if>
<if test="orgAgencyCode != null">#{orgAgencyCode},
</if>
<if test="agencyCategoryManageLevel != null">#{agencyCategoryManageLevel},
</if>
<if test="agencyContacts != null">#{agencyContacts},
</if>
<if test="agencyPhone != null">#{agencyPhone},
</if>
<if test="agencyAddress != null">#{agencyAddress},
</if>
<if test="agencyRemark != null">#{agencyRemark},
</if>
<if test="agencySort != null">#{agencySort},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="updateTime != null">#{updateTime},
</if>
<if test="parentId != null">#{parentId},
</if>
<if test="agencyCategoryId != null">#{agencyCategoryId},
</if>
<if test="agencyCategoryName != null">#{agencyCategoryName},
</if>
<if test="areaCode != null">#{areaCode},
</if>
<if test="areaName != null">#{areaName},
</if>
<if test="agencyName != null">#{agencyName},
</if>
<if test="agencyCode != null">#{agencyCode},
</if>
<if test="agencyAbbreviation != null">#{agencyAbbreviation},
</if>
<if test="agencyStatus != null">#{agencyStatus},
</if>
<if test="nodeType != null">#{nodeType},
</if>
<if test="orgAgencyCode != null">#{orgAgencyCode},
</if>
<if test="agencyCategoryManageLevel != null">#{agencyCategoryManageLevel},
</if>
<if test="agencyContacts != null">#{agencyContacts},
</if>
<if test="agencyPhone != null">#{agencyPhone},
</if>
<if test="agencyAddress != null">#{agencyAddress},
</if>
<if test="agencyRemark != null">#{agencyRemark},
</if>
<if test="agencySort != null">#{agencySort},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="updateTime != null">#{updateTime},
</if>
</trim>
</insert>
<update id="updateAgency" parameterType="Agency">
update agency
<trim prefix="SET" suffixOverrides=",">
<if test="parentId != null">parent_id =
#{parentId},
</if>
<if test="agencyCategoryId != null">agency_category_id =
#{agencyCategoryId},
</if>
<if test="agencyCategoryName != null">agency_category_name =
#{agencyCategoryName},
</if>
<if test="areaCode != null">area_code =
#{areaCode},
</if>
<if test="areaName != null">area_name =
#{areaName},
</if>
<if test="agencyName != null">agency_name =
#{agencyName},
</if>
<if test="agencyCode != null">agency_code =
#{agencyCode},
</if>
<if test="agencyAbbreviation != null">agency_abbreviation =
#{agencyAbbreviation},
</if>
<if test="agencyStatus != null">agency_status =
#{agencyStatus},
</if>
<if test="nodeType != null">node_type =
#{nodeType},
</if>
<if test="orgAgencyCode != null">org_agency_code =
#{orgAgencyCode},
</if>
<if test="agencyCategoryManageLevel != null">agency_category_manage_level =
#{agencyCategoryManageLevel},
</if>
<if test="agencyContacts != null">agency_contacts =
#{agencyContacts},
</if>
<if test="agencyPhone != null">agency_phone =
#{agencyPhone},
</if>
<if test="agencyAddress != null">agency_address =
#{agencyAddress},
</if>
<if test="agencyRemark != null">agency_remark =
#{agencyRemark},
</if>
<if test="agencySort != null">agency_sort =
#{agencySort},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
<if test="parentId != null">parent_id =
#{parentId},
</if>
<if test="agencyCategoryId != null">agency_category_id =
#{agencyCategoryId},
</if>
<if test="agencyCategoryName != null">agency_category_name =
#{agencyCategoryName},
</if>
<if test="areaCode != null">area_code =
#{areaCode},
</if>
<if test="areaName != null">area_name =
#{areaName},
</if>
<if test="agencyName != null">agency_name =
#{agencyName},
</if>
<if test="agencyCode != null">agency_code =
#{agencyCode},
</if>
<if test="agencyAbbreviation != null">agency_abbreviation =
#{agencyAbbreviation},
</if>
<if test="agencyStatus != null">agency_status =
#{agencyStatus},
</if>
<if test="nodeType != null">node_type =
#{nodeType},
</if>
<if test="orgAgencyCode != null">org_agency_code =
#{orgAgencyCode},
</if>
<if test="agencyCategoryManageLevel != null">agency_category_manage_level =
#{agencyCategoryManageLevel},
</if>
<if test="agencyContacts != null">agency_contacts =
#{agencyContacts},
</if>
<if test="agencyPhone != null">agency_phone =
#{agencyPhone},
</if>
<if test="agencyAddress != null">agency_address =
#{agencyAddress},
</if>
<if test="agencyRemark != null">agency_remark =
#{agencyRemark},
</if>
<if test="agencySort != null">agency_sort =
#{agencySort},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAgencyById" parameterType="Long">
delete from agency where id = #{id}
delete
from agency
where id = #{id}
</delete>
<delete id="deleteAgencyByIds" parameterType="String">
@ -293,4 +321,82 @@
#{id}
</foreach>
</delete>
<select id="getAllAgencyInfo" resultType="com.xinelu.manage.domain.agency.Agency">
select id,
parent_id,
agency_category_id,
agency_category_name,
area_code,
area_name,
agency_name,
agency_code,
agency_abbreviation,
agency_status,
node_type,
org_agency_code,
agency_category_manage_level,
agency_contacts,
agency_phone,
agency_address,
agency_remark,
agency_sort,
create_by,
create_time,
update_by,
update_time
from agency
<where>
<if test="agencyNames != null and agencyNames.size() > 0">
and agency_name in
<foreach item="agencyName" collection="agencyNames" open="(" separator="," close=")">
#{agencyName}
</foreach>
</if>
</where>
</select>
<insert id="insertAgencyImportList" parameterType="java.util.List">
insert into agency(
select
parent_id,
agency_category_id,
agency_category_name,
area_code,
area_name,
agency_name,
agency_code,
agency_abbreviation,
agency_status,
node_type,
org_agency_code,
agency_category_manage_level,
agency_contacts,
agency_phone,
agency_address,
agency_remark,
agency_sort
) values
<foreach item="Agency" index="index" collection="list" separator=",">
(
#{Agency.parentId},
#{Agency.agencyCategoryId},
#{Agency.agencyCategoryName},
#{Agency.areaCode},
#{Agency.areaName},
#{Agency.agencyName},
#{Agency.agencyCode},
#{Agency.agencyAbbreviation},
#{Agency.agencyStatus},
#{Agency.nodeType},
#{Agency.orgAgencyCode},
#{Agency.agencyCategoryManageLevel},
#{Agency.agencyContacts},
#{Agency.agencyPhone},
#{Agency.agencyAddress},
#{Agency.agencyRemark},
#{Agency.agencySort}
)
</foreach>
</insert>
</mapper>

View File

@ -57,6 +57,10 @@
</where>
</select>
<select id="selectAgencyCategoryVOList" resultType="com.xinelu.manage.vo.agencycategory.AgencyCategoryVO">
<include refid="selectAgencyCategoryVo"/>
</select>
<select id="selectAgencyCategoryById" parameterType="Long"
resultMap="AgencyCategoryResult">
<include refid="selectAgencyCategoryVo"/>