|  | @@ -2,12 +2,15 @@ package com.xunmei.system.service.impl;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import java.util.List;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.utils.DateUtils;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.utils.StringUtils;
 | 
	
		
			
				|  |  |  import com.xunmei.system.api.domain.SysOrg;
 | 
	
		
			
				|  |  | +import com.xunmei.system.domain.SysPhysicalDefenseConstruction;
 | 
	
		
			
				|  |  |  import com.xunmei.system.dto.SysOrgExtendDto;
 | 
	
		
			
				|  |  |  import com.xunmei.system.mapper.SysOrgMapper;
 | 
	
		
			
				|  |  | +import com.xunmei.system.mapper.SysPhysicalDefenseConstructionMapper;
 | 
	
		
			
				|  |  |  import org.springframework.beans.BeanUtils;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
	
		
			
				|  | @@ -37,6 +40,8 @@ public class SysOrgExtendServiceImpl extends ServiceImpl<SysOrgExtendMapper, Sys
 | 
	
		
			
				|  |  |      private ISysOrgService orgService;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private SysOrgMapper orgMapper;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private SysPhysicalDefenseConstructionMapper physicalDefenseConstructionMapper;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public TableDataInfo<SysOrgExtend> selectPage(SysOrgExtend sysOrgExtend) {
 | 
	
	
		
			
				|  | @@ -113,14 +118,10 @@ public class SysOrgExtendServiceImpl extends ServiceImpl<SysOrgExtendMapper, Sys
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public int insertOrUpdateSysOrgExtend(SysOrgExtendDto sysOrgExtend) {
 | 
	
		
			
				|  |  | -//        sysOrgExtend.setCreateTime(DateUtils.getNowDate());
 | 
	
		
			
				|  |  | -//        SysOrg sysOrg = orgMapper.selectById(sysOrgExtend.getParentId());
 | 
	
		
			
				|  |  | -//        sysOrgExtend.setId(IdWorker.getId());
 | 
	
		
			
				|  |  | -//        sysOrgExtend.setPath(sysOrg.getPath()+sysOrgExtend.getId()+"-");
 | 
	
		
			
				|  |  | +        //处理org数据
 | 
	
		
			
				|  |  |          sysOrgExtend.setDeleted(0);
 | 
	
		
			
				|  |  | -//        sysOrgExtend.setParentGuid(sysOrg.getParentGuid());
 | 
	
		
			
				|  |  |          SysOrg org = new SysOrg();
 | 
	
		
			
				|  |  | -        BeanUtils.copyProperties(sysOrgExtend,org);
 | 
	
		
			
				|  |  | +        BeanUtils.copyProperties(sysOrgExtend, org);
 | 
	
		
			
				|  |  |          boolean isOk = false;
 | 
	
		
			
				|  |  |          if (org.getId() != null) {
 | 
	
		
			
				|  |  |              if (StringUtils.isEmpty(org.getManagerPhone())) {
 | 
	
	
		
			
				|  | @@ -144,15 +145,41 @@ public class SysOrgExtendServiceImpl extends ServiceImpl<SysOrgExtendMapper, Sys
 | 
	
		
			
				|  |  |           */
 | 
	
		
			
				|  |  |          orgService.clearOrgCache();
 | 
	
		
			
				|  |  |          orgService.loadingOrgCache();
 | 
	
		
			
				|  |  | -//        orgService.saveOrUpdateOrg(org);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +        //处理物防建设数据
 | 
	
		
			
				|  |  | +        physicalDefenseConstructionMapper.delete(new LambdaQueryWrapper<SysPhysicalDefenseConstruction>().eq(SysPhysicalDefenseConstruction::getOrgId,org.getId()));
 | 
	
		
			
				|  |  | +        if (sysOrgExtend.getConstructionList() != null && sysOrgExtend.getConstructionList().size() > 0) {
 | 
	
		
			
				|  |  | +            for (SysPhysicalDefenseConstruction s :
 | 
	
		
			
				|  |  | +                    sysOrgExtend.getConstructionList()) {
 | 
	
		
			
				|  |  | +                s.setId(null);
 | 
	
		
			
				|  |  | +//                if (s.getOrgId() == null) {
 | 
	
		
			
				|  |  | +                    s.setOrgId(org.getId());
 | 
	
		
			
				|  |  | +                    s.setCreateTime(DateUtils.getNowDate());
 | 
	
		
			
				|  |  | +                    s.setType(4L);
 | 
	
		
			
				|  |  | +                    physicalDefenseConstructionMapper.insert(s);
 | 
	
		
			
				|  |  | +//                }
 | 
	
		
			
				|  |  | +//                else{
 | 
	
		
			
				|  |  | +//                    s.setUpdateTime(DateUtils.getNowDate());
 | 
	
		
			
				|  |  | +//                    physicalDefenseConstructionMapper.updateById(s);
 | 
	
		
			
				|  |  | +//                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        //处理机构扩展数据
 | 
	
		
			
				|  |  |          SysOrgExtend extend = new SysOrgExtend();
 | 
	
		
			
				|  |  | -        extend.setOrgId(org.getId());
 | 
	
		
			
				|  |  |          extend.setCreateTime(DateUtils.getNowDate());
 | 
	
		
			
				|  |  |          extend.setDetachedLobbyEquipment(sysOrgExtend.getDetachedLobbyEquipment());
 | 
	
		
			
				|  |  |          extend.setDetachedWallPenetratingEquipment(sysOrgExtend.getDetachedWallPenetratingEquipment());
 | 
	
		
			
				|  |  |          extend.setCashAddingRoomRemoteControl(sysOrgExtend.getCashAddingRoomRemoteControl());
 | 
	
		
			
				|  |  | -        return sysOrgExtendMapper.insert(extend);
 | 
	
		
			
				|  |  | +        if (sysOrgExtend.getOrgExtendId()!=null){
 | 
	
		
			
				|  |  | +            extend.setOrgId(org.getId());
 | 
	
		
			
				|  |  | +            extend.setId(sysOrgExtend.getOrgExtendId());
 | 
	
		
			
				|  |  | +            sysOrgExtendMapper.updateById(extend);
 | 
	
		
			
				|  |  | +        }else{
 | 
	
		
			
				|  |  | +            sysOrgExtendMapper.insert(extend);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        return 0;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 |