Commit e3121473 by YG8999

保洁结束任务时断电

parent c6249b21
...@@ -24,6 +24,7 @@ import share.common.enums.CleaningStatusEnum; ...@@ -24,6 +24,7 @@ import share.common.enums.CleaningStatusEnum;
import share.system.domain.SCleanRecords; import share.system.domain.SCleanRecords;
import share.system.domain.SConsumer; import share.system.domain.SConsumer;
import share.system.domain.vo.FrontTokenComponent; import share.system.domain.vo.FrontTokenComponent;
import share.system.service.DeviceOpService;
import share.system.service.ISCleanRecordsService; import share.system.service.ISCleanRecordsService;
import share.common.utils.poi.ExcelUtil; import share.common.utils.poi.ExcelUtil;
import share.common.core.page.TableDataInfo; import share.common.core.page.TableDataInfo;
...@@ -122,7 +123,7 @@ public class SCleanRecordsController extends BaseController ...@@ -122,7 +123,7 @@ public class SCleanRecordsController extends BaseController
sCleanRecords.setConsumerId(user.getId()); sCleanRecords.setConsumerId(user.getId());
sCleanRecords.setEndDate(DateUtil.date()); sCleanRecords.setEndDate(DateUtil.date());
sCleanRecords.setStatus(CleaningStatusEnum.CLEANED.getCode()); sCleanRecords.setStatus(CleaningStatusEnum.CLEANED.getCode());
return toAjax(sCleanRecordsService.updateSCleanRecords(sCleanRecords)); return toAjax(sCleanRecordsService.endCleanRecords(sCleanRecords));
} }
/** /**
......
...@@ -87,4 +87,10 @@ public interface ISCleanRecordsService extends IService<SCleanRecords> ...@@ -87,4 +87,10 @@ public interface ISCleanRecordsService extends IService<SCleanRecords>
List<SCleanRecords> unCleanedListByRoomIds(List<Long> roomIds); List<SCleanRecords> unCleanedListByRoomIds(List<Long> roomIds);
/**
* 结束保洁
* @param sCleanRecords
* @return
*/
int endCleanRecords(SCleanRecords sCleanRecords);
} }
...@@ -7,6 +7,7 @@ import cn.hutool.core.date.DateUtil; ...@@ -7,6 +7,7 @@ import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import share.common.enums.CleaningStatusEnum; import share.common.enums.CleaningStatusEnum;
import share.common.enums.OpTypeEnum;
import share.common.enums.RoleTypeEnum; import share.common.enums.RoleTypeEnum;
import share.common.utils.DateUtils; import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -20,6 +21,7 @@ import share.system.domain.SCleanRecords; ...@@ -20,6 +21,7 @@ import share.system.domain.SCleanRecords;
import share.system.mapper.SConsumerMapper; import share.system.mapper.SConsumerMapper;
import share.system.mapper.SRoomMapper; import share.system.mapper.SRoomMapper;
import share.system.mapper.SStoreMapper; import share.system.mapper.SStoreMapper;
import share.system.service.DeviceOpService;
import share.system.service.ISCleanRecordsService; import share.system.service.ISCleanRecordsService;
import share.system.service.SmsService; import share.system.service.SmsService;
...@@ -40,6 +42,8 @@ public class SCleanRecordsServiceImpl extends ServiceImpl<SCleanRecordsMapper,SC ...@@ -40,6 +42,8 @@ public class SCleanRecordsServiceImpl extends ServiceImpl<SCleanRecordsMapper,SC
private SStoreMapper sStoreMapper; private SStoreMapper sStoreMapper;
@Autowired @Autowired
private SmsService smsService; private SmsService smsService;
@Autowired
private DeviceOpService deviceOpService;
/** /**
* 查询保洁记录 * 查询保洁记录
...@@ -228,6 +232,20 @@ public class SCleanRecordsServiceImpl extends ServiceImpl<SCleanRecordsMapper,SC ...@@ -228,6 +232,20 @@ public class SCleanRecordsServiceImpl extends ServiceImpl<SCleanRecordsMapper,SC
return list(queryWrapper); return list(queryWrapper);
} }
@Override
public int endCleanRecords(SCleanRecords sCleanRecords) {
SCleanRecords records = baseMapper.selectSCleanRecordsById(sCleanRecords.getId());
if (records == null) {
throw new RuntimeException("当前保洁任务不存在!");
}
int index = updateSCleanRecords(sCleanRecords);
if (index > 0) {
// 断电
deviceOpService.openOrCloseDevice(records.getRoomId(), records.getPhone(), OpTypeEnum.CUT_ELECTRIC.getCode(), true, 5);
}
return index;
}
private void sendSms(Long storeId,SStore store, SRoom room) { private void sendSms(Long storeId,SStore store, SRoom room) {
sConsumerMapper.selectListByStoreId(storeId).stream().forEach(item -> { sConsumerMapper.selectListByStoreId(storeId).stream().forEach(item -> {
// 循环发送短信提示门店保洁打扫卫生 // 循环发送短信提示门店保洁打扫卫生
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment