|
@ -7,12 +7,11 @@ import cn.hutool.core.util.ObjectUtil; |
|
|
import com.ccsens.util.exception.BaseException; |
|
|
import com.ccsens.util.exception.BaseException; |
|
|
import com.ccsens.yanyuan.bean.dto.MedicineDto; |
|
|
import com.ccsens.yanyuan.bean.dto.MedicineDto; |
|
|
import com.ccsens.yanyuan.bean.dto.ZaritDto; |
|
|
import com.ccsens.yanyuan.bean.dto.ZaritDto; |
|
|
import com.ccsens.yanyuan.bean.po.Care; |
|
|
import com.ccsens.yanyuan.bean.po.*; |
|
|
import com.ccsens.yanyuan.bean.po.CareExample; |
|
|
|
|
|
import com.ccsens.yanyuan.bean.po.UserFamily; |
|
|
|
|
|
import com.ccsens.yanyuan.bean.vo.ZaritVo; |
|
|
import com.ccsens.yanyuan.bean.vo.ZaritVo; |
|
|
import com.ccsens.yanyuan.persist.dao.CareDao; |
|
|
import com.ccsens.yanyuan.persist.dao.CareDao; |
|
|
import com.ccsens.yanyuan.persist.dao.FamilyDao; |
|
|
import com.ccsens.yanyuan.persist.dao.FamilyDao; |
|
|
|
|
|
import com.ccsens.yanyuan.persist.mapper.UserMapper; |
|
|
import com.ccsens.yanyuan.util.YanYuanCodeError; |
|
|
import com.ccsens.yanyuan.util.YanYuanCodeError; |
|
|
import com.ccsens.yanyuan.util.YanYuanConstant; |
|
|
import com.ccsens.yanyuan.util.YanYuanConstant; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
@ -39,6 +38,8 @@ public class ZaritService implements IZaritService{ |
|
|
private FamilyDao familyDao; |
|
|
private FamilyDao familyDao; |
|
|
@Resource |
|
|
@Resource |
|
|
private Snowflake snowflake; |
|
|
private Snowflake snowflake; |
|
|
|
|
|
@Resource |
|
|
|
|
|
private UserMapper userMapper; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public List<ZaritVo.ZaritInfo> queryList(ZaritDto.QueryZarit param, Long userId) { |
|
|
public List<ZaritVo.ZaritInfo> queryList(ZaritDto.QueryZarit param, Long userId) { |
|
@ -58,6 +59,16 @@ public class ZaritService implements IZaritService{ |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public Long addZarit(ZaritDto.AddZarit param, Long userId) { |
|
|
public Long addZarit(ZaritDto.AddZarit param, Long userId) { |
|
|
|
|
|
// 检查使用者是否存在
|
|
|
|
|
|
UserExample userExample = new UserExample(); |
|
|
|
|
|
userExample.createCriteria().andKeyIdEqualTo(param.getProjectId()); |
|
|
|
|
|
userExample.setOrderByClause("key_id limit 1"); |
|
|
|
|
|
List<User> users = userMapper.selectByExample(userExample); |
|
|
|
|
|
if (CollectionUtil.isEmpty(users)) { |
|
|
|
|
|
log.info("没有找到用户信息:{}", param.getProjectId()); |
|
|
|
|
|
throw new BaseException(YanYuanCodeError.PARAM_ERROR); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
Care care = new Care(); |
|
|
Care care = new Care(); |
|
|
BeanUtil.copyProperties(param,care); |
|
|
BeanUtil.copyProperties(param,care); |
|
|
care.setId(UUID.randomUUID().toString()); |
|
|
care.setId(UUID.randomUUID().toString()); |
|
@ -65,6 +76,7 @@ public class ZaritService implements IZaritService{ |
|
|
care.setKeyUserId(param.getProjectId()); |
|
|
care.setKeyUserId(param.getProjectId()); |
|
|
care.setRecordUserId(userId); |
|
|
care.setRecordUserId(userId); |
|
|
care.setZaritState(YanYuanConstant.Zarit.STATE_CREATE); |
|
|
care.setZaritState(YanYuanConstant.Zarit.STATE_CREATE); |
|
|
|
|
|
care.setUserId(users.get(0).getId()); |
|
|
careDao.insertSelective(care); |
|
|
careDao.insertSelective(care); |
|
|
return care.getKeyId(); |
|
|
return care.getKeyId(); |
|
|
} |
|
|
} |
|
|