Merge remote-tracking branch 'origin/master'

This commit is contained in:
zjh 2025-12-14 20:39:32 +08:00
commit 3a3f14004b
11 changed files with 150 additions and 27 deletions

View File

@ -2,6 +2,7 @@ package com.xdap.self_development.controller;
import com.definesys.mpaas.common.http.Response;
import com.xdap.self_development.controller.request.ApprovalByPlatformRequest;
import com.xdap.self_development.controller.request.ApprovalNodeRequest;
import com.xdap.self_development.controller.request.EngineReviewListRequest;
import com.xdap.self_development.pojo.dto.*;
@ -34,6 +35,13 @@ public class ActivitiProcessController {
List<ActivitiDataDTO> msg = activitiProcessService.initiateApproval(modelID,userID);
return Response.ok().data(msg);
};
// //平台发起审批时生成本地审批流
// @PostMapping(value = "/startActivitiByPlatform")
// public Response startActivitiByPlatform(@RequestBody ApprovalByPlatformRequest request) {
// activitiProcessService.startActivitiByPlatform(request);
// return Response.ok();
// }
//正式发起审批
@PostMapping(value = "/startActiviti")
public Response startActiviti(@RequestBody ApprovalNodeRequest approvalNodeRequest) {

View File

@ -4,6 +4,7 @@ import com.definesys.mpaas.common.http.Response;
import com.xdap.self_development.controller.request.AnalysisRequest;
import com.xdap.self_development.controller.request.ReportRequest;
import com.xdap.self_development.pojo.view.AnalysisModelParamterView;
import com.xdap.self_development.pojo.view.AnalysisModelParamterViewAndParam;
import com.xdap.self_development.service.AnalysisCommonParametersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -28,8 +29,8 @@ public class AnalysisCommonController {
//统计分析图表
@PostMapping("/showReport")
public Response showReport(@RequestBody ReportRequest request) {
ArrayList<AnalysisModelParamterView> lists = analysisCommonParametersService.showReport(request);
return Response.ok().data(lists);
AnalysisModelParamterViewAndParam andParam = analysisCommonParametersService.showReport(request);
return Response.ok().data(andParam);
}
// //模糊查询下拉列表

View File

@ -0,0 +1,21 @@
package com.xdap.self_development.controller.request;
import lombok.Data;
import java.util.List;
@Data
public class ApprovalByPlatformRequest {
//document,model,申请人,当前状态,当前审批人
private String documentID;
private String modelID;
private String applicant;
private String statusDescription;
private String nodeName;
private List<String> approverPersons;
}

View File

@ -7,7 +7,15 @@ import java.util.List;
@Data
public class AnalysisModelParamterView {
String modelID;
String modelName;
private String modelID;
private String modelName;
private String plate;
private String platform;
private String series;
private String projectName;
private String projectNumber;
private String emission;
private String burnType;
private String engineCapacity;
List<EngineParamDetailPojo> pojos;
}

View File

@ -0,0 +1,12 @@
package com.xdap.self_development.pojo.view;
import com.xdap.self_development.pojo.EngineParamDetailPojo;
import lombok.Data;
import java.util.List;
@Data
public class AnalysisModelParamterViewAndParam {
List<String> paramList;
List<AnalysisModelParamterView> pojos;
}

View File

@ -1,6 +1,7 @@
package com.xdap.self_development.service;
import com.xdap.self_development.controller.request.ApprovalByPlatformRequest;
import com.xdap.self_development.controller.request.ApprovalNodeRequest;
import com.xdap.self_development.pojo.dto.ActivitiDataAndRecordDTO;
import com.xdap.self_development.pojo.dto.ActivitiDataDTO;
@ -18,4 +19,5 @@ public interface ActivitiProcessService {
//操作
String handleApproval(HandleApprovalDTO handleApprovalDTO);
void startActivitiByPlatform(ApprovalByPlatformRequest request);
}

View File

@ -9,6 +9,7 @@ import com.xdap.self_development.pojo.dto.ActivitiDataDTO;
import com.xdap.self_development.pojo.dto.HandleApprovalDTO;
import com.xdap.self_development.pojo.dto.ShowActivitiDTO;
import com.xdap.self_development.pojo.view.AnalysisModelParamterView;
import com.xdap.self_development.pojo.view.AnalysisModelParamterViewAndParam;
import java.util.ArrayList;
import java.util.List;
@ -17,5 +18,6 @@ public interface AnalysisCommonParametersService {
//查询常用参数返回机型数据
ArrayList<AnalysisModelParamterView> selectModelParamByCommon(AnalysisRequest analysisRequest);
ArrayList<AnalysisModelParamterView> showReport(ReportRequest analysisRequest);
AnalysisModelParamterViewAndParam showReport(ReportRequest analysisRequest);
}

View File

@ -2,6 +2,7 @@ package com.xdap.self_development.service.impl;
import com.definesys.mpaas.query.MpaasQueryFactory;
import com.xdap.api.moudle.user.pojo.XdapUsers;
import com.xdap.self_development.controller.request.ApprovalByPlatformRequest;
import com.xdap.self_development.controller.request.ApprovalNodeRequest;
import com.xdap.self_development.enums.CurrentNodeEnum;
import com.xdap.self_development.enums.ParamOperation;
@ -48,7 +49,7 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
engineParamDetailPojos = engineParamDetailService.selectByModelNewVersion(modelID)
.stream()
.filter(x -> ParamOperation.UPDATE.toString()
.equals(x.getOperation())).collect(Collectors.toList());
.equals(x.getOperation()) && userID.equals(x.getLastUpdatedBy() == null ? "" : x.getLastUpdatedBy())).collect(Collectors.toList());
if (ObjectUtils.isEmpty(engineParamDetailPojos)) {
throw new RuntimeException();
}
@ -463,6 +464,27 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
return "已审批";
}
@Override
public void startActivitiByPlatform(ApprovalByPlatformRequest request) {
DataEntryEngineModelPojo dataEntryEngineModelPojo = dataEntryEngineModelService.selectBymodelId(request.getModelID());
EngineReviewListPojo engineReviewListPojo = new EngineReviewListPojo();
engineReviewListPojo.setId(request.getDocumentID());
engineReviewListPojo.setModelId(request.getModelID());
engineReviewListPojo.setModelName(dataEntryEngineModelPojo.getModelName());
engineReviewListPojo.setYcOrOth(dataEntryEngineModelPojo.getYcOrOth());
engineReviewListPojo.setProcessTopic(processTopic);
engineReviewListPojo.setStatusCode(ParamValueVersionEnum.UNDER.getCode());
engineReviewListPojo.setApplicant(request.getApplicant());
engineReviewListPojo.setStatusDescription(ParamValueVersionEnum.UNDER.getDesc());
engineReviewListPojo.setNodeName(request.getNodeName());
engineReviewListPojo.setApproverPersons(String.join(",", request.getApproverPersons()));
engineReviewListPojo.setCreationDate(new Date());
engineReviewListPojo.setCreatedBy(request.getApplicant());
sw.buildFromDatasource("xdap_app_223770822127386625").doInsert(engineReviewListPojo);
}
@Transactional(rollbackFor = Exception.class) // 发生任何异常都回滚
public void batchInsertParamDetail(List<EngineParamDetailPojo> engineParamDetailPojos) {
sw.buildFromDatasource("xdap_app_223770822127386625").doBatchInsert(engineParamDetailPojos);

View File

@ -3,6 +3,7 @@ package com.xdap.self_development.service.impl;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.xdap.self_development.config.BusinessDatabase;
import com.xdap.self_development.controller.request.*;
import com.xdap.self_development.enums.ParamPermissionEnum;
@ -10,6 +11,7 @@ import com.xdap.self_development.exception.CommonException;
import com.xdap.self_development.pojo.*;
import com.xdap.self_development.pojo.dto.PageResultDTO;
import com.xdap.self_development.pojo.view.AnalysisModelParamterView;
import com.xdap.self_development.pojo.view.AnalysisModelParamterViewAndParam;
import com.xdap.self_development.pojo.view.MenuParamView;
import com.xdap.self_development.service.*;
import lombok.extern.slf4j.Slf4j;
@ -34,6 +36,8 @@ public class AnalysisCommonParametersServiceImpl implements AnalysisCommonParame
EngineParamDetailService engineParamDetailService;
@Autowired
DataEntryEngineModelService dataEntryEngineModelService;
private static final Pattern ALL_NUMBER_PATTERN = Pattern.compile("^[-+]?\\d+(\\.\\d+)?([Ee][-+]?\\d+)?$");
@Override
public ArrayList<AnalysisModelParamterView> selectModelParamByCommon(AnalysisRequest analysisRequest) {
@ -67,11 +71,12 @@ public class AnalysisCommonParametersServiceImpl implements AnalysisCommonParame
analysisModelParamterViews.add(analysisModelParamterView);
}
return analysisModelParamterViews;
}
@Override
public ArrayList<AnalysisModelParamterView> showReport(ReportRequest request) {
public AnalysisModelParamterViewAndParam showReport(ReportRequest request) {
List<DataEntryEngineModelPojo> queryResult = businessDatabase.getBusinessDatabase()
// .eq("yc_or_oth", request.getYcOrOth())
@ -89,22 +94,58 @@ public class AnalysisCommonParametersServiceImpl implements AnalysisCommonParame
Double engineCapacityMin = request.getEngineCapacityMin();
Double engineCapacityMax = request.getEngineCapacityMax();
List<DataEntryEngineModelPojo> engineModelPojos = queryResult.stream().filter(dataEntryEngineModelPojo -> {
List<DataEntryEngineModelPojo> engineModelPojos = queryResult;
if (ObjectUtils.isNotEmpty(engineCapacityMin) && ObjectUtils.isNotEmpty(engineCapacityMax)) {
engineModelPojos = queryResult.stream().filter(dataEntryEngineModelPojo -> {
String engineCapacity = dataEntryEngineModelPojo.getEngineCapacity();
Double ec = extractDisplacement(engineCapacity);
return (Double.compare(ec, engineCapacityMin) >= 0 && Double.compare(ec, engineCapacityMax) < 0);
}).collect(Collectors.toList());
}
AnalysisModelParamterViewAndParam andParam = new AnalysisModelParamterViewAndParam();
ArrayList<AnalysisModelParamterView> analysisModelParamterViews = new ArrayList<>();
for (DataEntryEngineModelPojo engineModelPojo : engineModelPojos) {
AnalysisModelParamterView analysisModelParamterView = new AnalysisModelParamterView();
List<EngineParamDetailPojo> pojoList = engineParamDetailService.selectByModelNewVersion(engineModelPojo.getId());
pojoList = pojoList.stream().filter(x->ObjectUtils.isNotEmpty(x.getParameterValue()) && isNumber(x.getParameterValue())).collect(Collectors.toList());
analysisModelParamterView.setModelID(engineModelPojo.getId());
analysisModelParamterView.setModelName(engineModelPojo.getModelName());
BeanUtils.copyProperties(engineModelPojo, analysisModelParamterView);
analysisModelParamterView.setPojos(pojoList);
analysisModelParamterViews.add(analysisModelParamterView);
}
return analysisModelParamterViews;
List<String> list = new ArrayList<>();
for (AnalysisModelParamterView analysisModelParamterView : analysisModelParamterViews) {
analysisModelParamterView.getPojos().stream().forEach(x->list.add(x.getParameterName()));
}
List<String> strings = list.stream().distinct().collect(Collectors.toList());
andParam.setParamList(strings);
andParam.setPojos(analysisModelParamterViews);
return andParam;
}
/**
* 验证所有数值类型
*/
public static boolean isNumber(String str) {
if (str == null || str.trim().isEmpty()) {
return false;
}
return ALL_NUMBER_PATTERN.matcher(str.trim()).matches();
}
public List<String> selectParamOnlyNum(ArrayList<AnalysisModelParamterView> analysisModelParamterViews) {
List<String> list = new ArrayList<>();
for (AnalysisModelParamterView analysisModelParamterView : analysisModelParamterViews) {
for (EngineParamDetailPojo pojo : analysisModelParamterView.getPojos()) {
String parameterValue = pojo.getParameterValue();
if (ObjectUtils.isEmpty(parameterValue) && isNumber(parameterValue)) {
list.add(pojo.getParameterName());
}
}
}
return list;
}
public static Double extractDisplacement(String displacementStr) {

View File

@ -6,6 +6,7 @@ import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.definesys.mpaas.query.MpaasQueryFactory;
import com.xdap.api.moudle.user.pojo.XdapUsers;
import com.xdap.runtime.service.RuntimeAppContextService;
import com.xdap.self_development.common.UserPermissionGetter;
import com.xdap.self_development.controller.request.EngineParamDetailExcel;
import com.xdap.self_development.controller.request.EngineParamDetailRequest;
@ -25,6 +26,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
@ -55,6 +57,8 @@ public class EngineParamDetailServiceImpl implements EngineParamDetailService {
private ResponsiblePerService responsiblePerService;
@Autowired
UserPermissionGetter userPermissionGetter;
@Autowired
private RuntimeAppContextService runtimeAppContextService;
private Integer versionNumber = 0;
private String createdBy = "Excel导入";
@ -382,7 +386,7 @@ public class EngineParamDetailServiceImpl implements EngineParamDetailService {
*/
@Override
public void updateParamValue(List<EngineParamDetailPojo> engineParamDetailPojos) {
String currentUserId = runtimeAppContextService.getCurrentUserId();
for (EngineParamDetailPojo engineParamDetailPojo : engineParamDetailPojos) {
@ -394,6 +398,8 @@ public class EngineParamDetailServiceImpl implements EngineParamDetailService {
.update("minor_version", engineParamDetailPojo.getParameterValue())
.update("version_status", ParamValueVersionEnum.DRAFT.getCode())
.update("operation", String.valueOf(ParamOperation.UPDATE))
.update("last_updated_by", currentUserId)
.update("last_update_date", new Date())
.rowid("id", engineParamDetailPojoById.getId())
.doUpdate(EngineParamDetailPojo.class);
} else if (engineParamDetailPojo.getOperation().equals(String.valueOf(ParamOperation.DELETE))) {
@ -402,6 +408,8 @@ public class EngineParamDetailServiceImpl implements EngineParamDetailService {
.update("is_delete", "1")
.update("version_status", ParamValueVersionEnum.DRAFT.getCode())
.update("operation", String.valueOf(ParamOperation.DELETE))
.update("last_updated_by", currentUserId)
.update("last_update_date", new Date())
.rowid("id", id)
.doUpdate(EngineParamDetailPojo.class);

View File

@ -2,6 +2,7 @@ package com.xdap.self_development.service.impl;
import com.definesys.mpaas.query.MpaasQueryFactory;
import com.definesys.mpaas.query.db.PageQueryResult;
import com.xdap.api.moudle.user.pojo.XdapUsers;
import com.xdap.self_development.controller.request.TodoReturnRequest;
import com.xdap.self_development.controller.request.TodoTaskRequest;
@ -95,16 +96,13 @@ public class TodoTaskServiceImpl implements TodoTaskService {
// }
// }
PageResultDTO<TodoTaskPojo> pageResultDTO = new PageResultDTO<TodoTaskPojo>();
List<TodoTaskPojo> todoTaskPojosTotal = sw.buildFromDatasource("xdap_app_223770822127386625")
PageQueryResult<TodoTaskPojo> queryResult = sw.buildFromDatasource("xdap_app_223770822127386625")
.eq("owner_id", todoTaskRequest.getPersonId())
.eq("is_delete", 0)
.doQuery(TodoTaskPojo.class);
List<TodoTaskPojo> todoTaskPojos = sw.buildFromDatasource("xdap_app_223770822127386625")
.eq("owner_id", todoTaskRequest.getPersonId())
.eq("is_delete", 0)
.doPageQuery(todoTaskRequest.getPage(), todoTaskRequest.getSize(), TodoTaskPojo.class).getResult();
.doPageQuery(todoTaskRequest.getPage(), todoTaskRequest.getSize(), TodoTaskPojo.class);
List<TodoTaskPojo> todoTaskPojos = queryResult.getResult() ;
pageResultDTO.setList(todoTaskPojos);
pageResultDTO.setTotalCount(todoTaskPojosTotal.size());
pageResultDTO.setTotalCount(queryResult.getCount());
return pageResultDTO;
}