|
|
|
@ -5,6 +5,10 @@ import org.jeecg.modules.demo.ordergoods.entity.OrderGoodsJk; |
|
|
|
|
import org.jeecg.modules.demo.zygoods.entity.ZyGoods; |
|
|
|
|
import org.jeecg.modules.demo.zygoods.mapper.ZyGoodsMapper; |
|
|
|
|
import org.jeecg.modules.demo.zygoods.service.IZyGoodsService; |
|
|
|
|
import org.jeecg.modules.system.entity.SysDepart; |
|
|
|
|
import org.jeecg.modules.system.entity.SysUser; |
|
|
|
|
import org.jeecg.modules.system.mapper.SysDepartMapper; |
|
|
|
|
import org.jeecg.modules.system.mapper.SysUserMapper; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
@ -24,6 +28,15 @@ public class ZyGoodsServiceImpl extends ServiceImpl<ZyGoodsMapper, ZyGoods> impl |
|
|
|
|
@Autowired |
|
|
|
|
private ZyGoodsMapper zyGoodsMapper; |
|
|
|
|
|
|
|
|
|
//部门
|
|
|
|
|
@Autowired |
|
|
|
|
private SysDepartMapper sysDepartMapper; |
|
|
|
|
//用户
|
|
|
|
|
@Autowired |
|
|
|
|
private SysUserMapper sysUserMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<ZyGoods> selectByMainId(String mainId) { |
|
|
|
|
return zyGoodsMapper.selectByMainId(mainId); |
|
|
|
@ -67,5 +80,107 @@ public class ZyGoodsServiceImpl extends ServiceImpl<ZyGoodsMapper, ZyGoods> impl |
|
|
|
|
|
|
|
|
|
return orderGoodsJkList; |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 根据商品ID获取销售部门 |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public SysDepart getSalesEnterprise(String goodsId) { |
|
|
|
|
//根据商品id查找商品
|
|
|
|
|
ZyGoods goods=zyGoodsMapper.selectById(goodsId); |
|
|
|
|
//根据企业id 查找部门id和父id等于企业id的部门列表
|
|
|
|
|
QueryWrapper<SysDepart> queryWrapper=new QueryWrapper(); |
|
|
|
|
queryWrapper.and(wrapper -> wrapper.eq("id", goods.getEnterprisesId()) |
|
|
|
|
.or().eq("parent_id", goods.getEnterprisesId()) |
|
|
|
|
); |
|
|
|
|
List<SysDepart> depList=sysDepartMapper.selectList(queryWrapper); |
|
|
|
|
//如果部门列表中有网店类型返回,如果没有则返回第一个部门
|
|
|
|
|
if(depList.size()>0) |
|
|
|
|
{ |
|
|
|
|
SysDepart model=depList.get(0); |
|
|
|
|
for(SysDepart dep:depList) |
|
|
|
|
{ |
|
|
|
|
if(dep.getOrgCategory().trim().equals("4")) |
|
|
|
|
{ |
|
|
|
|
model=dep; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return model; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 根据商品ID获取销售人员 |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public SysUser getSalesperson(String goodsId) { |
|
|
|
|
//根据商品id查找商品
|
|
|
|
|
ZyGoods goods=zyGoodsMapper.selectById(goodsId); |
|
|
|
|
//根据企业id 查找部门id和父id等于企业id的部门列表
|
|
|
|
|
QueryWrapper<SysDepart> queryWrapper=new QueryWrapper(); |
|
|
|
|
|
|
|
|
|
//查找网店类型部门
|
|
|
|
|
queryWrapper.eq("org_category", "4"); |
|
|
|
|
queryWrapper.and(wrapper -> wrapper.eq("id", goods.getEnterprisesId()) |
|
|
|
|
.or().eq("parent_id", goods.getEnterprisesId()) |
|
|
|
|
); |
|
|
|
|
List<SysDepart> depList=sysDepartMapper.selectList(queryWrapper); |
|
|
|
|
List<String> orgCodeList=new ArrayList<>(); |
|
|
|
|
if(depList.size()>0) |
|
|
|
|
{//如果存在网店类型部门在根据部门编号查找用户,如果用户不存在则查找所有部门
|
|
|
|
|
for(SysDepart dep:depList) |
|
|
|
|
{ |
|
|
|
|
orgCodeList.add(dep.getOrgCode()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QueryWrapper<SysUser> queryUseerWrapper=new QueryWrapper(); |
|
|
|
|
queryUseerWrapper.in("org_code",orgCodeList); |
|
|
|
|
List<SysUser> userList=sysUserMapper.selectList(queryUseerWrapper); |
|
|
|
|
if(userList.size()>0) |
|
|
|
|
{ |
|
|
|
|
return userList.get(0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//所有部门
|
|
|
|
|
queryWrapper.and(wrapper -> wrapper.eq("id", goods.getEnterprisesId()) |
|
|
|
|
.or().eq("parent_id", goods.getEnterprisesId()) |
|
|
|
|
); |
|
|
|
|
depList=sysDepartMapper.selectList(queryWrapper); |
|
|
|
|
for(SysDepart dep:depList) |
|
|
|
|
{ |
|
|
|
|
orgCodeList.add(dep.getOrgCode()); |
|
|
|
|
} |
|
|
|
|
//该部门所有用户
|
|
|
|
|
QueryWrapper<SysUser> queryUseerWrapper=new QueryWrapper(); |
|
|
|
|
queryUseerWrapper.in("org_code",orgCodeList); |
|
|
|
|
List<SysUser> userList=sysUserMapper.selectList(queryUseerWrapper); |
|
|
|
|
if(userList.size()>0) |
|
|
|
|
{ |
|
|
|
|
return userList.get(0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 获取物流信息 |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public SysDepart getLogisticsEnterprises() { |
|
|
|
|
//查找物流类型部门
|
|
|
|
|
QueryWrapper<SysDepart> queryWrapper=new QueryWrapper(); |
|
|
|
|
queryWrapper.eq("org_category", "7"); |
|
|
|
|
List<SysDepart> depList=sysDepartMapper.selectList(queryWrapper); |
|
|
|
|
if(depList.size()>0) |
|
|
|
|
{ |
|
|
|
|
return depList.get(0); |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|