From d825e64062a5c28d313bf52607c19139017b55f5 Mon Sep 17 00:00:00 2001 From: wanghb <17803890193@163.com> Date: Tue, 12 Dec 2023 18:04:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=BF=E9=94=80=E5=95=86=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E5=8F=91=E8=A1=8C=E7=94=B3=E8=AF=B7,=E5=8F=91=E8=A1=8C?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E5=BD=95=E5=85=A5,=E7=BD=91=E4=B8=8B?= =?UTF-8?q?=E9=85=8D=E5=94=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ContractInvestmentController.java | 153 ++++++-- .../fund_investment/entity/IssuanceInfo.java | 14 +- .../entity/preliminaryOfflineDto.java | 26 ++ .../service/ContractInvestmentService.java | 31 ++ .../ContractInvestmentServiceImpl.java | 362 +++++++++++++++++- .../fund_investment/util/seal/SealFont.java | 2 +- .../FundInvestmentApplicationTests.java | 3 + 7 files changed, 561 insertions(+), 30 deletions(-) create mode 100644 src/main/java/com/sztzjy/fund_investment/entity/preliminaryOfflineDto.java 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 a9ae911..c6302d9 100644 --- a/src/main/java/com/sztzjy/fund_investment/controller/ContractInvestmentController.java +++ b/src/main/java/com/sztzjy/fund_investment/controller/ContractInvestmentController.java @@ -1,5 +1,6 @@ package com.sztzjy.fund_investment.controller; +import cn.hutool.core.convert.Convert; import cn.hutool.core.io.resource.ClassPathResource; import cn.hutool.core.util.IdUtil; import com.nimbusds.jose.shaded.gson.Gson; @@ -10,10 +11,12 @@ 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.IssuanceInfoMapper; 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; +import com.sztzjy.fund_investment.service.PerformanceScoreService; import com.sztzjy.fund_investment.util.ResultEntity; import com.sztzjy.fund_investment.util.SealUtil; import com.sztzjy.fund_investment.util.file.IFileUtil; @@ -33,6 +36,7 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import java.io.FileInputStream; import java.io.IOException; +import java.lang.reflect.Field; import java.math.BigDecimal; import java.math.RoundingMode; import java.nio.file.Files; @@ -76,6 +80,12 @@ public class ContractInvestmentController { @Resource IFileUtil fileUtil; + @Autowired + private IssuanceInfoMapper issuanceInfoMapper; + + @Autowired + private PerformanceScoreService performanceScoreService; + /** * 上传尽调报告 */ @@ -150,7 +160,7 @@ public class ContractInvestmentController { profitManagement.setShareRatio(BigDecimal.valueOf(proportion)); profitManagement.setTotalEquity(BigDecimal.valueOf(v)); //设置公司名 - profitManagement.setProjectName(companyName+"有限公司"); + 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); // 保留两位小数 @@ -158,6 +168,9 @@ public class ContractInvestmentController { profitManagementMapper.insert(profitManagement); } } + //加分该处填写完成得4分 + performanceScoreService.calculateScoreByModule("investmentSigningInvestScore", 4, flowId); + return new ResultEntity<>(HttpStatus.OK, proportion); } else { return new ResultEntity(HttpStatus.BAD_REQUEST, "查询不到立项项目"); @@ -185,16 +198,14 @@ public class ContractInvestmentController { } - - @AnonymousAccess @GetMapping("/sealA") @ApiOperation("生成甲方公章") public ResponseEntity getSealImageA(@ApiParam("流程ID") @RequestParam String flowId) throws Exception { - String s = null; + String s = null; - //生成公章 - s = sealUtil.genertSealA("天泽股权投资基金"); + //生成公章 + s = sealUtil.genertSealA("天泽股权投资基金"); // FileInputStream fileInputStream = new FileInputStream(filePath+"/seal/"+ s +".png"); // // MultipartFile multipartFile = new MockMultipartFile( @@ -216,7 +227,6 @@ public class ContractInvestmentController { } - @AnonymousAccess @GetMapping("/sealB") @ApiOperation("投资意向书乙方公章和投资协议甲方公章") @@ -251,24 +261,25 @@ public class ContractInvestmentController { } } - // 模拟加载公章图片的数据(假设在硬盘上的某个路径下) - 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); - } + // 模拟加载公章图片的数据(假设在硬盘上的某个路径下) + 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); + } //投资协议 + /** - * 投资协议信息 - * @param flowId - * @return - */ + * 投资协议信息 + * + * @param flowId + * @return + */ @GetMapping("/investmentAgreementInfo") @AnonymousAccess @ApiOperation("投资协议信息") @@ -278,18 +289,25 @@ public class ContractInvestmentController { InvestmentAgreementDto investmentAgreementDto = contractInvestmentService.investmentAgreementInfo(flowId); - return new ResultEntity<>(HttpStatus.OK,investmentAgreementDto); + return new ResultEntity<>(HttpStatus.OK, investmentAgreementDto); } @AnonymousAccess @GetMapping("/signSealB") @ApiOperation("签署投资协议乙方公章") - public ResponseEntity signSealB(@ApiParam("流程ID") @RequestParam String flowId) throws Exception { + public ResponseEntity signSealB(@ApiParam("流程ID") @RequestParam String flowId,@ApiParam("基金公司名称")String companyName) throws Exception { + + //查询公司名称并校验 + if ("皖西学院基金管理有限公司".equals(companyName)){ + return new ResultEntity(HttpStatus.BAD_REQUEST, "请填写正确的基金公司名称!"); + } + + String s = null; //生成公章 - s = sealUtil.genertSealA("皖西学院基金管理"); + s = sealUtil.genertSealA("皖西学院基金管理有限公司"); // FileInputStream fileInputStream = new FileInputStream(filePath+"/seal/"+ s +".png"); // // MultipartFile multipartFile = new MockMultipartFile( @@ -304,6 +322,9 @@ public class ContractInvestmentController { String imagePath = filePath + "/seal/" + s + ".png"; // 替换为你的实际路径 byte[] sealBytes = Files.readAllBytes(Paths.get(imagePath)); + //返回公章并加分 + performanceScoreService.calculateScoreByModule("investmentSigningScore", 2, flowId); + // 构建HTTP响应,设置Content-Type为image/png return ResponseEntity.ok() .contentType(MediaType.IMAGE_PNG) @@ -311,7 +332,93 @@ public class ContractInvestmentController { } + /** + * 承销商新建发行申请 + * + * @return + */ + + @AnonymousAccess + @PostMapping("/newIssuanceApplication") + @ApiOperation("承销商新建发行申请") + public ResultEntity newIssuanceApplication(@RequestBody IssuanceInfo issuanceInfo) { + + return contractInvestmentService.newIssuanceApplication(issuanceInfo); + } + + + /** 承销商新建发行申请基本信息展示 + * @param flowId + * @return + */ + + + @AnonymousAccess + @GetMapping("/newIssuanceApplicationBaseInfo") + @ApiOperation("承销商新建发行申请基本信息展示") + public ResultEntity newIssuanceApplicationBaseInfo(@ApiParam("流程ID") @RequestParam String flowId) { + + + IssuanceInfoExample issuanceInfoExample = new IssuanceInfoExample(); + issuanceInfoExample.createCriteria().andFlowIdEqualTo(flowId); + List issuanceInfos = issuanceInfoMapper.selectByExample(issuanceInfoExample); + if (issuanceInfos.size() > 0) { + return new ResultEntity<>(HttpStatus.OK, issuanceInfos.get(0)); + } + return new ResultEntity<>(HttpStatus.OK); + } + + /** + *发行参数录入基本信息 + * @param flowId + * @return + */ + + @AnonymousAccess + @GetMapping("/releaseParametersInfo") + @ApiOperation("发行参数录入基本信息") + public ResultEntity releaseParametersInfo(@ApiParam("流程ID") @RequestParam String flowId) { + + IssuanceParameterInput info = contractInvestmentService.releaseParametersInfo(flowId); + + + return new ResultEntity<>(HttpStatus.OK,info); + } + /** + * 发行参数录入 + * + * @return + */ + + @AnonymousAccess + @PostMapping("/updateReleaseParametersInfo") + @ApiOperation("发行参数录入") + public ResultEntity updateReleaseParametersInfo(@RequestBody IssuanceParameterInput issuanceParameterInput) { + + return contractInvestmentService.updateReleaseParametersInfo(issuanceParameterInput); + } + + + + + /** + * 网下初步配售发行价格发行总量 + * @param flowId + * @return + */ + + @AnonymousAccess + @GetMapping("/preliminaryOffline") + @ApiOperation("网下初步配售发行价格发行总量") + public ResultEntity preliminaryOffline(@ApiParam("流程ID") @RequestParam String flowId) { + + preliminaryOfflineDto info = contractInvestmentService.preliminaryOffline(flowId); + + + return new ResultEntity<>(HttpStatus.OK,info); + } + } diff --git a/src/main/java/com/sztzjy/fund_investment/entity/IssuanceInfo.java b/src/main/java/com/sztzjy/fund_investment/entity/IssuanceInfo.java index 6454d42..eea6496 100644 --- a/src/main/java/com/sztzjy/fund_investment/entity/IssuanceInfo.java +++ b/src/main/java/com/sztzjy/fund_investment/entity/IssuanceInfo.java @@ -3,12 +3,17 @@ package com.sztzjy.fund_investment.entity; import java.math.BigDecimal; import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import org.springframework.format.annotation.DateTimeFormat; + /** * * @author xcj * issuance_info */ +@ApiModel public class IssuanceInfo { private String id; @@ -23,10 +28,13 @@ public class IssuanceInfo { @ApiModelProperty("最低非限售A股市值") private BigDecimal minimumNonRestrictedASharesMarketValue; - + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") @ApiModelProperty("初步询价起始日期") private Date initialInquiryStartDate; + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") @ApiModelProperty("网下申购起始日期") private Date offlineSubscriptionStartDate; @@ -63,9 +71,13 @@ public class IssuanceInfo { @ApiModelProperty("是否设自愿锁定期") private Byte voluntaryLockupPeriod; + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") @ApiModelProperty("初步询价截止日期") private Date initialInquiryDeadline; + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") @ApiModelProperty("网下申购截止日期") private Date offlineSubscriptionDeadline; diff --git a/src/main/java/com/sztzjy/fund_investment/entity/preliminaryOfflineDto.java b/src/main/java/com/sztzjy/fund_investment/entity/preliminaryOfflineDto.java new file mode 100644 index 0000000..18a1257 --- /dev/null +++ b/src/main/java/com/sztzjy/fund_investment/entity/preliminaryOfflineDto.java @@ -0,0 +1,26 @@ +package com.sztzjy.fund_investment.entity; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +/** + * @author 17803 + * @date 2023-12-12 17:52 + */ +@ApiModel +@Data +@Builder +public class preliminaryOfflineDto { + + @ApiModelProperty("发行价格") + private String IssuePrice; + + @ApiModelProperty("网下发行数量") + private String IssueNumber; + + @ApiModelProperty("余股总量") + private String TotalRemaining; + +} 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 467266b..e1832d7 100644 --- a/src/main/java/com/sztzjy/fund_investment/service/ContractInvestmentService.java +++ b/src/main/java/com/sztzjy/fund_investment/service/ContractInvestmentService.java @@ -1,7 +1,10 @@ package com.sztzjy.fund_investment.service; +import com.sztzjy.fund_investment.entity.IssuanceInfo; +import com.sztzjy.fund_investment.entity.IssuanceParameterInput; import com.sztzjy.fund_investment.entity.dto.InvestmentAgreementDto; import com.sztzjy.fund_investment.entity.dto.ReportUploadDto; +import com.sztzjy.fund_investment.entity.preliminaryOfflineDto; import com.sztzjy.fund_investment.util.ResultEntity; import org.springframework.web.multipart.MultipartFile; @@ -24,4 +27,32 @@ public interface ContractInvestmentService { * @return */ InvestmentAgreementDto investmentAgreementInfo(String flowId); + + /** + * 承销商新建发行申请 + * @return + */ + ResultEntity newIssuanceApplication(IssuanceInfo issuanceInfo); + + + /** + *发行参数录入基本信息 + * @param flowId + * @return + */ + IssuanceParameterInput releaseParametersInfo(String flowId); + + /** + * 发行参数录入 + * + * @return + */ + ResultEntity updateReleaseParametersInfo(IssuanceParameterInput issuanceParameterInput); + + /** + * 网下初步配售发行价格发行总量 + * @param flowId + * @return + */ + preliminaryOfflineDto preliminaryOffline(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 2ce6d48..ae5c329 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 @@ -9,12 +9,10 @@ import cn.hutool.core.util.IdUtil; 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.mapper.*; import com.sztzjy.fund_investment.service.ContractInvestmentService; import com.sztzjy.fund_investment.service.ISysProjectDueDiligenceService; +import com.sztzjy.fund_investment.service.PerformanceScoreService; import com.sztzjy.fund_investment.util.DateToUpperChinese; import com.sztzjy.fund_investment.util.ResultEntity; import com.sztzjy.fund_investment.util.file.IFileUtil; @@ -24,7 +22,9 @@ import org.springframework.http.HttpStatus; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; +import java.lang.reflect.Field; import java.math.BigDecimal; +import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.List; @@ -51,6 +51,22 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService @Autowired private ProfitManagementMapper profitManagementMapper; + + @Autowired + private IssuanceInfoMapper issuanceInfoMapper; + + @Autowired + private InquiryParticipationMapper inquiryParticipationMapper; + + @Autowired + private IssuanceParameterInputMapper issuanceParameterInputMapper; + + @Autowired + private PerformanceScoreMapper performanceScoreMapper; + + @Autowired + private PerformanceScoreService performanceScoreService; + /** * 上传尽调报告 */ @@ -80,6 +96,17 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService trainingReport.setUploadtime(new Date()); trainingReport.setStep(reportNameType.getReportNameType()); trainingReportMapper.insert(trainingReport); + //(每个2分,共4分) + if ("尽调报告".equals(reportNameType.getReportNameType())){ + //investmentSigningDiligenceReportScore + + performanceScoreService.calculateScoreByModule("investmentSigningDiligenceReportScore", 2, reportNameType.getFlowId()); + + }else if ("估值报告".equals(reportNameType.getReportNameType())){ + //investmentSigningVlauationReportScore + performanceScoreService.calculateScoreByModule("investmentSigningVlauationReportScore", 2, reportNameType.getFlowId()); + + } return new ResultEntity<>(HttpStatus.OK, "报告上传成功!"); } } @@ -234,7 +261,332 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService } - public List getTrainingReports (String flowId, String reportName){ + /** + * 承销商新建发行申请 + * @return + */ + @Override + public ResultEntity newIssuanceApplication(IssuanceInfo issuanceInfo) { + + + //发行总量和公司名称做校验 + + + IssuanceInfoExample issuanceInfoExample = new IssuanceInfoExample(); + issuanceInfoExample.createCriteria().andFlowIdEqualTo(issuanceInfo.getFlowId()); + List issuanceInfos = issuanceInfoMapper.selectByExample(issuanceInfoExample); + //查询有无第一次录入的数据 + if (issuanceInfos.size()>0) + { + //获取上一次录入的数据和这一次录入的做对比 + String s = compareFields(issuanceInfo,issuanceInfos.get(0)); + if (!s.isEmpty()) + { + issuanceInfoMapper.deleteByExample(issuanceInfoExample); + return new ResultEntity<>(HttpStatus.OK,s,"两次输入的"+s+":"+"值不同!"); + } + //完成新建发行申请3分 + performanceScoreService.calculateScoreByModule("newPricingIssuanceScore", 3, issuanceInfo.getFlowId()); + return new ResultEntity<>(HttpStatus.OK,s,"添加成功"); + + + } + //第一次录入和估值做计算 + else { + //查询立项公司估值 + FoundProjectExample foundProjectExample = new FoundProjectExample(); + foundProjectExample.createCriteria().andFlowIdEqualTo(issuanceInfo.getFlowId()); + 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); + if (projectPools.size() > 0) { + //项目估值 + String latestValuation = projectPools.get(0).getLatestValuation(); + Long aLong = Convert.toLong(latestValuation); + long max = 4000000000L; + + BigDecimal totalIssuanceVolume = issuanceInfo.getTotalIssuanceVolume(); + //学生输入的发行总量 + long l = totalIssuanceVolume.longValue(); + long info = l * 100000; + //判断估值和4亿比较 + //估值小于4亿的,发行总量大于等于估值的25%,估值大于4亿的,发行总量大于估值的10% + if(aLong > max){ + + if (info/aLong >0.1) { + issuanceInfo.setId(IdUtil.fastSimpleUUID()); + //插入数据 + issuanceInfoMapper.insert(issuanceInfo); + return new ResultEntity(HttpStatus.OK); + + }else { + return new ResultEntity(HttpStatus.BAD_REQUEST, "发行总量小于估值的10%"); + } + }else if (aLong < max){ + if (info/aLong >0.25) { + issuanceInfo.setId(IdUtil.fastSimpleUUID()); + //插入数据 + issuanceInfoMapper.insert(issuanceInfo); + return new ResultEntity(HttpStatus.OK); + + }else { + return new ResultEntity(HttpStatus.BAD_REQUEST, "发行总量小于估值的25%"); + } + } + //取出发行总量 + } + } + } + return null; + + } + + /** + *发行参数录入基本信息 + * @param flowId + * @return + */ + @Override + public IssuanceParameterInput releaseParametersInfo(String flowId) { + + IssuanceInfoExample issuanceInfoExample = new IssuanceInfoExample(); + issuanceInfoExample.createCriteria().andFlowIdEqualTo(flowId); + List issuanceInfos = issuanceInfoMapper.selectByExample(issuanceInfoExample); + if (issuanceInfos.size() > 0) { + IssuanceInfo issuanceInfo = issuanceInfos.get(0); + + // + IssuanceParameterInput issuanceParameterInput = new IssuanceParameterInput(); + //公司名称 + issuanceParameterInput.setCompanyName(issuanceInfo.getCompanyName()); + //证券代码 + issuanceParameterInput.setSecurityCode(issuanceInfo.getSecurityCode()); + //证券简称 + issuanceParameterInput.setSecurityAbbreviation(issuanceInfo.getSecurityAbbreviation()); + //发行总量 + issuanceParameterInput.setTotalIssuanceVolume(issuanceInfo.getTotalIssuanceVolume()); + //网下发行总量 + issuanceParameterInput.setOfflineIssuanceQuantity(issuanceInfo.getOfflineIssuanceQuantity()); + + InquiryParticipationExample inquiryParticipationExample = new InquiryParticipationExample(); + inquiryParticipationExample.createCriteria().andFlowIdEqualTo(flowId); + inquiryParticipationExample.setOrderByClause("submission_time desc"); + + List inquiryParticipations = inquiryParticipationMapper.selectByExample(inquiryParticipationExample); + + if (inquiryParticipations.size() > 0) { + //最新添加的报价 + InquiryParticipation inquiryParticipation = inquiryParticipations.get(0); + //发行价格 + issuanceParameterInput.setIssuancePrice(inquiryParticipation.getDeclarationPrice()); + } + + + return issuanceParameterInput; + + } + + return null; + } + + + /** + * 发行参数录入 + * + * @return + */ + + @Override + public ResultEntity updateReleaseParametersInfo(IssuanceParameterInput issuanceParameterInput) { + IssuanceParameterInputExample issuanceParameterInputExample = new IssuanceParameterInputExample(); + issuanceParameterInputExample.createCriteria().andFlowIdEqualTo(issuanceParameterInput.getFlowId()); + List issuanceParameterInputList = issuanceParameterInputMapper.selectByExample(issuanceParameterInputExample); + //查询有无第一次录入的数据 + if (issuanceParameterInputList.size()>0) + { + //获取上一次录入的数据和这一次录入的做对比 + String s = compareFieldsTwo(issuanceParameterInput,issuanceParameterInputList.get(0)); + if (!s.isEmpty()) + { + issuanceParameterInputMapper.deleteByExample(issuanceParameterInputExample); + return new ResultEntity<>(HttpStatus.OK,s,"两次输入的"+s+":"+"值不同!"); + } + //询价结果查询及发行参数录入2分 + performanceScoreService.calculateScoreByModule("pricingIssuanceEnteringScore", 2, issuanceParameterInput.getFlowId()); + + return new ResultEntity<>(HttpStatus.OK,s,"添加成功"); + } + //第一次录入和估值做计算 + else { + issuanceParameterInput.setId(IdUtil.fastSimpleUUID()); + + issuanceParameterInputMapper.insertSelective(issuanceParameterInput); + return new ResultEntity<>(HttpStatus.OK); + } + + + } + + /** + * 网下初步配售发行价格发行总量 + * @param flowId + * @return + */ + @Override + public preliminaryOfflineDto preliminaryOffline(String flowId) { + IssuanceParameterInputExample issuanceParameterInputExample = new IssuanceParameterInputExample(); + issuanceParameterInputExample.createCriteria().andFlowIdEqualTo(flowId); + IssuanceParameterInput issuanceParameterInput = issuanceParameterInputMapper.selectByExample(issuanceParameterInputExample).get(0); + + + preliminaryOfflineDto build = preliminaryOfflineDto.builder().IssuePrice(issuanceParameterInput.getIssuancePrice().toString()). + IssueNumber(issuanceParameterInput.getOfflineIssuanceQuantity().toString()) + .TotalRemaining(issuanceParameterInput.getOfflineIssuanceQuantity().toString()).build(); + + + return build; + } + + + // 比较两个Student对象的字段,返回不相同的字段 + public String compareFieldsTwo(IssuanceParameterInput newInfo ,IssuanceParameterInput other) { + IssuanceParameterInputExample issuanceParameterInputExample = new IssuanceParameterInputExample(); + issuanceParameterInputExample.createCriteria().andFlowIdEqualTo(newInfo.getFlowId()); + List issuanceParameterInputList = issuanceParameterInputMapper.selectByExample(issuanceParameterInputExample); + //查询有无第一次录入的数据 + String id = issuanceParameterInputList.get(0).getId(); + newInfo.setId(id); + //查询有无第一次录入的数据 + + StringBuilder differences = new StringBuilder(); + + // 获取Student类的所有字段 + Field[] fields = newInfo.getClass().getDeclaredFields(); + for (Field field : fields) { + // 设置字段可访问,因为可能是私有的 + field.setAccessible(true); + + try { + // 获取当前对象和另一个对象的字段值 + Object thisValue = field.get(newInfo); + Object otherValue = field.get(other); + +// // 比较字段值,如果不相同,记录下来 +// if ((thisValue == null && otherValue != null) || (thisValue != null && !thisValue.equals(otherValue))) { +// differences.append(field.getName()).append(": ").append(thisValue).append(" -> ").append(otherValue).append("\n"); +// } + + // 检查是否为浮点数,并比较数值 + if (thisValue instanceof BigDecimal && otherValue instanceof BigDecimal) { + BigDecimal epsilon = new BigDecimal("0.01"); // 设置误差范围 + + // 使用 compareTo 方法进行比较 + if (((BigDecimal) thisValue).subtract((BigDecimal) otherValue).abs().compareTo(epsilon) > 0) { + differences.append(field.getName()).append(": ").append(thisValue).append(" -> ").append(otherValue).append("/n"); + } + } else if (thisValue instanceof Date && otherValue instanceof Date) { + // 对于日期字段,格式化日期为 "yyyy-MM-dd" + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + String formattedThisValue = dateFormat.format((Date) thisValue); + String formattedOtherValue = dateFormat.format((Date) otherValue); + + // 比较格式化后的日期 + if (!formattedThisValue.equals(formattedOtherValue)) { + differences.append(field.getName()).append(": ").append(formattedThisValue).append(" -> ").append(formattedOtherValue).append("/n"); + } + } + else { + // 对于非浮点数,直接使用 equals 进行比较 + if ((thisValue == null && otherValue != null) || (thisValue != null && !thisValue.equals(otherValue))) { + differences.append(field.getName()).append(": ").append(thisValue).append(" -> ").append(otherValue).append("/n"); + } + } + + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + } + + return differences.toString(); + } + + + + + // 比较两个Student对象的字段,返回不相同的字段 + public String compareFields(IssuanceInfo newInfo ,IssuanceInfo other) { + IssuanceInfoExample issuanceInfoExample = new IssuanceInfoExample(); + issuanceInfoExample.createCriteria().andFlowIdEqualTo(other.getFlowId()); + List issuanceInfos = issuanceInfoMapper.selectByExample(issuanceInfoExample); + String id = issuanceInfos.get(0).getId(); + newInfo.setId(id); + //查询有无第一次录入的数据 + + StringBuilder differences = new StringBuilder(); + + // 获取Student类的所有字段 + Field[] fields = newInfo.getClass().getDeclaredFields(); + for (Field field : fields) { + // 设置字段可访问,因为可能是私有的 + field.setAccessible(true); + + try { + // 获取当前对象和另一个对象的字段值 + Object thisValue = field.get(newInfo); + Object otherValue = field.get(other); + +// // 比较字段值,如果不相同,记录下来 +// if ((thisValue == null && otherValue != null) || (thisValue != null && !thisValue.equals(otherValue))) { +// differences.append(field.getName()).append(": ").append(thisValue).append(" -> ").append(otherValue).append("\n"); +// } + + // 检查是否为浮点数,并比较数值 + if (thisValue instanceof BigDecimal && otherValue instanceof BigDecimal) { + BigDecimal epsilon = new BigDecimal("0.01"); // 设置误差范围 + + // 使用 compareTo 方法进行比较 + if (((BigDecimal) thisValue).subtract((BigDecimal) otherValue).abs().compareTo(epsilon) > 0) { + differences.append(field.getName()).append(": ").append(thisValue).append(" -> ").append(otherValue).append("/n"); + } + } else if (thisValue instanceof Date && otherValue instanceof Date) { + // 对于日期字段,格式化日期为 "yyyy-MM-dd" + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + String formattedThisValue = dateFormat.format((Date) thisValue); + String formattedOtherValue = dateFormat.format((Date) otherValue); + + // 比较格式化后的日期 + if (!formattedThisValue.equals(formattedOtherValue)) { + differences.append(field.getName()).append(": ").append(formattedThisValue).append(" -> ").append(formattedOtherValue).append("/n"); + } + } + else { + // 对于非浮点数,直接使用 equals 进行比较 + if ((thisValue == null && otherValue != null) || (thisValue != null && !thisValue.equals(otherValue))) { + differences.append(field.getName()).append(": ").append(thisValue).append(" -> ").append(otherValue).append("/n"); + } + } + + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + } + + return differences.toString(); + } + + + + + + + + + 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/seal/SealFont.java b/src/main/java/com/sztzjy/fund_investment/util/seal/SealFont.java index 8a37d0b..cbd40a7 100644 --- a/src/main/java/com/sztzjy/fund_investment/util/seal/SealFont.java +++ b/src/main/java/com/sztzjy/fund_investment/util/seal/SealFont.java @@ -23,7 +23,7 @@ public class SealFont { private Integer margin; public String getFamily() { - return family == null ? "仿宋体" : family; + return family == null ? "宋体" : family; } public boolean getBold() { diff --git a/src/test/java/com/sztzjy/fund_investment/FundInvestmentApplicationTests.java b/src/test/java/com/sztzjy/fund_investment/FundInvestmentApplicationTests.java index 74f7221..83c8ca4 100644 --- a/src/test/java/com/sztzjy/fund_investment/FundInvestmentApplicationTests.java +++ b/src/test/java/com/sztzjy/fund_investment/FundInvestmentApplicationTests.java @@ -1,5 +1,6 @@ package com.sztzjy.fund_investment; +import cn.hutool.core.util.RandomUtil; import com.sztzjy.fund_investment.util.seal.SealCircle; import com.sztzjy.fund_investment.util.seal.SealFont; import com.sztzjy.fund_investment.util.seal.SealUtil; @@ -14,6 +15,8 @@ class FundInvestmentApplicationTests { @Test void contextLoads() { + String s = RandomUtil.randomString("123456", 6); + System.out.println(RandomUtil.randomString("123456", 6)); }