| | |
| | | import com.stylefeng.guns.modular.system.dao.*; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.utils.GoogleMap.GeocodeVo; |
| | | import com.stylefeng.guns.modular.system.utils.GoogleMap.GoogleMapUtil; |
| | | import com.stylefeng.guns.modular.system.utils.RedisUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | sTime=time.split(" - ")[0]+" 00:00:00"; |
| | | eTime=time.split(" - ")[1]+" 23:59:59"; |
| | | } |
| | | return this.baseMapper.getReceivable(receivableVoPage,sTime,eTime,id,state,userId); |
| | | List<ReceivableVo> receivable = this.baseMapper.getReceivable(receivableVoPage, sTime, eTime, id, state, userId); |
| | | for (ReceivableVo receivableVo : receivable) { |
| | | List<TPrice> prices = priceMapper.selectList(new EntityWrapper<TPrice>().eq("order_id", receivableVo.getId())); |
| | | BigDecimal reduce = prices.stream().map(TPrice::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | receivableVo.setTotal(reduce.doubleValue()); |
| | | } |
| | | return receivable; |
| | | } |
| | | |
| | | @Override |
| | | public List<ShouldPayVo> getPayList(Page<ShouldPayVo> receivableVoPage, String time, String name) { |
| | | List<ShouldPayVo> list = this.baseMapper.getPayList(receivableVoPage,name); |
| | | List<ShouldPayVo> list = this.baseMapper.getPayList(receivableVoPage,name,1); |
| | | |
| | | Calendar instance = Calendar.getInstance(); |
| | | instance.setTime(new Date()); |
| | |
| | | sTime = time.split(" - ")[0]+" 00:00:01"; |
| | | eTime = time.split(" - ")[1]+" 23:59:59"; |
| | | } |
| | | List<ReceivablesList> receivablesLists = this.baseMapper.listOfReceivables(receivableVoPage, sTime, eTime, name, invoicesId, orderId, state); |
| | | List<ReceivablesList> receivablesLists = this.baseMapper.listOfReceivables(receivableVoPage, sTime, eTime, name, invoicesId, orderId, state,1); |
| | | for (ReceivablesList receivablesList : receivablesLists) { |
| | | Integer id= this.baseMapper.getPayStatus(receivablesList.getOrderId()); |
| | | if(id==null){ |
| | |
| | | sTime = time.split(" - ")[0]+" 00:00:01"; |
| | | eTime = time.split(" - ")[1]+" 23:59:59"; |
| | | } |
| | | List<PayList> list = this.baseMapper.listOfPay(receivableVoPage, sTime, eTime, name, billId, orderId, state); |
| | | List<PayList> list = this.baseMapper.listOfPay(receivableVoPage, sTime, eTime, name, billId, orderId, state,1); |
| | | return list; |
| | | } |
| | | |
| | |
| | | // 还柜码头 |
| | | TTransportation tTransportation = tTransportationService.selectOne(new EntityWrapper<TTransportation>().eq("order_id", id).eq("type", 4)); |
| | | Integer portId = tTransportation.getPortId(); |
| | | TPort tPort = portService.selectById(portId); |
| | | info.setEPortName(tPort.getAddress()); |
| | | if(portId!=null){ |
| | | TPort tPort = portService.selectById(portId); |
| | | info.setEPortName(tPort.getAddress()); |
| | | } |
| | | } |
| | | if(!"0".equals(tOrder.getWarehouse())){ |
| | | TWarehouse code = warehouseService.selectList(new EntityWrapper<TWarehouse>().eq("code", tOrder.getWarehouse())).get(0); |
| | |
| | | } |
| | | return goodsInfoVos; |
| | | } |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | |
| | | @Autowired |
| | | private ITExamSiteService examSiteService; |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private TYardService yardService; |
| | | private HashMap<String, String> getLat(String a){ |
| | | HashMap<String, String> map = new HashMap<>(); |
| | | try { |
| | | GeocodeVo geocode = googleMapUtil.getGeocode(a); |
| | | map.put("lon",String.valueOf(geocode.getLng())); |
| | | map.put("lat",String.valueOf(geocode.getLat())); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | map.put("lon",null); |
| | | map.put("lat",null); |
| | | } |
| | | |
| | | return map; |
| | | } |
| | | @Override |
| | | public OrderInfo getOrderInfo(Long orderId) { |
| | | public HashMap<String, Object> getOrderInfo(Long orderId) { |
| | | OrderInfo orderInfo = new OrderInfo(); |
| | | ArrayList<LonLat> lonLats = new ArrayList<>(); |
| | | |
| | | TOrder tOrder = this.baseMapper.selectById(orderId); |
| | | |
| | | |
| | | String value = redisUtil.getValue(String.valueOf(orderId)); |
| | | orderInfo.setDriverLat(value); |
| | | ArrayList<Map<String,String>> maps = new ArrayList<>(); |
| | | TTransportation tTransportations = tTransportationService.selectOne(new EntityWrapper<TTransportation>().eq("order_id", orderId).eq("type",1)); |
| | | TPort tPort1 = portMapper.selectById(tOrder.getPort()); |
| | | maps.add(getLat(tPort1.getAddress())); |
| | | |
| | | if(tOrder.getExamSite()!=null){ |
| | | Integer examSite = tOrder.getExamSite(); |
| | | TExamSite tExamSite = examSiteService.selectById(examSite); |
| | | // 第二个检查站 |
| | | maps.add(getLat(tExamSite.getAddress())); |
| | | } |
| | | |
| | | TTransportation tTransportations1 = tTransportationService.selectOne(new EntityWrapper<TTransportation>().eq("order_id", orderId).eq("type",2)); |
| | | if(tTransportations1!=null){ |
| | | Integer yardId = tTransportations1.getYardId(); |
| | | if(yardId!=null){ |
| | | TYard tYard = yardService.selectById(yardId); |
| | | maps.add(getLat(tYard.getStreetAddress())); |
| | | } |
| | | } |
| | | |
| | | |
| | | if(tOrder.geteAddress()!=null){ |
| | | maps.add(getLat(tOrder.geteAddress())); |
| | | } |
| | | |
| | | |
| | | |
| | | orderInfo.setSlat(tOrder.getStartLat()); |
| | | orderInfo.setSlon(tOrder.getStartLon()); |
| | | |
| | |
| | | lonLat.setLng(tOrder.getStartLon()); |
| | | lonLats.add(lonLat); |
| | | String s = tOrder.geteAddress(); |
| | | // GeocodeVo geocode = googleMapUtil.getGeocode(s); |
| | | // orderInfo.setElat(String.valueOf(geocode.getLat())); |
| | | // orderInfo.setElon(String.valueOf(geocode.getLng())); |
| | | GeocodeVo geocode = googleMapUtil.getGeocode(s); |
| | | orderInfo.setElat(String.valueOf(geocode.getLat())); |
| | | orderInfo.setElon(String.valueOf(geocode.getLng())); |
| | | lonLat=new LonLat(); |
| | | lonLat.setLng("-113.066919618184"); |
| | | lonLat.setLat("37.684389618184"); |
| | | lonLat.setLng(tOrder.getStartLon()); |
| | | lonLat.setLat(tOrder.getStartLat()); |
| | | lonLats.add(lonLat); |
| | | orderInfo.setElat("37.684389618184"); |
| | | orderInfo.setElon("-113.066919618184"); |
| | | orderInfo.setElat(String.valueOf(geocode.getLat())); |
| | | orderInfo.setElon(String.valueOf(geocode.getLng())); |
| | | |
| | | orderInfo.setLonLats(lonLats); |
| | | Long quoteId = tQuoteMapper.selectList(new EntityWrapper<TQuote>().eq("order_id", tOrder.geteZipZ())).get(0).getId(); |
| | |
| | | Integer groupId = tUser.getGroupId(); |
| | | if(groupId!=null) { |
| | | TGroup tGroup = tGroupMapper.selectById(groupId); |
| | | orderInfo.setSalesGroup(tGroup.getName()); |
| | | Integer salesId = tGroup.getSalesId(); |
| | | User user = userMapper.selectById(salesId); |
| | | orderInfo.setSales(user.getName()); |
| | | if(tGroup!=null){ |
| | | orderInfo.setSalesGroup(tGroup.getName()); |
| | | Integer salesId = tGroup.getSalesId(); |
| | | User user = userMapper.selectById(salesId); |
| | | orderInfo.setSales(user.getName()); |
| | | } |
| | | |
| | | } |
| | | // 获取码头id 获取码头地址 pickup信息 |
| | | Integer portId = tOrder.getPort(); |
| | | TPort tPort = portMapper.selectById(portId); |
| | | orderInfo.setAddress(tOrder.geteAddress()); |
| | | orderInfo.setAddress(tPort.getAddress()); |
| | | orderInfo.setContactName(tOrder.getsName()); |
| | | orderInfo.setContactPhone(tOrder.getsPhone()); |
| | | orderInfo.setContactEmail(tOrder.getsEmail()); |
| | |
| | | ArrayList<String> strings = new ArrayList<>(); |
| | | goods.forEach(e->{ |
| | | strings.add(e.getContainerNumber()); |
| | | strings.add(String.valueOf(e.getOrderId())); |
| | | orderInfo.setBl(e.getBillNumber()); |
| | | }); |
| | | orderInfo.setContainer(strings); |
| | |
| | | orderInfo.setNote(driverNoteVos); |
| | | orderInfo.setTrouble(driverNoteVos1); |
| | | orderInfo.setState(tOrder.getState()); |
| | | return orderInfo; |
| | | |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("lonlat",maps); |
| | | map.put("data",orderInfo); |
| | | |
| | | return map; |
| | | |
| | | |
| | | } |
| | |
| | | @Override |
| | | public List<IndexMonth> index(int userId) { |
| | | ArrayList<IndexMonth> list = new ArrayList<>(); |
| | | List<TOrder> orders = this.baseMapper.selectList(new EntityWrapper<TOrder>().eq("user_id", userId).isNotNull("company_id")); |
| | | List<TOrder> orders = this.baseMapper.selectList(new EntityWrapper<TOrder>().eq("user_id", userId).isNotNull("company_id").ne("status",17)); |
| | | for (TOrder order : orders) { |
| | | IndexMonth indexMonth = new IndexMonth(); |
| | | indexMonth.setTime(order.getPayTime()); |
| | | indexMonth.setOrderNumber(order.getId()); |
| | | indexMonth.setAmount(order.getAllTotal()); |
| | | BigDecimal order_id = priceMapper.selectList(new EntityWrapper<TPrice>().eq("order_id", order.getId())).stream().map(TPrice::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | indexMonth.setAmount(order_id); |
| | | list.add(indexMonth); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | public static void main(String[] args) throws ParseException { |
| | | Calendar instance = Calendar.getInstance(); |
| | | instance.add(Calendar.DATE,1); |
| | | System.out.println(instance.getTime()); |
| | | } |
| | | |
| | | @Override |
| | | public List<IndexMonth> indexYear(int i,int userId) { |
| | | ArrayList<IndexMonth> list = new ArrayList<>(); |
| | | List<TOrder> orders = this.baseMapper.selectList(new EntityWrapper<TOrder>().eq("user_id", userId).isNotNull("company_id").like("pay_time",String.valueOf(i))); |
| | | List<TOrder> orders = this.baseMapper.selectList(new EntityWrapper<TOrder>().eq("user_id", userId).isNotNull("company_id").like("pay_time",String.valueOf(i)).ne("status",17)); |
| | | for (TOrder order : orders) { |
| | | IndexMonth indexMonth = new IndexMonth(); |
| | | indexMonth.setTime(order.getPayTime()); |
| | | indexMonth.setOrderNumber(order.getId()); |
| | | indexMonth.setAmount(order.getAllTotal()); |
| | | BigDecimal order_id = priceMapper.selectList(new EntityWrapper<TPrice>().eq("order_id", order.getId())).stream().map(TPrice::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | indexMonth.setAmount(order_id); |
| | | list.add(indexMonth); |
| | | } |
| | | return list; |
| | |
| | | @Override |
| | | public List<IndexMonth> indexTime(String sTime, String eTime,int userId) { |
| | | ArrayList<IndexMonth> list = new ArrayList<>(); |
| | | List<TOrder> orders = this.baseMapper.selectList(new EntityWrapper<TOrder>().eq("user_id", userId).isNotNull("company_id").between("pay_time",sTime,eTime)); |
| | | List<TOrder> orders = this.baseMapper.selectList(new EntityWrapper<TOrder>().eq("user_id", userId).isNotNull("company_id").between("pay_time",sTime,eTime).ne("status",17)); |
| | | for (TOrder order : orders) { |
| | | IndexMonth indexMonth = new IndexMonth(); |
| | | indexMonth.setTime(order.getPayTime()); |
| | | indexMonth.setOrderNumber(order.getId()); |
| | | indexMonth.setAmount(order.getAllTotal()); |
| | | BigDecimal order_id = priceMapper.selectList(new EntityWrapper<TPrice>().eq("order_id", order.getId())).stream().map(TPrice::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | indexMonth.setAmount(order_id); |
| | | list.add(indexMonth); |
| | | } |
| | | return list; |
| | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getLonLat(Long orderId) { |
| | | return this.baseMapper.getLonLat(orderId); |
| | | } |
| | | |
| | | |
| | | } |