|
@@ -2,6 +2,7 @@ package com.dayou.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -17,6 +18,7 @@ import com.dayou.mapper.*;
|
|
|
import com.dayou.message.annotation.SendMessage;
|
|
|
import com.dayou.service.*;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.dayou.service.workflow.IWorkFlowNodeInstanceService;
|
|
|
import com.dayou.utils.LoginContext;
|
|
|
import com.dayou.vo.*;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -97,15 +99,25 @@ public class MajorProductionServiceImpl extends ServiceImpl<MajorProductionMappe
|
|
|
@Autowired
|
|
|
private IOrderFundAllotService orderFundAllotService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IWorkFlowNodeInstanceService workFlowNodeInstanceService;
|
|
|
+
|
|
|
|
|
|
|
|
|
@Override
|
|
|
@SuppressWarnings("unchecked")
|
|
|
public List<MajorProduction> selectPage(MajorProduction majorProduction){
|
|
|
List<MajorProduction> list = majorProductionMapper.getList(majorProduction);
|
|
|
- list.stream().forEach(x->{
|
|
|
- x.setSignatoryId(JSON.parseArray(x.getSignatory(),Long.class));
|
|
|
- });
|
|
|
+ if(CollectionUtils.isNotEmpty(list)){
|
|
|
+ MajorProduction production = list.get(0);
|
|
|
+ String reportNo = production.getReportNo();
|
|
|
+ String productionType = production.getProduction();
|
|
|
+ Boolean ifReverse = workFlowNodeInstanceService.checkIfReverse(productionType, reportNo);
|
|
|
+ list.stream().forEach(x->{
|
|
|
+ x.setSignatoryId(JSON.parseArray(x.getSignatory(),Long.class));
|
|
|
+ x.setIfReverse(ifReverse);
|
|
|
+ });
|
|
|
+ }
|
|
|
return list;
|
|
|
}
|
|
|
|
|
@@ -118,45 +130,27 @@ public class MajorProductionServiceImpl extends ServiceImpl<MajorProductionMappe
|
|
|
@Override
|
|
|
public Boolean add(MajorProduction taskData){
|
|
|
String reportNo = taskData.getReportNo();
|
|
|
+ String statementNo = taskData.getStatementNo();
|
|
|
Long majorId = taskData.getMajorId();
|
|
|
- //查询生成过该报告的产品信息
|
|
|
- List<MajorProduction> list = this.list(new LambdaQueryWrapper<MajorProduction>().eq(MajorProduction::getMajorId, majorId).eq(MajorProduction::getReportNo, reportNo).eq(BaseEntity::getDeleted, Boolean.FALSE));
|
|
|
- if (CollectionUtil.isNotEmpty(list)){
|
|
|
- List<MajorProduction> ifExist = list.stream().filter(x -> x.getProduction().equals(taskData.getProduction())).collect(Collectors.toList());
|
|
|
- if (CollectionUtil.isNotEmpty(ifExist)){
|
|
|
- ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR,ProductionEnum.valueOf(taskData.getProduction()).getMsg() + "类型产品已存在,请完善产品信息。");
|
|
|
- }
|
|
|
- MajorProduction production = list.get(0);
|
|
|
- if (production!=null){
|
|
|
- taskData.setName(production.getName());
|
|
|
- taskData.setClientName(production.getClientName());
|
|
|
- taskData.setClientTel(production.getClientTel());
|
|
|
- taskData.setClientAddress(production.getClientAddress());
|
|
|
- taskData.setOwner(production.getOwner());
|
|
|
- taskData.setValueTiming(production.getValueTiming());
|
|
|
- taskData.setEvaluateAcreage(production.getEvaluateAcreage());
|
|
|
- taskData.setEvaluatePrice(production.getEvaluatePrice());
|
|
|
- taskData.setEvaluateAmount(production.getEvaluateAmount());
|
|
|
- Major major = majorService.getOne(new LambdaQueryWrapper<Major>().eq(BaseEntity::getId, production.getMajorId())
|
|
|
- .select(BaseEntity::getId, Major::getEvaluateAim));
|
|
|
- //抵押类是否需要复审和三审逻辑 ?
|
|
|
- if (major.getEvaluateAim().equals(PLEDGE)){
|
|
|
- BigDecimal evaluateAmount = production.getEvaluateAmount();
|
|
|
- if (evaluateAmount.compareTo(EVALUATE_MIN)<=0){
|
|
|
- taskData.setSecondCheck(ReportStatus.不审.name());
|
|
|
- taskData.setThirdCheck(ReportStatus.不审.name());
|
|
|
- }
|
|
|
- if (evaluateAmount.compareTo(EVALUATE_MIN)>0 && evaluateAmount.compareTo(EVALUATE_MAX)<=0){
|
|
|
- taskData.setSecondCheck(ReportStatus.待审核.name());
|
|
|
- taskData.setThirdCheck(ReportStatus.不审.name());
|
|
|
- }
|
|
|
- if (evaluateAmount.compareTo(EVALUATE_MAX)>0){
|
|
|
- taskData.setSecondCheck(ReportStatus.待审核.name());
|
|
|
- taskData.setThirdCheck(ReportStatus.待审核.name());
|
|
|
- }
|
|
|
+ //查询是否生成过该报告的产品
|
|
|
+ MajorProduction prod = this.getOne(new LambdaQueryWrapper<MajorProduction>().eq(MajorProduction::getReportNo, reportNo)
|
|
|
+ .eq(MajorProduction::getMajorId, majorId).eq(BaseEntity::getDeleted, Boolean.FALSE));
|
|
|
+ if (prod!=null){
|
|
|
+ ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR,ProductionEnum.valueOf(taskData.getProduction()).getMsg() + "类型产品已存在,请完善产品信息。");
|
|
|
+ }
|
|
|
+ //查询该流程生成过的价值意见书产品信息
|
|
|
+ if (StrUtil.isNotBlank(statementNo)){
|
|
|
+ MajorProduction statementProd = this.getOne(new LambdaQueryWrapper<MajorProduction>().eq(MajorProduction::getReportNo, statementNo)
|
|
|
+ .eq(MajorProduction::getMajorId, majorId).eq(BaseEntity::getDeleted, Boolean.FALSE));
|
|
|
+ if (statementProd != null){
|
|
|
+ taskData.setValueTiming(statementProd.getValueTiming());
|
|
|
+ if (StrUtil.isBlank(taskData.getOwner())){
|
|
|
+ taskData.setOwner(statementProd.getOwner());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
//创建普通二维码
|
|
|
taskData.setQrCode(businessProductionService.doCreateNormalCode(taskData.getProduction(),reportNo));
|
|
|
taskData.setStandardAmount(productionFundService.calculateStandardAmount(taskData.getEvaluateAmount()));
|