|
|
@ -6,8 +6,11 @@ import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Set; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
import com.github.pagehelper.Page; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import com.ruoyi.common.core.domain.entity.SysUser; |
|
|
|
import com.ruoyi.common.core.page.PageDomain; |
|
|
|
import com.ruoyi.common.core.page.TableSupport; |
|
|
@ -20,9 +23,11 @@ import com.ruoyi.process.todoitem.mapper.BizTodoItemMapper; |
|
|
|
import com.ruoyi.system.domain.BaseEmpRequisiteOrderChild; |
|
|
|
import com.ruoyi.system.domain.BaseRequisitioningOrderChild; |
|
|
|
import com.ruoyi.system.domain.Vo.BaseEmpRequisiteOrderVO; |
|
|
|
import com.ruoyi.system.domain.Vo.BaseRequisitioningOrderVo; |
|
|
|
import com.ruoyi.system.domain.Vo.OutsourceQuoteVO; |
|
|
|
import com.ruoyi.system.mapper.BaseEmpRequisiteOrderChildMapper; |
|
|
|
import com.ruoyi.system.mapper.SysUserMapper; |
|
|
|
import com.ruoyi.system.service.IBaseExpenseAccountService; |
|
|
|
import com.ruoyi.system.service.ISysUserService; |
|
|
|
import org.activiti.engine.RuntimeService; |
|
|
|
import org.activiti.engine.TaskService; |
|
|
@ -75,6 +80,9 @@ public class BaseEmpRequisiteOrderServiceImpl implements IBaseEmpRequisiteOrderS |
|
|
|
@Autowired |
|
|
|
private IProcessService processService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IBaseExpenseAccountService baseExpenseAccountService; |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询员工领料单 |
|
|
|
* |
|
|
@ -99,15 +107,28 @@ public class BaseEmpRequisiteOrderServiceImpl implements IBaseEmpRequisiteOrderS |
|
|
|
* @return 员工领料单 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<BaseEmpRequisiteOrderVO> selectBaseEmpRequisiteOrderList(BaseEmpRequisiteOrderVO baseEmpRequisiteOrderVO) |
|
|
|
{ |
|
|
|
public List<BaseEmpRequisiteOrderVO> selectBaseEmpRequisiteOrderList(BaseEmpRequisiteOrderVO baseEmpRequisiteOrderVO) throws Exception { |
|
|
|
SysUser curUser = ShiroUtils.getSysUser(); |
|
|
|
Long userId = curUser.getUserId(); |
|
|
|
Set<String> roleKeys = roleService.selectRoleKeys(userId); |
|
|
|
List<BaseEmpRequisiteOrderVO> Volist = baseEmpRequisiteOrderMapper.selectBaseEmpRequisiteOrderList(baseEmpRequisiteOrderVO); |
|
|
|
|
|
|
|
// 获取当前登录名下可看用户列表
|
|
|
|
Set<String> users = baseExpenseAccountService.userLimitedList(roleKeys,curUser); |
|
|
|
|
|
|
|
List<BaseEmpRequisiteOrderVO> matchedList = Volist.stream() |
|
|
|
.filter(empRequisiteOrderVO -> users.contains(empRequisiteOrderVO.getApplyUser())) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
PageDomain pageDomain = TableSupport.buildPageRequest(); |
|
|
|
Integer pageNum = pageDomain.getPageNum(); |
|
|
|
Integer pageSize = pageDomain.getPageSize(); |
|
|
|
|
|
|
|
// PageHelper 仅对第一个 List 分页
|
|
|
|
Page<BaseEmpRequisiteOrderVO> list = (Page<BaseEmpRequisiteOrderVO>) baseEmpRequisiteOrderMapper.selectBaseEmpRequisiteOrderList(baseEmpRequisiteOrderVO); |
|
|
|
Page<BaseEmpRequisiteOrderVO> returnList = new Page<>(); |
|
|
|
PageHelper.startPage(pageNum, pageSize); |
|
|
|
//PageHelper 仅对第一List分页有效
|
|
|
|
PageInfo<BaseEmpRequisiteOrderVO> pageInfo = new PageInfo<>(matchedList); |
|
|
|
// Page<BaseRequisitioningOrderVo> list = (Page<BaseRequisitioningOrderVo>) pageInfo.getList();
|
|
|
|
List<BaseEmpRequisiteOrderVO> list = pageInfo.getList(); |
|
|
|
Page<BaseEmpRequisiteOrderVO> returnList = new Page<>(); |
|
|
|
for (BaseEmpRequisiteOrderVO tempRequisiteVO: list) { |
|
|
|
SysUser sysUser = userMapper.selectUserByLoginName(tempRequisiteVO.getCreateBy()); |
|
|
|
if (sysUser != null) { |
|
|
@ -147,9 +168,15 @@ public class BaseEmpRequisiteOrderServiceImpl implements IBaseEmpRequisiteOrderS |
|
|
|
} else { |
|
|
|
tempRequisiteVO.setTaskName("未启动"); |
|
|
|
} |
|
|
|
tempRequisiteVO.setTaskStatus(tempRequisiteVO.getTaskName()); |
|
|
|
if(tempRequisiteVO.getAuditStatus()!=null && tempRequisiteVO.getAuditStatus().equals("1")){ |
|
|
|
tempRequisiteVO.setTaskStatus("审核通过"); |
|
|
|
}else if(tempRequisiteVO.getAuditStatus()!=null && tempRequisiteVO.getAuditStatus().equals("2")){ |
|
|
|
tempRequisiteVO.setTaskStatus("审核拒绝"); |
|
|
|
} |
|
|
|
returnList.add(tempRequisiteVO); |
|
|
|
} |
|
|
|
returnList.setTotal(org.springframework.util.CollectionUtils.isEmpty(list) ? 0 : list.getTotal()); |
|
|
|
returnList.setTotal(org.springframework.util.CollectionUtils.isEmpty(list) ? 0 : list.size()); |
|
|
|
returnList.setPageNum(pageNum); |
|
|
|
returnList.setPageSize(pageSize); |
|
|
|
return returnList; |
|
|
@ -193,10 +220,10 @@ public class BaseEmpRequisiteOrderServiceImpl implements IBaseEmpRequisiteOrderS |
|
|
|
baseEmpRequisiteOrderVO.setMaterialAmount(Long.valueOf(childList.size())); |
|
|
|
} |
|
|
|
// baseEmpRequisiteOrderVO.setUseStatus("1");
|
|
|
|
baseEmpRequisiteOrderVO.setRequisitieStatus("0"); |
|
|
|
baseEmpRequisiteOrderVO.setMaterialSum(materialSum); |
|
|
|
baseEmpRequisiteOrderVO.setRmbSum(materialRmbSum); |
|
|
|
baseEmpRequisiteOrderVO.setNoRmbSum(materialNoRmbSum); |
|
|
|
System.out.println(baseEmpRequisiteOrderVO); |
|
|
|
return baseEmpRequisiteOrderMapper.insertBaseEmpRequisiteOrder(baseEmpRequisiteOrderVO); |
|
|
|
} |
|
|
|
|
|
|
@ -317,7 +344,7 @@ public class BaseEmpRequisiteOrderServiceImpl implements IBaseEmpRequisiteOrderS |
|
|
|
updateBaseEmpRequisiteOrder(baseEmpRequisiteOrderVO); |
|
|
|
} |
|
|
|
// 启动流程
|
|
|
|
String applyTitle = user.getUserName()+"发起了委外报价提交审批-"+DateUtils.dateTimeNow(); |
|
|
|
String applyTitle = user.getUserName()+"发起了员工领料提交审批-"+DateUtils.dateTimeNow(); |
|
|
|
String instanceType = "submit"; |
|
|
|
ProcessInstance processInstance = startProcessInstance(applyTitle,instanceType,baseEmpRequisiteOrderVO, user); |
|
|
|
String processInstanceId = processInstance.getProcessInstanceId(); |
|
|
@ -335,7 +362,7 @@ public class BaseEmpRequisiteOrderServiceImpl implements IBaseEmpRequisiteOrderS |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 创建委外报价审核流程 |
|
|
|
* 创建员工领料审核流程 |
|
|
|
* @param applyTitle |
|
|
|
* @param instanceType |
|
|
|
* @param user |
|
|
@ -362,9 +389,53 @@ public class BaseEmpRequisiteOrderServiceImpl implements IBaseEmpRequisiteOrderS |
|
|
|
* */ |
|
|
|
private void buildAuthority(SysUser user, Map<String, Object> variables) { |
|
|
|
Set<String> roleKeys = roleService.selectRoleKeys(user.getUserId()); |
|
|
|
// 角色不同审核人不同
|
|
|
|
if(roleKeys.contains("scyRole")){ |
|
|
|
variables.put("authority",1); |
|
|
|
|
|
|
|
variables.put("authority",1); |
|
|
|
//判断领料人的角色,进入相应的逻辑,设置节点审批人变量
|
|
|
|
if(roleKeys.contains("ywyRole") || roleKeys.contains("ywjlRole") || roleKeys.contains("ywzgRole")){ |
|
|
|
// 业务经理
|
|
|
|
variables.put("bmjlRole","ywjlRole"); |
|
|
|
// 业务主管
|
|
|
|
variables.put("bmzgRole","ywzgRole"); |
|
|
|
}else if(roleKeys.contains("cgyRole") || roleKeys.contains("cgjlRole") || roleKeys.contains("cgzgRole")){ |
|
|
|
// 采购经理
|
|
|
|
variables.put("bmjlRole","cgjlRole"); |
|
|
|
// 采购主管
|
|
|
|
variables.put("bmzgRole","cgzgRole"); |
|
|
|
}else if(roleKeys.contains("wwyRole") || roleKeys.contains("wwjlRole") || roleKeys.contains("wwzgRole")){ |
|
|
|
// 委外经理
|
|
|
|
variables.put("bmjlRole","wwjlRole"); |
|
|
|
// 委外主管
|
|
|
|
variables.put("bmzgRole","wwzgRole"); |
|
|
|
}else if (roleKeys.contains("gcwyRole") || roleKeys.contains("gcjlRole") || roleKeys.contains("gczgRole")){ |
|
|
|
// 工程经理
|
|
|
|
variables.put("bmjlRole","gcjlRole"); |
|
|
|
// 工程主管
|
|
|
|
variables.put("bmzgRole","gczgRole"); |
|
|
|
} else if (roleKeys.contains("scyRole") || roleKeys.contains("scjlRole") || roleKeys.contains("sczgRole")){ |
|
|
|
// 生产经理
|
|
|
|
variables.put("bmjlRole","scjlRole"); |
|
|
|
// 生产主管
|
|
|
|
variables.put("bmzgRole","sczgRole"); |
|
|
|
}else if (roleKeys.contains("shgcsRole") || roleKeys.contains("shjlRole") || roleKeys.contains("shzgRole")){ |
|
|
|
// 售后经理
|
|
|
|
variables.put("bmjlRole","shjlRole"); |
|
|
|
// 售后主管
|
|
|
|
variables.put("bmzgRole","shzgRole"); |
|
|
|
}else if(roleKeys.contains("cgyyRole") || roleKeys.contains("ckjlRole") || roleKeys.contains("ckzgRole")){ |
|
|
|
variables.put("bmjlRole","ckjlRole"); |
|
|
|
// 仓库主管
|
|
|
|
variables.put("bmzgRole","ckzgRole"); |
|
|
|
}else if (roleKeys.contains("cwRole") || roleKeys.contains("cwjlRole")|| roleKeys.contains("cwzgRole")){ |
|
|
|
variables.put("bmjlRole","cwjlRole"); |
|
|
|
// 财务主管
|
|
|
|
variables.put("bmzgRole","cwzgRole"); |
|
|
|
}else{ |
|
|
|
variables.put("authority",2); |
|
|
|
} |
|
|
|
if(roleKeys.contains("admin")){ |
|
|
|
// 角色包含业务经理、采购经理、工程经理、生产经理
|
|
|
|
variables.put("authority",2); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|