diff --git a/pom.xml b/pom.xml index f971e3b..a5d436e 100644 --- a/pom.xml +++ b/pom.xml @@ -191,7 +191,16 @@ org.springframework.boot spring-boot-maven-plugin + + org.apache.maven.plugins + maven-surefire-plugin + + false + + + + diff --git a/src/main/java/com/sztzjy/fund_investment/controller/ContractInvestmentController.java b/src/main/java/com/sztzjy/fund_investment/controller/ContractInvestmentController.java index cd920c3..a9ae911 100644 --- a/src/main/java/com/sztzjy/fund_investment/controller/ContractInvestmentController.java +++ b/src/main/java/com/sztzjy/fund_investment/controller/ContractInvestmentController.java @@ -1,12 +1,16 @@ package com.sztzjy.fund_investment.controller; import cn.hutool.core.io.resource.ClassPathResource; +import cn.hutool.core.util.IdUtil; import com.nimbusds.jose.shaded.gson.Gson; import com.sztzjy.fund_investment.annotation.AnonymousAccess; +import com.sztzjy.fund_investment.config.Constant; import com.sztzjy.fund_investment.entity.*; import com.sztzjy.fund_investment.entity.dto.InvestIntentionDetailedDto; +import com.sztzjy.fund_investment.entity.dto.InvestmentAgreementDto; import com.sztzjy.fund_investment.entity.dto.ReportUploadDto; import com.sztzjy.fund_investment.mapper.FoundProjectMapper; +import com.sztzjy.fund_investment.mapper.ProfitManagementMapper; import com.sztzjy.fund_investment.mapper.ProjectPoolMapper; import com.sztzjy.fund_investment.service.ContractInvestmentService; import com.sztzjy.fund_investment.service.ISysProjectDueDiligenceService; @@ -29,9 +33,13 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import java.io.FileInputStream; import java.io.IOException; +import java.math.BigDecimal; +import java.math.RoundingMode; import java.nio.file.Files; import java.nio.file.Paths; +import java.util.ArrayList; import java.util.List; +import java.util.Random; /** * @author 17803 @@ -62,6 +70,8 @@ public class ContractInvestmentController { @Autowired ISysProjectDueDiligenceService projectDueDiligenceService; + @Autowired + private ProfitManagementMapper profitManagementMapper; @Resource IFileUtil fileUtil; @@ -102,22 +112,57 @@ public class ContractInvestmentController { ProjectPoolExample projectPoolExample = new ProjectPoolExample(); projectPoolExample.createCriteria().andProjectPoolIdEqualTo(projectPoolId); List projectPools = projectPoolMapper.selectByExample(projectPoolExample); + double v = 0.0; if (projectPools.size() > 0) { //项目估值 String latestValuation = projectPools.get(0).getLatestValuation(); + + //公司名 + String companyName = projectPools.get(0).getCompanyName(); //转为Double类型 - double v = Double.parseDouble(latestValuation); + v = Double.parseDouble(latestValuation); // 金额不低于100万,持股比例自动显示,为总投资额/估值,持股比例不低于5% double proportion = totalInvest / v; if (0.05 > proportion) { return new ResultEntity(HttpStatus.BAD_REQUEST, "持股比例不低于5%"); } + + ProfitManagementExample profitManagementExample = new ProfitManagementExample(); + profitManagementExample.createCriteria().andFlowIdEqualTo(flowId); + List profitManagements = profitManagementMapper.selectByExample(profitManagementExample); + + if (profitManagements.size() > 0) { + + profitManagements.forEach(item -> { + //更新操作 + item.setShareRatio(BigDecimal.valueOf(proportion)); + item.setInvestmentAmount(BigDecimal.valueOf(totalInvest)); + profitManagementMapper.updateByPrimaryKeySelective(item); + }); + } else { + int date[] = {Constant.ONEDAY, Constant.FIVEDAY, Constant.TWENTYDAY, Constant.ONEMONTH, Constant.THREEMONTHS, Constant.SIXMONTHS}; + for (int i = 0; i < date.length; i++) { + ProfitManagement profitManagement = new ProfitManagement(); + profitManagement.setId(IdUtil.fastSimpleUUID()); + profitManagement.setFlowId(flowId); + profitManagement.setMarketTime(date[i]); + profitManagement.setInvestmentAmount(BigDecimal.valueOf(totalInvest)); + profitManagement.setShareRatio(BigDecimal.valueOf(proportion)); + profitManagement.setTotalEquity(BigDecimal.valueOf(v)); + //设置公司名 + profitManagement.setProjectName(companyName+"有限公司"); + Random random = new Random(); + double randomValue = 0.01 + random.nextDouble() * 19.99; // 生成0到20之间的随机数(不包括0) + BigDecimal stockPrice = BigDecimal.valueOf(randomValue).setScale(2, RoundingMode.HALF_UP); // 保留两位小数 + profitManagement.setStockPrice(stockPrice); + profitManagementMapper.insert(profitManagement); + } + } return new ResultEntity<>(HttpStatus.OK, proportion); + } else { + return new ResultEntity(HttpStatus.BAD_REQUEST, "查询不到立项项目"); } - - } else { - return new ResultEntity(HttpStatus.BAD_REQUEST, "查询不到立项项目"); } return null; } @@ -174,7 +219,7 @@ public class ContractInvestmentController { @AnonymousAccess @GetMapping("/sealB") - @ApiOperation("生成乙方公章") + @ApiOperation("投资意向书乙方公章和投资协议甲方公章") public ResponseEntity getSealImage(@ApiParam("流程ID") @RequestParam String flowId) throws Exception { String s = null; //获取乙方数据 @@ -216,4 +261,57 @@ public class ContractInvestmentController { .body(sealBytes); } + + + //投资协议 + /** + * 投资协议信息 + * @param flowId + * @return + */ + @GetMapping("/investmentAgreementInfo") + @AnonymousAccess + @ApiOperation("投资协议信息") + public ResultEntity investmentAgreementInfo(@ApiParam("流程ID") @RequestParam String flowId) { + + + InvestmentAgreementDto investmentAgreementDto = contractInvestmentService.investmentAgreementInfo(flowId); + + + return new ResultEntity<>(HttpStatus.OK,investmentAgreementDto); + } + + + @AnonymousAccess + @GetMapping("/signSealB") + @ApiOperation("签署投资协议乙方公章") + public ResponseEntity signSealB(@ApiParam("流程ID") @RequestParam String flowId) throws Exception { + String s = null; + + //生成公章 + s = sealUtil.genertSealA("皖西学院基金管理"); +// FileInputStream fileInputStream = new FileInputStream(filePath+"/seal/"+ s +".png"); +// +// MultipartFile multipartFile = new MockMultipartFile( +// "example.png", // 文件名 +// s + ".png", // 原始文件名 +// "png", // 文件类型 +// fileInputStream +// ); +// String upload = fileUtil.upload(multipartFile); + + // 模拟加载公章图片的数据(假设在硬盘上的某个路径下) + String imagePath = filePath + "/seal/" + s + ".png"; // 替换为你的实际路径 + byte[] sealBytes = Files.readAllBytes(Paths.get(imagePath)); + + // 构建HTTP响应,设置Content-Type为image/png + return ResponseEntity.ok() + .contentType(MediaType.IMAGE_PNG) + .body(sealBytes); + } + + + + + } diff --git a/src/main/java/com/sztzjy/fund_investment/entity/dto/InvestIntentionDetailedDto.java b/src/main/java/com/sztzjy/fund_investment/entity/dto/InvestIntentionDetailedDto.java index 5f01460..321680d 100644 --- a/src/main/java/com/sztzjy/fund_investment/entity/dto/InvestIntentionDetailedDto.java +++ b/src/main/java/com/sztzjy/fund_investment/entity/dto/InvestIntentionDetailedDto.java @@ -1,6 +1,7 @@ package com.sztzjy.fund_investment.entity.dto; import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Builder; import lombok.Data; @@ -15,6 +16,7 @@ import java.util.Date; @Data @Builder +@ApiModel(value = "投资意向书甲乙双方详细信息") public class InvestIntentionDetailedDto { @ApiModelProperty("签署时间") diff --git a/src/main/java/com/sztzjy/fund_investment/entity/dto/InvestmentAgreementDto.java b/src/main/java/com/sztzjy/fund_investment/entity/dto/InvestmentAgreementDto.java new file mode 100644 index 0000000..c63e256 --- /dev/null +++ b/src/main/java/com/sztzjy/fund_investment/entity/dto/InvestmentAgreementDto.java @@ -0,0 +1,129 @@ +package com.sztzjy.fund_investment.entity.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +/** + * /** 投资协议 + * + * @author 17803 + * @date 2023-12-06 9:17 + */ + +@Data +@ApiModel(value = "投资协议信息参数") +public class InvestmentAgreementDto { + + @ApiModelProperty("公司名称(xxxx有限公司都用这个参数)") + private String corporateName; + + @ApiModelProperty("法定代表人") + private String legalRepresentativePartA; + + @ApiModelProperty("注册地址") + private String regAddressPartA; + + + @ApiModelProperty("乙方公司名称") + private String corporateNamePartB; + + @ApiModelProperty("乙方法定代表人") + private String legalRepresentativePartB; + + @ApiModelProperty("乙方注册地址") + private String regAddressPartB; + + + @ApiModelProperty("承诺时间") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date promiseTime; + + @ApiModelProperty("承诺增资扩股") + private String increaseCapitalShare; + + @ApiModelProperty("增资后公司总股本") + private String totalShareCapital; + + @ApiModelProperty("增资基准日") + private String baseDateCapitalIncrease; + + @ApiModelProperty("第三条注册资本") + private String registeredCapital; + + @ApiModelProperty("第三条注册资本大写金额") + private String registeredCapitalAmount; + + @ApiModelProperty("第三条注册资本增加至") + private String registeredCapitalIncrease; + @ApiModelProperty("第三条注册资本增加至大写金额") + private String registeredCapitalIncreaseAmount; + @ApiModelProperty("第三条增资股份") + private String capitalIncreaseShares; + @ApiModelProperty("第三条乙方的增资总金额") + private Double totalAmountOfCapitalIncrease; + @ApiModelProperty("第三条新公司持有的股份") + private String sharesHeld; + @ApiModelProperty("第三条占新公司总股本百分比") + private String ownShare; + @ApiModelProperty("第三条4.0进入新公司股本金额") + private String amountMoney; + + + @ApiModelProperty("第三条5.转账时间") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date transferTime; + + + @ApiModelProperty("第十六条签约时间") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date signingTime; + + @ApiModelProperty("第十六条签约地点") + private String signingAddress; + + public InvestmentAgreementDto() { + this.corporateNamePartB = "皖西学院基金管理有限公司"; + this.legalRepresentativePartB = "张波"; + this.regAddressPartB = "安徽省六安市云露桥西月亮岛"; + } + + public InvestmentAgreementDto(String corporateName, String legalRepresentativePartA, String regAddressPartA, + String corporateNamePartB, String legalRepresentativePartB, String regAddressPartB, + Date promiseTime, String increaseCapitalShare, String totalShareCapital, + String baseDateCapitalIncrease, String registeredCapital, String registeredCapitalAmount, + String registeredCapitalIncrease, String registeredCapitalIncreaseAmount, + String capitalIncreaseShares, Double totalAmountOfCapitalIncrease, String sharesHeld, + String ownShare, String amountMoney, Date transferTime, Date signingTime, String signingAddress) { + this.corporateName = corporateName; + this.legalRepresentativePartA = legalRepresentativePartA; + this.regAddressPartA = regAddressPartA; + this.corporateNamePartB = "皖西学院基金管理有限公司"; + this.legalRepresentativePartB = "张波"; + this.regAddressPartB = "安徽省六安市云露桥西月亮岛"; + this.promiseTime = promiseTime; + this.increaseCapitalShare = increaseCapitalShare; + this.totalShareCapital = totalShareCapital; + this.baseDateCapitalIncrease = baseDateCapitalIncrease; + this.registeredCapital = registeredCapital; + this.registeredCapitalAmount = registeredCapitalAmount; + this.registeredCapitalIncrease = registeredCapitalIncrease; + this.registeredCapitalIncreaseAmount = registeredCapitalIncreaseAmount; + this.capitalIncreaseShares = capitalIncreaseShares; + this.totalAmountOfCapitalIncrease = totalAmountOfCapitalIncrease; + this.sharesHeld = sharesHeld; + this.ownShare = ownShare; + this.amountMoney = amountMoney; + this.transferTime = transferTime; + this.signingTime = signingTime; + this.signingAddress = signingAddress; + } +} diff --git a/src/main/java/com/sztzjy/fund_investment/entity/dto/ReportUploadDto.java b/src/main/java/com/sztzjy/fund_investment/entity/dto/ReportUploadDto.java index 152a77b..7c39654 100644 --- a/src/main/java/com/sztzjy/fund_investment/entity/dto/ReportUploadDto.java +++ b/src/main/java/com/sztzjy/fund_investment/entity/dto/ReportUploadDto.java @@ -1,5 +1,6 @@ package com.sztzjy.fund_investment.entity.dto; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; @@ -12,10 +13,15 @@ import org.springframework.web.bind.annotation.RequestParam; */ @Data +@ApiModel(value = "上传实验报告json参数") public class ReportUploadDto { - @ApiModelProperty("文件名称") - String fileName; +// { +// "flowId":"1", +// "schoolId":"1001", +// "reportNameType":"尽调报告/估值报告" +// } + @ApiModelProperty("流程id") String flowId; @ApiModelProperty("学校ID") diff --git a/src/main/java/com/sztzjy/fund_investment/service/ContractInvestmentService.java b/src/main/java/com/sztzjy/fund_investment/service/ContractInvestmentService.java index 6450f4f..467266b 100644 --- a/src/main/java/com/sztzjy/fund_investment/service/ContractInvestmentService.java +++ b/src/main/java/com/sztzjy/fund_investment/service/ContractInvestmentService.java @@ -1,5 +1,6 @@ package com.sztzjy.fund_investment.service; +import com.sztzjy.fund_investment.entity.dto.InvestmentAgreementDto; import com.sztzjy.fund_investment.entity.dto.ReportUploadDto; import com.sztzjy.fund_investment.util.ResultEntity; import org.springframework.web.multipart.MultipartFile; @@ -17,4 +18,10 @@ public interface ContractInvestmentService { ResultEntity uploadDueDiligenceReport(MultipartFile file, ReportUploadDto reportNameType); + /** + * 投资协议信息 + * @param flowId + * @return + */ + InvestmentAgreementDto investmentAgreementInfo(String flowId); } diff --git a/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/ContractInvestmentServiceImpl.java b/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/ContractInvestmentServiceImpl.java index e628867..2ce6d48 100644 --- a/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/ContractInvestmentServiceImpl.java +++ b/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/ContractInvestmentServiceImpl.java @@ -3,12 +3,19 @@ package com.sztzjy.fund_investment.service.serviceImpl;/** * @date 2023-12-05 9:02 */ +import cn.hutool.core.convert.Convert; +import cn.hutool.core.convert.ConverterRegistry; import cn.hutool.core.util.IdUtil; -import com.sztzjy.fund_investment.entity.TrainingReport; -import com.sztzjy.fund_investment.entity.TrainingReportExample; +import com.sztzjy.fund_investment.entity.*; +import com.sztzjy.fund_investment.entity.dto.InvestmentAgreementDto; import com.sztzjy.fund_investment.entity.dto.ReportUploadDto; +import com.sztzjy.fund_investment.mapper.FoundProjectMapper; +import com.sztzjy.fund_investment.mapper.ProfitManagementMapper; +import com.sztzjy.fund_investment.mapper.ProjectPoolMapper; import com.sztzjy.fund_investment.mapper.TrainingReportMapper; import com.sztzjy.fund_investment.service.ContractInvestmentService; +import com.sztzjy.fund_investment.service.ISysProjectDueDiligenceService; +import com.sztzjy.fund_investment.util.DateToUpperChinese; import com.sztzjy.fund_investment.util.ResultEntity; import com.sztzjy.fund_investment.util.file.IFileUtil; import org.apache.commons.lang3.StringUtils; @@ -17,6 +24,8 @@ import org.springframework.http.HttpStatus; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; +import java.math.BigDecimal; +import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.UUID; @@ -29,8 +38,21 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService @Autowired TrainingReportMapper trainingReportMapper; - /** 上传尽调报告 - * + + @Autowired + ISysProjectDueDiligenceService projectDueDiligenceService; + + @Autowired + private FoundProjectMapper foundProjectMapper; + + @Autowired + private ProjectPoolMapper projectPoolMapper; + + @Autowired + private ProfitManagementMapper profitManagementMapper; + + /** + * 上传尽调报告 */ @Override public ResultEntity uploadDueDiligenceReport(MultipartFile file, ReportUploadDto reportNameType) { @@ -44,18 +66,17 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService return new ResultEntity<>(HttpStatus.BAD_REQUEST, "文件必须为word或pdf!"); } //查看文件是否已经上传 - List trainingReports = getTrainingReports(reportNameType.getFlowId(),reportNameType.getReportNameType()); - if (trainingReports.size()>0) - { + List trainingReports = getTrainingReports(reportNameType.getFlowId(), reportNameType.getReportNameType()); + if (trainingReports.size() > 0) { return new ResultEntity<>(HttpStatus.BAD_REQUEST, "不允许重复提交!"); - } - else { //只允许提交一次 + } else { //只允许提交一次 TrainingReport trainingReport = new TrainingReport(); trainingReport.setId(IdUtil.fastSimpleUUID()); trainingReport.setFlowId(reportNameType.getFlowId()); trainingReport.setSchoolId(reportNameType.getSchoolId()); trainingReport.setUrl(filePath); - trainingReport.setReportName(reportNameType.getFileName()); + String filename = file.getOriginalFilename(); + trainingReport.setReportName(filename); trainingReport.setUploadtime(new Date()); trainingReport.setStep(reportNameType.getReportNameType()); trainingReportMapper.insert(trainingReport); @@ -63,10 +84,163 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService } } - public List getTrainingReports(String flowId,String reportName) { - TrainingReportExample trainingReportExample = new TrainingReportExample(); - trainingReportExample.createCriteria().andFlowIdEqualTo(flowId).andStepEqualTo(reportName); - return trainingReportMapper.selectByExample(trainingReportExample); + /** + * 投资协议信息 + * + * @param flowId + * @return + */ + @Override + public InvestmentAgreementDto investmentAgreementInfo(String flowId) { + + //根据flowId获取公司名和法人代表信息和注册地址 + + List list = projectDueDiligenceService.getBusinessInfoShareholderListByFlowId(flowId); + List businessInfoList = projectDueDiligenceService.getBusinessInfoList(flowId); + + + InvestmentAgreementDto investmentAgreementDto = new InvestmentAgreementDto(); + + + //获取乙方数据 + FoundProjectExample foundProjectExample = new FoundProjectExample(); + foundProjectExample.createCriteria().andFlowIdEqualTo(flowId); + List foundProjects = foundProjectMapper.selectByExample(foundProjectExample); + if (foundProjects.size() > 0) { + //立项项目ID + String projectPoolId = foundProjects.get(0).getProjectPoolId(); + + ProjectPoolExample projectPoolExample = new ProjectPoolExample(); + projectPoolExample.createCriteria().andProjectPoolIdEqualTo(projectPoolId); + List projectPools = projectPoolMapper.selectByExample(projectPoolExample); + String companyName = null; + + Double latestValuation = null; + if (projectPools.size() > 0) { + + ProjectPool projectPool = projectPools.get(0); + //项目估值 + latestValuation = Double.valueOf(projectPool.getLatestValuation()); + //获取公司名 + companyName = projectPool.getCompanyName(); + } + //公司名 + investmentAgreementDto.setCorporateName(companyName+"有限公司"); + //法定代表人 + investmentAgreementDto.setLegalRepresentativePartA(list.get(0).getLegalPerson()); + //注册地址 + investmentAgreementDto.setRegAddressPartA(businessInfoList.get(0).getRegisteredAddress()); + + // 获取当前日期 + Date currentDate = new Date(); + + // 将日期转换为Calendar对象 + Calendar calendar = Calendar.getInstance(); + calendar.setTime(currentDate); + + // 将月份增加1 + calendar.add(Calendar.MONTH, 1); + + // 获取加一个月后的日期 + Date newDate = calendar.getTime(); + //承诺时间 + investmentAgreementDto.setPromiseTime(newDate); + //假设1股为1元,增资扩股数等于投资金额,增资后总股本数等于估值+投资金额 + + //查询出来投资金额 + ProfitManagementExample profitManagementExample = new ProfitManagementExample(); + profitManagementExample.createCriteria().andFlowIdEqualTo(flowId); + //查询出来投资金额 + ProfitManagement profitManagement = profitManagementMapper.selectByExample(profitManagementExample).get(0); + //承诺增资扩股 + investmentAgreementDto.setIncreaseCapitalShare(profitManagement.getInvestmentAmount().toString()); + long v = profitManagement.getInvestmentAmount().longValue(); + Long aLong = Convert.toLong(latestValuation); + Long sum = aLong+v; + + //增资后公司总股本 + investmentAgreementDto.setTotalShareCapital(String.valueOf(sum)); + + //大写增资基准日 + String chinese = DateToUpperChinese.toChinese(newDate); + //增资基准日 + investmentAgreementDto.setBaseDateCapitalIncrease(chinese); + + //注册资本 + String registeredCapital = businessInfoList.get(0).getRegisteredCapital(); + //注册资本 + investmentAgreementDto.setRegisteredCapital(registeredCapital); + + Double aDouble = Convert.toDouble(registeredCapital); + //hutool工具转换金额 + String s = Convert.digitToChinese(aDouble); + //第三条注册资本大写金额 + investmentAgreementDto.setRegisteredCapitalAmount(s+"人民币"); + //投资金额 + BigDecimal investmentAmount = profitManagement.getInvestmentAmount(); + + Long aDouble1 = Convert.toLong(investmentAmount); + + + Long aLong1 = Convert.toLong(registeredCapital); + + //注册资本加上投资金额 + long sumMoney = aLong1+ aDouble1; + + + + //第三条注册资本增加至 + investmentAgreementDto.setRegisteredCapitalIncrease(String.valueOf(sumMoney)); + + + //hutool工具转换金额 + String s2 = Convert.digitToChinese(sumMoney); + + //第三条注册资本增加至大写金额 + investmentAgreementDto.setRegisteredCapitalIncreaseAmount(s2+"人民币"); + + //第三条增资股份等于投资金额 + investmentAgreementDto.setCapitalIncreaseShares(String.valueOf(investmentAmount)); + //第三条乙方的增资总金额 + investmentAgreementDto.setTotalAmountOfCapitalIncrease(investmentAmount.doubleValue()); + //第三条新公司持有的股份 + investmentAgreementDto.setSharesHeld(String.valueOf(investmentAmount)); + //第三条占新公司总股本百分比 + investmentAgreementDto.setOwnShare(profitManagement.getShareRatio().toString()); + //第三条4.0进入新公司股本金额 + investmentAgreementDto.setAmountMoney(String.valueOf(investmentAmount)); + + //第三条5.转账时间 + investmentAgreementDto.setTransferTime(newDate); + + //第十六条签约时间 + investmentAgreementDto.setSigningTime(new Date()); + + //第十六条签约地点 项目地址 + investmentAgreementDto.setSigningAddress(businessInfoList.get(0).getRegisteredAddress()); + + + + + return investmentAgreementDto; + + + + + + + } + return null; + } -} + public List getTrainingReports (String flowId, String reportName){ + TrainingReportExample trainingReportExample = new TrainingReportExample(); + trainingReportExample.createCriteria().andFlowIdEqualTo(flowId).andStepEqualTo(reportName); + return trainingReportMapper.selectByExample(trainingReportExample); + } + + } + + + diff --git a/src/main/java/com/sztzjy/fund_investment/util/DateToUpperChinese.java b/src/main/java/com/sztzjy/fund_investment/util/DateToUpperChinese.java new file mode 100644 index 0000000..3d5a004 --- /dev/null +++ b/src/main/java/com/sztzjy/fund_investment/util/DateToUpperChinese.java @@ -0,0 +1,98 @@ +package com.sztzjy.fund_investment.util; +import cn.hutool.core.date.DateUnit; +import cn.hutool.core.date.DateUtil; + +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * 日期转成中文大写形式 + * + */ +public class DateToUpperChinese { + + private static final String[] NUMBERS = { "零", "壹", "贰", "叁", "肆", "伍", + "陆", "柒", "捌", "玖" }; + + /** 通过 yyyy-MM-dd 得到中文大写格式 yyyy MM dd 日期 */ + public static synchronized String toChinese(Date newDate) { + SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd"); + String str = outputFormat.format(newDate); + + StringBuffer sb = new StringBuffer(); + sb.append(getSplitDateStr(str, 0)).append("年").append( + getSplitDateStr(str, 1)).append("月").append( + getSplitDateStr(str, 2)).append("日"); + return sb.toString(); + } + + /** 分别得到年月日的大写 默认分割符 "-" */ + public static String getSplitDateStr(String str, int unit) { + // unit是单位 0=年 1=月 2日 + String[] DateStr = str.split("-"); + if (unit > DateStr.length) + unit = 0; + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < DateStr[unit].length(); i++) { + + if ((unit == 1 || unit == 2) && Integer.valueOf(DateStr[unit]) > 9) { + sb.append(convertNum(DateStr[unit].substring(0, 1))) + .append("拾").append( + convertNum(DateStr[unit].substring(1, 2))); + break; + } else { + sb.append(convertNum(DateStr[unit].substring(i, i + 1))); + } + } + if (unit == 1 || unit == 2) { + return sb.toString().replaceAll("^壹", "").replace("零", ""); + } + return sb.toString(); + + } + + /** 转换数字为大写 */ + private static String convertNum(String str) { + return NUMBERS[Integer.valueOf(str)]; + } + + /** 判断是否是零或正整数 */ + public static boolean isNumeric(String str) { + Pattern pattern = Pattern.compile("[0-9]*"); + Matcher isNum = pattern.matcher(str); + if (!isNum.matches()) { + return false; + } + return true; + } + + public static void main(String args[]) { + + + System.out.println(toChinese(DateUtil.parse("2008-10-24"))); + + // 获取当前日期 + Date currentDate = new Date(); + + // 将日期转换为Calendar对象 + Calendar calendar = Calendar.getInstance(); + calendar.setTime(currentDate); + + // 将月份增加1 + calendar.add(Calendar.MONTH, 1); + + // 获取加一个月后的日期 + Date newDate = calendar.getTime(); + +// // 将 Date 对象格式化为 "yyyy-MM-dd" 的字符串 +// SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd"); +// String outputDateString = outputFormat.format(newDate); +// System.out.println(outputDateString); + + System.out.println(toChinese(newDate)); + } + +} \ No newline at end of file diff --git a/src/test/java/com/sztzjy/fund_investment/FundInvestmentApplicationTests.java b/src/test/java/com/sztzjy/fund_investment/FundInvestmentApplicationTests.java index a00e11f..74f7221 100644 --- a/src/test/java/com/sztzjy/fund_investment/FundInvestmentApplicationTests.java +++ b/src/test/java/com/sztzjy/fund_investment/FundInvestmentApplicationTests.java @@ -17,62 +17,4 @@ class FundInvestmentApplicationTests { } - @Test - public void OfficialSeal_1() throws Exception { - SealUtil.builder() - .size(200) - .borderCircle(SealCircle.builder().line(4).width(95).height(95).build()) - .mainFont(SealFont.builder().text("天泽股权投资基金").size(22).space(22.0).margin(4).build()) - .centerFont(SealFont.builder().text("★").size(60).build()) - .titleFont(SealFont.builder().text("电子签章").size(16).space(8.0).margin(54).build()) - .build() - .draw("D:\\home\\公章1.png"); - System.out.println("已完成"); - } - - @Test - public void OfficialSeal_2() throws Exception { - SealUtil.builder() - .size(300) - .borderCircle(SealCircle.builder().line(5).width(140).height(140).build()) - .mainFont(SealFont.builder().text("xxx科技有限公司").size(35).space(35.0).margin(10).build()) - .centerFont(SealFont.builder().text("★").size(100).build()) - .titleFont(SealFont.builder().text("电子签章").size(22).space(10.0).margin(68).build()) - .build() - .draw("D:\\home\\公章2.png"); - } - - @Test - public void OfficialSeal_3() throws Exception { - SealUtil.builder() - .size(300) - .borderCircle(SealCircle.builder().line(3).width(144).height(100).build()) - .borderInnerCircle(SealCircle.builder().line(1).width(140).height(96).build()) - .mainFont(SealFont.builder().text("xxx科技有限公司").size(25).space(12.0).margin(10).build()) - .centerFont(SealFont.builder().text("NO.5201314").size(20).build()) - .titleFont(SealFont.builder().text("电子合同专用章").size(20).space(9.0).margin(64).build()) - .build() - .draw("D:\\home\\公章3.png"); - } - - @Test - public void PrivateSeal_1() throws Exception { - SealUtil.builder() - .size(300) - .borderSquare(16) - .mainFont(SealFont.builder().text("秦始皇").size(120).build()) - .build() - .draw("D:\\home\\私章1.png"); - } - - @Test - public void PrivateSeal_2() throws Exception { - SealUtil.builder() - .size(300) - .borderSquare(16) - .mainFont(SealFont.builder().text("刘皇叔印").size(120).build()) - .build() - .draw("D:\\home\\私章2.png"); - } - }