|
|
@ -20,9 +20,14 @@ package com.elink.esua.epdc.modules.project.service.impl; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.elink.esua.epdc.commons.mybatis.utils.DeptEntityUtils; |
|
|
|
import com.elink.esua.epdc.commons.tools.exception.RenException; |
|
|
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|
|
|
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
|
|
|
import com.elink.esua.epdc.dto.ParentAndAllDeptDTO; |
|
|
|
import com.elink.esua.epdc.modules.feign.AdminFeignClient; |
|
|
|
import com.elink.esua.epdc.modules.group.dao.GroupDao; |
|
|
|
import com.elink.esua.epdc.modules.group.entity.GroupEntity; |
|
|
|
import com.elink.esua.epdc.modules.project.dao.PropertyProjectDao; |
|
|
@ -31,6 +36,7 @@ import com.elink.esua.epdc.modules.project.entity.PropertyProjectEntity; |
|
|
|
import com.elink.esua.epdc.modules.project.redis.PropertyProjectRedis; |
|
|
|
import com.elink.esua.epdc.modules.project.service.PropertyProjectService; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.checkerframework.checker.units.qual.A; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
@ -87,10 +93,43 @@ public class PropertyProjectServiceImpl extends BaseServiceImpl<PropertyProjectD |
|
|
|
return ConvertUtils.sourceToTarget(entity, PropertyProjectDTO.class); |
|
|
|
} |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private AdminFeignClient adminFeignClient; |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据网格ID获取冗余的组织机构信息 |
|
|
|
* |
|
|
|
* @param |
|
|
|
* @return com.elink.esua.epdc.dto.ParentAndAllDeptDTO |
|
|
|
* @author rongchao |
|
|
|
* @since 2019-12-19 |
|
|
|
*/ |
|
|
|
private ParentAndAllDeptDTO getParentAndAllDeptDTO(String gridId) { |
|
|
|
// 获取组织结构冗余信息
|
|
|
|
Result<ParentAndAllDeptDTO> parentAndAllDeptDTOResult = adminFeignClient.getParentAndAllDept(gridId); |
|
|
|
ParentAndAllDeptDTO parentAndAllDeptDTO = parentAndAllDeptDTOResult.getData(); |
|
|
|
|
|
|
|
if (!parentAndAllDeptDTOResult.success()) { |
|
|
|
throw new RenException(parentAndAllDeptDTOResult.getMsg()); |
|
|
|
} |
|
|
|
return parentAndAllDeptDTO; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void save(PropertyProjectDTO dto) { |
|
|
|
PropertyProjectEntity entity = ConvertUtils.sourceToTarget(dto, PropertyProjectEntity.class); |
|
|
|
|
|
|
|
|
|
|
|
ParentAndAllDeptDTO parentAndAllDeptDTO = getParentAndAllDeptDTO(dto.getGridId()); |
|
|
|
|
|
|
|
//保存用户居住地所在网格,及其他冗余字段。
|
|
|
|
DeptEntityUtils.loadDeptInfo( |
|
|
|
ConvertUtils.sourceToTarget(parentAndAllDeptDTO, DeptEntityUtils.DeptDto.class), |
|
|
|
entity |
|
|
|
); |
|
|
|
entity.setGrid(parentAndAllDeptDTO.getGrid()); |
|
|
|
|
|
|
|
entity = gridInfo(entity); |
|
|
|
entity.setDelFlag("0"); |
|
|
|
baseDao.insert(entity); |
|
|
|