审核模块相关接口修改
This commit is contained in:
@@ -100,24 +100,51 @@ public class MinioUtil {
|
|||||||
public String uploadBase64(String imgStr, String bucketName, String folder) {
|
public String uploadBase64(String imgStr, String bucketName, String folder) {
|
||||||
try {
|
try {
|
||||||
String objectName = folder + UUID.randomUUID().toString().replace("-", "") + ".png";
|
String objectName = folder + UUID.randomUUID().toString().replace("-", "") + ".png";
|
||||||
String filePath = RuoYiConfig.getProfile()+"/"+bucketName+"/"+objectName;
|
imgStr = imgStr.replace("data:image/png;base64,", "").replace("data:image/jpeg;base64,", "");
|
||||||
imgStr = imgStr.replace("data:image/png;base64,", "");
|
|
||||||
// 解码Base64字符串
|
|
||||||
byte[] imageBytes = Base64.getDecoder().decode(imgStr);
|
byte[] imageBytes = Base64.getDecoder().decode(imgStr);
|
||||||
|
|
||||||
// 将字节转换为BufferedImage
|
// 确保 bucket 存在
|
||||||
BufferedImage img = javax.imageio.ImageIO.read(new java.io.ByteArrayInputStream(imageBytes));
|
boolean exists = minioClient.bucketExists(BucketExistsArgs.builder().bucket(bucketName).build());
|
||||||
|
if (!exists) {
|
||||||
// 写入图片到文件系统
|
minioClient.makeBucket(MakeBucketArgs.builder().bucket(bucketName).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());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 设置公共访问策略(幂等)
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
|
||||||
|
return endpoint + "/" + bucketName + "/" + objectName;
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.err.println("Base64上传MinIO失败:" + e.getMessage());
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传文件到默认 bucket 根目录
|
* 上传文件到默认 bucket 根目录
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public class AuditSignatureController extends BaseController
|
|||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 查询审批记录列表
|
* 查询待审批记录列表
|
||||||
*/
|
*/
|
||||||
// @PreAuthorize("@ss.hasPermi('wisdom:signature:list')")
|
// @PreAuthorize("@ss.hasPermi('wisdom:signature:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
|
|||||||
@@ -183,4 +183,8 @@ public interface RkInfoMapper
|
|||||||
*/
|
*/
|
||||||
List<RkInfo> selectOneForEachBillNo(@Param("billNos") List<String> billNos);
|
List<RkInfo> selectOneForEachBillNo(@Param("billNos") List<String> billNos);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据入库单据编号查询入库单据
|
||||||
|
*/
|
||||||
|
List<RkInfo> selectRkInfoListByBillNo(String billNo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ public class AuditSignatureServiceImpl implements IAuditSignatureService
|
|||||||
audit.setRemark(audit.getRemark()); // 设置审核意见
|
audit.setRemark(audit.getRemark()); // 设置审核意见
|
||||||
audit.setUpdateBy(userId);
|
audit.setUpdateBy(userId);
|
||||||
audit.setUpdateTime(DateUtils.getNowDate());
|
audit.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
audit.setApproverSignUrl(audit.getApproverSignUrl());
|
||||||
|
|
||||||
auditSignatureMapper.updateAuditSignature(audit);
|
auditSignatureMapper.updateAuditSignature(audit);
|
||||||
|
|
||||||
@@ -147,17 +148,23 @@ public class AuditSignatureServiceImpl implements IAuditSignatureService
|
|||||||
// 审核通过:rk_info.status = 1(驳回)
|
// 审核通过:rk_info.status = 1(驳回)
|
||||||
rk.setStatus("1");
|
rk.setStatus("1");
|
||||||
rk.setIsChuku("0");
|
rk.setIsChuku("0");
|
||||||
// 根据 rk_id 查询 rk_info,拿到 gys_jh_id
|
// 获取该 bill_no 下所有 rk_info 记录
|
||||||
RkInfo rkInfo = rkInfoMapper.selectRkInfoById(audit.getRkId());
|
List<RkInfo> rkList = rkInfoMapper.selectRkInfoListByBillNo(audit.getBillNo());
|
||||||
if (rkInfo != null && rkInfo.getGysJhId() != null) {
|
// 提取所有非空的 gys_jh_id 并去重
|
||||||
gysJhMapper.updateStatusById(rkInfo.getGysJhId());
|
Set<Long> jhIdSet = rkList.stream()
|
||||||
} else {
|
.map(RkInfo::getGysJhId)
|
||||||
log.warn("审核通过,但未能根据 rkId={} 找到对应的 gysJhId,供应计划状态未更新", audit.getRkId());
|
.filter(Objects::nonNull)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
|
// 批量更新对应供应计划的状态
|
||||||
|
for (Long jhId : jhIdSet) {
|
||||||
|
gysJhMapper.updateStatusById(jhId);
|
||||||
}
|
}
|
||||||
} else if ("0".equals(audit.getAuditResult())) {
|
} else if ("0".equals(audit.getAuditResult())) {
|
||||||
// 审核驳回:rk_info.status = 2(已入库)
|
// 审核驳回:rk_info.status = 2(已入库)
|
||||||
rk.setStatus("2");
|
rk.setStatus("2");
|
||||||
}
|
}
|
||||||
|
|
||||||
rkInfoMapper.updateStatusByBillNo(rk);
|
rkInfoMapper.updateStatusByBillNo(rk);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -246,6 +246,7 @@ public class RkInfoServiceImpl implements IRkInfoService
|
|||||||
mainSign.setImageType("0"); // 签字图
|
mainSign.setImageType("0"); // 签字图
|
||||||
mainSign.setSignTime(now);
|
mainSign.setSignTime(now);
|
||||||
mainSign.setIsCurrent("1");
|
mainSign.setIsCurrent("1");
|
||||||
|
mainSign.setAuditResult("2");
|
||||||
mainSign.setIsDelete("0");
|
mainSign.setIsDelete("0");
|
||||||
mainSign.setCreateBy(userId);
|
mainSign.setCreateBy(userId);
|
||||||
mainSign.setCreateTime(now);
|
mainSign.setCreateTime(now);
|
||||||
@@ -255,11 +256,11 @@ public class RkInfoServiceImpl implements IRkInfoService
|
|||||||
if (!records.isEmpty()) {
|
if (!records.isEmpty()) {
|
||||||
auditSignatureMapper.batchInsert(records);
|
auditSignatureMapper.batchInsert(records);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ✅ 更新供应计划状态-》修改逻辑,审核通过后再修改供应计划状态
|
// ✅ 更新供应计划状态-》修改逻辑,审核通过后再修改供应计划状态
|
||||||
// if (dto.getGysJhId() != null) {
|
if (!needAudit && dto.getGysJhId() != null) {
|
||||||
// gysJhMapper.updateStatusById(dto.getGysJhId());
|
gysJhMapper.updateStatusById(dto.getGysJhId());
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -330,9 +331,9 @@ public class RkInfoServiceImpl implements IRkInfoService
|
|||||||
saveList.add(entity);
|
saveList.add(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (item.getGysJhId() != null) {
|
if (!needAudit && item.getGysJhId() != null) {
|
||||||
// gysJhMapper.updateStatusById(item.getGysJhId());
|
gysJhMapper.updateStatusById(item.getGysJhId());
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (saveList.isEmpty()) {
|
if (saveList.isEmpty()) {
|
||||||
|
|||||||
@@ -204,6 +204,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
UPDATE audit_signature
|
UPDATE audit_signature
|
||||||
<set>
|
<set>
|
||||||
<if test="auditResult != null">audit_result = #{auditResult},</if>
|
<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="approverId != null">approver_id = #{approverId},</if>
|
||||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="remark" column="remark" />
|
<result property="remark" column="remark" />
|
||||||
<result property="xj" column="xj" />
|
<result property="xj" column="xj" />
|
||||||
<result property="xmNo" column="xm_no" />
|
<result property="xmNo" column="xm_no" />
|
||||||
|
<result property="gysJhId" column="gys_jh_id"/>
|
||||||
<result property="xmMs" column="xm_ms" />
|
<result property="xmMs" column="xm_ms" />
|
||||||
<result property="xmNoCk" column="xm_no_ck"/>
|
<result property="xmNoCk" column="xm_no_ck"/>
|
||||||
<result property="xmMsCk" column="xm_ms_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
|
GROUP BY r.bill_no
|
||||||
</select>
|
</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 id="updateRkInfo" parameterType="RkInfo">
|
||||||
update rk_info
|
update rk_info
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
|||||||
Reference in New Issue
Block a user