陶杰
2024-09-10 2aae6068bbf1aff1ffb2813098553ac632d5002b
Merge remote-tracking branch 'origin/master-v2' into master-v2
已修改14个文件
111 ■■■■ 文件已修改
src/main/java/com/mzl/flower/dto/request/payment/DeliveryOrderInfoSpQueryDTO.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/dto/request/payment/DeliveryOrderStationQueryDTO.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/dto/request/payment/OrderQueryDTO.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/dto/response/payment/DeliveryOrderItem4CheckDTO.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/dto/response/payment/DeliveryOrderList4CheckDTO.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/service/flower/FlowerService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/service/payment/DeliveryOrderService.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/service/point/CustomerPointService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/service/point/PointGoodsService.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/service/system/UserService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/web/payment/DeliveryOrderController.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/payment/DeliveryOrderMapper.xml 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/payment/OrderMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/point/CustomerPointMapper.xml 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/dto/request/payment/DeliveryOrderInfoSpQueryDTO.java
@@ -4,6 +4,7 @@
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
@Data
public class DeliveryOrderInfoSpQueryDTO {
@@ -28,9 +29,15 @@
    @ApiModelProperty(value = "库位名称")
    private String warehouseLocationCode;
    @ApiModelProperty(value = "日期")
    private String date;
    @ApiModelProperty(hidden = true)
    private LocalDateTime startDate;
    @ApiModelProperty(hidden = true)
    private LocalDateTime endDate;
    @ApiModelProperty(hidden = true)
    private List<String> statusList;
}
src/main/java/com/mzl/flower/dto/request/payment/DeliveryOrderStationQueryDTO.java
@@ -4,6 +4,7 @@
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
@Data
public class DeliveryOrderStationQueryDTO {
@@ -34,9 +35,15 @@
    @ApiModelProperty(value = "库位名称")
    private String warehouseLocationCode;
    @ApiModelProperty(value = "日期")
    private String date;
    @ApiModelProperty(hidden = true)
    private LocalDateTime startDate;
    @ApiModelProperty(hidden = true)
    private LocalDateTime endDate;
    @ApiModelProperty(hidden = true)
    private List<String> statusList;
}
src/main/java/com/mzl/flower/dto/request/payment/OrderQueryDTO.java
@@ -70,4 +70,7 @@
    @ApiModelProperty(hidden = true)
    private List<String> idList;
    @ApiModelProperty(value = "收货地址详细地址(拼接省市区地址)")
    private String address;
}
src/main/java/com/mzl/flower/dto/response/payment/DeliveryOrderItem4CheckDTO.java
@@ -37,7 +37,7 @@
    private String flowerLevelStr;
    @ApiModelProperty(value = "订单商品状态")
    @DictTrans(target = "statusStr", codeType = "CHECK_OPERATE")
    @DictTrans(target = "statusStr", codeType = "ORDER_ITEM_STATUS")
    private String status;
    private String statusStr;
