121 lines
3.5 KiB
Java
121 lines
3.5 KiB
Java
|
package com.yanzhu.wechat.controller;
|
||
|
|
||
|
import com.yanzhu.base.domain.BaseAssetsType;
|
||
|
import com.yanzhu.base.service.IBaseAssetsTypeService;
|
||
|
import com.yanzhu.common.constant.Constants;
|
||
|
import com.yanzhu.common.core.controller.BaseController;
|
||
|
import com.yanzhu.common.core.domain.AjaxResult;
|
||
|
import com.yanzhu.common.core.domain.entity.SysDept;
|
||
|
import com.yanzhu.common.core.domain.entity.SysRole;
|
||
|
import com.yanzhu.common.core.domain.entity.SysUser;
|
||
|
import com.yanzhu.common.core.page.TableDataInfo;
|
||
|
import com.yanzhu.common.core.redis.RedisCache;
|
||
|
import com.yanzhu.common.utils.DictUtils;
|
||
|
import com.yanzhu.common.utils.StringUtils;
|
||
|
import com.yanzhu.project.service.IProProjectApplyService;
|
||
|
import com.yanzhu.system.service.ISysDeptService;
|
||
|
import com.yanzhu.system.service.ISysPostService;
|
||
|
import com.yanzhu.system.service.ISysRoleService;
|
||
|
import com.yanzhu.system.service.ISysUserService;
|
||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||
|
import org.springframework.web.bind.annotation.RestController;
|
||
|
|
||
|
import java.util.List;
|
||
|
import java.util.concurrent.TimeUnit;
|
||
|
import java.util.stream.Collectors;
|
||
|
|
||
|
/**
|
||
|
* 项目申请Controller
|
||
|
*
|
||
|
* @author yanZhu
|
||
|
* @date 2024-02-23
|
||
|
*/
|
||
|
@RestController
|
||
|
@RequestMapping("/wxApi/publics")
|
||
|
public class WxPublicsController extends BaseController
|
||
|
{
|
||
|
|
||
|
@Autowired
|
||
|
private RedisCache redisCache;
|
||
|
|
||
|
@Autowired
|
||
|
private ISysUserService userService;
|
||
|
|
||
|
@Autowired
|
||
|
private ISysDeptService deptService;
|
||
|
|
||
|
@Autowired
|
||
|
private IBaseAssetsTypeService baseAssetsTypeService;
|
||
|
|
||
|
@Autowired
|
||
|
private IProProjectApplyService proProjectApplyService;
|
||
|
|
||
|
/**
|
||
|
* 获取项目申请详细信息
|
||
|
*/
|
||
|
@GetMapping(value = "/projectApply/{id}")
|
||
|
public AjaxResult projectApplyInfo(@PathVariable("id") Long id)
|
||
|
{
|
||
|
return success(proProjectApplyService.selectProProjectApplyById(id));
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 查询物资类型
|
||
|
*/
|
||
|
@GetMapping("/findAllByCategory/{category}")
|
||
|
public AjaxResult findAllByCategory(@PathVariable String category)
|
||
|
{
|
||
|
SysUser sysUser = super.getLoginUser().getUser();
|
||
|
String key = "YANZHU.BASE.ASSETSTYPE.findAllByCategory." + sysUser.getParDeptId() + "." + category;
|
||
|
Object object = redisCache.getCacheObject(key);
|
||
|
if (object != null) {
|
||
|
return success(object);
|
||
|
}
|
||
|
List<BaseAssetsType> list = baseAssetsTypeService.findAllByCategory(category);
|
||
|
redisCache.setCacheObject(key, list, Constants.BASE_DATA_EXPIRATION, TimeUnit.MINUTES);
|
||
|
return success(list);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 获取用户列表
|
||
|
*/
|
||
|
@GetMapping("/user/list")
|
||
|
public TableDataInfo userList(SysUser user)
|
||
|
{
|
||
|
startPage();
|
||
|
List<SysUser> list = userService.selectUserList(user);
|
||
|
return getDataTable(list);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 根据用户编号获取详细信息
|
||
|
*/
|
||
|
@GetMapping(value = "/user/info")
|
||
|
public AjaxResult userInfo()
|
||
|
{
|
||
|
return success(super.getLoginUser().getUser());
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 获取部门树列表
|
||
|
*/
|
||
|
@GetMapping("/dept/deptTree")
|
||
|
public AjaxResult deptTree(SysDept dept)
|
||
|
{
|
||
|
return success(deptService.selectDeptTreeList(dept));
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 查询演训类型
|
||
|
* @return
|
||
|
*/
|
||
|
@GetMapping(value = "/dict/{key}")
|
||
|
public AjaxResult dictValues(@PathVariable("key") String key){
|
||
|
return success(DictUtils.getDictCache(key));
|
||
|
}
|
||
|
|
||
|
}
|