AdministerController.java 3.64 KB
package com.subsidy.controller;


import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.dto.administer.AddAdministerDTO;
import com.subsidy.dto.company.OperatorsDTO;
import com.subsidy.model.AdministerDO;
import com.subsidy.service.AdministerService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;

/**
 * <p>
 * 管理平台用户 前端控制器
 * </p>
 *
 * @author Tuyp
 * @since 2024-01-11
 */
@RestController
@Api(tags = "管理平台用户")
@RequestMapping("/administer")
public class AdministerController {

    @Autowired
    private AdministerService administerService;

    @PostMapping("centerLogin")
    @ApiOperation("中心端登录入口 accountName password ")
    public ResponseVO centerLogin(@RequestBody AdministerDO administerDO){
        return ResponseData.generateCreatedResponse(0,administerService.centerLogin(administerDO));
    }

    @PostMapping("/getPermissions")
    @ApiOperation("权限查询")
    @LoginRequired
    public ResponseVO getPermissions() {
        return ResponseData.generateCreatedResponse(0, administerService.getPermissions());
    }

    @PostMapping("/administers")
    @ApiOperation("客户账户管理 查中心账户  { userName  companyName pageNum  pageSize }")
//    @LoginRequired
    public ResponseVO operators(@RequestBody OperatorsDTO operatorsDTO) {
        return ResponseData.generateCreatedResponse(0, administerService.operators(operatorsDTO));
    }

    @PostMapping("/appOperators")
    @ApiOperation("应用账户管理 查中心账户  { userName  companyName pageNum  pageSize }")
//    @LoginRequired
    public ResponseVO appOperators(@RequestBody OperatorsDTO operatorsDTO) {
        return ResponseData.generateCreatedResponse(0, administerService.appOperators(operatorsDTO));
    }

    @PostMapping("/clientOperators")
    @ApiOperation("客户账户管理 查中心账户  { userName  companyName pageNum  pageSize }")
//    @LoginRequired
    public ResponseVO clientOperators(@RequestBody OperatorsDTO operatorsDTO) {
        return ResponseData.generateCreatedResponse(0, administerService.clientOperators(operatorsDTO));
    }

    @PostMapping("addAdminister")
    @ApiOperation("添加客户账户   userName 名称 accountName 账户  password 密码 telephone 联系方式  role:0:应用  1:客户  2:中心 3:企业唯一账号  remark 备注 companyIds[]  serviceIds[]")
    @LoginRequired
    public ResponseVO addAdminister(@RequestBody AddAdministerDTO addAdministerDTO) {
        return ResponseData.generateCreatedResponse(0, administerService.addAdminister(addAdministerDTO));
    }

    @PostMapping("deleteAdminister")
    @ApiOperation("客户账户管理 删除  id ")
    @LoginRequired
    public ResponseVO deleteAdminister(@RequestBody AdministerDO administerDO) {
        return ResponseData.generateCreatedResponse(0, administerService.deleteAdminister(administerDO));
    }

    @PostMapping("updateAdminister")
    @ApiOperation("编辑客户账户 id userName 名称  accountName 账号 password  remark  telephone  companyIds[]  serviceIds[]")
    @LoginRequired
    public ResponseVO updateAdminister(@RequestBody AddAdministerDTO addAdministerDTO) {
        return ResponseData.generateCreatedResponse(0, administerService.updateAdminister(addAdministerDTO));
    }

}