From 5223d5589418320862b6729d5e39fbea3ca05914 Mon Sep 17 00:00:00 2001 From: dongdingding <207595406@qq.com> Date: Thu, 12 Oct 2023 17:00:38 +0800 Subject: [PATCH] bug fix --- pom.xml | 19 ++-- ruoyi-admin/pom.xml | 18 +--- .../main/java/com/ruoyi/RuoYiApplication.java | 32 ++++--- .../ruoyi/tcZz/controller/TcCyController.java | 32 +++++++ .../tcZz/controller/TcWljgController.java | 31 +++++++ .../tcZz/controller/TcYqzsController.java | 31 +++++++ .../main/java/com/ruoyi/tcZz/domain/TcCy.java | 4 + .../java/com/ruoyi/tcZz/domain/TcWljg.java | 21 +++++ .../java/com/ruoyi/tcZz/domain/TcYqzs.java | 7 +- .../com/ruoyi/tcZz/mapper/TcWljgMapper.java | 3 + .../com/ruoyi/tcZz/service/ITcCyService.java | 8 ++ .../ruoyi/tcZz/service/ITcWljgService.java | 8 ++ .../ruoyi/tcZz/service/ITcYqzsService.java | 10 +++ .../tcZz/service/impl/TcCyServiceImpl.java | 16 +++- .../tcZz/service/impl/TcWljgServiceImpl.java | 17 +++- .../tcZz/service/impl/TcYqzsServiceImpl.java | 17 +++- .../ruoyi/web/core/config/SwaggerConfig.java | 90 ++++++------------- .../src/main/resources/application-druid.yml | 2 +- .../src/main/resources/application.yml | 10 +-- .../main/resources/mapper/tcZz/TcCyMapper.xml | 69 +++++++++----- .../resources/mapper/tcZz/TcYqzsMapper.xml | 72 +++++++++------ .../tcZz/networkSecurity/TcWljgMapper.xml | 32 ++++++- ruoyi-common/pom.xml | 6 ++ .../ruoyi/common/core/domain/BaseEntity.java | 12 +++ .../framework/config/SecurityConfig.java | 2 +- 25 files changed, 403 insertions(+), 166 deletions(-) diff --git a/pom.xml b/pom.xml index c971e463..62806cc5 100644 --- a/pom.xml +++ b/pom.xml @@ -35,7 +35,11 @@ - + + com.github.xiaoymin + knife4j-openapi2-spring-boot-starter + 4.3.0 + org.springframework.boot @@ -73,19 +77,6 @@ ${oshi.version} - - - io.springfox - springfox-boot-starter - ${swagger.version} - - - io.swagger - swagger-models - - - - commons-io diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index 642deff6..d486a484 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -16,7 +16,10 @@ - + + com.github.xiaoymin + knife4j-openapi2-spring-boot-starter + org.springframework.boot @@ -24,19 +27,6 @@ true - - - io.springfox - springfox-boot-starter - - - - - io.swagger - swagger-models - 1.6.2 - - mysql diff --git a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java index e3c56ee5..8c475561 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java @@ -3,6 +3,11 @@ package com.ruoyi; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.core.env.Environment; + +import java.net.InetAddress; +import java.net.UnknownHostException; /** * 启动程序 @@ -15,16 +20,21 @@ public class RuoYiApplication public static void main(String[] args) { // System.setProperty("spring.devtools.restart.enabled", "false"); - SpringApplication.run(RuoYiApplication.class, args); - System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" + - " .-------. ____ __ \n" + - " | _ _ \\ \\ \\ / / \n" + - " | ( ' ) | \\ _. / ' \n" + - " |(_ o _) / _( )_ .' \n" + - " | (_,_).' __ ___(_ o _)' \n" + - " | |\\ \\ | || |(_,_)' \n" + - " | | \\ `' /| `-' / \n" + - " | | \\ / \\ / \n" + - " ''-' `'-' `-..-' "); + ConfigurableApplicationContext run = SpringApplication.run(RuoYiApplication.class, args); + Environment env = run.getEnvironment(); + String ip; + try { + ip = InetAddress.getLocalHost().getHostAddress(); + } catch (UnknownHostException e) { + throw new RuntimeException(e); + } + String port = env.getProperty("server.port"); + String path = env.getProperty("server.servlet.context-path"); + path = path.isEmpty() ? "" : path; + System.out.println("\n----------------------------------------------------------\n\t" + + "Application is running! Access URLs:\n\t" + + "swagger-ui: http://localhost:" + port + path + "doc.html\n\t" + + "swagger-ui: http://" + ip + ":" + port + path + "doc.html\n\t" + + "----------------------------------------------------------"); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcCyController.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcCyController.java index b074224f..d91b185a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcCyController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcCyController.java @@ -2,6 +2,10 @@ package com.ruoyi.tcZz.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.tcZz.domain.TcYqzs; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -20,6 +24,7 @@ import com.ruoyi.tcZz.domain.TcCy; import com.ruoyi.tcZz.service.ITcCyService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; +import org.springframework.web.multipart.MultipartFile; /** * 词云Controller @@ -28,6 +33,7 @@ import com.ruoyi.common.core.page.TableDataInfo; * @date 2023-10-12 */ @RestController +@Api(tags = "词云") @RequestMapping("/tcZz/cy") public class TcCyController extends BaseController { @@ -101,4 +107,30 @@ public class TcCyController extends BaseController { return toAjax(tcCyService.deleteTcCyByIds(ids)); } + + + /** + * 查询词云列表 + */ + + @ApiOperation(value = "查询词云列表",response = TcCy.class) + @GetMapping("/ListNoToken") + public TableDataInfo ListNoToken(TcCy tcCy) + { + startPage(); + List list = tcCyService.selectTcCyList(tcCy); + return getDataTable(list); + } + + /** + * 导入 + */ + @ApiOperation("通用导入excel信息") + @PostMapping("/common/importExcel") + public AjaxResult importExcel(MultipartFile file) throws Exception { + ExcelUtil util = new ExcelUtil(TcCy.class); + List tcCyList = util.importExcel(file.getInputStream()); + tcCyService.importUser(tcCyList); + return AjaxResult.success(); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcWljgController.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcWljgController.java index 24d6a37f..bfd02c23 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcWljgController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcWljgController.java @@ -2,6 +2,10 @@ package com.ruoyi.tcZz.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.tcZz.domain.TcYqzs; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -20,6 +24,7 @@ import com.ruoyi.tcZz.domain.TcWljg; import com.ruoyi.tcZz.service.ITcWljgService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; +import org.springframework.web.multipart.MultipartFile; /** * 网络监测Controller @@ -28,6 +33,7 @@ import com.ruoyi.common.core.page.TableDataInfo; * @date 2023-10-12 */ @RestController +@Api(tags = "网络监测") @RequestMapping("/tcZz/networkSecurity/cybersecurity") public class TcWljgController extends BaseController { @@ -101,4 +107,29 @@ public class TcWljgController extends BaseController { return toAjax(tcWljgService.deleteTcWljgByIds(ids)); } + + + /** + * 查询网络监测列表 + */ + @ApiOperation(value = "查询舆情走势图列表",response = TcWljg.class) + @GetMapping("/ListNoToken") + public TableDataInfo ListNoToken(TcWljg tcWljg) + { + startPage(); + List list = tcWljgService.selectTcWljgList(tcWljg); + return getDataTable(list); + } + + /** + * 导入 + */ + @ApiOperation("通用导入excel信息") + @PostMapping("/common/importExcel") + public AjaxResult importExcel(MultipartFile file) throws Exception { + ExcelUtil util = new ExcelUtil(TcWljg.class); + List tcWljgList = util.importExcel(file.getInputStream()); + tcWljgService.importUser(tcWljgList); + return AjaxResult.success(); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcYqzsController.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcYqzsController.java index 180baab0..1137dfa5 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcYqzsController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcYqzsController.java @@ -2,6 +2,11 @@ package com.ruoyi.tcZz.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.tcZz.domain.TcCy; +import com.ruoyi.tcZz.domain.TcWljg; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -20,6 +25,7 @@ import com.ruoyi.tcZz.domain.TcYqzs; import com.ruoyi.tcZz.service.ITcYqzsService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; +import org.springframework.web.multipart.MultipartFile; /** * 舆情走势图Controller @@ -28,6 +34,7 @@ import com.ruoyi.common.core.page.TableDataInfo; * @date 2023-10-12 */ @RestController +@Api(tags = "舆情走势图") @RequestMapping("/tcZz/yqzs") public class TcYqzsController extends BaseController { @@ -101,4 +108,28 @@ public class TcYqzsController extends BaseController { return toAjax(tcYqzsService.deleteTcYqzsByIds(ids)); } + + /** + * 查询舆情走势图列表 + */ + @ApiOperation(value = "查询舆情走势图列表",response = TcYqzs.class) + @GetMapping("/ListNoToken") + public TableDataInfo ListNoToken(TcYqzs tcYqzs) + { + startPage(); + List list = tcYqzsService.selectTcYqzsList(tcYqzs); + return getDataTable(list); + } + + /** + * 导入 + */ + @ApiOperation("通用导入excel信息") + @PostMapping("/common/importExcel") + public AjaxResult importExcel(MultipartFile file) throws Exception { + ExcelUtil util = new ExcelUtil(TcYqzs.class); + List tcWljgList = util.importExcel(file.getInputStream()); + tcYqzsService.importUser(tcWljgList); + return AjaxResult.success(); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/domain/TcCy.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/domain/TcCy.java index 47e72255..9a1e3dfb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/domain/TcCy.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/domain/TcCy.java @@ -24,6 +24,10 @@ public class TcCy extends BaseEntity @ApiModelProperty(value = "id") private Long id; + @ApiModelProperty(value = "区域id") + @Excel(name = "区域id") + private String areaId; + /** 词云名称 */ @ApiModelProperty(value = "词云名称") @Excel(name = "词云名称") diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/domain/TcWljg.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/domain/TcWljg.java index 10d6f267..b63d285b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/domain/TcWljg.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/domain/TcWljg.java @@ -9,6 +9,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.core.domain.BaseEntity; +import org.springframework.format.annotation.DateTimeFormat; /** * 网络监测对象 tc_wljg @@ -30,72 +31,92 @@ public class TcWljg extends BaseEntity { /** * 区域id */ + @ApiModelProperty(value = "区域id") @Excel(name = "区域id") private String areaId; /** * 1.启用 2.禁用 */ + @ApiModelProperty(value = "1.启用 2.禁用") @Excel(name = "1.启用 2.禁用") private Long isStatus; /** * 攻击发起时间 */ + @Excel(name = "攻击发起时间", dateFormat = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "攻击发起时间") private Date startTime; /** * 攻击源IP */ @Excel(name = "攻击源IP") + @ApiModelProperty(value = "攻击源IP") private String attackyIp; /** * 攻击类型 */ @Excel(name = "攻击类型") + @ApiModelProperty(value = "攻击类型") private String attackType; /** * 攻击源IP区域 */ + @Excel(name = "攻击源IP区域") + @ApiModelProperty(value = "攻击源IP区域") private String attackIpArea; /** * 受攻击目标类型 */ + @Excel(name = "受攻击目标类型") + @ApiModelProperty(value = "受攻击目标类型") private String type; /** * 受攻击IP */ + @ApiModelProperty(value = "受攻击IP") @Excel(name = "受攻击IP") private String sAttackIp; /** * 受攻击IP区域 */ + @ApiModelProperty(value = "受攻击IP区域") private String sAttackIpArea; /** * 网站安全等级 */ + @ApiModelProperty(value = "网站安全等级") @Excel(name = "网站安全等级") private String netLevel; /** * 所属单位 */ + @ApiModelProperty(value = "所属单位") + @Excel(name = "所属单位") private String affUnit; /** * 联系电话 */ + @ApiModelProperty(value = "联系电话") + @Excel(name = "联系电话") private String linkTel; /** * 联系人 */ + @ApiModelProperty(value = "联系人") @Excel(name = "联系人") private String linkMan; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/domain/TcYqzs.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/domain/TcYqzs.java index 3e077668..c802f3dd 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/domain/TcYqzs.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/domain/TcYqzs.java @@ -28,18 +28,23 @@ public class TcYqzs extends BaseEntity /** 区域id */ @Excel(name = "区域id") + @ApiModelProperty(value = "区域id") private Long areaId; /** 日期 */ @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "日期", width = 30, dateFormat = "yyyy-MM-dd") + @ApiModelProperty(value = "日期") + @Excel(name = "日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") private Date dateTime; /** 非敏感数量 */ @Excel(name = "非敏感数量") + @ApiModelProperty(value = "非敏感数量") + private Long count1; /** 敏感数量 */ @Excel(name = "敏感数量") + @ApiModelProperty(value = "敏感数量") private Long count2; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/mapper/TcWljgMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/mapper/TcWljgMapper.java index 555ecbd2..7e124141 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/mapper/TcWljgMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/mapper/TcWljgMapper.java @@ -58,4 +58,7 @@ public interface TcWljgMapper * @return 结果 */ public int deleteTcWljgByIds(Long[] ids); + + + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/ITcCyService.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/ITcCyService.java index e24f405a..559d5f41 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/ITcCyService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/ITcCyService.java @@ -2,6 +2,7 @@ package com.ruoyi.tcZz.service; import java.util.List; import com.ruoyi.tcZz.domain.TcCy; +import com.ruoyi.tcZz.domain.TcYqzs; /** * 词云Service接口 @@ -58,4 +59,11 @@ public interface ITcCyService * @return 结果 */ public int deleteTcCyById(Long id); + + /** + * 导入云信息 + * + * @return 结果 + */ + public String importUser(List tcCyList); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/ITcWljgService.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/ITcWljgService.java index 91e941cc..76a4d511 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/ITcWljgService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/ITcWljgService.java @@ -58,4 +58,12 @@ public interface ITcWljgService * @return 结果 */ public int deleteTcWljgById(Long id); + + + /** + * 导入网络监测信息 + * + * @return 结果 + */ + public String importUser(List tcWljgList); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/ITcYqzsService.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/ITcYqzsService.java index 8c7446fe..6b5970eb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/ITcYqzsService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/ITcYqzsService.java @@ -1,6 +1,8 @@ package com.ruoyi.tcZz.service; import java.util.List; + +import com.ruoyi.tcZz.domain.TcWljg; import com.ruoyi.tcZz.domain.TcYqzs; /** @@ -58,4 +60,12 @@ public interface ITcYqzsService * @return 结果 */ public int deleteTcYqzsById(Long id); + + + /** + * 导入舆情走势图信息 + * + * @return 结果 + */ + public String importUser(List tcYqzsList); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcCyServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcCyServiceImpl.java index ba3f3553..bab7c1f3 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcCyServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcCyServiceImpl.java @@ -2,6 +2,7 @@ package com.ruoyi.tcZz.service.impl; import java.util.List; import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.tcZz.domain.TcYqzs; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.tcZz.mapper.TcCyMapper; @@ -66,7 +67,6 @@ public class TcCyServiceImpl implements ITcCyService @Override public int updateTcCy(TcCy tcCy) { - tcCy.setUpdateTime(DateUtils.getNowDate()); return tcCyMapper.updateTcCy(tcCy); } @@ -93,4 +93,18 @@ public class TcCyServiceImpl implements ITcCyService { return tcCyMapper.deleteTcCyById(id); } + + @Override + public String importUser(List tcCyList) { + StringBuilder successMsg = new StringBuilder(); + if (!tcCyList.isEmpty()) { + for (TcCy tcCy : tcCyList) { + tcCyMapper.insertTcCy(tcCy); + } + successMsg.append("导入成功"); + } + + return successMsg.toString(); + } + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcWljgServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcWljgServiceImpl.java index aa1ca147..0c4d9ac5 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcWljgServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcWljgServiceImpl.java @@ -22,7 +22,7 @@ public class TcWljgServiceImpl implements ITcWljgService /** * 查询网络监测 - * + * * @param id 网络监测主键 * @return 网络监测 */ @@ -66,7 +66,7 @@ public class TcWljgServiceImpl implements ITcWljgService @Override public int updateTcWljg(TcWljg tcWljg) { - tcWljg.setUpdateTime(DateUtils.getNowDate()); + return tcWljgMapper.updateTcWljg(tcWljg); } @@ -93,4 +93,17 @@ public class TcWljgServiceImpl implements ITcWljgService { return tcWljgMapper.deleteTcWljgById(id); } + + @Override + public String importUser(List tcWljgList) { + StringBuilder successMsg = new StringBuilder(); + if (!tcWljgList.isEmpty()) { + for (TcWljg tcWljg : tcWljgList) { + tcWljgMapper.insertTcWljg(tcWljg); + } + successMsg.append("导入成功"); + } + + return successMsg.toString(); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcYqzsServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcYqzsServiceImpl.java index 71e5f262..7a93fcbd 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcYqzsServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcYqzsServiceImpl.java @@ -2,6 +2,7 @@ package com.ruoyi.tcZz.service.impl; import java.util.List; import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.tcZz.domain.TcWljg; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.tcZz.mapper.TcYqzsMapper; @@ -66,7 +67,7 @@ public class TcYqzsServiceImpl implements ITcYqzsService @Override public int updateTcYqzs(TcYqzs tcYqzs) { - tcYqzs.setUpdateTime(DateUtils.getNowDate()); + return tcYqzsMapper.updateTcYqzs(tcYqzs); } @@ -93,4 +94,18 @@ public class TcYqzsServiceImpl implements ITcYqzsService { return tcYqzsMapper.deleteTcYqzsById(id); } + + @Override + public String importUser(List tcYqzsList) { + StringBuilder successMsg = new StringBuilder(); + if (!tcYqzsList.isEmpty()) { + for (TcYqzs tcYqzs : tcYqzsList) { + tcYqzsMapper.insertTcYqzs(tcYqzs); + } + successMsg.append("导入成功"); + } + + return successMsg.toString(); + } + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java b/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java index 0b942450..53a1966f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java @@ -1,56 +1,56 @@ package com.ruoyi.web.core.config; -import java.util.ArrayList; -import java.util.List; +import com.ruoyi.common.config.RuoYiConfig; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import com.ruoyi.common.config.RuoYiConfig; -import io.swagger.annotations.ApiOperation; -import io.swagger.models.auth.In; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.service.ApiInfo; -import springfox.documentation.service.ApiKey; -import springfox.documentation.service.AuthorizationScope; import springfox.documentation.service.Contact; -import springfox.documentation.service.SecurityReference; -import springfox.documentation.service.SecurityScheme; import springfox.documentation.spi.DocumentationType; -import springfox.documentation.spi.service.contexts.SecurityContext; import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc; /** * Swagger2的接口配置 - * + * * @author ruoyi */ @Configuration -public class SwaggerConfig -{ - /** 系统基础配置 */ +@EnableSwagger2WebMvc +public class SwaggerConfig { + /** + * 系统基础配置 + */ @Autowired private RuoYiConfig ruoyiConfig; - /** 是否开启swagger */ - @Value("${swagger.enabled}") + /** + * 是否开启swagger + */ + @Value("${knife4j.enable}") private boolean enabled; - /** 设置请求的统一前缀 */ - @Value("${swagger.pathMapping}") + /** + * 设置请求的统一前缀 + */ + @Value("${server.servlet.context-path}") private String pathMapping; /** * 创建API */ @Bean - public Docket createRestApi() - { - return new Docket(DocumentationType.OAS_30) + public Docket createRestApi() { + return new Docket(DocumentationType.SWAGGER_2) // 是否启用Swagger .enable(enabled) + //分组名称 + .groupName("太仓综治") // 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息) .apiInfo(apiInfo()) // 设置哪些接口暴露给Swagger展示 @@ -62,60 +62,22 @@ public class SwaggerConfig // 扫描所有 .apis(RequestHandlerSelectors.any()) .paths(PathSelectors.any()) .build() - /* 设置安全模式,swagger可以设置访问token */ - .securitySchemes(securitySchemes()) - .securityContexts(securityContexts()) .pathMapping(pathMapping); + // 排除mybatis-plus的分页参数 +// .ignoredParameterTypes(Page.class, IPage.class); } - /** - * 安全模式,这里指定token通过Authorization头请求头传递 - */ - private List securitySchemes() - { - List apiKeyList = new ArrayList(); - apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue())); - return apiKeyList; - } - - /** - * 安全上下文 - */ - private List securityContexts() - { - List securityContexts = new ArrayList<>(); - securityContexts.add( - SecurityContext.builder() - .securityReferences(defaultAuth()) - .operationSelector(o -> o.requestMappingPattern().matches("/.*")) - .build()); - return securityContexts; - } - - /** - * 默认的安全上引用 - */ - private List defaultAuth() - { - AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); - AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; - authorizationScopes[0] = authorizationScope; - List securityReferences = new ArrayList<>(); - securityReferences.add(new SecurityReference("Authorization", authorizationScopes)); - return securityReferences; - } /** * 添加摘要信息 */ - private ApiInfo apiInfo() - { + private ApiInfo apiInfo() { // 用ApiInfoBuilder进行定制 return new ApiInfoBuilder() // 设置标题 - .title("标题:若依管理系统_接口文档") + .title("苏州应急3期系统_接口文档") // 描述 - .description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...") + .description("描述:用于苏州应急3期系统") // 作者信息 .contact(new Contact(ruoyiConfig.getName(), null, null)) // 版本 diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml index b90b4f56..6cf9e178 100644 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ b/ruoyi-admin/src/main/resources/application-druid.yml @@ -21,7 +21,7 @@ spring: # 最小连接池数量 minIdle: 10 # 最大连接池数量 - maxActive: 20 + maxActive: 100 # 配置获取连接等待超时的时间 maxWait: 60000 # 配置连接超时时间 diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index e25f4e41..eaf33a04 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -18,7 +18,7 @@ ruoyi: # 开发环境配置 server: # 服务器的HTTP端口,默认为8080 - port: 9027 + port: 9035 servlet: # 应用的访问路径 context-path: / @@ -115,11 +115,9 @@ pagehelper: params: count=countSql # Swagger配置 -swagger: - # 是否开启swagger - enabled: true - # 请求前缀 - pathMapping: +knife4j: + enable: true + # 防止XSS攻击 xss: diff --git a/ruoyi-admin/src/main/resources/mapper/tcZz/TcCyMapper.xml b/ruoyi-admin/src/main/resources/mapper/tcZz/TcCyMapper.xml index efa4c123..4f363d64 100644 --- a/ruoyi-admin/src/main/resources/mapper/tcZz/TcCyMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/tcZz/TcCyMapper.xml @@ -1,37 +1,59 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + - - - - - - - - + + + + + + + + + + - select id, cy_name, cy_count, create_by, create_time, update_by, update_time, remark from tc_cy + select id, + area_id, + cy_name, + cy_count, + create_by, + create_time, + update_by, + update_time, + remark + from tc_cy - + - + insert into tc_cy @@ -42,7 +64,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_by, update_time, remark, - + area_id, + #{cyName}, #{cyCount}, @@ -51,7 +74,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{updateBy}, #{updateTime}, #{remark}, - + #{areaId}, + @@ -64,16 +88,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_by = #{updateBy}, update_time = #{updateTime}, remark = #{remark}, + area_id = #{areaId}, where id = #{id} - delete from tc_cy where id = #{id} + delete + from tc_cy + where id = #{id} - delete from tc_cy where id in + delete from tc_cy where id in #{id} diff --git a/ruoyi-admin/src/main/resources/mapper/tcZz/TcYqzsMapper.xml b/ruoyi-admin/src/main/resources/mapper/tcZz/TcYqzsMapper.xml index 45ad19fc..8dc02b32 100644 --- a/ruoyi-admin/src/main/resources/mapper/tcZz/TcYqzsMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/tcZz/TcYqzsMapper.xml @@ -1,41 +1,61 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + - - - - - - - - - - + + + + + + + + + + - select id, area_id, date_time, create_by, create_time, update_by, update_time, remark, count1, count2 from tc_yqzs + select id, + area_id, + date_time, + create_by, + create_time, + update_by, + update_time, + remark, + count1, + count2 + from tc_yqzs - + - + insert into tc_yqzs @@ -48,7 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" remark, count1, count2, - + #{areaId}, #{dateTime}, @@ -59,7 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{remark}, #{count1}, #{count2}, - + @@ -79,11 +99,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from tc_yqzs where id = #{id} + delete + from tc_yqzs + where id = #{id} - delete from tc_yqzs where id in + delete from tc_yqzs where id in #{id} diff --git a/ruoyi-admin/src/main/resources/mapper/tcZz/networkSecurity/TcWljgMapper.xml b/ruoyi-admin/src/main/resources/mapper/tcZz/networkSecurity/TcWljgMapper.xml index 6d86b0d5..3f2a5600 100644 --- a/ruoyi-admin/src/main/resources/mapper/tcZz/networkSecurity/TcWljgMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/tcZz/networkSecurity/TcWljgMapper.xml @@ -32,9 +32,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -42,7 +65,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where id = #{id} - + + insert into tc_wljg diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index 35e34b7b..83c8da97 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -125,6 +125,12 @@ javax.servlet javax.servlet-api + + io.swagger + swagger-annotations + 1.6.6 + compile + diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java index 67269ff6..8a490e7e 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java @@ -7,6 +7,9 @@ import java.util.Map; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import org.springframework.format.annotation.DateTimeFormat; /** * Entity基类 @@ -22,20 +25,29 @@ public class BaseEntity implements Serializable private String searchValue; /** 创建者 */ + @ApiModelProperty(value = "创建者") private String createBy; /** 创建时间 */ + @Excel(name = "创建时间", dateFormat = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date createTime; /** 更新者 */ + @ApiModelProperty(value = "更新者") private String updateBy; /** 更新时间 */ + @Excel(name = "更新时间", dateFormat = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date updateTime; /** 备注 */ + @ApiModelProperty(value = "备注") private String remark; /** 请求参数 */ diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java index bdb7199f..3d530a46 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java @@ -114,7 +114,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter .antMatchers("/login", "/register", "/captchaImage").permitAll() // 静态资源,可匿名访问 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() - .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() + .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**","/tcZz/cy/ListNoToken","/tcZz/yqzs/ListNoToken","/tcZz/networkSecurity/cybersecurity/ListNoToken","/tcZz/networkSecurity/cybersecurity/common/importExcel","/tcZz/yqzs/common/importExcel","/tcZz/cy/common/importExcel").permitAll() // 除上面外的所有请求全部需要鉴权认证 .anyRequest().authenticated() .and()