bug修复

This commit is contained in:
jjLv 2024-08-07 19:36:41 +08:00
parent cae5aff16e
commit cb542fd619
11 changed files with 137 additions and 112 deletions

View File

@ -5,6 +5,9 @@ import com.bonus.common.core.annotation.Excel.ColumnType;
import io.swagger.annotations.Api;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Api("BindDeviceVo")
@Data
@ -17,7 +20,7 @@ public class BindDeviceVo
/** 设备id */
@Excel(name = "设备id")
private int[] deviceIds;
private List<Map<String,Object>> deviceIds;
}

View File

@ -19,6 +19,10 @@ public class DeviceVo
@Excel(name = "设备类型")
private String deviceType;
/** 设备类型名称 */
@Excel(name = "设备类型名称")
private String deviceTypeName;
/** 设备名称 */
@Excel(name = "设备名称")
private String deviceName;

View File

@ -3,6 +3,7 @@ package com.bonus.common.entity.bracelet.vo;
import com.bonus.common.core.annotation.Excel;
import com.bonus.common.core.web.domain.BaseEntity;
import io.swagger.annotations.Api;
import lombok.Data;
import java.sql.Date;
@ -12,6 +13,7 @@ import java.sql.Date;
* @author bonus
*/
@Api("BaseProject")
@Data
public class QueryConstruction extends BaseEntity
{
/** 工程名称 */
@ -47,81 +49,4 @@ public class QueryConstruction extends BaseEntity
private int warnnum;
public String getProname() {
return proname;
}
public void setProname(String proname) {
this.proname = proname;
}
public String getDepartname() {
return departname;
}
public void setDepartname(String departname) {
this.departname = departname;
}
public String getTeamname() {
return teamname;
}
public void setTeamname(String teamname) {
this.teamname = teamname;
}
public String getTeamleader() {
return teamleader;
}
public void setTeamleader(String teamleader) {
this.teamleader = teamleader;
}
public int getTeamnum() {
return teamnum;
}
public void setTeamnum(int teamnum) {
this.teamnum = teamnum;
}
public int getTempnum() {
return tempnum;
}
public void setTempnum(int tempnum) {
this.tempnum = tempnum;
}
public int getWarnnum() {
return warnnum;
}
public void setWarnnum(int warnnum) {
this.warnnum = warnnum;
}
public Date getLytime() {
return lytime;
}
public void setLytime(Date lytime) {
this.lytime = lytime;
}
@Override
public String toString() {
return "QueryConstruction{" +
"proname='" + proname + '\'' +
", departname='" + departname + '\'' +
", teamname='" + teamname + '\'' +
", teamleader='" + teamleader + '\'' +
", teamnum=" + teamnum +
", tempnum=" + tempnum +
", lytime=" + lytime +
", warnnum=" + warnnum +
'}';
}
}

View File

@ -34,6 +34,10 @@ public class SidebandDeviceVo
@Excel(name = "设备类型")
private String deviceType;
/** 设备类型名称 */
@Excel(name = "设备类型名称")
private String deviceTypeName;
/** 设备名称 */
@Excel(name = "设备名称")
private String deviceName;

View File

@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @className:SidebandController
@ -147,8 +148,8 @@ public class SidebandController extends BaseController {
@SysLog(title = "边带管理", businessType = OperaType.QUERY, logType = 0, module = "施工管控->边带管理", details = "绑定")
public AjaxResult bindDevice(@RequestBody BindDeviceVo vo) {
int sidebandId = vo.getSidebandId();
return sidebandservice.bindDevice(sidebandId,vo.getDeviceIds());
List<Map<String,Object>> list= vo.getDeviceIds();
return sidebandservice.bindDevice(sidebandId,list);
}
}

View File

