Commit 31d9250f by 吕明尚

更改保洁负责的门店

parent 47e0d8f5
......@@ -51,7 +51,7 @@ public class SStoreController extends BaseController
/**
* 获取门店详细信息
*/
@GetMapping(value = "/{id}")
@GetMapping(value = "/info/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(sStoreService.selectSStoreById(id));
......@@ -73,7 +73,7 @@ public class SStoreController extends BaseController
*/
@ApiOperation(value = "保洁负责的门店")
@RequestMapping(value = "/listVoByCleaner", method = RequestMethod.GET)
public R<List<SStoreVo>> listVoByCleaner()
public R<List<SStore>> listVoByCleaner()
{
return R.ok(sStoreService.listVoByCleaner());
}
......
......@@ -65,7 +65,9 @@ public class WebConfig implements WebMvcConfigurer {
"/front/login/sendCode",
"/front/login/login/mobile",
"/front/login/login",
"/front/store/**",
"/front/store/list",
"/front/store/listVo",
"/front/store//info/*",
"/front/room/**",
"**"
).addPathPatterns("/**");
......
package share.system.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity;
import share.system.domain.vo.SRoomVo;
import java.util.List;
/**
* 门店对象 s_store
......@@ -67,6 +71,17 @@ public class SStore extends BaseEntity
@Excel(name = "门店类型 1:标准店 2: 形象店 3:旗舰店")
private String storeType;
@TableField(exist = false)
private List<SRoom> roolList;
public List<SRoom> getRoolList() {
return roolList;
}
public void setRoolList(List<SRoom> roolList) {
this.roolList = roolList;
}
public void setId(Long id)
{
this.id = id;
......
......@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity;
import java.math.BigDecimal;
......
......@@ -69,5 +69,18 @@ public interface ISRoomService extends IService<SRoom>
*/
List<SRoomVo> listByStoreIds(List<Long> storeIds);
List<SRoom> selectSroomListByIds(List<Long> storeIds);
/**
* 通过门店ID列表查询所有房间
*
* @param storeId
* @return
*/
List<SRoom> selectSroomListByStroeId(Long storeId);
String openDoor(Long id);
}
......@@ -94,5 +94,5 @@ public interface ISStoreService extends IService<SStore>
int insertStoreConsumers(Long storeId, Long[] consumerIds);
List<SStoreVo> listVoByCleaner();
List<SStore> listVoByCleaner();
}
......@@ -141,6 +141,22 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
}
@Override
public List<SRoom> selectSroomListByIds(List<Long> storeIds) {
LambdaQueryWrapper<SRoom> queryWrapper = new LambdaQueryWrapper();
queryWrapper.in(SRoom::getStoreId, storeIds);
List<SRoom> roomList = sRoomMapper.selectList(queryWrapper);
return roomList;
}
@Override
public List<SRoom> selectSroomListByStroeId(Long storeId) {
LambdaQueryWrapper<SRoom> queryWrapper = new LambdaQueryWrapper();
queryWrapper.in(SRoom::getStoreId, storeId);
List<SRoom> roomList = sRoomMapper.selectList(queryWrapper);
return roomList;
}
@Override
public String openDoor(Long id) {
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
if (!user.getRoleType().equals(RoleTypeEnum.CLEANER.getCode())) {
......
......@@ -252,21 +252,25 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
}
@Override
public List<SStoreVo> listVoByCleaner() {
public List<SStore> listVoByCleaner() {
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
if (!user.getRoleType().equals(RoleTypeEnum.CLEANER.getCode())) {
throw new BaseException("当前用户不是保洁人员!");
}
//查询保洁人员所属门店
List<String> storeIdList = storeConsumerMapper.selectByConsumerId(user.getId());
//查询门店信息
List<SStore> storeList = sStoreMapper.selectBatchIds(storeIdList);
//List<String> 转 List<Long>
List<Long> idList = storeIdList.stream().map(Long::parseLong).collect(Collectors.toList());
// 查询门店信息
List<SStore> storeList = new ArrayList<>();
idList.forEach(item -> {
storeList.add(sStoreMapper.selectById(item));
});
//转换VO
List<SStoreVo> sStoreVos = convertDosToVos(storeList);
sStoreVos.forEach(item -> {
item.setRoomVoList(sRoomService.listByStoreIds(Collections.singletonList(item.getId())));
storeList.forEach(item -> {
item.setRoolList(sRoomService.selectSroomListByStroeId(item.getId()));
});
return sStoreVos;
return storeList;
}
private List<Map> convertOptionList(List<SStore> storeList) {
......
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