设备详情功能开发
This commit is contained in:
@ -12,6 +12,7 @@ import com.fuyuanshen.app.domain.vo.AppPersonnelInfoVo;
|
|||||||
import com.fuyuanshen.app.mapper.AppPersonnelInfoMapper;
|
import com.fuyuanshen.app.mapper.AppPersonnelInfoMapper;
|
||||||
import com.fuyuanshen.app.mapper.equipment.APPDeviceMapper;
|
import com.fuyuanshen.app.mapper.equipment.APPDeviceMapper;
|
||||||
import com.fuyuanshen.common.core.utils.MapstructUtils;
|
import com.fuyuanshen.common.core.utils.MapstructUtils;
|
||||||
|
import com.fuyuanshen.common.core.utils.ObjectUtils;
|
||||||
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||||
import com.fuyuanshen.common.satoken.utils.AppLoginHelper;
|
import com.fuyuanshen.common.satoken.utils.AppLoginHelper;
|
||||||
@ -31,6 +32,8 @@ import org.springframework.stereotype.Service;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.apache.poi.hslf.usermodel.HSLFFontInfo.FontRenderType.device;
|
||||||
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@ -138,6 +141,9 @@ public class AppDeviceBizService {
|
|||||||
|
|
||||||
public AppDeviceDetailVo getInfo(Long id) {
|
public AppDeviceDetailVo getInfo(Long id) {
|
||||||
Device device = deviceMapper.selectById(id);
|
Device device = deviceMapper.selectById(id);
|
||||||
|
if (device == null) {
|
||||||
|
throw new RuntimeException("请先将设备入库!!!");
|
||||||
|
}
|
||||||
AppDeviceDetailVo vo = new AppDeviceDetailVo();
|
AppDeviceDetailVo vo = new AppDeviceDetailVo();
|
||||||
vo.setDeviceId(device.getId());
|
vo.setDeviceId(device.getId());
|
||||||
vo.setDeviceName(device.getDeviceName());
|
vo.setDeviceName(device.getDeviceName());
|
||||||
@ -152,7 +158,11 @@ public class AppDeviceBizService {
|
|||||||
}
|
}
|
||||||
vo.setBluetoothName(device.getBluetoothName());
|
vo.setBluetoothName(device.getBluetoothName());
|
||||||
|
|
||||||
AppPersonnelInfo appPersonnelInfo = appPersonnelInfoMapper.selectById(device.getId());
|
vo.setSendMsg(device.getSendMsg());
|
||||||
|
|
||||||
|
QueryWrapper<AppPersonnelInfo> qw = new QueryWrapper<AppPersonnelInfo>()
|
||||||
|
.eq("device_id", device.getId());
|
||||||
|
AppPersonnelInfo appPersonnelInfo = appPersonnelInfoMapper.selectOne(qw);
|
||||||
if(appPersonnelInfo != null){
|
if(appPersonnelInfo != null){
|
||||||
AppPersonnelInfoVo personnelInfoVo = MapstructUtils.convert(appPersonnelInfo, AppPersonnelInfoVo.class);
|
AppPersonnelInfoVo personnelInfoVo = MapstructUtils.convert(appPersonnelInfo, AppPersonnelInfoVo.class);
|
||||||
vo.setPersonnelInfo(personnelInfoVo);
|
vo.setPersonnelInfo(personnelInfoVo);
|
||||||
@ -161,7 +171,23 @@ public class AppDeviceBizService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean registerPersonInfo(AppPersonnelInfoBo bo) {
|
public boolean registerPersonInfo(AppPersonnelInfoBo bo) {
|
||||||
|
Long deviceId = bo.getDeviceId();
|
||||||
|
QueryWrapper<AppPersonnelInfo> qw = new QueryWrapper<AppPersonnelInfo>()
|
||||||
|
.eq("device_id", deviceId);
|
||||||
|
List<AppPersonnelInfoVo> appPersonnelInfoVos = appPersonnelInfoMapper.selectVoList(qw);
|
||||||
|
if(ObjectUtils.length(appPersonnelInfoVos) == 0){
|
||||||
AppPersonnelInfo appPersonnelInfo = MapstructUtils.convert(bo, AppPersonnelInfo.class);
|
AppPersonnelInfo appPersonnelInfo = MapstructUtils.convert(bo, AppPersonnelInfo.class);
|
||||||
return appPersonnelInfoMapper.insertOrUpdate(appPersonnelInfo);
|
return appPersonnelInfoMapper.insertOrUpdate(appPersonnelInfo);
|
||||||
|
}else {
|
||||||
|
UpdateWrapper<AppPersonnelInfo> uw = new UpdateWrapper<>();
|
||||||
|
uw.eq("device_id", deviceId)
|
||||||
|
.set("name", bo.getName())
|
||||||
|
.set("position", bo.getPosition())
|
||||||
|
.set("unit_name", bo.getUnitName())
|
||||||
|
.set("code",bo.getCode());
|
||||||
|
return appPersonnelInfoMapper.update(null, uw)>0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,11 @@ public class AppPersonnelInfo extends TenantEntity {
|
|||||||
*/
|
*/
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 职位
|
||||||
|
*/
|
||||||
|
private String position;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单位名称
|
* 单位名称
|
||||||
*/
|
*/
|
||||||
|
@ -23,13 +23,11 @@ public class AppPersonnelInfoBo extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 主键
|
* 主键
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "主键不能为空", groups = { AddGroup.class, EditGroup.class })
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备id
|
* 设备id
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "设备id不能为空", groups = { AddGroup.class, EditGroup.class })
|
|
||||||
private Long deviceId;
|
private Long deviceId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,6 +35,11 @@ public class AppPersonnelInfoBo extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 职位
|
||||||
|
*/
|
||||||
|
private String position;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门名称
|
* 部门名称
|
||||||
*/
|
*/
|
||||||
@ -52,5 +55,8 @@ public class AppPersonnelInfoBo extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String sendMsg;
|
private String sendMsg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID号
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
}
|
}
|
||||||
|
@ -69,4 +69,9 @@ public class AppDeviceDetailVo {
|
|||||||
* 人员信息
|
* 人员信息
|
||||||
*/
|
*/
|
||||||
private AppPersonnelInfoVo personnelInfo;
|
private AppPersonnelInfoVo personnelInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送信息
|
||||||
|
*/
|
||||||
|
private String sendMsg;
|
||||||
}
|
}
|
||||||
|
@ -30,5 +30,5 @@ public class AppDeviceBo {
|
|||||||
|
|
||||||
private String sendMsg;
|
private String sendMsg;
|
||||||
|
|
||||||
private String deviceId;
|
private Long deviceId;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user