Procházet zdrojové kódy

增加资源库模块

pull/4/head
lcr před 5 měsíci
rodič
revize
6533b1914d
8 změnil soubory, kde provedl 359 přidání a 13 odebrání
  1. +110
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/controller/ResourceLibraryController.java
  2. +87
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/domain/ResourceLibrary.java
  3. +24
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/mapper/ResourceLibraryMapper.java
  4. +24
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/service/IResourceLibraryService.java
  5. +14
    -12
      ruoyi-business/src/main/java/com/ruoyi/business/service/impl/ApplyPlanServiceImpl.java
  6. +34
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/service/impl/ResourceLibraryServiceImpl.java
  7. +1
    -1
      ruoyi-business/src/main/resources/mapper/business/ApplyMapper.xml
  8. +65
    -0
      ruoyi-business/src/main/resources/mapper/business/ResourceLibraryMapper.xml

+ 110
- 0
ruoyi-business/src/main/java/com/ruoyi/business/controller/ResourceLibraryController.java Zobrazit soubor

@@ -0,0 +1,110 @@
package com.ruoyi.business.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
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;
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.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.business.domain.ResourceLibrary;
import com.ruoyi.business.service.IResourceLibraryService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
* 资源库管理Controller
*
* @author LiuChengRan
* @date 2024-06-17
*/
@Api(tags = "资源库管理接口")
@RestController
@RequestMapping("/business/ctResourceLibrary")
public class ResourceLibraryController extends BaseController
{
@Autowired
private IResourceLibraryService resourceLibraryService;

/**
* 查询资源库管理列表
*/
@ApiOperation(value="查询资源库管理列表", httpMethod = "GET", response = ResourceLibrary.class)
@GetMapping("/list")
public TableDataInfo list(ResourceLibrary resourceLibrary)
{
startPage();
List<ResourceLibrary> list = resourceLibraryService.list(resourceLibrary);
return getDataTable(list);
}

/**
* 导出资源库管理列表
*/
@ApiOperation(value="导出资源库管理列表", httpMethod = "POST")
@Log(title = "资源库管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ResourceLibrary resourceLibrary)
{
List<ResourceLibrary> list = resourceLibraryService.list(resourceLibrary);
ExcelUtil<ResourceLibrary> util = new ExcelUtil<ResourceLibrary>(ResourceLibrary.class);
util.exportExcel(response, list, "资源库管理数据");
}

/**
* 获取资源库管理详细信息
*/
@ApiOperation(value="获取资源库管理详细信息", httpMethod = "GET", response = ResourceLibrary.class)
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(resourceLibraryService.getById(id));
}

/**
* 新增资源库管理
*/
@ApiOperation(value="新增资源库管理", httpMethod = "POST")
@Log(title = "资源库管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ResourceLibrary resourceLibrary)
{
return toAjax(resourceLibraryService.save(resourceLibrary));
}

/**
* 修改资源库管理
*/
@ApiOperation(value="修改资源库管理", httpMethod = "PUT")
@Log(title = "资源库管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ResourceLibrary resourceLibrary)
{
return toAjax(resourceLibraryService.updateById(resourceLibrary));
}

/**
* 删除资源库管理
*/
@ApiOperation(value="删除资源库管理", httpMethod = "DELETE")
@Log(title = "资源库管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(resourceLibraryService.removeByIds(Arrays.asList(ids)));
}
}

+ 87
- 0
ruoyi-business/src/main/java/com/ruoyi/business/domain/ResourceLibrary.java Zobrazit soubor

@@ -0,0 +1,87 @@
package com.ruoyi.business.domain;

import com.baomidou.mybatisplus.annotation.*;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.NoArgsConstructor;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.IdType;
import com.ruoyi.common.core.domain.BaseEntity;

/**
* 资源库管理对象 ct_resource_library
*
* @author LiuChengRan
* @date 2024-06-17
*/
@Data
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="ResourceLibrary",description = "资源库管理")
@TableName(value = "ct_resource_library")
public class ResourceLibrary extends BaseEntity
{
@TableField(exist = false)
private static final long serialVersionUID = 1L;



/** 资源描述 */
@Excel(name = "资源描述")
@ApiModelProperty(name="resource",value = "资源描述")
private String resource;

/** 资源内容 */
@Excel(name = "资源内容")
@ApiModelProperty(name="resourceValue",value = "资源内容")
private String resourceValue;

/** 资源类型 */
@Excel(name = "资源类型")
@ApiModelProperty(name="resourceType",value = "资源类型")
private String resourceType;

/** 资源键 */
@Excel(name = "资源键")
@ApiModelProperty(name="resourceName",value = "资源键")
private String resourceName;

/** 所属应用名称 */
@Excel(name = "所属应用名称")
@ApiModelProperty(name="appName",value = "所属应用名称")
private String appName;

/** 部门id */
@Excel(name = "部门id")
@ApiModelProperty(name="deptId",value = "部门id")
private Long deptId;


@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("resource", getResource())
.append("resourceValue", getResourceValue())
.append("resourceType", getResourceType())
.append("resourceName", getResourceName())
.append("appName", getAppName())
.append("deptId", getDeptId())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("deleted", getDeleted())
.toString();
}
}

