审核模块相关接口修改

This commit is contained in:
2025-07-18 08:08:37 +08:00
parent 2b981b64a5
commit 6c7f945d29
7 changed files with 76 additions and 26 deletions

View File

@@ -97,26 +97,53 @@ public class MinioUtil {
return endpoint + "/" + bucketName + "/" + objectName;
}
public String uploadBase64(String imgStr,String bucketName,String folder){
public String uploadBase64(String imgStr, String bucketName, String folder) {
try {
String objectName = folder + UUID.randomUUID().toString().replace("-", "") + ".png";
String filePath = RuoYiConfig.getProfile()+"/"+bucketName+"/"+objectName;
imgStr = imgStr.replace("data:image/png;base64,", "");
// 解码Base64字符串
imgStr = imgStr.replace("data:image/png;base64,", "").replace("data:image/jpeg;base64,", "");
byte[] imageBytes = Base64.getDecoder().decode(imgStr);
// 将字节转换为BufferedImage
BufferedImage img = javax.imageio.ImageIO.read(new java.io.ByteArrayInputStream(imageBytes));
// 确保 bucket 存在
boolean exists = minioClient.bucketExists(BucketExistsArgs.builder().bucket(bucketName).build());
if (!exists) {
minioClient.makeBucket(MakeBucketArgs.builder().bucket(bucketName).build());
}
// 设置公共访问策略(幂等)
String policyJson = "{\n" +
" \"Version\":\"2012-10-17\",\n" +
" \"Statement\":[\n" +
" {\n" +
" \"Effect\":\"Allow\",\n" +
" \"Principal\":{\"AWS\":\"*\"},\n" +
" \"Action\":[\"s3:GetObject\"],\n" +
" \"Resource\":[\"arn:aws:s3:::" + bucketName + "/*\"]\n" +
" }\n" +
" ]\n" +
"}";
minioClient.setBucketPolicy(
SetBucketPolicyArgs.builder()
.bucket(bucketName)
.config(policyJson)
.build()
);
// 构造 InputStream 上传
try (InputStream inputStream = new java.io.ByteArrayInputStream(imageBytes)) {
minioClient.putObject(PutObjectArgs.builder()
.bucket(bucketName)
.object(objectName)
.stream(inputStream, imageBytes.length, -1)
.contentType("image/png")
.build());
}
// 写入图片到文件系统
File outputFile = new File(filePath);
ImageIO.write(img, "PNG", outputFile);
return endpoint + "/" + bucketName + "/" + objectName;
// System.out.println("图片已保存到: " + outputFile.getAbsolutePath());
} catch (Exception e) {
System.err.println("转换或保存图片时发生错误: " + e.getMessage());
System.err.println("Base64上传MinIO失败" + e.getMessage());
return "";
}
return "";
}
/**

View File

@@ -67,7 +67,7 @@ public class AuditSignatureController extends BaseController
}
/**
* 查询审批记录列表
* 查询审批记录列表
*/
// @PreAuthorize("@ss.hasPermi('wisdom:signature:list')")
@GetMapping("/list")

View File

@@ -183,4 +183,8 @@ public interface RkInfoMapper
*/
List<RkInfo> selectOneForEachBillNo(@Param("billNos") List<String> billNos);
/**
* 根据入库单据编号查询入库单据
*/
List<RkInfo> selectRkInfoListByBillNo(String billNo);
}

View File

@@ -136,6 +136,7 @@ public class AuditSignatureServiceImpl implements IAuditSignatureService
audit.setRemark(audit.getRemark()); // 设置审核意见
audit.setUpdateBy(userId);
audit.setUpdateTime(DateUtils.getNowDate());
audit.setApproverSignUrl(audit.getApproverSignUrl());
auditSignatureMapper.updateAuditSignature(audit);
@@ -147,17 +148,23 @@ public class AuditSignatureServiceImpl implements IAuditSignatureService
// 审核通过rk_info.status = 1驳回
rk.setStatus("1");
rk.setIsChuku("0");
// 根据 rk_id 查询 rk_info拿到 gys_jh_id
RkInfo rkInfo = rkInfoMapper.selectRkInfoById(audit.getRkId());
if (rkInfo != null && rkInfo.getGysJhId() != null) {
gysJhMapper.updateStatusById(rkInfo.getGysJhId());
} else {
log.warn("审核通过,但未能根据 rkId={} 找到对应的 gysJhId供应计划状态未更新", audit.getRkId());
// 获取该 bill_no 下所有 rk_info 记录
List<RkInfo> rkList = rkInfoMapper.selectRkInfoListByBillNo(audit.getBillNo());
// 提取所有非空的 gys_jh_id 并去重
Set<Long> jhIdSet = rkList.stream()
.map(RkInfo::getGysJhId)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
// 批量更新对应供应计划的状态
for (Long jhId : jhIdSet) {
gysJhMapper.updateStatusById(jhId);
}
} else if ("0".equals(audit.getAuditResult())) {
// 审核驳回rk_info.status = 2已入库
rk.setStatus("2");
}
rkInfoMapper.updateStatusByBillNo(rk);
}

View File

@@ -246,6 +246,7 @@ public class RkInfoServiceImpl implements IRkInfoService
mainSign.setImageType("0"); // 签字图
mainSign.setSignTime(now);
mainSign.setIsCurrent("1");
mainSign.setAuditResult("2");
mainSign.setIsDelete("0");
mainSign.setCreateBy(userId);
mainSign.setCreateTime(now);
@@ -255,11 +256,11 @@ public class RkInfoServiceImpl implements IRkInfoService
if (!records.isEmpty()) {
auditSignatureMapper.batchInsert(records);
}
}
// ✅ 更新供应计划状态-》修改逻辑,审核通过后再修改供应计划状态
// if (dto.getGysJhId() != null) {
// gysJhMapper.updateStatusById(dto.getGysJhId());
// }
// ✅ 更新供应计划状态-》修改逻辑,审核通过后再修改供应计划状态
if (!needAudit && dto.getGysJhId() != null) {
gysJhMapper.updateStatusById(dto.getGysJhId());
}
}
@@ -330,9 +331,9 @@ public class RkInfoServiceImpl implements IRkInfoService
saveList.add(entity);
}
// if (item.getGysJhId() != null) {
// gysJhMapper.updateStatusById(item.getGysJhId());
// }
if (!needAudit && item.getGysJhId() != null) {
gysJhMapper.updateStatusById(item.getGysJhId());
}
}
if (saveList.isEmpty()) {

View File

@@ -204,6 +204,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
UPDATE audit_signature
<set>
<if test="auditResult != null">audit_result = #{auditResult},</if>
<if test="approverSignUrl != null">approver_sign_url = #{approverSignUrl},</if>
<if test="approverId != null">approver_id = #{approverId},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>

View File

@@ -21,6 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="remark" column="remark" />
<result property="xj" column="xj" />
<result property="xmNo" column="xm_no" />
<result property="gysJhId" column="gys_jh_id"/>
<result property="xmMs" column="xm_ms" />
<result property="xmNoCk" column="xm_no_ck"/>
<result property="xmMsCk" column="xm_ms_ck"/>
@@ -368,6 +369,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP BY r.bill_no
</select>
<select id="selectRkInfoListByBillNo" resultMap="RkInfoResult"
parameterType="java.lang.String">
SELECT
*
FROM rk_info
WHERE is_delete = '0'
AND bill_no = #{billNo}
</select>
<update id="updateRkInfo" parameterType="RkInfo">
update rk_info
<trim prefix="SET" suffixOverrides=",">