Commit 67cc7580 by 刘泽志

初始化

parents
######################################################################
# Build Tools
.gradle
/build/
!gradle/wrapper/gradle-wrapper.jar
target/
!.mvn/wrapper/maven-wrapper.jar
######################################################################
# IDE
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### JRebel ###
rebel.xml
### NetBeans ###
nbproject/private/
build/*
nbbuild/
dist/
nbdist/
.nb-gradle/
######################################################################
# Others
*.log
*.xml.versionsBackup
*.swp
!*/build/*.java
!*/build/*.html
!*/build/*.xml
FROM java:8
VOLUME /home/publish/admin-api
MAINTAINER guopx
ADD ./target/admin-api.jar /home/publish/admin-api/app.jar
EXPOSE 28081
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo 'Asia/Shanghai' >/etc/timezone
ENTRYPOINT ["java","-jar","-Djava.security.egd=file:/dev/.urandom","/home/publish/admin-api/app.jar"]
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.tbyf.his</groupId>
<artifactId>admin</artifactId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<artifactId>admin-api</artifactId>
<description>
web服务入口
</description>
<dependencies>
<!-- spring-boot-devtools -->
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-devtools</artifactId>-->
<!-- <optional>true</optional> &lt;!&ndash; 表示依赖不会传递 &ndash;&gt;-->
<!-- </dependency>-->
<!-- swagger3-->
<!-- <dependency>-->
<!-- <groupId>io.springfox</groupId>-->
<!-- <artifactId>springfox-boot-starter</artifactId>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; 防止进入swagger页面报类型转换错误,排除3.0.0中的引用,手动增加1.6.2版本 &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>io.swagger</groupId>-->
<!-- <artifactId>swagger-models</artifactId>-->
<!-- <version>1.6.2</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>com.github.xiaoymin</groupId>-->
<!-- <artifactId>swagger-bootstrap-ui</artifactId>-->
<!-- <version>1.9.6</version>-->
<!-- </dependency>-->
<!-- Mysql驱动包 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- oracle驱动包 -->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.syyai.spring.boot</groupId>-->
<!-- <artifactId>ureport-spring-boot-starter</artifactId>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>com.bstek.ureport</groupId>-->
<!-- <artifactId>ureport2-console</artifactId>-->
<!-- <version>2.2.9</version>-->
<!-- </dependency>-->
<!-- 核心模块-->
<!-- 代码生成-->
<dependency>
<groupId>com.tbyf</groupId>
<artifactId>hip-generator</artifactId>
</dependency>
<dependency>
<groupId>com.tbyf.his</groupId>
<artifactId>admin-service</artifactId>
</dependency>
<dependency>
<groupId>com.github.howinfun</groupId>
<artifactId>ercache-spring-boot-starter</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.1.1.RELEASE</version>
<configuration>
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<warName>${project.artifactId}</warName>
</configuration>
</plugin>
</plugins>
<finalName>${project.artifactId}</finalName>
</build>
</project>
package com.tbyf.his;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.web.client.RestTemplate;
/**
* 启动程序
*
* @author guopx
*/
//@MapperScan("com.tbyf.his.**.mapper")
@EnableAsync
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
public class MyApplication {
public static void main(String[] args) {
// System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(MyApplication.class, args);
System.out.println("启动成功");
}
// @Bean
// public ServletRegistrationBean<Servlet> registrationBean() {
// return new ServletRegistrationBean<>(new UReportServlet(), "/ureport/*");
// }
@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
}
}
package com.tbyf.his;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
/**
* web容器中进行部署
*
* @author guopx
*/
public class MyServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(MyApplication.class);
}
}
package com.tbyf.his.web.controller.adapter;
import com.tbyf.his.adapter.domain.AdapterPublishColumn;
import com.tbyf.his.adapter.domain.QueryAdapterColumVo;
import com.tbyf.his.adapter.service.AdapterPublishColumnService;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Author:lph
* Date:2022/11/16 15:43
**/
@RestController
@RequestMapping("/adapter/column")
public class AdapterPublishColumnController extends BaseController {
@Autowired
AdapterPublishColumnService adapterPublishColumnService;
@PostMapping("/add")
public AjaxResult insertAdapterColumn(@RequestBody AdapterPublishColumn adapterPublishColumn) {
return toAjax(adapterPublishColumnService.insertAdapterColumn(adapterPublishColumn));
}
@GetMapping("/getBySourceName")
public TableDataInfo selectBySourceTableName(QueryAdapterColumVo columVo) {
return getDataTable(adapterPublishColumnService.selectBySourceTableName(columVo));
}
@GetMapping("/getInfo/{id}")
public AjaxResult getInfo(@PathVariable(value = "id") Long id) {
return AjaxResult.success(adapterPublishColumnService.selectColumnById(id));
}
@PutMapping("/update")
public AjaxResult updateAdapterColumn(@RequestBody AdapterPublishColumn adapterPublishColumn) {
return toAjax(adapterPublishColumnService.updateAdapterColumn(adapterPublishColumn));
}
@DeleteMapping("/delete")
public AjaxResult deleteAdapterTable(@RequestBody List<Long> ids) {
adapterPublishColumnService.deleteAdapterPublishColumnByIds(ids);
return AjaxResult.success();
}
}
package com.tbyf.his.web.controller.adapter;
import com.tbyf.his.adapter.domain.AdapterPublishTable;
import com.tbyf.his.adapter.domain.QueryAdapterTableVo;
import com.tbyf.his.adapter.service.AdapterPublishTableService;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Author:lph
* Date:2022/11/16 15:40
**/
@RestController
@RequestMapping("/adapter/table")
public class AdapterPublishTableController extends BaseController {
@Autowired
AdapterPublishTableService adapterPublishTableService;
@PostMapping("/add")
public AjaxResult insertSelective(@RequestBody AdapterPublishTable adapterPublishTable) {
return toAjax(adapterPublishTableService.insertSelective(adapterPublishTable));
}
@GetMapping("/getPublishTableBySource")
public TableDataInfo selectBySourceTableName(QueryAdapterTableVo queryAdapterTableVo) {
startPage();
return getDataTable(adapterPublishTableService.selectBySourceTableName(queryAdapterTableVo));
}
@GetMapping("/getInfo/{id}")
public AjaxResult getInfo(@PathVariable(value = "id") Long id) {
return AjaxResult.success(adapterPublishTableService.selectTableById(id));
}
@PutMapping("/updateTable")
public AjaxResult updateAdapterTable(@RequestBody AdapterPublishTable record) {
return toAjax(adapterPublishTableService.updateAdapterTable(record));
}
@DeleteMapping("/deleteTable/{id}")
public AjaxResult deleteAdapterTable(@PathVariable("id") Long id) {
adapterPublishTableService.deleteAdapterTable(id);
return AjaxResult.success();
}
}
package com.tbyf.his.web.controller.adapter;
import com.tbyf.his.adapter.domain.AdapterPublishTask;
import com.tbyf.his.adapter.service.AdapterPublishTaskService;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/adapter/task")
public class AdapterPublishTaskController extends BaseController {
@Autowired
private AdapterPublishTaskService adapterPublishTaskService;
@GetMapping("/list")
public TableDataInfo getList(@RequestParam(required = false) String sourceName,
@RequestParam(required = false) String publishTableName) {
startPage();
return getDataTable(adapterPublishTaskService.getList(sourceName, publishTableName));
}
/**
* 生成增量sql、并将发布任务设置为已启动
*/
@PostMapping("/startUp")
public AjaxResult startUp(@RequestBody List<Long> ids) {
adapterPublishTaskService.startUp(ids);
return AjaxResult.success();
}
/**
* 停止任务
*/
@PostMapping("/stop")
public AjaxResult stop(@RequestBody List<Long> ids) {
adapterPublishTaskService.stop(ids);
return AjaxResult.success();
}
/**
* 查询发布任务
*/
@GetMapping("/getInfo")
public AjaxResult getInfo(@RequestParam("publishTableName") String publishTableName,
@RequestParam("sourceName") String sourceName) {
AdapterPublishTask adapterPublishTask = adapterPublishTaskService.selectTaskByPublishTableNameAndSourceName(publishTableName, sourceName);
return AjaxResult.success(adapterPublishTask);
}
@PutMapping("/update")
public AjaxResult update(@RequestBody AdapterPublishTask adapterPublishTask) {
return toAjax(adapterPublishTaskService.updateAdapterPublishTask(adapterPublishTask));
}
}
package com.tbyf.his.web.controller.adapter;
import com.tbyf.his.adapter.domain.BCodevalue;
import com.tbyf.his.adapter.service.IBCodevalueService;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.core.page.TableDataInfo;
import com.tbyf.his.common.utils.SecurityUtils;
import com.tbyf.his.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
/**
* Author:lph
* Date:2022/11/18 11:43
**/
@RestController
@RequestMapping("/platform/dictMeta/bCodevalue")
public class BCodevalueController extends BaseController {
@Autowired
private IBCodevalueService bCodevalueService;
/**
* 查询业务代码值域列表
*/
@GetMapping("/list")
public TableDataInfo list(@RequestParam HashMap map) {
BCodevalue bCodevalue = new BCodevalue();
bCodevalue.setbASECODETABLECODE((String) map.get("bASECODETABLECODE"));
String queryName = (String) map.get("queryName");
List<BCodevalue> list = bCodevalueService.selectBCodevalueList(bCodevalue);
//判断条件是否为空
if (!StringUtils.isNull(queryName)) {
//根据条件进行过滤
list = list.stream().filter(b -> b.getvALUECODE().contains(queryName) || b.getvALUENAME().contains(queryName))
.collect(Collectors.toList());
}
return getDataTable(list);
}
/**
* 修改业务代码值域
*/
@PutMapping
public AjaxResult edit(@Validated @RequestBody BCodevalue bCodevalue) {
bCodevalue.setUpdateBy(SecurityUtils.getUsername());
return toAjax(bCodevalueService.updateBCodevalue(bCodevalue));
}
}
package com.tbyf.his.web.controller.analysis;
import com.tbyf.his.analysis.domain.*;
import com.tbyf.his.analysis.service.AnalysisService;
import com.tbyf.his.common.annotation.Log;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.core.page.TableDataInfo;
import com.tbyf.his.common.enums.BusinessType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
* 数据质量监控
*
* @author guopx
* @date 2021-01-15
*/
@RestController
@RequestMapping("/platform/analysis")
public class AnalysisController extends BaseController {
/**
* 查询数据质量监控接入信息列表
*/
@Autowired
private AnalysisService analysisService;
@GetMapping("/list")
public TableDataInfo list(Analysis applyAnalog) {
startPage();
List<Analysis> list = analysisService.selectAnalysisInfo(applyAnalog);
return getDataTable(list);
}
/**
* 新增数据质量监控api信息
*
* @param analysis
* @return
*/
@PostMapping
@Log(title = "数据监控接入api信息", businessType = BusinessType.INSERT)
public AjaxResult add(@RequestBody Analysis analysis) {
return toAjax(analysisService.insterAnalysisInfo(analysis));
}
/**
* 删除数据质量监控api信息
*
* @param analysis
* @return
*/
@PostMapping("/del")
@Log(title = "数据监控删除api信息", businessType = BusinessType.DELETE)
public AjaxResult deletes(@RequestBody List<Analysis> analysis) {
return toAjax(analysisService.removeAnalysisInfo(analysis));
}
@GetMapping("/businessData")
@Log(title = "数据监控删除api信息", businessType = BusinessType.DELETE)
public TableDataInfo getAnalysisBusinessData(AnalysisBusinessDataInfo analysisInfo) {
startPage();
List<AnalysisBusinessDataInfo> list = analysisService.selectAnalysisBusinessData(analysisInfo);
return getDataTable(list);
}
//获取已配置api的数据集
@GetMapping("/businessDataHaveApi")
public TableDataInfo getAnalysisBusinessDataHaveApi(AnalysisBusinessDataInfo analysisInfo) {
startPage();
List<AnalysisBusinessDataInfo> list = analysisService.selectAnalysisBusinessDataHaveApi(analysisInfo);
return getDataTable(list);
}
/**
* 数据监控一致性获取数据集树
*
* @return
*/
//获取全部
@GetMapping("/businessDataTree")
public AjaxResult getAnalysisBusinessDataTree() {
List<IdLabel> list = new ArrayList<>();
IdLabel ib = new IdLabel("-1", "数据集");
ib.setChildren(analysisService.selectAnalysisBusinessDataTree());
list.add(ib);
return AjaxResult.success(list);
}
//获取绑定api的
@GetMapping("/businessDataTreeHaveApi")
public AjaxResult getAnalysisBusinessDataTreeHave() {
List<IdLabel> list = new ArrayList<>();
IdLabel ib = new IdLabel("-1", "数据集");
ib.setChildren(analysisService.selectAnalysisBusinessDataTreeHaveApi());
list.add(ib);
return AjaxResult.success(list);
}
//获取没有绑定api的
@GetMapping("/businessDataTreeNoApi")
public AjaxResult getAnalysisBusinessDataTreeNo() {
List<IdLabel> list = new ArrayList<>();
IdLabel ib = new IdLabel("-1", "数据集");
ib.setChildren(analysisService.selectAnalysisBusinessDataTreeNoApi());
list.add(ib);
return AjaxResult.success(list);
}
@GetMapping("/getAnalysisDataByGroupId/{dataGroupId}")
public AjaxResult getAnalysisDataByGroupId(@PathVariable("dataGroupId") String dataGroupId) {
List<Analysis> analyses = analysisService.selectAnalysisDataByGroupId(dataGroupId);
return new AjaxResult(200, "success", analyses);
}
/**
* 数据监控一致性获取一致性结果数据
*
* @param
* @return
*/
@PostMapping("/getAnalysisDataInfo")
public TableDataInfo getAnalysisDataInfo(@RequestBody ConsistentData consistentData) {
System.out.println(consistentData.getStartDate());
List<ConsistentData> list = analysisService.selectAnalysisDataInfo(consistentData);
return getDataTable(list);
}
@GetMapping("/getAnalysisMassageInfo")
public TableDataInfo getAnalysisMassageInfo(AnalyMassageInfo analyMassageInfo) {
startPage();
List<AnalyMassageInfo> analyMassageInfos = analysisService.selectAnalysisMassageInfo(analyMassageInfo);
return getDataTable(analyMassageInfos);
}
@PostMapping("/addAnalysisMassage")
public AjaxResult addAnalysisMassage(@RequestBody AnalyMassageInfo analyMassageInfo) {
int i = analysisService.insterAnalysisMassage(analyMassageInfo);
return toAjax(i);
}
@PostMapping("/changeAnalysisMassage")
public AjaxResult changeAnalysisMassage(@RequestBody AnalyMassageInfo analyMassageInfo) {
int i = analysisService.updateAnalysisMassage(analyMassageInfo);
return toAjax(i);
}
@PostMapping("/delAnalysisMassage")
public AjaxResult delAnalysisMassage(@RequestBody AnalyMassageInfo analyMassageInfo) {
int i = analysisService.removeAnalysisMassage(analyMassageInfo);
return toAjax(i);
}
}
package com.tbyf.his.web.controller.analysis;
import com.tbyf.his.analysis.domain.*;
import com.tbyf.his.analysis.service.AnalysisDataConsistencyService;
import com.tbyf.his.common.annotation.Log;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.core.page.TableDataInfo;
import com.tbyf.his.common.enums.BusinessType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
* 数据监控完整性
*/
@RestController
@RequestMapping("/platform/analysisConsistency")
public class AnalysisDataConsistencyController extends BaseController {
@Autowired
private AnalysisDataConsistencyService analysisDataConsistencyService;
/**
* 数据监控完整性获取数据集树
*
* @return
*/
//获取已配置指标的
@GetMapping("/businessDataTreeHave")
public AjaxResult getAnalysisDataConsistencyTreeHave() {
List<IdLabel> list = new ArrayList<>();
IdLabel ib = new IdLabel("-1", "数据集");
ib.setChildren(analysisDataConsistencyService.selectAnalysisBusinessDataTreeHave());
list.add(ib);
return AjaxResult.success(list);
}
//获取没有配置指标的
@GetMapping("/businessDataTreeNo")
public AjaxResult getAnalysisDataConsistencyTreeNo() {
List<IdLabel> list = new ArrayList<>();
IdLabel ib = new IdLabel("-1", "数据集");
ib.setChildren(analysisDataConsistencyService.selectAnalysisBusinessDataTreeNo());
list.add(ib);
return AjaxResult.success(list);
}
/**
* 数据监控完整性-获取数据元非空配置信息
*
* @param applyAnalog
* @return
*/
@GetMapping("/list")
public TableDataInfo list(AnalysisConsistencyElement applyAnalog) {
startPage();
List<AnalysisConsistencyElement> list = analysisDataConsistencyService.selectAnalyConsistencyElement(applyAnalog);
return getDataTable(list);
}
/**
* 数据监控完整性接入非空数据元
*
* @param analysisInfo
* @return
*/
@PostMapping
@Log(title = "数据监控完整性接入非空数据元", businessType = BusinessType.INSERT)
public AjaxResult add(@RequestBody AnalysisConsistencyElement analysisInfo) {
return toAjax(analysisDataConsistencyService.insterAnalyConsistencyElement(analysisInfo));
}
/**
* 数据监控完整性删除非空数据元
*
* @param analysisInfo
* @return
*/
@PostMapping("/del")
@Log(title = "数据监控完整性删除非空数据元", businessType = BusinessType.DELETE)
public AjaxResult deletes(@RequestBody List<AnalysisConsistencyElement> analysisInfo) {
return toAjax(analysisDataConsistencyService.removeAnalyConsistencyElement(analysisInfo));
}
/**
* 数据监控完整性结果数量获取
*
* @param analysisInfo
* @return
*/
@GetMapping("/getAnalyDataNumberCount")
public TableDataInfo getAnalyDataNumberCount(AnalysisBusinessDataInfo analysisInfo) {
startPage();
List<AnalysisConsistencyCount> list = analysisDataConsistencyService.getAnalyDataNumberCount(analysisInfo);
return getDataTable(list);
}
/**
* 数据监控完整性修改时间字段信息
*
* @param analysisInfo
* @return
*/
@PostMapping("/updateDateFlag")
public AjaxResult updateDateFlag(@RequestBody AnalysisConsistencyElement analysisInfo) {
return toAjax(analysisDataConsistencyService.updateDateFlag(analysisInfo));
}
@GetMapping("/DatasetvsmetadataList")
public TableDataInfo list(BDatasetvsmetadata bDatasetvsmetadata) {
startPage();
List<BDatasetvsmetadata> list = analysisDataConsistencyService.selectBDatasetvsmetadataList(bDatasetvsmetadata);
return getDataTable(list);
}
}
package com.tbyf.his.web.controller.apiconvert;
import com.alibaba.fastjson.JSONObject;
import com.tbyf.his.apiconvert.domain.ApiconvertBaseinfo;
import com.tbyf.his.apiconvert.domain.ExecuteApi;
import com.tbyf.his.apiconvert.service.IApiconvertBaseinfoService;
import com.tbyf.his.common.annotation.Log;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.core.domain.model.MyKeyValue;
import com.tbyf.his.common.core.page.TableDataInfo;
import com.tbyf.his.common.enums.BusinessType;
import com.tbyf.his.common.utils.poi.ExcelUtil;
import com.tbyf.his.common.utils.sign.Base64;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;
import java.util.List;
/**
* 参数配置Controller
*
* @author guopx
* @date 2022-03-01
*/
@RestController
@RequestMapping("/system/baseinfo")
public class ApiconvertBaseinfoController extends BaseController {
@Autowired
private IApiconvertBaseinfoService apiconvertBaseinfoService;
/**
* 查询参数配置列表
*/
@PreAuthorize("@ss.hasPermi('apiconvert:baseinfo:list')")
@GetMapping("/list")
public TableDataInfo list(ApiconvertBaseinfo apiconvertBaseinfo) {
startPage();
List<ApiconvertBaseinfo> list = apiconvertBaseinfoService.selectApiconvertBaseinfoList(apiconvertBaseinfo);
return getDataTable(list);
}
/**
* 导出参数配置列表
*/
@PreAuthorize("@ss.hasPermi('apiconvert:baseinfo:export')")
@Log(title = "参数配置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ApiconvertBaseinfo apiconvertBaseinfo) {
List<ApiconvertBaseinfo> list = apiconvertBaseinfoService.selectApiconvertBaseinfoList(apiconvertBaseinfo);
ExcelUtil<ApiconvertBaseinfo> util = new ExcelUtil<ApiconvertBaseinfo>(ApiconvertBaseinfo.class);
util.exportExcel(response, list, "参数配置数据");
}
/**
* 获取参数配置详细信息
*/
@PreAuthorize("@ss.hasPermi('apiconvert:baseinfo:query')")
@GetMapping(value = "/{apiId}")
public AjaxResult getInfo(@PathVariable("apiId") Long apiId) {
ApiconvertBaseinfo apiconvertBaseinfo = apiconvertBaseinfoService.selectApiconvertBaseinfoByApiId(apiId);
String sqlText = apiconvertBaseinfo.getTargetSqltext();
if (Base64.decode(sqlText) != null) {
apiconvertBaseinfo.setTargetSqltext(Base64.decode(sqlText));
}
return AjaxResult.success(apiconvertBaseinfo);
}
/**
* 新增参数配置
*/
@PreAuthorize("@ss.hasPermi('apiconvert:baseinfo:add')")
@Log(title = "参数配置", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ApiconvertBaseinfo apiconvertBaseinfo) throws UnsupportedEncodingException {
return toAjax(apiconvertBaseinfoService.insertApiconvertBaseinfo(apiconvertBaseinfo));
}
/**
* 修改参数配置
*/
@PreAuthorize("@ss.hasPermi('apiconvert:baseinfo:edit')")
@Log(title = "参数配置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ApiconvertBaseinfo apiconvertBaseinfo) throws UnsupportedEncodingException {
return toAjax(apiconvertBaseinfoService.updateApiconvertBaseinfo(apiconvertBaseinfo));
}
/**
* 删除参数配置
*/
@PreAuthorize("@ss.hasPermi('apiconvert:baseinfo:remove')")
@Log(title = "参数配置", businessType = BusinessType.DELETE)
@DeleteMapping("/{apiIds}")
public AjaxResult remove(@PathVariable Long[] apiIds) {
return toAjax(apiconvertBaseinfoService.deleteApiconvertBaseinfoByApiIds(apiIds));
}
//@ApiOperation("sqlSelect")
@PostMapping("/sqlSelect/{apiId}")
public AjaxResult sqlSelect(@PathVariable Long apiId, @RequestBody JSONObject params) {
ApiconvertBaseinfo apiconvertBaseinfo = apiconvertBaseinfoService.selectApiconvertBaseinfoByApiId(apiId);
Object jsonObjects = apiconvertBaseinfoService.executeApi(apiconvertBaseinfo, params);
return AjaxResult.success(jsonObjects);
}
@GetMapping("/getOptionByName")
public AjaxResult getOptionByName(String apiName) {
List<MyKeyValue> list = apiconvertBaseinfoService.getOptionByName(apiName);
return AjaxResult.success(list);
}
@PostMapping("/executeApi")
public AjaxResult executeApi(@RequestBody ExecuteApi executeApi) {
List<JSONObject> jsonObjects = apiconvertBaseinfoService.executeApi(executeApi.getApiId(), executeApi.getParams());
return AjaxResult.success(jsonObjects);
}
}
package com.tbyf.his.web.controller.apiconvert;
import com.tbyf.his.apiconvert.domain.FieldMap;
import com.tbyf.his.apiconvert.service.IFieldMappingService;
import com.tbyf.his.common.annotation.Log;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.enums.BusinessType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/system/fieldmap")
public class FieldMapController extends BaseController {
@Autowired
private IFieldMappingService FieldService;
@Log(title = "新增字段映射", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult addMap(@Validated @RequestBody FieldMap field) {
return toAjax(FieldService.insertFieldMap(field));
}
/**
* 删除字段映射
*/
@Log(title = "删除字段映射", businessType = BusinessType.DELETE)
@DeleteMapping("/{sourceFieldId}/{targetFieldId}/{apiBaseinfoId}")
public AjaxResult removeMap(@PathVariable Long sourceFieldId,
@PathVariable Long targetFieldId,
@PathVariable Long apiBaseinfoId) {
return toAjax(FieldService.deleteFieldMap(sourceFieldId, targetFieldId, apiBaseinfoId));
}
/**
* 字段映射
*/
@Log(title = "字段映射管理", businessType = BusinessType.DELETE)
@GetMapping("/selectFieldMappingByApiId/{apiId}")
public AjaxResult selectFieldMappingByApiId(@PathVariable Long apiId) {
List<FieldMap> sourceAndTargets = FieldService.selectFieldMappingByApiId(apiId);
return AjaxResult.success(sourceAndTargets);
}
}
package com.tbyf.his.web.controller.apiconvert;
import com.tbyf.his.apiconvert.domain.FieldMap;
import com.tbyf.his.apiconvert.domain.model.SourceAndTarget;
import com.tbyf.his.apiconvert.service.IFieldMappingService;
import com.tbyf.his.common.annotation.Log;
import com.tbyf.his.common.constant.UserConstants;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.core.domain.entity.FieldMapping;
import com.tbyf.his.common.enums.BusinessType;
import com.tbyf.his.common.utils.StringUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Iterator;
import java.util.List;
/**
* 字段映射
*
* @author guopx
*/
@RestController
@RequestMapping("/system/field")
public class FieldMappingController extends BaseController {
@Autowired
private IFieldMappingService FieldService;
/**
* 获取字段映射列表
*/
@GetMapping("/list")
public AjaxResult list(FieldMapping Field) {
List<FieldMapping> Fields = FieldService.selectFieldList(Field);
return AjaxResult.success(Fields);
}
@GetMapping("/selectConnectTo")
public AjaxResult selectConnectTo(FieldMapping Field) {
List<FieldMapping> Fields = FieldService.selectConnectTo(Field);
return AjaxResult.success(Fields);
}
/**
* 查询字段映射列表(排除节点)
*/
@GetMapping("/list/exclude/{FieldId}")
public AjaxResult excludeChild(@PathVariable(value = "FieldId", required = false) Long FieldId) {
List<FieldMapping> Fields = FieldService.selectFieldList(new FieldMapping());
Iterator<FieldMapping> it = Fields.iterator();
while (it.hasNext()) {
FieldMapping d = (FieldMapping) it.next();
if (d.getFieldId().intValue() == FieldId
|| ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), FieldId + "")) {
it.remove();
}
}
return AjaxResult.success(Fields);
}
/**
* 根据字段映射编号获取详细信息
*/
@GetMapping(value = "/{FieldId}")
public AjaxResult getInfo(@PathVariable Long FieldId) {
return AjaxResult.success(FieldService.selectFieldById(FieldId));
}
/**
* 获取字段映射下拉树列表
*/
@GetMapping("/treeselect")
public AjaxResult treeselect(FieldMapping Field) {
List<FieldMapping> Fields = FieldService.selectFieldList(Field);
return AjaxResult.success(FieldService.buildFieldTreeSelect(Fields));
}
/**
* 新增字段映射
*/
@Log(title = "字段映射管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody FieldMapping Field) {
if (UserConstants.NOT_UNIQUE.equals(FieldService.checkFieldNameUnique(Field))) {
return AjaxResult.error("新增字段映射'" + Field.getFieldName() + "'失败,字段映射名称已存在");
}
Field.setCreateBy(getUsername());
return toAjax(FieldService.insertField(Field));
}
/**
* 修改字段映射
*/
@Log(title = "字段映射管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody FieldMapping Field) {
Long FieldId = Field.getFieldId();
if (UserConstants.NOT_UNIQUE.equals(FieldService.checkFieldNameUnique(Field))) {
return AjaxResult.error("修改字段映射'" + Field.getFieldName() + "'失败,字段映射名称已存在");
} else if (Field.getParentId().equals(FieldId)) {
return AjaxResult.error("修改字段映射'" + Field.getFieldName() + "'失败,上级字段映射不能是自己");
}
Field.setUpdateBy(getUsername());
return toAjax(FieldService.updateField(Field));
}
/**
* 删除字段映射
*/
@Log(title = "字段映射管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{FieldId}")
public AjaxResult remove(@PathVariable Long FieldId) {
if (FieldService.hasChildByFieldId(FieldId)) {
return AjaxResult.error("存在下级字段映射,不允许删除");
}
return toAjax(FieldService.deleteFieldById(FieldId));
}
}
package com.tbyf.his.web.controller.closeloop;
import com.tbyf.his.apiconvert.domain.ApiconvertBaseinfo;
import com.tbyf.his.apiconvert.service.IApiconvertBaseinfoService;
import com.tbyf.his.closeloop.domain.CloseLoopManuInfo;
import com.tbyf.his.closeloop.service.CloseLoopService;
import com.tbyf.his.common.annotation.Log;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.core.page.TableDataInfo;
import com.tbyf.his.common.enums.BusinessType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 闭环流程
*/
@RestController()
@RequestMapping("/closeLoop")
public class CloseLoopController extends BaseController {
@Resource
private CloseLoopService closeLoopService;
@Autowired
private IApiconvertBaseinfoService apiconvertBaseinfoService;
/**
* 获取闭环流程菜单
*/
@GetMapping("/list")
public TableDataInfo getCloseLoopManu() {
List<CloseLoopManuInfo> closeLoopManuInfos = closeLoopService.queryCloseLoopManu();
return getDataTable(closeLoopManuInfos);
}
/**
* 插入闭环流程信息
*
* @param closeLoopManuInfo
* @return
*/
@PostMapping("/add")
@Log(title = "插入闭环流程信息", businessType = BusinessType.INSERT)
public AjaxResult saveCloseLoop(@RequestBody CloseLoopManuInfo closeLoopManuInfo) {
int result = closeLoopService.saveCloseLoop(closeLoopManuInfo);
return toAjax(result);
}
/**
* 修改闭环流程信息
*
* @param closeLoopManuInfo
* @return
*/
@PostMapping("/update")
@Log(title = "修改闭环流程信息", businessType = BusinessType.UPDATE)
public AjaxResult updateCloseLoop(@RequestBody CloseLoopManuInfo closeLoopManuInfo) {
if (closeLoopManuInfo.getId() == null || closeLoopManuInfo.getId().longValue() == 0) {
return new AjaxResult(500, "缺少主键id");
}
int result = closeLoopService.updateCloseLoop(closeLoopManuInfo);
return toAjax(result);
}
/**
* 获取接口转换列表
*
* @param apiconvertBaseinfo
* @return
*/
@GetMapping("/apiList")
public TableDataInfo apiList(ApiconvertBaseinfo apiconvertBaseinfo) {
List<ApiconvertBaseinfo> list = apiconvertBaseinfoService.selectApiconvertBaseinfoList(apiconvertBaseinfo);
return getDataTable(list);
}
/**
* 更具流程信息获取节点信息
*
* @param closeLoopManuInfo
* @return
*/
@PostMapping("/getNodeInfo")
public TableDataInfo getNodeInfo(@RequestBody CloseLoopManuInfo closeLoopManuInfo) {
List<CloseLoopManuInfo> nodeInfos = closeLoopService.queryNodeInfo(closeLoopManuInfo);
return getDataTable(nodeInfos);
}
/**
* 获取闭环流程流程图json
*
* @param closeLoopManuInfo
* @return
*/
@PostMapping("/getProcessFlow")
public AjaxResult getProcessFlow(@RequestBody CloseLoopManuInfo closeLoopManuInfo) {
String result = closeLoopService.queryProcessFlow(closeLoopManuInfo);
return new AjaxResult(200, "success", result);
}
/**
* 修改闭环流程流程图json信息
*
* @param closeLoopManuInfo
* @return
*/
@PostMapping("/saveProcessFlow")
@Log(title = "修改闭环流程信息", businessType = BusinessType.UPDATE)
public AjaxResult saveProcessFlow(@RequestBody CloseLoopManuInfo closeLoopManuInfo) {
int result = closeLoopService.saveProcessFlow(closeLoopManuInfo);
return toAjax(result);
}
/**
* 获取所有流程信息
*
* @return
*/
@GetMapping("/getProcessInfo")
public TableDataInfo getProcessInfo() {
List<CloseLoopManuInfo> closeLoopManuInfos = closeLoopService.queryProcessInfo();
return getDataTable(closeLoopManuInfos);
}
@PostMapping("/delNode")
public AjaxResult delNode(@RequestBody CloseLoopManuInfo closeLoopManuInfo) {
int result = closeLoopService.updateDelFlag(closeLoopManuInfo);
return toAjax(result);
}
}
package com.tbyf.his.web.controller.common;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse;
import com.tbyf.his.common.config.RuoYiConfig;
import com.tbyf.his.common.constant.Constants;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.core.redis.RedisCache;
import com.tbyf.his.common.utils.sign.Base64;
import com.tbyf.his.common.utils.uuid.IdUtils;
import com.tbyf.his.framework.system.service.ISysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.FastByteArrayOutputStream;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import com.google.code.kaptcha.Producer;
/**
* 验证码操作处理
*
* @author guopx
*/
@RestController
public class CaptchaController {
@Resource(name = "captchaProducer")
private Producer captchaProducer;
@Resource(name = "captchaProducerMath")
private Producer captchaProducerMath;
@Autowired
private RedisCache redisCache;
@Autowired
private ISysConfigService configService;
/**
* 生成验证码
*/
@GetMapping("/captchaImage")
public AjaxResult getCode(HttpServletResponse response) throws IOException {
AjaxResult ajax = AjaxResult.success();
boolean captchaOnOff = configService.selectCaptchaOnOff();
ajax.put("captchaOnOff", captchaOnOff);
if (!captchaOnOff) {
return ajax;
}
// 保存验证码信息
String uuid = IdUtils.simpleUUID();
String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
String capStr = null, code = null;
BufferedImage image = null;
// 生成验证码
String captchaType = RuoYiConfig.getCaptchaType();
if ("math".equals(captchaType)) {
String capText = captchaProducerMath.createText();
capStr = capText.substring(0, capText.lastIndexOf("@"));
code = capText.substring(capText.lastIndexOf("@") + 1);
image = captchaProducerMath.createImage(capStr);
} else if ("char".equals(captchaType)) {
capStr = code = captchaProducer.createText();
image = captchaProducer.createImage(capStr);
}
redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
// 转换流信息写出
FastByteArrayOutputStream os = new FastByteArrayOutputStream();
try {
ImageIO.write(image, "jpg", os);
} catch (IOException e) {
return AjaxResult.error(e.getMessage());
}
ajax.put("uuid", uuid);
ajax.put("img", Base64.encode(os.toByteArray()));
return ajax;
}
}
package com.tbyf.his.web.controller.common;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.tbyf.his.common.config.RuoYiConfig;
import com.tbyf.his.common.constant.Constants;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.utils.StringUtils;
import com.tbyf.his.common.utils.file.FileUploadUtils;
import com.tbyf.his.common.utils.file.FileUtils;
import com.tbyf.his.framework.config.ServerConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
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 org.springframework.web.multipart.MultipartFile;
/**
* 通用请求处理
*
* @author guopx
*/
@RestController
@RequestMapping("/common")
public class CommonController {
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
@Autowired
private ServerConfig serverConfig;
/**
* 通用下载请求
*
* @param fileName 文件名称
* @param delete 是否删除
*/
@GetMapping("/download")
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) {
try {
if (!FileUtils.checkAllowDownload(fileName)) {
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
}
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
String filePath = RuoYiConfig.getDownloadPath() + fileName;
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
FileUtils.setAttachmentResponseHeader(response, realFileName);
FileUtils.writeBytes(filePath, response.getOutputStream());
if (delete) {
FileUtils.deleteFile(filePath);
}
} catch (Exception e) {
log.error("下载文件失败", e);
}
}
/**
* 通用上传请求
*/
@PostMapping("/upload")
public AjaxResult uploadFile(MultipartFile file) throws Exception {
try {
// 上传文件路径
String filePath = RuoYiConfig.getUploadPath();
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName;
AjaxResult ajax = AjaxResult.success();
ajax.put("fileName", fileName);
ajax.put("url", url);
return ajax;
} catch (Exception e) {
return AjaxResult.error(e.getMessage());
}
}
/**
* 本地资源通用下载
*/
@GetMapping("/common/download/resource")
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
throws Exception {
try {
if (!FileUtils.checkAllowDownload(resource)) {
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
}
// 本地资源路径
String localPath = RuoYiConfig.getProfile();
// 数据库资源地址
String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX);
// 下载名称
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
FileUtils.setAttachmentResponseHeader(response, downloadName);
FileUtils.writeBytes(downloadPath, response.getOutputStream());
} catch (Exception e) {
log.error("下载文件失败", e);
}
}
}
package com.tbyf.his.web.controller.configuration;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.tbyf.his.configuration.service.IDqConfigService;
import org.springframework.security.access.prepost.PreAuthorize;
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.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tbyf.his.common.annotation.Log;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.enums.BusinessType;
import com.tbyf.his.configuration.domain.DqConfig;
import com.tbyf.his.configuration.service.IDqConfigService;
import com.tbyf.his.common.utils.poi.ExcelUtil;
import com.tbyf.his.common.core.page.TableDataInfo;
/**
* DynamicQuery组件配置Controller
*
* @author guopx
* @date 2022-05-18
*/
@RestController
@RequestMapping("/configuration/config")
public class DqConfigController extends BaseController {
@Autowired
private IDqConfigService dqConfigService;
/**
* 查询DynamicQuery组件配置列表
*/
// @PreAuthorize("@ss.hasPermi('configuration:config:list')")
@GetMapping("/list")
public TableDataInfo list(DqConfig dqConfig) {
startPage();
List<DqConfig> list = dqConfigService.selectDqConfigList(dqConfig);
return getDataTable(list);
}
/**
* 导出DynamicQuery组件配置列表
*/
// @PreAuthorize("@ss.hasPermi('configuration:config:export')")
@Log(title = "DynamicQuery组件配置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DqConfig dqConfig) {
List<DqConfig> list = dqConfigService.selectDqConfigList(dqConfig);
ExcelUtil<DqConfig> util = new ExcelUtil<DqConfig>(DqConfig.class);
util.exportExcel(response, list, "DynamicQuery组件配置数据");
}
/**
* 获取DynamicQuery组件配置详细信息
*/
// @PreAuthorize("@ss.hasPermi('configuration:config:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(dqConfigService.selectDqConfigById(id));
}
/**
* 新增DynamicQuery组件配置
*/
// @PreAuthorize("@ss.hasPermi('configuration:config:add')")
@Log(title = "DynamicQuery组件配置", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DqConfig dqConfig) {
return toAjax(dqConfigService.insertDqConfig(dqConfig));
}
/**
* 修改DynamicQuery组件配置
*/
// @PreAuthorize("@ss.hasPermi('configuration:config:edit')")
@Log(title = "DynamicQuery组件配置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DqConfig dqConfig) {
return toAjax(dqConfigService.updateDqConfig(dqConfig));
}
/**
* 删除DynamicQuery组件配置
*/
// @PreAuthorize("@ss.hasPermi('configuration:config:remove')")
@Log(title = "DynamicQuery组件配置", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(dqConfigService.deleteDqConfigByIds(ids));
}
}
package com.tbyf.his.web.controller.configuration;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.tbyf.his.configuration.domain.StConfig;
import com.tbyf.his.configuration.service.IStConfigService;
import org.springframework.security.access.prepost.PreAuthorize;
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.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tbyf.his.common.annotation.Log;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.enums.BusinessType;
import com.tbyf.his.common.utils.poi.ExcelUtil;
import com.tbyf.his.common.core.page.TableDataInfo;
/**
* searchTable组件配置Controller
*
* @author guopx
* @date 2022-05-16
*/
@RestController
@RequestMapping("/st/config")
public class StConfigController extends BaseController {
@Autowired
private IStConfigService stConfigService;
/**
* 查询searchTable组件配置列表
*/
// @PreAuthorize("@ss.hasPermi('system:config:list')")
@GetMapping("/list")
public TableDataInfo list(StConfig stConfig) {
startPage();
List<StConfig> list = stConfigService.selectStConfigList(stConfig);
return getDataTable(list);
}
/**
* 导出searchTable组件配置列表
*/
// @PreAuthorize("@ss.hasPermi('system:config:export')")
@Log(title = "searchTable组件配置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, StConfig stConfig) {
List<StConfig> list = stConfigService.selectStConfigList(stConfig);
ExcelUtil<StConfig> util = new ExcelUtil<StConfig>(StConfig.class);
util.exportExcel(response, list, "searchTable组件配置数据");
}
/**
* 获取searchTable组件配置详细信息
*/
// @PreAuthorize("@ss.hasPermi('system:config:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(stConfigService.selectStConfigById(id));
}
/**
* 新增searchTable组件配置
*/
// @PreAuthorize("@ss.hasPermi('system:config:add')")
@Log(title = "searchTable组件配置", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody StConfig stConfig) {
return toAjax(stConfigService.insertStConfig(stConfig));
}
/**
* 修改searchTable组件配置
*/
// @PreAuthorize("@ss.hasPermi('system:config:edit')")
@Log(title = "searchTable组件配置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody StConfig stConfig) {
return toAjax(stConfigService.updateStConfig(stConfig));
}
/**
* 删除searchTable组件配置
*/
// @PreAuthorize("@ss.hasPermi('system:config:remove')")
@Log(title = "searchTable组件配置", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(stConfigService.deleteStConfigByIds(ids));
}
}
package com.tbyf.his.web.controller.configuration;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.tbyf.his.configuration.domain.StConfigDetail;
import com.tbyf.his.configuration.service.IStConfigDetailService;
import org.springframework.security.access.prepost.PreAuthorize;
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.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tbyf.his.common.annotation.Log;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.enums.BusinessType;
import com.tbyf.his.common.utils.poi.ExcelUtil;
import com.tbyf.his.common.core.page.TableDataInfo;
/**
* 组件Controller
*
* @author guopx
* @date 2022-05-16
*/
@RestController
@RequestMapping("/st/detail")
public class StConfigDetailController extends BaseController {
@Autowired
private IStConfigDetailService stConfigDetailService;
/**
* 查询组件列表
*/
// @PreAuthorize("@ss.hasPermi('system:detail:list')")
@GetMapping("/list")
public TableDataInfo list(StConfigDetail stConfigDetail) {
startPage();
List<StConfigDetail> list = stConfigDetailService.selectStConfigDetailList(stConfigDetail);
return getDataTable(list);
}
/**
* 查询组件列表
*/
@GetMapping("/detailList")
public AjaxResult detailList(StConfigDetail stConfigDetail) {
List<StConfigDetail> list = stConfigDetailService.selectStConfigDetailList(stConfigDetail);
return AjaxResult.success(list);
}
/**
* 导出组件列表
*/
// @PreAuthorize("@ss.hasPermi('system:detail:export')")
@Log(title = "组件", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, StConfigDetail stConfigDetail) {
List<StConfigDetail> list = stConfigDetailService.selectStConfigDetailList(stConfigDetail);
ExcelUtil<StConfigDetail> util = new ExcelUtil<StConfigDetail>(StConfigDetail.class);
util.exportExcel(response, list, "组件数据");
}
/**
* 获取组件详细信息
*/
// @PreAuthorize("@ss.hasPermi('system:detail:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(stConfigDetailService.selectStConfigDetailById(id));
}
/**
* 新增组件
*/
// @PreAuthorize("@ss.hasPermi('system:detail:add')")
@Log(title = "组件", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody StConfigDetail stConfigDetail) {
return toAjax(stConfigDetailService.insertStConfigDetail(stConfigDetail));
}
/**
* 修改组件
*/
// @PreAuthorize("@ss.hasPermi('system:detail:edit')")
@Log(title = "组件", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody StConfigDetail stConfigDetail) {
return toAjax(stConfigDetailService.updateStConfigDetail(stConfigDetail));
}
/**
* 删除组件
*/
// @PreAuthorize("@ss.hasPermi('system:detail:remove')")
@Log(title = "组件", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(stConfigDetailService.deleteStConfigDetailByIds(ids));
}
}
package com.tbyf.his.web.controller.configuration;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.tbyf.his.configuration.domain.WsConfig;
import com.tbyf.his.configuration.service.IWsConfigService;
import org.springframework.security.access.prepost.PreAuthorize;
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.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tbyf.his.common.annotation.Log;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.enums.BusinessType;
import com.tbyf.his.common.utils.poi.ExcelUtil;
import com.tbyf.his.common.core.page.TableDataInfo;
/**
* webService服务配置Controller
*
* @author guopx
* @date 2022-04-14
*/
@RestController
@RequestMapping("/ws/config")
public class WsConfigController extends BaseController {
@Autowired
private IWsConfigService wsConfigService;
/**
* 查询webService服务配置列表
*/
// @PreAuthorize("@ss.hasPermi('ws:config:list')")
@GetMapping("/list")
public TableDataInfo list(WsConfig wsConfig) {
startPage();
System.out.println(wsConfig);
List<WsConfig> list = wsConfigService.selectWsConfigList(wsConfig);
return getDataTable(list);
}
/**
* 导出webService服务配置列表
*/
// @PreAuthorize("@ss.hasPermi('ws:config:export')")
@Log(title = "webService服务配置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WsConfig wsConfig) {
List<WsConfig> list = wsConfigService.selectWsConfigList(wsConfig);
ExcelUtil<WsConfig> util = new ExcelUtil<WsConfig>(WsConfig.class);
util.exportExcel(response, list, "webService服务配置数据");
}
/**
* 获取webService服务配置详细信息
*/
// @PreAuthorize("@ss.hasPermi('ws:config:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(wsConfigService.selectWsConfigById(id));
}
/**
* 根据moduleId获取webService服务配置详细信息
*/
// @PreAuthorize("@ss.hasPermi('ws:config:module')")
@PostMapping(value = "/moduleId")
public AjaxResult getListByModuleId(@RequestBody WsConfig moduleId) {
System.out.println(moduleId);
return AjaxResult.success(wsConfigService.selectWsConfigByModuleId(moduleId.getModuleId()));
}
/**
* 新增webService服务配置
*/
// @PreAuthorize("@ss.hasPermi('ws:config:add')")
@Log(title = "webService服务配置", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WsConfig wsConfig) {
return toAjax(wsConfigService.insertWsConfig(wsConfig));
}
/**
* 修改webService服务配置
*/
// @PreAuthorize("@ss.hasPermi('ws:config:edit')")
@Log(title = "webService服务配置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WsConfig wsConfig) {
return toAjax(wsConfigService.updateWsConfig(wsConfig));
}
/**
* 删除webService服务配置
*/
// @PreAuthorize("@ss.hasPermi('ws:config:remove')")
@Log(title = "webService服务配置", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(wsConfigService.deleteWsConfigByIds(ids));
}
}
package com.tbyf.his.web.controller.configuration;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import com.tbyf.his.common.utils.StringUtils;
import com.tbyf.his.configuration.domain.ImportParam;
import com.tbyf.his.configuration.domain.WsConfigDetail;
import com.tbyf.his.configuration.service.IWsConfigDetailService;
import org.springframework.security.access.prepost.PreAuthorize;
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.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tbyf.his.common.annotation.Log;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.enums.BusinessType;
import com.tbyf.his.common.utils.poi.ExcelUtil;
import com.tbyf.his.common.core.page.TableDataInfo;
/**
* detailController
*
* @author guopx
* @date 2022-04-15
*/
@RestController
@RequestMapping("/ws/configDetail")
public class WsConfigDetailController extends BaseController {
@Autowired
private IWsConfigDetailService wsConfigDetailService;
/**
* 查询detail列表
*/
// @PreAuthorize("@ss.hasPermi('system:detail:list')")
@GetMapping("/list")
public TableDataInfo list(WsConfigDetail wsConfigDetail) {
startPage();
List<WsConfigDetail> list = wsConfigDetailService.selectWsConfigDetailList(wsConfigDetail);
return getDataTable(list);
}
/**
* 导出detail列表
*/
// @PreAuthorize("@ss.hasPermi('system:detail:export')")
@Log(title = "detail", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WsConfigDetail wsConfigDetail) {
List<WsConfigDetail> list = wsConfigDetailService.selectWsConfigDetailList(wsConfigDetail);
ExcelUtil<WsConfigDetail> util = new ExcelUtil<WsConfigDetail>(WsConfigDetail.class);
util.exportExcel(response, list, "detail数据");
}
/**
* 获取detail详细信息
*/
@PreAuthorize("@ss.hasPermi('system:detail:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(wsConfigDetailService.selectWsConfigDetailById(id));
}
/**
* 新增detail
*/
// @PreAuthorize("@ss.hasPermi('system:detail:add')")
@Log(title = "detail", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WsConfigDetail wsConfigDetail) {
return toAjax(wsConfigDetailService.insertWsConfigDetail(wsConfigDetail));
}
/**
* 修改detail
*/
// @PreAuthorize("@ss.hasPermi('system:detail:edit')")
@Log(title = "detail", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WsConfigDetail wsConfigDetail) {
return toAjax(wsConfigDetailService.updateWsConfigDetail(wsConfigDetail));
}
/**
* 删除detail
*/
// @PreAuthorize("@ss.hasPermi('system:detail:remove')")
@Log(title = "detail", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(wsConfigDetailService.deleteWsConfigDetailByIds(ids));
}
/**
* 批量保存Detail
*/
@Log(title = "批量保存Detail", businessType = BusinessType.OTHER)
@PostMapping("/addDetailList/{wsConfigId}/{xmlFlag}")
public AjaxResult addDetailList(
@PathVariable("wsConfigId") Long wsConfigId,
@PathVariable("xmlFlag") String xmlFlag,
@RequestBody List<WsConfigDetail> detailList) {
if (StringUtils.isEmpty(detailList)) {
return AjaxResult.error("所选数据为空");
}
if (StringUtils.isEmpty(xmlFlag)) {
return AjaxResult.error("请选择所属xml");
}
wsConfigDetailService.addDetailList(wsConfigId, xmlFlag, detailList);
return AjaxResult.success();
}
/**
* 批量修改Detail
*/
@Log(title = "批量修改Detail", businessType = BusinessType.OTHER)
@PostMapping("/updateDetailList")
public AjaxResult updateDetailList(@RequestBody List<WsConfigDetail> detailList) {
wsConfigDetailService.updateDetailList(detailList);
return AjaxResult.success();
}
/**
* 生成目标字段
*/
@Log(title = "生成目标字段", businessType = BusinessType.OTHER)
@PostMapping("/importTargetKey")
public AjaxResult importTargetKey(@RequestBody ImportParam importParam) {
List<Map<String, Object>> r = wsConfigDetailService.importTargetKey(importParam);
return AjaxResult.success(r);
}
}
package com.tbyf.his.web.controller.dataImport;
import com.tbyf.his.common.annotation.IgnoreWebSecurity;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.core.page.TableDataInfo;
import com.tbyf.his.emport.domain.param.QueryTemplateParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author lzz
* @date 2023/2/7 10:42
*/
@RestController
@Api(tags = "数据导入接口")
@RequestMapping("/dataImport")
@Slf4j
public class DataImportController {
@IgnoreWebSecurity
@GetMapping("/template")
@ApiOperation("分页模板查询")
public AjaxResult queryTemplate(@Validated QueryTemplateParam param) {
return AjaxResult.success();
}
}
package com.tbyf.his.web.controller.dataset;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.platform.domain.BDataset;
import com.tbyf.his.platform.service.IBDatasetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 数据集 信息操作处理
*
* @author guopx
* @date 2020/10/19
*/
@RestController
@RequestMapping("/platform/dataSet/bDataset")
public class BDatasetController extends BaseController {
@Autowired
private IBDatasetService bDatasetService;
/**
* 查询数据集列表
*/
@GetMapping("/list")
public List<BDataset> list(BDataset bDataset) {
List<BDataset> list = bDatasetService.selectBDatasetList(bDataset);
return list;
}
}
package com.tbyf.his.web.controller.dataset;
import com.tbyf.his.adapter.domain.BCodevalue;
import com.tbyf.his.analysis.domain.BDatasetvsmetadata;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.utils.SecurityUtils;
import com.tbyf.his.platform.domain.BDatasetvsmetadataVo;
import com.tbyf.his.platform.service.IBDatasetvsmetadataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 数据集关联数据元 信息操作处理
*
* @author guopx
* @date 2020/10/21
*/
@RestController
@RequestMapping("/platform/dataSetMeta/bDatasetvsmetadata")
public class BDatasetvsmetadataController extends BaseController {
@Autowired
private IBDatasetvsmetadataService bDatasetvsmetadataService;
/**
* 查询数据集关联数据元列表
*/
@GetMapping("/list")
public AjaxResult list(BDatasetvsmetadata bDatasetvsmetadata) {
List<BDatasetvsmetadataVo> list = bDatasetvsmetadataService.selectBDatasetvsmetadataList(bDatasetvsmetadata);
return AjaxResult.success(list);
}
}
package com.tbyf.his.web.controller.monitor;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisCallback;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 缓存监控
*
* @author guopx
*/
@RestController
@RequestMapping("/monitor/cache")
public class CacheController {
@Autowired
private RedisTemplate<String, String> redisTemplate;
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping()
public AjaxResult getInfo() throws Exception {
Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
Map<String, Object> result = new HashMap<>(3);
result.put("info", info);
result.put("dbSize", dbSize);
List<Map<String, String>> pieList = new ArrayList<>();
commandStats.stringPropertyNames().forEach(key -> {
Map<String, String> data = new HashMap<>(2);
String property = commandStats.getProperty(key);
data.put("name", StringUtils.removeStart(key, "cmdstat_"));
data.put("value", StringUtils.substringBetween(property, "calls=", ",usec"));
pieList.add(data);
});
result.put("commandStats", pieList);
return AjaxResult.success(result);
}
}
package com.tbyf.his.web.controller.monitor;
import com.tbyf.his.common.core.domain.AjaxResult;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tbyf.his.framework.web.domain.Server;
/**
* 服务器监控
*
* @author guopx
*/
@RestController
@RequestMapping("/monitor/server")
public class ServerController {
@PreAuthorize("@ss.hasPermi('monitor:server:list')")
@GetMapping()
public AjaxResult getInfo() throws Exception {
Server server = new Server();
server.copyTo();
return AjaxResult.success(server);
}
}
package com.tbyf.his.web.controller.monitor;
import com.tbyf.his.common.annotation.Log;
import com.tbyf.his.common.constant.Constants;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.core.page.TableDataInfo;
import com.tbyf.his.common.enums.BusinessType;
import com.tbyf.his.common.exception.job.TaskException;
import com.tbyf.his.common.utils.StringUtils;
import com.tbyf.his.common.utils.poi.ExcelUtil;
import com.tbyf.his.job.domain.SysJobNew;
import com.tbyf.his.job.service.ISysJobNewService;
import com.tbyf.his.quartz.util.CronUtils;
import com.tbyf.his.quartz.util.ScheduleUtils;
import org.quartz.SchedulerException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* @author: fr
* @date: 2022年07月25日 9:52
*/
@RestController
@RequestMapping("/monitor/new_job")
public class SysJobNewController extends BaseController {
@Autowired
private ISysJobNewService jobService;
/**
* 查询定时任务列表
*/
@PreAuthorize("@ss.hasPermi('monitor:new_job:list')")
@GetMapping("/list")
public TableDataInfo list(SysJobNew sysJob) {
startPage();
List<SysJobNew> list = jobService.selectJobList(sysJob);
return getDataTable(list);
}
/**
* 导出定时任务列表
*/
@PreAuthorize("@ss.hasPermi('monitor:new_job:export')")
@Log(title = "定时任务", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SysJobNew sysJob) {
List<SysJobNew> list = jobService.selectJobList(sysJob);
ExcelUtil<SysJobNew> util = new ExcelUtil<SysJobNew>(SysJobNew.class);
util.exportExcel(response, list, "定时任务");
}
/**
* 获取定时任务详细信息
*/
@PreAuthorize("@ss.hasPermi('monitor:new_job:query')")
@GetMapping(value = "/{jobId}")
public AjaxResult getInfo(@PathVariable("jobId") Long jobId) {
return AjaxResult.success(jobService.selectJobById(jobId));
}
/**
* 新增定时任务
*/
@PreAuthorize("@ss.hasPermi('monitor:new_job:add')")
@Log(title = "定时任务", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SysJobNew job) throws SchedulerException, TaskException {
if (!CronUtils.isValid(job.getCronExpression())) {
return error("新增任务'" + job.getJobName() + "'失败,Cron表达式不正确");
} else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI)) {
return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'rmi'调用");
} else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[]{Constants.LOOKUP_LDAP, Constants.LOOKUP_LDAPS})) {
return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'ldap(s)'调用");
} else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[]{Constants.HTTP, Constants.HTTPS})) {
return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'http(s)'调用");
} else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), Constants.JOB_ERROR_STR)) {
return error("新增任务'" + job.getJobName() + "'失败,目标字符串存在违规");
}
// else if (!ScheduleUtils.whiteList(job.getInvokeTarget()))
// {
// return error("新增任务'" + job.getJobName() + "'失败,目标字符串不在白名单内");
// }
job.setCreateBy(getUsername());
return toAjax(jobService.insertJob(job));
}
/**
* 修改定时任务
*/
@PreAuthorize("@ss.hasPermi('monitor:new_job:edit')")
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysJobNew job) throws SchedulerException, TaskException {
if (!CronUtils.isValid(job.getCronExpression())) {
return error("修改任务'" + job.getJobName() + "'失败,Cron表达式不正确");
} else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI)) {
return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'rmi'调用");
} else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[]{Constants.LOOKUP_LDAP, Constants.LOOKUP_LDAPS})) {
return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'ldap(s)'调用");
} else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[]{Constants.HTTP, Constants.HTTPS})) {
return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'http(s)'调用");
} else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), Constants.JOB_ERROR_STR)) {
return error("修改任务'" + job.getJobName() + "'失败,目标字符串存在违规");
} else if (!ScheduleUtils.whiteList(job.getInvokeTarget())) {
return error("修改任务'" + job.getJobName() + "'失败,目标字符串不在白名单内");
}
job.setUpdateBy(getUsername());
return toAjax(jobService.updateJob(job));
}
/**
* 定时任务状态修改
*/
@PreAuthorize("@ss.hasPermi('monitor:new_job:changeStatus')")
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody SysJobNew job) throws SchedulerException {
SysJobNew newJob = jobService.selectJobById(job.getJobId());
newJob.setStatus(job.getStatus());
return toAjax(jobService.changeStatus(newJob));
}
/**
* 定时任务立即执行一次
*/
@PreAuthorize("@ss.hasPermi('monitor:new_job:changeStatus')")
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
@PutMapping("/run")
public AjaxResult run(@RequestBody SysJobNew job) throws SchedulerException {
jobService.run(job);
return AjaxResult.success();
}
/**
* 删除定时任务
*/
@PreAuthorize("@ss.hasPermi('monitor:new_job:remove')")
@Log(title = "定时任务", businessType = BusinessType.DELETE)
@DeleteMapping("/{jobIds}")
public AjaxResult remove(@PathVariable Long[] jobIds) throws SchedulerException, TaskException {
jobService.deleteJobByIds(jobIds);
return AjaxResult.success();
}
/**
* 查询定时任务列表
*/
@PreAuthorize("@ss.hasPermi('monitor:new_job:updateFile')")
@GetMapping("/updateFile")
public AjaxResult updateFile(MultipartFile file) {
return AjaxResult.success(jobService.updateFile(file));
}
}
package com.tbyf.his.web.controller.monitor;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.tbyf.his.common.annotation.Log;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.core.page.TableDataInfo;
import com.tbyf.his.common.enums.BusinessType;
import com.tbyf.his.common.utils.poi.ExcelUtil;
import com.tbyf.his.framework.system.domain.SysLogininfor;
import com.tbyf.his.framework.system.service.ISysLogininforService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 系统访问记录
*
* @author guopx
*/
@RestController
@RequestMapping("/monitor/logininfor")
public class SysLogininforController extends BaseController {
@Autowired
private ISysLogininforService logininforService;
@PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
@GetMapping("/list")
public TableDataInfo list(SysLogininfor logininfor) {
startPage();
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
return getDataTable(list);
}
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysLogininfor logininfor) {
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
util.exportExcel(response, list, "登录日志");
}
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
@Log(title = "登录日志", businessType = BusinessType.DELETE)
@DeleteMapping("/{infoIds}")
public AjaxResult remove(@PathVariable Long[] infoIds) {
return toAjax(logininforService.deleteLogininforByIds(infoIds));
}
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
@DeleteMapping("/clean")
public AjaxResult clean() {
logininforService.cleanLogininfor();
return AjaxResult.success();
}
}
package com.tbyf.his.web.controller.monitor;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.tbyf.his.common.annotation.Log;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.core.page.TableDataInfo;
import com.tbyf.his.common.enums.BusinessType;
import com.tbyf.his.common.utils.poi.ExcelUtil;
import com.tbyf.his.framework.system.domain.SysOperLog;
import com.tbyf.his.framework.system.service.ISysOperLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 操作日志记录
*
* @author guopx
*/
@RestController
@RequestMapping("/monitor/operlog")
public class SysOperlogController extends BaseController {
@Autowired
private ISysOperLogService operLogService;
@PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
@GetMapping("/list")
public TableDataInfo list(SysOperLog operLog) {
startPage();
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
return getDataTable(list);
}
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysOperLog operLog) {
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
util.exportExcel(response, list, "操作日志");
}
@Log(title = "操作日志", businessType = BusinessType.DELETE)
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
@DeleteMapping("/{operIds}")
public AjaxResult remove(@PathVariable Long[] operIds) {
return toAjax(operLogService.deleteOperLogByIds(operIds));
}
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
@DeleteMapping("/clean")
public AjaxResult clean() {
operLogService.cleanOperLog();
return AjaxResult.success();
}
}
package com.tbyf.his.web.controller.monitor;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import com.tbyf.his.common.constant.Constants;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.core.domain.model.LoginUser;
import com.tbyf.his.common.core.page.TableDataInfo;
import com.tbyf.his.common.core.redis.RedisCache;
import com.tbyf.his.common.enums.BusinessType;
import com.tbyf.his.common.utils.StringUtils;
import com.tbyf.his.framework.system.domain.SysUserOnline;
import com.tbyf.his.framework.system.service.ISysUserOnlineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tbyf.his.common.annotation.Log;
/**
* 在线用户监控
*
* @author guopx
*/
@RestController
@RequestMapping("/monitor/online")
public class SysUserOnlineController extends BaseController {
@Autowired
private ISysUserOnlineService userOnlineService;
@Autowired
private RedisCache redisCache;
@PreAuthorize("@ss.hasPermi('monitor:online:list')")
@GetMapping("/list")
public TableDataInfo list(String ipaddr, String userName) {
Collection<String> keys = redisCache.keys(Constants.LOGIN_TOKEN_KEY + "*");
List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
for (String key : keys) {
LoginUser user = redisCache.getCacheObject(key);
if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName)) {
if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername())) {
userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
}
} else if (StringUtils.isNotEmpty(ipaddr)) {
if (StringUtils.equals(ipaddr, user.getIpaddr())) {
userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
}
} else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser())) {
if (StringUtils.equals(userName, user.getUsername())) {
userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
}
} else {
userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
}
}
Collections.reverse(userOnlineList);
userOnlineList.removeAll(Collections.singleton(null));
return getDataTable(userOnlineList);
}
/**
* 强退用户
*/
@PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
@Log(title = "在线用户", businessType = BusinessType.FORCE)
@DeleteMapping("/{tokenId}")
public AjaxResult forceLogout(@PathVariable String tokenId) {
redisCache.deleteObject(Constants.LOGIN_TOKEN_KEY + tokenId);
return AjaxResult.success();
}
}
package com.tbyf.his.web.controller.patient360;
import com.tbyf.his.closeloop.domain.CloseLoopManuInfo;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.core.page.TableDataInfo;
import com.tbyf.his.framework.system.domain.SysOperLog;
import com.tbyf.his.patient360.domain.Patient360CountInfo;
import com.tbyf.his.patient360.domain.Patient360Info;
import com.tbyf.his.patient360.domain.Patient360MenuInfo;
import com.tbyf.his.patient360.service.Patient360Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* 患者360模块
*/
@RestController()
@RequestMapping("/patient360")
public class Patient360Contorller extends BaseController {
@Autowired
Patient360Service patient360Service;
/**
* 患者360日志监控查询
*
* @param patient360Info
* @return
*/
@GetMapping("/list")
public TableDataInfo getPatient360Info(Patient360Info patient360Info) {
startPage();
if (patient360Info.getPageNum() == null || patient360Info.getPageSize() == null) {
patient360Info.setPageSize(20L);
patient360Info.setPageNum(1L);
}
List<SysOperLog> sysOperLogs = patient360Service.queryPatient360Info(patient360Info);
return getDataTable(sysOperLogs);
}
/**
* 患者360日志监控查询统计
*
* @param patient360Info
* @return
*/
@PostMapping("/getPatient360Count")
public AjaxResult getPatient360Count(@RequestBody Patient360Info patient360Info) {
Map<String, List<Patient360CountInfo>> patient360CountInfos = patient360Service.queryPatient360Count(patient360Info);
return new AjaxResult(200, "成功", patient360CountInfos);
}
@GetMapping("/getPatient360Menu")
public TableDataInfo getPatient360Manu(Patient360MenuInfo patient360MenuInfo) {
List<Patient360MenuInfo> patient360MenuInfos = patient360Service.queryPatient360Menu(patient360MenuInfo);
return getDataTable(patient360MenuInfos);
}
@PostMapping("/addPatient360Menu")
public AjaxResult addPatient360Manu(@RequestBody Patient360MenuInfo patient360MenuInfo) {
int i = patient360Service.addPatient360Manu(patient360MenuInfo);
return toAjax(i);
}
@PostMapping("/updatePatient360Menu")
public AjaxResult updatePatient360Manu(@RequestBody Patient360MenuInfo patient360MenuInfo) {
int i = patient360Service.updatePatient360Manu(patient360MenuInfo);
return toAjax(i);
}
@PostMapping("/delPatient360Menu")
public AjaxResult delPatient360Menu(@RequestBody Patient360MenuInfo patient360MenuInfo) {
int i = patient360Service.delPatient360Menu(patient360MenuInfo);
return toAjax(i);
}
}
package com.tbyf.his.web.controller.print;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.tbyf.his.common.annotation.Log;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.core.page.TableDataInfo;
import com.tbyf.his.common.enums.BusinessType;
import com.tbyf.his.common.utils.poi.ExcelUtil;
import com.tbyf.his.print.domain.PrintDataset;
import com.tbyf.his.print.domain.PrintMetadata;
import com.tbyf.his.print.service.IPrintDatasetService;
import com.tbyf.his.print.service.IPrintMetadataService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 数据集信息Controller
*
* @author x
* @date 2022-02-25
*/
@Api(tags = "打印模板-数据集")
@RestController
@RequestMapping("/print/dataset")
public class PrintDatasetController extends BaseController {
@Autowired
private IPrintDatasetService printDatasetService;
@Autowired
private IPrintMetadataService printMetadataService;
/**
* 查询数据集信息列表
*/
// @PreAuthorize("@ss.hasPermi('dataset:dataset:list')")
@GetMapping("/list")
public TableDataInfo list(PrintDataset printDataset) {
startPage();
List<PrintDataset> list = printDatasetService.selectPrintDatasetList(printDataset);
return getDataTable(list);
}
/**
* 导出数据集信息列表
*/
// @PreAuthorize("@ss.hasPermi('dataset:dataset:export')")
@Log(title = "数据集信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, PrintDataset printDataset) {
List<PrintDataset> list = printDatasetService.selectPrintDatasetList(printDataset);
ExcelUtil<PrintDataset> util = new ExcelUtil<PrintDataset>(PrintDataset.class);
util.exportExcel(response, list, "数据集信息数据");
}
/**
* 获取数据集信息详细信息
*/
// @PreAuthorize("@ss.hasPermi('dataset:dataset:query')")
@GetMapping(value = "/{datasetId}")
public AjaxResult getInfo(@PathVariable("datasetId") Long datasetId) {
return AjaxResult.success(printDatasetService.selectPrintDatasetByDatasetId(datasetId));
}
/**
* 新增数据集信息
*/
// @PreAuthorize("@ss.hasPermi('dataset:dataset:add')")
@Log(title = "数据集信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody PrintDataset printDataset) {
return toAjax(printDatasetService.insertPrintDataset(printDataset));
}
/**
* 修改数据集信息
*/
// @PreAuthorize("@ss.hasPermi('dataset:dataset:edit')")
@Log(title = "数据集信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody PrintDataset printDataset) {
return toAjax(printDatasetService.updatePrintDataset(printDataset));
}
/**
* 删除数据集信息
*/
// @PreAuthorize("@ss.hasPermi('dataset:dataset:remove')")
@Log(title = "数据集信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{datasetIds}")
public AjaxResult remove(@PathVariable Long[] datasetIds) {
return toAjax(printDatasetService.deletePrintDatasetByDatasetIds(datasetIds));
}
/**
* 打印模板设计页左边的数据集fieldList
*/
// @PreAuthorize("@ss.hasPermi('dataset:dataset:allFieldList')")
@Log(title = "数据集信息", businessType = BusinessType.OTHER)
@GetMapping("/allFieldList")
public AjaxResult allFieldList() {
List<PrintDataset> list = printDatasetService.allFieldList();
return AjaxResult.success(list);
}
/**
* 保存fieldList
*/
// @PreAuthorize("@ss.hasPermi('dataset:dataset:saveFieldList')")
@Log(title = "数据集信息", businessType = BusinessType.OTHER)
@PostMapping("/saveFieldList")
public AjaxResult saveFieldList(@RequestBody List<JSONObject> jsonList) {
jsonList.forEach(json -> {
PrintDataset dataset = new PrintDataset();
dataset.setDatasetName(json.getString("fieldName"));
int i = printDatasetService.insertPrintDataset(dataset);
Long datasetId = dataset.getDatasetId();
JSONArray children = json.getJSONArray("children");
List<JSONObject> printMetadata = children.toJavaList(JSONObject.class);
for (JSONObject one : printMetadata) {
PrintMetadata metadata = JSONObject.toJavaObject(one, PrintMetadata.class);
metadata.setDatasetId(datasetId);
metadata.setMetadataName(metadata.getFieldName());
metadata.setMetadataDescription("1");
metadata.setDataType("1");
metadata.setReferenceId(1L);
metadata.setIsArray("N");
metadata.setWholeMessageId(1L);
System.out.println(metadata.toString());
// PrintMetadata metadata = new PrintMetadata();
// metadata.setDatasetId(datasetId);
printMetadataService.insertPrintMetadata(metadata);
}
});
return AjaxResult.success();
}
}
package com.tbyf.his.web.controller.print;
import com.tbyf.his.common.annotation.Log;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.core.page.TableDataInfo;
import com.tbyf.his.common.enums.BusinessType;
import com.tbyf.his.common.utils.poi.ExcelUtil;
import com.tbyf.his.print.domain.PrintMetadata;
import com.tbyf.his.print.service.IPrintMetadataService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 数据元信息Controller
*
* @author x
* @date 2022-02-25
*/
@Api(tags = "打印模板-数据元")
@RestController
@RequestMapping("/print/metadata")
public class PrintMetadataController extends BaseController {
@Autowired
private IPrintMetadataService printMetadataService;
/**
* 查询数据元信息列表
*/
// @PreAuthorize("@ss.hasPermi('metadata:metadata:list')")
@GetMapping("/list")
public TableDataInfo list(PrintMetadata printMetadata) {
startPage();
List<PrintMetadata> list = printMetadataService.selectPrintMetadataList(printMetadata);
return getDataTable(list);
}
/**
* 导出数据元信息列表
*/
// @PreAuthorize("@ss.hasPermi('metadata:metadata:export')")
@Log(title = "数据元信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, PrintMetadata printMetadata) {
List<PrintMetadata> list = printMetadataService.selectPrintMetadataList(printMetadata);
ExcelUtil<PrintMetadata> util = new ExcelUtil<PrintMetadata>(PrintMetadata.class);
util.exportExcel(response, list, "数据元信息数据");
}
/**
* 获取数据元信息详细信息
*/
// @PreAuthorize("@ss.hasPermi('metadata:metadata:query')")
@GetMapping(value = "/{metadataId}")
public AjaxResult getInfo(@PathVariable("metadataId") Long metadataId) {
return AjaxResult.success(printMetadataService.selectPrintMetadataByMetadataId(metadataId));
}
/**
* 新增数据元信息
*/
// @PreAuthorize("@ss.hasPermi('metadata:metadata:add')")
@Log(title = "数据元信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody PrintMetadata printMetadata) {
return toAjax(printMetadataService.insertPrintMetadata(printMetadata));
}
/**
* 修改数据元信息
*/
// @PreAuthorize("@ss.hasPermi('metadata:metadata:edit')")
@Log(title = "数据元信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody PrintMetadata printMetadata) {
return toAjax(printMetadataService.updatePrintMetadata(printMetadata));
}
/**
* 删除数据元信息
*/
// @PreAuthorize("@ss.hasPermi('metadata:metadata:remove')")
@Log(title = "数据元信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{metadataIds}")
public AjaxResult remove(@PathVariable Long[] metadataIds) {
return toAjax(printMetadataService.deletePrintMetadataByMetadataIds(metadataIds));
}
}
package com.tbyf.his.web.controller.print;
import com.tbyf.his.common.annotation.Log;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.core.page.TableDataInfo;
import com.tbyf.his.common.enums.BusinessType;
import com.tbyf.his.common.utils.poi.ExcelUtil;
import com.tbyf.his.print.domain.PrintTemplate;
import com.tbyf.his.print.service.IPrintTemplateService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 打印模板Controller
*
* @author x
* @date 2022-02-25
*/
@Api(tags = "打印模板")
@RestController
@RequestMapping("/print/template")
public class PrintTemplateController extends BaseController {
@Autowired
private IPrintTemplateService printTemplateService;
/**
* 查询打印模板列表
*/
// @PreAuthorize("@ss.hasPermi('print:template:list')")
@GetMapping("/list")
public TableDataInfo list(PrintTemplate printTemplate) {
startPage();
List<PrintTemplate> list = printTemplateService.selectPrintTemplateList(printTemplate);
return getDataTable(list);
}
/**
* 导出打印模板列表
*/
// @PreAuthorize("@ss.hasPermi('print:template:export')")
@Log(title = "打印模板", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, PrintTemplate printTemplate) {
List<PrintTemplate> list = printTemplateService.selectPrintTemplateList(printTemplate);
ExcelUtil<PrintTemplate> util = new ExcelUtil<PrintTemplate>(PrintTemplate.class);
util.exportExcel(response, list, "打印模板数据");
}
/**
* 获取打印模板详细信息
*/
// @PreAuthorize("@ss.hasPermi('print:template:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(printTemplateService.selectPrintTemplateById(id));
}
/**
* 新增打印模板
*/
// @PreAuthorize("@ss.hasPermi('print:template:add')")
@Log(title = "打印模板", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody PrintTemplate printTemplate) {
return toAjax(printTemplateService.insertPrintTemplate(printTemplate));
}
/**
* 修改打印模板
*/
// @PreAuthorize("@ss.hasPermi('print:template:edit')")
@Log(title = "打印模板", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody PrintTemplate printTemplate) {
return toAjax(printTemplateService.updatePrintTemplate(printTemplate));
}
/**
* 删除打印模板
*/
// @PreAuthorize("@ss.hasPermi('print:template:remove')")
@Log(title = "打印模板", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(printTemplateService.deletePrintTemplateByIds(ids));
}
/**
* 打印模板及打印项信息
*/
//@PreAuthorize("@ss.hasPermi('print:template:getTempItemById')")
@GetMapping(value = "/getTempItemById/{id}")
public AjaxResult getTempItemById(@PathVariable("id") Long id) {
return AjaxResult.success(printTemplateService.getTempItemById(id));
}
/**
* 保存打印模板及打印项信息
*/
// @PreAuthorize("@ss.hasPermi('print:template:saveTempItemById')")
@PostMapping(value = "/saveTempItemById")
public AjaxResult saveTempItemById(@RequestBody PrintTemplate printTemplate) {
return AjaxResult.success(printTemplateService.saveTempItemById(printTemplate));
}
}
package com.tbyf.his.web.controller.publish;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.platform.domain.PfIdLabel;
import com.tbyf.his.platform.service.IPMPubliserviewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 同步消息配置Controller
*
* @author guopx
* @date 2020-11-05
*/
@RestController
@RequestMapping("/platform/syncSeting")
public class PMSyncsettingController extends BaseController {
@Autowired
private IPMPubliserviewService pMPubliserviewService;
/**
* 查询发布者列表
*/
@GetMapping("/publisher")
public AjaxResult publisherTree() {
List<PfIdLabel> list = pMPubliserviewService.selectPublisherTree();
return AjaxResult.success(list);
}
/**
* 查询发布数据集列表
*/
@GetMapping("/pubDataSets/{publisercode}")
public AjaxResult pubDataSets(@PathVariable String publisercode) {
return AjaxResult.success(pMPubliserviewService.selectDataSetsByPub(publisercode));
}
}
package com.tbyf.his.web.controller.system;
import java.io.IOException;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.tbyf.his.common.annotation.Log;
import com.tbyf.his.common.config.RuoYiConfig;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.core.domain.model.LoginUser;
import com.tbyf.his.common.core.page.TableDataInfo;
import com.tbyf.his.common.enums.BusinessType;
import com.tbyf.his.common.utils.file.FileUploadUtils;
import com.tbyf.his.common.utils.poi.ExcelUtil;
import com.tbyf.his.system.domain.SysApplication;
import com.tbyf.his.system.service.ISysApplicationService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
/**
* 应用管理Controller
*
* @author
* @date 2022-03-17
*/
@RestController
@RequestMapping("/system/application")
public class SysApplicationController extends BaseController {
@Autowired
private ISysApplicationService sysApplicationService;
/**
* 查询应用管理列表
*/
@PreAuthorize("@ss.hasPermi('system:application:list')")
@GetMapping("/list")
public TableDataInfo list(SysApplication sysApplication) {
startPage();
List<SysApplication> list = sysApplicationService.selectSysApplicationList(sysApplication);
return getDataTable(list);
}
/**
* 查询应用管理列表
*/
//@PreAuthorize("@ss.hasPermi('system:application:appInfos')")
@GetMapping("/appInfos")
public AjaxResult appInfos() {
List<SysApplication> list = sysApplicationService.selectSysApplicationList(new SysApplication());
return AjaxResult.success(list);
}
/**
* 导出应用管理列表
*/
@PreAuthorize("@ss.hasPermi('system:application:export')")
@Log(title = "应用管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SysApplication sysApplication) {
List<SysApplication> list = sysApplicationService.selectSysApplicationList(sysApplication);
ExcelUtil<SysApplication> util = new ExcelUtil<SysApplication>(SysApplication.class);
util.exportExcel(response, list, "应用管理数据");
}
/**
* 获取应用管理详细信息
*/
@PreAuthorize("@ss.hasPermi('system:application:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(sysApplicationService.selectSysApplicationById(id));
}
/**
* 新增应用管理
*/
@PreAuthorize("@ss.hasPermi('system:application:add')")
@Log(title = "应用管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SysApplication sysApplication) {
int i = sysApplicationService.insertSysApplication(sysApplication);
if (i != 0) {
return AjaxResult.success(sysApplication);
}
return AjaxResult.error("新增失败");
}
/**
* 修改应用管理
*/
@PreAuthorize("@ss.hasPermi('system:application:edit')")
@Log(title = "应用管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysApplication sysApplication) {
return toAjax(sysApplicationService.updateSysApplication(sysApplication));
}
/**
* 删除应用管理
*/
@PreAuthorize("@ss.hasPermi('system:application:remove')")
@Log(title = "应用管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(sysApplicationService.deleteSysApplicationByIds(ids));
}
/**
* 图片上传
*/
@Log(title = "应用图标", businessType = BusinessType.UPDATE)
@PostMapping("/avatar")
public AjaxResult avatar(@RequestParam("id") Long id, @RequestParam("avatarfile") MultipartFile file) throws IOException {
if (!file.isEmpty()) {
SysApplication sysApplication = sysApplicationService.selectSysApplicationById(id);
String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file);
sysApplication.setAppIcon(avatar);
if (sysApplicationService.updateSysApplication(sysApplication) != 0) {
AjaxResult ajax = AjaxResult.success();
ajax.put("imgUrl", avatar);
return ajax;
}
}
return AjaxResult.error("上传图片异常,请联系管理员");
}
}
package com.tbyf.his.web.controller.system;
import com.tbyf.his.common.annotation.Log;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.core.page.TableDataInfo;
import com.tbyf.his.common.enums.BusinessType;
import com.tbyf.his.common.utils.poi.ExcelUtil;
import com.tbyf.his.system.domain.SysBjgColumn;
import com.tbyf.his.system.service.ISysBjgColumnService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 结构_列说明Controller
*
* @author guopx
* @date 2022-05-12
*/
@RestController
@RequestMapping("/system/column")
public class SysBjgColumnController extends BaseController {
@Autowired
private ISysBjgColumnService sysBjgColumnService;
/**
* 查询结构_列说明列表
*/
@PreAuthorize("@ss.hasPermi('system:column:list')")
@GetMapping("/list")
public TableDataInfo list(SysBjgColumn sysBjgColumn) {
startPage();
List<SysBjgColumn> list = sysBjgColumnService.selectSysBjgColumnList(sysBjgColumn);
return getDataTable(list);
}
/**
* 模糊查询
*/
@GetMapping("/likeSelect")
public TableDataInfo list4(SysBjgColumn sysBjgColumn) {
startPage();
List<SysBjgColumn> list = sysBjgColumnService.likeSelectSysBjgColumn(sysBjgColumn);
return getDataTable(list);
}
/**
* 导出结构_列说明列表
*/
@PreAuthorize("@ss.hasPermi('system:column:export')")
@Log(title = "结构_列说明", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SysBjgColumn sysBjgColumn) {
List<SysBjgColumn> list = sysBjgColumnService.selectSysBjgColumnList(sysBjgColumn);
ExcelUtil<SysBjgColumn> util = new ExcelUtil<SysBjgColumn>(SysBjgColumn.class);
util.exportExcel(response, list, "结构_列说明数据");
}
/**
* 获取结构_列说明详细信息
*/
@PreAuthorize("@ss.hasPermi('system:column:query')")
@GetMapping("/{tabName}")
public TableDataInfo getInfo(@PathVariable("tabName") String tabName) {
startPage();
List<SysBjgColumn> list = sysBjgColumnService.selectSysBjgColumnByTabName(tabName);
return getDataTable(list);
}
/**
* 新增结构_列说明
*/
@PreAuthorize("@ss.hasPermi('system:column:add')")
@Log(title = "结构_列说明", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SysBjgColumn sysBjgColumn) {
return toAjax(sysBjgColumnService.insertSysBjgColumn(sysBjgColumn));
}
/**
* 修改结构_列说明
*/
@PreAuthorize("@ss.hasPermi('system:column:edit')")
@Log(title = "结构_列说明", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysBjgColumn sysBjgColumn) {
return toAjax(sysBjgColumnService.updateSysBjgColumn(sysBjgColumn));
}
/**
* 删除结构_列说明
*/
@PreAuthorize("@ss.hasPermi('system:column:remove')")
@Log(title = "结构_列说明", businessType = BusinessType.DELETE)
@DeleteMapping("/{tabNames}")
public AjaxResult remove(@PathVariable String[] tabNames) {
return toAjax(sysBjgColumnService.deleteSysBjgColumnByTabNames(tabNames));
}
}
package com.tbyf.his.web.controller.system;
import com.tbyf.his.common.annotation.Log;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.core.page.TableDataInfo;
import com.tbyf.his.common.enums.BusinessType;
import com.tbyf.his.common.utils.poi.ExcelUtil;
import com.tbyf.his.system.domain.SysBjgTable;
import com.tbyf.his.system.service.ISysBjgTableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 结构_说明Controller
*
* @author guopx
* @date 2022-05-12
*/
@RestController
@RequestMapping("/system/table")
public class SysBjgTableController extends BaseController {
@Autowired
private ISysBjgTableService sysBjgTableService;
/**
* 查询结构_说明列表
*/
@PreAuthorize("@ss.hasPermi('system:table:list')")
@GetMapping("/list")
public TableDataInfo list(SysBjgTable sysBjgTable) {
startPage();
List<SysBjgTable> list = sysBjgTableService.selectSysBjgTableList(sysBjgTable);
return getDataTable(list);
}
/**
* 导出结构_说明列表
*/
@PreAuthorize("@ss.hasPermi('system:table:export')")
@Log(title = "结构_说明", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SysBjgTable sysBjgTable) {
List<SysBjgTable> list = sysBjgTableService.selectSysBjgTableList(sysBjgTable);
ExcelUtil<SysBjgTable> util = new ExcelUtil<SysBjgTable>(SysBjgTable.class);
util.exportExcel(response, list, "结构_说明数据");
}
/**
* 获取结构_说明详细信息
*/
@PreAuthorize("@ss.hasPermi('system:table:query')")
@GetMapping(value = "/{tabName}")
public AjaxResult getInfo(@PathVariable("tabName") String tabName) {
return AjaxResult.success(sysBjgTableService.selectSysBjgTableByTabName(tabName));
}
/**
* 模糊查询
*/
@GetMapping(value = "/likeSelect")
public TableDataInfo list2(SysBjgTable sysBjgTable) {
startPage();
List<SysBjgTable> list = sysBjgTableService.likeSelectSysBjgTable(sysBjgTable);
return getDataTable(list);
}
/**
* 新增结构_说明
*/
@PreAuthorize("@ss.hasPermi('system:table:add')")
@Log(title = "结构_说明", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SysBjgTable sysBjgTable) {
return toAjax(sysBjgTableService.insertSysBjgTable(sysBjgTable));
}
/**
* 修改结构_说明
*/
@PreAuthorize("@ss.hasPermi('system:table:edit')")
@Log(title = "结构_说明", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysBjgTable sysBjgTable) {
return toAjax(sysBjgTableService.updateSysBjgTable(sysBjgTable));
}
/**
* 删除结构_说明
*/
@PreAuthorize("@ss.hasPermi('system:table:remove')")
@Log(title = "结构_说明", businessType = BusinessType.DELETE)
@DeleteMapping("/{tabNames}")
public AjaxResult remove(@PathVariable String[] tabNames) {
return toAjax(sysBjgTableService.deleteSysBjgTableByTabNames(tabNames));
}
}
package com.tbyf.his.web.controller.system;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.utils.StringUtils;
import com.tbyf.his.system.domain.SysCategory;
import com.tbyf.his.system.service.ISysCategoryService;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.Iterator;
import java.util.List;
/**
* 插件种类信息
*/
@RestController
@RequestMapping("/system/category")
public class SysCategoryController extends BaseController {
@Autowired
private ISysCategoryService categoryService;
/**
* 获取插件种类列表
*/
@PreAuthorize("@ss.hasPermi('system:category:list')")
@GetMapping("/list")
public AjaxResult list(SysCategory category) {
List<SysCategory> categories = categoryService.selectDeptList(category);
return AjaxResult.success(categories);
}
/**
* 获取插件种类列表(排除节点)
*/
@PreAuthorize("@ss.hasPermi('system:category:list')")
@GetMapping("/list/exclude/{categoryId}")
public AjaxResult excludeChild(@PathVariable(value = "categoryId", required = false) Long categoryId) {
List<SysCategory> categories = categoryService.selectDeptList(new SysCategory());
Iterator<SysCategory> it = categories.iterator();
while (it.hasNext()) {
SysCategory c = (SysCategory) it.next();
if (c.getCategoryId().intValue() == categoryId
|| ArrayUtils.contains(StringUtils.split(c.getAncestors(), ","), categoryId + "")) {
it.remove();
}
}
return AjaxResult.success(categories);
}
/**
* 根据部门编号获取详细信息
*/
@PreAuthorize("@ss.hasPermi('system:category:query')")
@GetMapping(value = "/{categoryId}")
public AjaxResult getInfo(@PathVariable Long categoryId) {
categoryService.checkCategoryDataScope(categoryId);
return AjaxResult.success(categoryService.selectCategoryById(categoryId));
}
/**
* 获取部门下拉树列表
*/
@GetMapping("/treeselect")
public AjaxResult treeselect(SysCategory category) {
List<SysCategory> categories = categoryService.selectDeptList(category);
return AjaxResult.success(categoryService.buildCategoryTreeSelect(categories));
}
}
package com.tbyf.his.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.tbyf.his.common.constant.UserConstants;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.core.page.TableDataInfo;
import com.tbyf.his.common.enums.BusinessType;
import com.tbyf.his.common.utils.poi.ExcelUtil;
import com.tbyf.his.framework.system.domain.SysConfig;
import com.tbyf.his.framework.system.service.ISysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tbyf.his.common.annotation.Log;
/**
* 参数配置 信息操作处理
*
* @author guopx
*/
@RestController
@RequestMapping("/system/config")
public class SysConfigController extends BaseController {
@Autowired
private ISysConfigService configService;
/**
* 获取参数配置列表
*/
@PreAuthorize("@ss.hasPermi('system:config:list')")
@GetMapping("/list")
public TableDataInfo list(SysConfig config) {
startPage();
List<SysConfig> list = configService.selectConfigList(config);
return getDataTable(list);
}
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:config:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysConfig config) {
List<SysConfig> list = configService.selectConfigList(config);
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
util.exportExcel(response, list, "参数数据");
}
/**
* 根据参数编号获取详细信息
*/
@PreAuthorize("@ss.hasPermi('system:config:query')")
@GetMapping(value = "/{configId}")
public AjaxResult getInfo(@PathVariable Long configId) {
return AjaxResult.success(configService.selectConfigById(configId));
}
/**
* 根据参数键名查询参数值
*/
@GetMapping(value = "/configKey/{configKey}")
public AjaxResult getConfigKey(@PathVariable String configKey) {
return AjaxResult.success(configService.selectConfigByKey(configKey));
}
/**
* 新增参数配置
*/
@PreAuthorize("@ss.hasPermi('system:config:add')")
@Log(title = "参数管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysConfig config) {
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) {
return AjaxResult.error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
}
config.setCreateBy(getUsername());
return toAjax(configService.insertConfig(config));
}
/**
* 修改参数配置
*/
@PreAuthorize("@ss.hasPermi('system:config:edit')")
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysConfig config) {
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) {
return AjaxResult.error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
}
config.setUpdateBy(getUsername());
return toAjax(configService.updateConfig(config));
}
/**
* 删除参数配置
*/
@PreAuthorize("@ss.hasPermi('system:config:remove')")
@Log(title = "参数管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{configIds}")
public AjaxResult remove(@PathVariable Long[] configIds) {
configService.deleteConfigByIds(configIds);
return success();
}
/**
* 刷新参数缓存
*/
@PreAuthorize("@ss.hasPermi('system:config:remove')")
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
@DeleteMapping("/refreshCache")
public AjaxResult refreshCache() {
configService.resetConfigCache();
return AjaxResult.success();
}
}
package com.tbyf.his.web.controller.system;
import com.tbyf.his.common.annotation.Log;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.core.domain.model.MyKeyValue;
import com.tbyf.his.common.core.page.TableDataInfo;
import com.tbyf.his.common.enums.BusinessType;
import com.tbyf.his.common.utils.poi.ExcelUtil;
import com.tbyf.his.system.domain.SysDataTableVo;
import com.tbyf.his.system.domain.SysDatasource;
import com.tbyf.his.system.service.ISysDatasourceService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 数据源配置Controller
*
* @author guopx
* @date 2022-03-01
*/
@RestController
@RequestMapping("/system/datasource")
public class SysDatasourceController extends BaseController {
@Autowired
private ISysDatasourceService sysDatasourceService;
/**
* 查询数据源配置列表
*/
@PreAuthorize("@ss.hasPermi('system:datasource:list')")
@GetMapping("/list")
public TableDataInfo list(SysDatasource sysDatasource) {
startPage();
List<SysDatasource> list = sysDatasourceService.selectSysDatasourceList(sysDatasource);
return getDataTable(list);
}
/**
* 查询具有适配器标识的数据源树列表
*/
@GetMapping("/select")
public AjaxResult select() {
List<MyKeyValue> dataSource = sysDatasourceService.selectSysDatasource();
return AjaxResult.success(dataSource);
}
/**
* 导出数据源配置列表
*/
@PreAuthorize("@ss.hasPermi('system:datasource:export')")
@Log(title = "数据源配置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SysDatasource sysDatasource) {
List<SysDatasource> list = sysDatasourceService.selectSysDatasourceList(sysDatasource);
ExcelUtil<SysDatasource> util = new ExcelUtil<SysDatasource>(SysDatasource.class);
util.exportExcel(response, list, "数据源配置数据");
}
/**
* 获取数据源配置详细信息
*/
@PreAuthorize("@ss.hasPermi('system:datasource:query')")
@GetMapping(value = "/{datasourceId}")
public AjaxResult getInfo(@PathVariable("datasourceId") Long datasourceId) {
return AjaxResult.success(sysDatasourceService.selectSysDatasourceByDatasourceId(datasourceId));
}
/**
* 新增数据源配置
*/
@PreAuthorize("@ss.hasPermi('system:datasource:add')")
@Log(title = "数据源配置", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SysDatasource sysDatasource) {
return toAjax(sysDatasourceService.insertSysDatasource(sysDatasource));
}
/**
* 修改数据源配置
*/
@PreAuthorize("@ss.hasPermi('system:datasource:edit')")
@Log(title = "数据源配置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysDatasource sysDatasource) {
return toAjax(sysDatasourceService.updateSysDatasource(sysDatasource));
}
/**
* 删除数据源配置
*/
@PreAuthorize("@ss.hasPermi('system:datasource:remove')")
@Log(title = "数据源配置", businessType = BusinessType.DELETE)
@DeleteMapping("/{datasourceIds}")
public AjaxResult remove(@PathVariable Long[] datasourceIds) {
return toAjax(sysDatasourceService.deleteSysDatasourceByDatasourceIds(datasourceIds));
}
@GetMapping(value = "/getTablesBySourceId/{id}")
public AjaxResult getTablesBySourceId(@PathVariable("id") Long id) {
return AjaxResult.success(sysDatasourceService.getTablesBySourceId(id));
}
/**
* 测试连通性
*/
@GetMapping(value = "/getTestConnectBySource")
public AjaxResult testConnect(SysDatasource sysDatasource) {
sysDatasourceService.testConnectBySourceId(sysDatasource);
return AjaxResult.success();
}
/**
* 根据数据源和表名获取表分页
*
* @param sysDataTableVo
* @return
*/
@GetMapping(value = "/getTablesBySourceIdAndTableName")
public AjaxResult getTablesBySourceIdAndTableName(SysDataTableVo sysDataTableVo) {
return AjaxResult.success(sysDatasourceService.getTablesBySourceIdAndTableName(sysDataTableVo));
}
@ApiOperation("getColumnsByTableName")
@GetMapping(value = "/getColumnsByTableName/{id}/{tableName}")
public AjaxResult getColumnsByTableName(@PathVariable("id") Long id, @PathVariable("tableName") String tableName) {
return AjaxResult.success(sysDatasourceService.getColumnsByTableName(id, tableName));
}
}
package com.tbyf.his.web.controller.system;
import java.util.Iterator;
import java.util.List;
import com.tbyf.his.common.constant.UserConstants;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.core.domain.entity.SysDept;
import com.tbyf.his.common.enums.BusinessType;
import com.tbyf.his.common.utils.StringUtils;
import com.tbyf.his.framework.system.service.ISysDeptService;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tbyf.his.common.annotation.Log;
/**
* 部门信息
*
* @author guopx
*/
@RestController
@RequestMapping("/system/dept")
public class SysDeptController extends BaseController {
@Autowired
private ISysDeptService deptService;
/**
* 获取部门列表
*/
@PreAuthorize("@ss.hasPermi('system:dept:list')")
@GetMapping("/list")
public AjaxResult list(SysDept dept) {
List<SysDept> depts = deptService.selectDeptList(dept);
return AjaxResult.success(depts);
}
/**
* 查询部门列表(排除节点)
*/
@PreAuthorize("@ss.hasPermi('system:dept:list')")
@GetMapping("/list/exclude/{deptId}")
public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) {
List<SysDept> depts = deptService.selectDeptList(new SysDept());
Iterator<SysDept> it = depts.iterator();
while (it.hasNext()) {
SysDept d = (SysDept) it.next();
if (d.getDeptId().intValue() == deptId
|| ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")) {
it.remove();
}
}
return AjaxResult.success(depts);
}
/**
* 根据部门编号获取详细信息
*/
@PreAuthorize("@ss.hasPermi('system:dept:query')")
@GetMapping(value = "/{deptId}")
public AjaxResult getInfo(@PathVariable Long deptId) {
deptService.checkDeptDataScope(deptId);
return AjaxResult.success(deptService.selectDeptById(deptId));
}
/**
* 获取部门下拉树列表
*/
@GetMapping("/treeselect")
public AjaxResult treeselect(SysDept dept) {
List<SysDept> depts = deptService.selectDeptList(dept);
return AjaxResult.success(deptService.buildDeptTreeSelect(depts));
}
/**
* 加载对应角色部门列表树
*/
@GetMapping(value = "/roleDeptTreeselect/{roleId}")
public AjaxResult roleDeptTreeselect(@PathVariable("roleId") Long roleId) {
List<SysDept> depts = deptService.selectDeptList(new SysDept());
AjaxResult ajax = AjaxResult.success();
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
ajax.put("depts", deptService.buildDeptTreeSelect(depts));
return ajax;
}
/**
* 新增部门
*/
@PreAuthorize("@ss.hasPermi('system:dept:add')")
@Log(title = "部门管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysDept dept) {
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) {
return AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
}
dept.setCreateBy(getUsername());
return toAjax(deptService.insertDept(dept));
}
/**
* 修改部门
*/
@PreAuthorize("@ss.hasPermi('system:dept:edit')")
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysDept dept) {
Long deptId = dept.getDeptId();
deptService.checkDeptDataScope(deptId);
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) {
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
} else if (dept.getParentId().equals(deptId)) {
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
} else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0) {
return AjaxResult.error("该部门包含未停用的子部门!");
}
dept.setUpdateBy(getUsername());
return toAjax(deptService.updateDept(dept));
}
/**
* 删除部门
*/
@PreAuthorize("@ss.hasPermi('system:dept:remove')")
@Log(title = "部门管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{deptId}")
public AjaxResult remove(@PathVariable Long deptId) {
if (deptService.hasChildByDeptId(deptId)) {
return AjaxResult.error("存在下级部门,不允许删除");
}
if (deptService.checkDeptExistUser(deptId)) {
return AjaxResult.error("部门存在用户,不允许删除");
}
deptService.checkDeptDataScope(deptId);
return toAjax(deptService.deleteDeptById(deptId));
}
}
package com.tbyf.his.web.controller.system;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.core.domain.entity.SysDictData;
import com.tbyf.his.common.core.page.TableDataInfo;
import com.tbyf.his.common.enums.BusinessType;
import com.tbyf.his.common.utils.StringUtils;
import com.tbyf.his.common.utils.poi.ExcelUtil;
import com.tbyf.his.framework.system.service.ISysDictDataService;
import com.tbyf.his.framework.system.service.ISysDictTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tbyf.his.common.annotation.Log;
/**
* 数据字典信息
*
* @author guopx
*/
@RestController
@RequestMapping("/system/dict/data")
public class SysDictDataController extends BaseController {
@Autowired
private ISysDictDataService dictDataService;
@Autowired
private ISysDictTypeService dictTypeService;
@PreAuthorize("@ss.hasPermi('system:dict:list')")
@GetMapping("/list")
public TableDataInfo list(SysDictData dictData) {
startPage();
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
return getDataTable(list);
}
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:dict:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysDictData dictData) {
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
util.exportExcel(response, list, "字典数据");
}
/**
* 查询字典数据详细
*/
@PreAuthorize("@ss.hasPermi('system:dict:query')")
@GetMapping(value = "/{dictCode}")
public AjaxResult getInfo(@PathVariable Long dictCode) {
return AjaxResult.success(dictDataService.selectDictDataById(dictCode));
}
/**
* 根据字典类型查询字典数据信息
*/
@GetMapping(value = "/type/{dictType}")
public AjaxResult dictType(@PathVariable String dictType) {
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
if (StringUtils.isNull(data)) {
data = new ArrayList<SysDictData>();
}
return AjaxResult.success(data);
}
/**
* 新增字典类型
*/
@PreAuthorize("@ss.hasPermi('system:dict:add')")
@Log(title = "字典数据", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysDictData dict) {
dict.setCreateBy(getUsername());
return toAjax(dictDataService.insertDictData(dict));
}
/**
* 修改保存字典类型
*/
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysDictData dict) {
dict.setUpdateBy(getUsername());
return toAjax(dictDataService.updateDictData(dict));
}
/**
* 删除字典类型
*/
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictCodes}")
public AjaxResult remove(@PathVariable Long[] dictCodes) {
dictDataService.deleteDictDataByIds(dictCodes);
return success();
}
}
package com.tbyf.his.web.controller.system;
import com.tbyf.his.common.annotation.Log;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.core.page.TableDataInfo;
import com.tbyf.his.common.enums.BusinessType;
import com.tbyf.his.common.utils.poi.ExcelUtil;
import com.tbyf.his.system.domain.SysDictShowhidecolumn;
import com.tbyf.his.system.service.ISysDictShowhidecolumnService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 字典显隐藏操作Controller
*
* @author guopx
* @date 2022-03-25
*/
@RestController
@RequestMapping("/system/showhidecolumn")
public class SysDictShowhidecolumnController extends BaseController {
@Autowired
private ISysDictShowhidecolumnService sysDictShowhidecolumnService;
/**
* 查询字典显隐藏操作列表
*/
@PreAuthorize("@ss.hasPermi('system:showhidecolumn:list')")
@GetMapping("/list")
public TableDataInfo list(SysDictShowhidecolumn sysDictShowhidecolumn) {
startPage();
List<SysDictShowhidecolumn> list = sysDictShowhidecolumnService.selectSysDictShowhidecolumnList(sysDictShowhidecolumn);
return getDataTable(list);
}
/**
* 导出字典显隐藏操作列表
*/
@PreAuthorize("@ss.hasPermi('system:showhidecolumn:export')")
@Log(title = "字典显隐藏操作", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SysDictShowhidecolumn sysDictShowhidecolumn) {
List<SysDictShowhidecolumn> list = sysDictShowhidecolumnService.selectSysDictShowhidecolumnList(sysDictShowhidecolumn);
ExcelUtil<SysDictShowhidecolumn> util = new ExcelUtil<SysDictShowhidecolumn>(SysDictShowhidecolumn.class);
util.exportExcel(response, list, "字典显隐藏操作数据");
}
/**
* 获取字典显隐藏操作详细信息
*/
@PreAuthorize("@ss.hasPermi('system:showhidecolumn:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(sysDictShowhidecolumnService.selectSysDictShowhidecolumnById(id));
}
/**
* 新增字典显隐藏操作
*/
@PreAuthorize("@ss.hasPermi('system:showhidecolumn:add')")
@Log(title = "字典显隐藏操作", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SysDictShowhidecolumn sysDictShowhidecolumn) {
return toAjax(sysDictShowhidecolumnService.insertSysDictShowhidecolumn(sysDictShowhidecolumn));
}
/**
* 修改字典显隐藏操作
*/
@PreAuthorize("@ss.hasPermi('system:showhidecolumn:edit')")
@Log(title = "字典显隐藏操作", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysDictShowhidecolumn sysDictShowhidecolumn) {
return toAjax(sysDictShowhidecolumnService.updateSysDictShowhidecolumn(sysDictShowhidecolumn));
}
/**
* 删除字典显隐藏操作
*/
@PreAuthorize("@ss.hasPermi('system:showhidecolumn:remove')")
@Log(title = "字典显隐藏操作", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(sysDictShowhidecolumnService.deleteSysDictShowhidecolumnByIds(ids));
}
}
package com.tbyf.his.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.tbyf.his.common.constant.UserConstants;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.core.domain.entity.SysDictType;
import com.tbyf.his.common.core.page.TableDataInfo;
import com.tbyf.his.common.enums.BusinessType;
import com.tbyf.his.common.utils.poi.ExcelUtil;
import com.tbyf.his.framework.system.service.ISysDictTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tbyf.his.common.annotation.Log;
/**
* 数据字典信息
*
* @author guopx
*/
@RestController
@RequestMapping("/system/dict/type")
public class SysDictTypeController extends BaseController {
@Autowired
private ISysDictTypeService dictTypeService;
@PreAuthorize("@ss.hasPermi('system:dict:list')")
@GetMapping("/list")
public TableDataInfo list(SysDictType dictType) {
startPage();
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
return getDataTable(list);
}
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:dict:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysDictType dictType) {
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
util.exportExcel(response, list, "字典类型");
}
/**
* 查询字典类型详细
*/
@PreAuthorize("@ss.hasPermi('system:dict:query')")
@GetMapping(value = "/{dictId}")
public AjaxResult getInfo(@PathVariable Long dictId) {
return AjaxResult.success(dictTypeService.selectDictTypeById(dictId));
}
/**
* 新增字典类型
*/
@PreAuthorize("@ss.hasPermi('system:dict:add')")
@Log(title = "字典类型", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysDictType dict) {
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) {
return AjaxResult.error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
}
dict.setCreateBy(getUsername());
return toAjax(dictTypeService.insertDictType(dict));
}
/**
* 修改字典类型
*/
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysDictType dict) {
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) {
return AjaxResult.error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
}
dict.setUpdateBy(getUsername());
return toAjax(dictTypeService.updateDictType(dict));
}
/**
* 删除字典类型
*/
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictIds}")
public AjaxResult remove(@PathVariable Long[] dictIds) {
dictTypeService.deleteDictTypeByIds(dictIds);
return success();
}
/**
* 刷新字典缓存
*/
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
@DeleteMapping("/refreshCache")
public AjaxResult refreshCache() {
dictTypeService.resetDictCache();
return AjaxResult.success();
}
/**
* 获取字典选择框列表
*/
@GetMapping("/optionselect")
public AjaxResult optionselect() {
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
return AjaxResult.success(dictTypes);
}
}
package com.tbyf.his.web.controller.system;
import com.tbyf.his.common.config.RuoYiConfig;
import com.tbyf.his.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 首页
*
* @author guopx
*/
@RestController
public class SysIndexController {
/**
* 系统基础配置
*/
@Autowired
private RuoYiConfig guopxConfig;
/**
* 访问首页,提示语
*/
@RequestMapping("/")
public String index() {
return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", guopxConfig.getName(), guopxConfig.getVersion());
}
}
package com.tbyf.his.web.controller.system;
import java.util.List;
import java.util.Set;
import com.tbyf.his.common.config.RuoYiConfig;
import com.tbyf.his.common.constant.Constants;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.core.domain.entity.SysMenu;
import com.tbyf.his.common.core.domain.entity.SysUser;
import com.tbyf.his.common.core.domain.model.LoginUser;
import com.tbyf.his.common.utils.SecurityUtils;
import com.tbyf.his.common.utils.StringUtils;
import com.tbyf.his.framework.system.service.ISysMenuService;
import com.tbyf.his.framework.web.service.SysPermissionService;
import com.tbyf.his.login.domain.LoginBody;
import com.tbyf.his.login.service.SysLoginService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* 登录验证
*
* @author guopx
*/
@Api(tags = "登录验证")
@RestController
public class SysLoginController {
@Autowired
private SysLoginService loginService;
@Autowired
private ISysMenuService menuService;
@Autowired
private SysPermissionService permissionService;
/**
* 登录方法
*
* @param loginBody 登录信息
* @return 结果
*/
@ApiOperation("用户名密码登录")
@PostMapping("/login")
public AjaxResult login(@RequestBody LoginBody loginBody) {
AjaxResult ajax = AjaxResult.success();
// 生成令牌
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
loginBody.getUuid());
ajax.put(Constants.TOKEN, token);
return ajax;
}
/**
* 授权码 登录
*
* @param loginBody 登录信息
* @return 结果
*/
@ApiOperation("授权码 登录")
@PostMapping("/loginByAuthCode")
@ApiResponse(code = 200, message = "登录成功")
public AjaxResult loginByAuthCode(@RequestBody LoginBody loginBody) {
AjaxResult ajax = AjaxResult.success();
// 生成令牌
String token = loginService.loginByAuthCode(loginBody.getUsername(), loginBody.getAuthCode());
ajax.put(Constants.TOKEN, token);
return ajax;
}
/**
* 获取用户信息
*
* @return 用户信息
*/
@ApiOperation("获取用户信息")
@GetMapping("getInfo")
public AjaxResult getInfo() {
LoginUser loginUser = SecurityUtils.getLoginUser();
SysUser user = loginUser.getUser();
// 角色集合
Set<String> roles = permissionService.getRolePermission(user);
// 权限集合
Set<String> permissions = permissionService.getMenuPermission(user);
AjaxResult ajax = AjaxResult.success();
ajax.put("user", user);
ajax.put("roles", roles);
ajax.put("permissions", permissions);
return ajax;
}
/**
* 获取路由信息
*
* @return 路由信息
*/
@GetMapping("getRouters")
public AjaxResult getRouters(Long appId) {
Long userId = SecurityUtils.getUserId();
List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId, appId);
return AjaxResult.success(menuService.buildMenus(menus));
}
}
package com.tbyf.his.web.controller.system;
import java.util.List;
import com.tbyf.his.common.constant.UserConstants;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.core.domain.entity.SysMenu;
import com.tbyf.his.common.enums.BusinessType;
import com.tbyf.his.common.utils.StringUtils;
import com.tbyf.his.framework.system.service.ISysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tbyf.his.common.annotation.Log;
/**
* 菜单信息
*
* @author guopx
*/
@RestController
@RequestMapping("/system/menu")
public class SysMenuController extends BaseController {
@Autowired
private ISysMenuService menuService;
/**
* 获取菜单列表
*/
@PreAuthorize("@ss.hasPermi('system:menu:list')")
@GetMapping("/list")
public AjaxResult list(SysMenu menu) {
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
return AjaxResult.success(menus);
}
/**
* 根据菜单编号获取详细信息
*/
@PreAuthorize("@ss.hasPermi('system:menu:query')")
@GetMapping(value = "/{menuId}")
public AjaxResult getInfo(@PathVariable Long menuId) {
return AjaxResult.success(menuService.selectMenuById(menuId));
}
/**
* 获取菜单下拉树列表
*/
@PostMapping("/treeselect")
public AjaxResult treeselect(@RequestBody SysMenu menu) {
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
return AjaxResult.success(menuService.buildMenuTreeSelect(menus));
}
/**
* 加载对应角色菜单列表树
*/
@GetMapping(value = "/roleMenuTreeselect/{roleId}/{applicationId}")
public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId, @PathVariable("applicationId") Long applicationId) {
SysMenu menu = new SysMenu();
menu.setApplicationId(applicationId);
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
AjaxResult ajax = AjaxResult.success();
ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
ajax.put("menus", menuService.buildMenuTreeSelect(menus));
return ajax;
}
/**
* 新增菜单
*/
@PreAuthorize("@ss.hasPermi('system:menu:add')")
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysMenu menu) {
if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) {
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
} else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) {
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
}
menu.setCreateBy(getUsername());
return toAjax(menuService.insertMenu(menu));
}
/**
* 修改菜单
*/
@PreAuthorize("@ss.hasPermi('system:menu:edit')")
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysMenu menu) {
if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) {
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
} else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) {
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
} else if (menu.getMenuId().equals(menu.getParentId())) {
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
}
menu.setUpdateBy(getUsername());
return toAjax(menuService.updateMenu(menu));
}
/**
* 删除菜单
*/
@PreAuthorize("@ss.hasPermi('system:menu:remove')")
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{menuId}")
public AjaxResult remove(@PathVariable("menuId") Long menuId) {
if (menuService.hasChildByMenuId(menuId)) {
return AjaxResult.error("存在子菜单,不允许删除");
}
if (menuService.checkMenuExistRole(menuId)) {
return AjaxResult.error("菜单已分配,不允许删除");
}
return toAjax(menuService.deleteMenuById(menuId));
}
}
package com.tbyf.his.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.tbyf.his.common.constant.UserConstants;
import org.springframework.security.access.prepost.PreAuthorize;
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.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tbyf.his.common.annotation.Log;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.enums.BusinessType;
import com.tbyf.his.system.domain.SysModule;
import com.tbyf.his.system.service.ISysModuleService;
import com.tbyf.his.common.utils.poi.ExcelUtil;
import com.tbyf.his.common.core.page.TableDataInfo;
/**
* 应用模块管理Controller
*
* @author zq
* @date 2022-05-30
*/
@RestController
@RequestMapping("/system/module")
public class SysModuleController extends BaseController {
@Autowired
private ISysModuleService sysModuleService;
/**
* 查询应用模块管理列表
*/
// @PreAuthorize("@ss.hasPermi('system:module:list')")
@GetMapping("/list")
public TableDataInfo list(SysModule sysModule) {
startPage();
List<SysModule> list = sysModuleService.selectSysModuleList(sysModule);
return getDataTable(list);
}
/**
* 导出应用模块管理列表
*/
// @PreAuthorize("@ss.hasPermi('system:module:export')")
@Log(title = "应用模块管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SysModule sysModule) {
List<SysModule> list = sysModuleService.selectSysModuleList(sysModule);
ExcelUtil<SysModule> util = new ExcelUtil<SysModule>(SysModule.class);
util.exportExcel(response, list, "应用模块管理数据");
}
/**
* 获取应用模块管理详细信息
*/
// @PreAuthorize("@ss.hasPermi('system:module:query')")
@GetMapping(value = "/{moduleId}")
public AjaxResult getInfo(@PathVariable("moduleId") Long moduleId) {
return AjaxResult.success(sysModuleService.selectSysModuleByModuleId(moduleId));
}
/**
* 新增应用模块管理
*/
// @PreAuthorize("@ss.hasPermi('system:module:add')")
@Log(title = "应用模块管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SysModule sysModule) {
if (UserConstants.NOT_UNIQUE.equals(sysModuleService.checkMenuNameUnique(sysModule))) {
return AjaxResult.error("修改模块:" + sysModule.getModuleName() + "失败,此模块已经存在");
}
sysModule.setCreateBy(getUsername());
return toAjax(sysModuleService.insertSysModule(sysModule));
}
/**
* 修改应用模块管理
*/
// @PreAuthorize("@ss.hasPermi('system:module:edit')")
@Log(title = "应用模块管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysModule sysModule) {
if (UserConstants.NOT_UNIQUE.equals(sysModuleService.checkMenuNameUnique(sysModule))) {
return AjaxResult.error("修改模块:" + sysModule.getModuleName() + "失败,此模块已经存在");
}
sysModule.setUpdateBy(getUsername());
return toAjax(sysModuleService.updateSysModule(sysModule));
}
/**
* 删除应用模块管理
*/
// @PreAuthorize("@ss.hasPermi('system:module:remove')")
@Log(title = "应用模块管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{moduleId}")
public AjaxResult remove(@PathVariable Long moduleId) {
System.out.println(moduleId);
if (sysModuleService.hasChildByModuleId(moduleId)) {
return AjaxResult.error("存在子菜单,不允许删除");
}
return toAjax(sysModuleService.deleteSysModuleByModuleId(moduleId));
}
@PostMapping("/treeselect")
public AjaxResult treeselect(@RequestBody SysModule sysModule) {
List<SysModule> sysModules = sysModuleService.selectSysModuleList(sysModule);
return AjaxResult.success(sysModuleService.buildModuleTreeSelect(sysModules));
}
}
package com.tbyf.his.web.controller.system;
import java.util.List;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.core.page.TableDataInfo;
import com.tbyf.his.common.enums.BusinessType;
import com.tbyf.his.framework.system.domain.SysNotice;
import com.tbyf.his.framework.system.service.ISysNoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tbyf.his.common.annotation.Log;
/**
* 公告 信息操作处理
*
* @author guopx
*/
@RestController
@RequestMapping("/system/notice")
public class SysNoticeController extends BaseController {
@Autowired
private ISysNoticeService noticeService;
/**
* 获取通知公告列表
*/
@PreAuthorize("@ss.hasPermi('system:notice:list')")
@GetMapping("/list")
public TableDataInfo list(SysNotice notice) {
startPage();
List<SysNotice> list = noticeService.selectNoticeList(notice);
return getDataTable(list);
}
/**
* 根据通知公告编号获取详细信息
*/
@PreAuthorize("@ss.hasPermi('system:notice:query')")
@GetMapping(value = "/{noticeId}")
public AjaxResult getInfo(@PathVariable Long noticeId) {
return AjaxResult.success(noticeService.selectNoticeById(noticeId));
}
/**
* 新增通知公告
*/
@PreAuthorize("@ss.hasPermi('system:notice:add')")
@Log(title = "通知公告", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysNotice notice) {
notice.setCreateBy(getUsername());
return toAjax(noticeService.insertNotice(notice));
}
/**
* 修改通知公告
*/
@PreAuthorize("@ss.hasPermi('system:notice:edit')")
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysNotice notice) {
notice.setUpdateBy(getUsername());
return toAjax(noticeService.updateNotice(notice));
}
/**
* 删除通知公告
*/
@PreAuthorize("@ss.hasPermi('system:notice:remove')")
@Log(title = "通知公告", businessType = BusinessType.DELETE)
@DeleteMapping("/{noticeIds}")
public AjaxResult remove(@PathVariable Long[] noticeIds) {
return toAjax(noticeService.deleteNoticeByIds(noticeIds));
}
}
package com.tbyf.his.web.controller.system;
import com.tbyf.his.common.annotation.Log;
import com.tbyf.his.common.constant.UserConstants;
import com.tbyf.his.common.core.controller.BaseController;
import com.tbyf.his.common.core.domain.AjaxResult;
import com.tbyf.his.common.core.page.TableDataInfo;
import com.tbyf.his.common.enums.BusinessType;
import com.tbyf.his.common.utils.StringUtils;
import com.tbyf.his.common.utils.poi.ExcelUtil;
import com.tbyf.his.system.domain.SysPlugin;
import com.tbyf.his.system.service.ISysPluginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 插件信息 控制层
*/
@RestController
@RequestMapping("/system/plugin")
public class SysPluginController extends BaseController {
@Autowired
private ISysPluginService pluginService;
/**
* 获取插件列表
*/
@PreAuthorize("@ss.hasPermi('system:plugin:list')")
@GetMapping("/list")
public TableDataInfo list(SysPlugin plugin) {
startPage();
List<SysPlugin> list = pluginService.selectPluginList(plugin);
return getDataTable(list);
}
@Log(title = "插件管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:plugin:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysPlugin plugin) {
List<SysPlugin> list = pluginService.selectPluginList(plugin);
ExcelUtil<SysPlugin> util = new ExcelUtil<SysPlugin>(SysPlugin.class);
util.exportExcel(response, list, "插件数据");
}
@Log(title = "插件管理", businessType = BusinessType.IMPORT)
@PreAuthorize("@ss.hasPermi('system:plugin:import')")
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
ExcelUtil<SysPlugin> util = new ExcelUtil<SysPlugin>(SysPlugin.class);
List<SysPlugin> pluginList = util.importExcel(file.getInputStream());
String operName = getUsername();
String message = pluginService.importPlugin(pluginList, updateSupport, operName);
return AjaxResult.success(message);
}
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response) {
ExcelUtil<SysPlugin> util = new ExcelUtil<SysPlugin>(SysPlugin.class);
util.importTemplateExcel(response, "用户数据");
}
/**
* 根据插件编号获取详细信息
*/
@PreAuthorize("@ss.hasPermi('system:plugin:query')")
@GetMapping(value = {"/", "/{pluginId}"})
public AjaxResult getInfo(@PathVariable(value = "pluginId", required = false) Long pluginId) {
AjaxResult ajax = AjaxResult.success();
if (StringUtils.isNotNull(pluginId)) {
SysPlugin sysPlugin = pluginService.selectPluginById(pluginId);
ajax.put(AjaxResult.DATA_TAG, sysPlugin);
}
return ajax;
}
/**
* 新增插件
*/
@PreAuthorize("@ss.hasPermi('system:plugin:add')")
@Log(title = "插件管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysPlugin plugin) {
if (UserConstants.NOT_UNIQUE.equals(pluginService.checkPluginNameUnique(plugin.getPluginName()))) {
return AjaxResult.error("新增插件'" + plugin.getPluginName() + "'失败,插件信息已存在");
}
plugin.setCreateBy(getUsername());
return toAjax(pluginService.insertPlugin(plugin));
}
/**
* 修改插件
*/
@PreAuthorize("@ss.hasPermi('system:plugin:edit')")
@Log(title = "插件管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysPlugin plugin) {
plugin.setUpdateBy(getUsername());
return toAjax(pluginService.updatePlugin(plugin));
}
/**
* 删除插件
*/
@PreAuthorize("@ss.hasPermi('system:plugin:remove')")
@Log(title = "插件管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{pluginIds}")
public AjaxResult remove(@PathVariable Long[] pluginIds) {
return toAjax(pluginService.deletePluginByIds(pluginIds));
}
/**
* 插件状态修改
*/
@PreAuthorize("@ss.hasPermi('system:plugin:edit')")
@Log(title = "插件管理", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody SysPlugin plugin) {
plugin.setUpdateBy(getUsername());
return toAjax(pluginService.updatePluginStatus(plugin));
}
@PreAuthorize("@ss.hasPermi('system:plugin:uploadFile')")
@Log(title = "插件上传", businessType = BusinessType.IMPORT)
@PostMapping("/uploadFile")
public AjaxResult uploadFile(MultipartFile file) {
return AjaxResult.success(pluginService.uploadFile(file));
}
@PreAuthorize("@ss.hasPermi('system:plugin:getOptionByCategory')")
@GetMapping("/getOptionByCategory/{categoryId}")
public AjaxResult getOptionByCategory(@PathVariable Long categoryId) {
return AjaxResult.success(pluginService.getOptionByCategory(categoryId));
}
}
This diff is collapsed. Click to expand it.
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