APP领用管理
This commit is contained in:
parent
722dcbfa45
commit
2901dea04c
|
|
@ -28,6 +28,8 @@ public class BusinessConstants {
|
|||
|
||||
/** 手环箱设备类型*/
|
||||
public final static String SHX = "shx";
|
||||
/** 安全帽设备类型*/
|
||||
public final static String AQM = "aqm";
|
||||
|
||||
/** 管理员角色*/
|
||||
public final static String ADMINISTRATORS = "administrators";
|
||||
|
|
|
|||
|
|
@ -82,4 +82,9 @@ public class EquipmentReqDataVo {
|
|||
* 领用人类型 0正常 1临时人员
|
||||
*/
|
||||
private Integer userType = 0;
|
||||
|
||||
/**
|
||||
* 班组长ID
|
||||
* */
|
||||
private Long teamLeaderId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,4 +106,13 @@ public interface AppEquipmentReqMapper {
|
|||
* @date 2024/8/6 11:10
|
||||
*/
|
||||
int isAllDeviceReturn(@Param("params") BraceletParamsDto dto,@Param("type") int type);
|
||||
|
||||
/**
|
||||
* 获取绑定班组的班组长
|
||||
* @param vo
|
||||
* @return Long
|
||||
* @author cwchen
|
||||
* @date 2024/8/7 14:53
|
||||
*/
|
||||
Long getTeamLeader(EquipmentReqDataVo vo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,10 +74,16 @@ public class AppEquipmentReqServiceImpl implements IAppEquipmentReqService {
|
|||
// 添加设备领用数据、设备领用详情数据
|
||||
mapper.addDevUseData(vo);
|
||||
mapper.addDevUseDetailData(vo);
|
||||
// 获取绑定班组的班组长
|
||||
Long teamLeaderId = mapper.getTeamLeader(vo);
|
||||
vo.setTeamLeaderId(teamLeaderId);
|
||||
for (EquipmentReqDataVo.Equipment equipment : vo.getList()) {
|
||||
if(Objects.equals(equipment.getDevType(), BusinessConstants.SHX)){
|
||||
// 绑定手环箱
|
||||
mapper.updateDeviceData(vo,equipment,1);
|
||||
}else if(!Objects.equals(equipment.getDevType(), BusinessConstants.SHX) && !Objects.equals(equipment.getDevType(), BusinessConstants.AQM)){
|
||||
// 绑定除安全帽和手环箱以外的设备(绑定人为班组长)
|
||||
mapper.updateDeviceData(vo,equipment,2);
|
||||
}
|
||||
}
|
||||
return AjaxResult.success();
|
||||
|
|
@ -117,12 +123,15 @@ public class AppEquipmentReqServiceImpl implements IAppEquipmentReqService {
|
|||
}
|
||||
// 解绑手环箱
|
||||
mapper.updateReturnDeviceData(dto,1);
|
||||
}else{
|
||||
// 设备类型为其他设备时,判断是否全部归还
|
||||
}else if(Objects.equals(dto.getDevType(), BusinessConstants.AQM)){
|
||||
// 设备类型为安全帽时,判断是否全部归还
|
||||
int result = mapper.isAllDeviceReturn(dto,2);
|
||||
if(result > 0){
|
||||
return AjaxResult.error("班组人员未归还设");
|
||||
return AjaxResult.error("班组人员未归还安全帽设备");
|
||||
}
|
||||
}else{
|
||||
// 解绑除手环箱、安全帽以外的设备
|
||||
mapper.updateReturnDeviceData(dto,2);
|
||||
}
|
||||
mapper.returnDevice(dto);
|
||||
return AjaxResult.success();
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
UPDATE tb_sh_box SET team_id = #{vo.teamId},pro_id = #{vo.proId},gt_id = #{vo.powerId} WHERE id = #{equipment.devId}
|
||||
</if>
|
||||
<if test="type == 2">
|
||||
UPDATE tb_dev_ly SET pro_id = #{vo.proId},team_id = #{vo.teamId},ly_user = #{vo.createUser},ly_status = 0,ly_time = #{vo.lyTime},user_type = #{vo.userType},gt_id = #{vo.powerId} WHERE dev_id = #{equipment.devId}
|
||||
UPDATE tb_dev_ly SET pro_id = #{vo.proId},team_id = #{vo.teamId},ly_user = #{vo.teamLeaderId},ly_status = 0,ly_time = #{vo.lyTime},user_type = #{vo.userType},gt_id = #{vo.powerId} WHERE dev_id = #{equipment.devId}
|
||||
</if>
|
||||
</update>
|
||||
<!--更新1.手环箱/2.其他设备状态-->
|
||||
|
|
@ -180,4 +180,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN tb_sh_use tsu ON tdub.id = tsu.use_id AND tsu.bid_type = #{type}
|
||||
WHERE tdub.id = #{params.id} AND tdub.dev_id = #{params.devId} AND tdub.dev_type = #{params.devType} AND tdub.dev_code = #{params.devCode} AND tsu.time_type = 1
|
||||
</select>
|
||||
<!--获取绑定班组的班组长-->
|
||||
<select id="getTeamLeader" resultType="java.lang.Long">
|
||||
SELECT twt.team_leader_id
|
||||
FROM t_work_team twt
|
||||
WHERE twt.team_id = #{teamId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -50,7 +50,7 @@ public interface EquipmentReqMapper {
|
|||
void addDevUseDetailData(EquipmentReqDataVo vo);
|
||||
|
||||
/**
|
||||
* 更新手环箱状态
|
||||
* 更新手环箱/设备状态
|
||||
*
|
||||
* @param vo
|
||||
* @param equipment
|
||||
|
|
@ -107,4 +107,12 @@ public interface EquipmentReqMapper {
|
|||
*/
|
||||
int isAllDeviceReturn(@Param("params") BraceletParamsDto dto,@Param("type") int type);
|
||||
|
||||
/**
|
||||
* 获取绑定班组的班组长
|
||||
* @param vo
|
||||
* @return Long
|
||||
* @author cwchen
|
||||
* @date 2024/8/7 14:53
|
||||
*/
|
||||
Long getTeamLeader(EquipmentReqDataVo vo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,10 +73,16 @@ public class EquipmentReqServiceImpl implements IEquipmentReqService {
|
|||
// 添加设备领用数据、设备领用详情数据
|
||||
mapper.addDevUseData(vo);
|
||||
mapper.addDevUseDetailData(vo);
|
||||
// 获取绑定班组的班组长
|
||||
Long teamLeaderId = mapper.getTeamLeader(vo);
|
||||
vo.setTeamLeaderId(teamLeaderId);
|
||||
for (EquipmentReqDataVo.Equipment equipment : vo.getList()) {
|
||||
if(Objects.equals(equipment.getDevType(), BusinessConstants.SHX)){
|
||||
// 绑定手环箱
|
||||
mapper.updateDeviceData(vo,equipment,1);
|
||||
}else if(!Objects.equals(equipment.getDevType(), BusinessConstants.SHX) && !Objects.equals(equipment.getDevType(), BusinessConstants.AQM)){
|
||||
// 绑定除安全帽和手环箱以外的设备(绑定人为班组长)
|
||||
mapper.updateDeviceData(vo,equipment,2);
|
||||
}
|
||||
}
|
||||
return AjaxResult.success();
|
||||
|
|
@ -116,12 +122,15 @@ public class EquipmentReqServiceImpl implements IEquipmentReqService {
|
|||
}
|
||||
// 解绑手环箱
|
||||
mapper.updateReturnDeviceData(dto,1);
|
||||
}else{
|
||||
// 设备类型为其他设备时,判断是否全部归还
|
||||
}else if(Objects.equals(dto.getDevType(), BusinessConstants.AQM)){
|
||||
// 设备类型为安全帽时,判断是否全部归还
|
||||
int result = mapper.isAllDeviceReturn(dto,2);
|
||||
if(result > 0){
|
||||
return AjaxResult.error("班组人员未归还设");
|
||||
return AjaxResult.error("班组人员未归还安全帽设备");
|
||||
}
|
||||
}else{
|
||||
// 解绑除手环箱、安全帽以外的设备
|
||||
mapper.updateReturnDeviceData(dto,2);
|
||||
}
|
||||
mapper.returnDevice(dto);
|
||||
return AjaxResult.success();
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
UPDATE tb_sh_box SET team_id = #{vo.teamId},pro_id = #{vo.proId},gt_id = #{vo.powerId} WHERE id = #{equipment.devId}
|
||||
</if>
|
||||
<if test="type == 2">
|
||||
UPDATE tb_dev_ly SET pro_id = #{vo.proId},team_id = #{vo.teamId},ly_user = #{vo.createUser},ly_status = 0,ly_time = #{vo.lyTime},user_type = #{vo.userType},gt_id = #{vo.powerId} WHERE dev_id = #{equipment.devId}
|
||||
UPDATE tb_dev_ly SET pro_id = #{vo.proId},team_id = #{vo.teamId},ly_user = #{vo.teamLeaderId},ly_status = 0,ly_time = #{vo.lyTime},user_type = #{vo.userType},gt_id = #{vo.powerId} WHERE dev_id = #{equipment.devId}
|
||||
</if>
|
||||
</update>
|
||||
<!--更新1.手环箱/2.其他设备状态-->
|
||||
|
|
@ -180,4 +180,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN tb_sh_use tsu ON tdub.id = tsu.use_id AND tsu.bid_type = #{type}
|
||||
WHERE tdub.id = #{params.id} AND tdub.dev_id = #{params.devId} AND tdub.dev_type = #{params.devType} AND tdub.dev_code = #{params.devCode} AND tsu.time_type = 1
|
||||
</select>
|
||||
<!--获取绑定班组的班组长-->
|
||||
<select id="getTeamLeader" resultType="java.lang.Long">
|
||||
SELECT twt.team_leader_id
|
||||
FROM t_work_team twt
|
||||
WHERE twt.team_id = #{teamId}
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue