package com.goafanti.order.service.impl; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.UUID; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.goafanti.common.dao.JtConsultOrderMapper; import com.goafanti.common.model.JtConsultOrder; import com.goafanti.core.mybatis.JDBCIdGenerator; import com.goafanti.core.shiro.token.TokenManager; import com.goafanti.order.service.JtConsultOrderService; @Service public class JtConsultOrderServiceImpl implements JtConsultOrderService { @Autowired private JtConsultOrderMapper jtConsultOrderMapper; @Override public int addConsultOrder(List orderList) { List l= new ArrayList<>(); for(JtConsultOrder order:orderList) { JtConsultOrder consultOrder=new JtConsultOrder(); if(order.getOrderChannel()==null)return -3; if(order.getPayType()==null)order.setPayType(0); JDBCIdGenerator jdbcIdGenerator=new JDBCIdGenerator(); order.setPayType(1); order.setOrderStatus(0); order.setOrderChannel(0); order.setDeleteSign(0); order.setBuyerId(TokenManager.getUserId()); // order.setBuyerId("0549c290-5178-4886-8294-5037f1743b0c"); order.setOrderNo(jdbcIdGenerator.generateId()+""); order.setOrderTime(new Date()); consultOrder.setSellerId(order.getSellerId()); consultOrder.setOrderNo(order.getOrderNo()); consultOrder.setBuyerId(order.getBuyerId()); consultOrder.setOrderTime(order.getOrderTime()); consultOrder.setConsultType(order.getConsultType()); consultOrder.setConsultPrice(order.getConsultPrice()); consultOrder.setDiscountPrice(order.getDiscountPrice()); consultOrder.setMemberPrice(order.getMemberPrice()); consultOrder.setOrderAmount(order.getOrderAmount()); consultOrder.setPayAmount(order.getConsultPrice()); consultOrder.setRefundAmount(order.getRefundAmount()); consultOrder.setPayType(order.getPayType()); consultOrder.setOrderStatus(order.getOrderStatus()); consultOrder.setOrderChannel(order.getOrderChannel()); consultOrder.setDeleteSign(order.getDeleteSign()); consultOrder.setOrderRemarks(order.getOrderRemarks()); jtConsultOrderMapper.insert(consultOrder); } return 0; } }