+ 24
- 0
ruoyi-business/src/main/java/com/ruoyi/business/mapper/ResourceLibraryMapper.java Zobrazit soubor

@@ -0,0 +1,24 @@
package com.ruoyi.business.mapper;

import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.business.domain.ResourceLibrary;

/**
* 资源库管理Mapper接口
*
* @author LiuChengRan
* @date 2024-06-17
*/
public interface ResourceLibraryMapper extends BaseMapper<ResourceLibrary>
{

/**
* 查询资源库管理列表
*
* @param resourceLibrary 资源库管理
* @return 资源库管理集合
*/
List<ResourceLibrary> selectResourceLibraryList(ResourceLibrary resourceLibrary);

}

+ 24
- 0
ruoyi-business/src/main/java/com/ruoyi/business/service/IResourceLibraryService.java Zobrazit soubor

@@ -0,0 +1,24 @@
package com.ruoyi.business.service;

import java.util.List;
import com.ruoyi.business.domain.ResourceLibrary;
import com.baomidou.mybatisplus.extension.service.IService;

/**
* 资源库管理Service接口
*
* @author LiuChengRan
* @date 2024-06-17
*/
public interface IResourceLibraryService extends IService<ResourceLibrary>
{

/**
* 查询资源库管理列表
*
* @param resourceLibrary 资源库管理
* @return 资源库管理集合
*/
List<ResourceLibrary> list(ResourceLibrary resourceLibrary);

}

+ 14
- 12
ruoyi-business/src/main/java/com/ruoyi/business/service/impl/ApplyPlanServiceImpl.java Zobrazit soubor

