Bladeren bron

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	ruoyi-admin/src/main/resources/application.yml
Lin Qilong 3 maanden geleden
bovenliggende
commit
5ad253f7fc

+ 1 - 5
ruoyi-admin/src/main/resources/application.yml

@@ -61,6 +61,7 @@ spring:
     # 国际化资源文件路径
     basename: i18n/messages
   profiles:
+    # 配置文件后缀
     active: test
   # 文件上传
   servlet:
@@ -146,11 +147,6 @@ sys:
       path: D:/tmp/map/
 
 snail-job:
-  login:
-    url: http://localhost:8080/snail-job
-    username: admin
-    password: 21232f297a57a5a743894a0e4a801fc3
-    timeout: 60
   server:
     port: 17888
     host: 127.0.0.1

+ 82 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/controller/MdCatalogController.java

@@ -0,0 +1,82 @@
+package com.ruoyi.interfaces.controller;
+
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.SysDept;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.interfaces.domain.MdCatalog;
+import com.ruoyi.interfaces.service.IMdCatalogService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+
+@RestController
+@RequestMapping("/md/catalog")
+public class MdCatalogController extends BaseController {
+    @Autowired
+    private IMdCatalogService  mdCatalogService;
+
+
+
+    /**
+     * 获取目录列表
+     */
+    @GetMapping("/list")
+    public AjaxResult list(MdCatalog catalog)
+    {
+        List<MdCatalog> catalogs = mdCatalogService.selectCatalogList(catalog);
+        return success(catalogs);
+    }
+
+    /**
+     * 新增目录
+     */
+    @PostMapping
+    public AjaxResult add(@RequestBody MdCatalog catalog)
+    {
+        catalog.setCreateBy(getUsername());
+        return toAjax(mdCatalogService.insertCatalog(catalog));
+    }
+
+
+    /**
+     * 修改目录
+     */
+    @PutMapping
+    public AjaxResult edit(@RequestBody MdCatalog catalog)
+    {
+        Integer catalogId = catalog.getCatalogId();
+        if (catalog.getParentId().equals(catalogId))
+        {
+            return error("修改目录'" + catalog.getCatalogName() + "'失败,上级目录不能是自己");
+        }
+        else if (StringUtils.equals("0", catalog.getStatus())
+                && mdCatalogService.selectNormalChildrenCatalogById(catalogId) > 0)
+        {
+            return error("该目录包含未停用的子目录!");
+        }
+        catalog.setUpdateBy(getUsername());
+        return toAjax(mdCatalogService.updateCatalog(catalog));
+    }
+
+
+
+    /**
+     * 删除目录
+     */
+    @DeleteMapping("/{catalogId}")
+    public AjaxResult remove(@PathVariable Integer catalogId)
+    {
+        if (mdCatalogService.hasChildByCatalogId(catalogId))
+        {
+            return warn("存在下级目录,不允许删除");
+        }
+
+        return toAjax(mdCatalogService.deleteCatalogById(catalogId));
+    }
+
+
+}

+ 58 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/domain/MdCatalog.java

@@ -0,0 +1,58 @@
+package com.ruoyi.interfaces.domain;
+
+import com.ruoyi.common.core.domain.BaseEntity;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 模型目录
+ */
+@Data
+public class MdCatalog extends BaseEntity {
+    /**
+     * 目录id
+     */
+    private Integer catalogId;
+    /**
+     * 目录名称
+     */
+    private String catalogName;
+    /**
+     * 父目录id
+     */
+    private Integer parentId;
+    /**
+     * 祖级列表
+     */
+    private String ancestors;
+    /**
+     * 目录说明
+     */
+    private String remark;
+    /**
+     * 显示顺序
+     */
+    private Integer sort;
+    /**
+     * 目录状态(0 = 停用 1 = 正常)
+     */
+    private String status;
+    /**
+     * 创建者
+     */
+    private String createBy;
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+    /**
+     * 更新者
+     */
+    private String updateBy;
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+}
+

+ 34 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/mapper/MdCatalogMapper.java

@@ -0,0 +1,34 @@
+package com.ruoyi.interfaces.mapper;
+
+import com.ruoyi.common.annotation.DataSource;
+import com.ruoyi.common.enums.DataSourceType;
+import com.ruoyi.interfaces.domain.MdCatalog;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+@DataSource(DataSourceType.SLAVE)
+public interface MdCatalogMapper {
+
+    int insertCatalog(MdCatalog catalog);
+
+    MdCatalog selectCatalogById(Integer catalogId);
+
+    int selectNormalChildrenDeptById(Integer catalogId);
+
+    List<MdCatalog> selectChildrenCatalogById(Integer catalogId);
+
+    int updateDeptChildren(@Param("catalogs") List<MdCatalog> catalogs);
+
+    int updateCatalog(MdCatalog dept);
+
+    int updateCatalogStatusNormal(Integer[] catalogIds);
+
+    int hasChildByCatalogId(Integer catalogId);
+
+    int deleteCatalogById(Integer catalogId);
+
+    List<MdCatalog> selectCatalogList(MdCatalog catalog);
+}

+ 19 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/service/IMdCatalogService.java

@@ -0,0 +1,19 @@
+package com.ruoyi.interfaces.service;
+
+import com.ruoyi.interfaces.domain.MdCatalog;
+
+import java.util.List;
+
+public interface IMdCatalogService {
+    int insertCatalog(MdCatalog catalog);
+
+    int selectNormalChildrenCatalogById(Integer catalogId);
+
+    int updateCatalog(MdCatalog dept);
+
+    boolean hasChildByCatalogId(Integer catalogId);
+
+    int deleteCatalogById(Integer catalogId);
+
+    List<MdCatalog> selectCatalogList(MdCatalog catalog);
+}

+ 109 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/service/impl/MdCatalogServiceImpl.java

@@ -0,0 +1,109 @@
+package com.ruoyi.interfaces.service.impl;
+
+import com.ruoyi.common.constant.UserConstants;
+import com.ruoyi.common.core.text.Convert;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.interfaces.domain.MdCatalog;
+import com.ruoyi.interfaces.mapper.MdCatalogMapper;
+import com.ruoyi.interfaces.service.IMdCatalogService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Collections;
+import java.util.List;
+
+@Service
+public class MdCatalogServiceImpl implements IMdCatalogService {
+    @Autowired
+    private MdCatalogMapper  mdCatalogMapper;
+
+    @Override
+    public int insertCatalog(MdCatalog catalog) {
+        if (StringUtils.isNull(catalog.getParentId())) {
+            //新增顶级节点
+            return mdCatalogMapper.insertCatalog(catalog);
+        }
+        MdCatalog info = mdCatalogMapper.selectCatalogById(catalog.getParentId());
+        if (StringUtils.isNull(info)) {
+            throw new ServiceException("父目录不存在,不允许新增");
+        }
+        // 如果父节点不为正常状态,则不允许新增子节点
+        if (!"1".equals(info.getStatus()) ) {
+            throw new ServiceException("目录停用,不允许新增");
+        }
+        catalog.setAncestors(info.getAncestors() + "," + catalog.getParentId());
+        return mdCatalogMapper.insertCatalog(catalog);
+    }
+
+    @Override
+    public int selectNormalChildrenCatalogById(Integer catalogId) {
+
+        return mdCatalogMapper.selectNormalChildrenDeptById(catalogId);
+    }
+
+    @Override
+    public int updateCatalog(MdCatalog catalog) {
+        MdCatalog newParentMdCatalog = mdCatalogMapper.selectCatalogById(catalog.getParentId());
+        MdCatalog oldCatalog = mdCatalogMapper.selectCatalogById(catalog.getCatalogId());
+        if (StringUtils.isNotNull(newParentMdCatalog) && StringUtils.isNotNull(oldCatalog)) {
+            String newAncestors = newParentMdCatalog.getAncestors() + "," + newParentMdCatalog.getCatalogId();
+            String oldAncestors = oldCatalog.getAncestors();
+            catalog.setAncestors(newAncestors);
+            updateCatalogChildren(catalog.getCatalogId(), newAncestors, oldAncestors);
+        }
+        int result = mdCatalogMapper.updateCatalog(catalog);
+        if ("1".equals(catalog.getStatus()) && StringUtils.isNotEmpty(catalog.getAncestors())
+               ) {
+            // 如果该部门是启用状态,则启用该部门的所有上级部门
+            updateParentCatalogStatusNormal(catalog);
+        }
+        return result;
+    }
+
+    @Override
+    public boolean hasChildByCatalogId(Integer catalogId) {
+        int result = mdCatalogMapper.hasChildByCatalogId(catalogId);
+        return result > 0;
+    }
+
+    @Override
+    public int deleteCatalogById(Integer catalogId) {
+
+        return mdCatalogMapper.deleteCatalogById(catalogId);
+    }
+
+    @Override
+    public List<MdCatalog> selectCatalogList(MdCatalog catalog) {
+        return mdCatalogMapper.selectCatalogList(catalog);
+    }
+
+    /**
+     * 修改该目录的父级目录状态
+     *
+     * @param catalog 当前目录
+     */
+    private void updateParentCatalogStatusNormal(MdCatalog catalog) {
+        String ancestors = catalog.getAncestors();
+        Integer[] catalogIds = Convert.toIntArray(ancestors);
+        mdCatalogMapper.updateCatalogStatusNormal(catalogIds);
+    }
+
+    /**
+     * 修改子元素关系
+     *
+     * @param catalogId       被修改的部门ID
+     * @param newAncestors 新的父ID集合
+     * @param oldAncestors 旧的父ID集合
+     */
+    public void updateCatalogChildren(Integer catalogId, String newAncestors, String oldAncestors) {
+        List<MdCatalog> children = mdCatalogMapper.selectChildrenCatalogById(catalogId);
+        for (MdCatalog child : children) {
+            child.setAncestors(child.getAncestors().replaceFirst(oldAncestors, newAncestors));
+        }
+        if (children.size() > 0) {
+            mdCatalogMapper.updateDeptChildren(children);
+        }
+    }
+
+}

