Commit 6b903495 by wuwenlong

Merge remote-tracking branch 'origin/main'

parents 8ef61f7c 87e934bb
......@@ -111,5 +111,14 @@ public class SCleanRecordsController extends BaseController
return success(sCleanRecordsService.getByRoomId(roomId));
}
/**
* 查询正在保洁中的保洁记录
*/
@GetMapping(value = "/getByCleanerId")
public AjaxResult getByCleanerId()
{
return success(sCleanRecordsService.getByCleanerId());
}
}
......@@ -28,7 +28,7 @@ import share.common.core.page.TableDataInfo;
* @date 2023-09-27
*/
@RestController
@RequestMapping("/system/records")
@RequestMapping("/front/records")
public class SConsumptionRecordsController extends BaseController
{
@Autowired
......@@ -37,7 +37,7 @@ public class SConsumptionRecordsController extends BaseController
/**
* 查询消费记录列表
*/
@PreAuthorize("@ss.hasPermi('system:records:list')")
// @PreAuthorize("@ss.hasPermi('system:records:list')")
@GetMapping("/list")
public TableDataInfo list(SConsumptionRecords sConsumptionRecords)
{
......
......@@ -77,5 +77,14 @@ public class SRoomController extends BaseController {
return R.ok(roomStatusService.roomStatus(storeId, roomId, day));
}
/**
* 专属保洁的开门操作
*/
@ApiOperation(value = "专属保洁的开门操作")
@RequestMapping(value = "/open/door", method = RequestMethod.POST)
public R<String> openDoor(@RequestBody Long id) {
return R.ok(sRoomService.openDoor(id));
}
}
package share.system.domain;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
......@@ -69,6 +71,28 @@ public class SCleanRecords extends BaseEntity
*/
private String phone;
@TableField(exist = false)
private SRoom sRoom;
@TableField(exist = false)
private SStore sStore;
public SRoom getsRoom() {
return sRoom;
}
public void setsRoom(SRoom sRoom) {
this.sRoom = sRoom;
}
public SStore getsStore() {
return sStore;
}
public void setsStore(SStore sStore) {
this.sStore = sStore;
}
public void setId(Long id)
{
this.id = id;
......
......@@ -72,4 +72,6 @@ public interface ISCleanRecordsService
List<SCleanRecords> myCleanList(SCleanRecords sCleanRecords);
SCleanRecords getByRoomId(Long roomId);
SCleanRecords getByCleanerId();
}
......@@ -68,4 +68,6 @@ public interface ISRoomService extends IService<SRoom>
* @return
*/
List<SRoomVo> listByStoreIds(List<Long> storeIds);
String openDoor(Long id);
}
......@@ -8,9 +8,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.system.domain.SConsumer;
import share.system.domain.SRoom;
import share.system.domain.vo.FrontTokenComponent;
import share.system.mapper.SCleanRecordsMapper;
import share.system.domain.SCleanRecords;
import share.system.mapper.SConsumerMapper;
import share.system.mapper.SRoomMapper;
import share.system.mapper.SStoreMapper;
import share.system.service.ISCleanRecordsService;
/**
......@@ -26,6 +29,10 @@ public class SCleanRecordsServiceImpl implements ISCleanRecordsService
private SCleanRecordsMapper sCleanRecordsMapper;
@Autowired
private SConsumerMapper sConsumerMapper;
@Autowired
private SRoomMapper sRoomMapper;
@Autowired
private SStoreMapper sStoreMapper;
/**
* 查询保洁记录
......@@ -138,6 +145,24 @@ public class SCleanRecordsServiceImpl implements ISCleanRecordsService
return sCleanRecordsMapper.selectOne(queryWrapper);
}
@Override
public SCleanRecords getByCleanerId() {
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
if(!user.getRoleType().equals("1")){
throw new RuntimeException("当前用户不是保洁人员");
}
LambdaQueryWrapper<SCleanRecords> queryWrapper = new LambdaQueryWrapper();
queryWrapper.in(SCleanRecords::getConsumerId,user.getId());
queryWrapper.in(SCleanRecords::getStatus,1);
SCleanRecords sCleanRecords = sCleanRecordsMapper.selectOne(queryWrapper);
if(sCleanRecords == null){
throw new RuntimeException("当前用户没有保洁任务");
}
sCleanRecords.setsRoom(sRoomMapper.selectById(sCleanRecords.getRoomId()));
sCleanRecords.setsStore(sStoreMapper.selectById(sCleanRecords.getStoreId()));
return sCleanRecords;
}
private void sendSms(Long storeId) {
List<SConsumer> list = sConsumerMapper.selectListByStoreId(storeId);
for (SConsumer consumer : list) {
......
......@@ -10,6 +10,8 @@ import org.springframework.beans.BeanUtils;
import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.system.domain.SConsumer;
import share.system.domain.vo.FrontTokenComponent;
import share.system.domain.vo.SRoomVo;
import share.system.mapper.SRoomMapper;
import share.system.domain.SRoom;
......@@ -137,6 +139,24 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
return convertDoListToVoList(roomList);
}
@Override
public String openDoor(Long id) {
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
if(!user.getRoleType().equals("1")){
throw new RuntimeException("当前用户不是保洁人员");
}
SRoom room = sRoomMapper.selectById(id);
if(Objects.isNull(room)){
throw new RuntimeException("房间不存在");
}
//TODO 调用开门接口
if(true){
return "开门成功";
}else{
return "开门失败";
}
}
private List<SRoomVo> convertDoListToVoList(List<SRoom> roomList){
List<SRoomVo> voList = new ArrayList<>();
......
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