Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
346476d9ea
|
|
@ -137,6 +137,12 @@ public class PlanApplyVo {
|
||||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
private List<PlanAuditRecordVo> planRecordList;
|
private List<PlanAuditRecordVo> planRecordList;
|
||||||
|
|
||||||
|
/**审核次数*/
|
||||||
|
private int auditNum;
|
||||||
|
|
||||||
|
/**是否具有审核按钮*/
|
||||||
|
private boolean hasAuditBtn = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增条件限制
|
* 新增条件限制
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -75,4 +75,17 @@ public class PlanAuditRecordVo {
|
||||||
* 申请人手机号
|
* 申请人手机号
|
||||||
*/
|
*/
|
||||||
private String phone;
|
private String phone;
|
||||||
|
/**
|
||||||
|
* 审核次数
|
||||||
|
*/
|
||||||
|
private int auditNum;
|
||||||
|
/**
|
||||||
|
* 审核节点
|
||||||
|
*/
|
||||||
|
private int statusType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 完结
|
||||||
|
* */
|
||||||
|
private boolean completed = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -159,4 +159,13 @@ public interface PlanApplyMapper {
|
||||||
* @date 2024/12/25 11:10
|
* @date 2024/12/25 11:10
|
||||||
*/
|
*/
|
||||||
void editAuditStatus(PlanApplyVo data);
|
void editAuditStatus(PlanApplyVo data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断需求计划是否被修改
|
||||||
|
* @param data
|
||||||
|
* @return Integer
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2025/1/23 18:47
|
||||||
|
*/
|
||||||
|
Integer getPlanData(PlanApplyVo data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,11 @@ package com.bonus.aqgqj.business.backstage.mapper.plan;
|
||||||
|
|
||||||
import com.bonus.aqgqj.business.backstage.entity.plan.PlanApplyVo;
|
import com.bonus.aqgqj.business.backstage.entity.plan.PlanApplyVo;
|
||||||
import com.bonus.aqgqj.business.backstage.entity.plan.PlanAuditRecordVo;
|
import com.bonus.aqgqj.business.backstage.entity.plan.PlanAuditRecordVo;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @className:PlanAuditMapper
|
* @className:PlanAuditMapper
|
||||||
|
|
@ -17,6 +19,7 @@ import java.util.List;
|
||||||
public interface PlanAuditMapper {
|
public interface PlanAuditMapper {
|
||||||
/**
|
/**
|
||||||
* 需求计划审核列表
|
* 需求计划审核列表
|
||||||
|
*
|
||||||
* @param data
|
* @param data
|
||||||
* @return List<PlanApplyVo>
|
* @return List<PlanApplyVo>
|
||||||
* @author cwchen
|
* @author cwchen
|
||||||
|
|
@ -26,6 +29,7 @@ public interface PlanAuditMapper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询计划审核节点及状态
|
* 查询计划审核节点及状态
|
||||||
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @return PlanApplyVo
|
* @return PlanApplyVo
|
||||||
* @author cwchen
|
* @author cwchen
|
||||||
|
|
@ -35,6 +39,7 @@ public interface PlanAuditMapper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改审核状态
|
* 修改审核状态
|
||||||
|
*
|
||||||
* @param vo
|
* @param vo
|
||||||
* @return void
|
* @return void
|
||||||
* @author cwchen
|
* @author cwchen
|
||||||
|
|
@ -44,10 +49,59 @@ public interface PlanAuditMapper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统计本次计划所需数量
|
* 统计本次计划所需数量
|
||||||
|
*
|
||||||
* @param applyId
|
* @param applyId
|
||||||
* @return int
|
* @return int
|
||||||
* @author cwchen
|
* @author cwchen
|
||||||
* @date 2024/11/29 9:35
|
* @date 2024/11/29 9:35
|
||||||
*/
|
*/
|
||||||
int getPlanNeedNum(Integer applyId);
|
int getPlanNeedNum(Integer applyId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户是否有审核权限
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* @param statusType
|
||||||
|
* @param userId
|
||||||
|
* @return boolean
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2025/1/23 15:05
|
||||||
|
*/
|
||||||
|
int getUserPermission(@Param("name") String name, @Param("statusType") Integer statusType, @Param("userId") Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询该条数据属于审核节点的审核类型:1 会签 2 或签
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* @param statusType
|
||||||
|
* @return int
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2025/1/23 16:00
|
||||||
|
*/
|
||||||
|
int getAuditType(@Param("name") String name, @Param("statusType") Integer statusType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询审核记录
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* @param statusType
|
||||||
|
* @param plan
|
||||||
|
* @return List<Map < String, String>>
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2025/1/23 17:21
|
||||||
|
*/
|
||||||
|
List<Map<String, String>> getUserAuditRecord(@Param("name") String name, @Param("statusType") int statusType, @Param("params") PlanApplyVo plan);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否具有审核按钮
|
||||||
|
*
|
||||||
|
* @param vo
|
||||||
|
* @param userId
|
||||||
|
* @param type
|
||||||
|
* @return int
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2025/1/23 18:21
|
||||||
|
*/
|
||||||
|
Integer getHasAuditBtn(@Param("params") PlanApplyVo vo, @Param("userId") Long userId, @Param("name") String name, @Param("statusType") int statusType, @Param("type") int type);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,12 +95,14 @@ public class PlanApplyServiceImpl implements PlanApplyService {
|
||||||
String code = getCode(num);
|
String code = getCode(num);
|
||||||
data.setCode(code);
|
data.setCode(code);
|
||||||
data.setNeedNum(needNum);
|
data.setNeedNum(needNum);
|
||||||
|
data.setAuditNum(1);
|
||||||
// 添加计划申请数据
|
// 添加计划申请数据
|
||||||
mapper.addPlanApply(data);
|
mapper.addPlanApply(data);
|
||||||
// 添加安全工器具数据
|
// 添加安全工器具数据
|
||||||
mapper.addPlanDetail(details, data);
|
mapper.addPlanDetail(details, data);
|
||||||
// 添加需求计划申请节点
|
// 添加需求计划申请节点
|
||||||
PlanAuditRecordVo vo = setPlanAuditRecordVoData(data, acount, "0");
|
PlanAuditRecordVo vo = setPlanAuditRecordVoData(data, acount, "0");
|
||||||
|
vo.setAuditNum(1);
|
||||||
mapper.addPlanRecord(vo);
|
mapper.addPlanRecord(vo);
|
||||||
return ServerResponse.createBySuccessMsg("新增成功");
|
return ServerResponse.createBySuccessMsg("新增成功");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
@ -114,6 +116,10 @@ public class PlanApplyServiceImpl implements PlanApplyService {
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public ServerResponse editApplyPlan(PlanApplyVo data) {
|
public ServerResponse editApplyPlan(PlanApplyVo data) {
|
||||||
try {
|
try {
|
||||||
|
Integer num = mapper.getPlanData(data);
|
||||||
|
if(num == null || num > 0){
|
||||||
|
return ServerResponse.createBySuccessMsg("修改成功");
|
||||||
|
}
|
||||||
// 添加创建人信息
|
// 添加创建人信息
|
||||||
SelfUserEntity acount = UserUtil.getLoginUser();
|
SelfUserEntity acount = UserUtil.getLoginUser();
|
||||||
String userName = UserUtil.getLoginUser().getUsername();
|
String userName = UserUtil.getLoginUser().getUsername();
|
||||||
|
|
@ -201,11 +207,16 @@ public class PlanApplyServiceImpl implements PlanApplyService {
|
||||||
if (CollectionUtils.isNotEmpty(auditList) && auditList.size() > 1) {
|
if (CollectionUtils.isNotEmpty(auditList) && auditList.size() > 1) {
|
||||||
for (int i = 0; i < auditList.size(); i++) {
|
for (int i = 0; i < auditList.size(); i++) {
|
||||||
PlanAuditRecordVo item = auditList.get(i);
|
PlanAuditRecordVo item = auditList.get(i);
|
||||||
if (Objects.equals(item.getAuditType(), "4") && Objects.equals(item.getAuditStatus(), "2")) {
|
if (Objects.equals(vo.getStatusType(),"1") && Objects.equals(vo.getStatus(),"2") && Objects.equals(item.getAuditType(), "4") && Objects.equals(item.getAuditStatus(), "2") && i == 0) {
|
||||||
// 审核完结-->计算所有流程的时间差
|
// 审核完结-->计算所有流程的时间差
|
||||||
Long[] timeDiff = DateTimeHelper.getTimeDiff(item.getAuditTime(), auditList.get(auditList.size() - 1).getAuditTime());
|
Long[] timeDiff = DateTimeHelper.getTimeDiff(item.getAuditTime(), auditList.get(auditList.size() - 1).getAuditTime());
|
||||||
item.setHours(timeDiff[0]);
|
item.setHours(timeDiff[0]);
|
||||||
item.setMinutes(timeDiff[1]);
|
item.setMinutes(timeDiff[1]);
|
||||||
|
item.setCompleted(true);
|
||||||
|
} else if (Objects.equals(vo.getStatusType(),"1") && Objects.equals(vo.getStatus(),"2") && Objects.equals(item.getAuditType(), "4") && Objects.equals(item.getAuditStatus(), "2") && i != 0) {
|
||||||
|
Long[] timeDiff = DateTimeHelper.getTimeDiff(item.getAuditTime(), auditList.get(i + 1).getAuditTime());
|
||||||
|
item.setHours(timeDiff[0]);
|
||||||
|
item.setMinutes(timeDiff[1]);
|
||||||
} else {
|
} else {
|
||||||
// 未审核完结-计算每个流程的时间差
|
// 未审核完结-计算每个流程的时间差
|
||||||
if (i != auditList.size() - 1) {
|
if (i != auditList.size() - 1) {
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,11 @@ import com.bonus.aqgqj.business.backstage.entity.plan.PlanAuditRecordVo;
|
||||||
import com.bonus.aqgqj.business.backstage.mapper.plan.PlanApplyMapper;
|
import com.bonus.aqgqj.business.backstage.mapper.plan.PlanApplyMapper;
|
||||||
import com.bonus.aqgqj.business.backstage.mapper.plan.PlanAuditMapper;
|
import com.bonus.aqgqj.business.backstage.mapper.plan.PlanAuditMapper;
|
||||||
import com.bonus.aqgqj.manager.common.util.UserUtil;
|
import com.bonus.aqgqj.manager.common.util.UserUtil;
|
||||||
|
import com.bonus.aqgqj.manager.constant.BusinessConstants;
|
||||||
import com.bonus.aqgqj.manager.security.entity.SelfUserEntity;
|
import com.bonus.aqgqj.manager.security.entity.SelfUserEntity;
|
||||||
import com.bonus.aqgqj.manager.webResult.ServerResponse;
|
import com.bonus.aqgqj.manager.webResult.ServerResponse;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
|
|
@ -17,6 +19,7 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -42,9 +45,25 @@ public class PlanAuditServiceImpl implements PlanAuditService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PlanApplyVo> getPlanAuditList(PlanApplyVo data) {
|
public List<PlanApplyVo> getPlanAuditList(PlanApplyVo data) {
|
||||||
|
SelfUserEntity acount = UserUtil.getLoginUser();
|
||||||
List<PlanApplyVo> list = null;
|
List<PlanApplyVo> list = null;
|
||||||
try {
|
try {
|
||||||
list = mapper.getPlanAuditList(data);
|
list = mapper.getPlanAuditList(data);
|
||||||
|
for (PlanApplyVo vo : list) {
|
||||||
|
if(Objects.equals(vo.getStatusType(),"1") && Objects.equals(vo.getStatus(),"2")){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 判断是否具有审核按钮
|
||||||
|
Integer num = mapper.getHasAuditBtn(vo, acount.getUserId(),BusinessConstants.SAFETY_PLAN,Integer.parseInt(vo.getStatusType()) - 1,1);
|
||||||
|
if(num == null || num == 0){
|
||||||
|
vo.setHasAuditBtn(false);
|
||||||
|
}else{
|
||||||
|
Integer num2 = mapper.getHasAuditBtn(vo, acount.getUserId(),BusinessConstants.SAFETY_PLAN,Integer.parseInt(vo.getStatusType()) - 1,2);
|
||||||
|
if(num2 > 0){
|
||||||
|
vo.setHasAuditBtn(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.toString(), e);
|
log.error(e.toString(), e);
|
||||||
}
|
}
|
||||||
|
|
@ -57,30 +76,46 @@ public class PlanAuditServiceImpl implements PlanAuditService {
|
||||||
try {
|
try {
|
||||||
// 通过applicationContext获取代理对象
|
// 通过applicationContext获取代理对象
|
||||||
PlanAuditServiceImpl proxy = applicationContext.getBean(PlanAuditServiceImpl.class);
|
PlanAuditServiceImpl proxy = applicationContext.getBean(PlanAuditServiceImpl.class);
|
||||||
SelfUserEntity acount = UserUtil.getLoginUser();
|
SelfUserEntity account = UserUtil.getLoginUser();
|
||||||
String userName = UserUtil.getLoginUser().getUsername();
|
String userName = UserUtil.getLoginUser().getUsername();
|
||||||
Integer applyId = vo.getApplyId();
|
Integer applyId = vo.getApplyId();
|
||||||
if (applyId == null) {
|
if (applyId == null) {
|
||||||
return ServerResponse.createErroe("请选择计划进行审核");
|
return ServerResponse.createErroe("请选择计划进行审核");
|
||||||
} else {
|
} else {
|
||||||
//需要配置审核流程节点 、按照不同的用户 角色权限 进行审核
|
|
||||||
//查询计划节点 及状态
|
|
||||||
PlanApplyVo plan = mapper.getPlanApplyData(applyId);
|
PlanApplyVo plan = mapper.getPlanApplyData(applyId);
|
||||||
//目前未配置角色 全部都可以审核
|
|
||||||
String statusType = plan.getStatusType();
|
String statusType = plan.getStatusType();
|
||||||
String status = plan.getStatus();
|
String status = plan.getStatus();
|
||||||
if (!Objects.equals(status, "1")) {
|
//1.查询该账号是否具有审核权限
|
||||||
return ServerResponse.createErroe("该计划已被审核,请刷新重试");
|
int result = mapper.getUserPermission(BusinessConstants.SAFETY_PLAN, Integer.parseInt(statusType) - 1, account.getUserId());
|
||||||
|
if (result == 0) {
|
||||||
|
return ServerResponse.createErroe("该账号无权限审核");
|
||||||
}
|
}
|
||||||
|
//2.验证是否重复审核
|
||||||
|
if (((Integer.parseInt(statusType) > vo.getStatusType())) || Objects.equals(status, "2")) {
|
||||||
|
return ServerResponse.createBySuccessMsg("该数据已被审核请刷新后重试");
|
||||||
|
}
|
||||||
|
int isRepeatAudit = mapper.getHasAuditBtn(plan, account.getUserId(),BusinessConstants.SAFETY_PLAN,Integer.parseInt(plan.getStatusType()) - 1,2);
|
||||||
|
if (isRepeatAudit > 0) {
|
||||||
|
return ServerResponse.createBySuccessMsg("请勿重复审核");
|
||||||
|
}
|
||||||
|
//3.查询该条数据所属审核节点的审核类型:1 会签 2 或签
|
||||||
|
int auditType = mapper.getAuditType(BusinessConstants.SAFETY_PLAN, Integer.parseInt(statusType) - 1);
|
||||||
|
// 审核结果 2.审核通过 3.审核不通过
|
||||||
String auditStatus = vo.getAuditStatus();
|
String auditStatus = vo.getAuditStatus();
|
||||||
//审核通过
|
if (auditType == 1) { // 会签情况
|
||||||
if (Objects.equals(auditStatus, "2")) {
|
if (Objects.equals(auditStatus, "2")) {
|
||||||
proxy.auditSuccess(vo, statusType, acount, plan);
|
return proxy.countersignAuditSuccess(vo, statusType, account, plan);
|
||||||
return ServerResponse.createBySuccessMsg("审核成功");
|
} else {
|
||||||
} else {
|
return proxy.countersignAuditError(vo, statusType, account, plan);
|
||||||
//审核驳回
|
}
|
||||||
proxy.aduitError(vo, statusType, acount);
|
} else if (auditType == 2) { // 或签情况
|
||||||
return ServerResponse.createBySuccessMsg("驳回成功");
|
if (Objects.equals(auditStatus, "2")) {
|
||||||
|
proxy.orVisaAuditSuccess(vo, statusType, account, plan);
|
||||||
|
return ServerResponse.createBySuccessMsg("审核通过");
|
||||||
|
} else {
|
||||||
|
proxy.orVisaAuditError(vo, statusType, account, plan);
|
||||||
|
return ServerResponse.createBySuccessMsg("驳回成功");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
@ -88,20 +123,21 @@ public class PlanAuditServiceImpl implements PlanAuditService {
|
||||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
return ServerResponse.createErroe("审核失败");
|
return ServerResponse.createErroe("审核失败");
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 审核通过
|
* 或签-审核通过
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
public void auditSuccess(PlanAuditRecordVo vo, String statusType, SelfUserEntity user, PlanApplyVo plan) {
|
public void orVisaAuditSuccess(PlanAuditRecordVo vo, String statusType, SelfUserEntity user, PlanApplyVo plan) {
|
||||||
// 通过applicationContext获取代理对象
|
// 通过applicationContext获取代理对象
|
||||||
PlanAuditServiceImpl proxy = applicationContext.getBean(PlanAuditServiceImpl.class);
|
|
||||||
//添加审核记录
|
//添加审核记录
|
||||||
vo.setAuditType(statusType);//审核节点
|
vo.setAuditType(statusType);//审核节点
|
||||||
vo.setAuditor(Integer.parseInt(user.getUserId() + ""));
|
vo.setAuditor(Integer.parseInt(user.getUserId() + ""));
|
||||||
vo.setUpdater(Integer.parseInt(user.getUserId() + ""));
|
vo.setUpdater(Integer.parseInt(user.getUserId() + ""));
|
||||||
vo.setAuditName(user.getUsername());
|
vo.setAuditName(user.getUsername());
|
||||||
|
vo.setAuditNum(plan.getAuditNum());
|
||||||
planApplyMapper.addPlanRecord(vo);
|
planApplyMapper.addPlanRecord(vo);
|
||||||
//修改下次 审核流程
|
//修改下次 审核流程
|
||||||
vo.setAuditStatus("1");
|
vo.setAuditStatus("1");
|
||||||
|
|
@ -118,16 +154,78 @@ public class PlanAuditServiceImpl implements PlanAuditService {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 审核驳回
|
* 或签-审核驳回
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
public void aduitError(PlanAuditRecordVo vo, String statusType, SelfUserEntity user) {
|
public void orVisaAuditError(PlanAuditRecordVo vo, String statusType, SelfUserEntity user, PlanApplyVo plan) {
|
||||||
//修改审核状态
|
//修改审核状态
|
||||||
vo.setAuditType(statusType);//审核节点
|
vo.setAuditType(statusType);//审核节点
|
||||||
mapper.updatePlanAudit(vo);
|
mapper.updatePlanAudit(vo);
|
||||||
vo.setAuditor(Integer.parseInt(user.getUserId() + ""));
|
vo.setAuditor(Integer.parseInt(user.getUserId() + ""));
|
||||||
vo.setUpdater(Integer.parseInt(user.getUserId() + ""));
|
vo.setUpdater(Integer.parseInt(user.getUserId() + ""));
|
||||||
vo.setAuditName(user.getUsername());
|
vo.setAuditName(user.getUsername());
|
||||||
|
vo.setAuditNum(plan.getAuditNum());
|
||||||
planApplyMapper.addPlanRecord(vo);
|
planApplyMapper.addPlanRecord(vo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会签-审核通过
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
public ServerResponse countersignAuditSuccess(PlanAuditRecordVo vo, String statusType, SelfUserEntity user, PlanApplyVo plan) {
|
||||||
|
//添加审核记录
|
||||||
|
vo.setAuditType(statusType);//审核节点
|
||||||
|
vo.setAuditor(Integer.parseInt(user.getUserId() + ""));
|
||||||
|
vo.setUpdater(Integer.parseInt(user.getUserId() + ""));
|
||||||
|
vo.setAuditName(user.getUsername());
|
||||||
|
vo.setAuditNum(plan.getAuditNum());
|
||||||
|
planApplyMapper.addPlanRecord(vo);
|
||||||
|
// 查询审核记录
|
||||||
|
List<Map<String, String>> list = mapper.getUserAuditRecord(BusinessConstants.SAFETY_PLAN, Integer.parseInt(statusType) - 1, plan);
|
||||||
|
if (CollectionUtils.isNotEmpty(list)) {
|
||||||
|
int num = 0;
|
||||||
|
for (Map<String, String> item : list) {
|
||||||
|
String auditor = item.get("auditor");
|
||||||
|
if (!Objects.equals(auditor, "0")) {
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (num == list.size()) {
|
||||||
|
// 审核记录和审核人员数量相同时,则流转到下一审核节点
|
||||||
|
//修改下次 审核流程
|
||||||
|
vo.setAuditStatus("1");
|
||||||
|
if (Objects.equals(statusType, "2")) {
|
||||||
|
vo.setAuditType("3");
|
||||||
|
} else if (Objects.equals(statusType, "3")) {
|
||||||
|
vo.setAuditType("4");
|
||||||
|
} else if (Objects.equals(statusType, "4")) {
|
||||||
|
vo.setAuditType("1");
|
||||||
|
vo.setAuditStatus("2");
|
||||||
|
}
|
||||||
|
//修改审核状态
|
||||||
|
mapper.updatePlanAudit(vo);
|
||||||
|
return ServerResponse.createBySuccessMsg("审核通过");
|
||||||
|
} else {
|
||||||
|
return ServerResponse.createBySuccessMsg("审核通过,请等待其他用户审核");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return ServerResponse.createErroe("未配置审核用户");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会签-驳回
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
public ServerResponse countersignAuditError(PlanAuditRecordVo vo, String statusType, SelfUserEntity user, PlanApplyVo plan) {
|
||||||
|
//修改审核状态
|
||||||
|
vo.setAuditType(statusType);//审核节点
|
||||||
|
mapper.updatePlanAudit(vo);
|
||||||
|
vo.setAuditor(Integer.parseInt(user.getUserId() + ""));
|
||||||
|
vo.setUpdater(Integer.parseInt(user.getUserId() + ""));
|
||||||
|
vo.setAuditName(user.getUsername());
|
||||||
|
vo.setAuditNum(plan.getAuditNum());
|
||||||
|
planApplyMapper.addPlanRecord(vo);
|
||||||
|
return ServerResponse.createBySuccessMsg("驳回成功");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.bonus.aqgqj.manager.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @className:BusinessConstants
|
||||||
|
* @author:cwchen
|
||||||
|
* @date:2025-01-23-16:58
|
||||||
|
* @version:1.0
|
||||||
|
* @description:常量
|
||||||
|
*/
|
||||||
|
public class BusinessConstants {
|
||||||
|
|
||||||
|
/**安全工器具计划审核*/
|
||||||
|
public static final String SAFETY_PLAN = "safety_plan";
|
||||||
|
}
|
||||||
|
|
@ -100,7 +100,7 @@
|
||||||
<select id="getPlanApplyDetailsList"
|
<select id="getPlanApplyDetailsList"
|
||||||
resultType="com.bonus.aqgqj.business.backstage.entity.OutPlanVoSupInfo">
|
resultType="com.bonus.aqgqj.business.backstage.entity.OutPlanVoSupInfo">
|
||||||
select spo.id outId,spod.model_id modelId,spod.type,spod.`name`,spod.model,spod.unit,spos.cg_num cgNum,sct.price,sta.`code`,
|
select spo.id outId,spod.model_id modelId,spod.type,spod.`name`,spod.model,spod.unit,spos.cg_num cgNum,sct.price,sta.`code`,
|
||||||
spos.jy_day jyDay,spos.cc_day ccDay,spos.remark,bpr.name proName
|
spos.jy_day jyDay,spos.cc_day ccDay,spos.remark,bpr.name proName,sta.id AS planId
|
||||||
from st_plan_out spo
|
from st_plan_out spo
|
||||||
left join st_plan_apply sta on spo.apply_id=sta.id
|
left join st_plan_apply sta on spo.apply_id=sta.id
|
||||||
left join st_plan_out_sup spos on spos.out_id=spo.id
|
left join st_plan_out_sup spos on spos.out_id=spo.id
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,8 @@
|
||||||
updater,
|
updater,
|
||||||
update_time,
|
update_time,
|
||||||
status_type,
|
status_type,
|
||||||
need_num
|
need_num,
|
||||||
|
audit_num
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="code != null and code!=''">#{code},</if>
|
<if test="code != null and code!=''">#{code},</if>
|
||||||
|
|
@ -35,7 +36,8 @@
|
||||||
#{updater},
|
#{updater},
|
||||||
#{updateTime},
|
#{updateTime},
|
||||||
'2',
|
'2',
|
||||||
#{needNum}
|
#{needNum},
|
||||||
|
#{auditNum}
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
<!--添加安全工器具数据-->
|
<!--添加安全工器具数据-->
|
||||||
|
|
@ -71,6 +73,7 @@
|
||||||
<if test="auditType != null and auditType!=''">audit_type,</if>
|
<if test="auditType != null and auditType!=''">audit_type,</if>
|
||||||
<if test="auditName != null and auditName!=''">audit_name,</if>
|
<if test="auditName != null and auditName!=''">audit_name,</if>
|
||||||
id,
|
id,
|
||||||
|
audit_num
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="applyId != null">#{applyId},</if>
|
<if test="applyId != null">#{applyId},</if>
|
||||||
|
|
@ -82,7 +85,8 @@
|
||||||
<if test="updateTime != null">#{updateTime},</if>
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
<if test="auditType != null and auditType!=''">#{auditType},</if>
|
<if test="auditType != null and auditType!=''">#{auditType},</if>
|
||||||
<if test="auditName != null and auditName!=''">#{auditName},</if>
|
<if test="auditName != null and auditName!=''">#{auditName},</if>
|
||||||
null
|
null,
|
||||||
|
#{auditNum}
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
<!--添加/修改安全工器具数据-->
|
<!--添加/修改安全工器具数据-->
|
||||||
|
|
@ -114,7 +118,7 @@
|
||||||
<update id="editPlanApply">
|
<update id="editPlanApply">
|
||||||
UPDATE st_plan_apply SET project_id = #{projectId},project_part = #{projectPart},project_content = #{projectContent},
|
UPDATE st_plan_apply SET project_id = #{projectId},project_part = #{projectPart},project_content = #{projectContent},
|
||||||
need_time = #{needTime},remark = #{remark},updater = #{updater},update_time = #{updateTime},
|
need_time = #{needTime},remark = #{remark},updater = #{updater},update_time = #{updateTime},
|
||||||
need_num = #{needNum} WHERE id = #{id}
|
need_num = #{needNum},audit_num = (audit_num + 1) WHERE id = #{id}
|
||||||
</update>
|
</update>
|
||||||
<!--修改审核状态-->
|
<!--修改审核状态-->
|
||||||
<update id="editAuditStatus">
|
<update id="editAuditStatus">
|
||||||
|
|
@ -249,4 +253,10 @@
|
||||||
AND INSTR(mt.name,#{modelName}) > 0
|
AND INSTR(mt.name,#{modelName}) > 0
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
<!--判断需求计划是否被修改-->
|
||||||
|
<select id="getPlanData" resultType="java.lang.Integer">
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM st_plan_apply spa
|
||||||
|
WHERE spa.id = #{id} AND spa.status_type = '2' AND spa.status = '1'
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -19,7 +19,8 @@
|
||||||
spa.create_time AS createTime,
|
spa.create_time AS createTime,
|
||||||
spa.remark,
|
spa.remark,
|
||||||
spa.status,
|
spa.status,
|
||||||
spa.status_type AS statusType
|
spa.status_type AS statusType,
|
||||||
|
spa.audit_num AS auditNum
|
||||||
FROM st_plan_apply spa
|
FROM st_plan_apply spa
|
||||||
LEFT JOIN bm_project tbp ON spa.project_id = tbp.bid_id
|
LEFT JOIN bm_project tbp ON spa.project_id = tbp.bid_id
|
||||||
<where>
|
<where>
|
||||||
|
|
@ -43,11 +44,57 @@
|
||||||
<select id="getPlanApplyData" resultType="com.bonus.aqgqj.business.backstage.entity.plan.PlanApplyVo">
|
<select id="getPlanApplyData" resultType="com.bonus.aqgqj.business.backstage.entity.plan.PlanApplyVo">
|
||||||
SELECT status,
|
SELECT status,
|
||||||
status_type AS statusType,
|
status_type AS statusType,
|
||||||
project_id AS projectId
|
project_id AS projectId,
|
||||||
|
audit_num AS auditNum,
|
||||||
|
id
|
||||||
FROM st_plan_apply WHERE id= #{id}
|
FROM st_plan_apply WHERE id= #{id}
|
||||||
</select>
|
</select>
|
||||||
<!--统计本次计划所需数量-->
|
<!--统计本次计划所需数量-->
|
||||||
<select id="getPlanNeedNum" resultType="java.lang.Integer">
|
<select id="getPlanNeedNum" resultType="java.lang.Integer">
|
||||||
SELECT IFNULL(SUM(need_num),0) AS num FROM st_plan_details WHERE apply_id=#{applyId}
|
SELECT IFNULL(SUM(need_num),0) AS num FROM st_plan_details WHERE apply_id=#{applyId}
|
||||||
</select>
|
</select>
|
||||||
|
<!--查询用户是否有审核权限-->
|
||||||
|
<select id="getUserPermission" resultType="java.lang.Integer">
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM sys_audit_model sam
|
||||||
|
LEFT join sys_audit_config sac ON sam.id=sac.model_id
|
||||||
|
LEFT JOIN sys_audit_user_config sauc ON sauc.config_id=sac.id
|
||||||
|
WHERE sam.model_code=#{name} AND sac.type=#{statusType} AND
|
||||||
|
sauc.user_id=#{userId}
|
||||||
|
</select>
|
||||||
|
<!--查询该条数据属于审核节点的审核类型:1 会签 2 或签-->
|
||||||
|
<select id="getAuditType" resultType="java.lang.Integer">
|
||||||
|
SELECT sac.audit_type
|
||||||
|
FROM sys_audit_model sam
|
||||||
|
LEFT JOIN sys_audit_config sac ON sam.id=sac.model_id
|
||||||
|
WHERE sam.model_code=#{name} AND sac.type=#{statusType}
|
||||||
|
</select>
|
||||||
|
<!--查询审核节点会签人员的审核记录-->
|
||||||
|
<select id="getUserAuditRecord" resultType="java.util.Map">
|
||||||
|
SELECT sauc.user_id AS userId,IFNULL(a.auditor,'0') AS auditor
|
||||||
|
FROM sys_audit_model sam
|
||||||
|
LEFT join sys_audit_config sac ON sam.id=sac.model_id
|
||||||
|
LEFT JOIN sys_audit_user_config sauc ON sauc.config_id=sac.id
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT spr.auditor
|
||||||
|
FROM st_plan_record spr
|
||||||
|
WHERE spr.apply_id = #{params.id} AND spr.audit_num = #{params.auditNum}
|
||||||
|
)a ON sauc.user_id = a.auditor
|
||||||
|
WHERE sam.model_code=#{name} AND sac.type=#{statusType}
|
||||||
|
</select>
|
||||||
|
<!--判断是否具有审核按钮-->
|
||||||
|
<select id="getHasAuditBtn" resultType="java.lang.Integer">
|
||||||
|
<if test="type == 1">
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM sys_audit_model sam
|
||||||
|
LEFT join sys_audit_config sac ON sam.id=sac.model_id
|
||||||
|
LEFT JOIN sys_audit_user_config sauc ON sauc.config_id=sac.id
|
||||||
|
WHERE sam.model_code=#{name} AND sac.type=#{statusType} AND sauc.user_id=#{userId}
|
||||||
|
</if>
|
||||||
|
<if test="type == 2">
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM st_plan_record spr
|
||||||
|
WHERE spr.apply_id = #{params.id} AND spr.auditor = #{userId} AND spr.audit_type = #{params.statusType} AND spr.audit_num = #{params.auditNum}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue