|
|
@ -1,11 +1,15 @@ |
|
|
|
package com.ruoyi.purchase.service.impl; |
|
|
|
|
|
|
|
import com.github.pagehelper.Page; |
|
|
|
import com.ruoyi.common.core.domain.entity.SysUser; |
|
|
|
import com.ruoyi.common.core.page.PageDomain; |
|
|
|
import com.ruoyi.common.core.page.TableSupport; |
|
|
|
import com.ruoyi.common.core.redis.RedisCache; |
|
|
|
import com.ruoyi.common.core.text.Convert; |
|
|
|
import com.ruoyi.common.service.ICommonService; |
|
|
|
import com.ruoyi.common.utils.DateUtils; |
|
|
|
import com.ruoyi.common.utils.ShiroUtils; |
|
|
|
import com.ruoyi.common.utils.StringUtils; |
|
|
|
import com.ruoyi.common.utils.bean.BeanUtils; |
|
|
|
import com.ruoyi.financial.domain.FinancialAccountsPayable; |
|
|
|
import com.ruoyi.financial.service.IFinancialAccountsPayableService; |
|
|
@ -32,7 +36,9 @@ import com.ruoyi.warehouse.mapper.WarehouseStorageOrderDetailMapper; |
|
|
|
import com.ruoyi.warehouse.mapper.WarehouseStorageOrderMapper; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.activiti.engine.TaskService; |
|
|
|
import org.activiti.engine.impl.persistence.entity.TaskEntityImpl; |
|
|
|
import org.activiti.engine.runtime.ProcessInstance; |
|
|
|
import org.activiti.engine.task.Task; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
@ -128,7 +134,58 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService |
|
|
|
@Override |
|
|
|
public List<PurchaseOrderVo> selectPurchaseOrderList(PurchaseOrder purchaseOrder) |
|
|
|
{ |
|
|
|
return purchaseOrderMapper.selectPurchaseOrderList(purchaseOrder); |
|
|
|
PageDomain pageDomain = TableSupport.buildPageRequest(); |
|
|
|
Integer pageNum = pageDomain.getPageNum(); |
|
|
|
Integer pageSize = pageDomain.getPageSize(); |
|
|
|
|
|
|
|
//PageHelper 仅对第一List分页有效
|
|
|
|
Page<PurchaseOrderVo> list = (Page<PurchaseOrderVo>) purchaseOrderMapper.selectPurchaseOrderList(purchaseOrder);; |
|
|
|
Page<PurchaseOrderVo> returnList = new Page<>(); |
|
|
|
for(PurchaseOrderVo purchaseOrderVo : list){ |
|
|
|
SysUser sysUser = userMapper.selectUserByLoginName(purchaseOrderVo.getCreateBy()); |
|
|
|
if (sysUser != null) { |
|
|
|
purchaseOrderVo.setCreateBy(sysUser.getUserName()); |
|
|
|
} |
|
|
|
SysUser sysUser2 = userMapper.selectUserByLoginName(purchaseOrderVo.getApplyUser()); |
|
|
|
if (sysUser2!=null){ |
|
|
|
purchaseOrderVo.setApplyUserName(sysUser2.getUserName()); |
|
|
|
} |
|
|
|
String instanceId = purchaseOrderVo.getInstanceId(); |
|
|
|
// 当前环节
|
|
|
|
if (StringUtils.isNotBlank(instanceId)) { |
|
|
|
List<Task> taskList = taskService.createTaskQuery() |
|
|
|
.processInstanceId(instanceId) |
|
|
|
// .singleResult();
|
|
|
|
.list(); // 例如请假会签,会同时拥有多个任务
|
|
|
|
if (!CollectionUtils.isEmpty(taskList)) { |
|
|
|
TaskEntityImpl task = (TaskEntityImpl) taskList.get(0); |
|
|
|
String taskId = task.getId(); |
|
|
|
purchaseOrderVo.setTaskId(taskId); |
|
|
|
// 设置待办用户
|
|
|
|
List<String> todoUserList = todoItemMapper.selectUndealTodoUserList(taskId); |
|
|
|
if(!CollectionUtils.isEmpty(taskList)){ |
|
|
|
purchaseOrderVo.setTodoUserId(String.join(",",todoUserList)); |
|
|
|
} |
|
|
|
if (task.getSuspensionState() == 2) { |
|
|
|
purchaseOrderVo.setTaskName("已挂起"); |
|
|
|
purchaseOrderVo.setSuspendState("2"); |
|
|
|
} else { |
|
|
|
purchaseOrderVo.setTaskName(task.getName()); |
|
|
|
purchaseOrderVo.setSuspendState("1"); |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 已办结或者已撤销
|
|
|
|
purchaseOrderVo.setTaskName("已结束"); |
|
|
|
} |
|
|
|
} else { |
|
|
|
purchaseOrderVo.setTaskName("未启动"); |
|
|
|
} |
|
|
|
returnList.add(purchaseOrderVo); |
|
|
|
} |
|
|
|
returnList.setTotal(CollectionUtils.isEmpty(list) ? 0 : list.getTotal()); |
|
|
|
returnList.setPageNum(pageNum); |
|
|
|
returnList.setPageSize(pageSize); |
|
|
|
return returnList; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -303,8 +360,6 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService |
|
|
|
purchaseOrder.setNoRmbSum(materialNoRmbSum); |
|
|
|
purchaseOrder.setRmbSum(materialRmbSum); |
|
|
|
purchaseOrder.setDelFlag("0"); |
|
|
|
purchaseOrder.setAuditStatus("1"); |
|
|
|
purchaseOrder.setUseStatus("1"); |
|
|
|
purchaseOrder.setEceiptStatus("0"); |
|
|
|
purchaseOrder.setPaymentStatus("0"); |
|
|
|
purchaseOrder.setPurchaseBuyer(purchaseOrder.getPurchaseBuyer()); |
|
|
@ -627,7 +682,15 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService |
|
|
|
private void buildAuthority(SysUser user, Map<String, Object> variables) { |
|
|
|
Set<String> roleKeys = roleService.selectRoleKeys(user.getUserId()); |
|
|
|
// 角色不同审核人不同
|
|
|
|
|
|
|
|
if(roleKeys.contains("cgyRole")){ |
|
|
|
variables.put("authority",1); |
|
|
|
}else if(roleKeys.contains("cgjlRole")){ |
|
|
|
variables.put("authority",2); |
|
|
|
}else if(roleKeys.contains("cgzgRole")){ |
|
|
|
variables.put("authority",3); |
|
|
|
}else if(roleKeys.contains("fzjlRole")){ |
|
|
|
variables.put("authority",4); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|