|  | @@ -44,6 +44,7 @@ import com.ym.mec.auth.api.entity.SysRole;
 | 
											
												
													
														|  |  import com.ym.mec.auth.api.entity.SysUser;
 |  |  import com.ym.mec.auth.api.entity.SysUser;
 | 
											
												
													
														|  |  import com.ym.mec.auth.api.enums.SysUserType;
 |  |  import com.ym.mec.auth.api.enums.SysUserType;
 | 
											
												
													
														|  |  import com.ym.mec.biz.dal.dao.OrganizationDao;
 |  |  import com.ym.mec.biz.dal.dao.OrganizationDao;
 | 
											
												
													
														|  | 
 |  | +import com.ym.mec.biz.dal.dao.TenantContractTemplateDao;
 | 
											
												
													
														|  |  import com.ym.mec.biz.dal.dao.TenantInfoDao;
 |  |  import com.ym.mec.biz.dal.dao.TenantInfoDao;
 | 
											
												
													
														|  |  import com.ym.mec.biz.dal.dto.TenantConfigDto;
 |  |  import com.ym.mec.biz.dal.dto.TenantConfigDto;
 | 
											
												
													
														|  |  import com.ym.mec.biz.dal.dto.TenantInfoDto;
 |  |  import com.ym.mec.biz.dal.dto.TenantInfoDto;
 | 
											
										
											
												
													
														|  | @@ -56,6 +57,7 @@ import com.ym.mec.biz.dal.entity.SysConfig;
 | 
											
												
													
														|  |  import com.ym.mec.biz.dal.entity.SysUserTsign;
 |  |  import com.ym.mec.biz.dal.entity.SysUserTsign;
 | 
											
												
													
														|  |  import com.ym.mec.biz.dal.entity.TenantAssetsInfo;
 |  |  import com.ym.mec.biz.dal.entity.TenantAssetsInfo;
 | 
											
												
													
														|  |  import com.ym.mec.biz.dal.entity.TenantConfig;
 |  |  import com.ym.mec.biz.dal.entity.TenantConfig;
 | 
											
												
													
														|  | 
 |  | +import com.ym.mec.biz.dal.entity.TenantContractTemplate;
 | 
											
												
													
														|  |  import com.ym.mec.biz.dal.entity.TenantInfo;
 |  |  import com.ym.mec.biz.dal.entity.TenantInfo;
 | 
											
												
													
														|  |  import com.ym.mec.biz.dal.entity.TenantOrderRecord;
 |  |  import com.ym.mec.biz.dal.entity.TenantOrderRecord;
 | 
											
												
													
														|  |  import com.ym.mec.biz.dal.entity.TenantProductInfo;
 |  |  import com.ym.mec.biz.dal.entity.TenantProductInfo;
 | 
											
										
											
												
													
														|  | @@ -136,6 +138,9 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
 | 
											
												
													
														|  |      @Autowired
 |  |      @Autowired
 | 
											
												
													
														|  |      @Lazy
 |  |      @Lazy
 | 
											
												
													
														|  |      private ContractService contractService;
 |  |      private ContractService contractService;
 | 
											
												
													
														|  | 
 |  | +    
 | 
											
												
													
														|  | 
 |  | +    @Autowired
 | 
											
												
													
														|  | 
 |  | +    private TenantContractTemplateDao tenantContractTemplateDao;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      /**
 |  |      /**
 | 
											
												
													
														|  |       * 新增机构
 |  |       * 新增机构
 | 
											
										
											
												
													
														|  | @@ -187,11 +192,32 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
 | 
											
												
													
														|  |      @Transactional(rollbackFor = Exception.class)
 |  |      @Transactional(rollbackFor = Exception.class)
 | 
											
												
													
														|  |      @Override
 |  |      @Override
 | 
											
												
													
														|  |      public void updateTenantInfo(TenantInfoDto dto) {
 |  |      public void updateTenantInfo(TenantInfoDto dto) {
 | 
											
												
													
														|  | 
 |  | +    	
 | 
											
												
													
														|  |          //查询机构信息
 |  |          //查询机构信息
 | 
											
												
													
														|  |          TenantInfo tenantInfo = Optional.ofNullable(dto)
 |  |          TenantInfo tenantInfo = Optional.ofNullable(dto)
 | 
											
												
													
														|  |                  .map(TenantInfoDto::getId)
 |  |                  .map(TenantInfoDto::getId)
 | 
											
												
													
														|  |                  .map(this::getById)
 |  |                  .map(this::getById)
 | 
											
												
													
														|  |                  .orElseThrow(() -> new BizException("未找到该机构信息,机构信息不能为空!"));
 |  |                  .orElseThrow(() -> new BizException("未找到该机构信息,机构信息不能为空!"));
 | 
											
												
													
														|  | 
 |  | +        
 | 
											
												
													
														|  | 
 |  | +        Integer tenantId = tenantInfo.getId();
 | 
											
												
													
														|  | 
 |  | +        
 | 
											
												
													
														|  | 
 |  | +        //是否修改了机构名称或机构编码
 | 
											
												
													
														|  | 
 |  | +        if(!StringUtils.equals(dto.getTsignName(), tenantInfo.getTsignName()) || !StringUtils.equals(dto.getTsignCode(), tenantInfo.getTsignCode())){
 | 
											
												
													
														|  | 
 |  | +        	//升级机构协议版本号
 | 
											
												
													
														|  | 
 |  | +        	TenantContractTemplate tenantContractTemplate = tenantContractTemplateDao.queryLatestContractTemplate(null, null, tenantId);
 | 
											
												
													
														|  | 
 |  | +        	if(tenantContractTemplate != null){
 | 
											
												
													
														|  | 
 |  | +        		baseMapper.getLocked(tenantId);
 | 
											
												
													
														|  | 
 |  | +        		
 | 
											
												
													
														|  | 
 |  | +        		Integer maxVersion = tenantContractTemplateDao.queryMaxVersion();
 | 
											
												
													
														|  | 
 |  | +        		int version = maxVersion == null ? 1 : maxVersion + 1;
 | 
											
												
													
														|  | 
 |  | +        		
 | 
											
												
													
														|  | 
 |  | +        		tenantContractTemplate.setVersion(version);
 | 
											
												
													
														|  | 
 |  | +        		Date date = new Date();
 | 
											
												
													
														|  | 
 |  | +        		tenantContractTemplate.setUpdateTime(date);
 | 
											
												
													
														|  | 
 |  | +        		
 | 
											
												
													
														|  | 
 |  | +        		tenantContractTemplateDao.update(tenantContractTemplate);
 | 
											
												
													
														|  | 
 |  | +        	}
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          //机构状态 1已缴费,并且 机构注册的手机号与本次修改后的手机号不同,就证明本次修改了手机号 则需要修改机构的账号信息
 |  |          //机构状态 1已缴费,并且 机构注册的手机号与本次修改后的手机号不同,就证明本次修改了手机号 则需要修改机构的账号信息
 | 
											
												
													
														|  |          if (1 == tenantInfo.getPayState() && !Objects.equals(tenantInfo.getPhone(), dto.getPhone())) {
 |  |          if (1 == tenantInfo.getPayState() && !Objects.equals(tenantInfo.getPhone(), dto.getPhone())) {
 |