|
@@ -20,16 +20,15 @@ import com.zcxk.rmcp.api.dto.device.DeviceInputDto;
|
|
|
import com.zcxk.rmcp.api.dto.device.DeviceQueryDto;
|
|
|
import com.zcxk.rmcp.api.dto.device.ValveDto;
|
|
|
import com.zcxk.rmcp.api.enums.DeviceStatusEnum;
|
|
|
+import com.zcxk.rmcp.api.enums.OperationTypeEnum;
|
|
|
import com.zcxk.rmcp.api.enums.RmcpErrorEnum;
|
|
|
import com.zcxk.rmcp.api.enums.ValveStatusEnum;
|
|
|
import com.zcxk.rmcp.api.vo.*;
|
|
|
import com.zcxk.rmcp.core.dao.DeviceAlarmMapper;
|
|
|
+import com.zcxk.rmcp.core.dao.DeviceCommandMapper;
|
|
|
import com.zcxk.rmcp.core.dao.DeviceMapper;
|
|
|
import com.zcxk.rmcp.core.dao.InstallListMapper;
|
|
|
-import com.zcxk.rmcp.core.entity.Community;
|
|
|
-import com.zcxk.rmcp.core.entity.Device;
|
|
|
-import com.zcxk.rmcp.core.entity.Org;
|
|
|
-import com.zcxk.rmcp.core.entity.Product;
|
|
|
+import com.zcxk.rmcp.core.entity.*;
|
|
|
import com.zcxk.rmcp.web.excel.download.adapter.DeviceExcelFillAdapter;
|
|
|
import com.zcxk.rmcp.web.excel.download.service.DeviceDownloadExcelServiceImpl;
|
|
|
import com.zcxk.rmcp.web.excel.model.DeviceImportData;
|
|
@@ -82,6 +81,8 @@ public class DeviceServiceImpl implements DeviceService{
|
|
|
private DeviceAlarmMapper deviceAlarmMapper;
|
|
|
@Autowired
|
|
|
private MongoTemplate mongoTemplate;
|
|
|
+ @Resource
|
|
|
+ private DeviceCommandMapper deviceCommandMapper;
|
|
|
|
|
|
@Override
|
|
|
public int insertSelective(Device record) {
|
|
@@ -535,7 +536,31 @@ public class DeviceServiceImpl implements DeviceService{
|
|
|
|
|
|
@Override
|
|
|
public void batchValve(ValveDto dto) {
|
|
|
- log.info("begin batchValve dto:{}",JSON.toJSON(dto));
|
|
|
+ LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
+ log.info("begin batchValve dto:{}",JSON.toJSONString(dto));
|
|
|
+ if (!dto.getIds().isEmpty()) {
|
|
|
+ for (Long deviceId : dto.getIds()) {
|
|
|
+ DeviceCommand deviceCommand = new DeviceCommand();
|
|
|
+ deviceCommand.setDeviceId(deviceId);
|
|
|
+ deviceCommand.setCommandType(dto.getValveStatus());
|
|
|
+ deviceCommand.setCommandStatus(0);
|
|
|
+ deviceCommand.setOperationType(OperationTypeEnum.HAND.getCode());
|
|
|
+ deviceCommand.setRemark("");
|
|
|
+ deviceCommand.setCommandId("");
|
|
|
+ deviceCommand.setIssueDate(LocalDateTime.now());
|
|
|
+ deviceCommand.setParams("");
|
|
|
+ deviceCommand.setPlatform(1);
|
|
|
+ deviceCommand.setRelationId("");
|
|
|
+ deviceCommand.setPushStatus(0);
|
|
|
+ deviceCommand.setTenantId(loginUser.getTenantId());
|
|
|
+ deviceCommand.setCreateDate(LocalDateTime.now());
|
|
|
+ deviceCommand.setCreateBy(UserUtil.getUsername());
|
|
|
+ deviceCommand.setUpdateDate(LocalDateTime.now());
|
|
|
+ deviceCommand.setUpdateBy(UserUtil.getUsername());
|
|
|
+ deviceCommand.setStatus(StatusEnum.OK.getCode());
|
|
|
+ deviceCommandMapper.insertSelective(deviceCommand);
|
|
|
+ }
|
|
|
+ }
|
|
|
log.info("end batchValve");
|
|
|
}
|
|
|
|