| | |
| | | package org.springblade.modules.place.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.modules.place.entity.PlaceEntity; |
| | | import org.springblade.modules.place.entity.PlaceExtEntity; |
| | | import org.springblade.modules.place.service.IPlaceService; |
| | | import org.springblade.modules.place.vo.PlaceExtVO; |
| | | import org.springblade.modules.place.mapper.PlaceExtMapper; |
| | | import org.springblade.modules.place.service.IPlaceExtService; |
| | | import org.springblade.core.mp.base.BaseServiceImpl; |
| | | import org.springblade.modules.task.entity.TaskEntity; |
| | | import org.springblade.modules.task.service.ITaskService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 场所详情表 服务实现类 |
| | |
| | | @Service |
| | | public class PlaceExtServiceImpl extends ServiceImpl<PlaceExtMapper, PlaceExtEntity> implements IPlaceExtService { |
| | | |
| | | @Autowired |
| | | private ITaskService taskService; |
| | | |
| | | @Autowired |
| | | private IPlaceService placeService; |
| | | |
| | | /** |
| | | * 自定义查询 |
| | | * @param page |
| | | * @param placeExt |
| | | * @return |
| | | */ |
| | | @Override |
| | | public IPage<PlaceExtVO> selectPlaceExtPage(IPage<PlaceExtVO> page, PlaceExtVO placeExt) { |
| | | return page.setRecords(baseMapper.selectPlaceExtPage(page, placeExt)); |
| | | } |
| | | |
| | | /** |
| | | * 场所详情表 自定义更新 |
| | | * @param placeExt |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean updatePlaceExt(PlaceExtEntity placeExt) { |
| | | // 设置参数 |
| | | placeExt.setUpdateTime(new Date()); |
| | | placeExt.setUpdateUser(AuthUtil.getUserId()); |
| | | // 更新 |
| | | return updateById(placeExt); |
| | | } |
| | | |
| | | /** |
| | | * 场所详情表 审核 |
| | | * @param placeExt |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean checkPlaceExt(PlaceExtEntity placeExt) { |
| | | boolean flag = false; |
| | | // 设置更新时间 |
| | | placeExt.setConfirmTime(new Date()); |
| | | // 更新数据 |
| | | boolean b = updateById(placeExt); |
| | | if (b) { |
| | | // 更新任务表状态 |
| | | TaskEntity taskEntity = new TaskEntity(); |
| | | taskEntity.setId(placeExt.getTaskId()); |
| | | taskEntity.setStatus(placeExt.getConfirmFlag()); |
| | | flag = taskService.updateById(taskEntity); |
| | | } |
| | | // 返回 |
| | | return flag; |
| | | } |
| | | |
| | | /** |
| | | * 场所详情表 新增 |
| | | * @param placeExt |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean savePlaceExt(PlaceExtEntity placeExt) { |
| | | PlaceEntity placeEntity = placeService.getById(placeExt.getPlaceId()); |
| | | TaskEntity taskEntity = new TaskEntity(); |
| | | taskEntity.setId(placeExt.getTaskId()); |
| | | taskEntity.setStatus(placeExt.getConfirmFlag()); |
| | | taskEntity.setType(1); |
| | | taskEntity.setFrequency(3); |
| | | taskEntity.setName(placeEntity.getPlaceName() + "信息完善任务" + System.currentTimeMillis()); |
| | | // 新增任务 |
| | | boolean save = taskService.save(taskEntity); |
| | | if (save){ |
| | | placeExt.setTaskId(taskEntity.getId()); |
| | | placeExt.setConfirmFlag(1); |
| | | placeExt.setCreateTime(new Date()); |
| | | placeExt.setUpdateTime(new Date()); |
| | | placeExt.setCreateUser(AuthUtil.getUserId()); |
| | | placeExt.setUpdateUser(AuthUtil.getUserId()); |
| | | // 新增场所详情 |
| | | save(placeExt); |
| | | } |
| | | return false; |
| | | } |
| | | } |