|
|
@ -1,6 +1,7 @@ |
|
|
|
package com.ruoyi.system.service.impl; |
|
|
|
|
|
|
|
import com.github.pagehelper.Page; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.ruoyi.common.core.domain.entity.SysUser; |
|
|
|
import com.ruoyi.common.core.page.PageDomain; |
|
|
|
import com.ruoyi.common.core.page.TableSupport; |
|
|
@ -122,31 +123,17 @@ public class SysSalesOrderServiceImpl implements ISysSalesOrderService |
|
|
|
@Override |
|
|
|
public List<SysSalesOrderVo> selectSysSalesOrderList(SysSalesOrderVo sysSalesOrderVo1) |
|
|
|
{ |
|
|
|
|
|
|
|
//PageHelper 仅对第一List分页有效
|
|
|
|
PageDomain pageDomain = TableSupport.buildPageRequest(); |
|
|
|
Integer pageNum = pageDomain.getPageNum(); |
|
|
|
Integer pageSize = pageDomain.getPageSize(); |
|
|
|
SysUser curUser = ShiroUtils.getSysUser(); |
|
|
|
String loginName = ShiroUtils.getLoginName(); |
|
|
|
Long userId = curUser.getUserId(); |
|
|
|
Page<SysSalesOrderVo> returnList = new Page<>(); |
|
|
|
PageHelper.startPage(pageNum, pageSize); |
|
|
|
//PageHelper 仅对第一List分页有效
|
|
|
|
Page<SysSalesOrderVo> list = (Page<SysSalesOrderVo>)sysSalesOrderMapper.selectSysSalesOrderList(sysSalesOrderVo1); |
|
|
|
Set<String> roleKeys = roleService.selectRoleKeys(userId); |
|
|
|
List<SysUser> sysUserlist = sysUserService.selectRoleToUserList("ywyRole"); |
|
|
|
sysUserlist.add(curUser); |
|
|
|
Page<SysSalesOrderVo> list = (Page<SysSalesOrderVo>) sysSalesOrderMapper.selectSysSalesOrderList(sysSalesOrderVo1); |
|
|
|
Page<SysSalesOrderVo> returnList = new Page<>(); |
|
|
|
//如果主管审批,查看当前自己部门的审核
|
|
|
|
//如果经理审计需要查询自己部门下所有业务员的提交的订单,以及自身的提交的订单
|
|
|
|
if (roleKeys.contains("ywjlRole")) { |
|
|
|
List<SysUser> findUser = sysUserlist.stream().filter(item -> (item.getDeptId().equals(curUser.getDeptId()))).collect(Collectors.toList()); |
|
|
|
List<String> user = findUser.stream().map(SysUser::getLoginName).collect(Collectors.toList()); |
|
|
|
String userStr = String.join(",", user); |
|
|
|
sysSalesOrderVo1.setApplyUsers(user); |
|
|
|
list = (Page<SysSalesOrderVo>) sysSalesOrderMapper.selectSysSalesOrderList(sysSalesOrderVo1); |
|
|
|
} |
|
|
|
if (roleKeys.contains("ywyRole")) { |
|
|
|
sysSalesOrderVo1.setApplyUser(curUser.getLoginName()); |
|
|
|
list = (Page<SysSalesOrderVo>) list.stream().filter(item -> item.getApplyUser().equals(curUser.getLoginName())).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
for(SysSalesOrderVo sysSalesOrderVo : list){ |
|
|
|
SysUser sysUser = userMapper.selectUserByLoginName(sysSalesOrderVo.getCreateBy()); |
|
|
|
if (sysUser != null) { |
|
|
@ -240,18 +227,19 @@ public class SysSalesOrderServiceImpl implements ISysSalesOrderService |
|
|
|
//获取传输的销售订单物料报价信息
|
|
|
|
List<SysSalesOrderChild> sysSalesOrderChildList = sysSalesOrder.getSysSalesOrderChildList(); |
|
|
|
sysSalesOrderChildService.deleteSysSalesOrderChildByQuoteId(sysSalesOrder.getSalesOrderCode()); |
|
|
|
for (int i = 0; i < sysSalesOrderChildList.size(); i++) { |
|
|
|
SysSalesOrderChild sysSalesOrderChild = sysSalesOrderChildList.get(i); |
|
|
|
sysSalesOrderChild.setQuoteId(sysSalesOrder.getSalesOrderCode()); |
|
|
|
sysSalesOrderChild.setCreateBy(loginName); |
|
|
|
sysSalesOrderChild.setCreateTime(DateUtils.getNowDate()); |
|
|
|
sysSalesOrderChild.setUpdateBy(loginName); |
|
|
|
sysSalesOrderChild.setUpdateTime(DateUtils.getNowDate()); |
|
|
|
sysSalesOrderChildService.insertSysSalesOrderChild(sysSalesOrderChild); |
|
|
|
} |
|
|
|
for (int i = 0; i < sysSalesOrderChildList.size(); i++) { |
|
|
|
SysSalesOrderChild sysSalesOrderChild = sysSalesOrderChildList.get(i); |
|
|
|
sysSalesOrderChild.setQuoteId(sysSalesOrder.getSalesOrderCode()); |
|
|
|
sysSalesOrderChild.setCreateBy(loginName); |
|
|
|
sysSalesOrderChild.setCreateTime(DateUtils.getNowDate()); |
|
|
|
sysSalesOrderChild.setUpdateBy(loginName); |
|
|
|
sysSalesOrderChild.setUpdateTime(DateUtils.getNowDate()); |
|
|
|
sysSalesOrderChildService.insertSysSalesOrderChild(sysSalesOrderChild); |
|
|
|
} |
|
|
|
} |
|
|
|
int result = sysSalesOrderMapper.updateSysSalesOrder(sysSalesOrder); |
|
|
|
return result; |
|
|
|
return sysSalesOrderMapper.updateSysSalesOrder(sysSalesOrder); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
/** |
|
|
|
* 删除销售订单对象 |
|
|
|