|
@ -10,7 +10,9 @@ import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.dao.RecreationSportDao; |
|
|
import com.epmet.dao.RecreationSportDao; |
|
|
import com.epmet.dto.RecreationSportDTO; |
|
|
import com.epmet.dto.RecreationSportDTO; |
|
|
import com.epmet.dto.form.RecreationSportFormDTO; |
|
|
import com.epmet.dto.form.RecreationSportFormDTO; |
|
|
|
|
|
import com.epmet.dto.result.LoginUserDetailsResultDTO; |
|
|
import com.epmet.entity.RecreationSportEntity; |
|
|
import com.epmet.entity.RecreationSportEntity; |
|
|
|
|
|
import com.epmet.remote.EpmetUserRemoteService; |
|
|
import com.epmet.service.RecreationSportService; |
|
|
import com.epmet.service.RecreationSportService; |
|
|
import com.github.pagehelper.PageHelper; |
|
|
import com.github.pagehelper.PageHelper; |
|
|
import com.github.pagehelper.PageInfo; |
|
|
import com.github.pagehelper.PageInfo; |
|
@ -18,6 +20,7 @@ import org.apache.commons.lang3.StringUtils; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
import java.util.Arrays; |
|
|
import java.util.Arrays; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
@ -32,6 +35,9 @@ import java.util.Map; |
|
|
@Service |
|
|
@Service |
|
|
public class RecreationSportServiceImpl extends BaseServiceImpl<RecreationSportDao, RecreationSportEntity> implements RecreationSportService { |
|
|
public class RecreationSportServiceImpl extends BaseServiceImpl<RecreationSportDao, RecreationSportEntity> implements RecreationSportService { |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
private EpmetUserRemoteService remoteService; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public PageData<RecreationSportDTO> page(Map<String, Object> params) { |
|
|
public PageData<RecreationSportDTO> page(Map<String, Object> params) { |
|
|
IPage<RecreationSportEntity> page = baseDao.selectPage( |
|
|
IPage<RecreationSportEntity> page = baseDao.selectPage( |
|
@ -50,10 +56,11 @@ public class RecreationSportServiceImpl extends BaseServiceImpl<RecreationSportD |
|
|
|
|
|
|
|
|
private QueryWrapper<RecreationSportEntity> getWrapper(Map<String, Object> params) { |
|
|
private QueryWrapper<RecreationSportEntity> getWrapper(Map<String, Object> params) { |
|
|
String id = (String) params.get(FieldConstant.ID_HUMP); |
|
|
String id = (String) params.get(FieldConstant.ID_HUMP); |
|
|
|
|
|
LoginUserDetailsResultDTO userDetails = remoteService.getLoginUserDetails(); |
|
|
|
|
|
String orgIdPath = userDetails.getOrgIdPath();//社区级别的orgIdPath
|
|
|
QueryWrapper<RecreationSportEntity> wrapper = new QueryWrapper<>(); |
|
|
QueryWrapper<RecreationSportEntity> wrapper = new QueryWrapper<>(); |
|
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|
|
|
|
|
wrapper.likeRight(StringUtils.isNotBlank(orgIdPath), "ORG_ID_PATH", orgIdPath); |
|
|
return wrapper; |
|
|
return wrapper; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -67,6 +74,9 @@ public class RecreationSportServiceImpl extends BaseServiceImpl<RecreationSportD |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void save(RecreationSportFormDTO dto) { |
|
|
public void save(RecreationSportFormDTO dto) { |
|
|
RecreationSportEntity entity = ConvertUtils.sourceToTarget(dto, RecreationSportEntity.class); |
|
|
RecreationSportEntity entity = ConvertUtils.sourceToTarget(dto, RecreationSportEntity.class); |
|
|
|
|
|
LoginUserDetailsResultDTO userDetails = remoteService.getLoginUserDetails(); |
|
|
|
|
|
String orgIdPath = userDetails.getOrgIdPath();//社区级别的orgIdPath
|
|
|
|
|
|
entity.setOrgIdPath(orgIdPath); |
|
|
insert(entity); |
|
|
insert(entity); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -86,9 +96,11 @@ public class RecreationSportServiceImpl extends BaseServiceImpl<RecreationSportD |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public PageData<RecreationSportDTO> search(RecreationSportFormDTO dto) { |
|
|
public PageData<RecreationSportDTO> search(RecreationSportFormDTO dto) { |
|
|
|
|
|
LoginUserDetailsResultDTO userDetails = remoteService.getLoginUserDetails(); |
|
|
|
|
|
String orgIdPath = userDetails.getOrgIdPath();//社区级别的orgIdPath
|
|
|
PageInfo<RecreationSportDTO> pageInfo = PageHelper.startPage(dto.getPageNo(), dto.getPageSize(), dto.getIsPage()) |
|
|
PageInfo<RecreationSportDTO> pageInfo = PageHelper.startPage(dto.getPageNo(), dto.getPageSize(), dto.getIsPage()) |
|
|
.doSelectPageInfo(() -> baseDao.search(dto.getTitle(), dto.getType(), dto.getApply(), |
|
|
.doSelectPageInfo(() -> baseDao.search(dto.getTitle(), dto.getType(), dto.getApply(), |
|
|
DateUtil.formatDateTime(dto.getStartTime()), DateUtil.formatDateTime(dto.getEndTime()))); |
|
|
DateUtil.formatDateTime(dto.getStartTime()), DateUtil.formatDateTime(dto.getEndTime()), orgIdPath)); |
|
|
return new PageData<>(pageInfo.getList() == null ? new ArrayList<>() : pageInfo.getList(), pageInfo.getTotal()); |
|
|
return new PageData<>(pageInfo.getList() == null ? new ArrayList<>() : pageInfo.getList(), pageInfo.getTotal()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|