src/main/java/com/mzl/flower/dto/response/payment/DeliveryOrderList4CheckDTO.java
@@ -25,4 +25,6 @@
    @ApiModelProperty(value = "供应商总价")
    private BigDecimal totalAmount;
    @ApiModelProperty(value = "未完成质检订单数量")
    private Integer uncheckedCount;
}
src/main/java/com/mzl/flower/service/flower/FlowerService.java
@@ -458,6 +458,9 @@
    public void deleteFlower(Long id){
        final Flower flower = flowerMapper.selectById(id);
        if(flower == null){
            throw new ValidationException("商品未找到");
        }
        flowerMapper.deleteById(id);
src/main/java/com/mzl/flower/service/payment/DeliveryOrderService.java
@@ -354,7 +354,7 @@
        );
        if (items != null && items.size() > 0) {
            for (OrderItem i : items) {
                i.setStatus(Constants.CHECK_OPERATE.ok.name());
                i.setStatus(Constants.ORDER_ITEM_STATUS.ok.name());
                i.setCheckTime(LocalDateTime.now());
                orderItemMapper.updateById(i);
            }
@@ -463,6 +463,7 @@
    //////////////////////////////////////////////////////////////新接口
    public Page<DeliveryOrderList4CheckDTO> selectSupplierDoList4Check(Page page, DeliveryOrderStationQueryDTO dto) {
        dto.setStatusList(splitParam(dto.getStatus()));
        List<DeliveryOrderList4CheckDTO> ls = deliveryOrderMapper.selectSupplierDoList4Check(page, dto);
        page.setRecords(ls);
@@ -473,6 +474,7 @@
        if(dto.getSupplierId() == null){
            throw new ValidationException("供应商id不能为空");
        }
        dto.setStatusList(splitParam(dto.getStatus()));
        List<DeliveryOrder4CheckDTO> ls = deliveryOrderMapper.selectSupplierDoInfo4Check(page, dto);
        if(ls != null && ls.size() > 0){
src/main/java/com/mzl/flower/service/point/CustomerPointService.java
@@ -93,7 +93,7 @@
                    point.setDeductionPoint(point.getDeductionPoint() + detail.getPoint());
                }else{
                    //积分不足,直接清0
                    point.setDeductionPoint(point.getUsedPoint() + balancePoint);
                    point.setDeductionPoint(point.getDeductionPoint() + balancePoint);
                    detail.setPoint(balancePoint);
                    detail.setRemarks(detail.getRemarks()+",积分不足,扣除积分"+balancePoint);
                }
src/main/java/com/mzl/flower/service/point/PointGoodsService.java
@@ -18,6 +18,7 @@
import com.mzl.flower.mapper.point.PointGoodsMapper;
import com.mzl.flower.mapper.point.PointGoodsRecordMapper;
import com.mzl.flower.service.BaseService;
import com.mzl.flower.service.payment.RedisLockService;
import com.mzl.flower.utils.UUIDGenerator;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -43,6 +44,9 @@
    @Autowired
    private CustomerPointDetailMapper customerPointDetailMapper;
    @Autowired
    private RedisLockService lockService;
    public Long addPointGoods(PointGoodsCreateDTO dto){
        PointGoods p = new PointGoods();
@@ -117,7 +121,13 @@
        }
    }
    public synchronized void exchangeGoods(ExchangeGoodsDTO dto) {
    public void exchangeGoods(ExchangeGoodsDTO dto) {
        String key="EXCHANGE_GOODS:"+dto.getGoodsId()+":"+SecurityUtils.getUserId();
        boolean lock = lockService.getObjectLock(key, "");
        if(!lock){
            throw new ValidationException("系统操作频繁,请稍后重试");
        }
        try {
        PointGoods p = pointGoodsMapper.selectById(dto.getGoodsId());
        if(p == null){
            throw new ValidationException("商品未找到");
@@ -130,7 +140,7 @@
        }
        CustomerPoint cp = customerPointMapper.selectOne(new LambdaQueryWrapper<CustomerPoint>()
                .eq(CustomerPoint::getUserId, SecurityUtils.getUserId()));
        if(cp == null || (cp.getTotalPoint()-cp.getUsedPoint()-cp.getExpiredPoint()) < p.getPoint() * dto.getNum()){
            if(cp == null || (cp.getTotalPoint()-cp.getUsedPoint()-cp.getExpiredPoint()-cp.getDeductionPoint()) < p.getPoint() * dto.getNum()){
            throw new ValidationException("积分不足");
        }
        //记录兑换记录
@@ -141,7 +151,7 @@
        record.setNum(dto.getNum());
        record.setPoint(p.getPoint());
        record.setName(p.getName());
        record.setPictures(p.getPictures());
            record.setPictures(p.getCover());
        record.setDescription(p.getDescription());
        record.setTotalPoint(p.getPoint() * dto.getNum());
        record.setCover(p.getCover());
@@ -168,6 +178,12 @@
        //更新库存
        p.setStock(p.getStock()- dto.getNum());
        pointGoodsMapper.updateById(p);
        }catch (Exception e){
            throw new ValidationException("兑换失败");
        }finally {
            lockService.releaseObjectLock(key,"");
        }
    }
    public Page<PointGoodsRecordDTO> myExchangeGoods(QueryExchangeGoodsDTO dto, Page page) {
src/main/java/com/mzl/flower/service/system/UserService.java
@@ -201,7 +201,7 @@
            if(customerPoint == null){
                result.setCurrentPoint(0);
            }else{
                Integer currentPoint =customerPoint.getTotalPoint()-customerPoint.getUsedPoint()-customerPoint.getExpiredPoint();
                Integer currentPoint =customerPoint.getTotalPoint()-customerPoint.getUsedPoint()-customerPoint.getExpiredPoint()-customerPoint.getDeductionPoint();
                result.setCurrentPoint(currentPoint>=0?currentPoint:0);
            }
        }else if(Constants.USER_TYPE.supplier.name().equals(user.getType())){
src/main/java/com/mzl/flower/web/payment/DeliveryOrderController.java
@@ -136,6 +136,14 @@
    @ApiOperation(value = "查询集货站供应商配送列表")
    public ResponseEntity<ReturnDataDTO<Page<DeliveryOrderList4CheckDTO>>> selectSupplierDoList4Check(Page page
            , DeliveryOrderStationQueryDTO dto){
        LocalDate localDate = deliveryOrderService.parseLocalDate(dto.getDate());
        if(localDate != null){
            LocalDateTime end = localDate.atTime(17, 0, 0);
            LocalDateTime begin = end.plusDays(-1);
            dto.setStartDate(begin);
            dto.setEndDate(end);
        }
        return returnData(R.SUCCESS.getCode(), deliveryOrderService.selectSupplierDoList4Check(page, dto));
    }
@@ -179,6 +187,14 @@
    @ApiOperation(value = "查询供应商配送单列表")
    public ResponseEntity<ReturnDataDTO<Page<DeliveryOrder4CheckDTO>>> selectSupplierDoInfo4Check(Page page
            , DeliveryOrderInfoSpQueryDTO dto){
        LocalDate localDate = deliveryOrderService.parseLocalDate(dto.getDate());
        if(localDate != null){
            LocalDateTime end = localDate.atTime(17, 0, 0);
            LocalDateTime begin = end.plusDays(-1);
            dto.setStartDate(begin);
            dto.setEndDate(end);
        }
        return returnData(R.SUCCESS.getCode(), deliveryOrderService.selectSupplierDoInfo4Check(page, dto));
    }
src/main/resources/mapper/payment/DeliveryOrderMapper.xml
@@ -79,13 +79,16 @@
    </select>
    <select id="selectSupplierDoList4Check" resultType="com.mzl.flower.dto.response.payment.DeliveryOrderList4CheckDTO">
        SELECT tt.id, tt.supplierName, tt.supplierTel, tt.stationName, sum(tt.num) totalNum, sum(tt.amount) totalAmount
        SELECT tt.id, tt.supplierName, tt.supplierTel, tt.stationName, sum(tt.num) totalNum
            , sum(tt.amount) totalAmount, sum(tt.uncheckedCount) uncheckedCount
        from (
            select s.id, s.name supplierName, s.contact_tel supplierTel, st.name stationName
            , (select sum(num) from t_order_item oi
                where oi.supplier_id = q.supplier_id and oi.order_id = q.order_id) num
            ,  (select sum(oi.supplier_price * oi.num) from t_order_item oi
                where oi.supplier_id = q.supplier_id and oi.order_id = q.order_id) amount
            , (select count(1) from t_delivery_order dor
                where dor.id = q.id and dor.status != 'CHECKED') uncheckedCount
            from t_supplier_info s
            join t_station st on st.id = s.station_id
            join t_delivery_order q on s.id = q.supplier_id
@@ -98,8 +101,12 @@
        <if test="condition.orderNo != null and condition.orderNo != ''">
            AND q.order_no LIKE concat('%', #{condition.orderNo},'%')
        </if>
        <if test="condition.status != null and condition.status != ''">
            AND q.status = #{condition.status}
        <if test="condition.statusList != null and condition.statusList.size > 0">
            AND q.status in
            <foreach collection="condition.statusList" item="status" open="(" separator="," close=")">
                #{status}
            </foreach>
        </if>
        <if test="condition.supplierId != null">
@@ -148,8 +155,12 @@
        <if test="condition.orderNo != null and condition.orderNo != ''">
            AND q.order_no LIKE concat('%', #{condition.orderNo},'%')
        </if>
        <if test="condition.status != null and condition.status != ''">
            AND q.status = #{condition.status}
        <if test="condition.statusList != null and condition.statusList.size > 0">
            AND q.status in
            <foreach collection="condition.statusList" item="status" open="(" separator="," close=")">
                #{status}
            </foreach>
        </if>
        <if test="condition.warehouseId != null">
src/main/resources/mapper/payment/OrderMapper.xml
@@ -90,6 +90,10 @@
        <if test="condition.customerAddress != null and condition.customerAddress != ''">
            AND q.customer_address LIKE concat('%', #{condition.customerAddress},'%')
        </if>
        <if test="condition.address != null and condition.address != ''">
            AND CONCAT(q.customer_province, q.customer_city, q.customer_region, q.customer_address) LIKE concat('%',
            #{condition.address},'%')
        </if>
        <if test="condition.customer != null and condition.customer != ''">
            AND (q.customer LIKE concat('%', #{condition.customer},'%')
                or q.customer_tel LIKE concat('%', #{condition.customer},'%')
src/main/resources/mapper/point/CustomerPointMapper.xml
@@ -3,15 +3,21 @@
<mapper namespace="com.mzl.flower.mapper.point.CustomerPointMapper">
    <select id="queryPage" resultType="com.mzl.flower.dto.response.point.CustomerPointDTO">
        SELECT
            p.*,
            c.`name` as customerName,
            c.user_id as userId,
            p.id as id,
            c.id as customerId,
            IFNULL(p.total_point, 0) as totalPoint,
            IFNULL(p.used_point, 0) as usedPoint,
            IFNULL(p.expired_point, 0) as expiredPoint,
            IFNULL(p.deduction_point, 0) as deductionPoint,
            t.tel as customerTel
        FROM
            t_customer_point p
                LEFT JOIN t_customer_info c ON c.id = p.customer_id
                LEFT JOIN t_user t on p.user_id = t.id
            t_customer_info c
        LEFT JOIN t_customer_point p ON c.id = p.customer_id
        LEFT JOIN t_user t on c.user_id = t.id
        WHERE
            p.deleted = 0
            c.deleted = 0
          <if test="dto.customerName!= null and dto.customerName != ''">
              AND c.`name` LIKE CONCAT('%',#{dto.customerName},'%')
          </if>