@@ -90,7 +90,7 @@ public class ApplyPlanServiceImpl extends ServiceImpl<ApplyPlanMapper, ApplyPlan
JobStartVO jobStartVO = YinDaoHttpUtils.appStart(applyStartBO);
ApplyPlan applyPlan = new ApplyPlan();
applyPlan.setId(e.getId());
applyPlan.setUpdateBy("-1");
applyPlan.setUpdateBy("系统修改");
applyPlan.setUpdateTime(new Date());
applyPlan.setTaskUuid(jobStartVO.getJobUuid());
applyPlan.setTaskStatus(PlanRunStatus.CREATED.getKey());
@@ -99,8 +99,9 @@ public class ApplyPlanServiceImpl extends ServiceImpl<ApplyPlanMapper, ApplyPlan
updateRebot.setUpdateBy("-1");
updateRebot.setUpdateTime(new Date());
updateRebot.setStatus(RebotStatus.RUNNING.getKey());
rebotService.lambdaUpdate().eq(Rebot::getRobotClientName, rebot.getRobotClientName()).update(updateRebot);
applyPlanList.remove(e);
if(rebotService.lambdaUpdate().eq(Rebot::getRobotClientName, rebot.getRobotClientName()).update(updateRebot)){
applyPlanList.remove(e);
}
} catch (IllegalAccessException ex) {
throw new RuntimeException(ex);
}
@@ -173,7 +174,7 @@ public class ApplyPlanServiceImpl extends ServiceImpl<ApplyPlanMapper, ApplyPlan
JobStartVO jobStartVO = YinDaoHttpUtils.appStart(applyStartBO);
ApplyPlan applyPlan = new ApplyPlan();
applyPlan.setId(e.getId());
applyPlan.setUpdateBy("-1");
applyPlan.setUpdateBy("系统修改");
applyPlan.setUpdateTime(new Date());
applyPlan.setTaskUuid(jobStartVO.getJobUuid());
applyPlan.setTaskStatus(PlanRunStatus.CREATED.getKey());
@@ -190,11 +191,12 @@ public class ApplyPlanServiceImpl extends ServiceImpl<ApplyPlanMapper, ApplyPlan
applyPlan.setNextExecTime(nextDate);
this.updateById(applyPlan);
Rebot updateRebot = new Rebot();
updateRebot.setUpdateBy("-1");
updateRebot.setUpdateBy("系统修改");
updateRebot.setUpdateTime(new Date());
updateRebot.setStatus(RebotStatus.RUNNING.getKey());
rebotService.lambdaUpdate().eq(Rebot::getRobotClientName, rebot.getRobotClientName()).update(updateRebot);
applyPlanList.remove(e);
if(rebotService.lambdaUpdate().eq(Rebot::getRobotClientName, rebot.getRobotClientName()).update(updateRebot)){
applyPlanList.remove(e);
}
} catch (IllegalAccessException | ParseException ex) {
throw new RuntimeException(ex);
}
@@ -266,7 +268,7 @@ public class ApplyPlanServiceImpl extends ServiceImpl<ApplyPlanMapper, ApplyPlan
updateApplyPlan.setTimeSaving((Long.parseLong(applyPlan.getManualTime()) - planTime) + "");
}
updateApplyPlan.setId(applyPlan.getId());
updateApplyPlan.setUpdateBy("-1");
updateApplyPlan.setUpdateBy("系统修改");
updateApplyPlan.setUpdateTime(new Date());
this.updateById(updateApplyPlan);
}
@@ -275,14 +277,14 @@ public class ApplyPlanServiceImpl extends ServiceImpl<ApplyPlanMapper, ApplyPlan
if (finishStatus.contains(jobQueryVO.getStatus())) {
Rebot rebot = new Rebot();
rebot.setStatus(RebotStatus.IDLE.getKey());
rebot.setUpdateBy("-1");
rebot.setUpdateBy("系统修改");
rebot.setUpdateTime(new Date());
rebot.setStatus(RebotStatus.IDLE.getKey());
rebotService.lambdaUpdate().eq(Rebot::getRobotClientName, jobQueryVO.getRobotClientName()).update(rebot);
} else if (PlanRunStatus.RUNNING.getKey().equals(jobQueryVO.getStatus())) {
Rebot rebot = new Rebot();
rebot.setStatus(RebotStatus.RUNNING.getKey());
rebot.setUpdateBy("-1");
rebot.setUpdateBy("系统修改");
rebot.setUpdateTime(new Date());
rebotService.lambdaUpdate().eq(Rebot::getRobotClientName, jobQueryVO.getRobotClientName()).update(rebot);
}
@@ -363,9 +365,9 @@ public class ApplyPlanServiceImpl extends ServiceImpl<ApplyPlanMapper, ApplyPlan

ApplyPlan updateApplyPlan = new ApplyPlan();
updateApplyPlan.setId(applyPlan.getId());
updateApplyPlan.setCreateBy("-1");
updateApplyPlan.setCreateBy("系统创建");
updateApplyPlan.setCreateTime(new Date());
updateApplyPlan.setUpdateBy("-1");
updateApplyPlan.setUpdateBy("系统修改");
updateApplyPlan.setUpdateTime(new Date());
updateApplyPlan.setStartTime(new Date());
updateApplyPlan.setTaskUuid(jobStartVO.getJobUuid());