@ -37,6 +37,13 @@ public interface SidebandMapper {
*/
List<SidebandDeviceVo> getDeviceLists(SidebandDeviceVo data);
/**
* 杆塔绑定设备列表2
* @param data
* @return
*/
List<SidebandDeviceVo> getShLists(SidebandDeviceVo data);
/**
* 杆塔未绑定设备列表
* @param data
@ -113,6 +120,13 @@ public interface SidebandMapper {
*/
int delDevice(SidebandDeviceVo vo);
/**
* 解除绑定2
* @param vo
* @return
*/
int delSh(SidebandDeviceVo vo);
/**
* 获取人员管理表中领用人名称
* @param id
@ -129,4 +143,6 @@ public interface SidebandMapper {
void bindDevice(@Param("sidebandId") int sidebandId,@Param("deviceId") int deviceId);
void bindSh(@Param("sidebandId") int sidebandId,@Param("deviceId") int deviceId);
}

View File

@ -5,6 +5,7 @@ import com.bonus.common.entity.bracelet.BraceletParamsDto;
import com.bonus.common.entity.bracelet.vo.*;
import java.util.List;
import java.util.Map;
/**
* @className:SidebandService
@ -98,6 +99,6 @@ public interface ISidebandService {
* @param deviceIds
* @return
*/
AjaxResult bindDevice(int sidebandId,int[] deviceIds);
AjaxResult bindDevice(int sidebandId,List<Map<String,Object>> list);
}

View File

