| | |
| | | package org.springblade.modules.place.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.logging.log4j.util.Strings; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.modules.grid.service.IGridService; |
| | | import org.springblade.modules.house.entity.HouseTenantEntity; |
| | | import org.springblade.modules.house.vo.HouseTenantVO; |
| | | import org.springblade.modules.place.entity.PlaceEntity; |
| | | import org.springblade.modules.place.entity.PlaceExtEntity; |
| | | import org.springblade.modules.place.entity.PlacePractitionerEntity; |
| | | import org.springblade.modules.place.mapper.PlaceExtMapper; |
| | | import org.springblade.modules.place.service.IPlaceExtService; |
| | | import org.springblade.modules.place.service.IPlacePractitionerService; |
| | | 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.springblade.modules.system.entity.Dept; |
| | | import org.springblade.modules.system.service.IDeptService; |
| | | 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.ArrayList; |
| | |
| | | public class PlaceExtServiceImpl extends ServiceImpl<PlaceExtMapper, PlaceExtEntity> implements IPlaceExtService { |
| | | |
| | | @Autowired |
| | | private ITaskService taskService; |
| | | |
| | | @Autowired |
| | | private IPlaceService placeService; |
| | | |
| | | @Autowired |
| | |
| | | @Autowired |
| | | private IGridService gridService; |
| | | |
| | | @Autowired |
| | | private IDeptService deptService; |
| | | |
| | | /** |
| | | * 自定义查询 |
| | | * |
| | | * @param page |
| | | * @param placeExt |
| | | * @return |
| | |
| | | @Override |
| | | public IPage<PlaceExtVO> selectPlaceExtPage(IPage<PlaceExtVO> page, PlaceExtVO placeExt) { |
| | | List<String> list = new ArrayList<>(); |
| | | if (null!=placeExt.getRoleName() && !placeExt.getRoleName().equals("")){ |
| | | if (placeExt.getRoleName().equals("网格员")){ |
| | | if (null != placeExt.getRoleName() && !placeExt.getRoleName().equals("")) { |
| | | if (placeExt.getRoleName().equals("网格员")) { |
| | | // 查询对应的房屋地址code |
| | | list = gridService.getAddressCodeListByUserId(AuthUtil.getUserId()); |
| | | } |
| | | if (!placeExt.getRoleName().equals("系统管理员")){ |
| | | if (!placeExt.getRoleName().equals("系统管理员")) { |
| | | placeExt.setCreateUser(AuthUtil.getUserId()); |
| | | } |
| | | } |
| | | return page.setRecords(baseMapper.selectPlaceExtPage(page, placeExt,list)); |
| | | Dept dept = deptService.getById(AuthUtil.getDeptId()); |
| | | if (null != dept) { |
| | | placeExt.setCommunityCode(dept.getRegionCode()); |
| | | } |
| | | if (AuthUtil.getUserAccount().equals("18879306957")) { |
| | | placeExt.setCommunityCode("361102003027"); |
| | | placeExt.setCreateUser(null); |
| | | } |
| | | return page.setRecords(baseMapper.selectPlaceExtPage(page, placeExt, list)); |
| | | } |
| | | |
| | | /** |
| | | * 场所详情表 自定义更新 |
| | | * |
| | | * @param placeExt |
| | | * @return |
| | | */ |
| | |
| | | updatePlaceInfo(placeExt); |
| | | // 查询对应已存在的从业人员 |
| | | QueryWrapper<PlacePractitionerEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("place_id",placeExt.getPlaceId()); |
| | | wrapper.eq("place_id", placeExt.getPlaceId()); |
| | | List<PlacePractitionerEntity> oldList = placePractitionerService.list(wrapper); |
| | | List<PlacePractitionerEntity> list = placeExt.getPlacePractitioner(); |
| | | // 申明新增,修改,删除集合 |
| | |
| | | // 找出需要新增的,否则组成新集合进行比对 |
| | | for (PlacePractitionerEntity practitionerEntity : list) { |
| | | practitionerEntity.setPlaceId(placeExt.getPlaceId()); |
| | | if (null==practitionerEntity.getId()){ |
| | | if (null == practitionerEntity.getId()) { |
| | | // 新增 |
| | | PlacePractitionerEntity placePractitionerEntity= new PlacePractitionerEntity(); |
| | | PlacePractitionerEntity placePractitionerEntity = new PlacePractitionerEntity(); |
| | | |
| | | placePractitionerEntity.setPlaceId(placeExt.getPlaceId()); |
| | | placePractitionerEntity.setName(practitionerEntity.getName()); |
| | | placePractitionerEntity.setTelephone(practitionerEntity.getTelephone()); |
| | | placePractitionerEntity.setTempAddress(practitionerEntity.getTempAddress()); |
| | | addList.add(placePractitionerEntity); |
| | | }else { |
| | | } else { |
| | | newList.add(practitionerEntity); |
| | | } |
| | | } |
| | |
| | | e.getId()).collect(Collectors.toList()).contains(vo.getId())).collect(Collectors.toList()); |
| | | |
| | | // 批量新增 |
| | | if (addList.size()>0) { |
| | | if (addList.size() > 0) { |
| | | addFlag = placePractitionerService.saveBatch(addList); |
| | | } |
| | | // 批量修改 |
| | | if (updateList.size()>0) { |
| | | if (updateList.size() > 0) { |
| | | updateFlag = placePractitionerService.updateBatchById(updateList); |
| | | } |
| | | // 批量删除 |
| | | if (removeList.size()>0) { |
| | | if (removeList.size() > 0) { |
| | | removeFlag = placePractitionerService.removeBatchByIds(removeList); |
| | | } |
| | | // 返回 |
| | |
| | | |
| | | /** |
| | | * 更新场所表信息 |
| | | * |
| | | * @param placeExt |
| | | */ |
| | | public void updatePlaceInfo(PlaceExtVO placeExt) { |
| | |
| | | |
| | | /** |
| | | * 场所详情表 审核 |
| | | * |
| | | * @param placeExt |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 场所详情表 新增 |
| | | * |
| | | * @param placeExt |
| | | * @return |
| | | */ |
| | |
| | | // 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()); |
| | | // 新增场所详情 |
| | | boolean save = save(placeExt); |
| | | placeExt.setConfirmFlag(1); |
| | | placeExt.setCreateTime(new Date()); |
| | | placeExt.setUpdateTime(new Date()); |
| | | placeExt.setCreateUser(AuthUtil.getUserId()); |
| | | placeExt.setUpdateUser(AuthUtil.getUserId()); |
| | | // 新增场所详情 |
| | | boolean save = save(placeExt); |
| | | // } |
| | | return save; |
| | | } |
| | | |
| | | /** |
| | | * 场所详情表 自定义详情 |
| | | * |
| | | * @param placeExt |
| | | * @return |
| | | */ |
| | | @Override |
| | | public PlaceExtVO getDetail(PlaceExtVO placeExt) { |
| | | PlaceExtVO detail = baseMapper.getDetail(placeExt); |
| | | if (null!=detail) { |
| | | if (null != detail) { |
| | | // 查询从业人员信息 |
| | | QueryWrapper<PlacePractitionerEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("place_id", placeExt.getPlaceId()); |