+ 34
- 0
ruoyi-business/src/main/java/com/ruoyi/business/service/impl/ResourceLibraryServiceImpl.java Zobrazit soubor

@@ -0,0 +1,34 @@
package com.ruoyi.business.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.ResourceLibraryMapper;
import com.ruoyi.business.domain.ResourceLibrary;
import com.ruoyi.business.service.IResourceLibraryService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
* 资源库管理Service业务层处理
*
* @author LiuChengRan
* @date 2024-06-17
*/
@Service
public class ResourceLibraryServiceImpl extends ServiceImpl<ResourceLibraryMapper, ResourceLibrary> implements IResourceLibraryService
{


/**
* 查询资源库管理列表
*
* @param resourceLibrary 资源库管理
* @return 资源库管理
*/
@Override
public List<ResourceLibrary> list(ResourceLibrary resourceLibrary)
{
return baseMapper.selectResourceLibraryList(resourceLibrary);
}
}

+ 1
- 1
ruoyi-business/src/main/resources/mapper/business/ApplyMapper.xml Zobrazit soubor

@@ -110,7 +110,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="supportParam != null "> and support_param = #{supportParam}</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="deptName != null and deptName != ''"> and dept_name like concat(#{deptName}, '%')</if>
and version != '未发版'
and version != '未发版' and apply.manual_time != null
</where>
<!-- 数据范围过滤 -->
${params.dataScope}


+ 65
- 0
ruoyi-business/src/main/resources/mapper/business/ResourceLibraryMapper.xml Zobrazit soubor

@@ -0,0 +1,65 @@
<?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.business.mapper.ResourceLibraryMapper">
<!--资源库管理对象 ct_resource_library-->
<resultMap type="ResourceLibrary" id="ResourceLibraryResult">
<!-- 主键 -->
<result property="id" column="id" />
<!-- 资源描述 -->
<result property="resource" column="resource" />
<!-- 资源内容 -->
<result property="resourceValue" column="resource_value" />
<!-- 资源类型 -->
<result property="resourceType" column="resource_type" />
<!-- 资源键 -->
<result property="resourceName" column="resource_name" />
<!-- 所属应用名称 -->
<result property="appName" column="app_name" />
<!-- 部门id -->
<result property="deptId" column="dept_id" />
<!-- 创建者 -->
<result property="createBy" column="create_by" />
<!-- 创建时间 -->
<result property="createTime" column="create_time" />
<!-- 更新者 -->
<result property="updateBy" column="update_by" />
<!-- 更新时间 -->
<result property="updateTime" column="update_time" />
<!-- 备注 -->
<result property="remark" column="remark" />
<!-- 是否删除 -->
<result property="deleted" column="deleted" />
</resultMap>

<sql id="selectResourceLibraryVo">
select
id,<!-- 主键 -->
resource,<!-- 资源描述 -->
resource_value,<!-- 资源内容 -->
resource_type,<!-- 资源类型 -->
resource_name,<!-- 资源键 -->
app_name,<!-- 所属应用名称 -->
dept_id,<!-- 部门id -->
create_by,<!-- 创建者 -->
create_time,<!-- 创建时间 -->
update_by,<!-- 更新者 -->
update_time,<!-- 更新时间 -->
remark,<!-- 备注 -->
deleted </sql>

<select id="selectResourceLibraryList" parameterType="ResourceLibrary" resultMap="ResourceLibraryResult">
<include refid="selectResourceLibraryVo"/>
from ct_resource_library
<where>
deleted = 0
<if test="resource != null and resource != ''"> and resource like concat(#{resource}, '%')</if>
<if test="resourceValue != null and resourceValue != ''"> and resource_value = #{resourceValue}</if>
<if test="resourceType != null and resourceType != ''"> and resource_type = #{resourceType}</if>
<if test="resourceName != null and resourceName != ''"> and resource_name like concat(#{resourceName}, '%')</if>
<if test="appName != null and appName != ''"> and app_name like concat(#{appName}, '%')</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
</where>
</select>
</mapper>

Načítá se…
Zrušit
Uložit