|
|
@ -1,30 +1,44 @@ |
|
|
|
package com.lan.textja.service.supplier; |
|
|
|
package com.lan.textja.service.supplier; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.lan.textja.entity.Dealer; |
|
|
|
|
|
|
|
import com.lan.textja.entity.Order; |
|
|
|
import com.lan.textja.entity.Supplier; |
|
|
|
import com.lan.textja.entity.Supplier; |
|
|
|
import com.lan.textja.entity.Supply; |
|
|
|
import com.lan.textja.entity.Supply; |
|
|
|
|
|
|
|
import com.lan.textja.mapper.DealerMapper; |
|
|
|
|
|
|
|
import com.lan.textja.mapper.OrderMapper; |
|
|
|
|
|
|
|
import com.lan.textja.mapper.SupplierMapper; |
|
|
|
import com.lan.textja.mapper.SupplyMapper; |
|
|
|
import com.lan.textja.mapper.SupplyMapper; |
|
|
|
import com.lan.textja.util.PageResult; |
|
|
|
import com.lan.textja.util.PageResult; |
|
|
|
import com.sun.org.apache.regexp.internal.RE; |
|
|
|
import com.sun.org.apache.regexp.internal.RE; |
|
|
|
|
|
|
|
import org.apache.ibatis.javassist.expr.NewArray; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.*; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Service |
|
|
|
@Service |
|
|
|
public class SupplyServiceImp implements SupplyService{ |
|
|
|
public class SupplyServiceImp implements SupplyService { |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private SupplyMapper supplyMapper; |
|
|
|
private SupplyMapper supplyMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private DealerMapper dealerMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private OrderMapper orderMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private SupplierMapper supplierMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public PageResult supplyList(PageResult pageResult) { |
|
|
|
public PageResult supplyList(PageResult pageResult) { |
|
|
|
//起始位置
|
|
|
|
//起始位置
|
|
|
|
int start = (pageResult.getPageNum()-1) * pageResult.getPageSize(); |
|
|
|
int start = (pageResult.getPageNum() - 1) * pageResult.getPageSize(); |
|
|
|
//每页条数
|
|
|
|
//每页条数
|
|
|
|
int size = pageResult.getPageSize(); |
|
|
|
int size = pageResult.getPageSize(); |
|
|
|
//分页结果
|
|
|
|
//分页结果
|
|
|
|
List<Supply> supplyList = supplyMapper.supplyList(start,size); |
|
|
|
List<Supply> supplyList = supplyMapper.supplyList(start, size); |
|
|
|
//是user表的总数信息 暂时不需要where条件.
|
|
|
|
//是user表的总数信息 暂时不需要where条件.
|
|
|
|
long total = supplyMapper.selectCount(null); |
|
|
|
long total = supplyMapper.selectCount(null); |
|
|
|
//封装数据实现返回
|
|
|
|
//封装数据实现返回
|
|
|
@ -34,25 +48,109 @@ public class SupplyServiceImp implements SupplyService{ |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<Supplier> supplyDetail(Supply supply) { |
|
|
|
public List<Supplier> supplyDetail(Supply supply) { |
|
|
|
List<Supplier> supplierList= supplyMapper.supplyDetail(supply); |
|
|
|
List<Supplier> supplierList = supplyMapper.supplyDetail(supply); |
|
|
|
return supplierList; |
|
|
|
return supplierList; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<Supply> supplyselect(Supply supply) { |
|
|
|
public List<Supply> supplyselect(Supply supply) { |
|
|
|
List<Supply>supplyselect=supplyMapper.supplyselect(supply); |
|
|
|
List<Supply> supplyselect = supplyMapper.supplyselect(supply); |
|
|
|
return supplyselect; |
|
|
|
return supplyselect; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<Supply> goodsTypes() { |
|
|
|
public List<Supply> goodsTypes() { |
|
|
|
List<Supply>goodsTypes=supplyMapper.goodsTypes(); |
|
|
|
List<Supply> goodsTypes = supplyMapper.goodsTypes(); |
|
|
|
return goodsTypes; |
|
|
|
return goodsTypes; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<Supply> Onorder(Supply supply) { |
|
|
|
public List<Supply> Onorder(Supply supply) { |
|
|
|
List<Supply> Onorder=supplyMapper.Onorder(supply); |
|
|
|
List<Supply> Onorder = supplyMapper.Onorder(supply); |
|
|
|
return Onorder; |
|
|
|
return Onorder; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void SureOrder(Map<String, Object> params) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Order order = new Order(); |
|
|
|
|
|
|
|
//设置订单号
|
|
|
|
|
|
|
|
int max = 10000; |
|
|
|
|
|
|
|
int min = 1000; |
|
|
|
|
|
|
|
Random random = new Random(); |
|
|
|
|
|
|
|
int fileName = (random.nextInt(max - min) + min + 1); |
|
|
|
|
|
|
|
order.setOrderNo(fileName); |
|
|
|
|
|
|
|
//设置订单相关值
|
|
|
|
|
|
|
|
order.setOrderGoodsNo(Integer.parseInt(String.valueOf(params.get("goodsNum")))); |
|
|
|
|
|
|
|
order.setOrderName(String.valueOf(Optional.ofNullable(params.get("goodsName")).orElse(""))); |
|
|
|
|
|
|
|
order.setOrderPrice(Integer.parseInt(String.valueOf(params.get("goodsPrice")))); |
|
|
|
|
|
|
|
order.setOrderQty(Integer.parseInt(String.valueOf(params.get("goodsQty")))); |
|
|
|
|
|
|
|
order.setOrderTotalPrice(Integer.parseInt(String.valueOf(params.get("totalPrice")))); |
|
|
|
|
|
|
|
order.setOrderType(String.valueOf(Optional.ofNullable(params.get("goodsType")).orElse(""))); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取dealer信息
|
|
|
|
|
|
|
|
String dealerName = String.valueOf(Optional.ofNullable(params.get("dealerName")).orElse("")); |
|
|
|
|
|
|
|
Dealer dealerList = dealerMapper.select(dealerName); |
|
|
|
|
|
|
|
order.setOrderDealerContact(dealerList.getDealerContact()); |
|
|
|
|
|
|
|
order.setOrderDealerAddress(dealerList.getDealerAddress()); |
|
|
|
|
|
|
|
order.setOrderDealerNumber(dealerList.getDealerNumber()); |
|
|
|
|
|
|
|
order.setOrderDealerNo(dealerList.getDealerNum()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Integer goodsSupplierFirm = Integer.parseInt(String.valueOf(params.get("goodsSupplierFirm"))); |
|
|
|
|
|
|
|
Supplier supplierList = supplierMapper.select(goodsSupplierFirm); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取supplier信息
|
|
|
|
|
|
|
|
order.setOrderSupplierContact(supplierList.getSupplierContact()); |
|
|
|
|
|
|
|
order.setOrderSupplierAddress(supplierList.getSupplierAddress()); |
|
|
|
|
|
|
|
order.setOrderSupplierNumber(supplierList.getSupplierNumber()); |
|
|
|
|
|
|
|
order.setOrderSupplierNo(supplierList.getSupplierNum()); |
|
|
|
|
|
|
|
//订单进行中
|
|
|
|
|
|
|
|
order.setOrderState(true); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
orderMapper.SureOrder(order); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public Integer goodsNum() { |
|
|
|
|
|
|
|
List<Integer> Nums = supplyMapper.goodsNum(); |
|
|
|
|
|
|
|
System.out.println(Nums); |
|
|
|
|
|
|
|
Integer maxValue = Collections.max(Nums); |
|
|
|
|
|
|
|
System.out.println(maxValue); |
|
|
|
|
|
|
|
maxValue++; |
|
|
|
|
|
|
|
return maxValue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public List<Supplier> supplierName() { |
|
|
|
|
|
|
|
List<Supplier> supplierNames = supplierMapper.supplierName(); |
|
|
|
|
|
|
|
return supplierNames; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void onAddSupply(Map<String, Object> params) { |
|
|
|
|
|
|
|
Supply supply =new Supply(); |
|
|
|
|
|
|
|
supply.setGoodsNum(Integer.parseInt(String.valueOf(params.get("goodsNum")))); |
|
|
|
|
|
|
|
supply.setGoodsName(String.valueOf(Optional.ofNullable(params.get("goodsName")).orElse(""))); |
|
|
|
|
|
|
|
supply.setGoodsType(String.valueOf(Optional.ofNullable(params.get("goodsType")).orElse(""))); |
|
|
|
|
|
|
|
supply.setGoodsSupplier(String.valueOf(Optional.ofNullable(params.get("supplierName")).orElse(""))); |
|
|
|
|
|
|
|
supply.setGoodsPrice(Integer.parseInt(String.valueOf(params.get("goodsPrice")))); |
|
|
|
|
|
|
|
supply.setGoodsSize(String.valueOf(Optional.ofNullable(params.get("goodsSize")).orElse(""))); |
|
|
|
|
|
|
|
supply.setGoodsEffect(String.valueOf(Optional.ofNullable(params.get("goodsEffect")).orElse(""))); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//设置goodsState 0无 1有
|
|
|
|
|
|
|
|
Integer goodsState=Integer.parseInt(String.valueOf(params.get("goodsState"))); |
|
|
|
|
|
|
|
if(goodsState==0){ |
|
|
|
|
|
|
|
supply.setGoodsState(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
supply.setGoodsState(true); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//拿到supplierNum 设置goodsSupplierFirm
|
|
|
|
|
|
|
|
String supplierName=String.valueOf(Optional.ofNullable(params.get("supplierName")).orElse("")); |
|
|
|
|
|
|
|
Supplier supplierList = supplierMapper.goodsSupplierFirm(supplierName); |
|
|
|
|
|
|
|
supply.setGoodsSupplierFirm(supplierList.getSupplierNum()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
supplyMapper.onAddSupply(supply); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|