Resource Management System

Reminder: No

table of Contents

Preface

1. 2021-3-22 interface document (company)

URL: /system/dept/company

ARGUMENT:  no input argument

1. Enter the data

2.SQL statement

 

2. 2021-3-22 interface document (user department)

URL: /system/dept/department/{deptId} (Note: {deptld} is the company id type Long) Request method: [GET] restful style

ARGUMENT: deptld, type Long, chinse company id

1. Enter the data

2.SQL statement

3. 2021-3-22 interface document (user)

URL: /system/user/list

ARGUMENT:  UserObjct

1. Enter the data

 

Fourth, 2021-3-23 interface documents (import resources into the library)

URL: /assets/assets/inputData (Note:) Request method: [Post]    

ARGUMENT: file: file, boolean (boolean type): updateSupport. (Note: the value of boolean type: ture and false. If it is true, the imported asset number will be updated. If it is false, the asset with the existing asset number will be updated. Will not be added) 

1. Enter the data

2.impl statement

5. 2021-3-23 interface document (image upload) This interface is a general interface

URL:/system/pictures/inputImage (Note: file file) Request method: [Post]    

ARGUMENT: file: file, String: useType  

1. Enter the data

2.impl statement

6. 2021-3-29 interface document (operator) This interface is a general interface

URL:/system/user/locahostPhoneAndName Request method: [Get]     

1. Enter the data

2.impl statement

7. 2021-3-29 interface document (resources in query state) This interface is a general interface

URL:/assets/assets/selectAssetsState Parameters: assetsState: idle 

       Request method: [Get]     

1. Enter the data

2.sql statement

8. 2021-3-29 interface documentation (newly added for resource acquisition)   

URL:/getassets/getassets Parameters: AddGetAssets object and long[] assetsId asset id array Request method: [Post]     

1. Enter the data

2.impl statement

Nine, 2021-3-29 interface document (when asset scheduling is added, find all idle resources under the company)   

URL:/assets/assets/companyResources Parameter: Long companyId owning company id Request method: [Get]     

1. Enter the data

2.impl statement

X. 2021-3-29 interface document (all the resources in use under the current company)   

URL:/assets/assets/usecompanyResources Parameters: None Request method: [Get]     

1. Enter the data

2.impl statement

to sum up



Preface

Reminder: no
such as no


Tip: If there is no place where return is declared, the object will be returned by default. You need to check the corresponding value yourself. Since there are many object properties, they will not be listed one by one.

1. 2021-3-22 interface document (company)

Example:

URL: /system/dept/company

ARGUMENT:  no input argument

1. Enter the data

The code is as follows (example):

    /**
     * 获取所有公司
     */
    @ApiOperation("获取所有公司")
    @GetMapping("company")
    public AjaxResult selectCompany(){
        SysDept sysDept = new SysDept();
        sysDept.setAncestors(Depts.getName("公司"));
        System.out.println(Depts.getName("公司"));
        return AjaxResult.success(deptService.selectCompany(sysDept));
    }

2.SQL statement

