|
|
|
@ -1,8 +1,13 @@
|
|
|
|
|
package cc.yunxi.service.impl;
|
|
|
|
|
|
|
|
|
|
import cc.yunxi.common.exception.BizIllegalException;
|
|
|
|
|
import cc.yunxi.common.exception.DbException;
|
|
|
|
|
import cc.yunxi.common.utils.BeanUtils;
|
|
|
|
|
import cc.yunxi.domain.po.Client;
|
|
|
|
|
import cc.yunxi.domain.po.Recycler;
|
|
|
|
|
import cc.yunxi.domain.query.RecyclerQuery;
|
|
|
|
|
import cc.yunxi.domain.vo.client.ClientUpdateVO;
|
|
|
|
|
import cc.yunxi.domain.vo.recycler.RecyclerUpdateVO;
|
|
|
|
|
import cc.yunxi.mapper.RecyclerMapper;
|
|
|
|
|
import cc.yunxi.service.IRecyclerService;
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
@ -26,7 +31,8 @@ public class RecyclerServiceImpl extends ServiceImpl<RecyclerMapper, Recycler> i
|
|
|
|
|
@Resource
|
|
|
|
|
RecyclerMapper recyclerMapper;
|
|
|
|
|
|
|
|
|
|
public Page<Recycler> queryByPage(RecyclerQuery recyclerQuery) {
|
|
|
|
|
@Override
|
|
|
|
|
public Page<Recycler> queryRecyclerByPage(RecyclerQuery recyclerQuery) {
|
|
|
|
|
QueryWrapper<Recycler> wrapper = new QueryWrapper<>();
|
|
|
|
|
wrapper.lambda()
|
|
|
|
|
.eq(StrUtil.isNotEmpty(recyclerQuery.getStationId()), Recycler::getStationId, recyclerQuery.getStationId())
|
|
|
|
@ -39,6 +45,11 @@ public class RecyclerServiceImpl extends ServiceImpl<RecyclerMapper, Recycler> i
|
|
|
|
|
return recyclerPage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Recycler getRecyclerById(String id) {
|
|
|
|
|
return this.getById(id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Recycler getRecyclerByOpenid(String openid) {
|
|
|
|
@ -46,6 +57,16 @@ public class RecyclerServiceImpl extends ServiceImpl<RecyclerMapper, Recycler> i
|
|
|
|
|
return recycler;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional
|
|
|
|
|
public void updateRecycler(RecyclerUpdateVO recyclerUpdateVO) {
|
|
|
|
|
validateRecyclerExists(recyclerUpdateVO.getId());
|
|
|
|
|
Recycler recycler = BeanUtils.copyBean(recyclerUpdateVO, Recycler.class);
|
|
|
|
|
this.updateById(recycler);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional
|
|
|
|
|
public Recycler registerRecycler(String phoneNumber, String openId) {
|
|
|
|
@ -61,4 +82,11 @@ public class RecyclerServiceImpl extends ServiceImpl<RecyclerMapper, Recycler> i
|
|
|
|
|
recyclerMapper.insert(recycler);
|
|
|
|
|
return recycler;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 校验散户是否存在
|
|
|
|
|
private void validateRecyclerExists(String id) {
|
|
|
|
|
if (this.getRecyclerById(id) == null) {
|
|
|
|
|
throw new DbException("散户不存在");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|