Cui Zhi Feng
2024-09-13 615f6f7dbdd68b6ee8bbced785d8094ae4455482
一键质检
已修改4个文件
79 ■■■■ 文件已修改
src/main/java/com/mzl/flower/service/payment/DeliveryOrderService.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/web/payment/DeliveryOrderController.java 44 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/web/supplier/DeliverySupplierController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/payment/DeliveryOrderMapper.xml 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/service/payment/DeliveryOrderService.java
@@ -238,6 +238,18 @@
        return deliveryOrderItemMapper.selectDoItemList(id);
    }
    public List<DeliveryOrderItemDTO> getSupplierDeliveryOrderItems(String ids){
        List<String> idList = splitParam(ids);
        List<DeliveryOrderItemDTO> ls = new ArrayList<>();
        if(idList != null && idList.size() > 0){
            for(String id : idList){
                ls.add(getSupplierDeliveryOrderItem(id));
            }
        }
        return ls;
    }
    public DeliveryOrderItemDTO getSupplierDeliveryOrderItem(String id) {
        DeliveryOrderItemDTO dto = new DeliveryOrderItemDTO();
@@ -382,6 +394,10 @@
        );
        if (count == 0) {
            Order o = orderMapper.selectById(orderId);
            if(!Constants.ORDER_STATUS_BACKEND.COLLECTION.name().equals(o.getStatus())){
                log.warn("非待集货状态,不可设置待发货");
                return;
            }
            o.setStatusBackend(Constants.ORDER_STATUS_BACKEND.SEND.name());
            o.update(SecurityUtils.getUserId());
            orderMapper.updateById(o);
src/main/java/com/mzl/flower/web/payment/DeliveryOrderController.java
@@ -4,11 +4,13 @@
import com.mzl.flower.base.BaseController;
import com.mzl.flower.base.R;
import com.mzl.flower.base.ReturnDataDTO;
import com.mzl.flower.config.exception.ValidationException;
import com.mzl.flower.constant.Constants;
import com.mzl.flower.dto.request.payment.*;
import com.mzl.flower.dto.response.flower.StationStatisticDTO;
import com.mzl.flower.dto.response.payment.*;
import com.mzl.flower.service.payment.DeliveryOrderService;
import io.micrometer.core.instrument.util.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@@ -136,7 +138,11 @@
    @ApiOperation(value = "查询集货站供应商配送列表")
    public ResponseEntity<ReturnDataDTO<Page<DeliveryOrderList4CheckDTO>>> selectSupplierDoList4Check(Page page
            , DeliveryOrderStationQueryDTO dto){
        LocalDate localDate = deliveryOrderService.parseLocalDate(dto.getDate());
        String date = dto.getDate();
        if(StringUtils.isEmpty(date)){
            throw new ValidationException("请选择日期");
        }
        LocalDate localDate = deliveryOrderService.parseLocalDate(date);
        if(localDate != null){
            LocalDateTime end = localDate.atTime(17, 0, 0);
            LocalDateTime begin = end.plusDays(-1);
@@ -187,7 +193,11 @@
    @ApiOperation(value = "查询供应商配送单列表")
    public ResponseEntity<ReturnDataDTO<Page<DeliveryOrder4CheckDTO>>> selectSupplierDoInfo4Check(Page page
            , DeliveryOrderInfoSpQueryDTO dto){
        LocalDate localDate = deliveryOrderService.parseLocalDate(dto.getDate());
        String date = dto.getDate();
        if(StringUtils.isEmpty(date)){
            throw new ValidationException("请选择日期");
        }
        LocalDate localDate = deliveryOrderService.parseLocalDate(date);
        if(localDate != null){
            LocalDateTime end = localDate.atTime(17, 0, 0);
            LocalDateTime begin = end.plusDays(-1);
@@ -320,11 +330,34 @@
    }
    @GetMapping("/check/list/complete")
    @ApiOperation(value = "一键质检(只能完成当天的,且必须点一下才会修改订单状态)")
    @ApiOperation(value = "一键质检")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "供应商id", required = true, dataType = "Long", paramType = "query")
            @ApiImplicitParam(name = "id", value = "供应商id", required = true, dataType = "Long", paramType = "query"),
            @ApiImplicitParam(name = "date", value = "日期(yyyy-MM-dd)", required = true, dataType = "String", paramType = "query"),
    })
    public ResponseEntity<ReturnDataDTO> completeCheck(Long id) {
    public ResponseEntity<ReturnDataDTO> completeCheck(Long id, String date) {
        if(StringUtils.isEmpty(date)){
            throw new ValidationException("请选择日期");
        }
        LocalDateTime startDate = null;
        LocalDateTime endDate = null;
        LocalDate localDate = deliveryOrderService.parseLocalDate(date);
        if(localDate != null){
            endDate = localDate.atTime(17, 0, 0);
            startDate = endDate.plusDays(-1);
        }
        List<String> orderIds = deliveryOrderService.completeSupplierCheck(id, startDate, endDate);
        deliveryOrderService.checkOrdersStatus(orderIds);
        return returnData(R.SUCCESS.getCode(), null);
    }
    @GetMapping("/check/list/complete/today")
    @ApiOperation(value = "一键质检(今日)")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "供应商id", required = true, dataType = "Long", paramType = "query"),
    })
    public ResponseEntity<ReturnDataDTO> completeCheckToday(Long id) {
        LocalDateTime now = LocalDateTime.now();
        LocalDateTime towAm = LocalDate.now().atTime(2, 0, 0);
        LocalDateTime fivePm = LocalDate.now().atTime(17, 0, 0);
@@ -337,7 +370,6 @@
            startDate = fivePm.plusDays(-2);
            endDate = fivePm.plusDays(-1);
        }
        List<String> orderIds = deliveryOrderService.completeSupplierCheck(id, startDate, endDate);
        deliveryOrderService.checkOrdersStatus(orderIds);
        return returnData(R.SUCCESS.getCode(), null);
src/main/java/com/mzl/flower/web/supplier/DeliverySupplierController.java
@@ -104,6 +104,15 @@
        return returnData(R.SUCCESS.getCode(), deliveryOrderService.getSupplierDeliveryOrderItem(id));
    }
    @GetMapping("/list/items/views")
    @ApiOperation(value = "获取商品详情列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "ids", value = "配送物品id列表", required = true, dataType = "String", paramType = "query")
    })
    public ResponseEntity<ReturnDataDTO<List<DeliveryOrderItemDTO>>> getSupplierDeliveryOrderItems(String ids){
        return returnData(R.SUCCESS.getCode(), deliveryOrderService.getSupplierDeliveryOrderItems(ids));
    }
    @PostMapping("/list/arrive")
    @ApiOperation(value = "确认入位")
    public ResponseEntity<ReturnDataDTO> arrived(@RequestBody DeliveryOrderArriveDTO dto) {
src/main/resources/mapper/payment/DeliveryOrderMapper.xml
@@ -236,9 +236,13 @@
        SELECT q.*
        FROM t_delivery_order q
        WHERE q.deleted = 0
        and q.status in ('PENDING', 'ARRIVED', 'CHECKED')
        AND q.status in ('PENDING', 'ARRIVED')
        AND q.supplier_id = #{supplierId}
        AND q.create_time &gt; #{startDate}
        AND q.create_time &lt;= #{endDate}
        <if test="startDate != null">
            AND q.create_time &gt; #{startDate}
        </if>
        <if test="endDate != null">
            AND q.create_time &lt;= #{endDate}
        </if>
    </select>
</mapper>