Compare commits
1 Commits
6170
...
ebd8668178
Author | SHA1 | Date | |
---|---|---|---|
ebd8668178 |
@ -67,7 +67,7 @@ public class DeviceShareController extends BaseController {
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/permission")
|
||||
public R<Void> permission(@Validated(AddGroup.class) @RequestBody AppDeviceShareBo bo) {
|
||||
return toAjax(deviceShareService.permission(bo));
|
||||
return toAjax(deviceShareService.deviceShare(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -212,46 +212,6 @@ public class DeviceShareService {
|
||||
LambdaQueryWrapper<AppDeviceBindRecord> qw = new LambdaQueryWrapper<>();
|
||||
qw.eq(AppDeviceBindRecord::getDeviceId, bo.getDeviceId());
|
||||
AppDeviceBindRecord bindRecord = appDeviceBindRecordMapper.selectOne(qw);
|
||||
if (bindRecord == null) {
|
||||
throw new ServiceException("设备未绑定");
|
||||
}
|
||||
Long userId = bindRecord.getBindingUserId();
|
||||
|
||||
LambdaQueryWrapper<AppDeviceShare> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(AppDeviceShare::getDeviceId, bo.getDeviceId());
|
||||
lqw.eq(AppDeviceShare::getPhonenumber, bo.getPhonenumber());
|
||||
Long count = appDeviceShareMapper.selectCount(lqw);
|
||||
if (count > 0) {
|
||||
|
||||
UpdateWrapper<AppDeviceShare> uw = new UpdateWrapper<>();
|
||||
uw.eq("device_id", bo.getDeviceId());
|
||||
uw.eq("phonenumber", bo.getPhonenumber());
|
||||
uw.set("permission", bo.getPermission());
|
||||
uw.set("update_by", userId);
|
||||
uw.set("update_time", new Date());
|
||||
|
||||
return appDeviceShareMapper.update(uw);
|
||||
} else {
|
||||
AppDeviceShare appDeviceShare = new AppDeviceShare();
|
||||
appDeviceShare.setDeviceId(bo.getDeviceId());
|
||||
appDeviceShare.setPhonenumber(bo.getPhonenumber());
|
||||
appDeviceShare.setPermission(bo.getPermission());
|
||||
appDeviceShare.setCreateBy(userId);
|
||||
return appDeviceShareMapper.insert(appDeviceShare);
|
||||
}
|
||||
}
|
||||
|
||||
public int permission(AppDeviceShareBo bo) {
|
||||
Device device = deviceMapper.selectById(bo.getDeviceId());
|
||||
if (device == null) {
|
||||
throw new ServiceException("设备不存在");
|
||||
}
|
||||
LambdaQueryWrapper<AppDeviceBindRecord> qw = new LambdaQueryWrapper<>();
|
||||
qw.eq(AppDeviceBindRecord::getDeviceId, bo.getDeviceId());
|
||||
AppDeviceBindRecord bindRecord = appDeviceBindRecordMapper.selectOne(qw);
|
||||
if (bindRecord == null) {
|
||||
throw new ServiceException("设备未绑定");
|
||||
}
|
||||
Long userId = bindRecord.getBindingUserId();
|
||||
|
||||
LambdaQueryWrapper<AppDeviceShare> lqw = new LambdaQueryWrapper<>();
|
||||
|
@ -60,7 +60,7 @@ public class AppDeviceShareBo extends BaseEntity {
|
||||
/**
|
||||
* 分享时间
|
||||
*/
|
||||
private String shareStartTime;
|
||||
private String shareEndTime;
|
||||
private Date shareStartTime;
|
||||
private Date shareEndTime;
|
||||
|
||||
}
|
||||
|
@ -109,9 +109,4 @@ public class AppDeviceShareVo implements Serializable {
|
||||
* 告警状态(0解除告警,1告警)
|
||||
*/
|
||||
private String alarmStatus;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
}
|
||||
|
@ -72,12 +72,9 @@
|
||||
and ad.device_id = #{bo.deviceId}
|
||||
</if>
|
||||
<if test="bo.shareUser != null">
|
||||
and ad.phonenumber like concat('%',#{bo.shareUser},'%')
|
||||
and u.user_name = #{bo.shareUser}
|
||||
</if>
|
||||
<if test="bo.phonenumber != null">
|
||||
and ad.phonenumber like concat('%',#{bo.phonenumber},'%')
|
||||
</if>
|
||||
<if test="bo.shareStartTime != null and bo.shareEndTime != null">
|
||||
<if test="bo.shareStartTime != null and bo.hareEndTime != null">
|
||||
and ad.create_time between #{bo.shareStartTime} and #{bo.shareEndTime}
|
||||
</if>
|
||||
</where>
|
||||
|
@ -26,4 +26,24 @@ public class EquipmentClassificationVo {
|
||||
*/
|
||||
private Integer devices4GAndBluetooth = 0;
|
||||
|
||||
/**
|
||||
* 设备总数
|
||||
*/
|
||||
private Integer total;
|
||||
|
||||
|
||||
/**
|
||||
* 计算设备总数
|
||||
*
|
||||
* @return 设备总数
|
||||
*/
|
||||
public Integer getTotal() {
|
||||
if (total == null) {
|
||||
total = (equipment4G == null ? 0 : equipment4G) +
|
||||
(deviceBluetooth == null ? 0 : deviceBluetooth) +
|
||||
(devices4GAndBluetooth == null ? 0 : devices4GAndBluetooth);
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -630,6 +630,7 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
|
||||
@Override
|
||||
public EquipmentClassificationVo getEquipmentClassification() {
|
||||
EquipmentClassificationVo equipmentClassification = deviceMapper.getEquipmentClassification();
|
||||
equipmentClassification.getTotal();
|
||||
return equipmentClassification;
|
||||
}
|
||||
|
||||
|
@ -321,11 +321,11 @@
|
||||
<!-- 获取数据总览 -->
|
||||
<select id="getDataOverview" resultType="com.fuyuanshen.equipment.domain.vo.DataOverviewVo">
|
||||
SELECT (SELECT COUNT(1) FROM device) AS devicesNumber,
|
||||
(SELECT COUNT(1) FROM device WHERE device_status = 1) AS equipmentOnline,
|
||||
(SELECT COUNT(1) FROM device WHERE online_status = 1) AS equipmentOnline,
|
||||
(SELECT COUNT(1) FROM device WHERE DATE (create_time) = CURDATE()) AS bindingNew, (
|
||||
SELECT COUNT (1)
|
||||
FROM device
|
||||
WHERE device_status = 2) AS equipmentAbnormal
|
||||
WHERE online_status = 2) AS equipmentAbnormal
|
||||
</select>
|
||||
|
||||
<!-- 获取设备分类 -->
|
||||
|
Reference in New Issue
Block a user