|
@@ -19,8 +19,10 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import com.github.yitter.idgen.YitIdHelper;
|
|
import com.xy.collections.list.JArrayList;
|
|
import com.xy.collections.list.JArrayList;
|
|
import com.xy.collections.list.JList;
|
|
import com.xy.collections.list.JList;
|
|
|
|
+import com.xy.collections.map.JHashMap;
|
|
import com.xy.collections.map.JMap;
|
|
import com.xy.collections.map.JMap;
|
|
import com.xy.config.DeviceThreadPoolConfig;
|
|
import com.xy.config.DeviceThreadPoolConfig;
|
|
import com.xy.consts.DictConsts;
|
|
import com.xy.consts.DictConsts;
|
|
@@ -53,7 +55,6 @@ import io.swagger.annotations.ApiOperation;
|
|
import jodd.introspector.MapperFunction;
|
|
import jodd.introspector.MapperFunction;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
-import org.apache.ibatis.annotations.Param;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
@@ -130,6 +131,8 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
|
|
|
private final DeviceCreateIdsServiceImpl deviceCreateIdsService;
|
|
private final DeviceCreateIdsServiceImpl deviceCreateIdsService;
|
|
|
|
|
|
|
|
+ private final DeviceAnnualFeeServiceImpl deviceAnnualFeeService;
|
|
|
|
+
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@ApiOperation("设备列表-管理员")
|
|
@ApiOperation("设备列表-管理员")
|
|
@@ -903,6 +906,34 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
+ //新增设备年费
|
|
|
|
+ FunctionUtils.ParamsNoResult<List<DeviceInfo>> deviceAnnualFee = deviceInfos -> {
|
|
|
|
+ Map<String, SysDictRedis> stringSysDictRedisMap = SysDictUtils.get("merc_device_annual_fee");
|
|
|
|
+ if (stringSysDictRedisMap.isEmpty()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ JList<String> mercIds = new JHashMap<>(stringSysDictRedisMap).getValues().getProperty(SysDictRedis::getCode);
|
|
|
|
+ if (!mercIds.contains(String.valueOf(auth.getMercId()))) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ LocalDateTime now = LocalDateTime.now();
|
|
|
|
+ deviceInfos.forEach(deviceInfo -> {
|
|
|
|
+ long count = deviceAnnualFeeService.count(new LambdaQueryWrapper<DeviceAnnualFee>()
|
|
|
|
+ .eq(DeviceAnnualFee::getDeviceId, deviceInfo.getDeviceId())
|
|
|
|
+ .eq(DeviceAnnualFee::getMercId, auth.getMercId())
|
|
|
|
+ );
|
|
|
|
+ if (count > 0) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ deviceAnnualFeeService.save(new DeviceAnnualFee()
|
|
|
|
+ .setId(YitIdHelper.nextId())
|
|
|
|
+ .setMercId(auth.getMercId())
|
|
|
|
+ .setDeviceId(deviceInfo.getDeviceId())
|
|
|
|
+ .setTimeout(now)
|
|
|
|
+ .setCreateTime(now)
|
|
|
|
+ );
|
|
|
|
+ });
|
|
|
|
+ };
|
|
check.run();
|
|
check.run();
|
|
Long mercId = auth.getMercId();
|
|
Long mercId = auth.getMercId();
|
|
String mercCode = auth.getMercCode();
|
|
String mercCode = auth.getMercCode();
|
|
@@ -992,6 +1023,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
if (Emptys.check(deviceStatuses)) {
|
|
if (Emptys.check(deviceStatuses)) {
|
|
deviceStatusService.updateBatchById(deviceStatuses);
|
|
deviceStatusService.updateBatchById(deviceStatuses);
|
|
}
|
|
}
|
|
|
|
+ deviceAnnualFee.run(deviceInfos);
|
|
return R.ok(Boolean.TRUE);
|
|
return R.ok(Boolean.TRUE);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1928,6 +1960,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
|
|
|
/**
|
|
/**
|
|
* 设备统计PC端
|
|
* 设备统计PC端
|
|
|
|
+ *
|
|
* @param page
|
|
* @param page
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@@ -1935,7 +1968,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
DeviceInfoDto.PageCount count = new DeviceInfoDto.PageCount().setActiveNum(0).setOffLineNum(0).setTotal(0).setOnlineNum(0).setNoActiveNum(0);
|
|
DeviceInfoDto.PageCount count = new DeviceInfoDto.PageCount().setActiveNum(0).setOffLineNum(0).setTotal(0).setOnlineNum(0).setNoActiveNum(0);
|
|
|
|
|
|
List<Long> myDeviceIds = page.getMyDeviceIds();
|
|
List<Long> myDeviceIds = page.getMyDeviceIds();
|
|
- if(CollUtil.isEmpty(myDeviceIds)){
|
|
|
|
|
|
+ if (CollUtil.isEmpty(myDeviceIds)) {
|
|
return count;
|
|
return count;
|
|
}
|
|
}
|
|
List<DeviceStatus> deviceStatuses = deviceStatusService.listByIds(page.getMyDeviceIds());
|
|
List<DeviceStatus> deviceStatuses = deviceStatusService.listByIds(page.getMyDeviceIds());
|
|
@@ -1956,10 +1989,11 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
.filter(device -> device.getActiveState() == 2)
|
|
.filter(device -> device.getActiveState() == 2)
|
|
.count();
|
|
.count();
|
|
count.setNoActiveNum(unActiveNum.intValue());
|
|
count.setNoActiveNum(unActiveNum.intValue());
|
|
- count.setActiveNum(total-unActiveNum.intValue());
|
|
|
|
|
|
+ count.setActiveNum(total - unActiveNum.intValue());
|
|
count.setTotal(total);
|
|
count.setTotal(total);
|
|
- return count;
|
|
|
|
|
|
+ return count;
|
|
}
|
|
}
|
|
|
|
+
|
|
public PageBean<DeviceInfoDto.Vo2> queryPage(DeviceInfoDto.Page page) {
|
|
public PageBean<DeviceInfoDto.Vo2> queryPage(DeviceInfoDto.Page page) {
|
|
IPage<DeviceInfoQueryPage> iPage = baseMapper.queryPage(toIPage(page.getPage()), page);
|
|
IPage<DeviceInfoQueryPage> iPage = baseMapper.queryPage(toIPage(page.getPage()), page);
|
|
PageBean<DeviceInfoDto.Vo2> pageBean = toPageBean(DeviceInfoDto.Vo2.class, iPage);
|
|
PageBean<DeviceInfoDto.Vo2> pageBean = toPageBean(DeviceInfoDto.Vo2.class, iPage);
|