The code is as follows (example):

	<!-- 查询所有公司 -->
	<select id="selectCompany"  resultMap="SysDeptResult">
		<include refid="selectDeptVo"/>
		where d.del_flag = '0'
		and  ancestors like concat('%', #{ancestors}, '%')
	</select>

The data requested by the url network used here.

Example:

 

2. 2021-3-22 interface document (user department)

Example:

URL: /system/dept/department/{deptId} (Note: {deptld} is the company id type Long) Request method: [GET] restful style

ARGUMENT: deptld, type Long, chinse company id

1. Enter the data

The code is as follows (example):

    /**
     * 查看已选择公司下的所有部门
     */
    @ApiOperation("查看已选择公司下的所有部门")
    @GetMapping(value = "/department/{deptId}")
    public AjaxResult selectDeptId(@PathVariable("deptId") long deptId){
        SysDept sysDept = new SysDept();
        sysDept.setAncestors(deptId+"");
        return AjaxResult.success(deptService.selectDeptList(sysDept));
    }

2.SQL statement

The code is as follows (example):

	<!-- 查询所有公司 或者 部门 -->
	<select id="selectDepartment"  resultMap="SysDeptResult">
		<include refid="selectDeptVo"/>
		where d.del_flag = '0'
		and  ancestors like concat('%', #{ancestors}, '%')
		and  dept_id != #{ancestors}
	</select>

The data requested by the url network used here.

Example:

3. 2021-3-22 interface document (user)

Example:

URL: /system/user/list

ARGUMENT:  UserObjct

1. Enter the data

The code is as follows (example):

    /**
     * 获取用户列表
     */
    @ApiOperation("获取用户列表")
    @PreAuthorize("@ss.hasPermi('system:user:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysUser user)
    {
        startPage();
        List<SysUser> list = userService.selectUserList(user);
        return getDataTable(list);
    }

 

Example:

 

 

Fourth, 2021-3-23 interface documents (import resources into the library)

Example:

URL: /assets/assets/inputData (Note:) Request method: [Post]    

ARGUMENT: file: file, boolean (boolean type): updateSupport. (Note: the value of boolean type: ture and false. If it is true, the imported asset number will be updated. If it is false, the asset with the existing asset number will be updated. Will not be added) 

1. Enter the data

The code is as follows (example):

    /**
     * 导入资源入库
     */
    @ApiOperation("查询资源入库列表")
    @Log(title = "导入资源入库",businessType = BusinessType.INSERT)
    @PostMapping("/inputData")
    public AjaxResult inputData(MultipartFile file, boolean updateSupport) throws Exception {
        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
        loginUser.getUser().getUserId();

        ExcelUtil<AddAssets> util = new ExcelUtil<AddAssets>(AddAssets.class);
        List<AddAssets> assets = util.importExcel(file.getInputStream());
        String msg = addAssetsService.inputAssets(assets, updateSupport);
        return AjaxResult.success(msg);
    }

2.impl statement

The code is as follows (example):

    /**
     * 资源导入
     * @param addAssets  资源list
     * @param isUpdateSupport   是否允许修改原有对象(ture:可以修改 false:不可以修改)
     * @return
     */
    @Override
    public String inputAssets(List<AddAssets> addAssets, Boolean isUpdateSupport) {
        if (StringUtils.isNull(addAssets) || addAssets.size() == 0)
            throw new CustomException("导入用户数据不能为空");
        int successNum = 0;
        int failureNum = 0;
        StringBuilder successMsg = new StringBuilder();
        StringBuilder failureMsg = new StringBuilder();
        //不知道代码作用
        String password = configService.selectConfigByKey("sys.user.initPassword");
        for (AddAssets addAsset : addAssets) {
            try{
                //判定订单编码是否存在
                AddAssets asset = new AddAssets();
                asset.setAssetsCoding(addAsset.getAssetsCoding());
                List<AddAssets> addAssets1 = addAssetsMapper.selectAddAssetsList(asset);
                if (addAssets1.size() == 0 || addAssets1.size() > 1) {
                    successMsg.append("<br/>" + successNum + "、资产编号: " + addAsset.getAssetsCoding() + " 导入成功");
                    addAssetsMapper.insertAddAssets(addAsset);
                    successNum++;
                } else if (isUpdateSupport) {
                    successMsg.append("<br/>" + successNum + "、资产编号: " + addAsset.getAssetsCoding() + " 更新成功");
                    addAssetsMapper.updateAddAssetsCoding(addAsset);
                    successNum++;
                } else {
                    failureMsg.append("<br/>" + failureNum + "、资产编号 " + addAsset.getAssetsCoding() + " 已存在");
                    failureNum++;
                }
            }catch (Exception e)
            {
                failureNum++;
                String msg = "<br/>" + failureNum + "、账号 " +  addAsset.getAssetsCoding() + " 导入失败:";
                failureMsg.append(msg + e.getMessage());
                log.error(msg, e);
            }
        }
        if (failureNum > 0)
        {
            failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
            throw new CustomException(failureMsg.toString());
        }
        else
        {
            successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
        }
        return successMsg.toString();
    }

The data requested by the url network used here.

Example:

 

 

 

5. 2021-3-23 interface document (image upload) This interface is a general interface

Example:

URL:/system/pictures/inputImage (Note: file file) Request method: [Post]    

ARGUMENT: file: file, String: useType  

1. Enter the data

The code is as follows (example):

    @ApiOperation("查询资源入库列表")
    @Log(title = "图片上传", businessType = BusinessType.UPDATE)
    @PostMapping("/inputImage")
    public AjaxResult inputImages(@RequestParam("avatarfile") MultipartFile file)throws IOException {
        //文件相对路径
        String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file);
        SysPictures pictures = new SysPictures();
        pictures.setUrl(avatar);
        sysPicturesService.insertSysPictures(pictures);
        //可优化
        List<SysPictures> sysPictures = sysPicturesService.selectSysPicturesList(pictures);
        return AjaxResult.success(sysPictures.get(sysPictures.size()-1).getId());
    }

2.impl statement

The code is as follows (example):

//过于简单不做演示

The data requested by the url network used here.

Example:

6. 2021-3-29 interface document (operator) This interface is a general interface

Example:

URL:/system/user/locahostPhoneAndName Request method: [Get]     

1. Enter the data

The code is as follows (example):

    /**
     * 获取当前操作人名称
     */
    @ApiOperation("获取当前操作人姓名电话")
    @GetMapping("/locahostPhoneAndName")
    public AjaxResult locahostPhoneAndName(){
        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
        Map<String,String> map = new HashMap<>();
        map.put("name",loginUser.getUser().getUserName());
        map.put("phone",loginUser.getUser().getPhonenumber());
        map.put("id",loginUser.getUser().getUserId()+"");
        return AjaxResult.success(map);
    }

2.impl statement

The code is as follows (example):

The data requested by the url network used here.

Example:

 

 

7. 2021-3-29 interface document (resources in query state) This interface is a general interface

Example:

URL:/assets/assets/selectAssetsState Parameters: assetsState: idle 

       Request method: [Get]     

1. Enter the data

The code is as follows (example):

    /**
     * 查询某一个状态下的资源
     */
    @ApiOperation("查询某一个状态下的资源")
    @PreAuthorize("@ss.hasPermi('assets:assets:list')")
    @GetMapping("/selectAssetsState")
    public AjaxResult selectAssetsState(String assetsState){
        //验证资源领用是否关闭 并且获取到资源领用的value
        Map<String, String> map = VerifyUtil.verifySysFunction(assetsState, sysDictDataService);
        Set<String> strings = map.keySet();
        String key ="";
        String value = "";
        for (String mapString : strings) {
            value = map.get(mapString);
            key = mapString;
        }
        if (key.equals("错误信息"))
            return AjaxResult.error(HttpStatus.CLOSED_FUNCTION,map.get("错误信息"));
        return AjaxResult.success(addAssetsService.selectAssetsState(assetsState));
    };

2.sql statement

The code is as follows (example):

    <!-- 资产状态 -->
    <select id="selectAssetsState" parameterType="java.lang.String" resultMap="AddAssetsResult">
        <include refid="selectAddAssetsVoTableS"/>
        <where>
            <if test="assetsState != null  and assetsState != ''"> and a.assets_state = #{assetsState}</if>
        </where>
    </select>

The data requested by the url network used here.

Example:

 

8. 2021-3-29 interface documentation (newly added for resource acquisition)   

Example:

URL:/getassets/getassets Parameters: AddGetAssets object and long[] assetsId asset id array Request method: [Post]     

1. Enter the data

The code is as follows (example):

    /**
     * 新增资源领用
     */
    @ApiOperation("新增资源领用")
    @PreAuthorize("@ss.hasPermi('getassets:getassets:add')")
    @Log(title = "资源领用", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AddGetAssets addGetAssets,@RequestBody long[] assetsId)
    {
        String sysType = Verify();
        if(sysType.equals("0"))
            AjaxResult.error("数据字典可能停用,请启用数据字典!!!");
        if (assetsId.length>=0)
            return toAjax(addGetAssetsService.insertAddGetAssets(addGetAssets,assetsId,sysType));
        else
            return AjaxResult.error("请添加资产");
    }

2.impl statement

The code is as follows (example):


    /**
     * 新增资源领用
     *
     * @param addGetAssets 资源领用
     * @return 结果
     */
    @Override
    public int insertAddGetAssets(AddGetAssets addGetAssets,long[] assetsId,String sysType)
    {
        //所有资产id
        for (int i = 0; i < assetsId.length; i++) {
            AddAssetsRelevance relevance = new AddAssetsRelevance();
            relevance.setSysDisposeType(sysType);
            relevance.setAsstsId(assetsId[i]);
            relevance.setTaskId(addGetAssets.getGetId());
            addAssetsRelevanceMapper.insertAddAssetsRelevance(relevance);
            AddAssets assets = new AddAssets();
            assets.setAssetsId(assetsId[i]);
            assets.setAssetsState("1");
            addAssetsMapper.updateAddAssets(assets);
        }
            addGetAssets.setCreateTime(DateUtils.getNowDate());
            return addGetAssetsMapper.insertAddGetAssets(addGetAssets);
    }

The data requested by the url network used here.

Example:

 

 

Nine, 2021-3-29 interface document (when asset scheduling is added, find all idle resources under the company)   

Example:

URL:/assets/assets/companyResources Parameter: Long companyId owning company id Request method: [Get]     

1. Enter the data

The code is as follows (example):

    /**
     * 当前所在公司下所有的闲置资源
     */
    @ApiOperation("当前所在公司下所有的闲置资源")
    @PreAuthorize("@ss.hasPermi('assets:assets:list')")
    @GetMapping("/companyResources")
    public TableDataInfo companyResources(Long companyId)
    {
        Map<String, String> map = VerifyUtil.verifySysFunction("闲置", dictDataService);
        Set<String> strings = map.keySet();
        String key ="";
        String value = "";
        for (String mapString : strings) {
            value = map.get(mapString);
            key = mapString;
        }
        if (key.equals("错误信息"))
            return getCustomDataTable(new ArrayList<>(), HttpStatus.CLOSED_FUNCTION,map.get("错误信息"));

        SysDept sysDept = sysDeptService.selectDeptById(companyId);
        AddAssets addAssets = new AddAssets();
        addAssets.setCompanyId(companyId);
        addAssets.setAssetsState(value);
        startPage();
        List<AddAssets> list = addAssetsService.selectAddAssetsList(addAssets);
        return getDataTable(list);
    }

2.impl statement

The code is as follows (example):

暂时没有

The data requested by the url network used here.

Example:

 

X. 2021-3-29 interface document (all the resources in use under the current company)   

Example:

URL:/assets/assets/usecompanyResources Parameters: None Request method: [Get]     

1. Enter the data

The code is as follows (example):


    /**
     * 当前所在公司下所有的再用资源
     */
    @ApiOperation("当前所在公司下所有的闲置资源")
    @PreAuthorize("@ss.hasPermi('assets:assets:list')")
    @GetMapping("/usecompanyResources")
    public TableDataInfo usecompanyResources()
    {
        Map<String, String> map = VerifyUtil.verifySysFunction("在用", dictDataService);
        Set<String> strings = map.keySet();
        String key ="";
        String value = "";
        for (String mapString : strings) {
            value = map.get(mapString);
            key = mapString;
        }
        if (key.equals("错误信息"))
            return getCustomDataTable(new ArrayList<>(), HttpStatus.CLOSED_FUNCTION,map.get("错误信息"));
        AddAssets addAssets = new AddAssets();
        addAssets.setAssetsState(value);
        startPage();
        List<AddAssets> list = addAssetsService.selectAddAssetsList(addAssets);
        return getDataTable(list);
    }

2.impl statement

The code is as follows (example):

暂时没有

The data requested by the url network used here.

Example:

 

 



to sum up

Tip: Here is a summary of the article:
For example, the above is what we are going to talk about today. This article only briefly introduces the use of pandas, and pandas provides a large number of functions and methods that enable us to process data quickly and conveniently.

Guess you like

Origin blog.csdn.net/c_v_sCtrl/article/details/115008886