zhc4dev
喻忠伟 2 years ago
parent 4d098bead9
commit 7c4eba5921
  1. 62
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zygoods/service/impl/ZyGoodsServiceImpl.java
  2. 18
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/controller/ZyOrdersController.java
  3. 10
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/service/IZyOrdersService.java
  4. 241
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/service/impl/ZyOrdersServiceImpl.java
  5. 2
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/workorder/service/IWorkOrderService.java
  6. 23
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/workorder/service/impl/WorkOrderServiceImpl.java

@ -7,7 +7,9 @@ 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.entity.SysUserDepart;
import org.jeecg.modules.system.mapper.SysDepartMapper;
import org.jeecg.modules.system.mapper.SysUserDepartMapper;
import org.jeecg.modules.system.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -31,6 +33,10 @@ public class ZyGoodsServiceImpl extends ServiceImpl<ZyGoodsMapper, ZyGoods> impl
//部门
@Autowired
private SysDepartMapper sysDepartMapper;
//部门-用户
@Autowired
private SysUserDepartMapper sysUserDepartMapper;
//用户
@Autowired
private SysUserMapper sysUserMapper;
@ -129,40 +135,62 @@ public class ZyGoodsServiceImpl extends ServiceImpl<ZyGoodsMapper, ZyGoods> impl
.or().eq("parent_id", goods.getEnterprisesId())
);
List<SysDepart> depList=sysDepartMapper.selectList(queryWrapper);
List<String> orgCodeList=new ArrayList<>();
List<String> depIdsList=new ArrayList<>();
if(depList.size()>0)
{//如果存在网店类型部门在根据部门编号查找用户,如果用户不存在则查找所有部门
for(SysDepart dep:depList)
{
orgCodeList.add(dep.getOrgCode());
depIdsList.add(dep.getId());
}
//根据部门id查找对应用户
QueryWrapper<SysUserDepart> qwUserDepar=new QueryWrapper();
//qwUserDepar.select("DISTINCT user_id").in("dep_id",depIdsList);
qwUserDepar.in("dep_id",depIdsList);
List<SysUserDepart> udList=sysUserDepartMapper.selectList(qwUserDepar);
if(udList.size()>0)
{//根据查找得到数据 从中查询用户
QueryWrapper<SysUser> queryUseerWrapper=new QueryWrapper();
queryUseerWrapper.in("org_code",orgCodeList);
List<SysUser> userList=sysUserMapper.selectList(queryUseerWrapper);
if(userList.size()>0)
{
return userList.get(0);
SysUser userModel=sysUserMapper.selectById(udList.get(0).getUserId());
return userModel;
}
}
//
QueryWrapper<SysDepart> queryWrapper1=new QueryWrapper();
//所有部门
queryWrapper.and(wrapper -> wrapper.eq("id", goods.getEnterprisesId())
queryWrapper1.and(wrapper -> wrapper.eq("id", goods.getEnterprisesId())
.or().eq("parent_id", goods.getEnterprisesId())
);
depList=sysDepartMapper.selectList(queryWrapper);
depList=sysDepartMapper.selectList(queryWrapper1);
if(depList.size()>0)
{
for(SysDepart dep:depList)
{
orgCodeList.add(dep.getOrgCode());
depIdsList.add(dep.getId());
}
//该部门所有用户
QueryWrapper<SysUser> queryUseerWrapper=new QueryWrapper();
queryUseerWrapper.in("org_code",orgCodeList);
List<SysUser> userList=sysUserMapper.selectList(queryUseerWrapper);
if(userList.size()>0)
if(depIdsList.size()>0)
{
return userList.get(0);
//根据部门id查找对应用户
QueryWrapper<SysUserDepart> qwUserDepar1=new QueryWrapper();
// qwUserDepar1.select("DISTINCT user_id").in("dep_id",depIdsList);
qwUserDepar1.in("dep_id",depIdsList);
List<SysUserDepart> udList=sysUserDepartMapper.selectList(qwUserDepar1);
//该部门所有用户
if(udList.size()>0)
{//根据查找得到数据 从中查询用户
SysUser userModel=sysUserMapper.selectById(udList.get(0).getUserId());
return userModel;
}
}
}
return null;
}

@ -138,8 +138,7 @@ public class ZyOrdersController extends JeecgController<ZyOrders, IZyOrdersServi
*/
@AutoLog(value = "订单和订单商品接口")
@ApiOperation(value="订单和订单商品接口", notes="订单和订单商品接口")
@GetMapping(value = "/orderJk")
public Result<?> orderJk(ZyOrdersJk zyOrdersJk,List<OrderGoodsJk> orderGoodsJkList,HttpServletRequest req) {
public List<String> orderJk(ZyOrdersJk zyOrdersJk,List<OrderGoodsJk> orderGoodsJkList) {
Double actual_payment = 0.00;
Double money = 0.00;
for(int i = 0 ; i < orderGoodsJkList.size() ; i++){
@ -207,7 +206,7 @@ public class ZyOrdersController extends JeecgController<ZyOrders, IZyOrdersServi
orderGoods.setPayTotalPrice(zyGoods.getPromotionPrice()*orderGoodsJkList.get(j).getGoodsNum());
orderGoodsService.save(orderGoods);
GoodsModule goodsModule = new GoodsModule();
QueryWrapper<GoodsModule> queryWrapperzsm = QueryGenerator.initQueryWrapper(goodsModule, req.getParameterMap());
QueryWrapper<GoodsModule> queryWrapperzsm = new QueryWrapper();
queryWrapperzsm.eq("goods_id",zyGoods.getId());
queryWrapperzsm.eq("style_id",zyGoods.getStyleId());
List<GoodsModule> listzsm = goodsModuleService.list(queryWrapperzsm);
@ -221,7 +220,7 @@ public class ZyOrdersController extends JeecgController<ZyOrders, IZyOrdersServi
orderGoodsModuleService.save(orderGoodsModule);
}
GoodsFabric goodsFabric = new GoodsFabric();
QueryWrapper<GoodsFabric> queryWrapperzsf = QueryGenerator.initQueryWrapper(goodsFabric, req.getParameterMap());
QueryWrapper<GoodsFabric> queryWrapperzsf =new QueryWrapper();
queryWrapperzsf.eq("goods_id",zyGoods.getId());
List<GoodsFabric> listzsf = goodsFabricService.list(queryWrapperzsf);
for (int o = 0 ; o < listzsf.size() ; o++){
@ -232,7 +231,7 @@ public class ZyOrdersController extends JeecgController<ZyOrders, IZyOrdersServi
orderGoodsFabricService.save(orderGoodsFabric);
}
GoodsAccessories goodsAccessories = new GoodsAccessories();
QueryWrapper<GoodsAccessories> queryWrapperzsa = QueryGenerator.initQueryWrapper(goodsAccessories, req.getParameterMap());
QueryWrapper<GoodsAccessories> queryWrapperzsa = new QueryWrapper();
queryWrapperzsa.eq("goods_id",zyGoods.getId());
List<GoodsAccessories> listzsa = goodsAccessoriesService.list(queryWrapperzsa);
for (int p = 0 ; p < listzsa.size() ; p++){
@ -247,14 +246,15 @@ public class ZyOrdersController extends JeecgController<ZyOrders, IZyOrdersServi
}
List<String> ids = new ArrayList<>();
ZyOrders zos = new ZyOrders();
QueryWrapper<ZyOrders> queryWrapperzos = QueryGenerator.initQueryWrapper(zos, req.getParameterMap());
QueryWrapper<ZyOrders> queryWrapperzos = new QueryWrapper();
queryWrapperzos.eq("order_id",zyOrders.getId());
List<ZyOrders> listzos = zyOrdersService.list(queryWrapperzos);
if(listzos.size()>0){
return Result.error("该订单已经拆分,不可以再次拆单!");
//return Result.error("该订单已经拆分,不可以再次拆单!");
return null;
}else{
OrderGoods orderGoods = new OrderGoods();
QueryWrapper<OrderGoods> queryWrapperog = QueryGenerator.initQueryWrapper(orderGoods, req.getParameterMap());
QueryWrapper<OrderGoods> queryWrapperog = new QueryWrapper();
queryWrapperog.eq("orders_id",zyOrders.getId());
List<OrderGoods> listog = orderGoodsService.list(queryWrapperog);
if(listog.size()>0){
@ -279,7 +279,7 @@ public class ZyOrdersController extends JeecgController<ZyOrders, IZyOrdersServi
}
}
}
return Result.OK(ids);
return ids;
}

@ -1,8 +1,10 @@
package org.jeecg.modules.demo.zyorders.service;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.demo.ordergoods.entity.OrderGoodsJk;
import org.jeecg.modules.demo.zyorders.entity.ZyOrders;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.demo.zyorders.entity.ZyOrdersJk;
import org.jeecg.modules.orderbymakeclothplan.vo.TodayOrderAndQIriVo;
import java.util.List;
@ -21,4 +23,12 @@ public interface IZyOrdersService extends IService<ZyOrders> {
List<ZyOrders> getOldOrder();
//大屏数据-获取今日订单及七日订单
TodayOrderAndQIriVo getOrder();
/**
*订单和订单商品接口
* @param ordersJk
* @param ogjkList
* @return
*/
List<String> orderJk(ZyOrdersJk ordersJk, List<OrderGoodsJk> ogjkList);
}

@ -1,15 +1,39 @@
package org.jeecg.modules.demo.zyorders.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.jeecg.modules.demo.customerinvoice.entity.CustomerInvoice;
import org.jeecg.modules.demo.customerinvoice.mapper.CustomerInvoiceMapper;
import org.jeecg.modules.demo.customerreceivingaddress.entity.CustomerReceivingAddress;
import org.jeecg.modules.demo.customerreceivingaddress.mapper.CustomerReceivingAddressMapper;
import org.jeecg.modules.demo.goodsaccessories.entity.GoodsAccessories;
import org.jeecg.modules.demo.goodsaccessories.mapper.GoodsAccessoriesMapper;
import org.jeecg.modules.demo.goodsfabric.entity.GoodsFabric;
import org.jeecg.modules.demo.goodsfabric.mapper.GoodsFabricMapper;
import org.jeecg.modules.demo.goodsmodule.entity.GoodsModule;
import org.jeecg.modules.demo.goodsmodule.mapper.GoodsModuleMapper;
import org.jeecg.modules.demo.ordergoods.entity.OrderGoods;
import org.jeecg.modules.demo.ordergoods.entity.OrderGoodsJk;
import org.jeecg.modules.demo.ordergoods.mapper.OrderGoodsMapper;
import org.jeecg.modules.demo.ordergoodsaccessories.entity.OrderGoodsAccessories;
import org.jeecg.modules.demo.ordergoodsaccessories.mapper.OrderGoodsAccessoriesMapper;
import org.jeecg.modules.demo.ordergoodsfabric.entity.OrderGoodsFabric;
import org.jeecg.modules.demo.ordergoodsfabric.mapper.OrderGoodsFabricMapper;
import org.jeecg.modules.demo.ordergoodsmodule.entity.OrderGoodsModule;
import org.jeecg.modules.demo.ordergoodsmodule.mapper.OrderGoodsModuleMapper;
import org.jeecg.modules.demo.zygoods.entity.ZyGoods;
import org.jeecg.modules.demo.zygoods.mapper.ZyGoodsMapper;
import org.jeecg.modules.demo.zyorders.entity.ZyOrders;
import org.jeecg.modules.demo.zyorders.entity.ZyOrdersJk;
import org.jeecg.modules.demo.zyorders.mapper.ZyOrdersMapper;
import org.jeecg.modules.demo.zyorders.service.IZyOrdersService;
import org.jeecg.modules.orderbymakeclothplan.vo.TodayOrderAndQIriVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@ -23,6 +47,52 @@ import java.util.List;
@Service
public class ZyOrdersServiceImpl extends ServiceImpl<ZyOrdersMapper, ZyOrders> implements IZyOrdersService {
//商品
@Autowired
private ZyGoodsMapper zyGoodsMapper;
//订单商品表
@Autowired
private OrderGoodsMapper zyOrderGoodsMapper;
//商品模块表
@Autowired
private GoodsModuleMapper zyGoodsModuleMapper;
//订单商品模块表
@Autowired
private OrderGoodsModuleMapper zyOrderGoodsModuleMapper;
//商品面料表
@Autowired
private GoodsFabricMapper zyGoodsFabricMapper;
//订单商品面料表
@Autowired
private OrderGoodsFabricMapper zyOrderGoodsFabricMapper;
//商品辅料表
@Autowired
private GoodsAccessoriesMapper zyGoodsAccessoriesMapper;
//订单商品辅料表
@Autowired
private OrderGoodsAccessoriesMapper zyOrderGoodsAccessoriesMapper;
//顾客地址表
@Autowired
CustomerReceivingAddressMapper customerReceivingAddressMapper;
//客户发票信息
@Autowired
CustomerInvoiceMapper customerInvoiceMapper;
/**
* 大屏数据-获取订单的状态
* @return
@ -90,4 +160,175 @@ public class ZyOrdersServiceImpl extends ServiceImpl<ZyOrdersMapper, ZyOrders> i
}
}
/**
*
* @param zyOrdersJk
* @param orderGoodsJkList
* @return
*/
@Override
public List<String> orderJk(ZyOrdersJk zyOrdersJk, List<OrderGoodsJk> orderGoodsJkList) {
Double actual_payment = 0.00;
Double money = 0.00;
for(int i = 0 ; i < orderGoodsJkList.size() ; i++){
ZyGoods zyGoods = zyGoodsMapper.selectById(orderGoodsJkList.get(i).getGoodsId());
money = money + zyGoods.getUnitPrice()*orderGoodsJkList.get(i).getGoodsNum();
actual_payment = actual_payment + zyGoods.getPromotionPrice()*orderGoodsJkList.get(i).getGoodsNum();
}
ZyOrders zyOrders = new ZyOrders();
zyOrders.setIschild(0);
zyOrders.setOrderTime(new Date());
zyOrders.setOrdersNum(getOrdersNum());
zyOrders.setMoney(money);
zyOrders.setFreight(zyOrdersJk.getFreight());
zyOrders.setPromotionPrice(money-actual_payment);
zyOrders.setActualPayment(actual_payment);
zyOrders.setDeliveryTime(zyOrdersJk.getDeliveryTime());
zyOrders.setOrdersType(zyOrdersJk.getOrdersType());
zyOrders.setUserId(zyOrdersJk.getUserId());
zyOrders.setGoodsQuantity(zyOrdersJk.getGoodsQuantity());
CustomerReceivingAddress customerReceivingAddress = customerReceivingAddressMapper.selectById(zyOrdersJk.getAddressId());
zyOrders.setCityId(customerReceivingAddress.getCityId());
zyOrders.setAddress(customerReceivingAddress.getAddress());
zyOrders.setZipCode(customerReceivingAddress.getZipCode());
zyOrders.setReceiver(zyOrdersJk.getReceiver());
zyOrders.setMobile(customerReceivingAddress.getMobile());
CustomerInvoice customerInvoice = customerInvoiceMapper.selectById(zyOrdersJk.getInvoiceId());
zyOrders.setInvoiceCustomerType(Integer.parseInt(customerInvoice.getCustomerType()));
zyOrders.setInvoiceType(Integer.parseInt(customerInvoice.getInvoiceType()));
zyOrders.setTaxIdentificationNumber(customerInvoice.getTaxIdentificationNumber());
zyOrders.setAddressBilling(customerInvoice.getAddress());
zyOrders.setTelephone(customerInvoice.getTelephone());
zyOrders.setBankPublic(customerInvoice.getBankDeposit());
zyOrders.setAccountNumber(customerInvoice.getAccountNumber());
zyOrders.setSalesEnterpriseId(zyOrdersJk.getSalesEnterpriseId());
zyOrders.setSalespersonId(zyOrdersJk.getSalespersonId());
zyOrders.setLogisticsEnterprisesId(zyOrdersJk.getLogisticsEnterprisesId());
zyOrders.setDeliveryStatus(0);
baseMapper.insert(zyOrders);
for(int j = 0 ; j < orderGoodsJkList.size() ; j++){
ZyGoods zyGoods = zyGoodsMapper.selectById(orderGoodsJkList.get(j).getGoodsId());
OrderGoods orderGoods = new OrderGoods();
orderGoods.setOrdersId(zyOrders.getId());
orderGoods.setGoodsId(orderGoodsJkList.get(j).getGoodsId());
orderGoods.setGoodsNum(orderGoodsJkList.get(j).getGoodsNum());
orderGoods.setGoodsCode(zyGoods.getGoodsCode());
orderGoods.setGoodsName(zyGoods.getGoodsName());
orderGoods.setGoodsIntr(zyGoods.getGoodsIntr());
orderGoods.setCustomized(zyGoods.getCustomized());
orderGoods.setMeasureId(orderGoodsJkList.get(j).getMeasureId());
orderGoods.setGoodsPicture(zyGoods.getGoodsPicture());
orderGoods.setDefaultPicture(zyGoods.getDefaultPicture());
orderGoods.setGoodsVideo(zyGoods.getGoodsVideo());
orderGoods.setClothsTypeId(zyGoods.getClothsTypeId());
orderGoods.setStyleId(zyGoods.getStyleId());
orderGoods.setModelId(zyGoods.getModelId());
orderGoods.setUnit(zyGoods.getUnit());
orderGoods.setNumber(zyGoods.getNumber());
orderGoods.setUnitPrice(zyGoods.getUnitPrice());
orderGoods.setDiscount(zyGoods.getDiscount());
orderGoods.setPromotionPrice(zyGoods.getPromotionPrice());
orderGoods.setRecommend(zyGoods.getRecommend());
orderGoods.setPlaceOrigin(zyGoods.getPlaceOrigin());
orderGoods.setStatus(zyGoods.getStatus());
orderGoods.setTotalPrice(zyGoods.getUnitPrice()*orderGoodsJkList.get(j).getGoodsNum());
orderGoods.setPayTotalPrice(zyGoods.getPromotionPrice()*orderGoodsJkList.get(j).getGoodsNum());
zyOrderGoodsMapper.insert(orderGoods);
GoodsModule goodsModule = new GoodsModule();
QueryWrapper<GoodsModule> queryWrapperzsm = new QueryWrapper();
queryWrapperzsm.eq("goods_id",zyGoods.getId());
queryWrapperzsm.eq("style_id",zyGoods.getStyleId());
List<GoodsModule> listzsm = zyGoodsModuleMapper.selectList(queryWrapperzsm);
for (int k = 0 ; k < listzsm.size() ; k++){
OrderGoodsModule orderGoodsModule = new OrderGoodsModule();
orderGoodsModule.setOrderGoodsId(orderGoods.getId());
orderGoodsModule.setGoodsId(zyGoods.getId());
orderGoodsModule.setStyleId(zyGoods.getStyleId());
orderGoodsModule.setStyleModuleId(listzsm.get(k).getStyleModuleId());
orderGoodsModule.setModuleId(listzsm.get(k).getModuleId());
zyOrderGoodsModuleMapper.insert(orderGoodsModule);
}
GoodsFabric goodsFabric = new GoodsFabric();
QueryWrapper<GoodsFabric> queryWrapperzsf =new QueryWrapper();
queryWrapperzsf.eq("goods_id",zyGoods.getId());
List<GoodsFabric> listzsf = zyGoodsFabricMapper.selectList(queryWrapperzsf);
for (int o = 0 ; o < listzsf.size() ; o++){
OrderGoodsFabric orderGoodsFabric = new OrderGoodsFabric();
orderGoodsFabric.setOrderGoodsId(orderGoods.getId());
orderGoodsFabric.setGoodsId(zyGoods.getId());
orderGoodsFabric.setFabricId(listzsf.get(o).getFabricId());
zyOrderGoodsFabricMapper.insert(orderGoodsFabric);
}
GoodsAccessories goodsAccessories = new GoodsAccessories();
QueryWrapper<GoodsAccessories> queryWrapperzsa = new QueryWrapper();
queryWrapperzsa.eq("goods_id",zyGoods.getId());
List<GoodsAccessories> listzsa = zyGoodsAccessoriesMapper.selectList(queryWrapperzsa);
for (int p = 0 ; p < listzsa.size() ; p++){
OrderGoodsAccessories orderGoodsAccessories = new OrderGoodsAccessories();
orderGoodsAccessories.setOrderGoodsId(orderGoods.getId());
orderGoodsAccessories.setGoodsId(zyGoods.getId());
orderGoodsAccessories.setAccessoriesId(listzsa.get(p).getAccessoriesId());
zyOrderGoodsAccessoriesMapper.insert(orderGoodsAccessories);
}
}
List<String> ids = new ArrayList<>();
ZyOrders zos = new ZyOrders();
QueryWrapper<ZyOrders> queryWrapperzos = new QueryWrapper();
queryWrapperzos.eq("order_id",zyOrders.getId());
List<ZyOrders> listzos = baseMapper.selectList(queryWrapperzos);
if(listzos.size()>0){
//return Result.error("该订单已经拆分,不可以再次拆单!");
return null;
}else{
OrderGoods orderGoods = new OrderGoods();
QueryWrapper<OrderGoods> queryWrapperog = new QueryWrapper();
queryWrapperog.eq("orders_id",zyOrders.getId());
List<OrderGoods> listog = zyOrderGoodsMapper.selectList(queryWrapperog);
if(listog.size()>0){
for (int i = 0 ; i < listog.size() ; i++){
ZyOrders zo = new ZyOrders();
zo = zyOrders;
zo.setId(null);
zo.setOrdersNum(getOrdersNum());
zo.setFreight(Double.parseDouble("0"));
zo.setIschild(1);
zo.setOrderId(zyOrders.getId());
zo.setMoney(listog.get(i).getTotalPrice());
zo.setPromotionPrice(listog.get(i).getPromotionPrice());
zo.setActualPayment(listog.get(i).getPayTotalPrice());
zo.setGoodsQuantity(1);
baseMapper.insert(zo);
ids.add(zo.getId());
OrderGoods og = new OrderGoods();
og = listog.get(i);
og.setOrdersId(zo.getId());
zyOrderGoodsMapper.updateById(og);
}
}
}
return ids;
}
/**
* 生成订单编号
*
* @param
* @return
*/
public String getOrdersNum() {
String mrstr = "000000000000000000";
QueryWrapper<ZyOrders> qw=new QueryWrapper();
int listsize = baseMapper.selectCount(qw);
int strsize = listsize+1;
String str = strsize+"";
int strlength = str.length();
String substr = mrstr.substring(0,mrstr.length()-strlength);
String OrdersNum = substr+str;
return OrdersNum;
}
}

@ -27,5 +27,5 @@ public interface IWorkOrderService extends IService<WorkOrder> {
Result<?> cancellationWorkOrder(WorkOrder woModel);
void jobPaidan(List<String> orderIds);
List<String> jobPaidan(List<String> orderIds);
}

@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.demo.base.entity.ZyProcess;
import org.jeecg.modules.demo.base.mapper.ZyProcessMapper;
import org.jeecg.modules.demo.customermeasure.entity.CustomerMeasure;
import org.jeecg.modules.demo.customermeasure.mapper.CustomerMeasureMapper;
@ -185,6 +184,8 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder
QueryWrapper<OrderGoods> ogWrapper=new QueryWrapper<OrderGoods>();
ogWrapper.eq("orders_id",orderId);
List<OrderGoods> ogList=orderGoodsMapper.selectList(ogWrapper);
//工单
WorkOrder workOrder=new WorkOrder();
if(ogList.size()>0)
{//start if 02
// 保存工单
@ -218,7 +219,7 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder
//生成工单
int goodNum=ogModel.getGoodsNum();
WorkOrder workOrder=new WorkOrder();
workOrder.setProductCode(CreateWorkCode(csModel.getNums(),smModel.getModelNumber()));//工单编号
workOrder.setOrdersId(orderId);//订单id
workOrder.setOrderGoodsId(ogModel.getId());// 订单商品
@ -436,7 +437,7 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder
//修改订单状态
zyOrders.setDeliveryStatus(3);
zyOrdersMapper.updateById(zyOrders);
return Result.OK("成功");
return Result.OK("成功",workOrder);
}
/**
@ -500,22 +501,32 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder
}
@Override
public void jobPaidan(List<String> orderIds) {
public List<String> jobPaidan(List<String> orderIds) {
//获取生产部门
QueryWrapper<SysDepart> queryWrapper=new QueryWrapper();
queryWrapper.eq("org_category",2);
List<SysDepart> sysDepList = sysDepartMapper.selectList(queryWrapper);
if(sysDepList.size()>0)
{
List<String> wordOderIds=new ArrayList<>();
//生产随机数,然后随机获取生产部门
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());
Result result=this.paidan(model,dep.getId());
if (result.getCode().toString().equals("500"))
{
return null;
}
WorkOrder wo=(WorkOrder)result.getResult();
wordOderIds.add(wo.getId());
}
return wordOderIds;
}
return null;
}

Loading…
Cancel
Save