|
|
|
@ -84,7 +84,6 @@ public class ZyOrdersServiceImpl extends ServiceImpl<ZyOrdersMapper, ZyOrders> i |
|
|
|
|
private OrderGoodsAccessoriesMapper zyOrderGoodsAccessoriesMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//顾客地址表
|
|
|
|
|
@Autowired |
|
|
|
|
CustomerReceivingAddressMapper customerReceivingAddressMapper; |
|
|
|
@ -98,10 +97,9 @@ public class ZyOrdersServiceImpl extends ServiceImpl<ZyOrdersMapper, ZyOrders> i |
|
|
|
|
private ZySpeechMessageMapper zySpeechMessageMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 大屏数据-获取订单的状态 |
|
|
|
|
* |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
@ -131,6 +129,7 @@ public class ZyOrdersServiceImpl extends ServiceImpl<ZyOrdersMapper, ZyOrders> i |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 大屏数据-获取历史订单 |
|
|
|
|
* |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
@ -145,6 +144,7 @@ public class ZyOrdersServiceImpl extends ServiceImpl<ZyOrdersMapper, ZyOrders> i |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取今日订单及七日订单 |
|
|
|
|
* |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
@ -158,7 +158,6 @@ public class ZyOrdersServiceImpl extends ServiceImpl<ZyOrdersMapper, ZyOrders> i |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* |
|
|
|
|
* @param zyOrdersJk |
|
|
|
|
* @param orderGoodsJkList |
|
|
|
|
* @return |
|
|
|
@ -168,10 +167,10 @@ public class ZyOrdersServiceImpl extends ServiceImpl<ZyOrdersMapper, ZyOrders> i |
|
|
|
|
|
|
|
|
|
Double actual_payment = 0.00; |
|
|
|
|
Double money = 0.00; |
|
|
|
|
for(int i = 0 ; i < orderGoodsJkList.size() ; i++){ |
|
|
|
|
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(); |
|
|
|
|
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); |
|
|
|
@ -179,15 +178,14 @@ public class ZyOrdersServiceImpl extends ServiceImpl<ZyOrdersMapper, ZyOrders> i |
|
|
|
|
zyOrders.setOrdersNum(getOrdersNum()); |
|
|
|
|
zyOrders.setMoney(money); |
|
|
|
|
zyOrders.setFreight(zyOrdersJk.getFreight()); |
|
|
|
|
zyOrders.setPromotionPrice(money-actual_payment); |
|
|
|
|
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()); |
|
|
|
|
//顾客地址
|
|
|
|
|
if(zyOrdersJk.getAddressId()!=null&&zyOrdersJk.getAddressId()!="") |
|
|
|
|
{ |
|
|
|
|
if (zyOrdersJk.getAddressId() != null && zyOrdersJk.getAddressId() != "") { |
|
|
|
|
CustomerReceivingAddress customerReceivingAddress = customerReceivingAddressMapper.selectById(zyOrdersJk.getAddressId()); |
|
|
|
|
zyOrders.setCityId(customerReceivingAddress.getCityId()); |
|
|
|
|
zyOrders.setAddress(customerReceivingAddress.getAddress()); |
|
|
|
@ -197,8 +195,7 @@ public class ZyOrdersServiceImpl extends ServiceImpl<ZyOrdersMapper, ZyOrders> i |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//顾客发票
|
|
|
|
|
if(zyOrdersJk.getInvoiceId()!=null&&zyOrdersJk.getInvoiceId()!="") |
|
|
|
|
{ |
|
|
|
|
if (zyOrdersJk.getInvoiceId() != null && zyOrdersJk.getInvoiceId() != "") { |
|
|
|
|
CustomerInvoice customerInvoice = customerInvoiceMapper.selectById(zyOrdersJk.getInvoiceId()); |
|
|
|
|
zyOrders.setInvoiceCustomerType(Integer.parseInt(customerInvoice.getCustomerType())); |
|
|
|
|
zyOrders.setInvoiceType(Integer.parseInt(customerInvoice.getInvoiceType())); |
|
|
|
@ -216,7 +213,7 @@ public class ZyOrdersServiceImpl extends ServiceImpl<ZyOrdersMapper, ZyOrders> i |
|
|
|
|
zyOrders.setPaymentStatus(1); |
|
|
|
|
zyOrders.setPaymentTime(new Date()); |
|
|
|
|
baseMapper.insert(zyOrders); |
|
|
|
|
for(int j = 0 ; j < orderGoodsJkList.size() ; j++){ |
|
|
|
|
for (int j = 0; j < orderGoodsJkList.size(); j++) { |
|
|
|
|
ZyGoods zyGoods = zyGoodsMapper.selectById(orderGoodsJkList.get(j).getGoodsId()); |
|
|
|
|
OrderGoods orderGoods = new OrderGoods(); |
|
|
|
|
orderGoods.setOrdersId(zyOrders.getId()); |
|
|
|
@ -241,15 +238,15 @@ public class ZyOrdersServiceImpl extends ServiceImpl<ZyOrdersMapper, ZyOrders> i |
|
|
|
|
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()); |
|
|
|
|
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()); |
|
|
|
|
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++){ |
|
|
|
|
for (int k = 0; k < listzsm.size(); k++) { |
|
|
|
|
OrderGoodsModule orderGoodsModule = new OrderGoodsModule(); |
|
|
|
|
orderGoodsModule.setOrderGoodsId(orderGoods.getId()); |
|
|
|
|
orderGoodsModule.setGoodsId(zyGoods.getId()); |
|
|
|
@ -259,10 +256,10 @@ public class ZyOrdersServiceImpl extends ServiceImpl<ZyOrdersMapper, ZyOrders> i |
|
|
|
|
zyOrderGoodsModuleMapper.insert(orderGoodsModule); |
|
|
|
|
} |
|
|
|
|
GoodsFabric goodsFabric = new GoodsFabric(); |
|
|
|
|
QueryWrapper<GoodsFabric> queryWrapperzsf =new QueryWrapper(); |
|
|
|
|
queryWrapperzsf.eq("goods_id",zyGoods.getId()); |
|
|
|
|
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++){ |
|
|
|
|
for (int o = 0; o < listzsf.size(); o++) { |
|
|
|
|
OrderGoodsFabric orderGoodsFabric = new OrderGoodsFabric(); |
|
|
|
|
orderGoodsFabric.setOrderGoodsId(orderGoods.getId()); |
|
|
|
|
orderGoodsFabric.setGoodsId(zyGoods.getId()); |
|
|
|
@ -271,9 +268,9 @@ public class ZyOrdersServiceImpl extends ServiceImpl<ZyOrdersMapper, ZyOrders> i |
|
|
|
|
} |
|
|
|
|
GoodsAccessories goodsAccessories = new GoodsAccessories(); |
|
|
|
|
QueryWrapper<GoodsAccessories> queryWrapperzsa = new QueryWrapper(); |
|
|
|
|
queryWrapperzsa.eq("goods_id",zyGoods.getId()); |
|
|
|
|
queryWrapperzsa.eq("goods_id", zyGoods.getId()); |
|
|
|
|
List<GoodsAccessories> listzsa = zyGoodsAccessoriesMapper.selectList(queryWrapperzsa); |
|
|
|
|
for (int p = 0 ; p < listzsa.size() ; p++){ |
|
|
|
|
for (int p = 0; p < listzsa.size(); p++) { |
|
|
|
|
OrderGoodsAccessories orderGoodsAccessories = new OrderGoodsAccessories(); |
|
|
|
|
orderGoodsAccessories.setOrderGoodsId(orderGoods.getId()); |
|
|
|
|
orderGoodsAccessories.setGoodsId(zyGoods.getId()); |
|
|
|
@ -286,18 +283,18 @@ public class ZyOrdersServiceImpl extends ServiceImpl<ZyOrdersMapper, ZyOrders> i |
|
|
|
|
List<String> ids = new ArrayList<>(); |
|
|
|
|
ZyOrders zos = new ZyOrders(); |
|
|
|
|
QueryWrapper<ZyOrders> queryWrapperzos = new QueryWrapper(); |
|
|
|
|
queryWrapperzos.eq("order_id",zyOrders.getId()); |
|
|
|
|
queryWrapperzos.eq("order_id", zyOrders.getId()); |
|
|
|
|
List<ZyOrders> listzos = baseMapper.selectList(queryWrapperzos); |
|
|
|
|
if(listzos.size()>0){ |
|
|
|
|
if (listzos.size() > 0) { |
|
|
|
|
//return Result.error("该订单已经拆分,不可以再次拆单!");
|
|
|
|
|
return null; |
|
|
|
|
}else{ |
|
|
|
|
} else { |
|
|
|
|
OrderGoods orderGoods = new OrderGoods(); |
|
|
|
|
QueryWrapper<OrderGoods> queryWrapperog = new QueryWrapper(); |
|
|
|
|
queryWrapperog.eq("orders_id",zyOrders.getId()); |
|
|
|
|
queryWrapperog.eq("orders_id", zyOrders.getId()); |
|
|
|
|
List<OrderGoods> listog = zyOrderGoodsMapper.selectList(queryWrapperog); |
|
|
|
|
if(listog.size()>0){ |
|
|
|
|
for (int i = 0 ; i < listog.size() ; i++){ |
|
|
|
|
if (listog.size() > 0) { |
|
|
|
|
for (int i = 0; i < listog.size(); i++) { |
|
|
|
|
ZyOrders zo = new ZyOrders(); |
|
|
|
|
zo = zyOrders; |
|
|
|
|
zo.setId(null); |
|
|
|
@ -317,7 +314,7 @@ public class ZyOrdersServiceImpl extends ServiceImpl<ZyOrdersMapper, ZyOrders> i |
|
|
|
|
og.setOrdersId(zo.getId()); |
|
|
|
|
zyOrderGoodsMapper.updateById(og); |
|
|
|
|
//定时播报
|
|
|
|
|
ZySpeechMessage message=new ZySpeechMessage(); |
|
|
|
|
ZySpeechMessage message = new ZySpeechMessage(); |
|
|
|
|
//订单商品id
|
|
|
|
|
message.setOrdergoodsId(zo.getId()); |
|
|
|
|
// //工单id
|
|
|
|
@ -325,7 +322,9 @@ public class ZyOrdersServiceImpl extends ServiceImpl<ZyOrdersMapper, ZyOrders> i |
|
|
|
|
// //生产计划工序id
|
|
|
|
|
// message.setZyplanprocessId();
|
|
|
|
|
//消息
|
|
|
|
|
message.setMessage("您有新的订单,订单编号:"+zo.getOrdersNum()+",请及时查看!"); |
|
|
|
|
String ordersNum = zo.getOrdersNum(); |
|
|
|
|
String code = ordersNum.substring(ordersNum.length() - 6); |
|
|
|
|
message.setMessage("您有新的订单,订单尾号:" + code + ",请及时查看!"); |
|
|
|
|
zySpeechMessageMapper.insert(message); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -342,13 +341,13 @@ public class ZyOrdersServiceImpl extends ServiceImpl<ZyOrdersMapper, ZyOrders> i |
|
|
|
|
*/ |
|
|
|
|
public String getOrdersNum() { |
|
|
|
|
String mrstr = "000000000000000000"; |
|
|
|
|
QueryWrapper<ZyOrders> qw=new QueryWrapper(); |
|
|
|
|
QueryWrapper<ZyOrders> qw = new QueryWrapper(); |
|
|
|
|
int listsize = baseMapper.selectCount(qw); |
|
|
|
|
int strsize = listsize+1; |
|
|
|
|
String str = strsize+""; |
|
|
|
|
int strsize = listsize + 1; |
|
|
|
|
String str = strsize + ""; |
|
|
|
|
int strlength = str.length(); |
|
|
|
|
String substr = mrstr.substring(0,mrstr.length()-strlength); |
|
|
|
|
String OrdersNum = substr+str; |
|
|
|
|
String substr = mrstr.substring(0, mrstr.length() - strlength); |
|
|
|
|
String OrdersNum = substr + str; |
|
|
|
|
return OrdersNum; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|