@ -18,10 +18,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
/**
* @className:SidebandServiceImpl
@ -59,14 +56,20 @@ public class SidebandServiceImpl implements ISidebandService {
try {
list = sidebandMapper.getDeviceLists(data);
for (int i = 0; i < list.size(); i++) {
if(list.get(i).getLyType()==0){
if(list.get(i).getLyType()==0 && !list.get(i).getDeviceTypeName().equals("手提箱")){
String name = sidebandMapper.getDeviceLyName(list.get(i).getLyId());
list.get(i).setLyName(name);
}else if(list.get(i).getLyType()==1){
}else if(list.get(i).getLyType()==1 && !list.get(i).getDeviceTypeName().equals("手提箱")){
String name = sidebandMapper.getDeviceLyNameTemp(list.get(i).getLyId());
list.get(i).setLyName(name);
}
if(list.get(i).getLyName()!=null && list.get(i).getDeviceTypeName().equals("手提箱")){
list.get(i).setDeviceStatus(0);
}else if(list.get(i).getLyName()==null && list.get(i).getDeviceTypeName().equals("手提箱")){
list.get(i).setDeviceStatus(1);
}
}
} catch (Exception e) {
log.error(e.toString(), e);
}
@ -176,9 +179,6 @@ public class SidebandServiceImpl implements ISidebandService {
@Transactional(rollbackFor = Exception.class)
public AjaxResult delSideband(SidebandVo vo) {
try {
if (vo.getBindNum()!=0) {
return AjaxResult.error("边带数量不为0无法删除");
}
int result = sidebandMapper.delSideband(vo);
if(result==1){
return AjaxResult.success();
@ -199,8 +199,14 @@ public class SidebandServiceImpl implements ISidebandService {
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult delDevice(SidebandDeviceVo vo) {
int result = 0;
try {
int result = sidebandMapper.delDevice(vo);
if(vo.getDeviceTypeName().equals("手环箱")){
result = sidebandMapper.delSh(vo);
}else{
result = sidebandMapper.delDevice(vo);
}
if(result==1){
return AjaxResult.success();
}
@ -214,14 +220,21 @@ public class SidebandServiceImpl implements ISidebandService {
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult bindDevice(int sidebandId,int[] deviceIds) {
if(deviceIds.length==0){
return AjaxResult.error("请至少选择一个要绑定的设备");
}
public AjaxResult bindDevice(int sidebandId,List<Map<String,Object>> list) {
// if(deviceIds.length==0){
// return AjaxResult.error("请至少选择一个要绑定的设备");
// }
Map<String,Object> map = new HashMap<>();
try {
for (int i = 0; i < deviceIds.length; i++) {
int deviceId = deviceIds[i];
sidebandMapper.bindDevice(sidebandId,deviceId);
for (int i = 0; i < list.size(); i++) {
map = list.get(i);
if(map.get("type").equals("手环箱")){
int deviceId = (int) map.get("id");
sidebandMapper.bindSh(sidebandId,deviceId);
}else{
int deviceId = (int) map.get("id");
sidebandMapper.bindDevice(sidebandId,deviceId);
}
}
} catch (Exception e) {
log.error(e.toString(), e);

View File

@ -90,7 +90,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
group by tsb.id
order by tsb.id ASC
</select>
<!--手环绑定选择列表-->

View File

@ -6,8 +6,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!--设备列表-->
<select id="getDeviceLists" resultType="com.bonus.common.entity.bracelet.vo.DeviceVo">
select td.id as deviceId,td.dev_type as deviceType,td.dev_name as deviceName,td.dev_code as deviceCode,td.dev_status as deviceStatus,
tdl.ly_user as lyId,tdl.user_type as lyType
tdl.ly_user as lyId,tdl.user_type as lyType,tdd.dict_label AS deviceTypeName
from tb_device td
left join sys_dict_data tdd on tdd.dict_value=td.dev_type AND tdd .dict_type='sys_device_type'
left join tb_dev_ly tdl on td.id = tdl.dev_id
where td.del_flag = 0
<if test="deviceType != null and deviceType!=''">

View File

@ -6,9 +6,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!--边带列表-->
<select id="getSidebandLists" resultType="com.bonus.common.entity.bracelet.vo.SidebandVo">
select ss.id as sidebandId,ss.sideband_name as sidebandName,ss.sideband_code as sidebandCode,project_name as projectName,
gt_code as gtCode,bind_time as bindTime,count(tb.id) as bindNum,remarks as remarks
gt_code as gtCode,bind_time as bindTime,(count(distinct tb.id) + count(distinct tsb.id)) as bindNum,remarks as remarks
from sys_sideband ss
left join tb_device tb on ss.id = tb.bind_id and tb.del_flag = 0
left join tb_sh_box tsb on ss.id = tsb.bind_id and tsb.del_flag = 0
where ss.del_flag = 0
<if test="sidebandName != null and sidebandName!=''">
AND INSTR(ss.sideband_name,#{sidebandName}) > 0
@ -31,31 +32,74 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!--杆塔绑定设备列表-->
<select id="getDeviceLists" resultType="com.bonus.common.entity.bracelet.vo.SidebandDeviceVo">
select ss.id as sidebandId,ss.sideband_name as sidebandName,td.id as deviceId,td.dev_type as deviceType,td.dev_name as deviceName,
td.dev_code as deviceCode,td.dev_status as deviceStatus,tdl.ly_user as lyId,tdl.user_type as lyType
select * from(
select ss.id as sidebandId,ss.sideband_name as sidebandName,td.id as deviceId,td.dev_type as
deviceType,td.dev_name as deviceName,
td.dev_code as deviceCode,td.dev_status as deviceStatus,tdl.ly_user as lyId,tdl.user_type as lyType,null as
lyName,tdd.dict_label AS deviceTypeName
from sys_sideband ss
left join tb_device td on ss.id=td.bind_id and td.del_flag = 0
left join sys_dict_data tdd on tdd.dict_value=td.dev_type AND tdd .dict_type='sys_device_type'
left join tb_dev_ly tdl on td.id = tdl.dev_id
where ss.id = #{sidebandId} and ss.del_flag = 0 and (td.id is not null or td.id = '')
union all
select ss.id as sidebandId,ss.sideband_name as sidebandName,tsb.id as deviceId,'shx' as deviceType,tsb.box_name
as deviceName,tsb.box_code as deviceCode,0 as deviceStatus,null as lyId,null as lyType, twt.team_leader as lyName,
tdd.dict_label AS deviceTypeName
from sys_sideband ss
left join tb_sh_box tsb on ss.id = tsb.bind_id and tsb.del_flag = 0
left join sys_dict_data tdd on tdd.dict_value = 'shx' AND tdd .dict_type='sys_device_type'
left join t_work_team twt on tsb.team_id = twt.team_id and twt.del_flag = 0
where ss.id = #{sidebandId} and ss.del_flag = 0 and (tsb.id is not null or tsb.id = '')
)a
<where>
<if test="keyword != null and keyword!=''">
AND (INSTR(td.dev_type,#{keyword}) > 0 or
INSTR(td.dev_name,#{keyword}) > 0 or
INSTR(td.dev_code,#{keyword}) > 0 )
AND (INSTR(a.deviceTypeName,#{keyword}) > 0 or
INSTR(a.deviceName,#{keyword}) > 0 or
INSTR(a.deviceCode,#{keyword}) > 0 )
</if>
</where>
</select>
<!--杆塔绑定设备列表2-->
<select id="getShLists" resultType="com.bonus.common.entity.bracelet.vo.SidebandDeviceVo">
select ss.id as sidebandId,ss.sideband_name as sidebandName,tsb.id as deviceId,'shx' as deviceType,tsb.box_name as deviceName,
tsb.box_code as deviceCode,twt.team_leader as lyName, tdd.dict_label AS deviceTypeName
from sys_sideband ss
left join tb_sh_box tsb on ss.id = tsb.bind_id and tsb.del_flag = 0
left join sys_dict_data tdd on tdd.dict_value = 'shx' AND tdd .dict_type='sys_device_type'
left join t_work_team twt on tsb.team_id = twt.team_id and twt.del_flag = 0
where ss.id = #{sidebandId} and ss.del_flag = 0 and (tsb.id is not null or tsb.id = '')
<if test="keyword != null and keyword!=''">
AND (INSTR(tdd.dict_label,#{keyword}) > 0 or
INSTR(tsb.box_name,#{keyword}) > 0 or
INSTR(tsb.box_code,#{keyword}) > 0 )
</if>
order by ss.id ASC
</select>
<!--杆塔未绑定设备列表-->
<select id="getDeviceNoLists" resultType="com.bonus.common.entity.bracelet.vo.SidebandDeviceVo">
select id as deviceId,dev_type as deviceType,dev_name as deviceName,dev_code as deviceCode
select * from(
select id as deviceId,dev_type as deviceType,dev_name as deviceName,dev_code as deviceCode,tdd.dict_label AS
deviceTypeName
from tb_device td
where bind_id is null and del_flag = 0
left join sys_dict_data tdd on tdd.dict_value=td.dev_type AND tdd .dict_type='sys_device_type'
where bind_id is null and del_flag = 0
union all
select id as deviceId,'shx' as deviceType,box_name as deviceName,box_code as deviceCode,tdd.dict_label AS
deviceTypeName
from tb_sh_box tsb
left join sys_dict_data tdd on tdd.dict_value='shx' AND tdd .dict_type='sys_device_type'
where bind_id is null and del_flag = 0
)a
<where>
<if test="keyword != null and keyword!=''">
AND (INSTR(td.dev_type,#{keyword}) > 0 or
INSTR(td.dev_name,#{keyword}) > 0 or
INSTR(td.dev_code,#{keyword}) > 0 )
AND (INSTR(a.deviceTypeName,#{keyword}) > 0 or
INSTR(a.deviceName,#{keyword}) > 0 or
INSTR(a.deviceCode,#{keyword}) > 0 )
</if>
order by td.id ASC
</where>
</select>
<!--杆塔下拉选-->
@ -133,6 +177,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{deviceId}
</update>
<!--解除绑定2-->
<update id="delSh">
UPDATE tb_sh_box
SET bind_id = null
where id = #{deviceId}
</update>
<!--获取人员管理表中领用人名称-->
<select id="getDeviceLyName" parameterType="int" resultType="java.lang.String">
select name
@ -154,4 +205,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{deviceId}
</update>
<!--绑定-->
<update id="bindSh">
UPDATE tb_sh_box
SET bind_id = #{sidebandId}
where id = #{deviceId}
</update>
</mapper>