|
@@ -8,9 +8,7 @@ import com.jsh.erp.datasource.dto.AuditQueryDTO;
|
|
import com.jsh.erp.datasource.dto.MaterialDTO;
|
|
import com.jsh.erp.datasource.dto.MaterialDTO;
|
|
import com.jsh.erp.datasource.dto.MaterialExtendDTO;
|
|
import com.jsh.erp.datasource.dto.MaterialExtendDTO;
|
|
import com.jsh.erp.datasource.entities.*;
|
|
import com.jsh.erp.datasource.entities.*;
|
|
-import com.jsh.erp.datasource.mappers.AuditMapper;
|
|
|
|
-import com.jsh.erp.datasource.mappers.AuditNodeConfigMapper;
|
|
|
|
-import com.jsh.erp.datasource.mappers.AuditNodeMapper;
|
|
|
|
|
|
+import com.jsh.erp.datasource.mappers.*;
|
|
import com.jsh.erp.datasource.pda.dto.PDADepotHeadDTO;
|
|
import com.jsh.erp.datasource.pda.dto.PDADepotHeadDTO;
|
|
import com.jsh.erp.datasource.pda.vo.PDADepotHeadVO;
|
|
import com.jsh.erp.datasource.pda.vo.PDADepotHeadVO;
|
|
import com.jsh.erp.datasource.vo.AuditNodeVo;
|
|
import com.jsh.erp.datasource.vo.AuditNodeVo;
|
|
@@ -40,23 +38,24 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
|
|
|
|
|
|
private final AuditNodeMapper auditNodeMapper;
|
|
private final AuditNodeMapper auditNodeMapper;
|
|
|
|
|
|
- private final AuditProcessService auditProcessService;
|
|
|
|
|
|
+ private final AuditProcessMapper auditProcessMapper;
|
|
|
|
|
|
private final UserService userService;
|
|
private final UserService userService;
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
|
|
+ private MaterialService materialService;
|
|
|
|
+ @Resource
|
|
private MaterialBatchService materialBatchService;
|
|
private MaterialBatchService materialBatchService;
|
|
@Resource
|
|
@Resource
|
|
- private TaskStocktakingService taskStocktakingService;
|
|
|
|
|
|
+ private DepotHeadService depotHeadService;
|
|
@Resource
|
|
@Resource
|
|
private MaterialInputService materialInputService;
|
|
private MaterialInputService materialInputService;
|
|
@Resource
|
|
@Resource
|
|
- private MaterialService materialService;
|
|
|
|
- @Resource
|
|
|
|
- private DepotHeadService depotHeadService;
|
|
|
|
|
|
+ private TaskStocktakingService taskStocktakingService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 根据审核业务单号和类型生成审核实例及节点实例
|
|
* 根据审核业务单号和类型生成审核实例及节点实例
|
|
|
|
+ *
|
|
* @param businessNumber 业务单号
|
|
* @param businessNumber 业务单号
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
@@ -65,24 +64,24 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
|
|
try {
|
|
try {
|
|
//针对重新提交申请,获取失败审核
|
|
//针对重新提交申请,获取失败审核
|
|
Audit a = getOne(new LambdaQueryWrapperX<Audit>()
|
|
Audit a = getOne(new LambdaQueryWrapperX<Audit>()
|
|
- .eq(Audit::getBusinessNumber,businessNumber)
|
|
|
|
- .eq(Audit::getAuditStatus,2)
|
|
|
|
- .eq(Audit::getDeleteFlag,false));
|
|
|
|
- if (a != null){
|
|
|
|
|
|
+ .eq(Audit::getBusinessNumber, businessNumber)
|
|
|
|
+ .eq(Audit::getAuditStatus, 2)
|
|
|
|
+ .eq(Audit::getDeleteFlag, false));
|
|
|
|
+ if (a != null) {
|
|
//删除审核
|
|
//删除审核
|
|
- update(new UpdateWrapper<Audit>().set("delete_flag",true).eq("id",a.getId()));
|
|
|
|
|
|
+ update(new UpdateWrapper<Audit>().set("delete_flag", true).eq("id", a.getId()));
|
|
}
|
|
}
|
|
//获取业务id
|
|
//获取业务id
|
|
- Long bid = null;
|
|
|
|
- if (type.equals("盘点任务")){
|
|
|
|
- bid = taskStocktakingService.getOne(new LambdaQueryWrapperX<TaskStocktaking>().eq(TaskStocktaking::getNumber,businessNumber)).getId();
|
|
|
|
- }else if (type.equals("pda维护商品")){
|
|
|
|
- bid = materialInputService.getOne(new LambdaQueryWrapperX<MaterialInput>().eq(MaterialInput::getNumber,businessNumber)).getId();
|
|
|
|
- }else {
|
|
|
|
|
|
+ Long bid;
|
|
|
|
+ if (type.equals("盘点任务")) {
|
|
|
|
+ bid = taskStocktakingService.getOne(new LambdaQueryWrapperX<TaskStocktaking>().eq(TaskStocktaking::getNumber, businessNumber)).getId();
|
|
|
|
+ } else if (type.equals("pda维护商品")) {
|
|
|
|
+ bid = materialInputService.getOne(new LambdaQueryWrapperX<MaterialInput>().eq(MaterialInput::getNumber, businessNumber)).getId();
|
|
|
|
+ } else {
|
|
bid = depotHeadService.getDepotHead(businessNumber).getId();
|
|
bid = depotHeadService.getDepotHead(businessNumber).getId();
|
|
}
|
|
}
|
|
//获取审核流程
|
|
//获取审核流程
|
|
- AuditProcess auditProcess = auditProcessService.getOne(new LambdaQueryWrapperX<AuditProcess>()
|
|
|
|
|
|
+ AuditProcess auditProcess = auditProcessMapper.selectOne(new LambdaQueryWrapperX<AuditProcess>()
|
|
.eq(AuditProcess::getType, type)
|
|
.eq(AuditProcess::getType, type)
|
|
.eq(AuditProcess::getDeleteFlag, false));
|
|
.eq(AuditProcess::getDeleteFlag, false));
|
|
//判断是否有审核流程
|
|
//判断是否有审核流程
|
|
@@ -102,11 +101,11 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
|
|
AuditNodeConfig auditNodeConfig = auditNodeConfigMapper.selectOne(new LambdaQueryWrapperX<AuditNodeConfig>()
|
|
AuditNodeConfig auditNodeConfig = auditNodeConfigMapper.selectOne(new LambdaQueryWrapperX<AuditNodeConfig>()
|
|
.eq(AuditNodeConfig::getProcessId, auditProcess.getId())
|
|
.eq(AuditNodeConfig::getProcessId, auditProcess.getId())
|
|
.eq(AuditNodeConfig::getNodeOrder, 1));
|
|
.eq(AuditNodeConfig::getNodeOrder, 1));
|
|
- AuditNode auditNode = buildAuditNode(audit.getId(), auditNodeConfig, user);
|
|
|
|
|
|
+ AuditNode auditNode = buildAuditNode(audit.getId(), auditNodeConfig, user.getId());
|
|
auditNodeMapper.insert(auditNode);
|
|
auditNodeMapper.insert(auditNode);
|
|
} else {
|
|
} else {
|
|
//无审核流程,直接通过
|
|
//无审核流程,直接通过
|
|
- approved(bid,type);
|
|
|
|
|
|
+ approved(bid, type);
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
log.error("创建审核流程失败", e);
|
|
log.error("创建审核流程失败", e);
|
|
@@ -124,9 +123,7 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
|
|
auditQueryDTO.setUid(user.getId());
|
|
auditQueryDTO.setUid(user.getId());
|
|
PageUtils.startPage();
|
|
PageUtils.startPage();
|
|
List<AuditVo> list = auditMapper.pendingApprovalList(auditQueryDTO);
|
|
List<AuditVo> list = auditMapper.pendingApprovalList(auditQueryDTO);
|
|
- list.forEach(v -> {
|
|
|
|
- v.setAuditorName(user.getUsername());
|
|
|
|
- });
|
|
|
|
|
|
+ list.forEach(v -> v.setAuditorName(user.getUsername()) );
|
|
return list;
|
|
return list;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -136,8 +133,7 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
|
|
@Override
|
|
@Override
|
|
public Long pendingApprovalCount() {
|
|
public Long pendingApprovalCount() {
|
|
User user = userService.getCurrentUser();
|
|
User user = userService.getCurrentUser();
|
|
- Long count =auditNodeMapper.selectCount(AuditNode::getAuditorUser,user.getId(),AuditNode::getAuditResult,0);
|
|
|
|
- return count;
|
|
|
|
|
|
+ return auditNodeMapper.selectCount(AuditNode::getAuditorUser, user.getId(), AuditNode::getAuditResult, 0);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -149,9 +145,7 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
|
|
auditQueryDTO.setUid(user.getId());
|
|
auditQueryDTO.setUid(user.getId());
|
|
PageUtils.startPage();
|
|
PageUtils.startPage();
|
|
List<AuditVo> list = auditMapper.processedApprovalList(auditQueryDTO);
|
|
List<AuditVo> list = auditMapper.processedApprovalList(auditQueryDTO);
|
|
- list.forEach(v -> {
|
|
|
|
- v.setAuditorName(user.getUsername());
|
|
|
|
- });
|
|
|
|
|
|
+ list.forEach(v -> v.setAuditorName(user.getUsername()));
|
|
return list;
|
|
return list;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -164,9 +158,7 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
|
|
auditQueryDTO.setUid(user.getId());
|
|
auditQueryDTO.setUid(user.getId());
|
|
PageUtils.startPage();
|
|
PageUtils.startPage();
|
|
List<AuditVo> list = auditMapper.myApprovalList(auditQueryDTO);
|
|
List<AuditVo> list = auditMapper.myApprovalList(auditQueryDTO);
|
|
- list.forEach(v -> {
|
|
|
|
- v.setInitiatorName(user.getUsername());
|
|
|
|
- });
|
|
|
|
|
|
+ list.forEach(v -> v.setInitiatorName(user.getUsername()));
|
|
return list;
|
|
return list;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -180,7 +172,8 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
|
|
|
|
|
|
/**
|
|
/**
|
|
* 设置审核状态
|
|
* 设置审核状态
|
|
- * @param auditDTO
|
|
|
|
|
|
+ *
|
|
|
|
+ * @param auditDTO 审核参数
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
|
@@ -202,14 +195,16 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
|
|
AuditNodeConfig auditNodeConfig = auditNodeConfigMapper.getAuditNodeConfigByAuditIdAndOrder(auditDTO.getId(), auditNode.getNodeOrder());
|
|
AuditNodeConfig auditNodeConfig = auditNodeConfigMapper.getAuditNodeConfigByAuditIdAndOrder(auditDTO.getId(), auditNode.getNodeOrder());
|
|
if (auditNodeConfig != null && auditNodeConfig.getAuditorType() != null) {
|
|
if (auditNodeConfig != null && auditNodeConfig.getAuditorType() != null) {
|
|
//有,根据节点配置生成下一节点
|
|
//有,根据节点配置生成下一节点
|
|
- AuditNode newAuditNode = buildAuditNode(auditDTO.getId(), auditNodeConfig, user);
|
|
|
|
|
|
+ //发起审核用户ID
|
|
|
|
+ Long uid = getById(auditDTO.getId()).getSubmitUser();
|
|
|
|
+ AuditNode newAuditNode = buildAuditNode(auditDTO.getId(), auditNodeConfig, uid);
|
|
auditNodeMapper.insert(newAuditNode);
|
|
auditNodeMapper.insert(newAuditNode);
|
|
} else {
|
|
} else {
|
|
//无下一节点,审核阶段结束,修改对应审核内容状态
|
|
//无下一节点,审核阶段结束,修改对应审核内容状态
|
|
//修改审核状态
|
|
//修改审核状态
|
|
this.update(new UpdateWrapper<Audit>().set("audit_status", 1).eq("id", auditDTO.getId()));
|
|
this.update(new UpdateWrapper<Audit>().set("audit_status", 1).eq("id", auditDTO.getId()));
|
|
Audit audit = auditMapper.selectById(auditDTO.getId());
|
|
Audit audit = auditMapper.selectById(auditDTO.getId());
|
|
- approved(audit.getBusinessId(),audit.getType());
|
|
|
|
|
|
+ approved(audit.getBusinessId(), audit.getType());
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
//审批未通过
|
|
//审批未通过
|
|
@@ -218,11 +213,11 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
|
|
//修改单据状态
|
|
//修改单据状态
|
|
Audit audit = auditMapper.selectById(auditDTO.getId());
|
|
Audit audit = auditMapper.selectById(auditDTO.getId());
|
|
Long businessId = audit.getBusinessId();
|
|
Long businessId = audit.getBusinessId();
|
|
- if (audit.getType().equals("盘点任务")){
|
|
|
|
- taskStocktakingService.update(new UpdateWrapper<TaskStocktaking>().set("task_status",8).eq("id",businessId));
|
|
|
|
- }else if (audit.getType().equals("pda维护商品")){
|
|
|
|
- materialInputService.update(new UpdateWrapper<MaterialInput>().set("status",8).eq("id",businessId));
|
|
|
|
- }else {
|
|
|
|
|
|
+ if (audit.getType().equals("盘点任务")) {
|
|
|
|
+ taskStocktakingService.update(new UpdateWrapper<TaskStocktaking>().set("task_status", 8).eq("id", businessId));
|
|
|
|
+ } else if (audit.getType().equals("pda维护商品")) {
|
|
|
|
+ materialInputService.update(new UpdateWrapper<MaterialInput>().set("status", 8).eq("id", businessId));
|
|
|
|
+ } else {
|
|
depotHeadService.update(new UpdateWrapper<DepotHead>().set("status", 8).eq("id", businessId));
|
|
depotHeadService.update(new UpdateWrapper<DepotHead>().set("status", 8).eq("id", businessId));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -231,21 +226,22 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
|
|
|
|
|
|
/**
|
|
/**
|
|
* pda复核任务列表
|
|
* pda复核任务列表
|
|
- * @param pdaDepotHeadDTO
|
|
|
|
|
|
+ *
|
|
|
|
+ * @param pdaDepotHeadDTO 筛选条件
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public List<PDADepotHeadVO> pdaList(PDADepotHeadDTO pdaDepotHeadDTO) {
|
|
public List<PDADepotHeadVO> pdaList(PDADepotHeadDTO pdaDepotHeadDTO) {
|
|
- List<PDADepotHeadVO> list = auditMapper.pdaList(pdaDepotHeadDTO);
|
|
|
|
- return list;
|
|
|
|
|
|
+ return auditMapper.pdaList(pdaDepotHeadDTO);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 根据节点配置构建审核节点实例
|
|
* 根据节点配置构建审核节点实例
|
|
|
|
+ *
|
|
* @param aid 审核id
|
|
* @param aid 审核id
|
|
* @param auditNodeConfig 审核节点配置
|
|
* @param auditNodeConfig 审核节点配置
|
|
- * @param user 当前用户
|
|
|
|
|
|
+ * @param uid 发起用户id
|
|
*/
|
|
*/
|
|
- private AuditNode buildAuditNode(Long aid, AuditNodeConfig auditNodeConfig, User user) {
|
|
|
|
|
|
+ private AuditNode buildAuditNode(Long aid, AuditNodeConfig auditNodeConfig, Long uid) {
|
|
AuditNode auditNode = new AuditNode();
|
|
AuditNode auditNode = new AuditNode();
|
|
auditNode.setAuditId(aid);
|
|
auditNode.setAuditId(aid);
|
|
auditNode.setNodeId(auditNodeConfig.getId());
|
|
auditNode.setNodeId(auditNodeConfig.getId());
|
|
@@ -253,7 +249,7 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
|
|
if (auditNodeConfig.getAuditor() == null) {
|
|
if (auditNodeConfig.getAuditor() == null) {
|
|
if (auditNodeConfig.getAuditorType().equals(2)) {
|
|
if (auditNodeConfig.getAuditorType().equals(2)) {
|
|
//上级部门最高领导审核
|
|
//上级部门最高领导审核
|
|
- Long id = userService.getAuditUserIds(user.getId(), true);
|
|
|
|
|
|
+ Long id = userService.getAuditUserIds(uid, true);
|
|
if (id == null) {
|
|
if (id == null) {
|
|
throw new BusinessRunTimeException(ExceptionConstants.AUDIT_APPROVAL_HIGHER_DEPARTMENTS_LEADER_IS_NOT_EXIST_CODE,
|
|
throw new BusinessRunTimeException(ExceptionConstants.AUDIT_APPROVAL_HIGHER_DEPARTMENTS_LEADER_IS_NOT_EXIST_CODE,
|
|
ExceptionConstants.AUDIT_APPROVAL_HIGHER_DEPARTMENTS_LEADER_IS_NOT_EXIST_MSG);
|
|
ExceptionConstants.AUDIT_APPROVAL_HIGHER_DEPARTMENTS_LEADER_IS_NOT_EXIST_MSG);
|
|
@@ -261,7 +257,7 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
|
|
auditNode.setAuditorUser(id);
|
|
auditNode.setAuditorUser(id);
|
|
} else if (auditNodeConfig.getAuditorType().equals(3)) {
|
|
} else if (auditNodeConfig.getAuditorType().equals(3)) {
|
|
//本部门最高领导审核
|
|
//本部门最高领导审核
|
|
- Long id = userService.getAuditUserIds(user.getId(), false);
|
|
|
|
|
|
+ Long id = userService.getAuditUserIds(uid, false);
|
|
if (id == null) {
|
|
if (id == null) {
|
|
throw new BusinessRunTimeException(ExceptionConstants.AUDIT_APPROVAL_DEPARTMENT_LEADER_IS_NOT_EXIST_CODE,
|
|
throw new BusinessRunTimeException(ExceptionConstants.AUDIT_APPROVAL_DEPARTMENT_LEADER_IS_NOT_EXIST_CODE,
|
|
ExceptionConstants.AUDIT_APPROVAL_DEPARTMENT_LEADER_IS_NOT_EXIST_MSG);
|
|
ExceptionConstants.AUDIT_APPROVAL_DEPARTMENT_LEADER_IS_NOT_EXIST_MSG);
|
|
@@ -277,16 +273,17 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
|
|
|
|
|
|
/**
|
|
/**
|
|
* 审批通过,处理对应业务
|
|
* 审批通过,处理对应业务
|
|
|
|
+ *
|
|
* @param businessId 业务id
|
|
* @param businessId 业务id
|
|
- * @param type 业务类型
|
|
|
|
|
|
+ * @param type 业务类型
|
|
*/
|
|
*/
|
|
private void approved(Long businessId, String type) {
|
|
private void approved(Long businessId, String type) {
|
|
- if (type.equals("盘点任务")){
|
|
|
|
- taskStocktakingService.update(new UpdateWrapper<TaskStocktaking>().set("task_status",1).eq("id",businessId));
|
|
|
|
- }else if (type.equals("pda维护商品")){
|
|
|
|
- materialInputService.update(new UpdateWrapper<MaterialInput>().set("status",1).eq("id",businessId));
|
|
|
|
|
|
+ if (type.equals("盘点任务")) {
|
|
|
|
+ taskStocktakingService.update(new UpdateWrapper<TaskStocktaking>().set("task_status", 1).eq("id", businessId));
|
|
|
|
+ } else if (type.equals("pda维护商品")) {
|
|
|
|
+ materialInputService.update(new UpdateWrapper<MaterialInput>().set("status", 1).eq("id", businessId));
|
|
materialInputApproved(businessId);
|
|
materialInputApproved(businessId);
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
//单据处理
|
|
//单据处理
|
|
depotHeadService.update(new UpdateWrapper<DepotHead>().set("status", 1).eq("id", businessId));
|
|
depotHeadService.update(new UpdateWrapper<DepotHead>().set("status", 1).eq("id", businessId));
|
|
materialBatchService.generateMaterialBatchByDepotHeadId(businessId);
|
|
materialBatchService.generateMaterialBatchByDepotHeadId(businessId);
|
|
@@ -295,6 +292,7 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
|
|
|
|
|
|
/**
|
|
/**
|
|
* 单据审核通过 处理商品录入信息
|
|
* 单据审核通过 处理商品录入信息
|
|
|
|
+ *
|
|
* @param id 单据主表id
|
|
* @param id 单据主表id
|
|
*/
|
|
*/
|
|
private void materialInputApproved(Long id) {
|
|
private void materialInputApproved(Long id) {
|
|
@@ -334,7 +332,7 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
|
|
List<MaterialInitialStock> initialStockList = new ArrayList<>();
|
|
List<MaterialInitialStock> initialStockList = new ArrayList<>();
|
|
initialStockList.add(materialInitialStock);
|
|
initialStockList.add(materialInitialStock);
|
|
materialDTO.setStock(initialStockList);
|
|
materialDTO.setStock(initialStockList);
|
|
- materialService.insertMaterial(materialDTO,null);
|
|
|
|
|
|
+ materialService.insertMaterial(materialDTO, null);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|