|
@@ -49,8 +49,6 @@ public class PurchasePriceServiceImpl extends ServiceImpl<PurchasePriceMapper, P
|
|
|
private IWarehouseBaseInfoService warehouseBaseInfoService;
|
|
|
@Autowired
|
|
|
private INewWorkflowService workflowService;
|
|
|
- @SofaReference
|
|
|
- private ICommonRoleResourceService roleResourceService;
|
|
|
@Override
|
|
|
public Page<PurchasePrice> purchasePriceList(PurchasePrice purchasePrice) {
|
|
|
|
|
@@ -58,22 +56,12 @@ public class PurchasePriceServiceImpl extends ServiceImpl<PurchasePriceMapper, P
|
|
|
pageView.put("startRecord", (purchasePrice.getCurrentPage() - 1)
|
|
|
* purchasePrice.getPageSize());
|
|
|
//公司id
|
|
|
- List<String> statusSet = new ArrayList<>();
|
|
|
- List<String> resourceIdList = this.getResourceIdList();
|
|
|
- if (resourceIdList.contains("procurementInReport-Edit")) { // 填写,提交 权限做完以后替换
|
|
|
- List<String> statusList = Lists.newArrayList(StatusEnum.PUR_RETURN.getFlag());
|
|
|
- statusSet.addAll(statusList);
|
|
|
- }
|
|
|
pageView.put("compId", purchasePrice.getCompId());
|
|
|
pageView.put("warehouseId", purchasePrice.getWarehouseId());
|
|
|
pageView.put("pageSize", purchasePrice.getPageSize());
|
|
|
pageView.put("currentPage", purchasePrice.getCurrentPage());
|
|
|
- pageView.put("statusSet", statusSet);
|
|
|
List<PurchasePrice> dataList = this.baseMapper.purchasePriceList(pageView);
|
|
|
-
|
|
|
-
|
|
|
Integer dataCount = this.baseMapper.purchasePriceListCount(pageView);
|
|
|
-
|
|
|
if (!CollectionUtils.isEmpty(dataList)) {
|
|
|
dataList.forEach(purchasePrice1 -> {
|
|
|
String taskId = "";
|
|
@@ -84,7 +72,6 @@ public class PurchasePriceServiceImpl extends ServiceImpl<PurchasePriceMapper, P
|
|
|
purchasePrice1.setTaskId(taskId);
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
}
|
|
|
Page<PurchasePrice> page = new Page<>();
|
|
|
page.setRecords(dataList == null ? Lists.newArrayList() : dataList);
|
|
@@ -93,12 +80,6 @@ public class PurchasePriceServiceImpl extends ServiceImpl<PurchasePriceMapper, P
|
|
|
page.setSize(purchasePrice.getPageSize());
|
|
|
return page;
|
|
|
}
|
|
|
- private List<String> getResourceIdList() {
|
|
|
- User currentUser = AuthSecurityUtils.getCurrentUserInfo();
|
|
|
- // 当前登录人主要角色
|
|
|
- return roleResourceService.getBindResourcesByUserId(currentUser.getUserId()).stream()
|
|
|
- .map(CommonRoleResource::getResourceId).collect(Collectors.toList());
|
|
|
- }
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -166,7 +147,14 @@ public class PurchasePriceServiceImpl extends ServiceImpl<PurchasePriceMapper, P
|
|
|
|
|
|
@Override
|
|
|
public PurchasePrice purchasePriceLook(PurchasePrice purchasePrice) {
|
|
|
- purchasePrice = this.baseMapper.selectById(purchasePrice.getId());
|
|
|
+ purchasePrice = this.selectById(purchasePrice.getId());
|
|
|
+ String taskId = "";
|
|
|
+ // 只有待审核状态才有taskId
|
|
|
+ if (StringUtils.isNotBlank(purchasePrice.getWorkflowId())) {
|
|
|
+ JSONObject jsonObject = workflowService.getActiveTask(Lists.newArrayList(purchasePrice.getWorkflowId()), purchasePrice.getId());
|
|
|
+ taskId = jsonObject.getString("taskId");
|
|
|
+ purchasePrice.setTaskId(taskId);
|
|
|
+ }
|
|
|
List<PurchasePriceDetail> details = this.purchasePriceDetailService.selectList(new EntityWrapper<PurchasePriceDetail>().eq("main_id",purchasePrice.getId()));
|
|
|
purchasePrice.setDetails(details);
|
|
|
List<PurchasePriceDetailPrint> detailPrints = this.purchasePriceDetailPrintService.selectList(new EntityWrapper<PurchasePriceDetailPrint>().eq("main_id",purchasePrice.getId()));
|
|
@@ -196,29 +184,31 @@ public class PurchasePriceServiceImpl extends ServiceImpl<PurchasePriceMapper, P
|
|
|
this.purchasePriceDetailPrintService.insert(tmp);
|
|
|
}
|
|
|
boolean isStartWorkflow = StringUtils.isBlank(purchasePrice.getWorkflowId());
|
|
|
- // 不是退回的单子
|
|
|
- if (isStartWorkflow) {
|
|
|
- Workflow workflow = workflowService
|
|
|
- .findLatestWorkflowByBusinessCodeByApp(purchasePrice.getCompId(), "PROCUREMENT-PRICE-APPROVE");
|
|
|
- // 没配置审核流程,直接结束并处理信息
|
|
|
- if (workflow == null) {
|
|
|
- throw new YException(YExceptionEnum.PURCHASE_ORDER_ERROR);
|
|
|
+ if(StatusEnum.PURCHASE_FAILED.getFlag().equals(purchasePrice.getStatusFlag())) {
|
|
|
+ // 不是退回的单子
|
|
|
+ if (isStartWorkflow) {
|
|
|
+ Workflow workflow = workflowService
|
|
|
+ .findLatestWorkflowByBusinessCodeByApp(purchasePrice.getCompId(), "PROCUREMENT-PRICE-APPROVE");
|
|
|
+ // 没配置审核流程,直接结束并处理信息
|
|
|
+ if (workflow == null) {
|
|
|
+ throw new YException(YExceptionEnum.PURCHASE_ORDER_ERROR);
|
|
|
+ }
|
|
|
+ // 开启审核流
|
|
|
+ else {
|
|
|
+
|
|
|
+ // 设置状态 已提交审核
|
|
|
+ purchasePrice.setWorkflowId(workflow.getId());
|
|
|
+ this.updateById(purchasePrice);
|
|
|
+ workflowService.startInstance(workflow.getId(), purchasePrice.getId());
|
|
|
+ }
|
|
|
}
|
|
|
- // 开启审核流
|
|
|
+ // 退回的单子 再启用
|
|
|
else {
|
|
|
|
|
|
- // 设置状态 已提交审核
|
|
|
- purchasePrice.setWorkflowId(workflow.getId());
|
|
|
this.updateById(purchasePrice);
|
|
|
- workflowService.startInstance(workflow.getId(), purchasePrice.getId());
|
|
|
+ workflowService.activateInstance(purchasePrice.getWorkflowId(), purchasePrice.getId());
|
|
|
}
|
|
|
}
|
|
|
- // 退回的单子 再启用
|
|
|
- else {
|
|
|
-
|
|
|
- this.updateById(purchasePrice);
|
|
|
- workflowService.activateInstance(purchasePrice.getWorkflowId(), purchasePrice.getId());
|
|
|
- }
|
|
|
return "ok";
|
|
|
}
|
|
|
|