导入及树图修改
This commit is contained in:
parent
500720f8b5
commit
df838d2b3b
BIN
postdischarge-admin/src/main/resources/template/机构信息导入表.xlsx
Normal file
BIN
postdischarge-admin/src/main/resources/template/机构信息导入表.xlsx
Normal file
Binary file not shown.
@ -134,8 +134,23 @@ public class Constants {
|
|||||||
public static final String[] JOB_ERROR_STR = {"java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
|
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"};
|
"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 CATEGORY_CODE = "CC";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机构信息导入标识
|
||||||
|
*/
|
||||||
|
public static final String AGENCY = "agency";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,6 +1,7 @@
|
|||||||
package com.xinelu.manage.controller.agency;
|
package com.xinelu.manage.controller.agency;
|
||||||
|
|
||||||
import com.xinelu.common.annotation.Log;
|
import com.xinelu.common.annotation.Log;
|
||||||
|
import com.xinelu.common.constant.Constants;
|
||||||
import com.xinelu.common.core.controller.BaseController;
|
import com.xinelu.common.core.controller.BaseController;
|
||||||
import com.xinelu.common.core.domain.AjaxResult;
|
import com.xinelu.common.core.domain.AjaxResult;
|
||||||
import com.xinelu.common.core.page.TableDataInfo;
|
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.common.utils.poi.ExcelUtil;
|
||||||
import com.xinelu.manage.domain.agency.Agency;
|
import com.xinelu.manage.domain.agency.Agency;
|
||||||
import com.xinelu.manage.service.agency.IAgencyService;
|
import com.xinelu.manage.service.agency.IAgencyService;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 机构信息Controller
|
* 机构信息Controller
|
||||||
@ -96,4 +100,29 @@ public class AgencyController extends BaseController {
|
|||||||
public AjaxResult agencyList() {
|
public AjaxResult agencyList() {
|
||||||
return AjaxResult.success(agencyService.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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -11,9 +11,6 @@ import lombok.NoArgsConstructor;
|
|||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 机构信息对象 agency
|
* 机构信息对象 agency
|
||||||
*
|
*
|
||||||
@ -37,14 +34,14 @@ public class Agency extends BaseEntity {
|
|||||||
* 上级机构id
|
* 上级机构id
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "上级机构id")
|
@ApiModelProperty(value = "上级机构id")
|
||||||
@Excel(name = "上级机构id")
|
@Excel(name = "上级机构")
|
||||||
private Long parentId;
|
private Long parentId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 所属机构类别id
|
* 所属机构类别id
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "所属机构类别id")
|
@ApiModelProperty(value = "所属机构类别id")
|
||||||
@Excel(name = "所属机构类别id")
|
@Excel(name = "所属机构类别")
|
||||||
private Long agencyCategoryId;
|
private Long agencyCategoryId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -100,7 +97,7 @@ public class Agency extends BaseEntity {
|
|||||||
* 节点类型,节点类型,卫健委:HEALTH_COMMISSION,医保局:MEDICAL_INSURANCE_BUREAU,医院:HOSPITAL,院区:CAMPUS,药店:PHARMACY,科室:DEPARTMENT,病区:WARD,中国:CHINA,省份:PROVINCE
|
* 节点类型,节点类型,卫健委: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")
|
@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;
|
private String nodeType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -114,7 +111,7 @@ public class Agency extends BaseEntity {
|
|||||||
* 机构分类管理类别,非营利性医疗机构:NON_PROFIT_MEDICAL_AGENCY,营利性医疗机构:FOR_PROFIT_MEDICAL_AGENCY,其他卫生机构:OTHER_HEALTH_AGENCY
|
* 机构分类管理类别,非营利性医疗机构:NON_PROFIT_MEDICAL_AGENCY,营利性医疗机构:FOR_PROFIT_MEDICAL_AGENCY,其他卫生机构:OTHER_HEALTH_AGENCY
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "机构分类管理类别,非营利性医疗机构: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;
|
private String agencyCategoryManageLevel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -152,17 +149,6 @@ public class Agency extends BaseEntity {
|
|||||||
@Excel(name = "机构排序")
|
@Excel(name = "机构排序")
|
||||||
private Integer agencySort;
|
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
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
|||||||
@ -11,9 +11,6 @@ import lombok.NoArgsConstructor;
|
|||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 机构类别对象 agency_category
|
* 机构类别对象 agency_category
|
||||||
*
|
*
|
||||||
@ -75,18 +72,6 @@ public class AgencyCategory extends BaseEntity {
|
|||||||
@Excel(name = "类别概述")
|
@Excel(name = "类别概述")
|
||||||
private String categoryRemark;
|
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
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.xinelu.manage.mapper.agency;
|
|||||||
|
|
||||||
import com.xinelu.manage.domain.agency.Agency;
|
import com.xinelu.manage.domain.agency.Agency;
|
||||||
import com.xinelu.manage.vo.agency.AgencyVO;
|
import com.xinelu.manage.vo.agency.AgencyVO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -37,6 +38,14 @@ public interface AgencyMapper {
|
|||||||
*/
|
*/
|
||||||
List<Agency> selectAgencyList(Agency agency);
|
List<Agency> selectAgencyList(Agency agency);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询机构信息列表
|
||||||
|
*
|
||||||
|
* @param agency 机构信息
|
||||||
|
* @return 机构信息集合
|
||||||
|
*/
|
||||||
|
List<AgencyVO> selectAgencyVOList(Agency agency);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增机构信息
|
* 新增机构信息
|
||||||
*
|
*
|
||||||
@ -68,4 +77,20 @@ public interface AgencyMapper {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int deleteAgencyByIds(Long[] ids);
|
int deleteAgencyByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有的机构信息
|
||||||
|
*
|
||||||
|
* @param agencyNames 机构信息集合
|
||||||
|
* @return 列表集合信息
|
||||||
|
*/
|
||||||
|
List<Agency> getAllAgencyInfo(@Param("agencyNames") List<String> agencyNames);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机构信息导入
|
||||||
|
*
|
||||||
|
* @param agencyList 机构信息
|
||||||
|
* @return int
|
||||||
|
**/
|
||||||
|
int insertAgencyImportList(List<Agency> agencyList);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.xinelu.manage.mapper.agencycategory;
|
package com.xinelu.manage.mapper.agencycategory;
|
||||||
|
|
||||||
import com.xinelu.manage.domain.agencycategory.AgencyCategory;
|
import com.xinelu.manage.domain.agencycategory.AgencyCategory;
|
||||||
|
import com.xinelu.manage.vo.agencycategory.AgencyCategoryVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -28,6 +29,14 @@ public interface AgencyCategoryMapper {
|
|||||||
*/
|
*/
|
||||||
List<AgencyCategory> selectAgencyCategoryList(AgencyCategory agencyCategory);
|
List<AgencyCategory> selectAgencyCategoryList(AgencyCategory agencyCategory);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询机构类别列表
|
||||||
|
*
|
||||||
|
* @param agencyCategory 机构类别
|
||||||
|
* @return 机构类别集合
|
||||||
|
*/
|
||||||
|
List<AgencyCategoryVO> selectAgencyCategoryVOList(AgencyCategory agencyCategory);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增机构类别
|
* 新增机构类别
|
||||||
*
|
*
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
package com.xinelu.manage.service.agency;
|
package com.xinelu.manage.service.agency;
|
||||||
|
|
||||||
|
import com.xinelu.common.core.domain.AjaxResult;
|
||||||
import com.xinelu.manage.domain.agency.Agency;
|
import com.xinelu.manage.domain.agency.Agency;
|
||||||
import com.xinelu.manage.vo.agency.AgencyTreeVO;
|
import com.xinelu.manage.vo.agency.AgencyTreeVO;
|
||||||
|
import com.xinelu.manage.vo.agency.AgencyVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -19,7 +21,7 @@ public interface IAgencyService {
|
|||||||
* @param id 机构信息主键
|
* @param id 机构信息主键
|
||||||
* @return 机构信息
|
* @return 机构信息
|
||||||
*/
|
*/
|
||||||
Agency selectAgencyById(Long id);
|
AgencyVO selectAgencyById(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询机构信息列表
|
* 查询机构信息列表
|
||||||
@ -67,4 +69,13 @@ public interface IAgencyService {
|
|||||||
* @return AgencyVO
|
* @return AgencyVO
|
||||||
*/
|
*/
|
||||||
List<AgencyTreeVO> agencyList();
|
List<AgencyTreeVO> agencyList();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机构信息导入
|
||||||
|
*
|
||||||
|
* @param agencyList 机构信息
|
||||||
|
* @return int
|
||||||
|
**/
|
||||||
|
AjaxResult insertAgencyImportList(List<Agency> agencyList);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,15 +1,27 @@
|
|||||||
package com.xinelu.manage.service.agency.impl;
|
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.DateUtils;
|
||||||
|
import com.xinelu.common.utils.SecurityUtils;
|
||||||
import com.xinelu.common.utils.StringUtils;
|
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.domain.agency.Agency;
|
||||||
import com.xinelu.manage.mapper.agency.AgencyMapper;
|
import com.xinelu.manage.mapper.agency.AgencyMapper;
|
||||||
import com.xinelu.manage.service.agency.IAgencyService;
|
import com.xinelu.manage.service.agency.IAgencyService;
|
||||||
import com.xinelu.manage.vo.agency.AgencyTreeVO;
|
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.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -25,6 +37,10 @@ import java.util.stream.Collectors;
|
|||||||
public class AgencyServiceImpl implements IAgencyService {
|
public class AgencyServiceImpl implements IAgencyService {
|
||||||
@Resource
|
@Resource
|
||||||
private AgencyMapper agencyMapper;
|
private AgencyMapper agencyMapper;
|
||||||
|
@Resource
|
||||||
|
private RegexUtil regexUtil;
|
||||||
|
@Resource
|
||||||
|
private GenerateSystemCodeUtil generateSystemCodeUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询机构信息
|
* 查询机构信息
|
||||||
@ -33,8 +49,8 @@ public class AgencyServiceImpl implements IAgencyService {
|
|||||||
* @return 机构信息
|
* @return 机构信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Agency selectAgencyById(Long id) {
|
public AgencyVO selectAgencyById(Long id) {
|
||||||
return agencyMapper.selectAgencyById(id);
|
return agencyMapper.selectAgencyVOById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -101,18 +117,65 @@ public class AgencyServiceImpl implements IAgencyService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<AgencyTreeVO> agencyList() {
|
public List<AgencyTreeVO> agencyList() {
|
||||||
List<Agency> agencies = agencyMapper.selectAgencyList(null);
|
List<AgencyVO> agencies = agencyMapper.selectAgencyVOList(null);
|
||||||
List<Agency> agenciesTree = buildDeptTree(agencies);
|
for (AgencyVO agency : agencies) {
|
||||||
|
agency.setValue(agency.getId().toString());
|
||||||
|
}
|
||||||
|
List<AgencyVO> agenciesTree = buildDeptTree(agencies);
|
||||||
return agenciesTree.stream().map(AgencyTreeVO::new).collect(Collectors.toList());
|
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>();
|
List<Long> tempList = new ArrayList<Long>();
|
||||||
for (Agency agency : agencies) {
|
for (AgencyVO agency : agencies) {
|
||||||
tempList.add(agency.getId());
|
tempList.add(agency.getId());
|
||||||
}
|
}
|
||||||
for (Agency agency : agencies) {
|
for (AgencyVO agency : agencies) {
|
||||||
// 如果是顶级节点, 遍历该父节点的所有子节点
|
// 如果是顶级节点, 遍历该父节点的所有子节点
|
||||||
if (!tempList.contains(agency.getParentId())) {
|
if (!tempList.contains(agency.getParentId())) {
|
||||||
recursionFn(agencies, agency);
|
recursionFn(agencies, agency);
|
||||||
@ -125,22 +188,22 @@ public class AgencyServiceImpl implements IAgencyService {
|
|||||||
return returnList;
|
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);
|
t.setChildren(childList);
|
||||||
for (Agency tChild : childList) {
|
for (AgencyVO tChild : childList) {
|
||||||
if (hasChild(list, tChild)) {
|
if (hasChild(list, tChild)) {
|
||||||
recursionFn(list, tChild);
|
recursionFn(list, tChild);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Agency> getChildList(List<Agency> list, Agency t) {
|
private List<AgencyVO> getChildList(List<AgencyVO> list, AgencyVO t) {
|
||||||
List<Agency> tlist = new ArrayList<Agency>();
|
List<AgencyVO> tlist = new ArrayList<AgencyVO>();
|
||||||
Iterator<Agency> it = list.iterator();
|
Iterator<AgencyVO> it = list.iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Agency n = (Agency) it.next();
|
AgencyVO n = (AgencyVO) it.next();
|
||||||
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getId().longValue()) {
|
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getId().longValue()) {
|
||||||
tlist.add(n);
|
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;
|
return getChildList(list, t).size() > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@ package com.xinelu.manage.service.agencycategory;
|
|||||||
|
|
||||||
|
|
||||||
import com.xinelu.manage.domain.agencycategory.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;
|
import java.util.List;
|
||||||
|
|
||||||
@ -66,5 +66,5 @@ public interface IAgencyCategoryService {
|
|||||||
*
|
*
|
||||||
* @return AgencyVO
|
* @return AgencyVO
|
||||||
*/
|
*/
|
||||||
List<AgencyCategoryVO> agencyCategoryList();
|
List<AgencyCategoryTreeVO> agencyCategoryList();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import com.xinelu.common.utils.codes.GenerateSystemCodeUtil;
|
|||||||
import com.xinelu.manage.domain.agencycategory.AgencyCategory;
|
import com.xinelu.manage.domain.agencycategory.AgencyCategory;
|
||||||
import com.xinelu.manage.mapper.agencycategory.AgencyCategoryMapper;
|
import com.xinelu.manage.mapper.agencycategory.AgencyCategoryMapper;
|
||||||
import com.xinelu.manage.service.agencycategory.IAgencyCategoryService;
|
import com.xinelu.manage.service.agencycategory.IAgencyCategoryService;
|
||||||
|
import com.xinelu.manage.vo.agencycategory.AgencyCategoryTreeVO;
|
||||||
import com.xinelu.manage.vo.agencycategory.AgencyCategoryVO;
|
import com.xinelu.manage.vo.agencycategory.AgencyCategoryVO;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@ -111,19 +112,19 @@ public class AgencyCategoryServiceImpl implements IAgencyCategoryService {
|
|||||||
* @return AgencyCategoryVO
|
* @return AgencyCategoryVO
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<AgencyCategoryVO> agencyCategoryList() {
|
public List<AgencyCategoryTreeVO> agencyCategoryList() {
|
||||||
List<AgencyCategory> agencyCategoryList = agencyCategoryMapper.selectAgencyCategoryList(null);
|
List<AgencyCategoryVO> agencyCategoryList = agencyCategoryMapper.selectAgencyCategoryVOList(null);
|
||||||
List<AgencyCategory> agencyTree = buildDeptTree(agencyCategoryList);
|
List<AgencyCategoryVO> agencyTree = buildDeptTree(agencyCategoryList);
|
||||||
return agencyTree.stream().map(AgencyCategoryVO::new).collect(Collectors.toList());
|
return agencyTree.stream().map(AgencyCategoryTreeVO::new).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AgencyCategory> buildDeptTree(List<AgencyCategory> agencyCategoryList) {
|
public List<AgencyCategoryVO> buildDeptTree(List<AgencyCategoryVO> agencyCategoryList) {
|
||||||
List<AgencyCategory> returnList = new ArrayList<AgencyCategory>();
|
List<AgencyCategoryVO> returnList = new ArrayList<AgencyCategoryVO>();
|
||||||
List<Long> tempList = new ArrayList<Long>();
|
List<Long> tempList = new ArrayList<Long>();
|
||||||
for (AgencyCategory agencyCategory : agencyCategoryList) {
|
for (AgencyCategoryVO agencyCategory : agencyCategoryList) {
|
||||||
tempList.add(agencyCategory.getId());
|
tempList.add(agencyCategory.getId());
|
||||||
}
|
}
|
||||||
for (AgencyCategory agencyCategory : agencyCategoryList) {
|
for (AgencyCategoryVO agencyCategory : agencyCategoryList) {
|
||||||
// 如果是顶级节点, 遍历该父节点的所有子节点
|
// 如果是顶级节点, 遍历该父节点的所有子节点
|
||||||
if (!tempList.contains(agencyCategory.getParentCategoryId())) {
|
if (!tempList.contains(agencyCategory.getParentCategoryId())) {
|
||||||
recursionFn(agencyCategoryList, agencyCategory);
|
recursionFn(agencyCategoryList, agencyCategory);
|
||||||
@ -136,22 +137,22 @@ public class AgencyCategoryServiceImpl implements IAgencyCategoryService {
|
|||||||
return returnList;
|
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);
|
t.setChildren(childList);
|
||||||
for (AgencyCategory tChild : childList) {
|
for (AgencyCategoryVO tChild : childList) {
|
||||||
if (hasChild(list, tChild)) {
|
if (hasChild(list, tChild)) {
|
||||||
recursionFn(list, tChild);
|
recursionFn(list, tChild);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<AgencyCategory> getChildList(List<AgencyCategory> list, AgencyCategory t) {
|
private List<AgencyCategoryVO> getChildList(List<AgencyCategoryVO> list, AgencyCategoryVO t) {
|
||||||
List<AgencyCategory> tlist = new ArrayList<AgencyCategory>();
|
List<AgencyCategoryVO> tlist = new ArrayList<AgencyCategoryVO>();
|
||||||
Iterator<AgencyCategory> it = list.iterator();
|
Iterator<AgencyCategoryVO> it = list.iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
AgencyCategory n = (AgencyCategory) it.next();
|
AgencyCategoryVO n = (AgencyCategoryVO) it.next();
|
||||||
if (StringUtils.isNotNull(n.getParentCategoryId()) && n.getParentCategoryId().longValue() == t.getId().longValue()) {
|
if (StringUtils.isNotNull(n.getParentCategoryId()) && n.getParentCategoryId().longValue() == t.getId().longValue()) {
|
||||||
tlist.add(n);
|
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;
|
return getChildList(list, t).size() > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,10 @@
|
|||||||
|
package com.xinelu.manage.service.importdownload;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入Service接口
|
||||||
|
*
|
||||||
|
* @author xinelu
|
||||||
|
* @date 2024-02-26
|
||||||
|
*/
|
||||||
|
public interface ImportDownloadService {
|
||||||
|
}
|
||||||
@ -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 {
|
||||||
|
}
|
||||||
@ -1,8 +1,6 @@
|
|||||||
package com.xinelu.manage.vo.agency;
|
package com.xinelu.manage.vo.agency;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
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.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -27,6 +25,11 @@ public class AgencyTreeVO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String label;
|
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.id = agency.getId();
|
||||||
this.label = agency.getAgencyName();
|
this.label = agency.getAgencyName();
|
||||||
|
this.value = agency.getValue();
|
||||||
this.children = agency.getChildren().stream().map(AgencyTreeVO::new).collect(Collectors.toList());
|
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() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@ -65,6 +63,14 @@ public class AgencyTreeVO implements Serializable {
|
|||||||
this.label = label;
|
this.label = label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
public List<AgencyTreeVO> getChildren() {
|
public List<AgencyTreeVO> getChildren() {
|
||||||
return children;
|
return children;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,11 @@
|
|||||||
package com.xinelu.manage.vo.agency;
|
package com.xinelu.manage.vo.agency;
|
||||||
|
|
||||||
import com.xinelu.manage.domain.agency.Agency;
|
import com.xinelu.manage.domain.agency.Agency;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 机构树图信息对象vo agency
|
* 机构树图信息对象vo agency
|
||||||
@ -8,8 +13,25 @@ import com.xinelu.manage.domain.agency.Agency;
|
|||||||
* @author xinelu
|
* @author xinelu
|
||||||
* @date 2024-02-26
|
* @date 2024-02-26
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
public class AgencyVO extends Agency {
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,43 +1,25 @@
|
|||||||
package com.xinelu.manage.vo.agencycategory;
|
package com.xinelu.manage.vo.agencycategory;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
|
||||||
import com.xinelu.manage.domain.agencycategory.AgencyCategory;
|
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.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;
|
||||||
|
|
||||||
/**
|
private List<AgencyCategoryVO> children = new ArrayList<AgencyCategoryVO>();
|
||||||
* 节点ID
|
|
||||||
*/
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/**
|
public List<AgencyCategoryVO> getChildren() {
|
||||||
* 节点名称
|
return children;
|
||||||
*/
|
|
||||||
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 Long getId() {
|
public void setChildren(List<AgencyCategoryVO> children) {
|
||||||
return id;
|
this.children = children;
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -30,7 +30,29 @@
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectAgencyVo">
|
<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>
|
</sql>
|
||||||
|
|
||||||
<select id="selectAgencyList" parameterType="Agency" resultMap="AgencyResult">
|
<select id="selectAgencyList" parameterType="Agency" resultMap="AgencyResult">
|
||||||
@ -90,14 +112,19 @@
|
|||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAgencyVOList" resultType="com.xinelu.manage.vo.agency.AgencyVO">
|
||||||
|
<include refid="selectAgencyVo"/>
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectAgencyById" parameterType="Long"
|
<select id="selectAgencyById" parameterType="Long"
|
||||||
resultMap="AgencyResult">
|
resultMap="AgencyResult">
|
||||||
<include refid="selectAgencyVo"/>
|
<include refid="selectAgencyVo"/>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectAgencyVOById" resultType="com.xinelu.manage.vo.agency.AgencyVO">
|
<select id="selectAgencyVOById" resultType="com.xinelu.manage.vo.agency.AgencyVO">
|
||||||
select id,
|
select id,
|
||||||
parent_id,
|
ay.parent_id,
|
||||||
agency_category_id,
|
agency_category_id,
|
||||||
agency_category_name,
|
agency_category_name,
|
||||||
area_code,
|
area_code,
|
||||||
@ -114,10 +141,9 @@
|
|||||||
agency_address,
|
agency_address,
|
||||||
agency_remark,
|
agency_remark,
|
||||||
agency_sort,
|
agency_sort,
|
||||||
(select agency_name from agency where id = parent_id)
|
(select agency_name from agency where id = ay.parent_id) AS parentAgencyName
|
||||||
from agency
|
from agency ay
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertAgency" parameterType="Agency" useGeneratedKeys="true"
|
<insert id="insertAgency" parameterType="Agency" useGeneratedKeys="true"
|
||||||
@ -284,7 +310,9 @@
|
|||||||
</update>
|
</update>
|
||||||
|
|
||||||
<delete id="deleteAgencyById" parameterType="Long">
|
<delete id="deleteAgencyById" parameterType="Long">
|
||||||
delete from agency where id = #{id}
|
delete
|
||||||
|
from agency
|
||||||
|
where id = #{id}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteAgencyByIds" parameterType="String">
|
<delete id="deleteAgencyByIds" parameterType="String">
|
||||||
@ -293,4 +321,82 @@
|
|||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</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>
|
</mapper>
|
||||||
@ -57,6 +57,10 @@
|
|||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAgencyCategoryVOList" resultType="com.xinelu.manage.vo.agencycategory.AgencyCategoryVO">
|
||||||
|
<include refid="selectAgencyCategoryVo"/>
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectAgencyCategoryById" parameterType="Long"
|
<select id="selectAgencyCategoryById" parameterType="Long"
|
||||||
resultMap="AgencyCategoryResult">
|
resultMap="AgencyCategoryResult">
|
||||||
<include refid="selectAgencyCategoryVo"/>
|
<include refid="selectAgencyCategoryVo"/>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user