提交 ad1d4c08 authored 作者: aiqingguo's avatar aiqingguo

线路统计增加Feign

上级 36358ac4
package com.clx.performance.feign;
import com.clx.performance.vo.pc.child.OrderChildLineStatisticsVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.validation.constraints.NotBlank;
@FeignClient(name = "clx-performance")
public interface OrderChildFeign {
/**
* 线路运单统计
*/
@RequestMapping(value = "clx-performance/feign/orderChild/lineStatistics", method = RequestMethod.GET)
OrderChildLineStatisticsVO lineStatistics(@NotBlank(message = "发货地址不可为空") Integer sendSystemAddressId, @NotBlank(message = "收货货地址不可为空") Integer receiveSystemAddressId);
}
package com.clx.performance.vo.pc.child;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.math.BigDecimal;
/**
* @ClassName
* @Description
* @Author kavin
* @Date 2023/10/10 10:44
* @Version 1.0
*/
@ApiModel(description = "线路统计")
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class OrderChildLineStatisticsVO {
@ApiModelProperty("磅差率均值")
private BigDecimal poundDifferenceRatioAvg;
@ApiModelProperty("时长均值")
private Integer timeAvg;
}
......@@ -3,15 +3,16 @@ package com.clx.performance.controller.feign;
import cn.hutool.core.collection.CollectionUtil;
import com.clx.performance.model.OrderChild;
import com.clx.performance.service.OrderChildService;
import com.clx.performance.service.child.FeignOrderChildService;
import com.clx.performance.vo.pc.child.OrderChildLineStatisticsVO;
import com.msl.common.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;
......@@ -24,6 +25,9 @@ public class OrderChildFeignController {
private final OrderChildService orderChildService;
private final FeignOrderChildService feignOrderChildService;
@GetMapping({"/getOrderChildTotalByUserNo"})
Integer getTrucksByOrderGoodsNo(@RequestParam("userNo") @NotNull(message = "用户编号不可为空") Long userNo) {
Integer totalByUserNo = orderChildService.getOrderChildTotalByUserNo(userNo);
......@@ -45,4 +49,14 @@ public class OrderChildFeignController {
return Result.ok(false);
}
}
@ApiOperation(value = "线路运单统计", notes = "<br>By:艾庆国")
@RequestMapping(value = "/lineStatistics", method = RequestMethod.GET)
Result<OrderChildLineStatisticsVO> lineStatistics(@NotBlank(message = "发货地址不可为空") Integer sendSystemAddressId,
@NotBlank(message = "收货货地址不可为空") Integer receiveSystemAddressId){
return Result.ok(feignOrderChildService.getLineStatistics(sendSystemAddressId, receiveSystemAddressId));
}
}
package com.clx.performance.controller.temp;
import com.clx.performance.service.TempService;
import com.clx.performance.service.child.CarrierOrderChildService;
import com.clx.performance.service.child.FeignOrderChildService;
import com.clx.performance.vo.pc.child.OrderChildLineStatisticsVO;
import com.msl.common.result.Result;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
......@@ -10,8 +11,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
/**
* @Author: aiqingguo
......@@ -27,14 +26,13 @@ public class TempController {
@Autowired
private TempService tempService;
@Autowired
private CarrierOrderChildService carrierOrderChildService;
private FeignOrderChildService carrierOrderChildService;
@ApiOperation(value = "test", notes = "<br>By:艾庆国")
@RequestMapping(value = "/test", method = RequestMethod.GET)
public Result<HashMap> test(Integer sendAddressId, Integer receiveAddressId) {
public Result<OrderChildLineStatisticsVO> test(Integer sendAddressId, Integer receiveAddressId) {
return Result.ok(carrierOrderChildService.getLineStatistics(sendAddressId, receiveAddressId));
}
......
......@@ -109,12 +109,11 @@ public interface OrderChildDao extends BaseDao<OrderChildMapper, OrderChild, Int
List<OrderChild> selectInTransitOrderChildByOrderGoodsNo(String orderGoodsNo);
BigDecimal getLinePoundDifferenceAvg(@Param("sendAddressId") Integer sendAddressId,
@Param("receiveAddressId") Integer receiveAddressId,
@Param("beginTime") String beginTime);
Integer getLineArriveSendAddressToUnloadTimeAvg(@Param("sendAddressId") Integer sendAddressId,
@Param("receiveAddressId") Integer receiveAddressId,
BigDecimal getLinePoundDifferenceRatioAvg(@Param("sendSystemAddressId") Integer sendSystemAddressId,
@Param("receiveSystemAddressId") Integer receiveSystemAddressId,
@Param("beginTime") String beginTime);
Integer getLineArriveSendAddressToUnloadTimeAvg(@Param("sendSystemAddressId") Integer sendSystemAddressId,
@Param("receiveSystemAddressId") Integer receiveSystemAddressId,
@Param("beginTime") String beginTime);
void updateSendSystemAddress(Integer ownerAddressId, Integer systemAddressId);
......
......@@ -9,7 +9,6 @@ import com.clx.performance.dao.OrderChildDao;
import com.clx.performance.enums.OrderChildEnum;
import com.clx.performance.mapper.OrderChildMapper;
import com.clx.performance.model.OrderChild;
import com.clx.performance.model.OrderGoods;
import com.clx.performance.param.app.PageOrderChildOfDriverParam;
import com.clx.performance.param.app.PageOrderChildOfDriverSearchParam;
import com.clx.performance.param.pc.PageCarrierOrderChildParam;
......@@ -376,13 +375,13 @@ public class OrderChildDaoImpl extends BaseDaoImpl<OrderChildMapper, OrderChild,
); }
@Override
public BigDecimal getLinePoundDifferenceAvg(Integer sendAddressId, Integer receiveAddressId, String beginTime) {
return baseMapper.getLinePoundDifferenceAvg(sendAddressId, receiveAddressId, beginTime);
public BigDecimal getLinePoundDifferenceRatioAvg(Integer sendSystemAddressId, Integer receiveSystemAddressId, String beginTime) {
return baseMapper.getLinePoundDifferenceRatioAvg(sendSystemAddressId, receiveSystemAddressId, beginTime);
}
@Override
public Integer getLineArriveSendAddressToUnloadTimeAvg(Integer sendAddressId, Integer receiveAddressId, String beginTime) {
return baseMapper.getLineArriveSendAddressToUnloadTimeAvg(sendAddressId, receiveAddressId, beginTime);
public Integer getLineArriveSendAddressToUnloadTimeAvg(Integer sendSystemAddressId, Integer receiveSystemAddressId, String beginTime) {
return baseMapper.getLineArriveSendAddressToUnloadTimeAvg(sendSystemAddressId, receiveSystemAddressId, beginTime);
}
......
......@@ -49,21 +49,21 @@ public interface OrderChildMapper extends BaseMapper<OrderChild> {
Integer updateOrderGoodsSetResidueWeight(@Param(value = "status") Integer status, @Param(value = "ids") List<Integer> ids);
@Select("select AVG((load_net-unload_net)/load_net) from order_child " +
" where send_address_id = #{sendAddressId} " +
" and receive_address_id = #{receiveAddressId} " +
" where send_system_address_id = #{sendSystemAddressId} " +
" and receive_system_address_id = #{receiveSystemAddressId} " +
" and status >= 90 and status <= 100 " +
" and pay_time >= #{beginTime}")
BigDecimal getLinePoundDifferenceAvg(@Param("sendAddressId") Integer sendAddressId,
@Param("receiveAddressId") Integer receiveAddressId,
@Param("beginTime") String beginTime);
BigDecimal getLinePoundDifferenceRatioAvg(@Param("sendSystemAddressId") Integer sendSystemAddressId,
@Param("receiveSystemAddressId") Integer receiveSystemAddressId,
@Param("beginTime") String beginTime);
@Select("select AVG(TIMESTAMPDIFF(SECOND, arrive_send_time, unload_time)) from order_child " +
" where send_address_id = #{sendAddressId} " +
" and receive_address_id = #{receiveAddressId} " +
" where send_system_address_id = #{sendSystemAddressId} " +
" and receive_system_address_id = #{receiveSystemAddressId} " +
" and status >= 90 and status <= 100 " +
" and pay_time >= #{beginTime}")
Integer getLineArriveSendAddressToUnloadTimeAvg(@Param("sendAddressId") Integer sendAddressId,
@Param("receiveAddressId") Integer receiveAddressId,
Integer getLineArriveSendAddressToUnloadTimeAvg(@Param("sendSystemAddressId") Integer sendSystemAddressId,
@Param("receiveSystemAddressId") Integer receiveSystemAddressId,
@Param("beginTime") String beginTime);
}
\ No newline at end of file
package com.clx.performance.service.child;
import java.util.HashMap;
public interface CarrierOrderChildService {
HashMap<String, Object> getLineStatistics(Integer sendAddressId, Integer receiveAddressId);
}
package com.clx.performance.service.child;
import com.clx.performance.vo.pc.child.OrderChildLineStatisticsVO;
public interface FeignOrderChildService {
OrderChildLineStatisticsVO getLineStatistics(Integer sendSystemAddressId, Integer receiveSystemAddressId);
}
package com.clx.performance.service.impl.child;
import com.clx.performance.dao.OrderChildDao;
import com.clx.performance.service.child.CarrierOrderChildService;
import com.clx.performance.service.child.FeignOrderChildService;
import com.clx.performance.utils.LocalDateTimeUtils;
import com.clx.performance.vo.pc.child.OrderChildLineStatisticsVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -10,31 +11,30 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.util.HashMap;
@Slf4j
@Service
public class CarrierOrderChildServiceImpl implements CarrierOrderChildService {
public class FeignOrderChildServiceImpl implements FeignOrderChildService {
@Autowired
private OrderChildDao orderChildDao;
@Override
public HashMap<String, Object> getLineStatistics(Integer sendAddressId, Integer receiveAddressId) {
public OrderChildLineStatisticsVO getLineStatistics(Integer sendSystemAddressId, Integer receiveSystemAddressId) {
// 磅差
String beginTime = LocalDateTimeUtils.getStringDayStart(LocalDateTime.now().minusDays(7));
BigDecimal linePoundDifferenceAvg = orderChildDao.getLinePoundDifferenceAvg(sendAddressId, receiveAddressId, beginTime);
BigDecimal linePoundDifferenceRatioAvg = orderChildDao.getLinePoundDifferenceRatioAvg(sendSystemAddressId, receiveSystemAddressId, beginTime);
// 时长
beginTime = LocalDateTimeUtils.getStringDayStart(LocalDateTime.now().minusMonths(1));
Integer timeAvg = orderChildDao.getLineArriveSendAddressToUnloadTimeAvg(sendAddressId, receiveAddressId, beginTime);
Integer timeAvg = orderChildDao.getLineArriveSendAddressToUnloadTimeAvg(sendSystemAddressId, receiveSystemAddressId, beginTime);
HashMap<String, Object> map = new HashMap<>();
OrderChildLineStatisticsVO vo = new OrderChildLineStatisticsVO();
map.put("poundDifferenceAvg",linePoundDifferenceAvg==null? null:linePoundDifferenceAvg.setScale(4, RoundingMode.HALF_UP).movePointRight(2));
map.put("timeAvg",timeAvg==null? null : timeAvg/60);
vo.setPoundDifferenceRatioAvg(linePoundDifferenceRatioAvg==null? null:linePoundDifferenceRatioAvg.setScale(4, RoundingMode.HALF_UP).movePointRight(2));
vo.setTimeAvg(timeAvg==null? null : timeAvg/60);
return map;
return vo;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论