zhc4dev
喻忠伟 2 years ago
parent b43a2bcf2d
commit 9de02a141e
  1. 17
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zygoods/service/IZyGoodsService.java
  2. 115
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zygoods/service/impl/ZyGoodsServiceImpl.java
  3. 4
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/workorder/service/IWorkOrderService.java
  4. 27
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/workorder/service/impl/WorkOrderServiceImpl.java

@ -3,6 +3,8 @@ package org.jeecg.modules.demo.zygoods.service;
import org.jeecg.modules.demo.ordergoods.entity.OrderGoodsJk;
import org.jeecg.modules.demo.zygoods.entity.ZyGoods;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.system.entity.SysDepart;
import org.jeecg.modules.system.entity.SysUser;
import java.util.List;
@ -16,5 +18,20 @@ public interface IZyGoodsService extends IService<ZyGoods> {
public List<ZyGoods> selectByMainId(String mainId);
//随机获取商品
List<OrderGoodsJk> SJgetOrder();
/**
* 根据商品ID获取销售部门
* @return
*/
SysDepart getSalesEnterprise(String goodsId);
/**
* 根据商品ID获取销售人员
* @return
*/
SysUser getSalesperson(String goodsId);
/**
* 获取物流信息
* @return
*/
SysDepart getLogisticsEnterprises();
}

@ -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;
}
}

@ -9,6 +9,8 @@ import org.jeecg.modules.demo.zyorders.entity.ZyOrders;
import org.jeecg.modules.workorder.entity.WorkOrder;
import org.jeecg.modules.workorder.entity.WorkOrderVo;
import java.util.List;
/**
* @Description: 工单订单完工
* @Author: jeecg-boot
@ -24,4 +26,6 @@ public interface IWorkOrderService extends IService<WorkOrder> {
Result<?> paidan(ZyOrders zyOrders,String depId);
Result<?> cancellationWorkOrder(WorkOrder woModel);
void jobPaidan(List<String> orderIds);
}

@ -44,6 +44,8 @@ import org.jeecg.modules.productprocessaccessories.entity.ProductProcessAccessor
import org.jeecg.modules.productprocessaccessories.mapper.ProductProcessAccessoriesMapper;
import org.jeecg.modules.productprocessfabric.entity.ProductProcessFabric;
import org.jeecg.modules.productprocessfabric.mapper.ProductProcessFabricMapper;
import org.jeecg.modules.system.entity.SysDepart;
import org.jeecg.modules.system.mapper.SysDepartMapper;
import org.jeecg.modules.workorder.entity.WorkOrder;
import org.jeecg.modules.workorder.entity.WorkOrderVo;
import org.jeecg.modules.workorder.mapper.WorkOrderMapper;
@ -77,6 +79,10 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder
@Autowired
private ZyOrdersMapper zyOrdersMapper;
//部门
@Autowired
private SysDepartMapper sysDepartMapper;
//订单商品
@Autowired
private OrderGoodsMapper orderGoodsMapper;
@ -493,6 +499,25 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder
return Result.OK("成功");
}
@Override
public void jobPaidan(List<String> orderIds) {
//获取生产部门
QueryWrapper<SysDepart> queryWrapper=new QueryWrapper();
queryWrapper.eq("org_category",2);
List<SysDepart> sysDepList = sysDepartMapper.selectList(queryWrapper);
if(sysDepList.size()>0)
{
int r=(int)Math.random() * sysDepList.size();
SysDepart dep=sysDepList.get(r);
for(String orderId:orderIds)
{
ZyOrders model=zyOrdersMapper.selectById(orderId);
this.paidan(model,dep.getId());
}
}
}
//生成工单编号
@ -532,4 +557,6 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder
String produceCode = workCode+substr+str;
return produceCode;
}
}

Loading…
Cancel
Save