Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
545381cf94
|
|
@ -26,6 +26,9 @@ public class BusinessConstants {
|
|||
public final static String FEMALE = "女";
|
||||
public final static String OTHER = "其他";
|
||||
|
||||
/** 手环箱设备类型*/
|
||||
public final static String SHX = "shx";
|
||||
|
||||
public final static Integer CELL_1 = 1;
|
||||
public final static Integer CELL_2 = 2;
|
||||
public final static Integer CELL_3 = 3;
|
||||
|
|
|
|||
|
|
@ -86,4 +86,24 @@ public class BraceletParamsDto {
|
|||
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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,80 @@
|
|||
package com.bonus.common.entity.bracelet.vo;
|
||||
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @className:EquipmentReqDataVo
|
||||
* @author:cwchen
|
||||
* @date:2024-08-05-15:52
|
||||
* @version:1.0
|
||||
* @description:设备领用数据-vo
|
||||
*/
|
||||
@Data
|
||||
public class EquipmentReqDataVo {
|
||||
|
||||
private Long id;
|
||||
@NotNull(message = "班组ID不能为空")
|
||||
private Long teamId;
|
||||
@NotNull(message = "作业杆塔不能为空")
|
||||
private Long powerId;
|
||||
@NotNull(message = "所属工程ID不能为空")
|
||||
private Long proId;
|
||||
|
||||
private List<Equipment> list;
|
||||
|
||||
@Data
|
||||
public static class Equipment {
|
||||
/**
|
||||
* 设备ID
|
||||
*/
|
||||
private Long devId;
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
private String devName;
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
private String devCode;
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
private String devType;
|
||||
|
||||
}
|
||||
|
||||
@Length(max = 255, message = "备注字符长度不能超过255")
|
||||
private String remarks;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long createUser = SecurityUtils.getUserId();
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private Long updateUser = SecurityUtils.getUserId();
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTime = new Date();
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private Date updateTime = new Date();
|
||||
|
||||
/**
|
||||
* 领用时间
|
||||
*/
|
||||
private Date lyTime = new Date();
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
package com.bonus.common.entity.bracelet.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @className:EquipmentReqVo
|
||||
* @author:cwchen
|
||||
* @date:2024-08-05-13:50
|
||||
* @version:1.0
|
||||
* @description:设备领用-vo
|
||||
*/
|
||||
@Data
|
||||
public class EquipmentReqVo {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**设备ID*/
|
||||
private Long devId;
|
||||
/**设备类型*/
|
||||
private String devType;
|
||||
/**
|
||||
* 杆塔名称
|
||||
*/
|
||||
private String powerName;
|
||||
/**
|
||||
* 工程名称
|
||||
*/
|
||||
private String proName;
|
||||
/**
|
||||
* 领用班组
|
||||
*/
|
||||
private String teamName;
|
||||
/**
|
||||
* 班组负责人
|
||||
*/
|
||||
private String teamLeader;
|
||||
/**
|
||||
* 班组负责人手机号
|
||||
*/
|
||||
private String leaderPhone;
|
||||
/**
|
||||
* 领用设备类型名称
|
||||
*/
|
||||
private String deviceTypeName;
|
||||
/**
|
||||
* 领用设备编码
|
||||
*/
|
||||
private String devCode;
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
private String devName;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
/**领用时间*/
|
||||
private Date lyTime;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
/**归还时间*/
|
||||
private Date ghTime;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remarks;
|
||||
}
|
||||
|
|
@ -75,13 +75,13 @@ public class PersonVo implements Serializable {
|
|||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private Date createTime = new Date();
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private Date updateTime = new Date();
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,70 @@
|
|||
package com.bonus.bracelet.controller;
|
||||
|
||||
import com.bonus.bracelet.service.IEquipmentReqService;
|
||||
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.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;
|
||||
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:EquipmentReqController
|
||||
* @author:cwchen
|
||||
* @date:2024-08-05-13:42
|
||||
* @version:1.0
|
||||
* @description:设备领用-web层
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/equipmentReq/")
|
||||
@Slf4j
|
||||
public class EquipmentReqController extends BaseController {
|
||||
|
||||
@Resource(name = "IEquipmentReqService")
|
||||
private IEquipmentReqService service;
|
||||
|
||||
// @RequiresPermissions("basic:equipmentReq:list")
|
||||
@GetMapping("list")
|
||||
@SysLog(title = "施工管控", businessType = OperaType.QUERY,logType = 0,module = "施工管控->设备领用",details ="查询设备领用列表")
|
||||
public TableDataInfo list(BraceletParamsDto 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,100 @@
|
|||
package com.bonus.bracelet.mapper;
|
||||
|
||||
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:EquipmentReqMapper
|
||||
* @author:cwchen
|
||||
* @date:2024-08-05-13:46
|
||||
* @version:1.0
|
||||
* @description:设备领用-mapper
|
||||
*/
|
||||
@Repository(value = "EquipmentReqMapper")
|
||||
public interface EquipmentReqMapper {
|
||||
/**
|
||||
* 设备领用列表
|
||||
*
|
||||
* @param dto
|
||||
* @return List<EquipmentReqVo>
|
||||
* @author cwchen
|
||||
* @date 2024/8/5 13:53
|
||||
*/
|
||||
List<EquipmentReqVo> getEquipmentReqLists(BraceletParamsDto 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 updateShBoxData(@Param("vo") EquipmentReqDataVo vo, @Param("equipment") EquipmentReqDataVo.Equipment equipment);
|
||||
|
||||
/**
|
||||
* 判断设备是否已经归还
|
||||
*
|
||||
* @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 updateshBoxData(BraceletParamsDto dto);
|
||||
|
||||
/**
|
||||
* 更新设备归还状态
|
||||
* @param dto
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/8/6 9:19
|
||||
*/
|
||||
void returnDevice(BraceletParamsDto dto);
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
package com.bonus.bracelet.service;
|
||||
|
||||
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 java.util.List;
|
||||
|
||||
/**
|
||||
* @className:IEquipmentReqService
|
||||
* @author:cwchen
|
||||
* @date:2024-08-05-13:42
|
||||
* @version:1.0
|
||||
* @description:设备领用-serivice
|
||||
*/
|
||||
public interface IEquipmentReqService {
|
||||
/**
|
||||
* 设备领用列表
|
||||
*
|
||||
* @param dto
|
||||
* @return List<EquipmentReqVo>
|
||||
* @author cwchen
|
||||
* @date 2024/8/5 13:51
|
||||
*/
|
||||
List<EquipmentReqVo> getEquipmentReqLists(BraceletParamsDto 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,113 @@
|
|||
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;
|
||||
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.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @className:EquipmentReqServiceImpl
|
||||
* @author:cwchen
|
||||
* @date:2024-08-05-13:43
|
||||
* @version:1.0
|
||||
* @description:设备领用-serviceImpl
|
||||
*/
|
||||
@Slf4j
|
||||
@Service(value = "IEquipmentReqService")
|
||||
public class EquipmentReqServiceImpl implements IEquipmentReqService {
|
||||
|
||||
@Resource(name = "EquipmentReqMapper")
|
||||
private EquipmentReqMapper mapper;
|
||||
|
||||
@Override
|
||||
public List<EquipmentReqVo> getEquipmentReqLists(BraceletParamsDto 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.updateShBoxData(vo,equipment);
|
||||
}
|
||||
}
|
||||
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 {
|
||||
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)){
|
||||
// 设备类型为手环箱更新手环箱状态
|
||||
mapper.updateshBoxData(dto);
|
||||
}
|
||||
mapper.returnDevice(dto);
|
||||
return AjaxResult.success();
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(),e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,162 @@
|
|||
<?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.bracelet.mapper.EquipmentReqMapper">
|
||||
<!--添加设备领用数据-->
|
||||
<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="updateShBoxData">
|
||||
UPDATE tb_sh_box SET team_id = #{vo.teamId},pro_id = #{vo.proId},gt_id = #{vo.powerId} WHERE id = #{equipment.devId}
|
||||
</update>
|
||||
<!--更新手环箱状态-->
|
||||
<update id="updateshBoxData">
|
||||
UPDATE tb_sh_box SET team_id = null,pro_id = null,gt_id = null WHERE id = #{devId}
|
||||
</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,
|
||||
'手环箱' 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_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>
|
||||
<if test="devType == '' or devType==null">
|
||||
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
|
||||
UNION ALL
|
||||
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>
|
||||
</mapper>
|
||||
|
|
@ -42,6 +42,7 @@ public class SelectController {
|
|||
|
||||
/**
|
||||
* 工程下拉选
|
||||
*
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @author cwchen
|
||||
|
|
@ -51,4 +52,28 @@ public class SelectController {
|
|||
public AjaxResult getProList(SysParamsDto dto) {
|
||||
return service.getProList(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 班组下拉选-获取所属工程
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @author cwchen
|
||||
* @date 2024/8/5 17:48
|
||||
*/
|
||||
@GetMapping("getTeamLists")
|
||||
public AjaxResult getTeamLists(SysParamsDto dto) {
|
||||
return service.getTeamLists(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据工程获取杆塔下拉选
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @author cwchen
|
||||
* @date 2024/8/5 17:54
|
||||
*/
|
||||
@GetMapping("/getPowerLists")
|
||||
public AjaxResult getPowerLists(SysParamsDto dto) {
|
||||
return service.getPowerLists(dto);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ import lombok.Data;
|
|||
@Data
|
||||
public class SysParamsDto {
|
||||
|
||||
private Long proId;
|
||||
|
||||
private String id;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2,9 +2,11 @@ package com.bonus.system.mapper;
|
|||
|
||||
import com.bonus.system.domain.SysParamsDto;
|
||||
import com.bonus.system.domain.vo.SysSelectVo;
|
||||
import org.apache.ibatis.annotations.MapKey;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @className:SelectMapper
|
||||
|
|
@ -27,10 +29,30 @@ public interface SelectMapper {
|
|||
|
||||
/**
|
||||
* 班组下拉选
|
||||
*
|
||||
* @param dto
|
||||
* @return List<SysSelectVo>
|
||||
* @author cwchen
|
||||
* @date 2024/7/17 15:59
|
||||
*/
|
||||
List<SysSelectVo> getProList(SysParamsDto dto);
|
||||
|
||||
/**
|
||||
* 班组下拉选2
|
||||
* @param dto
|
||||
* @return List<Map < String, Object>>
|
||||
* @author cwchen
|
||||
* @date 2024/8/5 17:49
|
||||
*/
|
||||
@MapKey("teamId")
|
||||
List<Map<String, Object>> getTeamLists(SysParamsDto dto);
|
||||
|
||||
/**
|
||||
* 根据工程获取杆塔下拉选
|
||||
* @param dto
|
||||
* @return List<SysSelectVo>
|
||||
* @author cwchen
|
||||
* @date 2024/8/5 17:55
|
||||
*/
|
||||
List<SysSelectVo> getPowerLists(SysParamsDto dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ public interface ISelectService {
|
|||
|
||||
/**
|
||||
* 工程下拉选
|
||||
*
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @author cwchen
|
||||
|
|
@ -30,4 +31,21 @@ public interface ISelectService {
|
|||
*/
|
||||
AjaxResult getProList(SysParamsDto dto);
|
||||
|
||||
/**
|
||||
* 班组下拉选
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @author cwchen
|
||||
* @date 2024/8/5 17:48
|
||||
*/
|
||||
AjaxResult getTeamLists(SysParamsDto dto);
|
||||
|
||||
/**
|
||||
* 根据工程获取杆塔下拉选
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @author cwchen
|
||||
* @date 2024/8/5 17:55
|
||||
*/
|
||||
AjaxResult getPowerLists(SysParamsDto dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,9 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @className:SelectServiceImpl
|
||||
|
|
@ -45,4 +47,26 @@ public class SelectServiceImpl implements ISelectService {
|
|||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getTeamLists(SysParamsDto dto) {
|
||||
List<Map<String,Object>> list = new ArrayList<>();
|
||||
try {
|
||||
list = mapper.getTeamLists(dto);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getPowerLists(SysParamsDto dto) {
|
||||
try {
|
||||
List<SysSelectVo> list = mapper.getPowerLists(dto);
|
||||
return AjaxResult.success(list);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(),e);
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,4 +15,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
SELECT tp.id,tp.pro_name AS name
|
||||
FROM tb_project tp WHERE tp.del_flag = 0
|
||||
</select>
|
||||
<!--班组下拉选-->
|
||||
<select id="getTeamLists" resultType="java.util.Map">
|
||||
SELECT twt.team_id AS teamId,
|
||||
twt.team_name AS teamName,
|
||||
twt.team_leader AS teamLeader,
|
||||
tp.pro_name AS proName,
|
||||
twt.pro_id AS proId
|
||||
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
|
||||
</select>
|
||||
<!--根据工程获取杆塔下拉选-->
|
||||
<select id="getPowerLists" resultType="com.bonus.system.domain.vo.SysSelectVo">
|
||||
SELECT id,power_name AS name
|
||||
FROM tb_project_power
|
||||
<where>
|
||||
<if test="proId!=null">
|
||||
pro_id = #{proId}
|
||||
</if>
|
||||
AND del_flag = 0
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue