APP领用管理
This commit is contained in:
parent
5a0084306a
commit
2c70beb504
|
|
@ -1,7 +1,11 @@
|
|||
package com.bonus.common.entity.app;
|
||||
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @className:AppParamsDto
|
||||
* @author:cwchen
|
||||
|
|
@ -11,6 +15,110 @@ import lombok.Data;
|
|||
*/
|
||||
@Data
|
||||
public class AppParamsDto {
|
||||
/** id */
|
||||
private String id;
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 班组名称
|
||||
*/
|
||||
private String teamName;
|
||||
/**
|
||||
* 班组长
|
||||
*/
|
||||
private String teamLeader;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
private Integer sex;
|
||||
|
||||
/**
|
||||
* 角色编码
|
||||
*/
|
||||
private String roleCode = SecurityUtils.getRoleCode();
|
||||
|
||||
/**
|
||||
* 项目部ID
|
||||
*/
|
||||
private Long departId = SecurityUtils.getDepartId();
|
||||
|
||||
/**
|
||||
* 班组ID
|
||||
*/
|
||||
private Long teamId = SecurityUtils.getTeamId();
|
||||
|
||||
/**
|
||||
* 资源类型
|
||||
*/
|
||||
private String sourceType;
|
||||
|
||||
/**
|
||||
* 资源文件ID
|
||||
*/
|
||||
private Long fileId;
|
||||
|
||||
/**
|
||||
* 文件ID
|
||||
*/
|
||||
private String filePath;
|
||||
|
||||
/**
|
||||
* 解散时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date jsTime = new Date();
|
||||
|
||||
/**
|
||||
* 班组状态
|
||||
*/
|
||||
private Integer teamStatus;
|
||||
|
||||
/**
|
||||
* 1.全部人员 2.未分配人员 3.已分配人员
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
private Long updateUser = SecurityUtils.getUserId();
|
||||
|
||||
/**
|
||||
* 设备ID
|
||||
*/
|
||||
private Long devId;
|
||||
/**
|
||||
* 工程名称
|
||||
*/
|
||||
private String proName;
|
||||
/**
|
||||
* 杆塔编号
|
||||
*/
|
||||
private String powerName;
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
private String devType;
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
private String devName;
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
private String devCode;
|
||||
/**
|
||||
* 领用时间
|
||||
*/
|
||||
private String lyTime;
|
||||
/**
|
||||
* 归还时间
|
||||
*/
|
||||
private String ghTime;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date backTime = new Date();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ import com.bonus.common.core.utils.ServletUtils;
|
|||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.system.api.model.LoginUser;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 权限获取工具类
|
||||
*
|
||||
|
|
@ -114,4 +116,34 @@ public class SecurityUtils
|
|||
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
||||
return passwordEncoder.matches(rawPassword, encodedPassword);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取项目部ID
|
||||
* @return Long
|
||||
* @author cwchen
|
||||
* @date 2024/8/6 16:08
|
||||
*/
|
||||
public static Long getDepartId(){
|
||||
return SecurityUtils.getLoginUser() != null && SecurityUtils.getLoginUser().getSysUser() != null ? SecurityUtils.getLoginUser().getSysUser().getDeptId() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取班组ID
|
||||
* @return Long
|
||||
* @author cwchen
|
||||
* @date 2024/8/6 16:08
|
||||
*/
|
||||
public static Long getTeamId(){
|
||||
return SecurityUtils.getLoginUser() != null && SecurityUtils.getLoginUser().getSysUser() != null ? SecurityUtils.getLoginUser().getSysUser().getTeamId() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取角色编码
|
||||
* @return String
|
||||
* @author cwchen
|
||||
* @date 2024/8/6 17:03
|
||||
*/
|
||||
public static String getRoleCode(){
|
||||
return SecurityUtils.getLoginUser() != null && SecurityUtils.getLoginUser().getSysUser() != null ? SecurityUtils.getLoginUser().getSysUser().getRoleCode() : null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,6 +82,12 @@
|
|||
<artifactId>jasypt-spring-boot-starter</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bonus</groupId>
|
||||
<artifactId>bonus-common-entity</artifactId>
|
||||
<version>24.6.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,69 @@
|
|||
package com.bonus.app.controller;
|
||||
|
||||
import com.bonus.app.service.IAppEquipmentReqService;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
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.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @className:AppEquipmentReqController
|
||||
* @author:cwchen
|
||||
* @date:2024-08-06-15:49
|
||||
* @version:1.0
|
||||
* @description:APP-设备领用
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/appEquipmentReq/")
|
||||
@Slf4j
|
||||
public class AppEquipmentReqController extends BaseController {
|
||||
|
||||
@Resource(name = "IAppEquipmentReqService")
|
||||
private IAppEquipmentReqService service;
|
||||
|
||||
// @RequiresPermissions("basic:equipmentReq:list")
|
||||
@GetMapping("list")
|
||||
@SysLog(title = "施工管控", businessType = OperaType.QUERY,logType = 0,module = "施工管控->设备领用",details ="查询设备领用列表")
|
||||
public TableDataInfo list(AppParamsDto dto) {
|
||||
startPage();
|
||||
List<EquipmentReqVo> list = service.getEquipmentReqLists(dto);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
// @RequiresPermissions("basic:equipmentReq:addData")
|
||||
@PostMapping("addData")
|
||||
@SysLog(title = "施工管控", businessType = OperaType.INSERT,logType = 0,module = "施工管控->设备领用",details ="设备领用")
|
||||
public AjaxResult addData(@Validated @RequestBody EquipmentReqDataVo vo) {
|
||||
return service.addData(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取未领用的设备
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @author cwchen
|
||||
* @date 2024/8/5 18:05
|
||||
*/
|
||||
@GetMapping("getUseDevices")
|
||||
public AjaxResult getUseDevices(BraceletParamsDto dto) {
|
||||
return service.getUseDevices(dto);
|
||||
}
|
||||
|
||||
// @RequiresPermissions("basic:equipmentReq:returnDevice")
|
||||
@PostMapping("returnDevice")
|
||||
@SysLog(title = "施工管控", businessType = OperaType.INSERT,logType = 0,module = "施工管控->设备领用",details ="归还设备")
|
||||
public AjaxResult returnDevice(@RequestBody BraceletParamsDto dto) {
|
||||
return service.returnDevice(dto);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
package com.bonus.app.mapper;
|
||||
|
||||
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 org.apache.ibatis.annotations.MapKey;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @className:AppEquipmentReqMapper
|
||||
* @author:cwchen
|
||||
* @date:2024-08-06-15:52
|
||||
* @version:1.0
|
||||
* @description:APP-设备领用
|
||||
*/
|
||||
@Repository(value = "AppEquipmentReqMapper")
|
||||
public interface AppEquipmentReqMapper {
|
||||
/**
|
||||
* 设备领用列表-项目部角色
|
||||
* @param dto
|
||||
* @return List<EquipmentReqVo>
|
||||
* @author cwchen
|
||||
* @date 2024/8/6 16:10
|
||||
*/
|
||||
List<EquipmentReqVo> getEquipmentReqLists(AppParamsDto dto);
|
||||
|
||||
/**
|
||||
* 添加设备领用数据
|
||||
*
|
||||
* @param vo
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/8/5 16:26
|
||||
*/
|
||||
void addDevUseData(EquipmentReqDataVo vo);
|
||||
|
||||
/**
|
||||
* 添加设备领用详情数据
|
||||
*
|
||||
* @param vo
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/8/5 16:34
|
||||
*/
|
||||
void addDevUseDetailData(EquipmentReqDataVo vo);
|
||||
|
||||
/**
|
||||
* 更新手环箱状态
|
||||
*
|
||||
* @param vo
|
||||
* @param equipment
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/8/5 17:02
|
||||
*/
|
||||
void updateDeviceData(@Param("vo") EquipmentReqDataVo vo, @Param("equipment") EquipmentReqDataVo.Equipment equipment, @Param("type")int type);
|
||||
|
||||
/**
|
||||
* 判断设备是否已经归还
|
||||
*
|
||||
* @param equipment
|
||||
* @return Integer
|
||||
* @author cwchen
|
||||
* @date 2024/8/5 17:28
|
||||
*/
|
||||
Integer isHasUseDevice(EquipmentReqDataVo.Equipment equipment);
|
||||
|
||||
/**
|
||||
* 获取未领用的设备
|
||||
* @param dto
|
||||
* @return List<Map<String,Object>>
|
||||
* @author cwchen
|
||||
* @date 2024/8/5 18:08
|
||||
*/
|
||||
@MapKey("devId")
|
||||
List<Map<String, Object>> getUseDevices(BraceletParamsDto dto);
|
||||
|
||||
/**
|
||||
* 更新手环箱/手环箱状态
|
||||
* @param dto
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/8/6 9:16
|
||||
*/
|
||||
void updateReturnDeviceData(@Param("params") BraceletParamsDto dto,@Param("type") int type);
|
||||
|
||||
/**
|
||||
* 更新设备归还状态
|
||||
* @param dto
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/8/6 9:19
|
||||
*/
|
||||
void returnDevice(BraceletParamsDto dto);
|
||||
|
||||
/**
|
||||
* 判断设备是否全部归还
|
||||
* @param dto
|
||||
* @return int
|
||||
* @author cwchen
|
||||
* @date 2024/8/6 11:10
|
||||
*/
|
||||
int isAllDeviceReturn(@Param("params") BraceletParamsDto dto,@Param("type") int type);
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
package com.bonus.app.service;
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
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 java.util.List;
|
||||
|
||||
/**
|
||||
* @className:AppEquipmentReqService
|
||||
* @author:cwchen
|
||||
* @date:2024-08-06-15:50
|
||||
* @version:1.0
|
||||
* @description:APP-设备领用
|
||||
*/
|
||||
public interface IAppEquipmentReqService {
|
||||
|
||||
/**
|
||||
* APP-设备领用列表
|
||||
* @param dto
|
||||
* @return List<EquipmentReqVo>
|
||||
* @author cwchen
|
||||
* @date 2024/8/6 16:09
|
||||
*/
|
||||
List<EquipmentReqVo> getEquipmentReqLists(AppParamsDto dto);
|
||||
|
||||
/**
|
||||
* 设备领用
|
||||
* @param vo
|
||||
* @return AjaxResult
|
||||
* @author cwchen
|
||||
* @date 2024/8/5 16:03
|
||||
*/
|
||||
AjaxResult addData(EquipmentReqDataVo vo);
|
||||
|
||||
/**
|
||||
* 获取未领用的设备
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @author cwchen
|
||||
* @date 2024/8/5 18:06
|
||||
*/
|
||||
AjaxResult getUseDevices(BraceletParamsDto dto);
|
||||
|
||||
/**
|
||||
* 归还设备
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @author cwchen
|
||||
* @date 2024/8/6 9:14
|
||||
*/
|
||||
AjaxResult returnDevice(BraceletParamsDto dto);
|
||||
}
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
package com.bonus.app.service.impl;
|
||||
|
||||
import com.bonus.app.mapper.AppEquipmentReqMapper;
|
||||
import com.bonus.app.service.IAppEquipmentReqService;
|
||||
import com.bonus.common.core.constant.BusinessConstants;
|
||||
import com.bonus.common.core.utils.encryption.Sm4Utils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @className:AppEquipmentReqServiceImpl
|
||||
* @author:cwchen
|
||||
* @date:2024-08-06-15:51
|
||||
* @version:1.0
|
||||
* @description:APP-设备领用-impl
|
||||
*/
|
||||
@Service(value = "IAppEquipmentReqService")
|
||||
@Slf4j
|
||||
public class AppEquipmentReqServiceImpl implements IAppEquipmentReqService {
|
||||
|
||||
@Resource(name = "AppEquipmentReqMapper")
|
||||
private AppEquipmentReqMapper mapper;
|
||||
|
||||
@Override
|
||||
public List<EquipmentReqVo> getEquipmentReqLists(AppParamsDto dto) {
|
||||
List<EquipmentReqVo> list = new ArrayList<>();
|
||||
try {
|
||||
list = mapper.getEquipmentReqLists(dto);
|
||||
for (EquipmentReqVo vo : list) {
|
||||
vo.setLeaderPhone(Sm4Utils.decode(vo.getLeaderPhone()));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult addData(EquipmentReqDataVo vo) {
|
||||
try {
|
||||
if (CollectionUtils.isEmpty(vo.getList())) {
|
||||
return AjaxResult.error("领用设备不能为空");
|
||||
}
|
||||
// 判断是否添加重复设备
|
||||
Set<EquipmentReqDataVo.Equipment> setList = new HashSet<>(vo.getList());
|
||||
if (setList.size() != vo.getList().size()) {
|
||||
return AjaxResult.error("领用设备中有重复设备,请仔细检查");
|
||||
}
|
||||
for (EquipmentReqDataVo.Equipment equipment : vo.getList()) {
|
||||
// 判断设备是否已经归还
|
||||
Integer result = result = mapper.isHasUseDevice(equipment);
|
||||
if (result > 0) {
|
||||
return AjaxResult.error("领用设备中包含未归还设备,请先归还后,方可再次领用");
|
||||
}
|
||||
}
|
||||
// 添加设备领用数据、设备领用详情数据
|
||||
mapper.addDevUseData(vo);
|
||||
mapper.addDevUseDetailData(vo);
|
||||
for (EquipmentReqDataVo.Equipment equipment : vo.getList()) {
|
||||
if(Objects.equals(equipment.getDevType(), BusinessConstants.SHX)){
|
||||
// 绑定手环箱
|
||||
mapper.updateDeviceData(vo,equipment,1);
|
||||
}
|
||||
}
|
||||
return AjaxResult.success();
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getUseDevices(BraceletParamsDto dto) {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
try {
|
||||
if(StringUtils.isNotBlank(dto.getDevType())){
|
||||
list = mapper.getUseDevices(dto);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult returnDevice(BraceletParamsDto dto) {
|
||||
try {
|
||||
if(Objects.equals(dto.getDevType(), BusinessConstants.SHX)){
|
||||
// 设备类型为手环箱时,判断手环设备是否全部归还
|
||||
int result = mapper.isAllDeviceReturn(dto,1);
|
||||
if(result > 0){
|
||||
return AjaxResult.error("该手环箱中包含的手环设备未全部归还");
|
||||
}
|
||||
// 解绑手环箱
|
||||
mapper.updateReturnDeviceData(dto,1);
|
||||
}else{
|
||||
// 设备类型为其他设备时,判断是否全部归还
|
||||
int result = mapper.isAllDeviceReturn(dto,2);
|
||||
if(result > 0){
|
||||
return AjaxResult.error("班组人员未归还设");
|
||||
}
|
||||
}
|
||||
mapper.returnDevice(dto);
|
||||
return AjaxResult.success();
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(),e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,170 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.app.mapper.AppEquipmentReqMapper">
|
||||
<!--添加设备领用数据-->
|
||||
<insert id="addDevUseData" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO tb_dev_use
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="teamId != null">team_id,</if>
|
||||
<if test="proId != null">pro_id,</if>
|
||||
<if test="powerId != null">gt_id,</if>
|
||||
<if test="remarks != null and remarks!=''">remarks,</if>
|
||||
create_time,
|
||||
update_time,
|
||||
create_user,
|
||||
update_user,
|
||||
del_flag,
|
||||
id
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="teamId != null">#{teamId},</if>
|
||||
<if test="proId != null">#{proId},</if>
|
||||
<if test="powerId != null">#{powerId},</if>
|
||||
<if test="remarks != null and remarks!=''">#{remarks},</if>
|
||||
#{createTime},
|
||||
#{updateTime},
|
||||
#{createUser},
|
||||
#{updateUser},
|
||||
0,
|
||||
null
|
||||
</trim>
|
||||
</insert>
|
||||
<!--添加设备领用详情数据-->
|
||||
<insert id="addDevUseDetailData">
|
||||
INSERT INTO tb_dev_use_bid(id,dev_id,dev_name,dev_code,dev_type,ly_time) VALUES
|
||||
<foreach collection="list" separator="," item="item">
|
||||
(
|
||||
#{id},#{item.devId},#{item.devName},#{item.devCode},#{item.devType},#{lyTime}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
<!--更新设备状态-->
|
||||
<update id="updateDeviceData">
|
||||
<if test="type == 1">
|
||||
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}
|
||||
</if>
|
||||
</update>
|
||||
<!--更新1.手环箱/2.其他设备状态-->
|
||||
<update id="updateReturnDeviceData">
|
||||
<if test="type == 1">
|
||||
UPDATE tb_sh_box SET team_id = null,pro_id = null,gt_id = null WHERE id = #{params.devId}
|
||||
</if>
|
||||
<if test="type == 2">
|
||||
UPDATE tb_dev_ly SET pro_id = null,team_id = null,ly_user = null,ly_status = null,ly_time = null,user_type = null,gt_id = null WHERE dev_id = #{params.devId}
|
||||
</if>
|
||||
</update>
|
||||
<!--更新设备归还状态-->
|
||||
<update id="returnDevice">
|
||||
UPDATE tb_dev_use_bid SET gh_time = #{backTime} WHERE id = #{id} AND dev_id = #{devId} AND dev_type = #{devType} AND dev_code = #{devCode}
|
||||
</update>
|
||||
<!--设备领用-项目部角色查看-->
|
||||
<select id="getEquipmentReqLists" resultType="com.bonus.common.entity.bracelet.vo.EquipmentReqVo">
|
||||
SELECT * FROM (
|
||||
SELECT tdub.id,
|
||||
tdub.dev_id AS devId,
|
||||
tdub.dev_type AS devType,
|
||||
tdu.remarks,
|
||||
td.dev_code AS devCode,
|
||||
td.dev_name AS devName,
|
||||
tdub.ly_time AS lyTime,
|
||||
tdub.gh_time AS ghTime,
|
||||
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
|
||||
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_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'
|
||||
WHERE tdu.del_flag = 0 AND tdub.dev_type NOT IN ('shx')
|
||||
<if test="devType!=null and devType!=''">
|
||||
AND td.dev_type = #{devType}
|
||||
</if>
|
||||
UNION ALL
|
||||
SELECT tdub.id,
|
||||
tdub.dev_id AS devId,
|
||||
tdub.dev_type AS devType,
|
||||
tdu.remarks,
|
||||
tsb.box_code AS devCode,
|
||||
tsb.box_name AS devName,
|
||||
tdub.ly_time AS lyTime,
|
||||
tdub.gh_time AS ghTime,
|
||||
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
|
||||
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_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'">
|
||||
AND tsb.id = -1
|
||||
</if>
|
||||
) a
|
||||
<where>
|
||||
<if test="proName!=null and proName!=''">
|
||||
AND INSTR(a.proName,#{proName}) > 0
|
||||
</if>
|
||||
<if test="powerName!=null and powerName!=''">
|
||||
AND INSTR(a.powerName,#{powerName}) > 0
|
||||
</if>
|
||||
<if test="teamName!=null and teamName!=''">
|
||||
AND INSTR(a.teamName,#{teamName}) > 0
|
||||
</if>
|
||||
<if test="devName!=null and devName!=''">
|
||||
AND INSTR(a.devName,#{devName}) > 0
|
||||
</if>
|
||||
<if test="devCode!=null and devCode!=''">
|
||||
AND INSTR(a.devCode,#{devCode}) > 0
|
||||
</if>
|
||||
<if test="lyTime!=null and lyTime!=''">
|
||||
AND DATE_FORMAT(a.lyTime,'%y%m%d') BETWEEN #{lyTime} AND #{lyTime}
|
||||
</if>
|
||||
<if test="ghTime!=null and ghTime!=''">
|
||||
AND DATE_FORMAT(a.ghTime,'%y%m%d') BETWEEN #{ghTime} AND #{ghTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!--判断设备是否已经归还-->
|
||||
<select id="isHasUseDevice" resultType="java.lang.Integer">
|
||||
SELECT COUNT(*) FROM tb_dev_use_bid WHERE dev_id = #{devId} AND dev_type = #{devType} AND gh_time IS NULL
|
||||
</select>
|
||||
<!--获取未领用的设备-->
|
||||
<select id="getUseDevices" resultType="java.util.Map">
|
||||
<if test="devType!='' and devType!=null and devType!='shx'">
|
||||
SELECT td.id AS devId,td.dev_code AS devCode,td.dev_name AS devName,td.dev_type AS devType
|
||||
FROM tb_device td
|
||||
LEFT JOIN tb_dev_use_bid tdub ON td.id = tdub.dev_id AND td.dev_type = tdub.dev_type
|
||||
WHERE (tdub.id IS NULL OR tdub.gh_time IS NOT NULL) AND td.dev_type = #{devType} AND td.del_flag = 0
|
||||
</if>
|
||||
<if test="devType!='' and devType!=null and devType=='shx'">
|
||||
SELECT tsb.id AS devId,tsb.box_code AS devCode,tsb.box_name AS devName,'shx' AS devType
|
||||
FROM tb_sh_box tsb
|
||||
WHERE team_id IS NULL AND tsb.del_flag = 0
|
||||
</if>
|
||||
</select>
|
||||
<!--判断设备是否全部归还-->
|
||||
<select id="isAllDeviceReturn" resultType="java.lang.Integer">
|
||||
SELECT COUNT(*)
|
||||
FROM tb_dev_use_bid tdub
|
||||
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>
|
||||
</mapper>
|
||||
|
|
@ -7,7 +7,6 @@ import com.bonus.common.core.web.page.TableDataInfo;
|
|||
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.entity.bracelet.vo.PersonVo;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package com.bonus.bracelet.service.impl;
|
|||
import com.bonus.bracelet.mapper.EquipmentReqMapper;
|
||||
import com.bonus.bracelet.service.IEquipmentReqService;
|
||||
import com.bonus.common.core.constant.BusinessConstants;
|
||||
import com.bonus.common.core.constant.Constants;
|
||||
import com.bonus.common.core.utils.encryption.Sm4Utils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.entity.bracelet.BraceletParamsDto;
|
||||
|
|
|
|||
Loading…
Reference in New Issue