Commit c87b0c38 by YG8999

保洁记录

parent 4def0d01
...@@ -21,6 +21,8 @@ import share.common.core.controller.BaseController; ...@@ -21,6 +21,8 @@ import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult; import share.common.core.domain.AjaxResult;
import share.common.enums.BusinessType; import share.common.enums.BusinessType;
import share.system.domain.SCleanRecords; import share.system.domain.SCleanRecords;
import share.system.domain.SConsumer;
import share.system.domain.vo.FrontTokenComponent;
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;
...@@ -46,6 +48,8 @@ public class SCleanRecordsController extends BaseController ...@@ -46,6 +48,8 @@ public class SCleanRecordsController extends BaseController
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SCleanRecords sCleanRecords) public TableDataInfo list(SCleanRecords sCleanRecords)
{ {
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
sCleanRecords.setConsumerId(user.getId());
startPage(); startPage();
List<SCleanRecords> list = sCleanRecordsService.selectSCleanRecordsList(sCleanRecords); List<SCleanRecords> list = sCleanRecordsService.selectSCleanRecordsList(sCleanRecords);
return getDataTable(list); return getDataTable(list);
...@@ -58,6 +62,8 @@ public class SCleanRecordsController extends BaseController ...@@ -58,6 +62,8 @@ public class SCleanRecordsController extends BaseController
@GetMapping("/unCleanList") @GetMapping("/unCleanList")
public TableDataInfo unCleanList(SCleanRecords sCleanRecords) public TableDataInfo unCleanList(SCleanRecords sCleanRecords)
{ {
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
sCleanRecords.setConsumerId(user.getId());
startPage(); startPage();
List<SCleanRecords> list = sCleanRecordsService.unCleanList(sCleanRecords); List<SCleanRecords> list = sCleanRecordsService.unCleanList(sCleanRecords);
return getDataTable(list); return getDataTable(list);
...@@ -70,6 +76,8 @@ public class SCleanRecordsController extends BaseController ...@@ -70,6 +76,8 @@ public class SCleanRecordsController extends BaseController
@GetMapping("/myCleanList") @GetMapping("/myCleanList")
public TableDataInfo myCleanList(SCleanRecords sCleanRecords) public TableDataInfo myCleanList(SCleanRecords sCleanRecords)
{ {
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
sCleanRecords.setConsumerId(user.getId());
startPage(); startPage();
List<SCleanRecords> list = sCleanRecordsService.myCleanList(sCleanRecords); List<SCleanRecords> list = sCleanRecordsService.myCleanList(sCleanRecords);
return getDataTable(list); return getDataTable(list);
...@@ -93,9 +101,11 @@ public class SCleanRecordsController extends BaseController ...@@ -93,9 +101,11 @@ public class SCleanRecordsController extends BaseController
@PostMapping(value = "/startClean") @PostMapping(value = "/startClean")
public AjaxResult startClean(@RequestBody SCleanRecords sCleanRecords) public AjaxResult startClean(@RequestBody SCleanRecords sCleanRecords)
{ {
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
sCleanRecords.setConsumerId(user.getId());
sCleanRecords.setStartDate(DateUtil.date()); sCleanRecords.setStartDate(DateUtil.date());
sCleanRecords.setStatus(1); sCleanRecords.setStatus(1);
return toAjax(sCleanRecordsService.updateSCleanRecords(sCleanRecords)); return toAjax(sCleanRecordsService.startCleanRecords(sCleanRecords));
} }
/** /**
...@@ -106,6 +116,8 @@ public class SCleanRecordsController extends BaseController ...@@ -106,6 +116,8 @@ public class SCleanRecordsController extends BaseController
@PostMapping(value = "/endClean") @PostMapping(value = "/endClean")
public AjaxResult endClean(@RequestBody SCleanRecords sCleanRecords) public AjaxResult endClean(@RequestBody SCleanRecords sCleanRecords)
{ {
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
sCleanRecords.setConsumerId(user.getId());
sCleanRecords.setEndDate(DateUtil.date()); sCleanRecords.setEndDate(DateUtil.date());
sCleanRecords.setStatus(2); sCleanRecords.setStatus(2);
return toAjax(sCleanRecordsService.updateSCleanRecords(sCleanRecords)); return toAjax(sCleanRecordsService.updateSCleanRecords(sCleanRecords));
......
...@@ -80,4 +80,6 @@ public interface ISCleanRecordsService ...@@ -80,4 +80,6 @@ public interface ISCleanRecordsService
* @return * @return
*/ */
boolean finishCleanRecords(); boolean finishCleanRecords();
int startCleanRecords(SCleanRecords sCleanRecords);
} }
...@@ -188,6 +188,18 @@ public class SCleanRecordsServiceImpl implements ISCleanRecordsService ...@@ -188,6 +188,18 @@ public class SCleanRecordsServiceImpl implements ISCleanRecordsService
return 0 < sCleanRecordsMapper.updateBatch(list); return 0 < sCleanRecordsMapper.updateBatch(list);
} }
@Override
public int startCleanRecords(SCleanRecords sCleanRecords) {
LambdaQueryWrapper<SCleanRecords> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SCleanRecords::getStatus,1);
queryWrapper.eq(SCleanRecords::getConsumerId,sCleanRecords.getConsumerId());
List<SCleanRecords> list = sCleanRecordsMapper.selectList(queryWrapper);
if (list.size() > 0) {
throw new RuntimeException("当前用户有未结束的保洁任务");
}
return updateSCleanRecords(sCleanRecords);
}
private void sendSms(Long storeId,SStore store, SRoom room) { private void sendSms(Long storeId,SStore store, SRoom room) {
List<SConsumer> list = sConsumerMapper.selectListByStoreId(storeId); List<SConsumer> list = sConsumerMapper.selectListByStoreId(storeId);
for (SConsumer consumer : list) { for (SConsumer consumer : list) {
......
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