Commit b3ce42e9 by zhengxj

finish 数据权限限制 on 20190319 by zhengxj

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@18671 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent 05460a07
......@@ -221,13 +221,6 @@ public class OrderServiceImpl implements IOrderService {
// TODO 根据用户类型管理订单
// 如果当前用户是商户 限制搜索范围
byte userType = user.getByte("userType");
// if (userType == 1) {
//// SysMerchantExample sysMerchantExample = new SysMerchantExample();
//// sysMerchantExample.createCriteria().andUserIdEqualTo(userId);
//// SysMerchant sysMerchant = sysMerchantDao.selectByExample(sysMerchantExample).get(0);
// criteria.andMerchantIdEqualTo(userId);
//
// }
//
// 订单渠道过滤
List<Integer> dataRight=new ArrayList<>();
......@@ -252,30 +245,14 @@ public class OrderServiceImpl implements IOrderService {
criteria.andOrderSnLike("%" + oueryOrderReq.getOrderSn() + "%");
}
// 订单渠道 如果当前用户是商户只能搜索当前商户的订单
// if (oueryOrderReq.getOrderChannel() != null) {
//// criteria.andShopIdEqualTo(value)
// if(userType == 0){
//// TODO 查出该用户拥有的数据权限
// List<Integer> merIds=new ArrayList<>();
// criteria.andMerchantIdIn(merIds);
//
// }
// criteria.andMerchantIdEqualTo(oueryOrderReq.getOrderChannel());
// }
// 服务类型
if (oueryOrderReq.getServiceType() != null) {
criteria.andInstallDeviceTypeEqualTo(oueryOrderReq.getServiceType());
// criteria.andServiceTypeEqualTo(oueryOrderReq.getServiceType());
}
// 订单起始日
if (com.glsx.common.utils.StringUtils.isNotEmpty(oueryOrderReq.getDateStart())) {
criteria.andCreateTimeGreaterThanOrEqualTo(DateUtil.parseDateYmd(oueryOrderReq.getDateStart()));
}
// 订单结束日
if (com.glsx.common.utils.StringUtils.isNotEmpty(oueryOrderReq.getDateEnd())) {
Date endDate=DateUtil.parseDateYmd(oueryOrderReq.getDateEnd());
......@@ -348,7 +325,6 @@ public class OrderServiceImpl implements IOrderService {
break;
}
}
} else if (userType == 1) {
// 服务商端
// 待指派(状态1、状态2、状态5)、
......@@ -357,7 +333,6 @@ public class OrderServiceImpl implements IOrderService {
// 已完成(状态8)、
// 已拒绝(状态3)
// criteria.andMerchantIdEqualTo(userId);
if (orderStatus != null) {
switch (orderStatus) {
case 0:
......@@ -392,7 +367,6 @@ public class OrderServiceImpl implements IOrderService {
} else if(orderStatus != null && orderStatus > 0) {
criteria.andActiveStatusEqualTo(orderStatus).andCanceledEqualTo((byte)1);
}
}
if (oueryOrderReq.getMachanicInfo() != null) {
SysUserExample userExample = new SysUserExample();
......@@ -429,36 +403,22 @@ public class OrderServiceImpl implements IOrderService {
meExample.createCriteria().andUserIdIn(Ids);
mechanincs = sysMechanicDao.selectByExample(meExample);
}
// Ids.clear();
for (SysMechanic me : mechanincs) {
Ids.add(me.getId());
}
}
}
// 传递的是技工名字,且搜索不到该技工
if (oueryOrderReq.getMachanicInfo() != null
&& !com.glsx.common.utils.StringUtils.isMobile(oueryOrderReq.getMachanicInfo()) && !(Ids.size() > 0)) {
// Ids.add(Integer.MAX_VALUE);
criteria.andMechanicIdEqualTo(Integer.MAX_VALUE);
criteria.andMechanicIdEqualTo(-200);
}
PageHelper.startPage(page.getPageIndex(), page.getPageSize(), true);
orderList = orderDao.selectByExample(example);
// orderList = orderDao.selectByExample(example);
orderList = orderDao.selectByExample(example);
for (SysOrder order : orderList) {
// 订单地址信息
order.setArea(areaService.getAllChargeItems(order.getDistrict()));
// 渠道名称
// if (order.getMerchantId() != null) {
// // 经产品再次确认 为公司名称 而非门店名称
//// sysUserDao.selectByPrimaryKey(order.getMerchantId());
//// SysMerchantExample sysMerchantExample = new SysMerchantExample();
//// sysMerchantExample.createCriteria().andUserIdEqualTo(order.getShopId());
//// sysMerchantDao.selectByExample(sysMerchantExample);
// order.setOrderChannel(sysUserDao.selectByPrimaryKey(order.getMerchantId()).getUsername());
// }
// 渠道名称
if (oueryOrderReq.getOrderChannel() != null) {
......@@ -466,14 +426,10 @@ public class OrderServiceImpl implements IOrderService {
} else {
SysUser sysuser = sysUserDao.selectByPrimaryKey(order.getShopId());
order.setOrderChannel(orderChannelDao.selectByPrimaryKey(sysuser.getGroupId()).getName());
}
}
// 技工信息
if (order.getMechanicId() != null) {
MachanicInfo machanicInfo = new MachanicInfo();
// SysMechanic sysMechanic =
// sysMechanicDao.selectByPrimaryKey(order.getMechanicId());
SysUser sysUser = sysUserDao.selectByPrimaryKey(order.getMechanicId());
machanicInfo.setId(order.getMechanicId());
// 有可能是username
......@@ -481,7 +437,6 @@ public class OrderServiceImpl implements IOrderService {
machanicInfo.setPhone(sysUser.getPhoneNumber());
order.setMachanicInfo(machanicInfo);
}
}
if (page != null) {
PageHelper.startPage(page.getPageIndex(), page.getPageSize(), true);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!