+ 7 - 6
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/service/impl/PtServiceServiceImpl.java

@@ -16,7 +16,6 @@ import com.ruoyi.interfaces.mapper.PtServiceParamMapper;
 import com.ruoyi.interfaces.service.IMdModelInfoService;
 import com.ruoyi.interfaces.service.PtServiceService;
 import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -115,12 +114,13 @@ public class PtServiceServiceImpl extends ServiceImpl<PtServiceMapper, PtService
     @Override
     public MdModelInfoVo modelService(MdModelInfoVo par) {
         MdModelInfoVo mdModelInfoVo = ptServiceMapper.selectModelService(par);
-        mdModelInfoVo.getServiceList().forEach(p -> {
-            p.setDevelopContacter(sm4Util.decrypt(p.getDevelopContacter()));
-            p.setMaintainContacer(sm4Util.decrypt(p.getMaintainContacer()));
-            p.setAdName(sm4Util.decrypt(p.getAdName()));
+        if (StringUtils.isNotNull(mdModelInfoVo) && StringUtils.isNotEmpty(mdModelInfoVo.getServiceList()))
+            mdModelInfoVo.getServiceList().forEach(p -> {
+                p.setDevelopContacter(sm4Util.decrypt(p.getDevelopContacter()));
+                p.setMaintainContacer(sm4Util.decrypt(p.getMaintainContacer()));
+                p.setAdName(sm4Util.decrypt(p.getAdName()));
 
-        });
+            });
         return mdModelInfoVo;
     }
 
