问题修改v2.0
This commit is contained in:
parent
58a3f0b6e2
commit
dbc4d6da25
23
sonar-project.properties
Normal file
23
sonar-project.properties
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# ???????????
|
||||||
|
sonar.projectKey=self_development
|
||||||
|
# ?????????
|
||||||
|
sonar.projectName=Self Development
|
||||||
|
# ????
|
||||||
|
sonar.projectVersion=1.0
|
||||||
|
# ????????????????
|
||||||
|
sonar.sources=src/main/java
|
||||||
|
|
||||||
|
sonar.java.binaries=target/classes
|
||||||
|
# ?????
|
||||||
|
sonar.sourceEncoding=UTF-8
|
||||||
|
# Java??
|
||||||
|
sonar.java.version=8
|
||||||
|
# SonarQube??????????
|
||||||
|
sonar.host.url=http://localhost:9000
|
||||||
|
# SonarQube???????SonarQube??????
|
||||||
|
sonar.login=d82d295146d1cea88c15e32414be02352c4ecd41
|
||||||
|
# ???????????Jacoco??????
|
||||||
|
sonar.jacoco.reportPaths=target/jacoco.pdf
|
||||||
|
|
||||||
|
# ????????????????key?token?
|
||||||
|
curl -u squ_5187d64fc33363d0b6b10fd823fb25f27a332526: -X GET "http://localhost:9000/api/issues/search?componentKeys=self_development&format=csv" > sonar-report.csv
|
||||||
@ -17,6 +17,9 @@ public class BusinessDatabase {
|
|||||||
@Value("${apaas.single.tenantId}")
|
@Value("${apaas.single.tenantId}")
|
||||||
private String tenantId;
|
private String tenantId;
|
||||||
|
|
||||||
|
@Value("${mpaas.datasource[0].name}")
|
||||||
|
private String tcDatabaseName;
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public MpaasQuery getBusinessDatabase() {
|
public MpaasQuery getBusinessDatabase() {
|
||||||
return queryFactory.buildFromDatasource(DatasourceConstant.XDAP_MYSQL_PREFIX + tenantId);
|
return queryFactory.buildFromDatasource(DatasourceConstant.XDAP_MYSQL_PREFIX + tenantId);
|
||||||
@ -24,6 +27,6 @@ public class BusinessDatabase {
|
|||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public MpaasQuery getTCDatabase() {
|
public MpaasQuery getTCDatabase() {
|
||||||
return queryFactory.buildFromDatasource(DatasourceConstant.XDAP_MYSQL_PREFIX + tenantId);
|
return queryFactory.buildFromDatasource(tcDatabaseName == null ? DatasourceConstant.XDAP_MYSQL_PREFIX + tenantId : tcDatabaseName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,11 @@
|
|||||||
|
package com.xdap.self_development.common;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class YcTaskResult {
|
||||||
|
private String code;
|
||||||
|
private Long total;
|
||||||
|
private Object table;
|
||||||
|
private String requestid;
|
||||||
|
}
|
||||||
@ -2,6 +2,7 @@ package com.xdap.self_development.controller;
|
|||||||
|
|
||||||
import com.definesys.mpaas.common.http.Response;
|
import com.definesys.mpaas.common.http.Response;
|
||||||
import com.xdap.self_development.controller.form.*;
|
import com.xdap.self_development.controller.form.*;
|
||||||
|
import com.xdap.self_development.domain.dto.ChartCommonParameterDTO;
|
||||||
import com.xdap.self_development.exception.CommonException;
|
import com.xdap.self_development.exception.CommonException;
|
||||||
import com.xdap.self_development.service.CommonParameterService;
|
import com.xdap.self_development.service.CommonParameterService;
|
||||||
import org.springframework.validation.BindingResult;
|
import org.springframework.validation.BindingResult;
|
||||||
@ -143,4 +144,60 @@ public class CommonParameterController {
|
|||||||
commonParameterService.updateAnalysisCommonParameter(form);
|
commonParameterService.updateAnalysisCommonParameter(form);
|
||||||
return Response.ok().setMessage("修改成功");
|
return Response.ok().setMessage("修改成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取图表常用参数
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @return 图表常用参数列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/getChartCommonParameter")
|
||||||
|
public Response getChartCommonParameter(
|
||||||
|
@NotBlank @RequestParam String userId
|
||||||
|
) {
|
||||||
|
List<ChartCommonParameterDTO> list = commonParameterService.getChartCommonParameter(userId);
|
||||||
|
return Response.ok().data(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增图表常用参数
|
||||||
|
*
|
||||||
|
* @param form 图表参数插入表单
|
||||||
|
* @return 操作结果响应
|
||||||
|
*/
|
||||||
|
@PostMapping("/insertChartCommon")
|
||||||
|
public Response insertChartCommonParameter(
|
||||||
|
@Valid @RequestBody ChartCommonParameterInsertForm form,
|
||||||
|
BindingResult bindingResult
|
||||||
|
) {
|
||||||
|
if (bindingResult.hasErrors()) {
|
||||||
|
bindingResult.getFieldErrors().forEach(error -> {
|
||||||
|
throw new CommonException(error.getDefaultMessage());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
commonParameterService.insertChartCommonParameter(form);
|
||||||
|
return Response.ok().setMessage("新增成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改图表常用参数
|
||||||
|
*
|
||||||
|
* @param form 图表参数更新表单
|
||||||
|
* @return 操作结果响应
|
||||||
|
*/
|
||||||
|
@PostMapping("/updateChartCommon")
|
||||||
|
public Response updateChartCommonParameter(
|
||||||
|
@Valid @RequestBody ChartCommonParameterUpdateForm form,
|
||||||
|
BindingResult bindingResult
|
||||||
|
) {
|
||||||
|
if (bindingResult.hasErrors()) {
|
||||||
|
bindingResult.getFieldErrors().forEach(error -> {
|
||||||
|
throw new CommonException(error.getDefaultMessage());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
commonParameterService.updateChartCommonParameter(form);
|
||||||
|
return Response.ok().setMessage("修改成功");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,19 +1,15 @@
|
|||||||
package com.xdap.self_development.controller;
|
package com.xdap.self_development.controller;
|
||||||
|
|
||||||
|
|
||||||
import com.definesys.mpaas.common.http.Response;
|
import com.xdap.self_development.common.YcTaskResult;
|
||||||
import com.xdap.self_development.controller.request.YcGetTodoTaskRequest;
|
import com.xdap.self_development.controller.request.YcGetTodoTaskRequest;
|
||||||
import com.xdap.self_development.domain.dto.PageResultDTO;
|
import com.xdap.self_development.service.YcTaskResultService;
|
||||||
import com.xdap.self_development.domain.dto.YcTodoTaskCommonResultDTO;
|
|
||||||
import com.xdap.self_development.domain.dto.YcTodoTaskResultDTO;
|
|
||||||
import com.xdap.self_development.service.TodoTaskService;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 玉柴任务结果控制器
|
* 玉柴任务结果控制器
|
||||||
@ -27,7 +23,7 @@ import java.util.List;
|
|||||||
public class YcTaskResultController {
|
public class YcTaskResultController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
TodoTaskService todoTaskService;
|
YcTaskResultService ycTaskResultService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回待办给玉柴云
|
* 返回待办给玉柴云
|
||||||
@ -36,9 +32,14 @@ public class YcTaskResultController {
|
|||||||
* @return 待办任务结果列表
|
* @return 待办任务结果列表
|
||||||
*/
|
*/
|
||||||
@PostMapping("/returnTodoTask")
|
@PostMapping("/returnTodoTask")
|
||||||
public Response returnTodoTask(@RequestBody YcGetTodoTaskRequest ycGetTodoTaskRequest) {
|
public YcTaskResult returnTodoTask(@RequestBody YcGetTodoTaskRequest ycGetTodoTaskRequest) {
|
||||||
List<YcTodoTaskResultDTO> dtos = todoTaskService.returnTodoTask(ycGetTodoTaskRequest);
|
YcTaskResult result = new YcTaskResult();
|
||||||
return Response.ok().data(dtos);
|
try {
|
||||||
|
return ycTaskResultService.returnTodoTask(ycGetTodoTaskRequest);
|
||||||
|
} catch (Exception e) {
|
||||||
|
result.setCode("error");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -48,9 +49,14 @@ public class YcTaskResultController {
|
|||||||
* @return 已办任务分页结果
|
* @return 已办任务分页结果
|
||||||
*/
|
*/
|
||||||
@PostMapping("/returnCompleted")
|
@PostMapping("/returnCompleted")
|
||||||
public Response returnCompleted(@RequestBody YcGetTodoTaskRequest ycGetTodoTaskRequest) {
|
public YcTaskResult returnCompleted(@RequestBody YcGetTodoTaskRequest ycGetTodoTaskRequest) {
|
||||||
PageResultDTO<YcTodoTaskCommonResultDTO> dtos = todoTaskService.returnCompleted(ycGetTodoTaskRequest);
|
YcTaskResult result = new YcTaskResult();
|
||||||
return Response.ok().data(dtos);
|
try {
|
||||||
|
return ycTaskResultService.returnCompleted(ycGetTodoTaskRequest);
|
||||||
|
} catch (Exception e) {
|
||||||
|
result.setCode("error");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,8 +66,13 @@ public class YcTaskResultController {
|
|||||||
* @return 发起任务分页结果
|
* @return 发起任务分页结果
|
||||||
*/
|
*/
|
||||||
@PostMapping("/returnInitiator")
|
@PostMapping("/returnInitiator")
|
||||||
public Response returnInitiator(@RequestBody YcGetTodoTaskRequest ycGetTodoTaskRequest) {
|
public YcTaskResult returnInitiator(@RequestBody YcGetTodoTaskRequest ycGetTodoTaskRequest) {
|
||||||
PageResultDTO<YcTodoTaskCommonResultDTO> dtos = todoTaskService.returnInitiator(ycGetTodoTaskRequest);
|
YcTaskResult result = new YcTaskResult();
|
||||||
return Response.ok().data(dtos);
|
try {
|
||||||
|
return ycTaskResultService.returnInitiator(ycGetTodoTaskRequest);
|
||||||
|
} catch (Exception e) {
|
||||||
|
result.setCode("error");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,22 @@
|
|||||||
|
package com.xdap.self_development.controller.form;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ChartCommonItem {
|
||||||
|
@NotBlank(message = "标题不能为空")
|
||||||
|
private String title;
|
||||||
|
@NotBlank(message = "图表类型不能为空")
|
||||||
|
private String chartType;
|
||||||
|
@NotBlank(message = "X轴不能为空")
|
||||||
|
@JsonProperty("xAxis")
|
||||||
|
private String xAxis;
|
||||||
|
@NotEmpty(message = "Y轴不能为空")
|
||||||
|
@JsonProperty("yAxis")
|
||||||
|
private List<String> yAxis;
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
package com.xdap.self_development.controller.form;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ChartCommonParameterInsertForm {
|
||||||
|
@NotBlank(message = "常用名不能为空")
|
||||||
|
private String commonName;
|
||||||
|
@NotEmpty(message = "图表列表不能为空")
|
||||||
|
private List<ChartCommonItem> charts;
|
||||||
|
@NotBlank(message = "用户ID不能为空")
|
||||||
|
private String userId;
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.xdap.self_development.controller.form;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ChartCommonParameterUpdateForm {
|
||||||
|
@NotBlank(message = "常用名不能为空")
|
||||||
|
private String commonName;
|
||||||
|
@NotEmpty(message = "图表列表不能为空")
|
||||||
|
private List<ChartCommonItem> charts;
|
||||||
|
@NotBlank(message = "用户ID不能为空")
|
||||||
|
private String userId;
|
||||||
|
@NotBlank(message = "常用ID不能为空")
|
||||||
|
private String commonId;
|
||||||
|
}
|
||||||
@ -11,8 +11,6 @@ import com.alibaba.excel.annotation.ExcelProperty;
|
|||||||
import com.alibaba.excel.annotation.format.DateTimeFormat;
|
import com.alibaba.excel.annotation.format.DateTimeFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class DataEntryEngineModelExcel {
|
public class DataEntryEngineModelExcel {
|
||||||
|
|
||||||
@ -75,8 +73,18 @@ public class DataEntryEngineModelExcel {
|
|||||||
* 品牌
|
* 品牌
|
||||||
*/
|
*/
|
||||||
@ExcelIgnore
|
@ExcelIgnore
|
||||||
// @ExcelProperty("品牌")
|
@ExcelProperty("品牌")
|
||||||
private String brand;
|
private String brand;
|
||||||
|
|
||||||
|
@ExcelProperty("生产日期")
|
||||||
|
@DateTimeFormat("yyyy-MM-dd")
|
||||||
|
private String productionDate;
|
||||||
|
|
||||||
|
@ExcelProperty("厂家全称")
|
||||||
|
private String manufacturerName;
|
||||||
|
|
||||||
|
@ExcelProperty("厂家简称")
|
||||||
|
private String manufacturerAbbreviation;
|
||||||
/**
|
/**
|
||||||
* 排放
|
* 排放
|
||||||
*/
|
*/
|
||||||
@ -95,13 +103,6 @@ public class DataEntryEngineModelExcel {
|
|||||||
@ExcelProperty("排量")
|
@ExcelProperty("排量")
|
||||||
private String engineCapacity;
|
private String engineCapacity;
|
||||||
|
|
||||||
/**
|
|
||||||
* 生产日期
|
|
||||||
*/
|
|
||||||
@ExcelIgnore
|
|
||||||
@DateTimeFormat("yyyy-MM-dd")
|
|
||||||
private Date productionDate;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sheet名称
|
* sheet名称
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -28,7 +28,7 @@ public class DataEntryEngineModelPageRequest {
|
|||||||
private String modelNameSimple;
|
private String modelNameSimple;
|
||||||
private String manufacturerName;
|
private String manufacturerName;
|
||||||
private String manufacturerAbbreviation;
|
private String manufacturerAbbreviation;
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
private Date productionDate;
|
private Date productionDate;
|
||||||
/**
|
/**
|
||||||
* 第几页
|
* 第几页
|
||||||
|
|||||||
@ -13,7 +13,7 @@ public class AppTokenDTO {
|
|||||||
/**
|
/**
|
||||||
* 访问令牌
|
* 访问令牌
|
||||||
*/
|
*/
|
||||||
private String accessToken;
|
private String access_token;
|
||||||
/**
|
/**
|
||||||
* 令牌类型
|
* 令牌类型
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -0,0 +1,13 @@
|
|||||||
|
package com.xdap.self_development.domain.dto;
|
||||||
|
|
||||||
|
import com.xdap.self_development.domain.pojo.ChartCommonParameterPojo;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ChartCommonParameterDTO {
|
||||||
|
private String commonId;
|
||||||
|
private String commonName;
|
||||||
|
private List<ChartCommonParameterPojo> charts;
|
||||||
|
}
|
||||||
@ -5,6 +5,7 @@ import com.alibaba.excel.annotation.format.DateTimeFormat;
|
|||||||
import com.definesys.mpaas.query.annotation.SQL;
|
import com.definesys.mpaas.query.annotation.SQL;
|
||||||
import com.definesys.mpaas.query.annotation.SQLQuery;
|
import com.definesys.mpaas.query.annotation.SQLQuery;
|
||||||
import com.definesys.mpaas.query.model.MpaasBasePojo;
|
import com.definesys.mpaas.query.model.MpaasBasePojo;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
@ -100,7 +101,7 @@ public class DataEntryEngineModelDto extends MpaasBasePojo {
|
|||||||
/**
|
/**
|
||||||
* 生产日期
|
* 生产日期
|
||||||
*/
|
*/
|
||||||
@DateTimeFormat("yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||||
private Date productionDate;
|
private Date productionDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -0,0 +1,26 @@
|
|||||||
|
package com.xdap.self_development.domain.dto;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机型参数对比导出实体
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ModelParamComparisonDTO {
|
||||||
|
// 子系统列
|
||||||
|
@ExcelProperty(value = "子系统", index = 0)
|
||||||
|
@ColumnWidth(20)
|
||||||
|
private String subsystemName;
|
||||||
|
|
||||||
|
// 零部件列
|
||||||
|
@ExcelProperty(value = "零部件", index = 1)
|
||||||
|
@ColumnWidth(20)
|
||||||
|
private String partsName;
|
||||||
|
|
||||||
|
// 参数名列
|
||||||
|
@ExcelProperty(value = "参数", index = 2)
|
||||||
|
@ColumnWidth(25)
|
||||||
|
private String parameterName;
|
||||||
|
}
|
||||||
@ -4,5 +4,5 @@ import lombok.Data;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class UserTokenDT0 {
|
public class UserTokenDT0 {
|
||||||
private String accessToken;
|
private String access_token;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,8 +4,6 @@ import lombok.AllArgsConstructor;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
//待办
|
//待办
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@ -16,7 +14,7 @@ public class YcTodoTaskResultDTO {
|
|||||||
// 待办地址
|
// 待办地址
|
||||||
private String url;
|
private String url;
|
||||||
// 待办最近更新日期
|
// 待办最近更新日期
|
||||||
private Date updateDate;
|
private String updateDate;
|
||||||
// 当前处理环节
|
// 当前处理环节
|
||||||
private String activityLabel;
|
private String activityLabel;
|
||||||
// 来源系统名称
|
// 来源系统名称
|
||||||
|
|||||||
@ -0,0 +1,57 @@
|
|||||||
|
package com.xdap.self_development.domain.pojo;
|
||||||
|
|
||||||
|
import com.definesys.mpaas.query.annotation.*;
|
||||||
|
import com.definesys.mpaas.query.model.MpaasBasePojo;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:
|
||||||
|
*
|
||||||
|
* @author Developer
|
||||||
|
* @date 2026/1/26
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
@Table("yfsjglpt_model_chart_common_parameter")
|
||||||
|
public class ChartCommonParameterPojo extends MpaasBasePojo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@RowID(sequence = "yfsjglpt_model_chart_common_parameter_s", type = RowIDType.UUID)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图表标题
|
||||||
|
*/
|
||||||
|
@Column(value = "title")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图表类型
|
||||||
|
*/
|
||||||
|
@Column(value = "chart_type")
|
||||||
|
private String chartType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* X轴
|
||||||
|
*/
|
||||||
|
@Column(value = "x_axis")
|
||||||
|
private String xAxis;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Y轴
|
||||||
|
*/
|
||||||
|
@Column(value = "y_axis")
|
||||||
|
private String yAxis;
|
||||||
|
|
||||||
|
@Column(value = "common_id")
|
||||||
|
private String commonId;
|
||||||
|
|
||||||
|
@Column(type = ColumnType.JAVA)
|
||||||
|
private List<String> yAxisParameters;
|
||||||
|
|
||||||
|
}
|
||||||
@ -4,8 +4,8 @@ import com.alibaba.excel.context.AnalysisContext;
|
|||||||
import com.alibaba.excel.exception.ExcelAnalysisException;
|
import com.alibaba.excel.exception.ExcelAnalysisException;
|
||||||
import com.alibaba.excel.read.listener.ReadListener;
|
import com.alibaba.excel.read.listener.ReadListener;
|
||||||
import com.alibaba.excel.util.ListUtils;
|
import com.alibaba.excel.util.ListUtils;
|
||||||
import com.definesys.mpaas.query.MpaasQueryFactory;
|
|
||||||
import com.xdap.api.moudle.user.pojo.XdapUsers;
|
import com.xdap.api.moudle.user.pojo.XdapUsers;
|
||||||
|
import com.xdap.self_development.common.BusinessDatabase;
|
||||||
import com.xdap.self_development.controller.request.DataEntryEngineModelExcel;
|
import com.xdap.self_development.controller.request.DataEntryEngineModelExcel;
|
||||||
import com.xdap.self_development.domain.enums.DistributeStatusEnum;
|
import com.xdap.self_development.domain.enums.DistributeStatusEnum;
|
||||||
import com.xdap.self_development.domain.enums.ParamValueVersionEnum;
|
import com.xdap.self_development.domain.enums.ParamValueVersionEnum;
|
||||||
@ -21,18 +21,17 @@ import org.springframework.beans.BeanUtils;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
//@Component
|
//@Component
|
||||||
//@Scope("prototype")
|
//@Scope("prototype")
|
||||||
public class EngineModelListener implements ReadListener<DataEntryEngineModelExcel> {
|
public class EngineModelListener implements ReadListener<DataEntryEngineModelExcel> {
|
||||||
private final MpaasQueryFactory sw;
|
private final BusinessDatabase businessDatabase;
|
||||||
private final ResponsiblePerService responsiblePerService;
|
private final ResponsiblePerService responsiblePerService;
|
||||||
private final EngineParamDetailService engineParamDetailService;
|
private final EngineParamDetailService engineParamDetailService;
|
||||||
private static final int BATCH_COUNT = 1000;
|
private static final int BATCH_COUNT = 1000;
|
||||||
@ -43,8 +42,8 @@ public class EngineModelListener implements ReadListener<DataEntryEngineModelExc
|
|||||||
|
|
||||||
private List<DataEntryEngineModelExcel> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
|
private List<DataEntryEngineModelExcel> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
|
||||||
|
|
||||||
public EngineModelListener(MpaasQueryFactory sw, ResponsiblePerService responsiblePerService, EngineParamDetailService engineParamDetailService, String ycOrOt, XdapUsers usersPojo) {
|
public EngineModelListener(BusinessDatabase businessDatabase, ResponsiblePerService responsiblePerService, EngineParamDetailService engineParamDetailService, String ycOrOt, XdapUsers usersPojo) {
|
||||||
this.sw = sw;
|
this.businessDatabase = businessDatabase;
|
||||||
this.responsiblePerService = responsiblePerService;
|
this.responsiblePerService = responsiblePerService;
|
||||||
this.engineParamDetailService = engineParamDetailService;
|
this.engineParamDetailService = engineParamDetailService;
|
||||||
this.usersPojo = usersPojo;
|
this.usersPojo = usersPojo;
|
||||||
@ -75,7 +74,7 @@ public class EngineModelListener implements ReadListener<DataEntryEngineModelExc
|
|||||||
String sheetName = data.getSheetName();
|
String sheetName = data.getSheetName();
|
||||||
Integer rowIndex = data.getRowIndex();
|
Integer rowIndex = data.getRowIndex();
|
||||||
//productNumber,modelName,brand
|
//productNumber,modelName,brand
|
||||||
List<DataEntryEngineModelPojo> modelPojos = sw.buildFromDatasource("xdap_app_223770822127386625")
|
List<DataEntryEngineModelPojo> modelPojos = businessDatabase.getBusinessDatabase()
|
||||||
.eq("product_number", data.getProductNumber())
|
.eq("product_number", data.getProductNumber())
|
||||||
.eq("model_name", data.getModelName())
|
.eq("model_name", data.getModelName())
|
||||||
// .eq("brand", data.getBrand())
|
// .eq("brand", data.getBrand())
|
||||||
@ -123,10 +122,20 @@ public class EngineModelListener implements ReadListener<DataEntryEngineModelExc
|
|||||||
modelPojo.setCreationDate(Timestamp.valueOf(LocalDateTime.now()));
|
modelPojo.setCreationDate(Timestamp.valueOf(LocalDateTime.now()));
|
||||||
modelPojo.setId(UUID.randomUUID().toString());
|
modelPojo.setId(UUID.randomUUID().toString());
|
||||||
modelPojos.add(modelPojo);
|
modelPojos.add(modelPojo);
|
||||||
|
if (Objects.equals(ycOrOt, "竞品")) {
|
||||||
|
modelPojo.setManufacturerName(modelExcel.getManufacturerName());
|
||||||
|
modelPojo.setManufacturerAbbreviation(modelExcel.getManufacturerAbbreviation());
|
||||||
|
try {
|
||||||
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
|
LocalDate localDate = LocalDate.parse(modelExcel.getProductionDate(), dateTimeFormatter);
|
||||||
|
Date date = Date.from(localDate.atStartOfDay(java.time.ZoneId.systemDefault()).toInstant());
|
||||||
|
modelPojo.setProductionDate(date);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("生产日期格式错误", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sw.buildFromDatasource("xdap_app_223770822127386625").doBatchInsert(modelPojos);
|
businessDatabase.getBusinessDatabase().doBatchInsert(modelPojos);
|
||||||
|
|
||||||
saveDataParamDetail(modelPojos, parameters);
|
saveDataParamDetail(modelPojos, parameters);
|
||||||
}
|
}
|
||||||
@ -158,6 +167,6 @@ public class EngineModelListener implements ReadListener<DataEntryEngineModelExc
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
sw.buildFromDatasource("xdap_app_223770822127386625").doBatchInsert(engineParamDetailPojos);
|
businessDatabase.getBusinessDatabase().doBatchInsert(engineParamDetailPojos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,7 @@ package com.xdap.self_development.listener;
|
|||||||
import com.alibaba.excel.context.AnalysisContext;
|
import com.alibaba.excel.context.AnalysisContext;
|
||||||
import com.alibaba.excel.read.listener.ReadListener;
|
import com.alibaba.excel.read.listener.ReadListener;
|
||||||
import com.alibaba.excel.util.ListUtils;
|
import com.alibaba.excel.util.ListUtils;
|
||||||
import com.definesys.mpaas.query.MpaasQueryFactory;
|
import com.xdap.self_development.common.BusinessDatabase;
|
||||||
import com.xdap.self_development.controller.request.EngineParamDetailExcel;
|
import com.xdap.self_development.controller.request.EngineParamDetailExcel;
|
||||||
import com.xdap.self_development.domain.enums.ParamOperationEnum;
|
import com.xdap.self_development.domain.enums.ParamOperationEnum;
|
||||||
import com.xdap.self_development.domain.enums.ParamValueVersionEnum;
|
import com.xdap.self_development.domain.enums.ParamValueVersionEnum;
|
||||||
@ -24,7 +24,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class EngineParamDetailListener implements ReadListener<EngineParamDetailExcel> {
|
public class EngineParamDetailListener implements ReadListener<EngineParamDetailExcel> {
|
||||||
private final MpaasQueryFactory sw;
|
private final BusinessDatabase bd;
|
||||||
private final DataEntryEngineModelPojo modelPojo;
|
private final DataEntryEngineModelPojo modelPojo;
|
||||||
private final DataEntryEngineModelService dataEntryEngineModelService;
|
private final DataEntryEngineModelService dataEntryEngineModelService;
|
||||||
private final ResponsiblePerService responsiblePerService;
|
private final ResponsiblePerService responsiblePerService;
|
||||||
@ -37,8 +37,8 @@ public class EngineParamDetailListener implements ReadListener<EngineParamDetail
|
|||||||
|
|
||||||
private List<EngineParamDetailExcel> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
|
private List<EngineParamDetailExcel> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
|
||||||
|
|
||||||
public EngineParamDetailListener(MpaasQueryFactory sw, DataEntryEngineModelPojo modelPojo, DataEntryEngineModelService dataEntryEngineModelService, ResponsiblePerService responsiblePerService, DataEntryService dataEntryService, String userId) {
|
public EngineParamDetailListener(BusinessDatabase bd, DataEntryEngineModelPojo modelPojo, DataEntryEngineModelService dataEntryEngineModelService, ResponsiblePerService responsiblePerService, DataEntryService dataEntryService, String userId) {
|
||||||
this.sw = sw;
|
this.bd = bd;
|
||||||
this.modelPojo = modelPojo;
|
this.modelPojo = modelPojo;
|
||||||
this.dataEntryEngineModelService = dataEntryEngineModelService;
|
this.dataEntryEngineModelService = dataEntryEngineModelService;
|
||||||
this.responsiblePerService = responsiblePerService;
|
this.responsiblePerService = responsiblePerService;
|
||||||
@ -78,14 +78,14 @@ public class EngineParamDetailListener implements ReadListener<EngineParamDetail
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<EngineParamDetailPojo> detailPojos =
|
List<EngineParamDetailPojo> detailPojos =
|
||||||
sw.buildFromDatasource("xdap_app_223770822127386625")
|
bd.getBusinessDatabase()
|
||||||
.eq("id",paramDetailExcel.getId())
|
.eq("id",paramDetailExcel.getId())
|
||||||
.eq("engine_model_id",modelPojo.getId())
|
.eq("engine_model_id",modelPojo.getId())
|
||||||
.eq("major_version",modelPojo.getVersionNumber())
|
.eq("major_version",modelPojo.getVersionNumber())
|
||||||
.doQuery(EngineParamDetailPojo.class);
|
.doQuery(EngineParamDetailPojo.class);
|
||||||
//如果这个ID有数据则更新小版本为草稿
|
//如果这个ID有数据则更新小版本为草稿
|
||||||
if (ObjectUtils.isNotEmpty(detailPojos)) {
|
if (ObjectUtils.isNotEmpty(detailPojos)) {
|
||||||
sw.buildFromDatasource("xdap_app_223770822127386625")
|
bd.getBusinessDatabase()
|
||||||
.update("minor_version", paramDetailExcel.getParameterValue())
|
.update("minor_version", paramDetailExcel.getParameterValue())
|
||||||
.update("version_status",ParamValueVersionEnum.DRAFT.getCode())
|
.update("version_status",ParamValueVersionEnum.DRAFT.getCode())
|
||||||
.update("last_updated_by", userId)
|
.update("last_updated_by", userId)
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.xdap.self_development.service;
|
package com.xdap.self_development.service;
|
||||||
|
|
||||||
import com.xdap.self_development.controller.form.*;
|
import com.xdap.self_development.controller.form.*;
|
||||||
|
import com.xdap.self_development.domain.dto.ChartCommonParameterDTO;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
@ -20,4 +21,10 @@ public interface CommonParameterService {
|
|||||||
void insertAnalysisCommonParameter(@Valid AnalysisCommonParameterInsertForm form);
|
void insertAnalysisCommonParameter(@Valid AnalysisCommonParameterInsertForm form);
|
||||||
|
|
||||||
void updateAnalysisCommonParameter(AnalysisCommonParameterUpdateForm form);
|
void updateAnalysisCommonParameter(AnalysisCommonParameterUpdateForm form);
|
||||||
|
|
||||||
|
List<ChartCommonParameterDTO> getChartCommonParameter(@NotBlank String userId);
|
||||||
|
|
||||||
|
void insertChartCommonParameter(@Valid ChartCommonParameterInsertForm form);
|
||||||
|
|
||||||
|
void updateChartCommonParameter(@Valid ChartCommonParameterUpdateForm form);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,6 @@ import com.xdap.self_development.controller.request.YcGetTodoTaskRequest;
|
|||||||
import com.xdap.self_development.domain.dto.EngineParamDetailDTO;
|
import com.xdap.self_development.domain.dto.EngineParamDetailDTO;
|
||||||
import com.xdap.self_development.domain.dto.PageResultDTO;
|
import com.xdap.self_development.domain.dto.PageResultDTO;
|
||||||
import com.xdap.self_development.domain.dto.YcTodoTaskCommonResultDTO;
|
import com.xdap.self_development.domain.dto.YcTodoTaskCommonResultDTO;
|
||||||
import com.xdap.self_development.domain.dto.YcTodoTaskResultDTO;
|
|
||||||
import com.xdap.self_development.domain.pojo.CompletedTaskPojo;
|
import com.xdap.self_development.domain.pojo.CompletedTaskPojo;
|
||||||
import com.xdap.self_development.domain.pojo.InitiatedTaskPojo;
|
import com.xdap.self_development.domain.pojo.InitiatedTaskPojo;
|
||||||
import com.xdap.self_development.domain.pojo.TodoTaskPojo;
|
import com.xdap.self_development.domain.pojo.TodoTaskPojo;
|
||||||
@ -35,7 +34,6 @@ public interface TodoTaskService {
|
|||||||
void rejectTodo(RejectTodoRequest request);
|
void rejectTodo(RejectTodoRequest request);
|
||||||
|
|
||||||
//---------------------------------玉柴调用接口--------------------------------
|
//---------------------------------玉柴调用接口--------------------------------
|
||||||
List<YcTodoTaskResultDTO> returnTodoTask(YcGetTodoTaskRequest ycGetTodoTaskRequest);
|
|
||||||
|
|
||||||
PageResultDTO<YcTodoTaskCommonResultDTO> returnCompleted(YcGetTodoTaskRequest ycGetTodoTaskRequest);
|
PageResultDTO<YcTodoTaskCommonResultDTO> returnCompleted(YcGetTodoTaskRequest ycGetTodoTaskRequest);
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,12 @@
|
|||||||
|
package com.xdap.self_development.service;
|
||||||
|
|
||||||
|
import com.xdap.self_development.common.YcTaskResult;
|
||||||
|
import com.xdap.self_development.controller.request.YcGetTodoTaskRequest;
|
||||||
|
|
||||||
|
public interface YcTaskResultService {
|
||||||
|
YcTaskResult returnTodoTask(YcGetTodoTaskRequest ycGetTodoTaskRequest);
|
||||||
|
|
||||||
|
YcTaskResult returnCompleted(YcGetTodoTaskRequest ycGetTodoTaskRequest);
|
||||||
|
|
||||||
|
YcTaskResult returnInitiator(YcGetTodoTaskRequest ycGetTodoTaskRequest);
|
||||||
|
}
|
||||||
@ -178,8 +178,9 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
|||||||
.eq("filled_by", userId)
|
.eq("filled_by", userId)
|
||||||
.isNull("minor_version")
|
.isNull("minor_version")
|
||||||
.doQuery(EngineParamDetailPojo.class);
|
.doQuery(EngineParamDetailPojo.class);
|
||||||
if (!ObjectUtils.isEmpty(toBeFilledParams))
|
if (!ObjectUtils.isEmpty(toBeFilledParams)) {
|
||||||
throw new CommonException("您在当前机型的参数未全部填写完成,请检查");
|
throw new CommonException("您在当前机型的参数未全部填写完成,请检查");
|
||||||
|
}
|
||||||
|
|
||||||
// 查询机型最新版本的参数,过滤出操作为更新且由当前用户更新的参数
|
// 查询机型最新版本的参数,过滤出操作为更新且由当前用户更新的参数
|
||||||
List<EngineParamDetailPojo> paramList = bd.getBusinessDatabase()
|
List<EngineParamDetailPojo> paramList = bd.getBusinessDatabase()
|
||||||
@ -243,7 +244,7 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
|||||||
}
|
}
|
||||||
bd.getBusinessDatabase().doBatchInsert(list);
|
bd.getBusinessDatabase().doBatchInsert(list);
|
||||||
|
|
||||||
//创建发起
|
//创建审批发起
|
||||||
InitiatedTaskPojo initiatedTaskPojo = new InitiatedTaskPojo();
|
InitiatedTaskPojo initiatedTaskPojo = new InitiatedTaskPojo();
|
||||||
initiatedTaskPojo.setDocumentNo(approvalId);
|
initiatedTaskPojo.setDocumentNo(approvalId);
|
||||||
initiatedTaskPojo.setProcessTitle(processTitle);
|
initiatedTaskPojo.setProcessTitle(processTitle);
|
||||||
@ -319,12 +320,8 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
|||||||
.update("last_update_date", new Date())
|
.update("last_update_date", new Date())
|
||||||
.eq("document_no", todoTaskPojo.getDocumentNo())
|
.eq("document_no", todoTaskPojo.getDocumentNo())
|
||||||
.doUpdate(TodoTaskPojo.class);
|
.doUpdate(TodoTaskPojo.class);
|
||||||
bd.getBusinessDatabase()
|
|
||||||
.update("current_node", "已维护")
|
//新增这个人的填写的已办和经办
|
||||||
.update("last_update_date", new Date())
|
|
||||||
.eq("document_no", todoTaskPojo.getDocumentNo())
|
|
||||||
.doUpdate(InitiatedTaskPojo.class);
|
|
||||||
//新增这个人的已办
|
|
||||||
CompletedTaskPojo completedTaskPojo = new CompletedTaskPojo();
|
CompletedTaskPojo completedTaskPojo = new CompletedTaskPojo();
|
||||||
BeanUtils.copyProperties(todoTaskPojo, completedTaskPojo);
|
BeanUtils.copyProperties(todoTaskPojo, completedTaskPojo);
|
||||||
completedTaskPojo.setId(UUID.randomUUID().toString().replaceAll("-", ""));
|
completedTaskPojo.setId(UUID.randomUUID().toString().replaceAll("-", ""));
|
||||||
@ -333,6 +330,15 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
|||||||
completedTaskPojo.setIsDelete(0);
|
completedTaskPojo.setIsDelete(0);
|
||||||
completedTaskPojo.setCurrentNode("已维护");
|
completedTaskPojo.setCurrentNode("已维护");
|
||||||
bd.getBusinessDatabase().doInsert(completedTaskPojo);
|
bd.getBusinessDatabase().doInsert(completedTaskPojo);
|
||||||
|
|
||||||
|
InitiatedTaskPojo initiatedTask = new InitiatedTaskPojo();
|
||||||
|
BeanUtils.copyProperties(todoTaskPojo, initiatedTask);
|
||||||
|
initiatedTask.setId(UUID.randomUUID().toString().replaceAll("-", ""));
|
||||||
|
initiatedTask.setDocumentNo(todoTaskPojo.getDocumentNo());
|
||||||
|
initiatedTask.setCreationDate(engineReviewListPojo.getCreationDate());
|
||||||
|
initiatedTask.setIsDelete(0);
|
||||||
|
initiatedTask.setCurrentNode("已维护");
|
||||||
|
bd.getBusinessDatabase().doInsert(initiatedTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -542,7 +548,7 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
|||||||
todoTask.setIsDelete(0);
|
todoTask.setIsDelete(0);
|
||||||
todoTask.setModelId(flow.getModelId());
|
todoTask.setModelId(flow.getModelId());
|
||||||
todoTask.setModelName(flow.getModelName());
|
todoTask.setModelName(flow.getModelName());
|
||||||
todoTask.setProcessTitle("拒绝提醒-"+flow.getProcessTopic());
|
todoTask.setProcessTitle(flow.getProcessTopic());
|
||||||
todoTask.setStatusCode(flow.getStatusDescription());
|
todoTask.setStatusCode(flow.getStatusDescription());
|
||||||
todoTask.setVersionNumber(0);
|
todoTask.setVersionNumber(0);
|
||||||
todoTask.setOwnerId(flow.getCreatedBy());
|
todoTask.setOwnerId(flow.getCreatedBy());
|
||||||
@ -611,19 +617,21 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
|||||||
|
|
||||||
// 检查当前参数是否为一版本,是则更新参数,否则新建版本。
|
// 检查当前参数是否为一版本,是则更新参数,否则新建版本。
|
||||||
// 这个机型下所有参数都全部写入一版且版本加一 没有参与审批的参数时原来的值,参与审批的参数值要取小版本值作为大版本
|
// 这个机型下所有参数都全部写入一版且版本加一 没有参与审批的参数时原来的值,参与审批的参数值要取小版本值作为大版本
|
||||||
// 现版本全部参数
|
// 现版本需要填写的全部参数
|
||||||
List<EngineParamDetailPojo> oldDetails = bd.getBusinessDatabase()
|
List<EngineParamDetailPojo> oldDetails = bd.getBusinessDatabase()
|
||||||
.eq("engine_model_id", flow.getModelId())
|
.eq("engine_model_id", flow.getModelId())
|
||||||
.eq("major_version", model.getVersionNumber())
|
.eq("major_version", model.getVersionNumber())
|
||||||
|
.ne("is_distributed_res", 2)
|
||||||
.doQuery(EngineParamDetailPojo.class);
|
.doQuery(EngineParamDetailPojo.class);
|
||||||
// 本次审核通过审核的参数id
|
// 本次审核通过审核的参数id
|
||||||
List<String> ids = list.stream()
|
List<String> ids = list.stream()
|
||||||
.map(EngineParamDetailPojo::getId)
|
.map(EngineParamDetailPojo::getId)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
// 现版本未填写的参数
|
// 现版本需要填写但未填写的参数
|
||||||
List<EngineParamDetailPojo> emptyParameters = bd.getBusinessDatabase()
|
List<EngineParamDetailPojo> emptyParameters = bd.getBusinessDatabase()
|
||||||
.eq("engine_model_id", flow.getModelId())
|
.eq("engine_model_id", flow.getModelId())
|
||||||
.eq("major_version", model.getVersionNumber())
|
.eq("major_version", model.getVersionNumber())
|
||||||
|
.ne("is_distributed_res", 2)
|
||||||
.isNull("parameter_value")
|
.isNull("parameter_value")
|
||||||
.doQuery(EngineParamDetailPojo.class);
|
.doQuery(EngineParamDetailPojo.class);
|
||||||
|
|
||||||
@ -636,6 +644,8 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
|||||||
.doUpdate(EngineParamDetailPojo.class);
|
.doUpdate(EngineParamDetailPojo.class);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// 更新机型版本
|
||||||
|
model.setVersionNumber(model.getVersionNumber() + 1);
|
||||||
List<EngineParamDetailPojo> toInsert = new ArrayList<>();
|
List<EngineParamDetailPojo> toInsert = new ArrayList<>();
|
||||||
for (EngineParamDetailPojo oldDetail : oldDetails) {
|
for (EngineParamDetailPojo oldDetail : oldDetails) {
|
||||||
EngineParamDetailPojo engineParamDetailPojo = new EngineParamDetailPojo();
|
EngineParamDetailPojo engineParamDetailPojo = new EngineParamDetailPojo();
|
||||||
@ -650,7 +660,7 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
|||||||
if (ids.contains(oldDetail.getId())) {
|
if (ids.contains(oldDetail.getId())) {
|
||||||
engineParamDetailPojo.setParameterValue(oldDetail.getMinorVersion());
|
engineParamDetailPojo.setParameterValue(oldDetail.getMinorVersion());
|
||||||
}
|
}
|
||||||
engineParamDetailPojo.setMajorVersion(model.getVersionNumber() + 1);
|
engineParamDetailPojo.setMajorVersion(model.getVersionNumber());
|
||||||
// 添加到待插入列表
|
// 添加到待插入列表
|
||||||
toInsert.add(engineParamDetailPojo);
|
toInsert.add(engineParamDetailPojo);
|
||||||
}
|
}
|
||||||
@ -659,7 +669,7 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
|||||||
|
|
||||||
// 这个机型版本加一,
|
// 这个机型版本加一,
|
||||||
bd.getBusinessDatabase()
|
bd.getBusinessDatabase()
|
||||||
.update("version_number", (model.getVersionNumber() + 1))
|
.update("version_number", model.getVersionNumber())
|
||||||
.eq("id", flow.getModelId())
|
.eq("id", flow.getModelId())
|
||||||
.doUpdate(DataEntryEngineModelPojo.class);
|
.doUpdate(DataEntryEngineModelPojo.class);
|
||||||
}
|
}
|
||||||
@ -681,29 +691,21 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
|||||||
.doUpdate(EngineReviewListPojo.class);
|
.doUpdate(EngineReviewListPojo.class);
|
||||||
|
|
||||||
// 判断当前是否完成全部审批任务
|
// 判断当前是否完成全部审批任务
|
||||||
DataEntryEngineModelPojo hasDistributed = bd.getBusinessDatabase()
|
List<EngineParamDetailPojo> finishDetails = bd.getBusinessDatabase()
|
||||||
.eq("id", model.getId())
|
|
||||||
.eq("distribute_status", 1)
|
|
||||||
.doQueryFirst(DataEntryEngineModelPojo.class);
|
|
||||||
List<EngineParamDetailPojo> allDetails = bd.getBusinessDatabase()
|
|
||||||
.eq("engine_model_id", flow.getModelId())
|
.eq("engine_model_id", flow.getModelId())
|
||||||
.eq("major_version", model.getVersionNumber())
|
.eq("major_version", model.getVersionNumber())
|
||||||
.ne("is_distributed_res", 2)
|
.ne("is_distributed_res", 2)
|
||||||
.doQuery(EngineParamDetailPojo.class);
|
.eq("version_status", ParamValueVersionEnum.PASSED.getCode())
|
||||||
List<EngineParamDetailPojo> finishDetails = bd.getBusinessDatabase()
|
|
||||||
.eq("engine_model_id", flow.getModelId())
|
|
||||||
.eq("major_version", model.getVersionNumber() + 1)
|
|
||||||
.eq("status_code", ParamValueVersionEnum.PASSED.getCode())
|
|
||||||
.doQuery(EngineParamDetailPojo.class);
|
.doQuery(EngineParamDetailPojo.class);
|
||||||
// 机型已完成分发并且全部分发参数已完成填写并审核通过
|
// 机型已完成分发并且全部分发参数已完成填写并审核通过
|
||||||
if (hasDistributed != null && allDetails.size() == finishDetails.size()) {
|
if (model.getDistributeStatus() == 1 && oldDetails.size() == finishDetails.size()) {
|
||||||
// 修改机型状态为待分发
|
// 修改机型状态为待分发
|
||||||
bd.getBusinessDatabase()
|
bd.getBusinessDatabase()
|
||||||
.eq("id", model.getId())
|
.eq("id", model.getId())
|
||||||
.update("distribute_status", DistributeStatusEnum.UNDISTRIBUTED.getCode())
|
.update("distribute_status", DistributeStatusEnum.UNDISTRIBUTED.getCode())
|
||||||
.doUpdate(DataEntryEngineModelPojo.class);
|
.doUpdate(DataEntryEngineModelPojo.class);
|
||||||
// 修改参数状态为草稿并清除所有责任人和填写人
|
// 修改新参数状态为草稿并清除所有责任人和填写人
|
||||||
List<String> collected = allDetails.stream().map(EngineParamDetailPojo::getId).collect(Collectors.toList());
|
List<String> collected = finishDetails.stream().map(EngineParamDetailPojo::getId).collect(Collectors.toList());
|
||||||
bd.getBusinessDatabase()
|
bd.getBusinessDatabase()
|
||||||
.update("is_distributed_res", 0)
|
.update("is_distributed_res", 0)
|
||||||
.update("is_distributed_filled", 0)
|
.update("is_distributed_filled", 0)
|
||||||
@ -902,7 +904,94 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
|||||||
throw new CommonException("流程不存在");
|
throw new CommonException("流程不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
templateApprovalService.updateNodeConfig(form);
|
// 获取可更新流程节点名称
|
||||||
|
List<ApprovalConfigPojo> nodes = bd.getBusinessDatabase()
|
||||||
|
.eq("approval_id", form.getFlowId())
|
||||||
|
.doQuery(ApprovalConfigPojo.class);
|
||||||
|
|
||||||
|
// 将节点列表转换为 Map,方便后续查找
|
||||||
|
Map<String, ApprovalConfigPojo> currentNodeMap = nodes.stream()
|
||||||
|
.collect(Collectors.toMap(
|
||||||
|
ApprovalConfigPojo::getNodeName,
|
||||||
|
node -> node,
|
||||||
|
(oldValue, newValue) -> oldValue
|
||||||
|
));
|
||||||
|
Map<String, ApprovalNodeDTO> newNodeMap = form.getNodeList().stream()
|
||||||
|
.collect(Collectors.toMap(
|
||||||
|
ApprovalNodeDTO::getNodeName,
|
||||||
|
node -> node,
|
||||||
|
(oldValue, newValue) -> oldValue
|
||||||
|
));
|
||||||
|
|
||||||
|
// 更新节点前,先删除待办
|
||||||
|
bd.getBusinessDatabase()
|
||||||
|
.eq("document_no", form.getFlowId())
|
||||||
|
.eq("is_delete", 0)
|
||||||
|
.update("is_delete", 1)
|
||||||
|
.doUpdate(TodoTaskPojo.class);
|
||||||
|
|
||||||
|
boolean addNode = false;
|
||||||
|
int orderOffset = 0;
|
||||||
|
List<ApprovalNodeDTO> sorted = form.getNodeList().stream()
|
||||||
|
.sorted(Comparator.comparing(ApprovalNodeDTO::getNodeOrder))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
// 更新可选的会签节点
|
||||||
|
ApprovalConfigPojo signNode = currentNodeMap.get("会签");
|
||||||
|
ApprovalNodeDTO newSignNode = newNodeMap.get("会签");
|
||||||
|
if (newSignNode != null) {
|
||||||
|
// 新增节点
|
||||||
|
if (!newSignNode.getAssignees().isEmpty() && signNode == null) {
|
||||||
|
// 找到新增节点的插入位置
|
||||||
|
int insertOrder = newSignNode.getNodeOrder();
|
||||||
|
// 新增会签节点
|
||||||
|
ApprovalConfigPojo addNewNode = new ApprovalConfigPojo();
|
||||||
|
addNewNode.setApprovalId(form.getFlowId());
|
||||||
|
addNewNode.setNodeName(newSignNode.getNodeName());
|
||||||
|
addNewNode.setNodeOrder(insertOrder);
|
||||||
|
addNewNode.setAssignees(String.join(",", newSignNode.getAssignees()));
|
||||||
|
bd.getBusinessDatabase().doInsert(addNewNode);
|
||||||
|
// 新增节点后,后续节点序号需要+1
|
||||||
|
orderOffset = 1;
|
||||||
|
addNode = true;
|
||||||
|
}
|
||||||
|
// 删除节点
|
||||||
|
else if (newSignNode.getAssignees().isEmpty() && signNode != null) {
|
||||||
|
// 删除会签节点
|
||||||
|
bd.getBusinessDatabase()
|
||||||
|
.eq("id", signNode.getId())
|
||||||
|
.doDelete(ApprovalConfigPojo.class);
|
||||||
|
// 删除节点后,后续节点序号需要-1
|
||||||
|
orderOffset = -1;
|
||||||
|
addNode = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 遍历所有节点,更新序号和处理人信息
|
||||||
|
for (ApprovalNodeDTO newNode : sorted) {
|
||||||
|
// 获取当前节点
|
||||||
|
ApprovalConfigPojo node = currentNodeMap.get(newNode.getNodeName());
|
||||||
|
if (node == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算新序号:原始序号 + 偏移量
|
||||||
|
int finalOrder = node.getNodeOrder() + orderOffset;
|
||||||
|
// 更新节点信息
|
||||||
|
if (addNode) {
|
||||||
|
bd.getBusinessDatabase()
|
||||||
|
.eq("id", node.getId())
|
||||||
|
.update("node_order", finalOrder)
|
||||||
|
.update("assignees", String.join(",", newNode.getAssignees()))
|
||||||
|
.doUpdate(ApprovalConfigPojo.class);
|
||||||
|
} else {
|
||||||
|
// 无节点增减时,只更新处理人
|
||||||
|
bd.getBusinessDatabase()
|
||||||
|
.eq("id", node.getId())
|
||||||
|
.update("assignees", String.join(",", newNode.getAssignees()))
|
||||||
|
.doUpdate(ApprovalConfigPojo.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 更新流程状态
|
// 更新流程状态
|
||||||
if (!Objects.equals(reviewListPojo.getProcessTopic(), form.getTitle())) {
|
if (!Objects.equals(reviewListPojo.getProcessTopic(), form.getTitle())) {
|
||||||
|
|||||||
@ -193,13 +193,13 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
|
|||||||
);
|
);
|
||||||
|
|
||||||
UserTokenDT0 userToken = apaasMyTokenFeign.getUserToken(
|
UserTokenDT0 userToken = apaasMyTokenFeign.getUserToken(
|
||||||
token.getAccessToken(),
|
token.getAccess_token(),
|
||||||
userId
|
userId
|
||||||
);
|
);
|
||||||
|
|
||||||
String uploadId = new ObjectId().toHexString();
|
String uploadId = new ObjectId().toHexString();
|
||||||
FileUploadDTO fileUploadDTO = apaasMyTokenFeign.uploadFile(
|
FileUploadDTO fileUploadDTO = apaasMyTokenFeign.uploadFile(
|
||||||
"Bearer " + userToken.getAccessToken(),
|
"Bearer " + userToken.getAccess_token(),
|
||||||
"application/x-www-form-urlencoded",
|
"application/x-www-form-urlencoded",
|
||||||
file,
|
file,
|
||||||
uploadId,
|
uploadId,
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.xdap.self_development.service.impl;
|
|||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.xdap.self_development.common.BusinessDatabase;
|
import com.xdap.self_development.common.BusinessDatabase;
|
||||||
import com.xdap.self_development.controller.form.*;
|
import com.xdap.self_development.controller.form.*;
|
||||||
|
import com.xdap.self_development.domain.dto.ChartCommonParameterDTO;
|
||||||
import com.xdap.self_development.domain.pojo.*;
|
import com.xdap.self_development.domain.pojo.*;
|
||||||
import com.xdap.self_development.domain.view.ParameterItem;
|
import com.xdap.self_development.domain.view.ParameterItem;
|
||||||
import com.xdap.self_development.domain.view.ParametersView;
|
import com.xdap.self_development.domain.view.ParametersView;
|
||||||
@ -241,6 +242,93 @@ public class CommonParameterServiceImpl implements CommonParameterService {
|
|||||||
bd.getBusinessDatabase().rowid("id", commonParameter.getRowId()).doUpdate(commonParameter);
|
bd.getBusinessDatabase().rowid("id", commonParameter.getRowId()).doUpdate(commonParameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ChartCommonParameterDTO> getChartCommonParameter(String userId) {
|
||||||
|
List<ChartCommonParameterDTO> list = new ArrayList<>();
|
||||||
|
List<CommonParameterPojo> commonParameterPojos = bd.getBusinessDatabase()
|
||||||
|
.eq("create_by", userId)
|
||||||
|
.eq("common_type", 3)
|
||||||
|
.doQuery(CommonParameterPojo.class);
|
||||||
|
|
||||||
|
for (CommonParameterPojo commonParameterPojo : commonParameterPojos) {
|
||||||
|
ChartCommonParameterDTO chartCommonParameterDTO = new ChartCommonParameterDTO();
|
||||||
|
List<ChartCommonParameterPojo> chartCommonParameterPojos = bd.getBusinessDatabase()
|
||||||
|
.eq("common_id", commonParameterPojo.getId())
|
||||||
|
.doQuery(ChartCommonParameterPojo.class);
|
||||||
|
for (ChartCommonParameterPojo chartCommonParameterPojo : chartCommonParameterPojos) {
|
||||||
|
chartCommonParameterPojo.setYAxisParameters(JSON.parseArray(chartCommonParameterPojo.getYAxis(), String.class));
|
||||||
|
}
|
||||||
|
chartCommonParameterDTO.setCommonId(commonParameterPojo.getId());
|
||||||
|
chartCommonParameterDTO.setCommonName(commonParameterPojo.getCommonName());
|
||||||
|
chartCommonParameterDTO.setCharts(chartCommonParameterPojos);
|
||||||
|
list.add(chartCommonParameterDTO);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void insertChartCommonParameter(ChartCommonParameterInsertForm form) {
|
||||||
|
// 检查名字是否重复
|
||||||
|
List<CommonParameterPojo> modelCommonParameters1 = bd.getBusinessDatabase()
|
||||||
|
.eq("common_name", form.getCommonName())
|
||||||
|
.eq("create_by", form.getUserId())
|
||||||
|
.doQuery(CommonParameterPojo.class);
|
||||||
|
if (!modelCommonParameters1.isEmpty()) {
|
||||||
|
throw new CommonException("常用名重复,请重新命名");
|
||||||
|
}
|
||||||
|
// 新增常用
|
||||||
|
CommonParameterPojo commonParameter = new CommonParameterPojo();
|
||||||
|
commonParameter.setCommonName(form.getCommonName());
|
||||||
|
commonParameter.setCommonType(3);
|
||||||
|
commonParameter.setCreateBy(form.getUserId());
|
||||||
|
bd.getBusinessDatabase().doInsert(commonParameter);
|
||||||
|
|
||||||
|
// 关联常用参数
|
||||||
|
List<ChartCommonParameterPojo> chartCommonParameters = new ArrayList<>();
|
||||||
|
for (ChartCommonItem chart : form.getCharts()) {
|
||||||
|
ChartCommonParameterPojo chartCommonParameter = new ChartCommonParameterPojo();
|
||||||
|
chartCommonParameter.setTitle(chart.getTitle());
|
||||||
|
chartCommonParameter.setChartType(chart.getChartType());
|
||||||
|
chartCommonParameter.setXAxis(chart.getXAxis());
|
||||||
|
chartCommonParameter.setYAxis(JSON.toJSONString(chart.getYAxis()));
|
||||||
|
chartCommonParameter.setCommonId(commonParameter.getId());
|
||||||
|
chartCommonParameters.add(chartCommonParameter);
|
||||||
|
}
|
||||||
|
bd.getBusinessDatabase().doBatchInsert(chartCommonParameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateChartCommonParameter(ChartCommonParameterUpdateForm form) {
|
||||||
|
CommonParameterPojo commonParameter = bd.getBusinessDatabase()
|
||||||
|
.eq("id", form.getCommonId())
|
||||||
|
.doQueryFirst(CommonParameterPojo.class);
|
||||||
|
if (commonParameter == null) {
|
||||||
|
throw new CommonException("无该常用");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新常用名
|
||||||
|
bd.getBusinessDatabase()
|
||||||
|
.eq("id", commonParameter.getId())
|
||||||
|
.update("common_name", form.getCommonName())
|
||||||
|
.doUpdate(CommonParameterPojo.class);
|
||||||
|
|
||||||
|
// 更新常用
|
||||||
|
bd.getBusinessDatabase().eq("common_id", form.getCommonId())
|
||||||
|
.doDelete(ChartCommonParameterPojo.class);
|
||||||
|
List<ChartCommonParameterPojo> chartCommonParameters = new ArrayList<>();
|
||||||
|
for (ChartCommonItem chart : form.getCharts()) {
|
||||||
|
ChartCommonParameterPojo chartCommonParameter = new ChartCommonParameterPojo();
|
||||||
|
chartCommonParameter.setTitle(chart.getTitle());
|
||||||
|
chartCommonParameter.setChartType(chart.getChartType());
|
||||||
|
chartCommonParameter.setXAxis(chart.getXAxis());
|
||||||
|
chartCommonParameter.setYAxis(JSON.toJSONString(chart.getYAxis()));
|
||||||
|
chartCommonParameter.setCommonId(commonParameter.getId());
|
||||||
|
chartCommonParameters.add(chartCommonParameter);
|
||||||
|
}
|
||||||
|
bd.getBusinessDatabase().doBatchInsert(chartCommonParameters);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ParameterPojo 列表转换为 ModelCommonItem 列表
|
* ParameterPojo 列表转换为 ModelCommonItem 列表
|
||||||
* 将参数POJO列表转换为模型常用项列表
|
* 将参数POJO列表转换为模型常用项列表
|
||||||
|
|||||||
@ -10,7 +10,6 @@ import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
|
|||||||
import com.definesys.mpaas.query.MpaasQueryFactory;
|
import com.definesys.mpaas.query.MpaasQueryFactory;
|
||||||
import com.definesys.mpaas.query.db.PageQueryResult;
|
import com.definesys.mpaas.query.db.PageQueryResult;
|
||||||
import com.xdap.api.moudle.user.pojo.XdapUsers;
|
import com.xdap.api.moudle.user.pojo.XdapUsers;
|
||||||
import com.xdap.runtime.service.RuntimeDatasourceService;
|
|
||||||
import com.xdap.self_development.common.BusinessDatabase;
|
import com.xdap.self_development.common.BusinessDatabase;
|
||||||
import com.xdap.self_development.controller.request.DataEntryEngineModelExcel;
|
import com.xdap.self_development.controller.request.DataEntryEngineModelExcel;
|
||||||
import com.xdap.self_development.controller.request.DataEntryEngineModelPageRequest;
|
import com.xdap.self_development.controller.request.DataEntryEngineModelPageRequest;
|
||||||
@ -60,8 +59,6 @@ public class DataEntryEngineModelServiceImpl implements DataEntryEngineModelServ
|
|||||||
@Resource
|
@Resource
|
||||||
private ResponsiblePerService responsiblePerService;
|
private ResponsiblePerService responsiblePerService;
|
||||||
@Resource
|
@Resource
|
||||||
private RuntimeDatasourceService runtimeDatasourceService;
|
|
||||||
@Resource
|
|
||||||
private XdapDeptUsersService xdapDeptUsersService;
|
private XdapDeptUsersService xdapDeptUsersService;
|
||||||
@Resource
|
@Resource
|
||||||
private EngineParamDetailService engineParamDetailService;
|
private EngineParamDetailService engineParamDetailService;
|
||||||
@ -147,6 +144,7 @@ public class DataEntryEngineModelServiceImpl implements DataEntryEngineModelServ
|
|||||||
|
|
||||||
PageQueryResult<DataEntryEngineModelPojo> pageQueryResult = bd.getBusinessDatabase()
|
PageQueryResult<DataEntryEngineModelPojo> pageQueryResult = bd.getBusinessDatabase()
|
||||||
.eq("yc_or_oth", request.getYcOrOth())
|
.eq("yc_or_oth", request.getYcOrOth())
|
||||||
|
.eq("is_delete", 0)
|
||||||
.like("model_name", request.getModelName())
|
.like("model_name", request.getModelName())
|
||||||
.like("product_number", request.getProductNumber())
|
.like("product_number", request.getProductNumber())
|
||||||
.like("plate", request.getPlate())
|
.like("plate", request.getPlate())
|
||||||
@ -192,7 +190,7 @@ public class DataEntryEngineModelServiceImpl implements DataEntryEngineModelServ
|
|||||||
if (ObjectUtils.isEmpty(userId)) {
|
if (ObjectUtils.isEmpty(userId)) {
|
||||||
throw new ExcelImportException("执行上传操作的用户查不到,无法上传");
|
throw new ExcelImportException("执行上传操作的用户查不到,无法上传");
|
||||||
}
|
}
|
||||||
List<XdapUsers> users = runtimeDatasourceService.buildTenantMpaasQuery("xdap_app_223770822127386625")
|
List<XdapUsers> users = bd.getBusinessDatabase()
|
||||||
.eq("id", userId)
|
.eq("id", userId)
|
||||||
.doQuery(XdapUsers.class);
|
.doQuery(XdapUsers.class);
|
||||||
if (ObjectUtils.isEmpty(users)) {
|
if (ObjectUtils.isEmpty(users)) {
|
||||||
@ -200,7 +198,15 @@ public class DataEntryEngineModelServiceImpl implements DataEntryEngineModelServ
|
|||||||
}
|
}
|
||||||
XdapUsers xdapUsersPojo = users.get(0);
|
XdapUsers xdapUsersPojo = users.get(0);
|
||||||
try {
|
try {
|
||||||
EasyExcel.read(file.getInputStream(), DataEntryEngineModelExcel.class, new EngineModelListener(sw, responsiblePerService, engineParamDetailService, ycOrOt, xdapUsersPojo))
|
EasyExcel.read(file.getInputStream(),
|
||||||
|
DataEntryEngineModelExcel.class,
|
||||||
|
new EngineModelListener(
|
||||||
|
bd,
|
||||||
|
responsiblePerService,
|
||||||
|
engineParamDetailService,
|
||||||
|
ycOrOt,
|
||||||
|
xdapUsersPojo
|
||||||
|
))
|
||||||
.sheet()
|
.sheet()
|
||||||
.doRead();
|
.doRead();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -234,7 +240,7 @@ public class DataEntryEngineModelServiceImpl implements DataEntryEngineModelServ
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<XdapUsers> users = runtimeDatasourceService.buildTenantMpaasQuery("xdap_app_223770822127386625")
|
List<XdapUsers> users = bd.getBusinessDatabase()
|
||||||
.eq("id", userId)
|
.eq("id", userId)
|
||||||
.doQuery(XdapUsers.class);
|
.doQuery(XdapUsers.class);
|
||||||
if (ObjectUtils.isEmpty(users)) {
|
if (ObjectUtils.isEmpty(users)) {
|
||||||
@ -294,6 +300,8 @@ public class DataEntryEngineModelServiceImpl implements DataEntryEngineModelServ
|
|||||||
engineParamDetailPojo.setLastUpdatedBy("");
|
engineParamDetailPojo.setLastUpdatedBy("");
|
||||||
engineParamDetailPojo.setLastUpdateDate(Timestamp.valueOf(LocalDateTime.now()));
|
engineParamDetailPojo.setLastUpdateDate(Timestamp.valueOf(LocalDateTime.now()));
|
||||||
engineParamDetailPojo.setCreationDate(Timestamp.valueOf(LocalDateTime.now()));
|
engineParamDetailPojo.setCreationDate(Timestamp.valueOf(LocalDateTime.now()));
|
||||||
|
engineParamDetailPojo.setIsDistributedRes(Objects.equals(parameter.getParameterSource(), "数据平台手工录入") ? 0 : 2);
|
||||||
|
engineParamDetailPojo.setIsDistributedFilled(Objects.equals(parameter.getParameterSource(), "数据平台手工录入") ? 0 : 2);
|
||||||
//为每个参数生成默认责任人
|
//为每个参数生成默认责任人
|
||||||
List<ResponsiblePersonPojo> personPojos = responsiblePerService.selectByDepName(parameter.getDepartment());
|
List<ResponsiblePersonPojo> personPojos = responsiblePerService.selectByDepName(parameter.getDepartment());
|
||||||
if (ObjectUtils.isNotEmpty(personPojos)) {
|
if (ObjectUtils.isNotEmpty(personPojos)) {
|
||||||
@ -387,23 +395,29 @@ public class DataEntryEngineModelServiceImpl implements DataEntryEngineModelServ
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void delete(String modelId) {
|
public void delete(String modelId) {
|
||||||
EngineReviewListPojo model = bd.getBusinessDatabase()
|
EngineReviewListPojo flow = bd.getBusinessDatabase()
|
||||||
.eq("model_id", modelId)
|
.eq("model_id", modelId)
|
||||||
.doQueryFirst(EngineReviewListPojo.class);
|
.doQueryFirst(EngineReviewListPojo.class);
|
||||||
if (!ObjectUtils.isEmpty(model)) {
|
if (!ObjectUtils.isEmpty(flow)) {
|
||||||
throw new CommonException("参数值在审批值,机型无法删除");
|
throw new CommonException("参数值在审批值,机型无法删除");
|
||||||
}
|
}
|
||||||
|
|
||||||
List<InitiatedTaskPojo> initiatedTaskPojos = bd.getBusinessDatabase()
|
|
||||||
|
DataEntryEngineModelPojo model = bd.getBusinessDatabase()
|
||||||
.eq("model_id", modelId)
|
.eq("model_id", modelId)
|
||||||
.doQuery(InitiatedTaskPojo.class);
|
.doQueryFirst(DataEntryEngineModelPojo.class);
|
||||||
if (!ObjectUtils.isEmpty(initiatedTaskPojos)) {
|
if (ObjectUtils.isEmpty(model)) {
|
||||||
|
throw new CommonException("机型不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (model.getDistributeStatus() != 2) {
|
||||||
throw new CommonException("机型已分发,无法删除");
|
throw new CommonException("机型已分发,无法删除");
|
||||||
}
|
}
|
||||||
|
|
||||||
bd.getBusinessDatabase()
|
bd.getBusinessDatabase()
|
||||||
.eq("id", modelId)
|
.eq("id", modelId)
|
||||||
.doDelete(DataEntryEngineModelPojo.class);
|
.update("is_delete", 1)
|
||||||
|
.doUpdate(DataEntryEngineModelPojo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -33,7 +33,9 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
import java.sql.Timestamp;
|
||||||
import java.text.Collator;
|
import java.text.Collator;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -135,12 +137,18 @@ public class EngineParamDetailServiceImpl implements EngineParamDetailService {
|
|||||||
String emission = dataEntryEngineModelPojo.getEmission();
|
String emission = dataEntryEngineModelPojo.getEmission();
|
||||||
String burnType = dataEntryEngineModelPojo.getBurnType();
|
String burnType = dataEntryEngineModelPojo.getBurnType();
|
||||||
String engineCapacity = dataEntryEngineModelPojo.getEngineCapacity();
|
String engineCapacity = dataEntryEngineModelPojo.getEngineCapacity();
|
||||||
|
Date productionDate = dataEntryEngineModelPojo.getProductionDate();
|
||||||
|
String manufacturerName = dataEntryEngineModelPojo.getManufacturerName();
|
||||||
|
String manufacturerAbbreviation = dataEntryEngineModelPojo.getManufacturerAbbreviation();
|
||||||
ArrayList<String> strings = new ArrayList<>();
|
ArrayList<String> strings = new ArrayList<>();
|
||||||
if (dataEntryEngineModelPojo.getYcOrOth().equals("玉柴")) {
|
if (dataEntryEngineModelPojo.getYcOrOth().equals("玉柴")) {
|
||||||
strings.add("状态代号:" + productNumber);
|
strings.add("状态代号:" + productNumber);
|
||||||
} else {
|
} else {
|
||||||
strings.add("产品编号:" + productNumber);
|
strings.add("产品编号:" + productNumber);
|
||||||
strings.add("品牌:" + brand);
|
strings.add("品牌:" + brand);
|
||||||
|
strings.add("厂家全称:" + manufacturerName);
|
||||||
|
strings.add("厂家简称:" + manufacturerAbbreviation);
|
||||||
|
strings.add("生产日期:" + new SimpleDateFormat("yyyy-MM-dd").format(productionDate));
|
||||||
}
|
}
|
||||||
strings.add("产品型号:" + dataEntryEngineModelPojo.getModelName());
|
strings.add("产品型号:" + dataEntryEngineModelPojo.getModelName());
|
||||||
strings.add("板块:" + plate);
|
strings.add("板块:" + plate);
|
||||||
@ -208,7 +216,7 @@ public class EngineParamDetailServiceImpl implements EngineParamDetailService {
|
|||||||
file.getInputStream(),
|
file.getInputStream(),
|
||||||
EngineParamDetailExcel.class,
|
EngineParamDetailExcel.class,
|
||||||
new EngineParamDetailListener(
|
new EngineParamDetailListener(
|
||||||
sw,
|
bd,
|
||||||
modelPojo,
|
modelPojo,
|
||||||
dataEntryEngineModelService,
|
dataEntryEngineModelService,
|
||||||
responsiblePerService,
|
responsiblePerService,
|
||||||
@ -503,7 +511,7 @@ public class EngineParamDetailServiceImpl implements EngineParamDetailService {
|
|||||||
@Override
|
@Override
|
||||||
public void updateToInsertFiledBy(List<EngineParamDetailPojo> engineParamDetailPojos, String userID) {
|
public void updateToInsertFiledBy(List<EngineParamDetailPojo> engineParamDetailPojos, String userID) {
|
||||||
String engineModelId = engineParamDetailPojos.get(0).getEngineModelId();
|
String engineModelId = engineParamDetailPojos.get(0).getEngineModelId();
|
||||||
//TODO 分发填写人
|
//TODO 责任人向填写人分发任务
|
||||||
|
|
||||||
// 检查是否有当前任务待办
|
// 检查是否有当前任务待办
|
||||||
TodoTaskPojo todoTaskPojo = bd.getBusinessDatabase()
|
TodoTaskPojo todoTaskPojo = bd.getBusinessDatabase()
|
||||||
@ -519,7 +527,6 @@ public class EngineParamDetailServiceImpl implements EngineParamDetailService {
|
|||||||
DataEntryEngineModelPojo modelPojo = dataEntryEngineModelService.selectBymodelId(engineModelId);
|
DataEntryEngineModelPojo modelPojo = dataEntryEngineModelService.selectBymodelId(engineModelId);
|
||||||
XdapUsers xdapUsers = xdapDeptUsersService.selectUserByID(userID);
|
XdapUsers xdapUsers = xdapDeptUsersService.selectUserByID(userID);
|
||||||
ArrayList<TodoTaskPojo> todoTaskPojos = new ArrayList<>();
|
ArrayList<TodoTaskPojo> todoTaskPojos = new ArrayList<>();
|
||||||
ArrayList<InitiatedTaskPojo> taskPojos = new ArrayList<>();
|
|
||||||
|
|
||||||
//分解任务更新填写人
|
//分解任务更新填写人
|
||||||
for (EngineParamDetailPojo engineParamDetailPojo : engineParamDetailPojos) {
|
for (EngineParamDetailPojo engineParamDetailPojo : engineParamDetailPojos) {
|
||||||
@ -535,6 +542,16 @@ public class EngineParamDetailServiceImpl implements EngineParamDetailService {
|
|||||||
.map(EngineParamDetailPojo::getFilledBy)
|
.map(EngineParamDetailPojo::getFilledBy)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
for (String filledBy : filledBys) {
|
for (String filledBy : filledBys) {
|
||||||
|
// 检查是否有当前填写人的待办,有就不增加代办
|
||||||
|
List<TodoTaskPojo> filledTodos = bd.getBusinessDatabase()
|
||||||
|
.eq("model_id", modelPojo.getId())
|
||||||
|
.eq("data_type", CurrentNodeEnum.REPAIR.getDesc())
|
||||||
|
.eq("is_delete", 0)
|
||||||
|
.eq("owner_id", filledBy)
|
||||||
|
.eq("process_title", modelPojo.getModelName() + "-" + "填写参数任务")
|
||||||
|
.doQuery(TodoTaskPojo.class);
|
||||||
|
if (!filledTodos.isEmpty()) continue;
|
||||||
|
|
||||||
TodoTaskPojo todoTask = new TodoTaskPojo();
|
TodoTaskPojo todoTask = new TodoTaskPojo();
|
||||||
todoTask.setCreatedById(userID);
|
todoTask.setCreatedById(userID);
|
||||||
todoTask.setDocumentNo(UUID.randomUUID().toString());
|
todoTask.setDocumentNo(UUID.randomUUID().toString());
|
||||||
@ -551,13 +568,10 @@ public class EngineParamDetailServiceImpl implements EngineParamDetailService {
|
|||||||
todoTask.setIsDelete(0);
|
todoTask.setIsDelete(0);
|
||||||
todoTask.setCreatedBy(ObjectUtils.isNotEmpty(xdapUsers) ? xdapUsers.getUsername() : "");
|
todoTask.setCreatedBy(ObjectUtils.isNotEmpty(xdapUsers) ? xdapUsers.getUsername() : "");
|
||||||
todoTaskPojos.add(todoTask);
|
todoTaskPojos.add(todoTask);
|
||||||
InitiatedTaskPojo initiatedTaskPojo = new InitiatedTaskPojo();
|
|
||||||
BeanUtils.copyProperties(todoTask, initiatedTaskPojo);
|
|
||||||
initiatedTaskPojo.setLastUpdatedBy(filledBy);
|
|
||||||
taskPojos.add(initiatedTaskPojo);
|
|
||||||
}
|
}
|
||||||
bd.getBusinessDatabase().doBatchInsert(todoTaskPojos);
|
if (!todoTaskPojos.isEmpty()) {
|
||||||
bd.getBusinessDatabase().doBatchInsert(taskPojos);
|
bd.getBusinessDatabase().doBatchInsert(todoTaskPojos);
|
||||||
|
}
|
||||||
|
|
||||||
// 每次分发填写人时进行检测
|
// 每次分发填写人时进行检测
|
||||||
// 这个责任人相关的填写人是否都已经填写完成,如果没有则待办不动,如果填写完了,则待办完成
|
// 这个责任人相关的填写人是否都已经填写完成,如果没有则待办不动,如果填写完了,则待办完成
|
||||||
@ -577,23 +591,68 @@ public class EngineParamDetailServiceImpl implements EngineParamDetailService {
|
|||||||
.eq("owner_id", userID)
|
.eq("owner_id", userID)
|
||||||
.update("is_delete", 1)
|
.update("is_delete", 1)
|
||||||
.doUpdate(TodoTaskPojo.class);
|
.doUpdate(TodoTaskPojo.class);
|
||||||
//更新待办和发起的任务状态
|
}
|
||||||
|
InitiatedTaskPojo initiatedTask = bd.getBusinessDatabase()
|
||||||
|
.eq("model_id", modelPojo.getId())
|
||||||
|
.eq("data_type", CurrentNodeEnum.JOBSPLIT.getDesc())
|
||||||
|
.eq("created_by_id", userID)
|
||||||
|
.eq("process_title", modelPojo.getModelName() + "-" + "分发参数填写人任务")
|
||||||
|
.doQueryFirst(InitiatedTaskPojo.class);
|
||||||
|
|
||||||
|
String disStatus = ObjectUtils.isEmpty(toBeDistributedParams) ? "已分解" : "待分解";
|
||||||
|
if (ObjectUtils.isEmpty(initiatedTask)) {
|
||||||
|
InitiatedTaskPojo initiatedTaskPojo = new InitiatedTaskPojo();
|
||||||
|
initiatedTaskPojo.setCreatedById(userID);
|
||||||
|
initiatedTaskPojo.setDocumentNo(UUID.randomUUID().toString());
|
||||||
|
initiatedTaskPojo.setProcessTitle(modelPojo.getModelName() + "-" + "分发参数填写人任务");
|
||||||
|
initiatedTaskPojo.setCurrentNode(disStatus);
|
||||||
|
initiatedTaskPojo.setCurrentProcessor(JSON.toJSONString(filledBys));
|
||||||
|
initiatedTaskPojo.setStatusCode(null/*String.valueOf(ParamValueVersionEnum.DRAFT.getCode())*/);
|
||||||
|
initiatedTaskPojo.setModelName(ObjectUtils.isNotEmpty(modelPojo) ? modelPojo.getModelName() : "");
|
||||||
|
initiatedTaskPojo.setModelId(modelPojo.getId());
|
||||||
|
initiatedTaskPojo.setCreationDate(Timestamp.valueOf(LocalDateTime.now()));
|
||||||
|
initiatedTaskPojo.setDataType(CurrentNodeEnum.JOBSPLIT.getDesc());
|
||||||
|
initiatedTaskPojo.setVersionNumber(ObjectUtils.isNotEmpty(modelPojo) ? modelPojo.getVersionNumber() : 0);
|
||||||
|
initiatedTaskPojo.setIsDelete(0);
|
||||||
|
initiatedTaskPojo.setCreatedBy(ObjectUtils.isNotEmpty(xdapUsers) ? xdapUsers.getUsername() : "");
|
||||||
|
bd.getBusinessDatabase().doInsert(initiatedTaskPojo);
|
||||||
|
} else {
|
||||||
bd.getBusinessDatabase()
|
bd.getBusinessDatabase()
|
||||||
.update("current_node", "已分解")
|
.eq("id", initiatedTask.getId())
|
||||||
.update("last_update_date", new Date())
|
.update("current_node", disStatus)
|
||||||
.eq("model_id", modelPojo.getId())
|
|
||||||
.eq("data_type", CurrentNodeEnum.JOBSPLIT.getDesc())
|
|
||||||
.eq("created_by_id", userID)
|
|
||||||
.doUpdate(InitiatedTaskPojo.class);
|
.doUpdate(InitiatedTaskPojo.class);
|
||||||
//新增这个人的已办
|
}
|
||||||
|
|
||||||
|
CompletedTaskPojo completedTask = bd.getBusinessDatabase()
|
||||||
|
.eq("model_id", modelPojo.getId())
|
||||||
|
.eq("data_type", CurrentNodeEnum.JOBSPLIT.getDesc())
|
||||||
|
.eq("created_by_id", userID)
|
||||||
|
.eq("process_title", modelPojo.getModelName() + "-" + "分发参数填写人任务")
|
||||||
|
.doQueryFirst(CompletedTaskPojo.class);
|
||||||
|
|
||||||
|
String distStatus = ObjectUtils.isEmpty(toBeDistributedParams) ? "已分解" : "待分解";
|
||||||
|
if (ObjectUtils.isEmpty(completedTask)) {
|
||||||
CompletedTaskPojo completedTaskPojo = new CompletedTaskPojo();
|
CompletedTaskPojo completedTaskPojo = new CompletedTaskPojo();
|
||||||
BeanUtils.copyProperties(todoTaskPojo, completedTaskPojo);
|
completedTaskPojo.setCreatedById(userID);
|
||||||
completedTaskPojo.setId(UUID.randomUUID().toString().replaceAll("-", ""));
|
completedTaskPojo.setDocumentNo(UUID.randomUUID().toString());
|
||||||
completedTaskPojo.setDocumentNo(todoTaskPojo.getDocumentNo());
|
completedTaskPojo.setProcessTitle(modelPojo.getModelName() + "-" + "分发参数填写人任务");
|
||||||
completedTaskPojo.setCreationDate(todoTaskPojo.getCreationDate());
|
completedTaskPojo.setCurrentNode(distStatus);
|
||||||
|
completedTaskPojo.setCurrentProcessor(JSON.toJSONString(filledBys));
|
||||||
|
completedTaskPojo.setStatusCode(null/*String.valueOf(ParamValueVersionEnum.DRAFT.getCode())*/);
|
||||||
|
completedTaskPojo.setModelName(ObjectUtils.isNotEmpty(modelPojo) ? modelPojo.getModelName() : "");
|
||||||
|
completedTaskPojo.setModelId(modelPojo.getId());
|
||||||
|
completedTaskPojo.setCreationDate(Timestamp.valueOf(LocalDateTime.now()));
|
||||||
|
completedTaskPojo.setDataType(CurrentNodeEnum.JOBSPLIT.getDesc());
|
||||||
|
completedTaskPojo.setVersionNumber(ObjectUtils.isNotEmpty(modelPojo) ? modelPojo.getVersionNumber() : 0);
|
||||||
|
completedTaskPojo.setOwnerId(userID);
|
||||||
completedTaskPojo.setIsDelete(0);
|
completedTaskPojo.setIsDelete(0);
|
||||||
completedTaskPojo.setCurrentNode("已分解");
|
completedTaskPojo.setCreatedBy(ObjectUtils.isNotEmpty(xdapUsers) ? xdapUsers.getUsername() : "");
|
||||||
bd.getBusinessDatabase().doInsert(completedTaskPojo);
|
bd.getBusinessDatabase().doInsert(completedTaskPojo);
|
||||||
|
} else {
|
||||||
|
bd.getBusinessDatabase()
|
||||||
|
.eq("id", completedTask.getId())
|
||||||
|
.update("current_node", distStatus)
|
||||||
|
.doUpdate(CompletedTaskPojo.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -363,18 +363,19 @@ public class TcDataQueryServiceImpl implements TcDataQueryService {
|
|||||||
List<ModelItem> models = request.getModelIds();
|
List<ModelItem> models = request.getModelIds();
|
||||||
String userID = request.getUserID();
|
String userID = request.getUserID();
|
||||||
List<String> subsystemParts = request.getSubsystemParts();
|
List<String> subsystemParts = request.getSubsystemParts();
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
|
||||||
|
|
||||||
// 1. 前置空指针检查,提前拦截异常并给出明确信息
|
// 1. 前置空指针检查,提前拦截异常并给出明确信息
|
||||||
if (models == null) {
|
if (models == null || models.isEmpty()) {
|
||||||
log.error("导出失败:机型列表为null");
|
log.error("导出失败:机型列表为null或空");
|
||||||
throw new CommonException("导出失败:机型列表不能为空");
|
throw new CommonException("导出失败:机型列表不能为空");
|
||||||
}
|
}
|
||||||
if (StringUtils.isEmpty(userID)) {
|
if (StringUtils.isEmpty(userID)) {
|
||||||
log.error("导出失败:用户ID为空");
|
log.error("导出失败:用户ID为空");
|
||||||
throw new CommonException("导出失败:用户ID不能为空");
|
throw new CommonException("导出失败:用户ID不能为空");
|
||||||
}
|
}
|
||||||
if (subsystemParts.isEmpty()) {
|
if (subsystemParts == null || subsystemParts.isEmpty()) {
|
||||||
log.error("导出失败:子系统部件列表为null");
|
log.error("导出失败:子系统部件列表为null或空");
|
||||||
throw new CommonException("导出失败:子系统部件列表不能为空");
|
throw new CommonException("导出失败:子系统部件列表不能为空");
|
||||||
}
|
}
|
||||||
if (response == null) {
|
if (response == null) {
|
||||||
@ -384,176 +385,230 @@ public class TcDataQueryServiceImpl implements TcDataQueryService {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// 设置响应头
|
// 设置响应头
|
||||||
setupResponse(response, "机型参数对比表" + (formatter.format(LocalDateTime.now())) + ".xlsx");
|
setupExcelResponse(response, "机型参数对比表" + formatter.format(LocalDateTime.now()) + ".xlsx");
|
||||||
|
|
||||||
// 获取机型名称映射
|
// 获取机型名称映射
|
||||||
Map<String, String> modelNames = new HashMap<>();
|
Map<String, String> modelNames = getModelNameMapping(models);
|
||||||
for (ModelItem model : models) {
|
|
||||||
// 防护model为null
|
|
||||||
if (model == null || StringUtils.isEmpty(model.getModelId())) {
|
|
||||||
log.warn("无效的机型项:model为null或modelId为空");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
DataEntryEngineModelPojo tempModel = engineModelService.selectBymodelId(model.getModelId());
|
|
||||||
if (tempModel != null) {
|
|
||||||
modelNames.put(model.getModelId(), tempModel.getModelName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 存储所有参数信息,key为参数名,value为各机型的参数值
|
// 从Redis加载并处理数据
|
||||||
Map<String, Map<String, String>> parameterValues = new HashMap<>();
|
Map<String, Map<String, String>> parameterValues = new HashMap<>();
|
||||||
// 存储参数的子系统和零部件信息
|
|
||||||
Map<String, String[]> parameterSubsystemParts = new HashMap<>();
|
Map<String, String[]> parameterSubsystemParts = new HashMap<>();
|
||||||
|
loadAndProcessRedisData(request, models, userID, subsystemParts, parameterValues, parameterSubsystemParts);
|
||||||
|
|
||||||
// 从Redis获取每个机型的数据
|
// 构建EasyExcel的表头和数据
|
||||||
for (ModelItem model : models) {
|
List<List<String>> excelData = buildExcelData(models, modelNames, parameterValues, parameterSubsystemParts);
|
||||||
try {
|
|
||||||
// 防护model为null
|
|
||||||
if (model == null) {
|
|
||||||
log.warn("跳过空的机型项");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
String modelId = model.getModelId();
|
|
||||||
String paramVersion = model.getParameterVersion();
|
|
||||||
if (StringUtils.isEmpty(modelId) || StringUtils.isEmpty(paramVersion)) {
|
|
||||||
log.warn("机型ID或参数版本为空,跳过该机型:modelId={}, paramVersion={}", modelId, paramVersion);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
String redisKey = userID + ":" + modelId + ":" + paramVersion + ":" + "ComparisonExport";
|
// 使用EasyExcel写入
|
||||||
// 防护redisTemplate为null
|
try (OutputStream outputStream = response.getOutputStream()) {
|
||||||
if (redisTemplate == null) {
|
|
||||||
throw new CommonException("Redis模板对象未初始化");
|
|
||||||
}
|
|
||||||
String cachedData = redisTemplate.opsForValue().get(redisKey);
|
|
||||||
|
|
||||||
if (ObjectUtils.isNotEmpty(cachedData)) {
|
|
||||||
// 防护objectMapper为null
|
|
||||||
if (objectMapper == null) {
|
|
||||||
throw new CommonException("ObjectMapper对象未初始化");
|
|
||||||
}
|
|
||||||
// 反序列化数据
|
|
||||||
List<EngineParamDetailPojo> allPojos = objectMapper.readValue(cachedData,
|
|
||||||
objectMapper.getTypeFactory().constructCollectionType(List.class, EngineParamDetailPojo.class));
|
|
||||||
|
|
||||||
|
|
||||||
// 根据子系统部件筛选数据
|
|
||||||
List<EngineParamDetailPojo> filteredPojos = allPojos.stream()
|
|
||||||
.filter(pojo -> subsystemParts.stream().anyMatch(part -> {
|
|
||||||
String[] parts = part.split("-");
|
|
||||||
if (parts.length != 2) return false;
|
|
||||||
String subsystem = parts[0];
|
|
||||||
String partsName = parts[1];
|
|
||||||
|
|
||||||
if (!request.getParameterIds().isEmpty()) {
|
|
||||||
return request.getParameterIds().contains(pojo.getParameterId());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果部件名为"/",表示只匹配子系统
|
|
||||||
if ("/".equals(partsName)) {
|
|
||||||
return subsystem.equals(pojo.getSubsystemName());
|
|
||||||
} else {
|
|
||||||
return subsystem.equals(pojo.getSubsystemName()) && partsName.equals(pojo.getPartsName());
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
// 处理筛选后的数据,按参数名分组
|
|
||||||
for (EngineParamDetailPojo pojo : filteredPojos) {
|
|
||||||
if (pojo == null || StringUtils.isEmpty(pojo.getParameterName())) {
|
|
||||||
log.warn("无效的参数项:pojo为null或参数名为空");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
String paramName = pojo.getParameterName();
|
|
||||||
String paramValue = pojo.getParameterValue();
|
|
||||||
|
|
||||||
// 如果参数名不存在,创建新条目
|
|
||||||
if (!parameterValues.containsKey(paramName)) {
|
|
||||||
parameterValues.put(paramName, new HashMap<>());
|
|
||||||
// 存储子系统和零部件信息
|
|
||||||
parameterSubsystemParts.put(paramName, new String[]{
|
|
||||||
pojo.getSubsystemName() == null ? "" : pojo.getSubsystemName(),
|
|
||||||
pojo.getPartsName() == null ? "" : pojo.getPartsName()
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置该机型的参数值
|
|
||||||
parameterValues.get(paramName).put(modelId, paramValue == null ? "" : paramValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
String errorMsg = null;
|
|
||||||
if (model != null) {
|
|
||||||
errorMsg = String.format("从Redis读取机型%s数据失败: %s", model.getModelId(), e.toString());
|
|
||||||
}
|
|
||||||
log.error(errorMsg, e); // 记录完整异常栈
|
|
||||||
throw new CommonException(errorMsg, e); // 传递异常根因
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 准备Excel数据
|
|
||||||
List<List<String>> excelData = new ArrayList<>();
|
|
||||||
|
|
||||||
// 表头行:子系统,零部件,参数名,机型1,机型2,机型3...
|
|
||||||
List<String> header = new ArrayList<>();
|
|
||||||
header.add("子系统");
|
|
||||||
header.add("零部件");
|
|
||||||
header.add("参数");
|
|
||||||
for (ModelItem model : models) {
|
|
||||||
if (model == null) {
|
|
||||||
header.add("未知机型");
|
|
||||||
} else {
|
|
||||||
header.add(modelNames.getOrDefault(model.getModelId(), "未知机型"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
excelData.add(header);
|
|
||||||
|
|
||||||
// 数据行:每个参数一行
|
|
||||||
for (Map.Entry<String, Map<String, String>> entry : parameterValues.entrySet()) {
|
|
||||||
List<String> row = new ArrayList<>();
|
|
||||||
String paramName = entry.getKey();
|
|
||||||
|
|
||||||
// 添加子系统和零部件信息
|
|
||||||
String[] getSubsystemParts = parameterSubsystemParts.get(paramName);
|
|
||||||
if (getSubsystemParts != null && getSubsystemParts.length >= 2) {
|
|
||||||
row.add(getSubsystemParts[0]); // 子系统
|
|
||||||
row.add(getSubsystemParts[1]); // 零部件
|
|
||||||
} else {
|
|
||||||
row.add(""); // 子系统
|
|
||||||
row.add(""); // 零部件
|
|
||||||
}
|
|
||||||
|
|
||||||
row.add(paramName); // 参数名
|
|
||||||
|
|
||||||
// 每个机型的参数值
|
|
||||||
Map<String, String> values = entry.getValue();
|
|
||||||
for (ModelItem model : models) {
|
|
||||||
if (model == null) {
|
|
||||||
row.add("");
|
|
||||||
} else {
|
|
||||||
row.add(values.getOrDefault(model.getModelId(), ""));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
excelData.add(row);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 写入Excel(防护流操作异常)
|
|
||||||
try (OutputStream outputStream = response.getOutputStream()) { // 自动关闭流
|
|
||||||
EasyExcel.write(outputStream)
|
EasyExcel.write(outputStream)
|
||||||
.sheet("机型参数对比")
|
.sheet("机型参数对比")
|
||||||
|
.head(getCustomHeader(models, modelNames)) // 自定义表头
|
||||||
.doWrite(excelData);
|
.doWrite(excelData);
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("机型参数对比表导出成功,共导出{}行数据", excelData.size());
|
log.info("机型参数对比表导出成功,共导出{}行数据(含表头)", excelData.size());
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// 关键修复:使用e.toString()而非e.getMessage(),并记录完整异常栈
|
String errorMsg = "导出失败: " + e.getMessage();
|
||||||
String errorMsg = "导出失败: " + e.toString();
|
log.error(errorMsg, e);
|
||||||
log.error(errorMsg, e); // 记录完整异常栈,便于定位问题
|
throw new CommonException(errorMsg, e);
|
||||||
throw new CommonException(errorMsg, e); // 传递根异常,保留调用栈
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// public void modelComparisonExport(ModelComparisonExportRequest request, HttpServletResponse response) {
|
||||||
|
// List<ModelItem> models = request.getModelIds();
|
||||||
|
// String userID = request.getUserID();
|
||||||
|
// List<String> subsystemParts = request.getSubsystemParts();
|
||||||
|
//
|
||||||
|
// // 1. 前置空指针检查,提前拦截异常并给出明确信息
|
||||||
|
// if (models == null) {
|
||||||
|
// log.error("导出失败:机型列表为null");
|
||||||
|
// throw new CommonException("导出失败:机型列表不能为空");
|
||||||
|
// }
|
||||||
|
// if (StringUtils.isEmpty(userID)) {
|
||||||
|
// log.error("导出失败:用户ID为空");
|
||||||
|
// throw new CommonException("导出失败:用户ID不能为空");
|
||||||
|
// }
|
||||||
|
// if (subsystemParts.isEmpty()) {
|
||||||
|
// log.error("导出失败:子系统部件列表为null");
|
||||||
|
// throw new CommonException("导出失败:子系统部件列表不能为空");
|
||||||
|
// }
|
||||||
|
// if (response == null) {
|
||||||
|
// log.error("导出失败:响应对象为null");
|
||||||
|
// throw new CommonException("导出失败:响应对象异常");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// // 设置响应头
|
||||||
|
// setupResponse(response, "机型参数对比表" + (formatter.format(LocalDateTime.now())) + ".xlsx");
|
||||||
|
//
|
||||||
|
// // 获取机型名称映射
|
||||||
|
// Map<String, String> modelNames = new HashMap<>();
|
||||||
|
// for (ModelItem model : models) {
|
||||||
|
// // 防护model为null
|
||||||
|
// if (model == null || StringUtils.isEmpty(model.getModelId())) {
|
||||||
|
// log.warn("无效的机型项:model为null或modelId为空");
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
// DataEntryEngineModelPojo tempModel = engineModelService.selectBymodelId(model.getModelId());
|
||||||
|
// if (tempModel != null) {
|
||||||
|
// modelNames.put(model.getModelId(), tempModel.getModelName());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 存储所有参数信息,key为参数名,value为各机型的参数值
|
||||||
|
// Map<String, Map<String, String>> parameterValues = new HashMap<>();
|
||||||
|
// // 存储参数的子系统和零部件信息
|
||||||
|
// Map<String, String[]> parameterSubsystemParts = new HashMap<>();
|
||||||
|
//
|
||||||
|
// // 从Redis获取每个机型的数据
|
||||||
|
// for (ModelItem model : models) {
|
||||||
|
// try {
|
||||||
|
// // 防护model为null
|
||||||
|
// if (model == null) {
|
||||||
|
// log.warn("跳过空的机型项");
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
// String modelId = model.getModelId();
|
||||||
|
// String paramVersion = model.getParameterVersion();
|
||||||
|
// if (StringUtils.isEmpty(modelId) || StringUtils.isEmpty(paramVersion)) {
|
||||||
|
// log.warn("机型ID或参数版本为空,跳过该机型:modelId={}, paramVersion={}", modelId, paramVersion);
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// String redisKey = userID + ":" + modelId + ":" + paramVersion + ":" + "ComparisonExport";
|
||||||
|
// // 防护redisTemplate为null
|
||||||
|
// if (redisTemplate == null) {
|
||||||
|
// throw new CommonException("Redis模板对象未初始化");
|
||||||
|
// }
|
||||||
|
// String cachedData = redisTemplate.opsForValue().get(redisKey);
|
||||||
|
//
|
||||||
|
// if (ObjectUtils.isNotEmpty(cachedData)) {
|
||||||
|
// // 防护objectMapper为null
|
||||||
|
// if (objectMapper == null) {
|
||||||
|
// throw new CommonException("ObjectMapper对象未初始化");
|
||||||
|
// }
|
||||||
|
// // 反序列化数据
|
||||||
|
// List<EngineParamDetailPojo> allPojos = objectMapper.readValue(cachedData,
|
||||||
|
// objectMapper.getTypeFactory().constructCollectionType(List.class, EngineParamDetailPojo.class));
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// // 根据子系统部件筛选数据
|
||||||
|
// List<EngineParamDetailPojo> filteredPojos = allPojos.stream()
|
||||||
|
// .filter(pojo -> subsystemParts.stream().anyMatch(part -> {
|
||||||
|
// String[] parts = part.split("-");
|
||||||
|
// if (parts.length != 2) return false;
|
||||||
|
// String subsystem = parts[0];
|
||||||
|
// String partsName = parts[1];
|
||||||
|
//
|
||||||
|
// if (!request.getParameterIds().isEmpty()) {
|
||||||
|
// return request.getParameterIds().contains(pojo.getParameterId());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 如果部件名为"/",表示只匹配子系统
|
||||||
|
// if ("/".equals(partsName)) {
|
||||||
|
// return subsystem.equals(pojo.getSubsystemName());
|
||||||
|
// } else {
|
||||||
|
// return subsystem.equals(pojo.getSubsystemName()) && partsName.equals(pojo.getPartsName());
|
||||||
|
// }
|
||||||
|
// }))
|
||||||
|
// .collect(Collectors.toList());
|
||||||
|
//
|
||||||
|
// // 处理筛选后的数据,按参数名分组
|
||||||
|
// for (EngineParamDetailPojo pojo : filteredPojos) {
|
||||||
|
// if (pojo == null || StringUtils.isEmpty(pojo.getParameterName())) {
|
||||||
|
// log.warn("无效的参数项:pojo为null或参数名为空");
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
// String paramName = pojo.getParameterName();
|
||||||
|
// String paramValue = pojo.getParameterValue();
|
||||||
|
//
|
||||||
|
// // 如果参数名不存在,创建新条目
|
||||||
|
// if (!parameterValues.containsKey(paramName)) {
|
||||||
|
// parameterValues.put(paramName, new HashMap<>());
|
||||||
|
// // 存储子系统和零部件信息
|
||||||
|
// parameterSubsystemParts.put(paramName, new String[]{
|
||||||
|
// pojo.getSubsystemName() == null ? "" : pojo.getSubsystemName(),
|
||||||
|
// pojo.getPartsName() == null ? "" : pojo.getPartsName()
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 设置该机型的参数值
|
||||||
|
// parameterValues.get(paramName).put(modelId, paramValue == null ? "" : paramValue);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// String errorMsg = null;
|
||||||
|
// if (model != null) {
|
||||||
|
// errorMsg = String.format("从Redis读取机型%s数据失败: %s", model.getModelId(), e.toString());
|
||||||
|
// }
|
||||||
|
// log.error(errorMsg, e); // 记录完整异常栈
|
||||||
|
// throw new CommonException(errorMsg, e); // 传递异常根因
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 准备Excel数据
|
||||||
|
// List<List<String>> excelData = new ArrayList<>();
|
||||||
|
//
|
||||||
|
// // 表头行:子系统,零部件,参数名,机型1,机型2,机型3...
|
||||||
|
// List<String> header = new ArrayList<>();
|
||||||
|
// header.add("子系统");
|
||||||
|
// header.add("零部件");
|
||||||
|
// header.add("参数");
|
||||||
|
// for (ModelItem model : models) {
|
||||||
|
// if (model == null) {
|
||||||
|
// header.add("未知机型");
|
||||||
|
// } else {
|
||||||
|
// header.add(modelNames.getOrDefault(model.getModelId(), "未知机型"));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// excelData.add(header);
|
||||||
|
//
|
||||||
|
// // 数据行:每个参数一行
|
||||||
|
// for (Map.Entry<String, Map<String, String>> entry : parameterValues.entrySet()) {
|
||||||
|
// List<String> row = new ArrayList<>();
|
||||||
|
// String paramName = entry.getKey();
|
||||||
|
//
|
||||||
|
// // 添加子系统和零部件信息
|
||||||
|
// String[] getSubsystemParts = parameterSubsystemParts.get(paramName);
|
||||||
|
// if (getSubsystemParts != null && getSubsystemParts.length >= 2) {
|
||||||
|
// row.add(getSubsystemParts[0]); // 子系统
|
||||||
|
// row.add(getSubsystemParts[1]); // 零部件
|
||||||
|
// } else {
|
||||||
|
// row.add(""); // 子系统
|
||||||
|
// row.add(""); // 零部件
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// row.add(paramName); // 参数名
|
||||||
|
//
|
||||||
|
// // 每个机型的参数值
|
||||||
|
// Map<String, String> values = entry.getValue();
|
||||||
|
// for (ModelItem model : models) {
|
||||||
|
// if (model == null) {
|
||||||
|
// row.add("");
|
||||||
|
// } else {
|
||||||
|
// row.add(values.getOrDefault(model.getModelId(), ""));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// excelData.add(row);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 写入Excel(防护流操作异常)
|
||||||
|
// try (OutputStream outputStream = response.getOutputStream()) { // 自动关闭流
|
||||||
|
// EasyExcel.write(outputStream)
|
||||||
|
// .sheet("机型参数对比")
|
||||||
|
// .doWrite(excelData);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// log.info("机型参数对比表导出成功,共导出{}行数据", excelData.size());
|
||||||
|
//
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// // 关键修复:使用e.toString()而非e.getMessage(),并记录完整异常栈
|
||||||
|
// String errorMsg = "导出失败: " + e.toString();
|
||||||
|
// log.error(errorMsg, e); // 记录完整异常栈,便于定位问题
|
||||||
|
// throw new CommonException(errorMsg, e); // 传递根异常,保留调用栈
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
/**
|
/**
|
||||||
@ -845,4 +900,180 @@ public class TcDataQueryServiceImpl implements TcDataQueryService {
|
|||||||
String encodedFileName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
|
String encodedFileName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
|
||||||
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + encodedFileName + ".xlsx");
|
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + encodedFileName + ".xlsx");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setupExcelResponse(HttpServletResponse response, String fileName) {
|
||||||
|
try {
|
||||||
|
// 设置响应内容类型
|
||||||
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||||
|
response.setCharacterEncoding("UTF-8");
|
||||||
|
// 处理文件名中文乱码
|
||||||
|
String encodedFileName = java.net.URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
|
||||||
|
response.setHeader("Content-Disposition", "attachment; filename=\"" + encodedFileName + "\"");
|
||||||
|
// 禁止缓存
|
||||||
|
response.setHeader("Pragma", "no-cache");
|
||||||
|
response.setHeader("Cache-Control", "no-cache");
|
||||||
|
response.setDateHeader("Expires", 0);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("设置Excel响应头失败", e);
|
||||||
|
throw new CommonException("设置导出响应头失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, String> getModelNameMapping(List<ModelItem> models) {
|
||||||
|
Map<String, String> modelNames = new HashMap<>();
|
||||||
|
for (ModelItem model : models) {
|
||||||
|
if (model == null || StringUtils.isEmpty(model.getModelId())) {
|
||||||
|
log.warn("无效的机型项:model为null或modelId为空");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
DataEntryEngineModelPojo tempModel = engineModelService.selectBymodelId(model.getModelId());
|
||||||
|
if (tempModel != null) {
|
||||||
|
modelNames.put(model.getModelId(), tempModel.getModelName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return modelNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadAndProcessRedisData(ModelComparisonExportRequest request, List<ModelItem> models, String userID,
|
||||||
|
List<String> subsystemParts, Map<String, Map<String, String>> parameterValues,
|
||||||
|
Map<String, String[]> parameterSubsystemParts) {
|
||||||
|
for (ModelItem model : models) {
|
||||||
|
try {
|
||||||
|
if (model == null) {
|
||||||
|
log.warn("跳过空的机型项");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String modelId = model.getModelId();
|
||||||
|
String paramVersion = model.getParameterVersion();
|
||||||
|
if (StringUtils.isEmpty(modelId) || StringUtils.isEmpty(paramVersion)) {
|
||||||
|
log.warn("机型ID或参数版本为空,跳过该机型:modelId={}, paramVersion={}", modelId, paramVersion);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
String redisKey = userID + ":" + modelId + ":" + paramVersion + ":" + "ComparisonExport";
|
||||||
|
if (redisTemplate == null) {
|
||||||
|
throw new CommonException("Redis模板对象未初始化");
|
||||||
|
}
|
||||||
|
String cachedData = redisTemplate.opsForValue().get(redisKey);
|
||||||
|
|
||||||
|
if (ObjectUtils.isNotEmpty(cachedData)) {
|
||||||
|
if (objectMapper == null) {
|
||||||
|
throw new CommonException("ObjectMapper对象未初始化");
|
||||||
|
}
|
||||||
|
List<EngineParamDetailPojo> allPojos = objectMapper.readValue(cachedData,
|
||||||
|
objectMapper.getTypeFactory().constructCollectionType(List.class, EngineParamDetailPojo.class));
|
||||||
|
|
||||||
|
// 筛选数据(优化:抽取为独立方法)
|
||||||
|
List<EngineParamDetailPojo> filteredPojos = filterEngineParams(allPojos, subsystemParts, request);
|
||||||
|
|
||||||
|
// 处理筛选后的数据
|
||||||
|
processFilteredParams(filteredPojos, modelId, parameterValues, parameterSubsystemParts);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
String errorMsg = model != null ?
|
||||||
|
String.format("从Redis读取机型%s数据失败: %s", model.getModelId(), e.getMessage()) :
|
||||||
|
"从Redis读取机型数据失败: " + e.getMessage();
|
||||||
|
log.error(errorMsg, e);
|
||||||
|
throw new CommonException(errorMsg, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<EngineParamDetailPojo> filterEngineParams(List<EngineParamDetailPojo> allPojos,
|
||||||
|
List<String> subsystemParts,
|
||||||
|
ModelComparisonExportRequest request) {
|
||||||
|
if (allPojos == null) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
return allPojos.stream()
|
||||||
|
.filter(Objects::nonNull) // 增加null过滤
|
||||||
|
.filter(pojo -> subsystemParts.stream().anyMatch(part -> {
|
||||||
|
String[] parts = part.split("-");
|
||||||
|
if (parts.length != 2) return false;
|
||||||
|
String subsystem = parts[0];
|
||||||
|
String partsName = parts[1];
|
||||||
|
|
||||||
|
// 参数ID筛选优先
|
||||||
|
if (request.getParameterIds() != null && !request.getParameterIds().isEmpty()) {
|
||||||
|
return request.getParameterIds().contains(pojo.getParameterId());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 子系统和零部件匹配逻辑
|
||||||
|
if ("/".equals(partsName)) {
|
||||||
|
return Objects.equals(subsystem, pojo.getSubsystemName());
|
||||||
|
} else {
|
||||||
|
return Objects.equals(subsystem, pojo.getSubsystemName()) &&
|
||||||
|
Objects.equals(partsName, pojo.getPartsName());
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processFilteredParams(List<EngineParamDetailPojo> filteredPojos, String modelId,
|
||||||
|
Map<String, Map<String, String>> parameterValues,
|
||||||
|
Map<String, String[]> parameterSubsystemParts) {
|
||||||
|
for (EngineParamDetailPojo pojo : filteredPojos) {
|
||||||
|
if (pojo == null || StringUtils.isEmpty(pojo.getParameterName())) {
|
||||||
|
log.warn("无效的参数项:pojo为null或参数名为空");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String paramName = pojo.getParameterName();
|
||||||
|
String paramValue = pojo.getParameterValue() == null ? "" : pojo.getParameterValue();
|
||||||
|
|
||||||
|
parameterValues.computeIfAbsent(paramName, k -> new HashMap<>()).put(modelId, paramValue);
|
||||||
|
|
||||||
|
// 只在首次添加时存储子系统和零部件信息
|
||||||
|
parameterSubsystemParts.computeIfAbsent(paramName, k -> new String[]{
|
||||||
|
pojo.getSubsystemName() != null ? pojo.getSubsystemName() : "",
|
||||||
|
pojo.getPartsName() != null ? pojo.getPartsName() : ""
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<List<String>> buildExcelData(List<ModelItem> models, Map<String, String> modelNames,
|
||||||
|
Map<String, Map<String, String>> parameterValues,
|
||||||
|
Map<String, String[]> parameterSubsystemParts) {
|
||||||
|
List<List<String>> excelData = new ArrayList<>();
|
||||||
|
|
||||||
|
// 构建数据行
|
||||||
|
for (Map.Entry<String, Map<String, String>> entry : parameterValues.entrySet()) {
|
||||||
|
List<String> row = new ArrayList<>();
|
||||||
|
String paramName = entry.getKey();
|
||||||
|
|
||||||
|
// 添加子系统和零部件信息
|
||||||
|
String[] subsystemParts = parameterSubsystemParts.get(paramName);
|
||||||
|
row.add(subsystemParts != null && subsystemParts.length >= 1 ? subsystemParts[0] : "");
|
||||||
|
row.add(subsystemParts != null && subsystemParts.length >= 2 ? subsystemParts[1] : "");
|
||||||
|
|
||||||
|
// 添加参数名
|
||||||
|
row.add(paramName);
|
||||||
|
|
||||||
|
// 添加各机型参数值
|
||||||
|
Map<String, String> values = entry.getValue();
|
||||||
|
for (ModelItem model : models) {
|
||||||
|
String modelId = model != null ? model.getModelId() : "";
|
||||||
|
row.add(values.getOrDefault(modelId, ""));
|
||||||
|
}
|
||||||
|
|
||||||
|
excelData.add(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
return excelData;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<List<String>> getCustomHeader(List<ModelItem> models, Map<String, String> modelNames) {
|
||||||
|
List<List<String>> header = new ArrayList<>();
|
||||||
|
// 固定表头:子系统、零部件、参数
|
||||||
|
header.add(Collections.singletonList("子系统"));
|
||||||
|
header.add(Collections.singletonList("零部件"));
|
||||||
|
header.add(Collections.singletonList("参数"));
|
||||||
|
|
||||||
|
// 动态添加机型表头
|
||||||
|
for (ModelItem model : models) {
|
||||||
|
String modelName = model == null ? "未知机型" : modelNames.getOrDefault(model.getModelId(), "未知机型");
|
||||||
|
header.add(Collections.singletonList(modelName));
|
||||||
|
}
|
||||||
|
return header;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,6 @@ import com.xdap.self_development.controller.request.YcGetTodoTaskRequest;
|
|||||||
import com.xdap.self_development.domain.dto.EngineParamDetailDTO;
|
import com.xdap.self_development.domain.dto.EngineParamDetailDTO;
|
||||||
import com.xdap.self_development.domain.dto.PageResultDTO;
|
import com.xdap.self_development.domain.dto.PageResultDTO;
|
||||||
import com.xdap.self_development.domain.dto.YcTodoTaskCommonResultDTO;
|
import com.xdap.self_development.domain.dto.YcTodoTaskCommonResultDTO;
|
||||||
import com.xdap.self_development.domain.dto.YcTodoTaskResultDTO;
|
|
||||||
import com.xdap.self_development.domain.enums.CurrentNodeEnum;
|
import com.xdap.self_development.domain.enums.CurrentNodeEnum;
|
||||||
import com.xdap.self_development.domain.enums.DistributeStatusEnum;
|
import com.xdap.self_development.domain.enums.DistributeStatusEnum;
|
||||||
import com.xdap.self_development.domain.pojo.*;
|
import com.xdap.self_development.domain.pojo.*;
|
||||||
@ -21,6 +20,7 @@ import com.xdap.self_development.service.TodoTaskService;
|
|||||||
import com.xdap.self_development.service.XdapDeptUsersService;
|
import com.xdap.self_development.service.XdapDeptUsersService;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@ -54,17 +54,27 @@ public class TodoTaskServiceImpl implements TodoTaskService {
|
|||||||
|
|
||||||
private final String SYSTEM = "研发数据管理平台";
|
private final String SYSTEM = "研发数据管理平台";
|
||||||
|
|
||||||
private final String TODOTASKURL = "https://apaas-meim.app.yuchai.com/app/a5e8e08/ycgf-yf-rddata/223770822127386625/app/custom-page/" +
|
@Value("${apaas.app.url}")
|
||||||
"apaas-custom-toDoList?appId=771297120740179968&title=%E6%88%91%E7%9A%84%E5%BE%85%E5%8A%9E¤tMenu=782242383386378240&url=apaas-custom-toDoList";
|
private String APAASAPPURL;
|
||||||
private final String COMPLETEDURL = "https://apaas-meim.app.yuchai.com/app/a5e8e08/ycgf-yf-rddata/223770822127386625/app/custom-page/" +
|
@Value("${apaas.single.tenantId}")
|
||||||
"apaas-custom-myDone?appId=771297120740179968&title=%E6%88%91%E7%9A%84%E5%B7%B2%E5%8A%9E¤tMenu=788768564826865664&url=apaas-custom-myDone";
|
private String TENANTID;
|
||||||
private final String INITIATORURL = "https://apaas-meim.app.yuchai.com/app/a5e8e08/ycgf-yf-rddata/223770822127386625/app/\n" +
|
@Value("${apaas.single.appId}")
|
||||||
"custom-page/apaas-custom-mySend?appId=771297120740179968&title=%E6%88%91%E5%8F%91%E8%B5%B7%E7%9A%84&\n" +
|
private String APPID;
|
||||||
"currentMenu=788768456722874368&url=apaas-custom-mySend";
|
|
||||||
|
|
||||||
|
|
||||||
private static final String dateFormat = "yyyy-MM-dd HH:mm:ss";
|
private static final String dateFormat = "yyyy-MM-dd HH:mm:ss";
|
||||||
|
|
||||||
|
private String getTodoUrl() {
|
||||||
|
return APAASAPPURL + "/" + TENANTID + "/app/custom-page/apaas-custom-toDoList?appId=" + APPID;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getCompletedUrl() {
|
||||||
|
return APAASAPPURL + "/" + TENANTID + "/app/custom-page/apaas-custom-myDone?appId=" + APPID;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getInitiatorUrl() {
|
||||||
|
return APAASAPPURL + "/" + TENANTID + "/app/custom-page/apaas-custom-mySend?appId=" + APPID;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询发起任务
|
* 分页查询发起任务
|
||||||
@ -229,7 +239,7 @@ public class TodoTaskServiceImpl implements TodoTaskService {
|
|||||||
@Override
|
@Override
|
||||||
public void createResPerson(List<EngineParamDetailDTO> paramDetailPojosAll, String userID) {
|
public void createResPerson(List<EngineParamDetailDTO> paramDetailPojosAll, String userID) {
|
||||||
String modelId = paramDetailPojosAll.get(0).getEngineModelId();
|
String modelId = paramDetailPojosAll.get(0).getEngineModelId();
|
||||||
//TODO 分发责任人
|
//TODO 管理员向责任人分发任务
|
||||||
//为参数更新责任人
|
//为参数更新责任人
|
||||||
for (EngineParamDetailDTO engineParamDetailDTO : paramDetailPojosAll) {
|
for (EngineParamDetailDTO engineParamDetailDTO : paramDetailPojosAll) {
|
||||||
bd.getBusinessDatabase()
|
bd.getBusinessDatabase()
|
||||||
@ -240,7 +250,6 @@ public class TodoTaskServiceImpl implements TodoTaskService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<TodoTaskPojo> todoTaskPojos = new ArrayList<>();
|
ArrayList<TodoTaskPojo> todoTaskPojos = new ArrayList<>();
|
||||||
ArrayList<InitiatedTaskPojo> taskPojos = new ArrayList<>();
|
|
||||||
XdapUsers createdUser = xdapDeptUsersService.selectUserByID(userID);
|
XdapUsers createdUser = xdapDeptUsersService.selectUserByID(userID);
|
||||||
DataEntryEngineModelPojo model = bd.getBusinessDatabase()
|
DataEntryEngineModelPojo model = bd.getBusinessDatabase()
|
||||||
.eq("id", modelId)
|
.eq("id", modelId)
|
||||||
@ -257,6 +266,7 @@ public class TodoTaskServiceImpl implements TodoTaskService {
|
|||||||
.eq("data_type", CurrentNodeEnum.JOBSPLIT.getDesc())
|
.eq("data_type", CurrentNodeEnum.JOBSPLIT.getDesc())
|
||||||
.eq("is_delete", 0)
|
.eq("is_delete", 0)
|
||||||
.eq("owner_id", resId)
|
.eq("owner_id", resId)
|
||||||
|
.eq("process_title", model.getModelName() + "-" + "分发参数填写人任务")
|
||||||
.doQuery(TodoTaskPojo.class);
|
.doQuery(TodoTaskPojo.class);
|
||||||
if (!resTodos.isEmpty()) continue;
|
if (!resTodos.isEmpty()) continue;
|
||||||
// 没有就新增待办
|
// 没有就新增待办
|
||||||
@ -276,13 +286,10 @@ public class TodoTaskServiceImpl implements TodoTaskService {
|
|||||||
todoTaskPojo.setOwnerId(resId);
|
todoTaskPojo.setOwnerId(resId);
|
||||||
todoTaskPojo.setCreatedBy(ObjectUtils.isNotEmpty(createdUser) ? createdUser.getUsername() : "");
|
todoTaskPojo.setCreatedBy(ObjectUtils.isNotEmpty(createdUser) ? createdUser.getUsername() : "");
|
||||||
todoTaskPojos.add(todoTaskPojo);
|
todoTaskPojos.add(todoTaskPojo);
|
||||||
InitiatedTaskPojo initiatedTaskPojo = new InitiatedTaskPojo();
|
|
||||||
BeanUtils.copyProperties(todoTaskPojo, initiatedTaskPojo);
|
|
||||||
initiatedTaskPojo.setLastUpdatedBy(resId);
|
|
||||||
taskPojos.add(initiatedTaskPojo);
|
|
||||||
}
|
}
|
||||||
bd.getBusinessDatabase().doBatchInsert(todoTaskPojos);
|
if (!todoTaskPojos.isEmpty()) {
|
||||||
bd.getBusinessDatabase().doBatchInsert(taskPojos);
|
bd.getBusinessDatabase().doBatchInsert(todoTaskPojos);
|
||||||
|
}
|
||||||
|
|
||||||
// 检查分发状态
|
// 检查分发状态
|
||||||
List<EngineParamDetailPojo> toBeDistributedParams = bd.getBusinessDatabase()
|
List<EngineParamDetailPojo> toBeDistributedParams = bd.getBusinessDatabase()
|
||||||
@ -307,6 +314,69 @@ public class TodoTaskServiceImpl implements TodoTaskService {
|
|||||||
.update("distribute_status", status)
|
.update("distribute_status", status)
|
||||||
.doUpdate(DataEntryEngineModelPojo.class);
|
.doUpdate(DataEntryEngineModelPojo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
InitiatedTaskPojo initiatedTask = bd.getBusinessDatabase()
|
||||||
|
.eq("model_id", model.getId())
|
||||||
|
.eq("data_type", CurrentNodeEnum.JOBSPLIT.getDesc())
|
||||||
|
.eq("created_by_id", userID)
|
||||||
|
.eq("process_title", model.getModelName() + "-" + "分发参数责任人任务")
|
||||||
|
.doQueryFirst(InitiatedTaskPojo.class);
|
||||||
|
|
||||||
|
String disStatus = ObjectUtils.isEmpty(toBeDistributedParams) ? "已分解" : "待分解";
|
||||||
|
if (ObjectUtils.isEmpty(initiatedTask)) {
|
||||||
|
InitiatedTaskPojo initiatedTaskPojo = new InitiatedTaskPojo();
|
||||||
|
initiatedTaskPojo.setCreatedById(userID);
|
||||||
|
initiatedTaskPojo.setDocumentNo(UUID.randomUUID().toString());
|
||||||
|
initiatedTaskPojo.setProcessTitle(model.getModelName() + "-" + "分发参数责任人任务");
|
||||||
|
initiatedTaskPojo.setCurrentNode(disStatus);
|
||||||
|
initiatedTaskPojo.setCurrentProcessor(JSON.toJSONString(resIds));
|
||||||
|
initiatedTaskPojo.setStatusCode(null/*String.valueOf(ParamValueVersionEnum.DRAFT.getCode())*/);
|
||||||
|
initiatedTaskPojo.setModelName(ObjectUtils.isNotEmpty(model) ? model.getModelName() : "");
|
||||||
|
initiatedTaskPojo.setModelId(modelId);
|
||||||
|
initiatedTaskPojo.setCreationDate(Timestamp.valueOf(LocalDateTime.now()));
|
||||||
|
initiatedTaskPojo.setDataType(CurrentNodeEnum.JOBSPLIT.getDesc());
|
||||||
|
initiatedTaskPojo.setVersionNumber(ObjectUtils.isNotEmpty(model) ? model.getVersionNumber() : 0);
|
||||||
|
initiatedTaskPojo.setIsDelete(0);
|
||||||
|
initiatedTaskPojo.setCreatedBy(ObjectUtils.isNotEmpty(createdUser) ? createdUser.getUsername() : "");
|
||||||
|
bd.getBusinessDatabase().doInsert(initiatedTaskPojo);
|
||||||
|
} else {
|
||||||
|
bd.getBusinessDatabase()
|
||||||
|
.eq("id", initiatedTask.getId())
|
||||||
|
.update("current_node", disStatus)
|
||||||
|
.doUpdate(InitiatedTaskPojo.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
CompletedTaskPojo completedTask = bd.getBusinessDatabase()
|
||||||
|
.eq("model_id", model.getId())
|
||||||
|
.eq("data_type", CurrentNodeEnum.JOBSPLIT.getDesc())
|
||||||
|
.eq("created_by_id", userID)
|
||||||
|
.eq("process_title", model.getModelName() + "-" + "分发参数责任人任务")
|
||||||
|
.doQueryFirst(CompletedTaskPojo.class);
|
||||||
|
|
||||||
|
String distStatus = ObjectUtils.isEmpty(toBeDistributedParams) ? "已分解" : "待分解";
|
||||||
|
if (ObjectUtils.isEmpty(completedTask)) {
|
||||||
|
CompletedTaskPojo completedTaskPojo = new CompletedTaskPojo();
|
||||||
|
completedTaskPojo.setCreatedById(userID);
|
||||||
|
completedTaskPojo.setDocumentNo(UUID.randomUUID().toString());
|
||||||
|
completedTaskPojo.setProcessTitle(model.getModelName() + "-" + "分发参数责任人任务");
|
||||||
|
completedTaskPojo.setCurrentNode(distStatus);
|
||||||
|
completedTaskPojo.setCurrentProcessor(JSON.toJSONString(resIds));
|
||||||
|
completedTaskPojo.setStatusCode(null/*String.valueOf(ParamValueVersionEnum.DRAFT.getCode())*/);
|
||||||
|
completedTaskPojo.setModelName(ObjectUtils.isNotEmpty(model) ? model.getModelName() : "");
|
||||||
|
completedTaskPojo.setModelId(modelId);
|
||||||
|
completedTaskPojo.setCreationDate(Timestamp.valueOf(LocalDateTime.now()));
|
||||||
|
completedTaskPojo.setDataType(CurrentNodeEnum.JOBSPLIT.getDesc());
|
||||||
|
completedTaskPojo.setVersionNumber(ObjectUtils.isNotEmpty(model) ? model.getVersionNumber() : 0);
|
||||||
|
completedTaskPojo.setOwnerId(userID);
|
||||||
|
completedTaskPojo.setIsDelete(0);
|
||||||
|
completedTaskPojo.setCreatedBy(ObjectUtils.isNotEmpty(createdUser) ? createdUser.getUsername() : "");
|
||||||
|
bd.getBusinessDatabase().doInsert(completedTaskPojo);
|
||||||
|
} else {
|
||||||
|
bd.getBusinessDatabase()
|
||||||
|
.eq("id", completedTask.getId())
|
||||||
|
.update("current_node", distStatus)
|
||||||
|
.doUpdate(CompletedTaskPojo.class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -346,26 +416,33 @@ public class TodoTaskServiceImpl implements TodoTaskService {
|
|||||||
.eq("id", resTodo.getId())
|
.eq("id", resTodo.getId())
|
||||||
.update("is_delete", 0)
|
.update("is_delete", 0)
|
||||||
.doUpdate(TodoTaskPojo.class);
|
.doUpdate(TodoTaskPojo.class);
|
||||||
|
// 更新发起
|
||||||
bd.getBusinessDatabase()
|
bd.getBusinessDatabase()
|
||||||
.eq("model_id", model.getId())
|
.eq("model_id", model.getId())
|
||||||
.eq("owner_id", todoTaskPojo.getOwnerId())
|
|
||||||
.eq("document_no", todoTaskPojo.getDocumentNo())
|
|
||||||
.eq("data_type", CurrentNodeEnum.JOBSPLIT.getDesc())
|
.eq("data_type", CurrentNodeEnum.JOBSPLIT.getDesc())
|
||||||
|
.eq("created_by_id", todoTaskPojo.getCreatedById())
|
||||||
|
.eq("process_title", model.getModelName() + "-" + "分发参数填写人任务")
|
||||||
.update("current_node", "待分解")
|
.update("current_node", "待分解")
|
||||||
.update("last_update_date", new Date())
|
|
||||||
.doUpdate(InitiatedTaskPojo.class);
|
.doUpdate(InitiatedTaskPojo.class);
|
||||||
|
// 更新完成
|
||||||
bd.getBusinessDatabase()
|
bd.getBusinessDatabase()
|
||||||
.eq("model_id", model.getId())
|
.eq("model_id", model.getId())
|
||||||
.eq("owner_id", todoTaskPojo.getOwnerId())
|
|
||||||
.eq("document_no", todoTaskPojo.getDocumentNo())
|
|
||||||
.eq("data_type", CurrentNodeEnum.JOBSPLIT.getDesc())
|
.eq("data_type", CurrentNodeEnum.JOBSPLIT.getDesc())
|
||||||
.update("is_delete", 1)
|
.eq("owner_id", todoTaskPojo.getCreatedById())
|
||||||
|
.eq("process_title", model.getModelName() + "-" + "分发参数填写人任务")
|
||||||
|
.update("current_node", "待分解")
|
||||||
.doUpdate(CompletedTaskPojo.class);
|
.doUpdate(CompletedTaskPojo.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 责任人拒绝
|
// 责任人拒绝
|
||||||
else if ((request.getFillerId() == null || ObjectUtils.isEmpty(request.getFillerId()))
|
else if ((request.getFillerId() == null || ObjectUtils.isEmpty(request.getFillerId()))
|
||||||
&& ObjectUtils.isNotEmpty(request.getResponsiblePersonId())) {
|
&& ObjectUtils.isNotEmpty(request.getResponsiblePersonId())) {
|
||||||
|
List<EngineParamDetailPojo> pojoList = bd.getBusinessDatabase()
|
||||||
|
.eq("engine_model_id", model.getId())
|
||||||
|
.eq("major_version", model.getVersionNumber())
|
||||||
|
.ne("responsible_person_id", request.getResponsiblePersonId())
|
||||||
|
.doQuery(EngineParamDetailPojo.class);
|
||||||
|
|
||||||
bd.getBusinessDatabase()
|
bd.getBusinessDatabase()
|
||||||
.eq("engine_model_id", model.getId())
|
.eq("engine_model_id", model.getId())
|
||||||
.eq("major_version", model.getVersionNumber())
|
.eq("major_version", model.getVersionNumber())
|
||||||
@ -376,12 +453,28 @@ public class TodoTaskServiceImpl implements TodoTaskService {
|
|||||||
.update("filled_by", null)
|
.update("filled_by", null)
|
||||||
.doUpdate(EngineParamDetailPojo.class);
|
.doUpdate(EngineParamDetailPojo.class);
|
||||||
|
|
||||||
DistributeStatusEnum byDesc = DistributeStatusEnum.getByDesc("部分分发");
|
Integer status = pojoList.isEmpty() ? 2 : 3;
|
||||||
Integer status = byDesc != null ? byDesc.getCode() : null;
|
|
||||||
bd.getBusinessDatabase()
|
bd.getBusinessDatabase()
|
||||||
.eq("id", model.getId())
|
.eq("id", model.getId())
|
||||||
.update("distribute_status", status)
|
.update("distribute_status", status)
|
||||||
.doUpdate(DataEntryEngineModelPojo.class);
|
.doUpdate(DataEntryEngineModelPojo.class);
|
||||||
|
// 更新发起
|
||||||
|
bd.getBusinessDatabase()
|
||||||
|
.eq("model_id", model.getId())
|
||||||
|
.eq("data_type", CurrentNodeEnum.JOBSPLIT.getDesc())
|
||||||
|
.eq("created_by_id", todoTaskPojo.getCreatedById())
|
||||||
|
.eq("process_title", model.getModelName() + "-" + "分发参数责任人任务")
|
||||||
|
.update("current_node", "待分解")
|
||||||
|
.doUpdate(InitiatedTaskPojo.class);
|
||||||
|
|
||||||
|
// 更新完成
|
||||||
|
bd.getBusinessDatabase()
|
||||||
|
.eq("model_id", model.getId())
|
||||||
|
.eq("data_type", CurrentNodeEnum.JOBSPLIT.getDesc())
|
||||||
|
.eq("owner_id", todoTaskPojo.getCreatedById())
|
||||||
|
.eq("process_title", model.getModelName() + "-" + "分发参数责任人任务")
|
||||||
|
.update("current_node", "待分解")
|
||||||
|
.doUpdate(CompletedTaskPojo.class);
|
||||||
} else {
|
} else {
|
||||||
throw new CommonException("参数错误");
|
throw new CommonException("参数错误");
|
||||||
}
|
}
|
||||||
@ -392,40 +485,6 @@ public class TodoTaskServiceImpl implements TodoTaskService {
|
|||||||
.doUpdate(TodoTaskPojo.class);
|
.doUpdate(TodoTaskPojo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 返回云柴待办任务
|
|
||||||
*
|
|
||||||
* @param ycGetTodoTaskRequest 云柴获取待办任务请求对象
|
|
||||||
* @return 云柴待办任务结果DTO列表
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<YcTodoTaskResultDTO> returnTodoTask(YcGetTodoTaskRequest ycGetTodoTaskRequest) {
|
|
||||||
String username = ycGetTodoTaskRequest.getUsername();
|
|
||||||
if (ObjectUtils.isEmpty(username)) {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
ArrayList<YcTodoTaskResultDTO> dtos = new ArrayList<>();
|
|
||||||
XdapUsers xdapUsers = xdapDeptUsersService.selectUserByCode(username);
|
|
||||||
if (ObjectUtils.isNotEmpty(xdapUsers)) {
|
|
||||||
String id = xdapUsers.getId();
|
|
||||||
List<TodoTaskPojo> todoTaskPojos = bd.getBusinessDatabase()
|
|
||||||
.eq("owner_id", id)
|
|
||||||
.eq("is_delete", 0)
|
|
||||||
.doQuery(TodoTaskPojo.class);
|
|
||||||
for (TodoTaskPojo todoTaskPojo : todoTaskPojos) {
|
|
||||||
YcTodoTaskResultDTO dto = new YcTodoTaskResultDTO();
|
|
||||||
dto.setTitle(todoTaskPojo.getProcessTitle());
|
|
||||||
dto.setSystemName(SYSTEM);
|
|
||||||
dto.setUpdateDate(todoTaskPojo.getCreationDate());
|
|
||||||
dto.setActivityLabel(todoTaskPojo.getCurrentNode());
|
|
||||||
dto.setUrl(TODOTASKURL);
|
|
||||||
dtos.add(dto);
|
|
||||||
}
|
|
||||||
return dtos;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回已办任务
|
* 返回已办任务
|
||||||
@ -526,9 +585,9 @@ public class TodoTaskServiceImpl implements TodoTaskService {
|
|||||||
|
|
||||||
YcTodoTaskCommonResultDTO ycCompletedResultDTO = new YcTodoTaskCommonResultDTO();
|
YcTodoTaskCommonResultDTO ycCompletedResultDTO = new YcTodoTaskCommonResultDTO();
|
||||||
if (!o.equals("发起")) {
|
if (!o.equals("发起")) {
|
||||||
ycCompletedResultDTO.setUrl(COMPLETEDURL);
|
ycCompletedResultDTO.setUrl(getCompletedUrl());
|
||||||
} else {
|
} else {
|
||||||
ycCompletedResultDTO.setUrl(INITIATORURL);
|
ycCompletedResultDTO.setUrl(getInitiatorUrl());
|
||||||
}
|
}
|
||||||
ycCompletedResultDTO.setTitle(todoTaskPojo.getProcessTitle());
|
ycCompletedResultDTO.setTitle(todoTaskPojo.getProcessTitle());
|
||||||
ycCompletedResultDTO.setCreateDate(format.format(todoTaskPojo.getCreationDate()));
|
ycCompletedResultDTO.setCreateDate(format.format(todoTaskPojo.getCreationDate()));
|
||||||
|
|||||||
@ -0,0 +1,248 @@
|
|||||||
|
package com.xdap.self_development.service.impl;
|
||||||
|
|
||||||
|
import com.definesys.mpaas.query.db.PageQueryResult;
|
||||||
|
import com.xdap.api.moudle.menus.pojo.XdapMenus;
|
||||||
|
import com.xdap.api.moudle.user.pojo.XdapUsers;
|
||||||
|
import com.xdap.self_development.common.BusinessDatabase;
|
||||||
|
import com.xdap.self_development.common.YcTaskResult;
|
||||||
|
import com.xdap.self_development.controller.request.YcGetTodoTaskRequest;
|
||||||
|
import com.xdap.self_development.domain.dto.YcTodoTaskCommonResultDTO;
|
||||||
|
import com.xdap.self_development.domain.dto.YcTodoTaskResultDTO;
|
||||||
|
import com.xdap.self_development.domain.pojo.CompletedTaskPojo;
|
||||||
|
import com.xdap.self_development.domain.pojo.InitiatedTaskPojo;
|
||||||
|
import com.xdap.self_development.domain.pojo.TodoTaskPojo;
|
||||||
|
import com.xdap.self_development.exception.CommonException;
|
||||||
|
import com.xdap.self_development.service.XdapDeptUsersService;
|
||||||
|
import com.xdap.self_development.service.YcTaskResultService;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.BinaryOperator;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class YcTaskResultServiceImpl implements YcTaskResultService {
|
||||||
|
private static final Pattern POSITIVE_INTEGER_PATTERN = Pattern.compile("^[1-9]\\d*$");
|
||||||
|
private static final SimpleDateFormat DATE_FORMATTER = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
private static final String dateFormat = "yyyy-MM-dd HH:mm:ss";
|
||||||
|
private final String SYSTEM = "研发数据管理平台";
|
||||||
|
@Resource
|
||||||
|
private BusinessDatabase bd;
|
||||||
|
@Resource
|
||||||
|
private XdapDeptUsersService xdapDeptUsersService;
|
||||||
|
@Value("${apaas.app.url}")
|
||||||
|
private String APAASAPPURL;
|
||||||
|
@Value("${apaas.single.tenantId}")
|
||||||
|
private String TENANTID;
|
||||||
|
@Value("${apaas.single.appId}")
|
||||||
|
private String APPID;
|
||||||
|
|
||||||
|
private String getTodoUrl() {
|
||||||
|
XdapMenus xdapMenus = bd.getBusinessDatabase()
|
||||||
|
.eq("app_id", APPID)
|
||||||
|
.eq("menu_name", "我的待办")
|
||||||
|
.doQueryFirst(XdapMenus.class);
|
||||||
|
String menuId = xdapMenus == null ? "" : xdapMenus.getId();
|
||||||
|
return APAASAPPURL + "/" + TENANTID + "/app/custom-page/apaas-custom-toDoList?appId=" + APPID + "&title=我的待办&url=apaas-custom-toDoList¤tMenu=" + menuId;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getCompletedUrl() {
|
||||||
|
XdapMenus xdapMenus = bd.getBusinessDatabase()
|
||||||
|
.eq("app_id", APPID)
|
||||||
|
.eq("menu_name", "我发起的")
|
||||||
|
.doQueryFirst(XdapMenus.class);
|
||||||
|
String menuId = xdapMenus == null ? "" : xdapMenus.getId();
|
||||||
|
return APAASAPPURL + "/" + TENANTID + "/app/custom-page/apaas-custom-myDone?appId=" + APPID + "&title=我发起的&url=apaas-custom-mySend¤tMenu=" + menuId;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getInitiatorUrl() {
|
||||||
|
XdapMenus xdapMenus = bd.getBusinessDatabase()
|
||||||
|
.eq("app_id", APPID)
|
||||||
|
.eq("menu_name", "我的经办")
|
||||||
|
.doQueryFirst(XdapMenus.class);
|
||||||
|
String menuId = xdapMenus == null ? "" : xdapMenus.getId();
|
||||||
|
return APAASAPPURL + "/" + TENANTID + "/app/custom-page/apaas-custom-mySend?appId=" + APPID + "&title=我的经办&url=apaas-custom-myDone¤tMenu=" + menuId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回云柴待办任务
|
||||||
|
*
|
||||||
|
* @param ycGetTodoTaskRequest 云柴获取待办任务请求对象
|
||||||
|
* @return 云柴待办任务结果DTO列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public YcTaskResult returnTodoTask(YcGetTodoTaskRequest ycGetTodoTaskRequest) {
|
||||||
|
YcTaskResult ycTaskResult = new YcTaskResult();
|
||||||
|
String username = ycGetTodoTaskRequest.getUsername();
|
||||||
|
if (ObjectUtils.isEmpty(username)) {
|
||||||
|
ycTaskResult.setCode("error");
|
||||||
|
return ycTaskResult;
|
||||||
|
}
|
||||||
|
ArrayList<YcTodoTaskResultDTO> dtos = new ArrayList<>();
|
||||||
|
XdapUsers xdapUsers = xdapDeptUsersService.selectUserByCode(username);
|
||||||
|
if (ObjectUtils.isNotEmpty(xdapUsers)) {
|
||||||
|
String id = xdapUsers.getId();
|
||||||
|
List<TodoTaskPojo> todoTaskPojos = bd.getBusinessDatabase()
|
||||||
|
.eq("owner_id", id)
|
||||||
|
.eq("is_delete", 0)
|
||||||
|
.doQuery(TodoTaskPojo.class);
|
||||||
|
for (TodoTaskPojo todoTaskPojo : todoTaskPojos) {
|
||||||
|
YcTodoTaskResultDTO dto = new YcTodoTaskResultDTO();
|
||||||
|
dto.setTitle(todoTaskPojo.getProcessTitle());
|
||||||
|
dto.setSystemName(SYSTEM);
|
||||||
|
dto.setUpdateDate(DATE_FORMATTER.format(todoTaskPojo.getCreationDate()));
|
||||||
|
dto.setActivityLabel(todoTaskPojo.getCurrentNode());
|
||||||
|
dto.setUrl(getTodoUrl());
|
||||||
|
dtos.add(dto);
|
||||||
|
}
|
||||||
|
ycTaskResult.setCode("ok");
|
||||||
|
ycTaskResult.setTable(dtos);
|
||||||
|
ycTaskResult.setTotal((long) dtos.size());
|
||||||
|
return ycTaskResult;
|
||||||
|
}
|
||||||
|
ycTaskResult.setCode("error");
|
||||||
|
return ycTaskResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public YcTaskResult returnCompleted(YcGetTodoTaskRequest ycGetTodoTaskRequest) {
|
||||||
|
YcTaskResult ycTaskResult = new YcTaskResult();
|
||||||
|
if (ObjectUtils.isEmpty(ycGetTodoTaskRequest.getCreateDateStart())) {
|
||||||
|
throw new CommonException("开始时间为必填项");
|
||||||
|
}
|
||||||
|
List<CompletedTaskPojo> completedTaskPojos = new ArrayList<>();
|
||||||
|
if (ObjectUtils.isEmpty(ycGetTodoTaskRequest.getUsername())) {
|
||||||
|
List<CompletedTaskPojo> list = bd.getBusinessDatabase()
|
||||||
|
.gteq("creation_date", ycGetTodoTaskRequest.getCreateDateStart())
|
||||||
|
.lteq("creation_date", ycGetTodoTaskRequest.getCreateDateEnd() == null ? new Date() : ycGetTodoTaskRequest.getCreateDateEnd())
|
||||||
|
.doQuery(CompletedTaskPojo.class);
|
||||||
|
completedTaskPojos.addAll(list);
|
||||||
|
} else {
|
||||||
|
XdapUsers user = bd.getBusinessDatabase()
|
||||||
|
.eq("user_number", ycGetTodoTaskRequest.getUsername())
|
||||||
|
.doQueryFirst(XdapUsers.class);
|
||||||
|
if (user == null) {
|
||||||
|
throw new CommonException("用户不存在");
|
||||||
|
}
|
||||||
|
Date createDateEnd = safeParseDateParam(ycGetTodoTaskRequest.getCreateDateEnd(), new Date());
|
||||||
|
List<CompletedTaskPojo> result = bd.getBusinessDatabase()
|
||||||
|
.eq("owner_id", user.getId())
|
||||||
|
.gteq("creation_date", ycGetTodoTaskRequest.getCreateDateStart())
|
||||||
|
.lteq("creation_date", createDateEnd)
|
||||||
|
.doQuery(CompletedTaskPojo.class);
|
||||||
|
completedTaskPojos.addAll(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 后处理
|
||||||
|
List<CompletedTaskPojo> collect = new ArrayList<>(completedTaskPojos.stream()
|
||||||
|
.collect(Collectors
|
||||||
|
.toMap(CompletedTaskPojo::getDocumentNo, Function.identity(),
|
||||||
|
BinaryOperator
|
||||||
|
.maxBy(Comparator.comparing(CompletedTaskPojo::getCreationDate))))
|
||||||
|
.values());
|
||||||
|
Integer page = safeParsePageParam(ycGetTodoTaskRequest.getPage(), 1);
|
||||||
|
Integer pageSize = safeParsePageParam(ycGetTodoTaskRequest.getPageSize(), 10);
|
||||||
|
int fromIndex = (page - 1) * pageSize;
|
||||||
|
int toIndex = Math.min(fromIndex + pageSize, collect.size());
|
||||||
|
List<CompletedTaskPojo> paginatedList = collect.subList(fromIndex, toIndex);
|
||||||
|
|
||||||
|
List<YcTodoTaskCommonResultDTO> list = new ArrayList<>();
|
||||||
|
paginatedList.forEach(completedTaskPojo -> {
|
||||||
|
YcTodoTaskCommonResultDTO dto = new YcTodoTaskCommonResultDTO();
|
||||||
|
dto.setTitle(completedTaskPojo.getProcessTitle());
|
||||||
|
dto.setCreateDate(DATE_FORMATTER.format(completedTaskPojo.getCreationDate()));
|
||||||
|
dto.setActivityName(completedTaskPojo.getCurrentNode());
|
||||||
|
dto.setUrl(getCompletedUrl());
|
||||||
|
list.add(dto);
|
||||||
|
});
|
||||||
|
ycTaskResult.setCode("ok");
|
||||||
|
ycTaskResult.setTable(list);
|
||||||
|
ycTaskResult.setTotal((long) collect.size());
|
||||||
|
return ycTaskResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public YcTaskResult returnInitiator(YcGetTodoTaskRequest ycGetTodoTaskRequest) {
|
||||||
|
YcTaskResult ycTaskResult = new YcTaskResult();
|
||||||
|
if (ObjectUtils.isEmpty(ycGetTodoTaskRequest.getCreateDateStart())) {
|
||||||
|
throw new CommonException("开始时间为必填项");
|
||||||
|
}
|
||||||
|
List<InitiatedTaskPojo> initiatedTaskPojos = new ArrayList<>();
|
||||||
|
long total = 0;
|
||||||
|
if (ObjectUtils.isEmpty(ycGetTodoTaskRequest.getUsername())) {
|
||||||
|
List<InitiatedTaskPojo> list = bd.getBusinessDatabase()
|
||||||
|
.gteq("creation_date", ycGetTodoTaskRequest.getCreateDateStart())
|
||||||
|
.lteq("creation_date", ycGetTodoTaskRequest.getCreateDateEnd() == null ? new Date() : ycGetTodoTaskRequest.getCreateDateEnd())
|
||||||
|
.doQuery(InitiatedTaskPojo.class);
|
||||||
|
initiatedTaskPojos.addAll(list);
|
||||||
|
} else {
|
||||||
|
XdapUsers user = bd.getBusinessDatabase()
|
||||||
|
.eq("user_number", ycGetTodoTaskRequest.getUsername())
|
||||||
|
.doQueryFirst(XdapUsers.class);
|
||||||
|
if (user == null) {
|
||||||
|
throw new CommonException("用户不存在");
|
||||||
|
}
|
||||||
|
Integer page = safeParsePageParam(ycGetTodoTaskRequest.getPage(), 1);
|
||||||
|
Integer pageSize = safeParsePageParam(ycGetTodoTaskRequest.getPageSize(), 10);
|
||||||
|
Date createDateEnd = safeParseDateParam(ycGetTodoTaskRequest.getCreateDateEnd(), new Date());
|
||||||
|
PageQueryResult<InitiatedTaskPojo> result = bd.getBusinessDatabase()
|
||||||
|
.eq("created_by_id", user.getId())
|
||||||
|
.gteq("creation_date", ycGetTodoTaskRequest.getCreateDateStart())
|
||||||
|
.lteq("creation_date", createDateEnd)
|
||||||
|
.doPageQuery(page, pageSize, InitiatedTaskPojo.class);
|
||||||
|
total = result.getCount();
|
||||||
|
initiatedTaskPojos.addAll(result.getResult());
|
||||||
|
}
|
||||||
|
|
||||||
|
List<YcTodoTaskCommonResultDTO> list = new ArrayList<>();
|
||||||
|
initiatedTaskPojos.forEach(initiatedTaskPojo -> {
|
||||||
|
YcTodoTaskCommonResultDTO dto = new YcTodoTaskCommonResultDTO();
|
||||||
|
dto.setTitle(initiatedTaskPojo.getProcessTitle());
|
||||||
|
dto.setCreateDate(DATE_FORMATTER.format(initiatedTaskPojo.getCreationDate()));
|
||||||
|
dto.setActivityName(initiatedTaskPojo.getCurrentNode());
|
||||||
|
dto.setUrl(getInitiatorUrl());
|
||||||
|
list.add(dto);
|
||||||
|
});
|
||||||
|
ycTaskResult.setCode("ok");
|
||||||
|
ycTaskResult.setTable(list);
|
||||||
|
ycTaskResult.setTotal(total);
|
||||||
|
return ycTaskResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Integer safeParsePageParam(String paramStr, Integer defaultValue) {
|
||||||
|
if (paramStr == null || paramStr.trim().isEmpty()) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
String cleanParam = paramStr.trim();
|
||||||
|
|
||||||
|
if (!POSITIVE_INTEGER_PATTERN.matcher(cleanParam).matches()) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return Integer.parseInt(cleanParam);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Date safeParseDateParam(String dateStr, Date defaultValue) {
|
||||||
|
if (dateStr == null || dateStr.trim().isEmpty()) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return DATE_FORMATTER.parse(dateStr.trim());
|
||||||
|
} catch (ParseException e) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,7 +1,5 @@
|
|||||||
tc.query.model.batch.size=10
|
|
||||||
tc.query.lbjth.batch.size=500
|
|
||||||
|
|
||||||
# ====================== APAAS ???? ======================
|
# ====================== APAAS ???? ======================
|
||||||
|
apaas.app.url=https://apaas-meim.app.yuchai.com/app/a5e8e08/ycgf-yf-rddata
|
||||||
apaas.token.url=http://apaas-meim.app.yuchai.com/apaas/backend/a5e8e08/ycgf-yf-rddata
|
apaas.token.url=http://apaas-meim.app.yuchai.com/apaas/backend/a5e8e08/ycgf-yf-rddata
|
||||||
apaas.token.clientId=2b5b3de8-e7fd-406a-a59a-d5568457b1f4
|
apaas.token.clientId=2b5b3de8-e7fd-406a-a59a-d5568457b1f4
|
||||||
apaas.token.clientSecred=94bddc6a-27a4-4204-885b-b075812ec535
|
apaas.token.clientSecred=94bddc6a-27a4-4204-885b-b075812ec535
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user