From 4865f255e8786b476b01d920ff14a855a9da5fb3 Mon Sep 17 00:00:00 2001 From: 18650502300 <18650502300@163.com> Date: Wed, 12 Jun 2024 15:32:32 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/AsArticleClassifyController.java | 7 +++++++ .../controller/system/AsArticleController.java | 12 ++++++------ .../src/main/resources/application-druid.yml | 4 ++-- .../core/domain/entity/AsArticleClassify.java | 10 ++++++++++ .../ruoyi/framework/aspectj/DataScopeAspect.java | 1 - .../java/com/ruoyi/system/domain/EtArticle.java | 4 ++++ .../java/com/ruoyi/system/domain/EtFeeRule.java | 4 ++++ .../impl/AsArticleClassifyServiceImpl.java | 9 ++++++++- .../service/impl/EtFeeRuleServiceImpl.java | 8 ++++++++ .../system/service/impl/EtModelServiceImpl.java | 2 +- .../mapper/system/AsArticleClassifyMapper.xml | 10 ++++++++-- .../resources/mapper/system/AsArticleMapper.xml | 6 +++++- .../resources/mapper/system/EtFeeRuleMapper.xml | 16 ++++++++-------- 13 files changed, 71 insertions(+), 22 deletions(-) diff --git a/electripper-admin/src/main/java/com/ruoyi/web/controller/system/AsArticleClassifyController.java b/electripper-admin/src/main/java/com/ruoyi/web/controller/system/AsArticleClassifyController.java index 831c356..b31da66 100644 --- a/electripper-admin/src/main/java/com/ruoyi/web/controller/system/AsArticleClassifyController.java +++ b/electripper-admin/src/main/java/com/ruoyi/web/controller/system/AsArticleClassifyController.java @@ -10,6 +10,7 @@ import com.ruoyi.common.core.domain.entity.AsArticleClassify; import com.ruoyi.system.service.IAsArticleClassifyService; 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.*; @@ -30,6 +31,7 @@ public class AsArticleClassifyController extends BaseController /** * 获取分类列表 */ + @PreAuthorize("@ss.hasPermi('system:articleClassify:list')") @GetMapping("/list") public AjaxResult list(AsArticleClassify asArticleClassify) { @@ -40,6 +42,7 @@ public class AsArticleClassifyController extends BaseController /** * 查询分类列表(排除节点) */ + @PreAuthorize("@ss.hasPermi('system:articleClassify:list')") @GetMapping("/list/exclude/{classifyId}") public AjaxResult excludeChild(@PathVariable(value = "classifyId", required = false) Long classifyId) { @@ -51,6 +54,7 @@ public class AsArticleClassifyController extends BaseController /** * 根据分类编号获取详细信息 */ + @PreAuthorize("@ss.hasPermi('system:articleClassify:query')") @GetMapping(value = "/{classifyId}") public AjaxResult getInfo(@PathVariable Long classifyId) { @@ -61,6 +65,7 @@ public class AsArticleClassifyController extends BaseController /** * 新增分类 */ + @PreAuthorize("@ss.hasPermi('system:articleClassify:add')") @Log(title = "分类管理", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@Validated @RequestBody AsArticleClassify dept) @@ -76,6 +81,7 @@ public class AsArticleClassifyController extends BaseController /** * 修改分类 */ + @PreAuthorize("@ss.hasPermi('system:articleClassify:edit')") @Log(title = "分类管理", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@Validated @RequestBody AsArticleClassify articleClassify) @@ -101,6 +107,7 @@ public class AsArticleClassifyController extends BaseController /** * 删除分类 */ + @PreAuthorize("@ss.hasPermi('system:articleClassify:remove')") @Log(title = "分类管理", businessType = BusinessType.DELETE) @DeleteMapping("/{classifyId}") public AjaxResult remove(@PathVariable Long classifyId) diff --git a/electripper-admin/src/main/java/com/ruoyi/web/controller/system/AsArticleController.java b/electripper-admin/src/main/java/com/ruoyi/web/controller/system/AsArticleController.java index 25b338f..4d1eba7 100644 --- a/electripper-admin/src/main/java/com/ruoyi/web/controller/system/AsArticleController.java +++ b/electripper-admin/src/main/java/com/ruoyi/web/controller/system/AsArticleController.java @@ -36,7 +36,7 @@ public class AsArticleController extends BaseController /** * 查询文章列表 */ -// @PreAuthorize("@ss.hasPermi('system:article:list')") + @PreAuthorize("@ss.hasPermi('system:article:list')") @GetMapping("/list") public TableDataInfo list(EtArticle etArticle) { @@ -48,7 +48,7 @@ public class AsArticleController extends BaseController /** * 导出文章列表 */ -// @PreAuthorize("@ss.hasPermi('system:article:export')") + @PreAuthorize("@ss.hasPermi('system:article:export')") @Log(title = "文章", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, EtArticle etArticle) @@ -61,7 +61,7 @@ public class AsArticleController extends BaseController /** * 获取文章详细信息 */ -// @PreAuthorize("@ss.hasPermi('system:article:query')") + @PreAuthorize("@ss.hasPermi('system:article:query')") @GetMapping(value = "/{articleId}") public AjaxResult getInfo(@PathVariable("articleId") Long articleId) { @@ -71,7 +71,7 @@ public class AsArticleController extends BaseController /** * 新增文章 */ -// @PreAuthorize("@ss.hasPermi('system:article:add')") + @PreAuthorize("@ss.hasPermi('system:article:add')") @Log(title = "文章", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody EtArticle etArticle) @@ -82,7 +82,7 @@ public class AsArticleController extends BaseController /** * 修改文章 */ -// @PreAuthorize("@ss.hasPermi('system:article:edit')") + @PreAuthorize("@ss.hasPermi('system:article:edit')") @Log(title = "文章", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody EtArticle etArticle) @@ -93,7 +93,7 @@ public class AsArticleController extends BaseController /** * 删除文章 */ -// @PreAuthorize("@ss.hasPermi('system:article:remove')") + @PreAuthorize("@ss.hasPermi('system:article:remove')") @Log(title = "文章", businessType = BusinessType.DELETE) @DeleteMapping("/{articleIds}") public AjaxResult remove(@PathVariable Long[] articleIds) diff --git a/electripper-admin/src/main/resources/application-druid.yml b/electripper-admin/src/main/resources/application-druid.yml index 5651be6..f7dc9c6 100644 --- a/electripper-admin/src/main/resources/application-druid.yml +++ b/electripper-admin/src/main/resources/application-druid.yml @@ -9,9 +9,9 @@ spring: # url: jdbc:mysql://localhost:3306/electripper?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 # username: root # password: 123456 - url: jdbc:mysql://106.75.233.135:3306/electripper?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + url: jdbc:mysql://117.26.179.22:61110/electripper?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root - password: 9671e015b05b3f11 + password: d0dbe100b71c1d09 # 从库数据源 slave: # 从数据源开关/默认关闭 diff --git a/electripper-common/src/main/java/com/ruoyi/common/core/domain/entity/AsArticleClassify.java b/electripper-common/src/main/java/com/ruoyi/common/core/domain/entity/AsArticleClassify.java index b868a25..1cf7f2b 100644 --- a/electripper-common/src/main/java/com/ruoyi/common/core/domain/entity/AsArticleClassify.java +++ b/electripper-common/src/main/java/com/ruoyi/common/core/domain/entity/AsArticleClassify.java @@ -23,6 +23,9 @@ public class AsArticleClassify extends BaseEntity /** 父分类ID */ private Long parentId; + /** 父分类ID */ + private Long deptId; + /** 祖级列表 */ private String ancestors; @@ -136,4 +139,11 @@ public class AsArticleClassify extends BaseEntity this.children = children; } + public Long getDeptId() { + return deptId; + } + + public void setDeptId(Long deptId) { + this.deptId = deptId; + } } diff --git a/electripper-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java b/electripper-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java index 2104531..e4a807d 100644 --- a/electripper-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java +++ b/electripper-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java @@ -3,7 +3,6 @@ package com.ruoyi.framework.aspectj; import java.util.ArrayList; import java.util.List; -import cn.hutool.core.util.StrUtil; import com.ruoyi.common.core.domain.BaseEntityPlus; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.Aspect; diff --git a/electripper-system/src/main/java/com/ruoyi/system/domain/EtArticle.java b/electripper-system/src/main/java/com/ruoyi/system/domain/EtArticle.java index 5d17e3a..2d1c869 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/domain/EtArticle.java +++ b/electripper-system/src/main/java/com/ruoyi/system/domain/EtArticle.java @@ -27,6 +27,10 @@ public class EtArticle extends BaseEntity @Excel(name = "标题") private String title; + /** 运营区id */ + @Excel(name = "运营区id") + private Long areaId; + /** logo地址 */ private String logo; diff --git a/electripper-system/src/main/java/com/ruoyi/system/domain/EtFeeRule.java b/electripper-system/src/main/java/com/ruoyi/system/domain/EtFeeRule.java index f78ea93..67a4e54 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/domain/EtFeeRule.java +++ b/electripper-system/src/main/java/com/ruoyi/system/domain/EtFeeRule.java @@ -28,6 +28,10 @@ public class EtFeeRule extends BaseEntity @Excel(name = "运营区id") private Long areaId; + /** 运营商id */ + @Excel(name = "运营商id") + private Long deptId; + /** 说明 */ @Excel(name = "说明") private String explain; diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsArticleClassifyServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsArticleClassifyServiceImpl.java index b50100a..05cd756 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsArticleClassifyServiceImpl.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsArticleClassifyServiceImpl.java @@ -15,6 +15,7 @@ import com.ruoyi.system.service.IAsArticleClassifyService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import javax.annotation.Resource; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -28,7 +29,7 @@ import java.util.stream.Collectors; @Service public class AsArticleClassifyServiceImpl implements IAsArticleClassifyService { - @Autowired + @Resource private AsArticleClassifyMapper articleClassifyMapper; /** @@ -207,6 +208,12 @@ public class AsArticleClassifyServiceImpl implements IAsArticleClassifyService @Override public int insertClassify(AsArticleClassify dept) { + if(dept.getDeptId() == null){ + SysUser currentUser = SecurityUtils.getLoginUser().getUser();//获取当前系统用户 + if(!currentUser.isAdmin()){ + dept.setDeptId(currentUser.getDeptId()); + } + } AsArticleClassify info = articleClassifyMapper.selectClassifyById(dept.getParentId()); // 如果父节点不为正常状态,则不允许新增子节点 if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtFeeRuleServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtFeeRuleServiceImpl.java index c718c46..88de043 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtFeeRuleServiceImpl.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtFeeRuleServiceImpl.java @@ -3,7 +3,9 @@ package com.ruoyi.system.service.impl; import java.util.List; import com.ruoyi.common.annotation.DataScope; +import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.system.service.IAsUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -68,6 +70,12 @@ public class EtFeeRuleServiceImpl implements IEtFeeRuleService @Override public int insertEtFeeRule(EtFeeRule etFeeRule) { + if(etFeeRule.getDeptId() == null){ + SysUser currentUser = SecurityUtils.getLoginUser().getUser();//获取当前系统用户 + if(!currentUser.isAdmin()){ + etFeeRule.setDeptId(currentUser.getDeptId()); + } + } etFeeRule.setCreateTime(DateUtils.getNowDate()); etFeeRule.setStatus("0"); return etFeeRuleMapper.insertEtFeeRule(etFeeRule); diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtModelServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtModelServiceImpl.java index 99f236c..7c2f220 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtModelServiceImpl.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtModelServiceImpl.java @@ -106,7 +106,7 @@ public class EtModelServiceImpl implements IEtModelService @Transactional public int insertEtModel(EtModel etModel) { - if(etModel.getOperator() != null){ + if(etModel.getOperator() == null){ SysUser currentUser = SecurityUtils.getLoginUser().getUser();//获取当前系统用户 if(!currentUser.isAdmin()){ etModel.setOperator(currentUser.getDeptId()); diff --git a/electripper-system/src/main/resources/mapper/system/AsArticleClassifyMapper.xml b/electripper-system/src/main/resources/mapper/system/AsArticleClassifyMapper.xml index 9846f28..6bb2df7 100644 --- a/electripper-system/src/main/resources/mapper/system/AsArticleClassifyMapper.xml +++ b/electripper-system/src/main/resources/mapper/system/AsArticleClassifyMapper.xml @@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -20,12 +21,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select ac.classify_id, ac.parent_id, ac.ancestors, ac.classify_name, ac.order_num, ac.status, ac.del_flag, ac.create_by, ac.create_time + select ac.classify_id, ac.dept_id, ac.parent_id, ac.ancestors, ac.classify_name, ac.order_num, ac.status, ac.del_flag, ac.create_by, ac.create_time from et_article_classify ac @@ -62,6 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" article_id, classify_id, title, + area_id, logo, master_picture, tag, @@ -79,6 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{articleId}, #{classifyId}, #{title}, + #{areaId}, #{logo}, #{masterPicture}, #{tag}, @@ -99,6 +102,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" classify_id = #{classifyId}, title = #{title}, + area_id = #{areaId}, logo = #{logo}, master_picture = #{masterPicture}, tag = #{tag}, diff --git a/electripper-system/src/main/resources/mapper/system/EtFeeRuleMapper.xml b/electripper-system/src/main/resources/mapper/system/EtFeeRuleMapper.xml index eeb62ec..10eb43e 100644 --- a/electripper-system/src/main/resources/mapper/system/EtFeeRuleMapper.xml +++ b/electripper-system/src/main/resources/mapper/system/EtFeeRuleMapper.xml @@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -26,19 +27,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select rule_id, area_id, `name`, `explain`, + select rule_id, dept_id, dept_id, `name`, `explain`, status, auto_refund_deposit, order_exceed_minutes, order_exceed_warn, free_ride_time, rental_unit, riding_rule, riding_rule_json, charging_cycle, charging_cycle_value, capped_amount, instructions, create_by, create_time from et_fee_rule