| | |
| | | package com.yuanchu.mom.controller; |
| | | |
| | | import cn.hutool.http.HttpUtil; |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.mom.annotation.ValueAuth; |
| | | import com.yuanchu.mom.common.PrintChina; |
| | | import com.yuanchu.mom.annotation.ValueClassify; |
| | | import com.yuanchu.mom.pojo.Custom; |
| | | import com.yuanchu.mom.dto.UserPageDto; |
| | | import com.yuanchu.mom.pojo.User; |
| | | import com.yuanchu.mom.service.CustomService; |
| | | import com.yuanchu.mom.service.PowerService; |
| | | import com.yuanchu.mom.service.UserService; |
| | | import com.yuanchu.mom.utils.JackSonUtil; |
| | | import com.yuanchu.mom.utils.Jwt; |
| | | import com.yuanchu.mom.utils.RedisUtil; |
| | | import com.yuanchu.mom.utils.ServletUtils; |
| | | import com.yuanchu.mom.vo.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.DigestUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.HashMap; |
| | |
| | | private PowerService powerService; |
| | | |
| | | private Jwt jwt; |
| | | |
| | | private CustomService customService; |
| | | |
| | | @ApiOperation(value = "登录") |
| | | @PostMapping("/enter") |
| | |
| | | map.put("token", jwtToken); |
| | | map.put("reToken", jwtReToken); |
| | | map.put("name", user.getName()); |
| | | map.put("userId", user.getId()); |
| | | map.put("power", powerService.selectPowerByRoleId(user.getRoleId())); |
| | | return Result.success("登录成功", map); |
| | | } |
| | |
| | | return Result.fail(map.get("info")); |
| | | } |
| | | |
| | | @ValueClassify("用户管理") |
| | | @ApiOperation(value = "获取用户列表") |
| | | @PostMapping("/selectUserList2") |
| | | public Result selectUserList2(@RequestBody Map<String, Object> data) throws Exception { |
| | | Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class); |
| | | UserPageDto user = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), UserPageDto.class); |
| | | return Result.success(userService.selectUserList(page, user)); |
| | | } |
| | | |
| | | @ValueAuth |
| | | @ApiOperation(value = "获取用户列表(用于其他页面获取用户数据)") |
| | | @PostMapping("/selectUserList") |
| | | public Result selectUserList(@RequestBody Map<String, Object> data) throws Exception { |
| | | Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class); |
| | |
| | | return Result.success(userService.selectUserList(page, user)); |
| | | } |
| | | |
| | | @ValueClassify("人员总览") |
| | | @ApiOperation(value = "查询人员总览") |
| | | @PostMapping("/selectPersonnelOverview") |
| | | public Result selectPersonnelOverview(@RequestBody Map<String, Object> data) throws Exception { |
| | | Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class); |
| | | UserPageDto user = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), UserPageDto.class); |
| | | return Result.success(userService.selectPersonnelOverview(page, user)); |
| | | } |
| | | |
| | | @ValueClassify("用户管理") |
| | | @ApiOperation(value = "修改用户信息") |
| | | @PostMapping("/updateUser") |
| | | public Result<?> updateUser(@RequestBody User user) { |
| | |
| | | else user.setPassword(DigestUtils.md5DigestAsHex(user.getPassword().getBytes())); |
| | | return Result.success(userService.updateUser(user)); |
| | | } |
| | | |
| | | @ValueClassify("用户管理") |
| | | @ApiOperation(value = "添加用户信息") |
| | | @PostMapping("/addUser") |
| | | public Result<?> addUser(@RequestBody User user) { |
| | |
| | | public Result<?> getUserMenu() { |
| | | return Result.success(userService.getUserMenu()); |
| | | } |
| | | |
| | | @ValueClassify("客户管理") |
| | | @ApiOperation(value = "获取客户列表") |
| | | @PostMapping("/selectCustomPageList") |
| | | public Result selectCustomPageList(@RequestBody Map<String, Object> data) throws Exception { |
| | | Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class); |
| | | Custom custom = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), Custom.class); |
| | | return Result.success(customService.selectCustomPageList(page, custom)); |
| | | } |
| | | @ValueClassify("客户管理") |
| | | @ApiOperation(value = "删除客户信息") |
| | | @PostMapping("/delCustomById") |
| | | public Result<?> delCustomById(Long id) { |
| | | return Result.success(customService.removeById(id)); |
| | | } |
| | | @ValueClassify("客户管理") |
| | | @ApiOperation(value = "新增客户信息") |
| | | @PostMapping("/addCustom") |
| | | public Result<?> addCustom(@RequestBody Custom custom) { |
| | | return Result.success(customService.addCustom(custom)); |
| | | } |
| | | |
| | | @ValueClassify("客户管理") |
| | | @ApiOperation(value = "修改客户信息") |
| | | @PostMapping("/upCustom") |
| | | public Result<?> upCustom(@RequestBody Custom custom) { |
| | | return Result.success(customService.upCustom(custom)); |
| | | } |
| | | |
| | | //获取设备负责人 |
| | | @ValueAuth |
| | | @ApiOperation(value = "获取设备负责人") |
| | | @GetMapping("/getDeviceManager") |
| | | public Result<?> getDeviceManager() { |
| | | return Result.success(userService.getDeviceManager()); |
| | | } |
| | | |
| | | @ValueAuth |
| | | @GetMapping("/getUserNow") |
| | | @ApiOperation(value = "获取当前登录的客户信息") |
| | | public Result<?> getUserNow(){ |
| | | return Result.success(userService.getUserNow()); |
| | | } |
| | | |
| | | @ValueAuth |
| | | @GetMapping("/getUserInfo") |
| | | @ApiOperation(value = "获取当前登录的用户信息") |
| | | public Result<?> getUserInfo(){ |
| | | return Result.success(userService.getUserInfo()); |
| | | } |
| | | |
| | | @PostMapping("/upUserPassword") |
| | | @ApiOperation(value = "修改用户密码") |
| | | @ValueAuth |
| | | public Result<?> upUserPassword(String oldPassword, String newPassWord){ |
| | | return Result.success(userService.upUserPassword(oldPassword, newPassWord)); |
| | | } |
| | | |
| | | @ValueClassify("人员明细") |
| | | @PostMapping("/upUserDepardLimsId") |
| | | @ApiOperation(value = "修改人员明细所在组织架构") |
| | | public Result<?> upUserDepardLimsId(String ids, String id){ |
| | | return Result.success(userService.upUserDepardLimsId(ids, id)); |
| | | } |
| | | |
| | | @ValueClassify("人员明细") |
| | | @PostMapping("/delUserDepardLimsId") |
| | | @ApiOperation(value = "删除人员明细所在组织架构") |
| | | public Result<?> delUserDepardLimsId(Integer id){ |
| | | return Result.success(userService.delUserDepardLimsId(id)); |
| | | } |
| | | |
| | | @ValueAuth |
| | | @GetMapping ("/selectCustomEnum") |
| | | @ApiOperation(value = "获取客户枚举") |
| | | public Result<?> selectCustomEnum(){ |
| | | return Result.success(customService.selectCustomEnum()); |
| | | } |
| | | |
| | | } |