Commit 9cc7ffd9 by 吕明尚

结束保洁修改只限制领取人结束

parent a88ffbac
package share.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import share.common.annotation.Log;
import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.core.domain.R;
import share.common.enums.BusinessType;
import share.system.domain.SConsumer;
import share.common.core.page.TableDataInfo;
import share.system.domain.SStore;
import share.system.domain.vo.SStoreVo;
import share.system.request.SStoreRequest;
import share.system.service.ISStoreService;
import share.common.utils.poi.ExcelUtil;
import share.common.core.page.TableDataInfo;
import share.system.domain.SStore;
import java.util.List;
/**
* 门店Controller
......@@ -86,4 +79,9 @@ public class SStoreController extends BaseController
public AjaxResult storeList() {
return success(sStoreService.storeList());
}
@PostMapping("/queryByStoreIds")
public R<List<SStore>> queryByStoreIds(@RequestBody Long[] storeIds) {
return R.ok(sStoreService.queryByStoreIds(storeIds));
}
}
......@@ -105,4 +105,5 @@ public interface ISStoreService extends IService<SStore>
List<SStoreVo> convertDosToVosSortByDst(List<SStore> storeList, SStoreRequest request);
List<SStore> queryByStoreIds(Long[] storeIds);
}
......@@ -480,14 +480,18 @@ public class SCleanRecordsServiceImpl extends ServiceImpl<SCleanRecordsMapper,SC
if (!user.getRoleType().equals(RoleTypeEnum.CLEANER.getCode())) {
throw new RuntimeException("当前用户不是店员");
}
List<Long> longs = storeConsumerMapper.selectByConsumerId(user.getId(), PositionEnum.CLEANER.getCode());
if (CollectionUtils.isEmpty(longs)) {
LambdaQueryWrapper<SStoreConsumer> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SStoreConsumer::getConsumerId, user.getId());
queryWrapper.in(SStoreConsumer::getPosition, PositionEnum.CLEANER.getCode(), PositionEnum.ADMIN.getCode());
queryWrapper.eq(SStoreConsumer::getStoreId, storeId);
List<SStoreConsumer> storeConsumer = storeConsumerMapper.selectList(queryWrapper);
if (CollectionUtils.isEmpty(storeConsumer)) {
throw new RuntimeException("当前用户不是保洁人员");
}
LambdaQueryWrapper<SCleanRecords> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SCleanRecords::getStoreId, storeId);
queryWrapper.eq(SCleanRecords::getStatus, CleaningStatusEnum.UNCLEAN.getCode());
List<SCleanRecords> sCleanRecords = baseMapper.selectList(queryWrapper);
LambdaQueryWrapper<SCleanRecords> sCleanRecordsLambdaQueryWrapper = new LambdaQueryWrapper<>();
sCleanRecordsLambdaQueryWrapper.eq(SCleanRecords::getStoreId, storeId);
sCleanRecordsLambdaQueryWrapper.eq(SCleanRecords::getStatus, CleaningStatusEnum.UNCLEAN.getCode());
List<SCleanRecords> sCleanRecords = baseMapper.selectList(sCleanRecordsLambdaQueryWrapper);
if (CollectionUtils.isEmpty(sCleanRecords)) {
throw new RuntimeException("当前门店没有未保洁的保洁任务");
}
......@@ -505,8 +509,12 @@ public class SCleanRecordsServiceImpl extends ServiceImpl<SCleanRecordsMapper,SC
if (!user.getRoleType().equals(RoleTypeEnum.CLEANER.getCode())) {
throw new RuntimeException("当前用户不是店员");
}
List<Long> longs = storeConsumerMapper.selectByConsumerId(user.getId(), PositionEnum.CLEANER.getCode());
if (CollectionUtils.isEmpty(longs)) {
LambdaQueryWrapper<SStoreConsumer> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SStoreConsumer::getConsumerId, user.getId());
queryWrapper.in(SStoreConsumer::getPosition, PositionEnum.CLEANER.getCode(), PositionEnum.ADMIN.getCode());
queryWrapper.eq(SStoreConsumer::getStoreId, sCleanRecords.getStoreId());
List<SStoreConsumer> storeConsumer = storeConsumerMapper.selectList(queryWrapper);
if (CollectionUtils.isEmpty(storeConsumer)) {
throw new RuntimeException("当前用户不是保洁人员");
}
sCleanRecords.setConsumerId(user.getId());
......
......@@ -345,6 +345,11 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
return voList;
}
@Override
public List<SStore> queryByStoreIds(Long[] storeIds) {
return baseMapper.selectBatchIds(Arrays.asList(storeIds));
}
/**
* 门店DO集合转换VO集合,按距离排序
*
......
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