|
|
@ -1,22 +1,25 @@ |
|
|
|
package com.epmet.service.impl; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.dao.MemoWorkDiaryDao; |
|
|
|
import com.epmet.dto.MemoAttrDTO; |
|
|
|
import com.epmet.dto.MemoWorkDiaryDTO; |
|
|
|
import com.epmet.dto.form.MemoWorkDiaryFormDTO; |
|
|
|
import com.epmet.entity.MemoWorkDiaryEntity; |
|
|
|
import com.epmet.service.MemoAttachmentService; |
|
|
|
import com.epmet.service.MemoAttrService; |
|
|
|
import com.epmet.service.MemoWorkDiaryService; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
/** |
|
|
|
* 备忘录-工作日志 |
|
|
@ -27,36 +30,44 @@ import java.util.Map; |
|
|
|
@Service |
|
|
|
public class MemoWorkDiaryServiceImpl extends BaseServiceImpl<MemoWorkDiaryDao, MemoWorkDiaryEntity> implements MemoWorkDiaryService { |
|
|
|
|
|
|
|
@Resource |
|
|
|
private MemoAttrService memoAttrService; |
|
|
|
@Resource |
|
|
|
private MemoAttachmentService memoAttachmentService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<MemoWorkDiaryDTO> page(Map<String, Object> params) { |
|
|
|
IPage<MemoWorkDiaryEntity> page = baseDao.selectPage( |
|
|
|
getPage(params, FieldConstant.CREATED_TIME, false), |
|
|
|
getWrapper(params) |
|
|
|
); |
|
|
|
return getPageData(page, MemoWorkDiaryDTO.class); |
|
|
|
public PageData<MemoWorkDiaryDTO> page(MemoWorkDiaryFormDTO formDTO) { |
|
|
|
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); |
|
|
|
List<MemoWorkDiaryDTO> list = baseDao.getPage(formDTO); |
|
|
|
PageInfo<MemoWorkDiaryDTO> pageInfo = new PageInfo<>(list); |
|
|
|
return new PageData<>(list, pageInfo.getTotal()); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<MemoWorkDiaryDTO> list(Map<String, Object> params) { |
|
|
|
List<MemoWorkDiaryEntity> entityList = baseDao.selectList(getWrapper(params)); |
|
|
|
public List<MemoWorkDiaryDTO> list(MemoWorkDiaryFormDTO formDTO) { |
|
|
|
List<MemoWorkDiaryDTO> list = baseDao.getPage(formDTO); |
|
|
|
|
|
|
|
return ConvertUtils.sourceToTarget(entityList, MemoWorkDiaryDTO.class); |
|
|
|
} |
|
|
|
|
|
|
|
private QueryWrapper<MemoWorkDiaryEntity> getWrapper(Map<String, Object> params){ |
|
|
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
|
|
|
|
|
|
|
QueryWrapper<MemoWorkDiaryEntity> wrapper = new QueryWrapper<>(); |
|
|
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|
|
|
|
|
|
|
return wrapper; |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public MemoWorkDiaryDTO get(String id) { |
|
|
|
MemoWorkDiaryEntity entity = baseDao.selectById(id); |
|
|
|
return ConvertUtils.sourceToTarget(entity, MemoWorkDiaryDTO.class); |
|
|
|
public MemoWorkDiaryDTO get(MemoWorkDiaryFormDTO formDTO) { |
|
|
|
MemoWorkDiaryEntity entity = baseDao.selectById(formDTO.getId()); |
|
|
|
MemoWorkDiaryDTO dto = ConvertUtils.sourceToTarget(entity, MemoWorkDiaryDTO.class); |
|
|
|
//获取提醒时间
|
|
|
|
MemoAttrDTO memoAttr = memoAttrService.get(formDTO.getId()); |
|
|
|
if (null != memoAttr && null != dto) { |
|
|
|
dto.setRemindTime(memoAttr.getRemindTime()); |
|
|
|
} |
|
|
|
//获取附件列表
|
|
|
|
//更新阅读状态
|
|
|
|
if (NumConstant.ONE_STR.equals(formDTO.getReadFlag())) { |
|
|
|
MemoAttrDTO memoAttrDTO = new MemoAttrDTO(); |
|
|
|
memoAttrDTO.setId(formDTO.getId()); |
|
|
|
memoAttrDTO.setReadFlag(NumConstant.ONE); |
|
|
|
memoAttrService.update(memoAttrDTO); |
|
|
|
} |
|
|
|
return dto; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|