|  | @@ -24,7 +24,6 @@ import org.springframework.beans.factory.InitializingBean;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Value;
 | 
	
		
			
				|  |  |  import org.springframework.context.annotation.Lazy;
 | 
	
		
			
				|  |  | -import org.springframework.http.HttpStatus;
 | 
	
		
			
				|  |  |  import org.springframework.scheduling.annotation.Async;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  import org.springframework.transaction.annotation.Isolation;
 | 
	
	
		
			
				|  | @@ -39,7 +38,6 @@ import com.ym.mec.biz.dal.dao.EmployeeDao;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.dao.StudentDao;
 | 
	
		
			
				|  |  | -import java.nio.charset.Charset;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.dao.SysUserContractsDao;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.dto.CirculationUser;
 | 
	
	
		
			
				|  | @@ -52,6 +50,7 @@ import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.entity.MusicGroupSubjectPlan;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.entity.Organization;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.entity.StudentRegistration;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.entity.Subject;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.entity.SysUserContracts;
 | 
	
	
		
			
				|  | @@ -68,6 +67,7 @@ import com.ym.mec.biz.service.GoodsService;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.service.MusicGroupService;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.service.MusicGroupSubjectGoodsGroupService;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.service.MusicGroupSubjectPlanService;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.service.OrganizationService;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.service.StudentRegistrationService;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.service.SubjectService;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.service.SysUserContractsService;
 | 
	
	
		
			
				|  | @@ -76,8 +76,6 @@ import com.ym.mec.biz.service.TenantConfigService;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.service.TenantContractTemplateService;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.service.TenantInfoService;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.service.VipGroupService;
 | 
	
		
			
				|  |  | -import com.ym.mec.common.controller.BaseController;
 | 
	
		
			
				|  |  | -import com.ym.mec.common.entity.HttpResponseResult;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.exception.BizException;
 | 
	
		
			
				|  |  |  import com.ym.mec.thirdparty.eseal.ESealPlugin;
 | 
	
		
			
				|  |  |  import com.ym.mec.thirdparty.storage.StoragePluginContext;
 | 
	
	
		
			
				|  | @@ -155,6 +153,9 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 | 
	
		
			
				|  |  |      private TenantConfigService tenantConfigService;
 | 
	
		
			
				|  |  |      
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  | +    private OrganizationService organizationService;
 | 
	
		
			
				|  |  | +    
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  |      private TenantContractTemplateService tenantContractTemplateService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Value("${contract.baseDir:/var/pdf}")
 | 
	
	
		
			
				|  | @@ -198,9 +199,9 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  		SysUserTsign sysUserTsign = null;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -		SysUserTsign orignSysUserTsign = sysUserTsignService.get(-userId);
 | 
	
		
			
				|  |  | +		SysUserTsign orignSysUserTsign = sysUserTsignService.queryByCardNo(organCode);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -		if (orignSysUserTsign == null || !StringUtils.equals(orignSysUserTsign.getCardNo(), organCode)) {
 | 
	
		
			
				|  |  | +		if (orignSysUserTsign == null) {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  			String accountId = eSealPlugin.createOrganAccount(orgName, organCode);
 | 
	
		
			
				|  |  |  			if (StringUtils.isBlank(accountId)) {
 | 
	
	
		
			
				|  | @@ -213,16 +214,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 | 
	
		
			
				|  |  |  			}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  			sysUserTsign = new SysUserTsign(-userId, accountId, sealData, orgName, organCode, tenantId);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -			if (orignSysUserTsign == null) {
 | 
	
		
			
				|  |  | -				sysUserTsignService.insert(sysUserTsign);
 | 
	
		
			
				|  |  | -			} else {
 | 
	
		
			
				|  |  | -				orignSysUserTsign.setAccountId(accountId);
 | 
	
		
			
				|  |  | -				orignSysUserTsign.setSealData(sealData);
 | 
	
		
			
				|  |  | -				orignSysUserTsign.setName(orgName);
 | 
	
		
			
				|  |  | -				orignSysUserTsign.setCardNo(organCode);
 | 
	
		
			
				|  |  | -				sysUserTsignService.update(orignSysUserTsign);
 | 
	
		
			
				|  |  | -			}
 | 
	
		
			
				|  |  | +			sysUserTsignService.insert(sysUserTsign);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  		} else if (!StringUtils.equals(orignSysUserTsign.getName(), orgName)) {
 | 
	
		
			
				|  |  |  			if (eSealPlugin.updateOrganAccount(orignSysUserTsign.getAccountId(), orgName, organCode)) {
 | 
	
	
		
			
				|  | @@ -987,18 +979,21 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 | 
	
		
			
				|  |  |              return;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          
 | 
	
		
			
				|  |  | -		TenantInfo tenantInfo = tenantInfoService.get(studentInfo.getTenantId());
 | 
	
		
			
				|  |  | -		if(tenantInfo == null){
 | 
	
		
			
				|  |  | -			throw new BizException("机构信息不存在");
 | 
	
		
			
				|  |  | -		}
 | 
	
		
			
				|  |  | -		
 | 
	
		
			
				|  |  | -		TenantConfig tenantConfig = tenantConfigService.queryByTenantId(studentInfo.getTenantId());
 | 
	
		
			
				|  |  | -		if(tenantConfig == null){
 | 
	
		
			
				|  |  | -			throw new BizException("机构配置信息查询失败");
 | 
	
		
			
				|  |  | +        //如果分部有企业信息,就用分部上的企业信息,否则用机构上的企业信息
 | 
	
		
			
				|  |  | +        String companyName = null;
 | 
	
		
			
				|  |  | +        TenantInfo tenantInfo = null;
 | 
	
		
			
				|  |  | +        Organization organizationDto = organizationService.get(user.getOrganId());
 | 
	
		
			
				|  |  | +		if (organizationDto == null || StringUtils.isBlank(organizationDto.getCorporateName()) || StringUtils.isBlank(organizationDto.getCorporateCode())) {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +			tenantInfo = tenantInfoService.get(studentInfo.getTenantId());
 | 
	
		
			
				|  |  | +			if (tenantInfo == null) {
 | 
	
		
			
				|  |  | +				throw new BizException("机构信息不存在");
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +			companyName = tenantInfo.getTsignName();
 | 
	
		
			
				|  |  | +		} else {
 | 
	
		
			
				|  |  | +			companyName = organizationDto.getCorporateName();
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  | -		
 | 
	
		
			
				|  |  | -		params.put("companyName", tenantInfo.getTsignName());
 | 
	
		
			
				|  |  | -		params.put("sealPicture", tenantConfig.getCorporateChops());
 | 
	
		
			
				|  |  | +		params.put("companyName", companyName);
 | 
	
		
			
				|  |  |          
 | 
	
		
			
				|  |  |  		if (studentInfo.getTenantId() == 1) {
 | 
	
		
			
				|  |  |  			if (OwnershipType.OWN.name().equals(params.get("ownershipType"))) {
 | 
	
	
		
			
				|  | @@ -1020,22 +1015,17 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 | 
	
		
			
				|  |  |              return;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        String organCode = "";
 | 
	
		
			
				|  |  | +        String organCode = tenantInfo == null ? organizationDto.getCorporateCode() : tenantInfo.getTsignCode();
 | 
	
		
			
				|  |  |          
 | 
	
		
			
				|  |  |  		if (user.getTenantId() == 1) {
 | 
	
		
			
				|  |  | -			if (OwnershipType.OWN.name().equals(params.get("ownershipType"))) {
 | 
	
		
			
				|  |  | -				organCode = "91440300326364429H";
 | 
	
		
			
				|  |  | -			} else {
 | 
	
		
			
				|  |  | +			if (!OwnershipType.OWN.name().equals(params.get("ownershipType"))) {
 | 
	
		
			
				|  |  |  				organCode = "91420106333619290A";
 | 
	
		
			
				|  |  |  			}
 | 
	
		
			
				|  |  | -		} else {
 | 
	
		
			
				|  |  | -			organCode = tenantInfo.getTsignCode();
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |          SysUserTsign organTsign = sysUserTsignService.queryByCardNo(organCode);
 | 
	
		
			
				|  |  |          if (organTsign == null) {
 | 
	
		
			
				|  |  | -            logger.error("甲方未创建签章");
 | 
	
		
			
				|  |  | -            return;
 | 
	
		
			
				|  |  | +            //创建企业签章
 | 
	
		
			
				|  |  | +            addTsign(tenantInfo.getUserId(), organCode, companyName, user.getTenantId());
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          eSealPlugin.organSign(organTsign.getSealData(), srcPdfPath, srcPdfPath);
 | 
	
	
		
			
				|  | @@ -1113,18 +1103,31 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 | 
	
		
			
				|  |  |              ownershipType = courseViewType;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          
 | 
	
		
			
				|  |  | -		TenantInfo tenantInfo = tenantInfoService.get(studentInfo.getTenantId());
 | 
	
		
			
				|  |  | -		if(tenantInfo == null){
 | 
	
		
			
				|  |  | -			throw new BizException("机构信息不存在");
 | 
	
		
			
				|  |  | -		}
 | 
	
		
			
				|  |  | -		
 | 
	
		
			
				|  |  | -		TenantConfig tenantConfig = tenantConfigService.queryByTenantId(studentInfo.getTenantId());
 | 
	
		
			
				|  |  | -		if(tenantConfig == null){
 | 
	
		
			
				|  |  | -			throw new BizException("机构配置信息查询失败");
 | 
	
		
			
				|  |  | +        //如果分部有企业信息,就用分部上的企业信息,否则用机构上的企业信息
 | 
	
		
			
				|  |  | +        String companyName = null, sealPicture = null;
 | 
	
		
			
				|  |  | +        TenantInfo tenantInfo = null;
 | 
	
		
			
				|  |  | +        Organization organizationDto = organizationService.get(studentInfo.getOrganId());
 | 
	
		
			
				|  |  | +		if (organizationDto == null || StringUtils.isBlank(organizationDto.getCorporateName()) || StringUtils.isBlank(organizationDto.getCorporateCode())) {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +			tenantInfo = tenantInfoService.get(studentInfo.getTenantId());
 | 
	
		
			
				|  |  | +			if (tenantInfo == null) {
 | 
	
		
			
				|  |  | +				throw new BizException("机构信息不存在");
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +	        
 | 
	
		
			
				|  |  | +			TenantConfig tenantConfig = tenantConfigService.queryByTenantId(studentInfo.getTenantId());
 | 
	
		
			
				|  |  | +			if(tenantConfig == null){
 | 
	
		
			
				|  |  | +				throw new BizException("机构配置信息查询失败");
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +			
 | 
	
		
			
				|  |  | +			companyName = tenantInfo.getTsignName();
 | 
	
		
			
				|  |  | +			sealPicture = tenantConfig.getCorporateChops();
 | 
	
		
			
				|  |  | +		} else {
 | 
	
		
			
				|  |  | +			companyName = organizationDto.getCorporateName();
 | 
	
		
			
				|  |  | +			sealPicture = organizationDto.getCorporateSeal();
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  | -		params.put("companyName", tenantInfo.getTsignName());
 | 
	
		
			
				|  |  | -		params.put("sealPicture", tenantConfig.getCorporateChops());
 | 
	
		
			
				|  |  | +		params.put("companyName", companyName);
 | 
	
		
			
				|  |  | +		params.put("sealPicture", sealPicture);
 | 
	
		
			
				|  |  |          
 | 
	
		
			
				|  |  |  		if (studentInfo.getTenantId() == 1) {
 | 
	
		
			
				|  |  |  			if (OwnershipType.OWN.name().equals(params.get("ownershipType"))) {
 | 
	
	
		
			
				|  | @@ -1162,148 +1165,6 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  | -    public HttpResponseResult transferProduceContractOnlyWithCourseList(Integer userId) {
 | 
	
		
			
				|  |  | -        SysUser user = studentDao.lockUserReturnInfo(userId);
 | 
	
		
			
				|  |  | -        if (user == null) {
 | 
	
		
			
				|  |  | -            logger.error("用户不存在({})", userId);
 | 
	
		
			
				|  |  | -            return BaseController.failed("用户不存在");
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        int validContactNum = sysUserContractsDao.countUserValidContact(userId);
 | 
	
		
			
				|  |  | -        if (validContactNum > 0) {
 | 
	
		
			
				|  |  | -            return BaseController.succeed();
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        if (StringUtils.isBlank(user.getRealName()) || StringUtils.isBlank(user.getIdCardNo())) {
 | 
	
		
			
				|  |  | -            return BaseController.failed(HttpStatus.PARTIAL_CONTENT, user, "");
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        SysUserTsign sysUserTsign = sysUserTsignService.get(userId);
 | 
	
		
			
				|  |  | -        if (sysUserTsign == null) {
 | 
	
		
			
				|  |  | -            try {
 | 
	
		
			
				|  |  | -                sysUserTsign = register(userId, user.getRealName(), user.getIdCardNo(), user.getPhone());
 | 
	
		
			
				|  |  | -            } catch (Exception e) {
 | 
	
		
			
				|  |  | -                logger.error("用户电子签章注册失败", e);
 | 
	
		
			
				|  |  | -                return BaseController.failed("用户电子签章注册失败");
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        Date date = new Date();
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        // 合成freemarker
 | 
	
		
			
				|  |  | -        String srcPdfPath = contractBaseDir + "/product/" + dateFormat1.format(date) + "/" + userId + "_" + LocalDateTime.now().getSecond() + ".pdf";
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        File srcFile = new File(srcPdfPath);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        File debtFile = new File(srcFile.getParent());
 | 
	
		
			
				|  |  | -        if (!debtFile.exists()) {
 | 
	
		
			
				|  |  | -            debtFile.mkdirs();
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        FreemarkerTemplateEngine templateEngine = FreemarkerTemplateEngine.getInstance();
 | 
	
		
			
				|  |  | -        templateEngine.setClassForTemplateLoading(ContractServiceImpl.class, "/config/contracts/");
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        Map<String, Object> params = new HashMap<String, Object>();
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        // 查询参数信息
 | 
	
		
			
				|  |  | -        StudentInfo studentInfo = studentRegistrationService.queryStudentInfo(userId);
 | 
	
		
			
				|  |  | -        params.put("studentInfo", studentInfo);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        params.put("isShowVisualSeal", false);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        params.put("ownershipType", "OWN");
 | 
	
		
			
				|  |  | -		
 | 
	
		
			
				|  |  | -        // 查询最新协议模板
 | 
	
		
			
				|  |  | -		TenantContractTemplate tenantContractTemplate = tenantContractTemplateService.queryLatestContractTemplate(user.getTenantId(), null, null);
 | 
	
		
			
				|  |  | -		if(tenantContractTemplate == null){
 | 
	
		
			
				|  |  | -			logger.error("最新协议模板查询失败");
 | 
	
		
			
				|  |  | -            return BaseController.succeed();
 | 
	
		
			
				|  |  | -		}
 | 
	
		
			
				|  |  | -		String mainContent = tenantContractTemplate.getContractTemplateContent();
 | 
	
		
			
				|  |  | -		params.put("contractMainContent", mainContent);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        // 查询是否已生成协议
 | 
	
		
			
				|  |  | -        List<SysUserContracts> userContracts = sysUserContractsService.getUserContractWithType(userId, ContractType.PRODUCT, tenantContractTemplate.getVersion());
 | 
	
		
			
				|  |  | -        if (!CollectionUtils.isEmpty(userContracts)) {
 | 
	
		
			
				|  |  | -            return BaseController.succeed();
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        
 | 
	
		
			
				|  |  | -		TenantInfo tenantInfo = tenantInfoService.get(studentInfo.getTenantId());
 | 
	
		
			
				|  |  | -		if(tenantInfo == null){
 | 
	
		
			
				|  |  | -			throw new BizException("机构信息不存在");
 | 
	
		
			
				|  |  | -		}
 | 
	
		
			
				|  |  | -		
 | 
	
		
			
				|  |  | -		TenantConfig tenantConfig = tenantConfigService.queryByTenantId(studentInfo.getTenantId());
 | 
	
		
			
				|  |  | -		if(tenantConfig == null){
 | 
	
		
			
				|  |  | -			throw new BizException("机构配置信息查询失败");
 | 
	
		
			
				|  |  | -		}
 | 
	
		
			
				|  |  | -		
 | 
	
		
			
				|  |  | -		params.put("companyName", tenantInfo.getTsignName());
 | 
	
		
			
				|  |  | -		params.put("sealPicture", tenantConfig.getCorporateChops());
 | 
	
		
			
				|  |  | -        
 | 
	
		
			
				|  |  | -		if (studentInfo.getTenantId() == 1) {
 | 
	
		
			
				|  |  | -			if (OwnershipType.OWN.name().equals(params.get("ownershipType"))) {
 | 
	
		
			
				|  |  | -				//params.put("companyName", "深圳大雅乐盟网络教育股份有限公司");
 | 
	
		
			
				|  |  | -				//params.put("sealPicture", "https://daya-online.oss-cn-beijing.aliyuncs.com/website/cachet.png");
 | 
	
		
			
				|  |  | -			} else {
 | 
	
		
			
				|  |  | -				params.put("companyName", "武汉长乐长风乐器销售有限公司");
 | 
	
		
			
				|  |  | -				params.put("sealPicture", "https://daya-online.oss-cn-beijing.aliyuncs.com/website/clcf.png");
 | 
	
		
			
				|  |  | -			}
 | 
	
		
			
				|  |  | -		}
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        templateEngine.render(params, "latest_contract_template.ftl", srcFile);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        // 生成借款协议PDF
 | 
	
		
			
				|  |  | -        try {
 | 
	
		
			
				|  |  | -            PDFUtil.renderToPDFByData(ContractServiceImpl.class.getResource("/").getFile(), FileUtils.readFileToString(srcFile, Charset.defaultCharset()), srcPdfPath, "simsun.ttc");
 | 
	
		
			
				|  |  | -        } catch (IOException e) {
 | 
	
		
			
				|  |  | -            logger.error("生成产品协议失败", e);
 | 
	
		
			
				|  |  | -            return BaseController.failed("生成产品协议失败");
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        String organCode = "";
 | 
	
		
			
				|  |  | -        
 | 
	
		
			
				|  |  | -		if (user.getTenantId() == 1) {
 | 
	
		
			
				|  |  | -			if (OwnershipType.OWN.name().equals(params.get("ownershipType"))) {
 | 
	
		
			
				|  |  | -				organCode = "91440300326364429H";
 | 
	
		
			
				|  |  | -			} else {
 | 
	
		
			
				|  |  | -				organCode = "91420106333619290A";
 | 
	
		
			
				|  |  | -			}
 | 
	
		
			
				|  |  | -		} else {
 | 
	
		
			
				|  |  | -			organCode = tenantInfo.getTsignCode();
 | 
	
		
			
				|  |  | -		}
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        SysUserTsign organTsign = sysUserTsignService.queryByCardNo(organCode);
 | 
	
		
			
				|  |  | -        if (organTsign == null) {
 | 
	
		
			
				|  |  | -            logger.error("甲方未创建签章");
 | 
	
		
			
				|  |  | -            return BaseController.failed("甲方未创建签章");
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        eSealPlugin.organSign(organTsign.getSealData(), srcPdfPath, srcPdfPath);
 | 
	
		
			
				|  |  | -        if (sysUserTsign != null && CertificateTypeEnum.IDENTITY.getCode().equals(user.getCertificateType())) {
 | 
	
		
			
				|  |  | -            eSealPlugin.userSign(sysUserTsign.getAccountId(), sysUserTsign.getSealData(), srcPdfPath, srcPdfPath);
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        // 上传到oss
 | 
	
		
			
				|  |  | -        String dateStrOss = dateFormatOss.format(date);
 | 
	
		
			
				|  |  | -        dateStrOss = "product/" + dateStrOss + "/" + DateUtil.getHour(date);
 | 
	
		
			
				|  |  | -        String pdfFilePath = storagePluginContext.uploadFile(KS3StoragePlugin.PLUGIN_NAME, dateStrOss, srcFile);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        SysUserContracts sysUserContracts = new SysUserContracts();
 | 
	
		
			
				|  |  | -        sysUserContracts.setCreateTime(date);
 | 
	
		
			
				|  |  | -        sysUserContracts.setType(ContractType.PRODUCT);
 | 
	
		
			
				|  |  | -        sysUserContracts.setUrl(pdfFilePath);
 | 
	
		
			
				|  |  | -        sysUserContracts.setUserId(userId);
 | 
	
		
			
				|  |  | -        sysUserContracts.setVersion(2);
 | 
	
		
			
				|  |  | -        sysUserContracts.setTenantId(user.getTenantId());
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        sysUserContractsService.insert(sysUserContracts);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        FileUtils.deleteQuietly(srcFile);
 | 
	
		
			
				|  |  | -        return BaseController.succeed();
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    @Override
 | 
	
		
			
				|  |  |      public String transferOaFinancial(OAFinancialDto financialDto) {
 | 
	
		
			
				|  |  |          List<Integer> circulationUserIds = financialDto.getCirculationUsers().stream().map(CirculationUser::getUserId).collect(Collectors.toList());
 | 
	
		
			
				|  |  |          List<Integer> executorIds = financialDto.getExecutors().stream().map(CirculationUser::getUserId).collect(Collectors.toList());
 |