feat:报告流程回调优化;转pdf;发起iwork流程;
This commit is contained in:
@@ -14,6 +14,9 @@ public class QmsBpmConstant {
|
||||
public static final String BPM_FIELD_EXTENSIONS = "bpmFieldExtensions";
|
||||
public static final String BPM_FIRST_ACTIVITY_FLAG = "firstActivityFlag";
|
||||
public static final String BPM_LAST_ACTIVITY_FLAG = "lastActivityFlag";
|
||||
public static final String BPM_REJECT_TO_FIRST_FLAG = "rejectToFirstActivity";
|
||||
public static final String BPM_CUR_ACTIVITY_INS_ID = "currentActivityInsId"; //当前活动实例id
|
||||
public static final String BPM_PROCESS_INS_ID = "processInstanceId"; //当前活动实例id
|
||||
|
||||
//驳回标记前缀
|
||||
public static final String BPM_CALLBACK_RETURN_FLAG_PREFIX_KEY = "RETURN_FLAG_";
|
||||
|
||||
@@ -77,7 +77,7 @@ public class ReportDocumentAssistService {
|
||||
JSONObject extension = bpmFieldExtensions.getJSONObject(i);
|
||||
String fieldName = extension.getString("fieldName");
|
||||
String stringValue = extension.getString("stringValue");
|
||||
if(fieldName.equals("creatIWorkFlow") && stringValue.equals("1")){
|
||||
if(fieldName.equalsIgnoreCase("createiworkflow") && stringValue.equals("1")){
|
||||
createIworkWorkflowFlag = true;
|
||||
break;
|
||||
}
|
||||
@@ -86,19 +86,6 @@ public class ReportDocumentAssistService {
|
||||
if(createIworkWorkflowFlag){
|
||||
createIWorkflow(entity, docFile);
|
||||
}
|
||||
// todo 判断是否更新pdf
|
||||
|
||||
// if(!updateDocFileFlag && createIworkWorkflowFlag){
|
||||
// ReportDocumentFileDO docFile = reportDocumentFileService.getReportDocumentFile(entity.getId());
|
||||
// createIWorkflow(entity, docFile);
|
||||
// return;
|
||||
// }
|
||||
|
||||
//更新报告pdf
|
||||
|
||||
// if(updateDocFileFlag){
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -113,8 +100,8 @@ public class ReportDocumentAssistService {
|
||||
dto.setSqsj(sdf.format(new Date()));
|
||||
dto.setYyqx("检测报告用印");
|
||||
dto.setYysy("检测报告用印");
|
||||
// dto.setXyywjUrl(docFile.getUrl());
|
||||
dto.setXyywjUrl("http://172.16.46.63:30002/yudao/20251204/%E6%B5%8B%E8%AF%95pdf_1764818842846.pdf?response-cache-control=no-cache%2C%20no-store%2C%20must-revalidate&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20251209T093343Z&X-Amz-SignedHeaders=host&X-Amz-Credential=EKplIEnbNgfYBAZbEJNa%2F20251209%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Expires=86400&X-Amz-Signature=37d63249667ea855f9a51bdf47bbb044d5860c302721f52fff2ba644985bae4c");
|
||||
dto.setYysx("检测报告用印");
|
||||
dto.setXyywjUrl(docFile.getUrl());
|
||||
dto.setYwxtdjbh(sequenceUtil.genCode(sequenceKey));
|
||||
return iWorkIntegrationApi.createWorkflow(dto);
|
||||
}
|
||||
@@ -152,9 +139,11 @@ public class ReportDocumentAssistService {
|
||||
InputStream inputStream = response.bodyStream(); // 关键:返回原始 InputStream
|
||||
|
||||
//尝试从响应头中提取文件名
|
||||
String contentDisposition = response.header("Content-Disposition");
|
||||
String defaultName = "检测报告.pdf";
|
||||
String filename = extractFilename(contentDisposition).orElse(defaultName);
|
||||
// String contentDisposition = response.header("Content-Disposition");
|
||||
String documentCode = mainDO.getDocumentCode();
|
||||
if(documentCode == null) documentCode = "";
|
||||
String filename = documentCode + "检测报告.pdf";
|
||||
// String filename = extractFilename(contentDisposition).orElse(defaultName);
|
||||
//inputStream转byte[]
|
||||
byte[] fileBytes = IOUtils.toByteArray(inputStream);
|
||||
|
||||
@@ -181,14 +170,14 @@ public class ReportDocumentAssistService {
|
||||
return BeanUtils.toBean(fileRespDTO, ReportDocumentFileDO.class);
|
||||
}
|
||||
|
||||
private Optional<String> extractFilename(String contentDisposition) {
|
||||
if (contentDisposition != null && contentDisposition.contains("filename=")) {
|
||||
String filename = contentDisposition.substring(contentDisposition.indexOf("filename=") + 9);
|
||||
filename = filename.replaceAll("\"", "").trim();
|
||||
return Optional.of(filename);
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
// private Optional<String> extractFilename(String contentDisposition) {
|
||||
// if (contentDisposition != null && contentDisposition.contains("filename=")) {
|
||||
// String filename = contentDisposition.substring(contentDisposition.indexOf("filename=") + 9);
|
||||
// filename = filename.replaceAll("\"", "").trim();
|
||||
// return Optional.of(filename);
|
||||
// }
|
||||
// return Optional.empty();
|
||||
// }
|
||||
|
||||
// private String encodeFilename(String filename) {
|
||||
// try {
|
||||
|
||||
@@ -28,14 +28,11 @@ import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentMa
|
||||
import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentTypeDO;
|
||||
import com.zt.plat.module.qms.business.reportdoc.dal.mapper.ReportDocumentMainMapper;
|
||||
import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentMainDO;
|
||||
import com.zt.plat.module.qms.common.data.service.DataKeyCheckService;
|
||||
import com.zt.plat.module.qms.enums.QmsBpmConstant;
|
||||
import com.zt.plat.module.qms.enums.QmsCommonConstant;
|
||||
import com.zt.plat.module.system.api.iwork.IWorkIntegrationApi;
|
||||
import com.zt.plat.module.system.api.iwork.dto.IWorkOperationRespDTO;
|
||||
import com.zt.plat.module.system.api.iwork.dto.IWorkWorkflowCreateReqDTO;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -72,8 +69,7 @@ public class ReportDocumentMainServiceImpl implements ReportDocumentMainService,
|
||||
@Resource private ConfigUserSignatureService configUserSignatureService;
|
||||
@Resource private BusinessSampleEntrustRegistrationService businessSampleEntrustRegistrationService;
|
||||
@Resource private ReportDocumentAssistService reportDocumentAssistService;
|
||||
|
||||
|
||||
@Resource private DataKeyCheckService dataKeyCheckService;
|
||||
|
||||
/*
|
||||
* 测试异步执行
|
||||
@@ -382,6 +378,7 @@ public class ReportDocumentMainServiceImpl implements ReportDocumentMainService,
|
||||
throw exception0(ERROR_CODE_MODULE_COMMON, result.getMsg());
|
||||
}
|
||||
entity.setFlowStatus(QmsCommonConstant.IN_PROGRESS);
|
||||
//todo 生成报告编号 documentCode
|
||||
reportDocumentMainMapper.updateById(entity);
|
||||
ReportDocumentMainRespVO respVO = BeanUtils.toBean(entity, ReportDocumentMainRespVO.class);
|
||||
return CommonResult.success(respVO);
|
||||
@@ -421,10 +418,24 @@ public class ReportDocumentMainServiceImpl implements ReportDocumentMainService,
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public CommonResult<JSONObject> callback(QmsBpmDTO reqDTO) {
|
||||
|
||||
//todo 幂等性
|
||||
|
||||
log.error("流程回调:{}", JSONObject.toJSONString(reqDTO));
|
||||
JSONObject variables = reqDTO.getVariables();
|
||||
String processInsId = variables.getString(QmsBpmConstant.BPM_PROCESS_INS_ID);
|
||||
String currentActivityInsId = variables.getString(QmsBpmConstant.BPM_CUR_ACTIVITY_INS_ID);
|
||||
String returnFlag = variables.getString(QmsBpmConstant.BPM_REJECT_TO_FIRST_FLAG); //退回标识。在任务监听中设置
|
||||
//同一个节点实例只触发一次
|
||||
String checkKey = currentActivityInsId;
|
||||
if(ObjectUtils.isEmpty(currentActivityInsId))
|
||||
checkKey = processInsId + "-create";
|
||||
if("1".equals(returnFlag))
|
||||
checkKey += "-reject";
|
||||
try{
|
||||
dataKeyCheckService.create(checkKey, this.getClass().getName());
|
||||
}catch (Exception e){
|
||||
// e.printStackTrace();
|
||||
log.error("checkKey 重复:key={}", checkKey);
|
||||
return CommonResult.success(new JSONObject());
|
||||
}
|
||||
//流程状态 1-提交(含退回) 4-取消流程
|
||||
String PROCESS_STATUS = variables.getString(QmsBpmConstant.PROCESS_INSTANCE_VARIABLE_STATUS);
|
||||
String mainId = variables.getString("mainId");
|
||||
@@ -433,10 +444,7 @@ public class ReportDocumentMainServiceImpl implements ReportDocumentMainService,
|
||||
fieldExtensions = variables.getJSONArray(QmsBpmConstant.BPM_FIELD_EXTENSIONS);
|
||||
}
|
||||
ReportDocumentMainDO entity = getReportDocumentMain(Long.valueOf(mainId));
|
||||
log.error("流程回调:{}", JSONObject.toJSONString(reqDTO));
|
||||
String currentActivityId = variables.getString(QmsBpmConstant.BPM_CALLBACK_ACTIVITY_ID);
|
||||
String RETURN_FLAG_PREFIX_KEY = QmsBpmConstant.BPM_CALLBACK_RETURN_FLAG_PREFIX_KEY;
|
||||
String returnFlagKey = RETURN_FLAG_PREFIX_KEY + "Activity_001";
|
||||
|
||||
//判断是否最后一个节点
|
||||
String lastActivityFlag = "0";
|
||||
@@ -453,7 +461,7 @@ public class ReportDocumentMainServiceImpl implements ReportDocumentMainService,
|
||||
}
|
||||
}
|
||||
//"RETURN_FLAG_Activity_001": true 标识驳回到发起环节
|
||||
if(variables.containsKey(returnFlagKey) && variables.getString(returnFlagKey).equals("true")){
|
||||
if(("1").equals(returnFlag)){
|
||||
//驳回。流程需要配置退回到发起节点
|
||||
entity.setFlowStatus(QmsCommonConstant.REJECTED);
|
||||
entity.setDocumentSignature("");
|
||||
@@ -490,8 +498,6 @@ public class ReportDocumentMainServiceImpl implements ReportDocumentMainService,
|
||||
return CommonResult.success(ret);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void assembleSignature(String currentActivityId, ReportDocumentMainDO entity){
|
||||
if(ObjectUtils.isEmpty(currentActivityId) || "null".equals(currentActivityId))
|
||||
return;
|
||||
@@ -517,7 +523,4 @@ public class ReportDocumentMainServiceImpl implements ReportDocumentMainService,
|
||||
signObj.put(currentActivityId, obj);
|
||||
entity.setDocumentSignature(signObj.toJSONString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.zt.plat.module.qms.common.data.controller.admin;
|
||||
|
||||
import com.zt.plat.module.qms.common.data.controller.vo.DataKeyCheckPageReqVO;
|
||||
import com.zt.plat.module.qms.common.data.controller.vo.DataKeyCheckRespVO;
|
||||
import com.zt.plat.module.qms.common.data.controller.vo.DataKeyCheckSaveReqVO;
|
||||
import com.zt.plat.module.qms.common.data.dal.dataobject.DataKeyCheckDO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.zt.plat.framework.business.interceptor.BusinessControllerMarker;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import jakarta.validation.*;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import com.zt.plat.module.qms.common.data.service.DataKeyCheckService;
|
||||
|
||||
@Tag(name = "管理后台 - 数据重复校验")
|
||||
@RestController
|
||||
@RequestMapping("/qms/data-key-check")
|
||||
@Validated
|
||||
public class DataKeyCheckController implements BusinessControllerMarker {
|
||||
|
||||
|
||||
@Resource
|
||||
private DataKeyCheckService dataKeyCheckService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建数据重复校验")
|
||||
@PreAuthorize("@ss.hasPermission('qms:data-key-check:create')")
|
||||
public CommonResult<DataKeyCheckRespVO> createDataKeyCheck(@Valid @RequestBody DataKeyCheckSaveReqVO createReqVO) {
|
||||
return success(dataKeyCheckService.createDataKeyCheck(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新数据重复校验")
|
||||
@PreAuthorize("@ss.hasPermission('qms:data-key-check:update')")
|
||||
public CommonResult<Boolean> updateDataKeyCheck(@Valid @RequestBody DataKeyCheckSaveReqVO updateReqVO) {
|
||||
dataKeyCheckService.updateDataKeyCheck(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除数据重复校验")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('qms:data-key-check:delete')")
|
||||
public CommonResult<Boolean> deleteDataKeyCheck(@RequestParam("id") String id) {
|
||||
dataKeyCheckService.deleteDataKeyCheck(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得数据重复校验")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('qms:data-key-check:query')")
|
||||
public CommonResult<DataKeyCheckRespVO> getDataKeyCheck(@RequestParam("id") String id) {
|
||||
DataKeyCheckDO dataKeyCheck = dataKeyCheckService.getDataKeyCheck(id);
|
||||
return success(BeanUtils.toBean(dataKeyCheck, DataKeyCheckRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得数据重复校验分页")
|
||||
@PreAuthorize("@ss.hasPermission('qms:data-key-check:query')")
|
||||
public CommonResult<PageResult<DataKeyCheckRespVO>> getDataKeyCheckPage(@Valid DataKeyCheckPageReqVO pageReqVO) {
|
||||
PageResult<DataKeyCheckDO> pageResult = dataKeyCheckService.getDataKeyCheckPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, DataKeyCheckRespVO.class));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.zt.plat.module.qms.common.data.controller.vo;
|
||||
|
||||
import lombok.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.zt.plat.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 数据重复校验分页 Request VO")
|
||||
@Data
|
||||
public class DataKeyCheckPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "所属部门")
|
||||
private String systemDepartmentCode;
|
||||
|
||||
@Schema(description = "模块编码")
|
||||
private String moduleCode;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.zt.plat.module.qms.common.data.controller.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 数据重复校验 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class DataKeyCheckRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "4480")
|
||||
@ExcelProperty("主键")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "所属部门")
|
||||
@ExcelProperty("所属部门")
|
||||
private String systemDepartmentCode;
|
||||
|
||||
@Schema(description = "模块编码")
|
||||
@ExcelProperty("模块编码")
|
||||
private String moduleCode;
|
||||
|
||||
@Schema(description = "备注")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.zt.plat.module.qms.common.data.controller.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
@Schema(description = "管理后台 - 数据重复校验新增/修改 Request VO")
|
||||
@Data
|
||||
public class DataKeyCheckSaveReqVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "4480")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "所属部门")
|
||||
private String systemDepartmentCode;
|
||||
|
||||
@Schema(description = "模块编码")
|
||||
private String moduleCode;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.zt.plat.module.qms.common.data.dal.dataobject;
|
||||
|
||||
import lombok.*;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO;
|
||||
/**
|
||||
* 数据重复校验 DO
|
||||
*
|
||||
* @author 后台管理-1
|
||||
*/
|
||||
@TableName("t_dat_ky_chk")
|
||||
@KeySequence("t_dat_ky_chk_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
/**
|
||||
* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO
|
||||
*/
|
||||
public class DataKeyCheckDO extends BusinessBaseDO {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.INPUT)
|
||||
private String id;
|
||||
/**
|
||||
* 所属部门
|
||||
*/
|
||||
@TableField("SYS_DEPT_CD")
|
||||
private String systemDepartmentCode;
|
||||
/**
|
||||
* 模块编码
|
||||
*/
|
||||
@TableField("MDUL_CD")
|
||||
private String moduleCode;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@TableField("RMK")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.zt.plat.module.qms.common.data.dal.mapper;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.zt.plat.module.qms.common.data.controller.vo.DataKeyCheckPageReqVO;
|
||||
import com.zt.plat.module.qms.common.data.dal.dataobject.DataKeyCheckDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 数据重复校验 Mapper
|
||||
*
|
||||
* @author 后台管理-1
|
||||
*/
|
||||
@Mapper
|
||||
public interface DataKeyCheckMapper extends BaseMapperX<DataKeyCheckDO> {
|
||||
|
||||
default PageResult<DataKeyCheckDO> selectPage(DataKeyCheckPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<DataKeyCheckDO>()
|
||||
.eqIfPresent(DataKeyCheckDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
|
||||
.eqIfPresent(DataKeyCheckDO::getModuleCode, reqVO.getModuleCode())
|
||||
.eqIfPresent(DataKeyCheckDO::getRemark, reqVO.getRemark())
|
||||
.betweenIfPresent(DataKeyCheckDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(DataKeyCheckDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.zt.plat.module.qms.common.data.service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.zt.plat.module.qms.common.data.controller.vo.DataKeyCheckPageReqVO;
|
||||
import com.zt.plat.module.qms.common.data.controller.vo.DataKeyCheckRespVO;
|
||||
import com.zt.plat.module.qms.common.data.controller.vo.DataKeyCheckSaveReqVO;
|
||||
import com.zt.plat.module.qms.common.data.dal.dataobject.DataKeyCheckDO;
|
||||
import jakarta.validation.*;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 数据重复校验 Service 接口
|
||||
*
|
||||
* @author 后台管理-1
|
||||
*/
|
||||
public interface DataKeyCheckService {
|
||||
|
||||
void create(String id, String moduleCode);
|
||||
|
||||
/**
|
||||
* 创建数据重复校验
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
DataKeyCheckRespVO createDataKeyCheck(@Valid DataKeyCheckSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新数据重复校验
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateDataKeyCheck(@Valid DataKeyCheckSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除数据重复校验
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteDataKeyCheck(String id);
|
||||
|
||||
/**
|
||||
* 批量删除数据重复校验
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deleteDataKeyCheckListByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 获得数据重复校验
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 数据重复校验
|
||||
*/
|
||||
DataKeyCheckDO getDataKeyCheck(String id);
|
||||
|
||||
/**
|
||||
* 获得数据重复校验分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 数据重复校验分页
|
||||
*/
|
||||
PageResult<DataKeyCheckDO> getDataKeyCheckPage(DataKeyCheckPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.zt.plat.module.qms.common.data.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.zt.plat.module.qms.common.data.controller.vo.DataKeyCheckPageReqVO;
|
||||
import com.zt.plat.module.qms.common.data.controller.vo.DataKeyCheckRespVO;
|
||||
import com.zt.plat.module.qms.common.data.controller.vo.DataKeyCheckSaveReqVO;
|
||||
import com.zt.plat.module.qms.common.data.dal.dataobject.DataKeyCheckDO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||
|
||||
import com.zt.plat.module.qms.common.data.dal.mapper.DataKeyCheckMapper;
|
||||
|
||||
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.zt.plat.framework.common.util.collection.CollectionUtils.convertList;
|
||||
|
||||
/**
|
||||
* 数据重复校验 Service 实现类
|
||||
*
|
||||
* @author 后台管理-1
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class DataKeyCheckServiceImpl implements DataKeyCheckService {
|
||||
|
||||
@Resource
|
||||
private DataKeyCheckMapper dataKeyCheckMapper;
|
||||
|
||||
@Override
|
||||
public void create(String id, String moduleCode) {
|
||||
DataKeyCheckDO dataKeyCheck = new DataKeyCheckDO();
|
||||
dataKeyCheck.setId(id);
|
||||
dataKeyCheck.setModuleCode(moduleCode);
|
||||
dataKeyCheckMapper.insert(dataKeyCheck);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataKeyCheckRespVO createDataKeyCheck(DataKeyCheckSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
DataKeyCheckDO dataKeyCheck = BeanUtils.toBean(createReqVO, DataKeyCheckDO.class);
|
||||
dataKeyCheckMapper.insert(dataKeyCheck);
|
||||
// 返回
|
||||
return BeanUtils.toBean(dataKeyCheck, DataKeyCheckRespVO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDataKeyCheck(DataKeyCheckSaveReqVO updateReqVO) {
|
||||
|
||||
// 更新
|
||||
DataKeyCheckDO updateObj = BeanUtils.toBean(updateReqVO, DataKeyCheckDO.class);
|
||||
dataKeyCheckMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDataKeyCheck(String id) {
|
||||
|
||||
// 删除
|
||||
dataKeyCheckMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDataKeyCheckListByIds(List<String> ids) {
|
||||
|
||||
// 删除
|
||||
dataKeyCheckMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataKeyCheckDO getDataKeyCheck(String id) {
|
||||
return dataKeyCheckMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<DataKeyCheckDO> getDataKeyCheckPage(DataKeyCheckPageReqVO pageReqVO) {
|
||||
return dataKeyCheckMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -40,7 +40,9 @@ public final class CryptoSignatureUtils {
|
||||
random.setSeed(password.getBytes(StandardCharsets.UTF_8));
|
||||
kg.init(128, random);
|
||||
SecretKey secretKey = kg.generateKey();
|
||||
return new SecretKeySpec(secretKey.getEncoded(), "AES");
|
||||
SecretKeySpec secretKeySpec = new SecretKeySpec(secretKey.getEncoded(), "AES");
|
||||
String keyStr = new String(secretKeySpec.getEncoded(), StandardCharsets.UTF_8);
|
||||
return secretKeySpec;
|
||||
} catch (NoSuchAlgorithmException ex) {
|
||||
throw new IllegalStateException("Failed to generate AES secret key", ex);
|
||||
}
|
||||
@@ -99,6 +101,7 @@ public final class CryptoSignatureUtils {
|
||||
}
|
||||
} else if (ENCRYPT_TYPE_DES.equalsIgnoreCase(type)) {
|
||||
byte[] keyBytes = key.getBytes(StandardCharsets.UTF_8);
|
||||
String keyStr = new String(keyBytes, StandardCharsets.UTF_8);
|
||||
byte[] desKey = new byte[8];
|
||||
System.arraycopy(keyBytes, 0, desKey, 0, Math.min(keyBytes.length, desKey.length));
|
||||
byte[] decoded = decodeBase64Ciphertext(ciphertext);
|
||||
|
||||
@@ -24,6 +24,7 @@ public class DatabusApiInvocationExample {
|
||||
private static final String APP_SECRET = "tjDKCUGNEDR9yNgbxIsvtXsRMuQK+tj1HNEMpgjJOPU=";
|
||||
private static final String ENCRYPTION_TYPE = CryptoSignatureUtils.ENCRYPT_TYPE_AES;
|
||||
private static final String TARGET_API = "http://172.16.46.62:30081/admin-api/databus/api/portal";
|
||||
// private static final String TARGET_API = "https://jygk.chncopper.com:30078/admin-api/databus/api/portal";
|
||||
private static final HttpClient HTTP_CLIENT = HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(5)).build();
|
||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||
private static final PrintStream OUT = buildConsolePrintStream();
|
||||
@@ -37,11 +38,16 @@ public class DatabusApiInvocationExample {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
OUT.println("=== GET 请求示例 ===");
|
||||
// OUT.println("=== GET 请求示例 ===");
|
||||
// executeGetExample();
|
||||
// OUT.println();
|
||||
// OUT.println("=== POST 请求示例 ===");
|
||||
executePostExample();
|
||||
// executePostExample();
|
||||
String encodeStr = "SFqGUDidGgWMWvcU6Qy8SNvyhESvZV9uViIz6lisYB9A1qvKrhotX0JXLrcgcL057d+ZVMDJxngw+UvQ5F6UnYXeDGtyAr/ZXKqSXApygdPYZQPwbj1hzUAZhTw/oHUc7ucU59jT5N1TYW/4jJPzmnMU28D0gXrRVDUmX/SNfPlpN9YvPIobzMeoXZlNkFdURZzIX9aQbhgRNXZHruGQGcqDLePkSh01oq9D+i65DNWQGAYDTGfdVTXuGJw6UY4fQJsn7/5HxZoVWKXgKwAmWo/+KwUG5AVD1BcfK7avYLXAcmnJJftFwZvB08eoe7/ySp4ytv1iSHYxUGZ8YNbUS/wIA3pVhfJHWz1Ko0t3nBbxBtLAOmj2jNzjxU/TI/g1n5dtX8B2OoiMZUHHJaHNEMqmULfLILZE7oMGNbRAh1T0gZcU+rkFfm/995ZnTUmaCCKrKZAs5p0FPqhXRf/ZchN0G6opd9hBE+hJY7v92uDqK5RkgomRIAFcf73d7pnIXTgKHMtLLn7r298+A1kKgyH28wGS6pqGfvdZ1yHqbb5zFNvA9IF60VQ1Jl/0jXz5CJBXy+d+QqX/s06uXDzZ2UWcyF/WkG4YETV2R67hkBnKgy3j5EodNaKvQ/ouuQzVkBgGA0xn3VU17hicOlGOH0CbJ+/+R8WaFVil4CsAJlqjj0mF1g5XV34ddfgOcGFYdcKvMDA+YRf1zK8oGRwGekqeMrb9Ykh2MVBmfGDW1EueSNggsyxhSQWEnThMCB2stDi4frs5kanGFhC7er/L9fTD1leamk8i04Wy5eC0PALKplC3yyC2RO6DBjW0QIdU9IGXFPq5BX5v/feWZ01JmggiqymQLOadBT6oV0X/2XIimcN9BgTUX2en4UohmG1NAjFVyWRqx4KmhX10IRwB47CxOMt1NRhwz7UCTqb7fn60/OcolT4ljcD7SuLCj5zwNCt3cQ4eX+mpPecoUtsPdA==";
|
||||
|
||||
String decrypt = tryDecrypt(encodeStr);
|
||||
String aa = normalizePotentialMojibake(decrypt);
|
||||
OUT.println(decrypt);
|
||||
}
|
||||
|
||||
private static void executeGetExample() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user