| | |
| | | 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.common.node.TreeStringNode; |
| | |
| | | import org.springblade.modules.place.entity.PlaceRelEntity; |
| | | import org.springblade.modules.place.excel.PlaceAndRelExcel; |
| | | import org.springblade.modules.place.excel.PlaceExcel; |
| | | import org.springblade.modules.place.mapper.PlaceMapper; |
| | | import org.springblade.modules.place.service.IPlaceExtService; |
| | | import org.springblade.modules.place.service.IPlacePoiLabelService; |
| | | import org.springblade.modules.place.service.IPlaceRelService; |
| | | import org.springblade.modules.place.vo.PlaceVO; |
| | | import org.springblade.modules.place.mapper.PlaceMapper; |
| | | import org.springblade.modules.place.service.IPlaceService; |
| | | import org.springblade.modules.place.vo.PlaceVO; |
| | | import org.springblade.modules.system.entity.User; |
| | | import org.springblade.modules.system.service.IUserService; |
| | | 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 User bindUserHandle(PlaceVO placeVO) { |
| | | User newUser = new User(); |
| | | if (null!=placeVO.getPhone() && !placeVO.getPhone().equals("")) { |
| | | placeVO.setPrincipal(placeVO.getUsername()); |
| | | placeVO.setPrincipalPhone(placeVO.getPhone()); |
| | | //根据手机号查询库里的数据 |
| | | User userParams = new User(); |
| | | userParams.setPhone(placeVO.getPhone()); |
| | |
| | | PlaceEntity placeEntity = new PlaceEntity(); |
| | | placeEntity.setHouseCode(placeExcel.getHouseCode()); |
| | | placeEntity.setPrincipalUserId(userId); |
| | | placeEntity.setPrincipal(placeExcel.getName()); |
| | | placeEntity.setPrincipalPhone(placeExcel.getPhoneNumber()); |
| | | placeEntity.setCreateTime(new Date()); |
| | | placeEntity.setCreateUser(AuthUtil.getUserId()); |
| | | placeEntity.setUpdateTime(new Date()); |
| | |
| | | placeEntity.setPlaceName(placeExcel.getPlaceName()); |
| | | placeEntity.setLocaltion(placeExcel.getAddress()); |
| | | placeEntity.setPrincipalUserId(userId); |
| | | placeEntity.setPrincipal(placeExcel.getName()); |
| | | placeEntity.setPrincipalPhone(placeExcel.getPhoneNumber()); |
| | | placeEntity.setPrincipalUserId(userId); |
| | | placeEntity.setCreateTime(new Date()); |
| | | placeEntity.setCreateUser(AuthUtil.getUserId()); |
| | | placeEntity.setUpdateTime(new Date()); |
| | |
| | | placeLabelBind(placeVO); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 场所数据处理-用户信息(场所负责人信息写入到场所表) |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Object placeUserHandle() { |
| | | // 查询出有用户id 的场所 |
| | | List<PlaceEntity> list = baseMapper.getHasUserIdPlaceList(); |
| | | // 遍历 |
| | | for (PlaceEntity placeEntity : list) { |
| | | // 查询对应的用户信息 |
| | | User user = userService.getById(placeEntity.getPrincipalUserId()); |
| | | if (null!=user) { |
| | | // 设置场所负责人,手机号 |
| | | if (null != user.getRealName() && !user.getRealName().equals("")) { |
| | | placeEntity.setPrincipal(user.getRealName()); |
| | | } |
| | | if (null != user.getPhone() && !user.getPhone().equals("")) { |
| | | placeEntity.setPrincipalPhone(user.getPhone()); |
| | | } |
| | | // 更新场所信息 |
| | | updateById(placeEntity); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |