APP领用管理
This commit is contained in:
parent
e26b886c72
commit
5eb16d96ed
|
|
@ -29,6 +29,13 @@ public class BusinessConstants {
|
|||
/** 手环箱设备类型*/
|
||||
public final static String SHX = "shx";
|
||||
|
||||
/** 管理员角色*/
|
||||
public final static String ADMINISTRATORS = "administrators";
|
||||
/** 班组角色*/
|
||||
public final static String TEAM = "team";
|
||||
/** 项目部角色*/
|
||||
public final static String DEPART = "depart";
|
||||
|
||||
public final static Integer CELL_1 = 1;
|
||||
public final static Integer CELL_2 = 2;
|
||||
public final static Integer CELL_3 = 3;
|
||||
|
|
|
|||
|
|
@ -42,17 +42,17 @@ public class BraceletParamsDto {
|
|||
/**
|
||||
* 角色编码
|
||||
*/
|
||||
private String roleCode;
|
||||
private String roleCode = SecurityUtils.getRoleCode();;
|
||||
|
||||
/**
|
||||
* 项目部ID
|
||||
*/
|
||||
private Long departId;
|
||||
private Long departId = SecurityUtils.getDepartId();
|
||||
|
||||
/**
|
||||
* 班组ID
|
||||
*/
|
||||
private Long teamId;
|
||||
private Long teamId = SecurityUtils.getTeamId();
|
||||
|
||||
/**
|
||||
* 资源类型
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ public class EquipmentReqVo {
|
|||
* 工程名称
|
||||
*/
|
||||
private String proName;
|
||||
|
||||
/**
|
||||
* 项目部名称
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.bonus.common.security.utils;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.bonus.common.core.constant.BusinessConstants;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import com.bonus.common.core.constant.SecurityConstants;
|
||||
import com.bonus.common.core.constant.TokenConstants;
|
||||
|
|
@ -146,4 +148,18 @@ public class SecurityUtils
|
|||
public static String getRoleCode(){
|
||||
return SecurityUtils.getLoginUser() != null && SecurityUtils.getLoginUser().getSysUser() != null ? SecurityUtils.getLoginUser().getSysUser().getRoleCode() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是项目部角色/管理员角色
|
||||
* @return boolean
|
||||
* @author cwchen
|
||||
* @date 2024/8/7 10:47
|
||||
*/
|
||||
public static boolean isDepartRoleCode(){
|
||||
String roleCode = getRoleCode();
|
||||
if(Objects.equals(roleCode, BusinessConstants.DEPART) || Objects.equals(roleCode, BusinessConstants.ADMINISTRATORS)){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class AppEquipmentReqController extends BaseController {
|
|||
@Resource(name = "IAppEquipmentReqService")
|
||||
private IAppEquipmentReqService service;
|
||||
|
||||
// @RequiresPermissions("basic:equipmentReq:list")
|
||||
// @RequiresPermissions("app:equipmentReq:list")
|
||||
@GetMapping("list")
|
||||
@SysLog(title = "施工管控", businessType = OperaType.QUERY,logType = 0,module = "施工管控->设备领用",details ="查询设备领用列表")
|
||||
public TableDataInfo list(AppParamsDto dto) {
|
||||
|
|
@ -41,7 +41,7 @@ public class AppEquipmentReqController extends BaseController {
|
|||
return getDataTable(list);
|
||||
}
|
||||
|
||||
// @RequiresPermissions("basic:equipmentReq:addData")
|
||||
// @RequiresPermissions("app:equipmentReq:addData")
|
||||
@PostMapping("addData")
|
||||
@SysLog(title = "施工管控", businessType = OperaType.INSERT,logType = 0,module = "施工管控->设备领用",details ="设备领用")
|
||||
public AjaxResult addData(@Validated @RequestBody EquipmentReqDataVo vo) {
|
||||
|
|
@ -60,7 +60,7 @@ public class AppEquipmentReqController extends BaseController {
|
|||
return service.getUseDevices(dto);
|
||||
}
|
||||
|
||||
// @RequiresPermissions("basic:equipmentReq:returnDevice")
|
||||
// @RequiresPermissions("app:equipmentReq:returnDevice")
|
||||
@PostMapping("returnDevice")
|
||||
@SysLog(title = "施工管控", businessType = OperaType.INSERT,logType = 0,module = "施工管控->设备领用",details ="归还设备")
|
||||
public AjaxResult returnDevice(@RequestBody BraceletParamsDto dto) {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import com.bonus.common.entity.app.AppParamsDto;
|
|||
import com.bonus.common.entity.bracelet.BraceletParamsDto;
|
||||
import com.bonus.common.entity.bracelet.vo.EquipmentReqDataVo;
|
||||
import com.bonus.common.entity.bracelet.vo.EquipmentReqVo;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
|
@ -51,6 +52,10 @@ public class AppEquipmentReqServiceImpl implements IAppEquipmentReqService {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult addData(EquipmentReqDataVo vo) {
|
||||
try {
|
||||
boolean isDepartRoleCode = SecurityUtils.isDepartRoleCode();
|
||||
if(!isDepartRoleCode){
|
||||
return AjaxResult.error("非项目部角色,无领用设备权限");
|
||||
}
|
||||
if (CollectionUtils.isEmpty(vo.getList())) {
|
||||
return AjaxResult.error("领用设备不能为空");
|
||||
}
|
||||
|
|
@ -100,6 +105,10 @@ public class AppEquipmentReqServiceImpl implements IAppEquipmentReqService {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult returnDevice(BraceletParamsDto dto) {
|
||||
try {
|
||||
boolean isDepartRoleCode = SecurityUtils.isDepartRoleCode();
|
||||
if(!isDepartRoleCode){
|
||||
return AjaxResult.error("非项目部角色,无归还设备权限");
|
||||
}
|
||||
if(Objects.equals(dto.getDevType(), BusinessConstants.SHX)){
|
||||
// 设备类型为手环箱时,判断手环设备是否全部归还
|
||||
int result = mapper.isAllDeviceReturn(dto,1);
|
||||
|
|
|
|||
|
|
@ -78,11 +78,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
twt.team_leader AS teamLeader,
|
||||
twt.leader_phone AS leaderPhone,
|
||||
tpp.power_name AS powerName,
|
||||
tp.pro_name AS proName
|
||||
tp.pro_name AS proName,
|
||||
tpd.depart_name AS departName
|
||||
FROM tb_dev_use tdu
|
||||
LEFT JOIN t_work_team twt ON tdu.team_id = twt.team_id AND twt.del_flag = 0
|
||||
LEFT JOIN tb_project_power tpp ON tpp.id = tdu.gt_id AND tpp.del_flag = 0
|
||||
LEFT JOIN tb_project tp ON tp.id = tdu.pro_id AND tp.del_flag = 0
|
||||
LEFT JOIN tb_project_depart tpd ON tpd.id = tp.depart_id AND tpd.del_flag = 0
|
||||
LEFT JOIN tb_dev_use_bid tdub ON tdu.id = tdub.id
|
||||
LEFT JOIN tb_device td ON tdub.dev_id = td.id AND td.del_flag = 0
|
||||
LEFT JOIN sys_dict_data sdd ON td.dev_type = sdd.dict_value AND sdd.dict_type = 'sys_device_type'
|
||||
|
|
@ -104,11 +106,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
twt.team_leader AS teamLeader,
|
||||
twt.leader_phone AS leaderPhone,
|
||||
tpp.power_name AS powerName,
|
||||
tp.pro_name AS proName
|
||||
tp.pro_name AS proName,
|
||||
tpd.depart_name AS departName
|
||||
FROM tb_dev_use tdu
|
||||
LEFT JOIN t_work_team twt ON tdu.team_id = twt.team_id AND twt.del_flag = 0
|
||||
LEFT JOIN tb_project_power tpp ON tpp.id = tdu.gt_id AND tpp.del_flag = 0
|
||||
LEFT JOIN tb_project tp ON tp.id = tdu.pro_id AND tp.del_flag = 0
|
||||
LEFT JOIN tb_project_depart tpd ON tpd.id = tp.depart_id AND tpd.del_flag = 0
|
||||
LEFT JOIN tb_dev_use_bid tdub ON tdu.id = tdub.id
|
||||
LEFT JOIN sys_dict_data sdd ON tdub.dev_type = sdd.dict_value AND sdd.dict_type = 'sys_device_type'
|
||||
LEFT JOIN tb_sh_box tsb ON tdub.dev_id = tsb.id AND tsb.del_flag = 0
|
||||
|
|
@ -139,6 +143,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="ghTime!=null and ghTime!=''">
|
||||
AND DATE_FORMAT(a.ghTime,'%y%m%d') BETWEEN #{ghTime} AND #{ghTime}
|
||||
</if>
|
||||
<if test="roleCode!='administrators' and roleCode!='depart'">
|
||||
AND a.departId = -1
|
||||
</if>
|
||||
<if test="roleCode=='depart'">
|
||||
AND a.departId = #{departId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.bonus.common.core.web.domain.AjaxResult;
|
|||
import com.bonus.common.entity.bracelet.BraceletParamsDto;
|
||||
import com.bonus.common.entity.bracelet.vo.EquipmentReqDataVo;
|
||||
import com.bonus.common.entity.bracelet.vo.EquipmentReqVo;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
|
@ -50,6 +51,10 @@ public class EquipmentReqServiceImpl implements IEquipmentReqService {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult addData(EquipmentReqDataVo vo) {
|
||||
try {
|
||||
boolean isDepartRoleCode = SecurityUtils.isDepartRoleCode();
|
||||
if(!isDepartRoleCode){
|
||||
return AjaxResult.error("非项目部角色,无领用设备权限");
|
||||
}
|
||||
if (CollectionUtils.isEmpty(vo.getList())) {
|
||||
return AjaxResult.error("领用设备不能为空");
|
||||
}
|
||||
|
|
@ -99,6 +104,10 @@ public class EquipmentReqServiceImpl implements IEquipmentReqService {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult returnDevice(BraceletParamsDto dto) {
|
||||
try {
|
||||
boolean isDepartRoleCode = SecurityUtils.isDepartRoleCode();
|
||||
if(!isDepartRoleCode){
|
||||
return AjaxResult.error("非项目部角色,无归还设备权限");
|
||||
}
|
||||
if(Objects.equals(dto.getDevType(), BusinessConstants.SHX)){
|
||||
// 设备类型为手环箱时,判断手环设备是否全部归还
|
||||
int result = mapper.isAllDeviceReturn(dto,1);
|
||||
|
|
|
|||
|
|
@ -79,11 +79,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
twt.team_leader AS teamLeader,
|
||||
twt.leader_phone AS leaderPhone,
|
||||
tpp.power_name AS powerName,
|
||||
tp.pro_name AS proName
|
||||
tp.pro_name AS proName,
|
||||
tpd.depart_name AS departName,
|
||||
tp.depart_id AS departId
|
||||
FROM tb_dev_use tdu
|
||||
LEFT JOIN t_work_team twt ON tdu.team_id = twt.team_id AND twt.del_flag = 0
|
||||
LEFT JOIN tb_project_power tpp ON tpp.id = tdu.gt_id AND tpp.del_flag = 0
|
||||
LEFT JOIN tb_project tp ON tp.id = tdu.pro_id AND tp.del_flag = 0
|
||||
LEFT JOIN tb_project_depart tpd ON tpd.id = tp.depart_id AND tpd.del_flag = 0
|
||||
LEFT JOIN tb_dev_use_bid tdub ON tdu.id = tdub.id
|
||||
LEFT JOIN tb_device td ON tdub.dev_id = td.id AND td.del_flag = 0
|
||||
LEFT JOIN sys_dict_data sdd ON td.dev_type = sdd.dict_value AND sdd.dict_type = 'sys_device_type'
|
||||
|
|
@ -100,17 +103,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
tsb.box_name AS devName,
|
||||
tdub.ly_time AS lyTime,
|
||||
tdub.gh_time AS ghTime,
|
||||
'手环箱' AS deviceTypeName,
|
||||
sdd.dict_label AS deviceTypeName,
|
||||
twt.team_name AS teamName,
|
||||
twt.team_leader AS teamLeader,
|
||||
twt.leader_phone AS leaderPhone,
|
||||
tpp.power_name AS powerName,
|
||||
tp.pro_name AS proName
|
||||
tp.pro_name AS proName,
|
||||
tpd.depart_name AS departName,
|
||||
tp.depart_id AS departId
|
||||
FROM tb_dev_use tdu
|
||||
LEFT JOIN t_work_team twt ON tdu.team_id = twt.team_id AND twt.del_flag = 0
|
||||
LEFT JOIN tb_project_power tpp ON tpp.id = tdu.gt_id AND tpp.del_flag = 0
|
||||
LEFT JOIN tb_project tp ON tp.id = tdu.pro_id AND tp.del_flag = 0
|
||||
LEFT JOIN tb_project_depart tpd ON tpd.id = tp.depart_id AND tpd.del_flag = 0
|
||||
LEFT JOIN tb_dev_use_bid tdub ON tdu.id = tdub.id
|
||||
LEFT JOIN sys_dict_data sdd ON tdub.dev_type = sdd.dict_value AND sdd.dict_type = 'sys_device_type'
|
||||
LEFT JOIN tb_sh_box tsb ON tdub.dev_id = tsb.id AND tsb.del_flag = 0
|
||||
WHERE tdu.del_flag = 0 AND tdub.dev_type = 'shx'
|
||||
<if test="devType!=null and devType!='' and devType != 'shx'">
|
||||
|
|
@ -139,6 +146,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="ghTime!=null and ghTime!=''">
|
||||
AND DATE_FORMAT(a.ghTime,'%y%m%d') BETWEEN #{ghTime} AND #{ghTime}
|
||||
</if>
|
||||
<if test="roleCode!='administrators' and roleCode!='depart'">
|
||||
AND a.departId = -1
|
||||
</if>
|
||||
<if test="roleCode=='depart'">
|
||||
AND a.departId = #{departId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<!--判断设备是否已经归还-->
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.system.domain;
|
||||
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
|
|
@ -19,15 +20,15 @@ public class SysParamsDto {
|
|||
/**
|
||||
* 角色编码
|
||||
*/
|
||||
private String roleCode;
|
||||
private String roleCode = SecurityUtils.getRoleCode();
|
||||
|
||||
/**
|
||||
* 项目部ID
|
||||
*/
|
||||
private Long departId;
|
||||
private Long departId = SecurityUtils.getDepartId();
|
||||
|
||||
/**
|
||||
* 班组ID
|
||||
*/
|
||||
private Long teamId;
|
||||
private Long teamId = SecurityUtils.getTeamId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
FROM t_work_team twt
|
||||
LEFT JOIN tb_project tp on twt.pro_id = tp.id AND tp.del_flag = 0
|
||||
WHERE twt.del_flag = 0
|
||||
<if test="roleCode!='administrators' and roleCode!='depart'">
|
||||
AND tp.depart_id = -1
|
||||
</if>
|
||||
<if test="roleCode=='depart'">
|
||||
AND tp.depart_id = #{departId}
|
||||
</if>
|
||||
</select>
|
||||
<!--根据工程获取杆塔下拉选-->
|
||||
<select id="getPowerLists" resultType="com.bonus.system.domain.vo.SysSelectVo">
|
||||
|
|
|
|||
Loading…
Reference in New Issue