审核模块相关接口修改

This commit is contained in:
2025-07-17 08:37:27 +08:00
parent 16c1b403ed
commit 7924256b29
12 changed files with 110 additions and 145 deletions

View File

@@ -100,16 +100,6 @@ public class AuditSignatureController extends BaseController
return success(auditSignatureService.selectAuditSignatureById(id));
}
/**
* 新增审批记录
*/
@PreAuthorize("@ss.hasPermi('wisdom:signature:add')")
@Log(title = "审批记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody AuditSignature auditSignature)
{
return toAjax(auditSignatureService.insertAuditSignature(auditSignature));
}
/**
* 审批
@@ -133,14 +123,14 @@ public class AuditSignatureController extends BaseController
}
/**
* 待审核列表
* 当前用户待审核列表条数
* @return
*/
@GetMapping("/pending")
public AjaxResult getPending() {
String userId = SecurityUtils.getUserId().toString();
List<AuditSignature> list = auditSignatureService.selectPendingByUser(userId);
return AjaxResult.success(list);
@GetMapping("/count")
public AjaxResult getPending(AuditSignature auditSignat) {
String approverId = auditSignat.getApproverId();
int total = auditSignatureService.countPendingByUser(approverId);
return AjaxResult.success(total);
}
/**

View File

@@ -26,6 +26,10 @@ public class RkInfo extends BaseEntity
/** 主键ID */
private Long id;
/** 供应计划ID对应供应计划表主键 */
@Excel(name = "供应计划ID")
private Long gysJhId;
/** 库龄 */
private Long stockAge;
@@ -68,6 +72,9 @@ public class RkInfo extends BaseEntity
@Excel(name = "理货员")
private String lihuoY;
/** 理货员名称(联查显示用,导出专用) */
private String lihuoYName;
/** 是否已出库0未出库1已出库 */
@Excel(name = "是否已出库", readConverterExp = "0=已入库1已出库")
private String isChuku;
@@ -186,7 +193,7 @@ public class RkInfo extends BaseEntity
@Excel(name = "出库备注")
private String ckRemark;
@TableField(exist = false)
@Excel(name = "出库备注")
private String status;
/** 是否移库过0否 1是 */
@@ -223,6 +230,14 @@ public class RkInfo extends BaseEntity
public void setKeyword(String keyword) { this.keyword = keyword; }
public Long getId() { return id; }
public void setId(Long id) { this.id = id; }
public Long getGysJhId() {
return gysJhId;
}
public void setGysJhId(Long gysJhId) {
this.gysJhId = gysJhId;
}
public Long getStockAge() { return stockAge; }
public void setStockAge(Long stockAge) { this.stockAge = stockAge; }
public String getRkType() { return rkType; }
@@ -255,6 +270,9 @@ public class RkInfo extends BaseEntity
public String getLihuoY() { return lihuoY; }
public void setLihuoY(String lihuoY) { this.lihuoY = lihuoY; }
public String getLihuoYName() { return lihuoYName; }
public void setLihuoYName(String lihuoYName) { this.lihuoYName = lihuoYName; }
public String getIsChuku() { return isChuku; }
public void setIsChuku(String isChuku) { this.isChuku = isChuku; }
public String getBillNo() { return billNo; }
@@ -394,6 +412,7 @@ public class RkInfo extends BaseEntity
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("gysJhId", getGysJhId())
.append("rkType", getRkType())
.append("wlType", getWlType())
.append("cangku", getCangku())

View File

@@ -6,6 +6,9 @@ import java.util.List;
@Data
public class RkInfoBatchDTO {
/** 供应商计划ID */
private Long gysJhId;
/** 审核人用户ID */
private String approverId;

View File

@@ -26,4 +26,8 @@ public class RkInfoScanDTO {
/** 备注 */
private String remark;
/** 供应计划主键ID */
private Long gysJhId;
}

View File

@@ -72,4 +72,7 @@ public class AuditSignatureReviewVO {
/** 理货员名称(原本就是中文) */
private String lihuoY;
/** 理货员名称(联查显示用,导出专用) */
private String lihuoYName;
}

View File

@@ -39,4 +39,7 @@ public class AuditSignatureVo extends AuditSignature {
/** 入库备注rk_info 表里的) */
private String rkRemark;
/** 入库记录ID对应rk_info.id */
private Long rkId;
}

View File

@@ -29,13 +29,6 @@ public interface AuditSignatureMapper
*/
public List<AuditSignature> selectAuditSignatureList(AuditSignature auditSignature);
/**
* 新增审批记录
*
* @param auditSignature 审批记录
* @return 结果
*/
public int insertAuditSignature(AuditSignature auditSignature);
/**
* 修改审批记录
@@ -66,7 +59,7 @@ public interface AuditSignatureMapper
* @param userId
* @return
*/
List<AuditSignature> selectPendingByUser(String userId);
int countPendingByUser(String approverId);
/**
* 是否存在提交记录(第一次申请还是驳回后再次申请)

View File

@@ -28,13 +28,6 @@ public interface IAuditSignatureService
*/
public List<AuditSignature> selectAuditSignatureList(AuditSignature auditSignature);
/**
* 新增审批记录
*
* @param auditSignature 审批记录
* @return 结果
*/
public int insertAuditSignature(AuditSignature auditSignature);
/**
* 修改审批记录
@@ -62,10 +55,10 @@ public interface IAuditSignatureService
/**
* 查询待审核的申请
* @param userId
* @param approverId
* @return
*/
List<AuditSignature> selectPendingByUser(String userId);
int countPendingByUser(String approverId);
/**
* 审批申请

View File

@@ -11,6 +11,7 @@ import com.zg.common.utils.StringUtils;
import com.zg.project.wisdom.domain.RkInfo;
import com.zg.project.wisdom.domain.vo.AuditSignatureReviewVO;
import com.zg.project.wisdom.domain.vo.AuditSignatureVo;
import com.zg.project.wisdom.mapper.GysJhMapper;
import com.zg.project.wisdom.mapper.RkInfoMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.BeanUtils;
@@ -21,6 +22,8 @@ import com.zg.project.wisdom.domain.AuditSignature;
import com.zg.project.wisdom.service.IAuditSignatureService;
import org.springframework.transaction.annotation.Transactional;
import static com.zg.framework.datasource.DynamicDataSourceContextHolder.log;
/**
* 审批记录Service业务层处理
*
@@ -36,6 +39,9 @@ public class AuditSignatureServiceImpl implements IAuditSignatureService
@Autowired
private RkInfoMapper rkInfoMapper;
@Autowired
private GysJhMapper gysJhMapper;
/**
* 查询审批记录
*
@@ -60,18 +66,6 @@ public class AuditSignatureServiceImpl implements IAuditSignatureService
return auditSignatureMapper.selectAuditSignatureList(auditSignature);
}
/**
* 新增审批记录
*
* @param auditSignature 审批记录
* @return 结果
*/
@Override
public int insertAuditSignature(AuditSignature auditSignature)
{
auditSignature.setCreateTime(DateUtils.getNowDate());
return auditSignatureMapper.insertAuditSignature(auditSignature);
}
/**
* 修改审批记录
@@ -112,12 +106,12 @@ public class AuditSignatureServiceImpl implements IAuditSignatureService
/**
* 查询待审核的申请
* @param userId
* @param
* @return
*/
@Override
public List<AuditSignature> selectPendingByUser(String userId) {
return auditSignatureMapper.selectPendingByUser(userId);
public int countPendingByUser(String approverId) {
return auditSignatureMapper.countPendingByUser(approverId);
}
@Override
@@ -132,12 +126,12 @@ public class AuditSignatureServiceImpl implements IAuditSignatureService
}
// 2. 校验是否已审核
if (db.getAuditResult() != null) {
if ("0".equals(db.getAuditResult()) || "1".equals(db.getAuditResult())) {
throw new ServiceException("该记录已审核,不能重复操作");
}
// 3. 更新审核状态
audit.setAuditResult(audit.getAuditResult()); // 必须为 "0"(通过)或 "1"(驳回)
audit.setAuditResult(audit.getAuditResult()); // 必须为 "1"(通过)或 "0"(驳回)
audit.setApproverId(userId); // 设置审核人
audit.setRemark(audit.getRemark()); // 设置审核意见
audit.setUpdateBy(userId);
@@ -149,14 +143,23 @@ public class AuditSignatureServiceImpl implements IAuditSignatureService
rk.setBillNo(audit.getBillNo());
rk.setUpdateBy(userId);
rk.setUpdateTime(DateUtils.getNowDate());
if ("0".equals(audit.getAuditResult())) {
// 审核通过rk_info.status = 1已入库
if ("1".equals(audit.getAuditResult())) {
// 审核通过rk_info.status = 1驳回
rk.setStatus("1");
} else if ("1".equals(audit.getAuditResult())) {
// 审核驳回rk_info.status = 2驳回
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());
}
} else if ("0".equals(audit.getAuditResult())) {
// 审核驳回rk_info.status = 2已入库
rk.setStatus("2");
}
rkInfoMapper.updateStatusByBillNo(rk);
}
@Override
@@ -191,6 +194,7 @@ public class AuditSignatureServiceImpl implements IAuditSignatureService
vo.setRkTypeName(rk.getRkTypeName());
vo.setCangkuName(rk.getCangkuName());
vo.setWlTypeName(rk.getWlTypeName());
vo.setLihuoYName(rk.getLihuoYName());
vo.setLihuoY(rk.getLihuoY());
}

View File

@@ -106,10 +106,10 @@ public class RkInfoServiceImpl implements IRkInfoService
}
}
// 审核开启,过滤掉未通过的(只有 auditResult = '0' 保留)
// 审核开启,过滤掉未通过的(只有 auditResult = '1' 保留)
if (needAudit) {
list = list.stream()
.filter(info -> "0".equals(info.getAuditResult()))
.filter(info -> "1".equals(info.getAuditResult()))
.collect(Collectors.toList());
}
@@ -176,9 +176,11 @@ public class RkInfoServiceImpl implements IRkInfoService
RkInfo rk = new RkInfo();
BeanUtils.copyProperties(item, rk);
rk.setBillNo(billNo);
rk.setGysJhId(dto.getGysJhId());
rk.setRkType(dto.getRkType());
rk.setWlType(dto.getWlType());
rk.setLihuoY(dto.getLihuoY());
rk.setGysJhId(dto.getGysJhId());
rk.setRkTime(now);
rk.setCangku(dto.getCangku());
rk.setCreateBy(userId);
@@ -254,10 +256,10 @@ public class RkInfoServiceImpl implements IRkInfoService
auditSignatureMapper.batchInsert(records);
}
// ✅ 更新供应计划状态
if (dto.getGysJhId() != null) {
gysJhMapper.updateStatusById(dto.getGysJhId());
}
// ✅ 更新供应计划状态-》修改逻辑,审核通过后再修改供应计划状态
// if (dto.getGysJhId() != null) {
// gysJhMapper.updateStatusById(dto.getGysJhId());
// }
}
}
@@ -299,6 +301,7 @@ public class RkInfoServiceImpl implements IRkInfoService
entity.setJhQty(item.getJhQty());
entity.setHtQty(item.getHtQty());
entity.setJhAmt(item.getJhAmt());
entity.setGysJhId(item.getGysJhId());
entity.setHtDj(item.getHtDj());
entity.setDw(item.getDw());
entity.setWlNo(item.getWlNo());
@@ -318,7 +321,7 @@ public class RkInfoServiceImpl implements IRkInfoService
if (needAudit) {
entity.setStatus("0"); // 待审核
entity.setIsChuku("3"); // 待入库(审核中)
entity.setIsChuku("2"); // 待入库(审核中)
} else {
entity.setStatus("1"); // 审核通过
entity.setIsChuku("0"); // 已入库
@@ -327,9 +330,9 @@ public class RkInfoServiceImpl implements IRkInfoService
saveList.add(entity);
}
if (item.getGysJhId() != null) {
gysJhMapper.updateStatusById(item.getGysJhId());
}
// if (item.getGysJhId() != null) {
// gysJhMapper.updateStatusById(item.getGysJhId());
// }
}
if (saveList.isEmpty()) {
@@ -359,6 +362,7 @@ public class RkInfoServiceImpl implements IRkInfoService
mainSign.setImageType("0"); // 签字图
mainSign.setSignTime(now);
mainSign.setApproverId(dto.getApproverId());
mainSign.setAuditResult("2");
mainSign.setIsCurrent("1");
mainSign.setIsDelete("0");
mainSign.setCreateBy(userId);
@@ -386,6 +390,7 @@ public class RkInfoServiceImpl implements IRkInfoService
photo.setSignTime(now);
photo.setApproverId(dto.getApproverId());
photo.setIsCurrent("1");
photo.setAuditResult("2");
photo.setIsDelete("0");
photo.setCreateBy(userId);
photo.setCreateTime(now);

View File

@@ -45,7 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectAuditSignatureVo">
select id, bill_no, bill_type, signer_id, signer_role, sign_url, sign_time, pcode, tray_code, approver_id, approver_sign_url, audit_result, image_type, is_current, remark, create_by, create_time, update_by, update_time, is_delete from audit_signature
select id, bill_no,rk_id, bill_type, signer_id, signer_role, sign_url, sign_time, pcode, tray_code, approver_id, approver_sign_url, audit_result, image_type, is_current, remark, create_by, create_time, update_by, update_time, is_delete from audit_signature
</sql>
<select id="selectAuditSignatureList" parameterType="AuditSignature" resultMap="AuditSignatureResult">
@@ -73,16 +73,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</select>
<select id="selectPendingByUser" resultMap="AuditSignatureResult">
SELECT
id, bill_no, bill_type, signer_id, signer_role, sign_url, sign_time,
pcode, tray_code, approver_id, approver_sign_url, audit_result,
image_type, is_current, remark, create_by, create_time, update_by,
update_time, is_delete
<select id="countPendingByUser" resultType="int">
SELECT COUNT(1)
FROM audit_signature
WHERE is_delete = '0'
AND approver_id = #{userId}
AND audit_result IS NULL
AND approver_id = #{approverId}
AND audit_result = '2'
AND signer_role = '0'
</select>
<select id="existsCurrentSigner" resultType="boolean">
@@ -165,52 +162,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<insert id="insertAuditSignature" parameterType="AuditSignature" useGeneratedKeys="true" keyProperty="id">
insert into audit_signature
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="billNo != null and billNo != ''">bill_no,</if>
<if test="billType != null and billType != ''">bill_type,</if>
<if test="signerId != null">signer_id,</if>
<if test="signerRole != null">signer_role,</if>
<if test="signUrl != null">sign_url,</if>
<if test="signTime != null">sign_time,</if>
<if test="pcode != null">pcode,</if>
<if test="trayCode != null">tray_code,</if>
<if test="approverId != null">approver_id,</if>
<if test="approverSignUrl != null">approver_sign_url,</if>
<if test="auditResult != null">audit_result,</if>
<if test="imageType != null">image_type,</if>
<if test="isCurrent != null">is_current,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="isDelete != null">is_delete,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="billNo != null and billNo != ''">#{billNo},</if>
<if test="billType != null and billType != ''">#{billType},</if>
<if test="signerId != null">#{signerId},</if>
<if test="signerRole != null">#{signerRole},</if>
<if test="signUrl != null">#{signUrl},</if>
<if test="signTime != null">#{signTime},</if>
<if test="pcode != null">#{pcode},</if>
<if test="trayCode != null">#{trayCode},</if>
<if test="approverId != null">#{approverId},</if>
<if test="approverSignUrl != null">#{approverSignUrl},</if>
<if test="auditResult != null">#{auditResult},</if>
<if test="imageType != null">#{imageType},</if>
<if test="isCurrent != null">#{isCurrent},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="isDelete != null">#{isDelete},</if>
</trim>
</insert>
<insert id="batchInsert" parameterType="java.util.List">
INSERT INTO audit_signature (
bill_no,
@@ -221,6 +172,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sign_time,
image_type,
approver_id,
audit_result,
is_current,
is_delete,
create_by,
@@ -238,6 +190,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item.signTime},
#{item.imageType},
#{item.approverId},
#{item.auditResult},
#{item.isCurrent},
#{item.isDelete},
#{item.createBy},
@@ -248,29 +201,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert>
<update id="updateAuditSignature" parameterType="AuditSignature">
update audit_signature
<trim prefix="SET" suffixOverrides=",">
<if test="billNo != null and billNo != ''">bill_no = #{billNo},</if>
<if test="billType != null and billType != ''">bill_type = #{billType},</if>
<if test="signerId != null">signer_id = #{signerId},</if>
<if test="signerRole != null">signer_role = #{signerRole},</if>
<if test="signUrl != null">sign_url = #{signUrl},</if>
<if test="signTime != null">sign_time = #{signTime},</if>
<if test="pcode != null">pcode = #{pcode},</if>
<if test="trayCode != null">tray_code = #{trayCode},</if>
<if test="approverId != null">approver_id = #{approverId},</if>
<if test="approverSignUrl != null">approver_sign_url = #{approverSignUrl},</if>
UPDATE audit_signature
<set>
<if test="auditResult != null">audit_result = #{auditResult},</if>
<if test="imageType != null">image_type = #{imageType},</if>
<if test="isCurrent != null">is_current = #{isCurrent},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</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>
<if test="isDelete != null">is_delete = #{isDelete},</if>
</trim>
where id = #{id}
<if test="remark != null">remark = #{remark},</if>
</set>
WHERE bill_no = #{billNo}
AND is_current = '1'
AND is_delete = '0'
</update>
<update id="updateIsCurrentToZero">

View File

@@ -55,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" />
<result property="isDelete" column="is_delete" />
<result property="hasMoved" column="has_moved"/>
<result property="lihuoYName" column="lihuo_y_name"/>
</resultMap>
<sql id="selectRkInfoVo">
@@ -75,13 +76,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ri.gys_no, ri.gys_mc, ri.jh_amt, ri.ht_dj, ri.sap_no, ri.xh,
ri.jh_qty, ri.ht_qty, ri.dw, ri.real_qty,
ri.pcode, ri.pcode_id, ri.tray_code, ri.entity_id,
ri.create_by, ri.create_time, ri.update_by, ri.update_time, ri.is_delete
ri.create_by, ri.create_time, ri.update_by, ri.update_time, ri.is_delete,
u.user_name AS lihuo_y_name
FROM rk_info ri
LEFT JOIN stock_in_type st ON ri.rk_type = st.type_code
LEFT JOIN material_type mt ON ri.wl_type = mt.type_code
LEFT JOIN warehouse_info wh ON ri.cangku = wh.warehouse_code
LEFT JOIN stock_out_type sot ON ri.ck_type = sot.type_code
LEFT JOIN construction_team ct ON ri.team_code = ct.team_code
LEFT JOIN sys_user u ON ri.lihuo_y = u.user_id
</sql>
<insert id="batchInsertRkInfo"
@@ -94,9 +97,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
wl_no, wl_ms, xm_no, xm_ms,
xm_no_ck, xm_ms_ck, xj, sap_no, gys_no, gys_mc,
jh_qty, ht_qty, jh_amt, ht_dj, dw,
borrow_time, return_time,
borrow_time, return_time, status,
pcode, pcode_id, tray_code, real_qty, entity_id,
remark, is_chuku,is_borrowed,
remark, is_chuku, is_borrowed, gys_jh_id,
is_delete, create_by, create_time
)
VALUES
@@ -107,13 +110,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item.wlNo}, #{item.wlMs}, #{item.xmNo}, #{item.xmMs},
#{item.xmNoCk}, #{item.xmMsCk}, #{item.xj}, #{item.sapNo}, #{item.gysNo}, #{item.gysMc},
#{item.jhQty}, #{item.htQty}, #{item.jhAmt}, #{item.htDj}, #{item.dw},
#{item.borrowTime}, #{item.returnTime},
#{item.borrowTime}, #{item.returnTime}, #{item.status},
#{item.pcode}, #{item.pcodeId}, #{item.trayCode}, #{item.realQty}, #{item.entityId},
#{item.remark}, #{item.isChuku}, #{item.isBorrowed},
#{item.remark}, #{item.isChuku}, #{item.isBorrowed}, #{item.gysJhId},
#{item.isDelete}, #{item.createBy}, #{item.createTime}
)
</foreach>
</insert>
<!--还料入库-->
<insert id="insertRkInfo" parameterType="RkInfo" useGeneratedKeys="true" keyProperty="id">
INSERT INTO rk_info (
@@ -347,6 +351,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT
r.bill_no AS billNo,
MAX(r.lihuo_y) AS lihuoY,
MAX(u.user_name) AS lihuoYName,
MAX(rkType.type_name) AS rkTypeName,
MAX(cangku.warehouse_name) AS cangkuName,
MAX(wlType.type_name) AS wlTypeName
@@ -354,6 +359,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN stock_in_type rkType ON r.rk_type = rkType.type_code
LEFT JOIN warehouse_info cangku ON r.cangku = cangku.warehouse_code
LEFT JOIN material_type wlType ON r.wl_type = wlType.type_code
LEFT JOIN sys_user u ON r.lihuo_y = u.user_id
WHERE r.is_delete = '0'
AND r.bill_no IN
<foreach collection="billNos" item="billNo" open="(" separator="," close=")">
@@ -450,6 +456,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
UPDATE rk_info
SET status = #{status},
update_by = #{updateBy},
is_chuku = #{isChuku},
update_time = #{updateTime}
WHERE bill_no = #{billNo}
AND is_delete = '0'