@@ -145,6 +145,7 @@ public class PtServiceServiceImpl extends ServiceImpl<PtServiceMapper, PtService
     public HashMap<String, String> testRun(PtService ptService) throws IOException {
 
         String url = RuoYiConfig.getGatewayUrl() + ptService.getProxyPath() + ptService.getUrl();
+        System.out.println(url);
         //String url = ptService.getUrl();
         HashMap<String, String> headers = new HashMap<>();
         List<PtServiceParam> params = ptService.getParams();

+ 155 - 0
ruoyi-api-patform/src/main/resources/mapper/interfaces/MdCatalogMapper.xml

@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.interfaces.mapper.MdCatalogMapper">
+
+    <insert id="insertCatalog">
+        insert into md_catalog(
+                               catalog_name,
+                               parent_id,
+                               ancestors,
+                               remark,
+                               sort,
+                               status,
+                               create_by,
+                               create_time,
+                               update_by,
+                               update_time)
+        values (  #{catalogName,jdbcType=VARCHAR}
+               , #{parentId,jdbcType=INTEGER}
+               , #{ancestors,jdbcType=VARCHAR}
+               , #{remark,jdbcType=VARCHAR}
+               , #{sort,jdbcType=INTEGER}
+               , #{status,jdbcType=VARCHAR}
+               , #{createBy,jdbcType=VARCHAR}
+               , sysdate
+               , #{updateBy,jdbcType=VARCHAR}
+               , #{updateTime,jdbcType=DATE}
+               )
+    </insert>
+    <update id="updateDeptChildren">
+        update md_catalog set ancestors =
+        <foreach collection="catalogs" item="item" index="index"
+                 separator=" " open="case catalog_id" close="end">
+            when #{item.catalogId} then #{item.ancestors}
+        </foreach>
+        where catalog_id in
+        <foreach collection="catalogs" item="item" index="index"
+                 separator="," open="(" close=")">
+            #{item.catalogId}
+        </foreach>
+    </update>
+    <update id="updateCatalog">
+        update md_catalog
+        <set>
+            <if test="catalogName != null and catalogName != ''">
+                catalog_name = #{catalogName},
+            </if>
+            <if test="parentId != null ">
+                parent_id = #{parentId},
+            </if>
+            <if test="ancestors != null">
+                ancestors = #{ancestors},
+            </if>
+            <if test="remark != null">
+                remark = #{remark},
+            </if>
+            <if test="sort != null ">
+                sort = #{sort},
+            </if>
+            <if test="status != null">
+                status = #{status},
+            </if>
+            <if test="createBy != null">
+                create_by = #{createBy},
+            </if>
+            <if test="createTime != null ">
+                create_time = #{createTime},
+            </if>
+            <if test="updateBy != null">
+                update_by = #{updateBy},
+            </if>
+                update_time = sysdate
+        </set>
+        where catalog_id = #{catalogId}
+    </update>
+    <update id="updateCatalogStatusNormal">
+        update md_catalog set status = '0' where catalog_id in
+        <foreach collection="array" item="catalogId" open="(" separator="," close=")">
+            #{catalogId}
+        </foreach>
+    </update>
+    <delete id="deleteCatalogById">
+        delete from md_catalog
+        where catalog_id = #{catalogId}
+    </delete>
+    <select id="selectCatalogById" resultType="com.ruoyi.interfaces.domain.MdCatalog">
+        select catalog_id,
+               catalog_name,
+               parent_id,
+               ancestors,
+               remark,
+               sort,
+               status,
+               create_by,
+               create_time,
+               update_by,
+               update_time
+        from md_catalog
+        <where>
+            catalog_id = #{catalogId}
+        </where>
+    </select>
+    <select id="selectNormalChildrenDeptById" resultType="java.lang.Integer">
+        select count(*) from md_catalog where status = 0 and instr(','||ancestors||',' ,  ','|| #{catalogId} ||',')
+    </select>
+    <select id="selectChildrenCatalogById" resultType="com.ruoyi.interfaces.domain.MdCatalog">
+        select * from md_catalog where instr(','||ancestors||',' ,  ','|| #{catalogId} ||',')
+    </select>
+    <select id="hasChildByCatalogId" resultType="java.lang.Integer">
+        select count(1) from md_catalog
+        where parent_id = #{catalogId} limit 1
+    </select>
+    <select id="selectCatalogList" resultType="com.ruoyi.interfaces.domain.MdCatalog">
+        select
+        catalog_id,catalog_name,parent_id,ancestors,remark,sort,status,create_by,create_time,update_by,update_time
+        from md_catalog
+        <where>
+            <if test="catalogId != null">
+                and catalog_id = #{catalogId}
+            </if>
+
+            <if test="catalogName != null">
+                and catalog_name like concat('%', #{catalogName}, '%')
+            </if>
+            <if test="parentId != null">
+                and parent_id = #{parentId}
+            </if>
+            <if test="ancestors != null">
+                and ancestors = #{ancestors}
+            </if>
+            <if test="remark != null">
+                and remark = #{remark}
+            </if>
+            <if test="sort != null">
+                and sort = #{sort}
+            </if>
+            <if test="status != null">
+                and status = #{status}
+            </if>
+            <if test="createBy != null">
+                and create_by = #{createBy}
+            </if>
+            <if test="createTime != null ">
+                and create_time = #{createTime}
+            </if>
+            <if test="updateBy != null">
+                and update_by = #{updateBy}
+            </if>
+            <if test="updateTime != null">
+                and update_time = #{updateTime}
+            </if>
+        </where>
+    </select>
+</mapper>

+ 1 - 0
ruoyi-api-patform/src/main/resources/mapper/interfaces/SysMetaTableMapper.xml

@@ -24,6 +24,7 @@
             resultMap="SysMetaTableResult">
         <include refid="selectSysMetaTableVo"/>
         <where>
+            <if test="dsCode != null  and dsCode != ''">and ds_code = #{dsCode} </if>
             <if test="metaName != null  and metaName != ''">and META_NAME like concat('%', #{metaName}, '%')</if>
             <if test="metaType != null  and metaType != ''">and META_TYPE = #{metaType}</if>
             <if test="metaCatalog != null  and metaCatalog != ''">and META_CATALOG = #{metaCatalog}</if>

+ 1 - 2
ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml

@@ -75,12 +75,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</select>
 	
 	<select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
--- 		select * from sys_dept where find_in_set(#{deptId}, ancestors)
+
 		select * from sys_dept where instr(','||ancestors||',' ,  ','|| #{deptId} ||',')
 	</select>
 	
 	<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
--- 		select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)
 		select count(*) from sys_dept where status = 0 and del_flag = '0' and instr(','||ancestors||',' ,  ','|| #{deptId} ||',')
 	</select>
 	

+ 2 - 0
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -84,6 +84,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<!-- 数据范围过滤 -->
 		${params.dataScope}
 	</select>
+
+
 	
 	<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
 	    select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time

+ 3 - 3
ruoyi-ui/src/views/evaluate/score.vue

@@ -183,7 +183,7 @@
           </template>
         </el-dialog>
         <el-dialog @close="clearForm" v-model="dialogVisibleRen" :title="titleTest" width="30%" destroy-on-close class="custom-dialog-bg">
-          <el-form size="mini" style="margin-top:1%;width: 98%;" :model="formRen" label-position="right" :rules="rulesRen"
+          <el-form size="mini" style="margin-top:1%;width: 98%;height:15vh;" :model="formRen" label-position="right" :rules="rulesRen"
                  ref="formRefRen" label-width="100px" >
             <el-form-item label="认定类型:" prop="firmlyType"  style="">
               <el-select
@@ -195,7 +195,7 @@
                   <el-option label="评分认定" value="1"></el-option>
               </el-select>
             </el-form-item>
-            <el-form-item v-if="formRen.firmlyType=='1'" label="认定分数:" prop="firmlyConfirm"  style="">
+            <el-form-item v-if="formRen.firmlyType=='0'" label="认定分数:" prop="firmlyConfirm"  style="">
               <el-input v-model="formRen.firmlyConfirm" style="width: 100%;" />
             </el-form-item>
 
@@ -298,7 +298,7 @@ function editLog(row){
   formAdd.value.remark = row.remark
 }
 function changeRule(){
-  if(formRen.value.firmlyType==='1'){
+  if(formRen.value.firmlyType==='0'){
     rulesRen.firmlyConfirm = [{required: true, message: '必填', trigger: 'blur'}]
   }
 }

+ 1 - 1
ruoyi-ui/src/views/register/componentReg/index.vue

@@ -659,7 +659,7 @@
                 </div>
               </div>
             </el-tab-pane>
-            <el-tab-pane label="服务信息" style="height: 50vh;" :key="activeTabKey"> 
+            <el-tab-pane label="服务信息" style="" :key="activeTabKey"> 
               <el-button @click="showAddSer" type="primary" plain size="mini" style="margin-left: 1%;">新增服务</el-button>
               <el-table 
                 :data="tableDataSer"