审核模块相关接口修改
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -6,6 +6,9 @@ import java.util.List;
|
||||
@Data
|
||||
public class RkInfoBatchDTO {
|
||||
|
||||
/** 供应商计划ID */
|
||||
private Long gysJhId;
|
||||
|
||||
/** 审核人用户ID */
|
||||
private String approverId;
|
||||
|
||||
|
||||
@@ -26,4 +26,8 @@ public class RkInfoScanDTO {
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 供应计划主键ID */
|
||||
private Long gysJhId;
|
||||
|
||||
}
|
||||
|
||||
@@ -72,4 +72,7 @@ public class AuditSignatureReviewVO {
|
||||
/** 理货员名称(原本就是中文) */
|
||||
private String lihuoY;
|
||||
|
||||
/** 理货员名称(联查显示用,导出专用) */
|
||||
private String lihuoYName;
|
||||
|
||||
}
|
||||
|
||||
@@ -39,4 +39,7 @@ public class AuditSignatureVo extends AuditSignature {
|
||||
|
||||
/** 入库备注(rk_info 表里的) */
|
||||
private String rkRemark;
|
||||
|
||||
/** 入库记录ID(对应rk_info.id) */
|
||||
private Long rkId;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
/**
|
||||
* 是否存在提交记录(第一次申请还是驳回后再次申请)
|
||||
|
||||
@@ -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);
|
||||
|
||||
/**
|
||||
* 审批申请
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user