Merge remote-tracking branch 'remote-v2/master-v2' into master-v2
| | |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import javax.validation.constraints.Max; |
| | | import javax.validation.constraints.Min; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.validation.constraints.*; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | |
| | | */ |
| | | @ApiModelProperty(value = "使用条件,满多少钱") |
| | | @NotNull(message = "使用条件不能为空") |
| | | @Max(value = 99999999,message = "使用条件不能超过99999999") |
| | | // @DecimalMin(value = "0.01", inclusive = true,message = "使用条件大于0") |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @ApiModelProperty(value = "优惠券面值") |
| | | @NotNull(message = "优惠券面值不能为空") |
| | | @DecimalMin(value = "0.01", inclusive = true,message = "优惠券面值大于0") |
| | | @Max(value = 99999999,message = "优惠券面值不能超过99999999") |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | | |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.Max; |
| | | import javax.validation.constraints.Min; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.validation.constraints.*; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | |
| | | @ApiModelProperty(value = "使用条件") |
| | | @NotNull(message = "使用条件不能为空") |
| | | @Max(value = 99999999,message = "使用条件不能超过99999999") |
| | | // @DecimalMin(value = "0.01", inclusive = true,message = "使用条件大于0") |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @ApiModelProperty(value = "优惠券面值") |
| | | @NotNull(message = "优惠券面值不能为空") |
| | | @Min(value = 1,message = "优惠券面值大于0") |
| | | @DecimalMin(value = "0.01", inclusive = true,message = "优惠券面值大于0") |
| | | @Max(value = 99999999,message = "优惠券面值不能超过99999999") |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.Max; |
| | | import javax.validation.constraints.Min; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.validation.constraints.*; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | |
| | | @ApiModelProperty(value = "使用条件") |
| | | @NotNull(message = "使用条件不能为空") |
| | | @Max(value = 99999999,message = "使用条件不能超过99999999") |
| | | // @DecimalMin(value = "0.01", inclusive = true,message = "使用条件大于0") |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @ApiModelProperty(value = "优惠券面值") |
| | | @NotNull(message = "优惠券面值不能为空") |
| | | @Min(value = 1,message = "优惠券面值大于0") |
| | | @DecimalMin(value = "0.01", inclusive = true,message = "优惠券面值大于0") |
| | | @Max(value = 99999999,message = "优惠券面值不能超过99999999") |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.DecimalMin; |
| | | import javax.validation.constraints.Max; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | |
| | | @ApiModelProperty(value = "优惠券面值") |
| | | @NotNull(message = "优惠券面值不能为空") |
| | | @Max(value = 99999999,message = "优惠券面值不能超过99999999") |
| | | @DecimalMin(value = "0.01", inclusive = true,message = "优惠券面值大于0") |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | | /** |
| | |
| | | @ApiModelProperty(value = "使用条件") |
| | | @NotNull(message = "使用条件不能为空") |
| | | @Max(value = 99999999,message = "使用条件不能超过99999999") |
| | | // @DecimalMin(value = "0.01", inclusive = true,message = "使用条件大于0") |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | |
| | |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private List<String> statusList; |
| | | |
| | | @ApiModelProperty(value = "是否限购") |
| | | private Boolean isLimited; |
| | | } |
| | |
| | | package com.mzl.flower.dto.request.menber; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | @NotNull |
| | | private String pictures; |
| | | |
| | | @ApiModelProperty(value = "会员成长值获取规则") |
| | | @NotNull |
| | | private String growthValueDesc; |
| | | |
| | | } |
| | |
| | | @ApiModelProperty("会员折扣百分比") |
| | | private BigDecimal targetDiscountRatio; |
| | | |
| | | @ApiModelProperty("折扣类型Str") |
| | | private String targetGrowthValueDesc; |
| | | |
| | | |
| | | } |
| | |
| | | @ApiModelProperty("会员折扣百分比") |
| | | private BigDecimal currentDiscountRatio; |
| | | |
| | | @ApiModelProperty("会员成长值获取规则") |
| | | private String currentGrowthValueDesc; |
| | | |
| | | List<TargetMemberDTO> targetMemberInfos; |
| | | |
| | | } |
| | |
| | | |
| | | @ApiModelProperty("服务区域-区") |
| | | private String region; |
| | | |
| | | private String name; |
| | | |
| | | private String contactTel; |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.partner; |
| | | |
| | | import com.mzl.flower.dto.AttachmentDTO; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class UpdatePartnerBaseDTO { |
| | | |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("名称") |
| | | private String name; |
| | | |
| | | // @ApiModelProperty("联系方式") |
| | | // private String contactTel; |
| | | |
| | | @ApiModelProperty("头像") |
| | | private String cover; |
| | | |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "配送单状态; DELIVERY_ORDER_STATUS") |
| | | private String status; |
| | | |
| | | @ApiModelProperty(value = "日期") |
| | | private String date; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private LocalDateTime startDate; |
| | | |
| | |
| | | |
| | | @ApiModelProperty(value = "收货地址详细地址(拼接省市区地址)") |
| | | private String address; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private boolean customerQuery = false; |
| | | |
| | | @ApiModelProperty(value = "库位") |
| | | private String warehouseLocationCode; |
| | | } |
| | |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class QueryPointDetailDTO { |
| | |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private String userId; |
| | | |
| | | @ApiModelProperty("yyyy-MM-dd HH:mm:ss") |
| | | private String createTimeStartStr; |
| | | |
| | | @ApiModelProperty("yyyy-MM-dd HH:mm:ss") |
| | | private String createTimeEndStr; |
| | | |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private LocalDateTime createTimeStart; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private LocalDateTime createTimeEnd; |
| | | } |
| | |
| | | private LocalDateTime createTime; |
| | | |
| | | |
| | | /** |
| | | * 已经领取数 |
| | | */ |
| | | @ApiModelProperty(value = "已经领取数") |
| | | private Integer getNum; |
| | | |
| | | /** |
| | | * 未领取数 |
| | | */ |
| | | @ApiModelProperty(value = "未领取数") |
| | | private Integer unGetNum; |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "级别限制") |
| | | private String levelLimit; |
| | | |
| | | private Integer childrenCount; |
| | | } |
| | |
| | | @ApiModelProperty(value = "描述") |
| | | private String description; |
| | | |
| | | @ApiModelProperty(value = "库存") |
| | | private Integer limited; |
| | | |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | |
| | | |
| | | @ApiModelProperty("图片") |
| | | private String pictures; |
| | | |
| | | @ApiModelProperty(value = "会员成长值获取规则") |
| | | private String growthValueDesc; |
| | | } |
| | |
| | | |
| | | @ApiModelProperty("启用/禁用") |
| | | private Boolean isEnabled; |
| | | |
| | | @ApiModelProperty("头像") |
| | | private String cover; |
| | | |
| | | } |
| | |
| | | private BigDecimal memberDiscountAmount; |
| | | |
| | | private List<OrderItemListDTO> items; |
| | | |
| | | @ApiModelProperty(value = "优惠券类型(discount_type)") |
| | | @DictTrans(target = "couponDiscountTypeName",codeType = "COUPON_TYPE") |
| | | private String couponDiscountType; |
| | | private String couponDiscountTypeName; |
| | | |
| | | @ApiModelProperty(value = " 使用条件(满多少钱)") |
| | | private String minOrderAmount; |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "缺货数量") |
| | | private Integer lackNum; |
| | | |
| | | @ApiModelProperty(value = "优惠券总金额") |
| | | private BigDecimal couponAmountTotal; |
| | | |
| | | @ApiModelProperty(value = "真实成交总价格") |
| | | private BigDecimal realTotal; |
| | | } |
| | |
| | | @ApiModelProperty(value = "下单时间") |
| | | private LocalDateTime orderTime; |
| | | |
| | | @ApiModelProperty(value = "降级数量") |
| | | private Integer reduceNum; |
| | | |
| | | @ApiModelProperty(value = "降级金额") |
| | | private BigDecimal reduceAmount; |
| | | |
| | | @ApiModelProperty(value = "补货数量") |
| | | private Integer replaceNum; |
| | | |
| | | } |
| | |
| | | @DictTrans(target = "salesTypeStr", codeType = "after_sale_type") |
| | | private String salesType; |
| | | private String salesTypeStr; |
| | | |
| | | @ApiModelProperty(value = "真实成交价格/每扎") |
| | | private BigDecimal realPrice; |
| | | |
| | | @ApiModelProperty(value = "真实成交总价格") |
| | | private BigDecimal realTotal; |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "订单号") |
| | | private String orderNo; |
| | | |
| | | private String orderId; |
| | | } |
| | |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class CustomerPointDetailDTO extends AbstractTransDTO { |
| | | |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("记录日期") |
| | | private LocalDate recordDate; |
| | |
| | | @ApiModelProperty("积分备注") |
| | | private String remarks; |
| | | |
| | | @ApiModelProperty("创建时间") |
| | | private LocalDateTime createTime; |
| | | } |
| | |
| | | package com.mzl.flower.entity.menber; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.mzl.flower.base.BaseAutoEntity; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | |
| | | |
| | | @ApiModelProperty("图片") |
| | | private String pictures; |
| | | |
| | | @ApiModelProperty(value = "会员成长值获取规则") |
| | | private String growthValueDesc; |
| | | |
| | | } |
| | |
| | | |
| | | @ApiModelProperty("启用/禁用") |
| | | private Boolean isEnabled; |
| | | |
| | | @ApiModelProperty("头像") |
| | | private String cover; |
| | | |
| | | } |
| | |
| | | List<CouponRecordVO> getMineCouponRecordList(@Param("param") QueryMineCouponRecordDTO dto); |
| | | |
| | | void checkCouponExpired(@Param("param") QueryMineCouponRecordDTO dto); |
| | | |
| | | boolean expireCouponRecordAll(); |
| | | } |
| | |
| | | CouponTemplateVO getHomeActivityEffectAlert(@Param("param") QueryActivityEffectCouponDTO dto); |
| | | |
| | | void expireHomeActivityCouponTemplate(); |
| | | |
| | | int expireActivityCouponTemplateAll(); |
| | | } |
| | |
| | | |
| | | @Repository |
| | | public interface FlowerCategoryMapper extends BaseMapper<FlowerCategory> { |
| | | List<FlowerCategoryTreeDTO> selectCategoryList(@Param("condition") FlowerCategoryQueryDTO dto); |
| | | |
| | | List<FlowerCategoryTreeDTO> selectTreeList(@Param("condition") FlowerCategoryQueryDTO dto); |
| | | |
| | | void clearParamByParamId(@Param("paramId") Long paramId); |
| | |
| | | "LEFT JOIN t_customer_info c ON t1.create_by = c.user_id ") |
| | | List<Order> getOrderInfoByReceiveTime(); |
| | | |
| | | Integer getFlowerCompleteNumToday(@Param("userId") String userId,@Param("flowerId") Long flowerId); |
| | | int getFlowerCompleteNumWithinTimeRange(@Param("userId") String userId ,@Param("flowerId") Long flowerId, |
| | | @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime); |
| | | } |
| | |
| | | import com.mzl.flower.mapper.partner.PartnerMapper; |
| | | import com.mzl.flower.mapper.payment.OrderMapper; |
| | | import com.mzl.flower.service.coupon.CouponRecordService; |
| | | import com.mzl.flower.service.coupon.CouponTemplateService2; |
| | | import com.mzl.flower.service.flower.FlowerCategoryService; |
| | | import com.mzl.flower.service.flower.FlowerService; |
| | | import com.mzl.flower.service.menber.impl.GrowthValueDealService; |
| | |
| | | |
| | | @Autowired |
| | | private MemberGrowthRecordMapper memberGrowthRecordMapper; |
| | | |
| | | @Autowired |
| | | private CouponTemplateService2 couponTemplateService2; |
| | | |
| | | @Scheduled(cron = "1 0/30 * * * ?") |
| | | public void calculateAvePrice() { |
| | |
| | | } |
| | | |
| | | |
| | | @Scheduled(cron = "0 0/5 * * * ?") |
| | | public void expireActivityCouponTemplateAll() { |
| | | log.info("优惠券模版过期下架开始:" + DateFormatUtils.format(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss")); |
| | | |
| | | // 下架有所的过期的优惠券 |
| | | couponTemplateService2.expireActivityCouponTemplateAll(); |
| | | |
| | | log.info("优惠券模版过期下架开始:" + DateFormatUtils.format(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss")); |
| | | } |
| | | |
| | | @Scheduled(cron = "0 0/5 * * * ?") |
| | | public void expireCouponRecordAll() { |
| | | log.info("优惠券记录过期开始:" + DateFormatUtils.format(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss")); |
| | | |
| | | // 下架有所的过期的优惠券 |
| | | couponRecordService.expireCouponRecordAll(); |
| | | |
| | | log.info("优惠券记录过期开始:" + DateFormatUtils.format(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss")); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | boolean checkUserCouponExists(String couponId, Long customId); |
| | | |
| | | |
| | | boolean expireCouponRecordAll(); |
| | | } |
| | |
| | | */ |
| | | CouponTemplateVO getHomeActivityEffectAlert(QueryActivityEffectCouponDTO dto); |
| | | |
| | | boolean expireActivityCouponTemplateAll(); |
| | | } |
| | |
| | | return dto; |
| | | } |
| | | |
| | | public List<FlowerCategoryTreeDTO> selectCategoryList(FlowerCategoryQueryDTO dto){ |
| | | return categoryMapper.selectCategoryList(dto); |
| | | } |
| | | |
| | | public List<FlowerCategoryTreeDTO> selectCategoryTree(FlowerCategoryQueryDTO dto) { |
| | | List<FlowerCategoryTreeDTO> treeList = categoryMapper.selectTreeList(dto); |
| | | treeList = (List<FlowerCategoryTreeDTO>) TreeBuilderUtil.buildListToTree(treeList); |
| | |
| | | } else { |
| | | g.setPrice(dto.getPrice()); |
| | | g.setStock(dto.getStock()); |
| | | g.setLimited(dto.getLimited()); |
| | | } |
| | | |
| | | g.update(SecurityUtils.getUserId()); |
| | |
| | | public Long editFlowerAdmin(FlowerUpdateAdminDTO dto){ |
| | | Flower g = flowerMapper.selectById(dto.getId()); |
| | | g.setSales(dto.getSales()); |
| | | if (!org.springframework.util.StringUtils.isEmpty(dto.getLimited())) { |
| | | if (g.getStock() == 0 || org.springframework.util.StringUtils.isEmpty(g.getStock())) { |
| | | throw new ValidationException("库存为0或者空时不能修改限购数量"); |
| | | } |
| | | if(g.getStock()<dto.getLimited()){ |
| | | throw new ValidationException("限购数量不能大于库存"); |
| | | } |
| | | g.setLimited(dto.getLimited()); |
| | | }else{ |
| | | g.setLimited(null); |
| | | } |
| | | g.update(SecurityUtils.getUserId()); |
| | | flowerMapper.updateById(g); |
| | | |
| | |
| | | } |
| | | for (Long id : ids) { |
| | | Flower f = flowerMapper.selectById(id); |
| | | if (!org.springframework.util.StringUtils.isEmpty(dto.getLimited())) { |
| | | if (f.getStock() == 0 || org.springframework.util.StringUtils.isEmpty(f.getStock())) { |
| | | throw new ValidationException("商品" + f.getName() + "库存为0或者空时不能修改限购数量"); |
| | | } |
| | | if(f.getStock()<dto.getLimited()){ |
| | | throw new ValidationException("商品" + f.getName() + "限购数量不能大于库存"); |
| | | } |
| | | f.setLimited(dto.getLimited()); |
| | | }else{ |
| | | f.setLimited(null); |
| | | } |
| | | flowerMapper.updateById(f); |
| | | } |
| | | } |
| | |
| | | // 获取锁,最多等待 10 秒,锁自动释放时间 30 秒 |
| | | if (lock.tryLock(10, 30, TimeUnit.SECONDS)) { |
| | | try { |
| | | // 活动优惠券和积分优惠券需要根据库存来控制- 根据优惠券的发放数量来控制有没有超发 |
| | | if(StringUtils.isNotBlank(couponTemplateDO.getCategory()) && ( |
| | | couponTemplateDO.getCategory().equals(CouponCategoryEnum.ACTIVITY.getStatus()) || couponTemplateDO.getCategory().equals(CouponCategoryEnum.POINT.getStatus()) |
| | | )){ |
| | | // 活动优惠券 根据优惠券的发放数量来控制有没有超发 |
| | | if(StringUtils.isNotBlank(couponTemplateDO.getCategory()) && |
| | | couponTemplateDO.getCategory().equals(CouponCategoryEnum.ACTIVITY.getStatus()) |
| | | ){ |
| | | // 获取当前优惠券已经领取的数量 |
| | | final Integer gainTotal = getExistGainCouponRecordAmountById(couponTemplateDO.getId()); |
| | | if(couponTemplateDO.getCouponAmount().compareTo(gainTotal)<=0){ |
| | | throw new ValidationException("当前优惠券已经领完!"); |
| | | } |
| | | } |
| | | if(StringUtils.isNotBlank(couponTemplateDO.getCategory()) |
| | | && couponTemplateDO.getCategory().equals(CouponCategoryEnum.POINT.getStatus() |
| | | )){ |
| | | // 获取当前优惠券已经领取的数量 |
| | | |
| | | if(couponTemplateDO.getCouponAmount()<=0){ |
| | | throw new ValidationException("当前优惠券已经领完!"); |
| | | }else{ |
| | | couponTemplateDO.setCouponAmount(couponTemplateDO.getCouponAmount()-1); |
| | | // 更新库存 |
| | | couponTemplateService.updateById(couponTemplateDO); |
| | | } |
| | | |
| | | } |
| | | |
| | | // 根据用户领取设置的getLimit 查看当前用户是否已经超领优惠券 |
| | |
| | | ; |
| | | return baseMapper.selectCount(queryWrapper)>0; |
| | | } |
| | | |
| | | @Override |
| | | public boolean expireCouponRecordAll() { |
| | | |
| | | return couponRecordMapperCustom.expireCouponRecordAll(); |
| | | } |
| | | } |
| | |
| | | if(couponTemplateDO==null){ |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | if(couponTemplateDO.getCouponAmount()<=0 ){ |
| | | throw new ValidationException("优惠券已兑换完"); |
| | | } |
| | | CustomerPoint cp = customerPointMapper.selectOne(new LambdaQueryWrapper<CustomerPoint>() |
| | | .eq(CustomerPoint::getUserId, SecurityUtils.getUserId())); |
| | | if(cp == null || (cp.getTotalPoint()-cp.getUsedPoint()-cp.getExpiredPoint()- cp.getExpiredPoint()) < couponTemplateDO.getPoint() * dto.getNum()){ |
| | |
| | | recordDTO.setCustomerId(customer.getId()); |
| | | couponRecordService.createCouponRecord(recordDTO); |
| | | |
| | | // //更新优惠券数量 |
| | | // couponTemplateDO.setCouponAmount(couponTemplateDO.getCouponAmount()-dto.getNum()); |
| | | // couponTemplateService.updateById(couponTemplateDO); |
| | | |
| | | //更新积分汇总 |
| | | cp.setUsedPoint(cp.getUsedPoint()+couponTemplateDO.getPoint()); |
| | | customerPointMapper.updateById(cp); |
| | |
| | | detail.setRemarks(couponTemplateDO.getCouponName()); |
| | | detail.create(SecurityUtils.getUserId()); |
| | | customerPointDetailMapper.insert(detail); |
| | | }catch (Exception e){ |
| | | throw new ValidationException("兑换失败"); |
| | | }finally { |
| | | lockService.releaseObjectLock(key,""); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public boolean expireActivityCouponTemplateAll() { |
| | | |
| | | return couponTemplateMapperCustom.expireActivityCouponTemplateAll()>0; |
| | | } |
| | | |
| | | @Override |
| | | public List<CouponTemplateVO> getActivityEffectList(QueryActivityEffectCouponDTO dto) { |
| | | |
| | | return couponTemplateMapperCustom.getActivityEffectList(dto); |
| | |
| | | } |
| | | userGrowthRecordDTO.setCurrentDiscountRatio(StringUtils.isEmpty(member.getDiscountRatio()) ? BigDecimal.valueOf(100) : member.getDiscountRatio()); |
| | | userGrowthRecordDTO.setCurrentDiscountAmount(StringUtils.isEmpty(member.getDiscountAmount()) ? BigDecimal.ZERO : member.getDiscountAmount()); |
| | | userGrowthRecordDTO.setCurrentGrowthValueDesc(member.getGrowthValueDesc()); |
| | | //查询比当前等级高的会员等级信息 |
| | | List<Member> memberList = memberMapper.getgtMembersByGrowthValue(sumGrowth); |
| | | if (!CollectionUtils.isEmpty(memberList)) { |
| | |
| | | break; |
| | | } |
| | | targetMemberDTO.setTargetDiscountRatio(StringUtils.isEmpty(m.getDiscountRatio()) ? BigDecimal.valueOf(100) : m.getDiscountRatio()); |
| | | targetMemberDTO.setTargetGrowthValueDesc(m.getGrowthValueDesc()); |
| | | targetMemberDTOList.add(targetMemberDTO); |
| | | }); |
| | | } |
| | |
| | | member.create(SecurityUtils.getUserId()); |
| | | memberMapper.insert(member); |
| | | //更新会员等级 |
| | | customerMapper.updateMemberLevelByPoint(member.getId(), member.getStartPoint(), member.getEndPoint()); |
| | | customerMapper.updateMemberLevelByPoint(member.getId(), memberDTO.getStartPoint(), memberDTO.getEndPoint()); |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | //更新会员等级 |
| | | if (memberInfo.getStartPoint() != memberDTO.getStartPoint() || memberInfo.getEndPoint() != memberDTO.getEndPoint()) { |
| | | customerMapper.updateMemberLevelByPoint(memberInfo.getId(), memberInfo.getStartPoint(), memberInfo.getEndPoint()); |
| | | customerMapper.updateMemberLevelByPoint(memberInfo.getId(), memberDTO.getStartPoint(), memberDTO.getEndPoint()); |
| | | } |
| | | |
| | | BeanUtils.copyProperties(memberDTO,memberInfo); |
| | |
| | | import com.mzl.flower.dto.request.partner.*; |
| | | import com.mzl.flower.dto.response.partner.PartnerDTO; |
| | | import com.mzl.flower.entity.partner.Partner; |
| | | import com.mzl.flower.entity.supplier.Supplier; |
| | | import com.mzl.flower.entity.system.User; |
| | | import com.mzl.flower.mapper.partner.PartnerMapper; |
| | | import com.mzl.flower.mapper.system.UserMapper; |
| | | import com.mzl.flower.service.BaseService; |
| | | import com.mzl.flower.service.UploadService; |
| | | import com.mzl.flower.service.system.UserService; |
| | | import com.mzl.flower.utils.DateUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | |
| | | |
| | | private final PartnerMapper partnerMapper; |
| | | |
| | | private final UserMapper userMapper; |
| | | |
| | | |
| | | private final WxMaService maService; |
| | | |
| | |
| | | @Resource |
| | | private BaseService baseService; |
| | | |
| | | public PartnerService(PartnerMapper partnerMapper, WxMaService maService, UploadService uploadService) { |
| | | public PartnerService(PartnerMapper partnerMapper, UserMapper userMapper, WxMaService maService, UploadService uploadService) { |
| | | this.partnerMapper = partnerMapper; |
| | | this.userMapper = userMapper; |
| | | this.maService = maService; |
| | | this.uploadService = uploadService; |
| | | } |
| | |
| | | if(dto.getId()==null){ //注册 |
| | | if(checkExist(dto.getUserId())){ |
| | | throw new ValidationException("合伙人信息已登记"); |
| | | } |
| | | if(StringUtils.isNotBlank(dto.getContactTel()) && StringUtils.isNotBlank(dto.getUserId())){ |
| | | //验证手机号 |
| | | User user = userMapper.selectById(dto.getUserId()); |
| | | if(user==null){ |
| | | throw new ValidationException("合伙人账号信息不存在"); |
| | | } |
| | | if(userMapper.selectCount(new LambdaQueryWrapper<User>().eq(User::getTel, dto.getContactTel()) |
| | | .eq(User::getType, Constants.USER_TYPE.partner.name()) |
| | | .ne(User::getId, dto.getUserId()) |
| | | .eq(User::getDeleted, 0) |
| | | )>0){ |
| | | throw new ValidationException("手机号已被注册使用"); |
| | | } |
| | | user.setTel(dto.getContactTel()); |
| | | userMapper.updateById(user); |
| | | } |
| | | partner = new Partner(); |
| | | BeanUtils.copyProperties(dto, partner,"id"); |
| | |
| | | partner = partnerMapper.selectById(dto.getId()); |
| | | if(partner==null){ |
| | | throw new ValidationException("合伙人信息未登记"); |
| | | } |
| | | if(StringUtils.isNotBlank(dto.getContactTel()) && !partner.getContactTel().equals(dto.getContactTel())){ |
| | | //验证手机号 |
| | | User user = userMapper.selectById(partner.getUserId()); |
| | | if(user==null){ |
| | | throw new ValidationException("合伙人账号信息不存在"); |
| | | } |
| | | if(userMapper.selectCount(new LambdaQueryWrapper<User>().eq(User::getTel, dto.getContactTel()) |
| | | .eq(User::getType, Constants.USER_TYPE.partner.name()) |
| | | .ne(User::getId, partner.getUserId()) |
| | | .eq(User::getDeleted, 0) |
| | | )>0){ |
| | | throw new ValidationException("手机号已被注册使用"); |
| | | } |
| | | user.setTel(dto.getContactTel()); |
| | | partner.setContactTel(dto.getContactTel()); |
| | | userMapper.updateById(user); |
| | | } |
| | | BeanUtils.copyProperties(dto, partner,"id"); |
| | | partner.setIdCards(JSON.toJSONString(dto.getIdCards())); |
| | |
| | | partner.setProvince(dto.getProvince()); |
| | | partner.setCity(dto.getCity()); |
| | | partner.setRegion(dto.getRegion()); |
| | | if(StringUtils.isNotBlank(dto.getName())){ |
| | | partner.setName(dto.getName()); |
| | | } |
| | | if(StringUtils.isNotBlank(dto.getContactTel()) && !partner.getContactTel().equals(dto.getContactTel())){ |
| | | //验证手机号 |
| | | User user = userMapper.selectById(partner.getUserId()); |
| | | if(user==null){ |
| | | throw new ValidationException("合伙人账号信息不存在"); |
| | | } |
| | | if(userMapper.selectCount(new LambdaQueryWrapper<User>().eq(User::getTel, dto.getContactTel()) |
| | | .eq(User::getType, Constants.USER_TYPE.partner.name()) |
| | | .ne(User::getId, partner.getUserId()) |
| | | .eq(User::getDeleted, 0) |
| | | )>0){ |
| | | throw new ValidationException("手机号已被注册使用"); |
| | | } |
| | | user.setTel(dto.getContactTel()); |
| | | partner.setContactTel(dto.getContactTel()); |
| | | userMapper.updateById(user); |
| | | } |
| | | partner.update(SecurityUtils.getUserId()); |
| | | partnerMapper.updateById(partner); |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | public String generateCodeDTO(GenerateCodeDTO dto) { |
| | | try { |
| | |
| | | partner.update(SecurityUtils.getUserId()); |
| | | partnerMapper.updateById(partner); |
| | | } |
| | | |
| | | public void baseUpdate(UpdatePartnerBaseDTO dto) { |
| | | Partner partner = partnerMapper.selectById(dto.getId()); |
| | | if(partner==null){ |
| | | throw new ValidationException("合伙人信息未登记"); |
| | | } |
| | | BeanUtils.copyProperties(dto, partner,"id"); |
| | | partner.update(SecurityUtils.getUserId()); |
| | | partnerMapper.updateById(partner); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | public Page<DeliveryOrderListDTO> selectDeliveryOrderList(Page page, DeliveryOrderQueryDTO dto) { |
| | | Supplier s = getCurrentSupplier(); |
| | | if(Constants.DELIVERY_ORDER_STATUS.ARRIVED.name().equals(dto.getStatus())){ |
| | | List<String> statusLs = new ArrayList<>(); |
| | | statusLs.add(Constants.DELIVERY_ORDER_STATUS.ARRIVED.name()); |
| | | statusLs.add(Constants.DELIVERY_ORDER_STATUS.CHECKED.name()); |
| | | dto.setStatusList(statusLs); |
| | | } else { |
| | | dto.setStatusList(splitParam(dto.getStatus())); |
| | | } |
| | | List<DeliveryOrderListDTO> ls = deliveryOrderMapper.selectDoList(page, s.getId(), dto); |
| | | if (ls != null && ls.size() > 0) { |
| | | List<String> dIds = new ArrayList<>(); |
| | |
| | | orderItemSettlementService.saveItemSettlementInfo(oi, SecurityUtils.getUserId(), Constants.S_TYPE.CHECK); |
| | | } |
| | | |
| | | private BigDecimal calculateOrderItemDeduct(String id){ |
| | | public BigDecimal calculateOrderItemDeduct(String id){ |
| | | List<OrderItemCheck> cLs = orderItemCheckMapper.selectList(new QueryWrapper<OrderItemCheck>() |
| | | .eq("order_item_id", id) |
| | | .eq("audit_status", Constants.CHECK_AUDIT_STATUS.AGREED.name()) |
| | |
| | | throw new ValidationException("处理数量不能大于商品数量"); |
| | | } |
| | | |
| | | Order o = orderMapper.selectById(oi.getOrderId()); |
| | | if(StringUtils.isNotEmpty(o.getTransferId())){ |
| | | throw new ValidationException("已质检退款,不可提交质检记录"); |
| | | } |
| | | |
| | | if(!Constants.ORDER_STATUS_BACKEND.COLLECTION.name().equals(o.getStatusBackend()) |
| | | && !Constants.ORDER_STATUS_BACKEND.SEND.name().equals(o.getStatusBackend())){ |
| | | throw new ValidationException("订单状态异常,不可提交质检记录"); |
| | | } |
| | | |
| | | List<OrderItemCheck> cLs = orderItemCheckMapper.selectList(new QueryWrapper<OrderItemCheck>() |
| | | .ne("type", dto.getType()) |
| | | .eq("order_item_id", dto.getOrderItemId()) |
| | |
| | | BigDecimal dt = realPrice.multiply(new BigDecimal(dto.getNum())); |
| | | if(deduct.doubleValue() > dt.doubleValue() |
| | | || (oi.getRealTotal() != null && deduct.doubleValue() > oi.getRealTotal().doubleValue())){ |
| | | throw new ValidationException("降级金额不能大于商品处理数量金额"); |
| | | throw new ValidationException("降级金额不能大于商品处理数量的支付的金额"); |
| | | } |
| | | BigDecimal st = oi.getSupplierPrice().multiply(new BigDecimal(dto.getNum())); |
| | | if(deduct.doubleValue() > st.doubleValue()){ |
| | | throw new ValidationException("降级金额不能大于商品处理数量的供应商的金额"); |
| | | } |
| | | } |
| | | |
| | |
| | | @Autowired |
| | | private OrderItemCheckMapper orderItemCheckMapper; |
| | | |
| | | @Autowired |
| | | private DeliveryOrderService deliveryOrderService; |
| | | |
| | | public String createSales(OrderItemSalesCreateDTO dto){ |
| | | Integer num = dto.getNum(); |
| | | if(num == null || num == 0){ |
| | |
| | | } |
| | | |
| | | public List<OrderStatusCountDTO> getSalesStatusCount(OrderItemSalesQueryDTO dto) { |
| | | dto.setOrderStartDate(parseLocalDateTime(dto.getOrderStartDateStr())); |
| | | dto.setOrderEndDate(parseLocalDateTime(dto.getOrderEndDateStr())); |
| | | dto.setSalesStartDate(parseLocalDateTime(dto.getSalesStartDateStr())); |
| | | dto.setSalesEndDate(parseLocalDateTime(dto.getSalesEndDateStr())); |
| | | dto.setOrderStartDate(parseLocalDateTime(dto.getOrderStartDateStr(), true)); |
| | | dto.setOrderEndDate(parseLocalDateTime(dto.getOrderEndDateStr(), false)); |
| | | dto.setSalesStartDate(parseLocalDateTime(dto.getSalesStartDateStr(), true)); |
| | | dto.setSalesEndDate(parseLocalDateTime(dto.getSalesEndDateStr(), false)); |
| | | |
| | | List<CodeValueDTO> ls = codeService.searchValue("ORDER_SALES_STATUS"); |
| | | List<OrderStatusCountDTO> ll = orderItemSalesMapper.getSalesStatusCount(dto); |
| | |
| | | List<OrderItemSalesNewListDTO> ls = orderItemSalesMapper.selectItemSalesList(null, dto); |
| | | codeDecorator.decorate(ls); |
| | | |
| | | String[] rowsName = new String[]{"集货站", "商品名称", "商品单位", "商品颜色", "商品等级" |
| | | String[] rowsName = new String[]{"序号", "集货站", "商品名称", "商品单位", "商品颜色", "商品等级" |
| | | , "商品分类", "收货人", "收货人手机号码", "收货地址", "商品数量", "供应商名称", "商品售价" |
| | | , "总金额", "订单号", "售后单号", "标题", "申请数量", "理由", "实际退款", "审核结果" |
| | | , "申请时间", "平台回复"}; |
| | | List<Object[]> dataList = new ArrayList<>(); |
| | | |
| | | int sn = 1; |
| | | for (OrderItemSalesNewListDTO d : ls) { |
| | | Object[] objs = new Object[rowsName.length]; |
| | | int a = 0; |
| | | objs[a++] = sn; |
| | | objs[a++] = d.getStationName(); |
| | | objs[a++] = d.getFlowerName(); |
| | | objs[a++] = d.getFlowerUnit(); |
| | |
| | | objs[a++] = d.getFlowerCategory(); |
| | | objs[a++] = d.getCustomer(); |
| | | objs[a++] = d.getCustomerTel(); |
| | | objs[a++] = d.getCustomerAddress(); |
| | | objs[a++] = d.getCustomerProvince() + d.getCustomerCity() + d.getCustomerRegion() + d.getCustomerAddress(); |
| | | objs[a++] = d.getFlowerNum(); |
| | | objs[a++] = d.getSupplierName(); |
| | | objs[a++] = d.getPrice(); |
| | |
| | | objs[a++] = d.getRemarks(); |
| | | |
| | | dataList.add(objs); |
| | | |
| | | sn++; |
| | | } |
| | | |
| | | ExcelExportUtil excelExportUtil = new ExcelExportUtil("售后申请列表", rowsName, dataList, response); |
| | |
| | | rr.setTotal(oi.getTotal()); |
| | | rr.setSupplierPrice(oi.getSupplierPrice()); |
| | | rr.setMarkupPartner(oi.getMarkupPartner()); |
| | | rr.setRealPrice(oi.getRealPrice()); |
| | | rr.setRealTotal(oi.getRealTotal()); |
| | | |
| | | Long stationId = oi.getStationId(); |
| | | if(stationId != null) { |
| | | Station s = stationMapper.selectById(oi.getStationId()); |
| | | rr.setStationName(s.getName()); |
| | | } |
| | | |
| | | List<OrderItemCheck> cLs = orderItemCheckMapper.selectList(new QueryWrapper<OrderItemCheck>() |
| | | .eq("order_item_id", oi.getId()) |
| | | .eq("audit_status", Constants.CHECK_AUDIT_STATUS.AGREED.name()) |
| | | ); |
| | | int reduceNum = 0; |
| | | BigDecimal reduceAmount = new BigDecimal(0); |
| | | int replaceNum = 0; |
| | | if(cLs != null && cLs.size() > 0){ |
| | | for(OrderItemCheck c : cLs){ |
| | | if(Constants.CHECK_TYPE.reduce.name().equals(c.getType())){ |
| | | reduceNum += c.getNum(); |
| | | reduceAmount = reduceAmount.add(c.getDeductAmount()); |
| | | } else if(Constants.CHECK_TYPE.replace.name().equals(c.getType())){ |
| | | replaceNum += c.getNum(); |
| | | } |
| | | } |
| | | } |
| | | rr.setReduceNum(reduceNum); |
| | | rr.setReduceAmount(reduceAmount); |
| | | rr.setReplaceNum(replaceNum); |
| | | |
| | | return rr; |
| | | } |
| | |
| | | } |
| | | |
| | | BigDecimal feeSupplier = getAmount(dto.getFeeSupplier()); |
| | | BigDecimal supplierTotal = oi.getSupplierPrice().multiply(new BigDecimal(sl.getNum())); |
| | | if(feeSupplier.doubleValue() > supplierTotal.doubleValue()){ |
| | | throw new ValidationException("供应商扣款金额不能大于商品申请数量的供应商售价"); |
| | | } |
| | | |
| | | BigDecimal feePartner = getAmount(dto.getFeePartner()); |
| | | BigDecimal feePlatform = getAmount(dto.getFeePlatform()); |
| | | BigDecimal feePlatformPack = getAmount(dto.getFeePlatformPack()); |
| | |
| | | BigDecimal totalFee = feeSupplier.add(feePartner).add(feePlatform).add(feePlatformPack) |
| | | .add(feePlatformCheck).add(feePlatformTransport); |
| | | |
| | | BigDecimal st = oi.getPrice().multiply(new BigDecimal(sl.getNum()));//申请售后的花的金额 |
| | | BigDecimal st = oi.getRealPrice().multiply(new BigDecimal(sl.getNum()));//申请售后的花的金额,使用券后的单价 |
| | | if(totalFee.doubleValue() > st.doubleValue()){ |
| | | throw new ValidationException("退款金额不能大于商品申请数量的售价"); |
| | | } |
| | |
| | | } |
| | | } |
| | | preFee = preFee.add(totalFee); |
| | | if(preFee.doubleValue() > oi.getTotal().doubleValue()){ |
| | | if(preFee.doubleValue() > oi.getRealTotal().doubleValue()){//使用券后的总价 |
| | | throw new ValidationException("退款总金额不能大于商品总价"); |
| | | } |
| | | |
| | | BigDecimal deduct = deliveryOrderService.calculateOrderItemDeduct(sl.getOrderItemId());//质检已扣款金额 |
| | | preFee = preFee.add(deduct); |
| | | if(preFee.doubleValue() > oi.getRealTotal().doubleValue()){ |
| | | throw new ValidationException("退款总金额(包含质检退款)不能大于商品总价"); |
| | | } |
| | | |
| | | sl.setRemarks(dto.getRemarks()); |
| | | sl.setFeeSupplier(feeSupplier); |
| | | sl.setFeePartner(feePartner); |
| | |
| | | import com.mzl.flower.dto.PriceDTO; |
| | | import com.mzl.flower.dto.request.menber.MemberGrowthRecordDTO; |
| | | import com.mzl.flower.dto.request.payment.*; |
| | | import com.mzl.flower.dto.response.coupon.CouponRecordVO; |
| | | import com.mzl.flower.dto.response.flower.FlowerCartListDTO; |
| | | import com.mzl.flower.dto.response.flower.FlowerCartListWrapDTO; |
| | | import com.mzl.flower.dto.response.flower.FlowerDTO; |
| | |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | c.setNum(dto.getNum()); |
| | | c.create(userId); |
| | | |
| | | // 限购 1.首先查看购物车中的数量是否已经超过限售数量 |
| | | final FlowerDTO flowerDetail = flowerService.getFlowerDetail(c.getFlowerId()); |
| | | if(null!=c.getNum() && null!=flowerDetail.getLimited() |
| | | && c.getNum().compareTo(flowerDetail.getLimited())>0){ |
| | | throw new ValidationException("数量不能超过限售数量!"); |
| | | } |
| | | |
| | | // 限购 2.查看已结单的订单的当前花朵已经购买的数量,加当前购物车的加入的数量是否超过限购的数量,查看当前5点前到昨天五点前 |
| | | Integer completeNumToday=getFlowerCompleteNumToday(userId,c.getFlowerId()); |
| | | Integer tmp=completeNumToday+c.getNum(); |
| | | if(null!=tmp && null!=flowerDetail.getLimited() |
| | | && tmp.compareTo(flowerDetail.getLimited())>0){ |
| | | throw new ValidationException("当天的订单的花数量加上购物车的数量不能超过限售数量!"); |
| | | } |
| | | |
| | | cartMapper.insert(c); |
| | | } else { |
| | | // 查看是否已经超过当前商品的限购数量 |
| | |
| | | // 限购 2.查看已结单的订单的当前花朵已经购买的数量,加当前购物车的加入的数量是否超过限购的数量,查看当前5点前到昨天五点前 |
| | | Integer completeNumToday=getFlowerCompleteNumToday(userId,c.getFlowerId()); |
| | | Integer tmp=completeNumToday+c.getNum(); |
| | | if(tmp.compareTo(flowerDetail.getLimited())>0){ |
| | | if(null!=tmp && null!=flowerDetail.getLimited() |
| | | && tmp.compareTo(flowerDetail.getLimited())>0){ |
| | | throw new ValidationException("当天的订单的花数量加上购物车的数量不能超过限售数量!"); |
| | | } |
| | | |
| | |
| | | Integer completeNumToday=getFlowerCompleteNumToday(userId,cartSaveDTO.getId()); |
| | | Integer tmp=completeNumToday+cartSaveDTO.getNum(); |
| | | Flower flower=flowerMapper.selectById(cartSaveDTO.getId()); |
| | | if(tmp.compareTo(flower.getLimited())>0){ |
| | | if(null!=flower.getLimited() && tmp.compareTo(flower.getLimited())>0){ |
| | | throw new ValidationException("商品:'"+flower.getName()+"' 昨天17:00到今天17:00 超过限售数量:"+flower.getLimited()+"!"); |
| | | } |
| | | }); |
| | |
| | | // 限购数量 鲜花数量校验 |
| | | Integer completeNumToday=getFlowerCompleteNumToday(userId,flower.getId()); |
| | | Integer tmp=completeNumToday+flower.getNum(); |
| | | if(tmp.compareTo(flower.getLimited())>0){ |
| | | if(null!=tmp && null!=flower.getLimited() |
| | | && tmp.compareTo(flower.getLimited())>0){ |
| | | throw new ValidationException("商品:'"+flower.getName()+"' 昨天17:00到今天17:00 超过限售数量:"+flower.getLimited()+"!"); |
| | | } |
| | | }); |
| | |
| | | List<FlowerCartListDTO> flowers = p.getFlowers(); |
| | | Map<Long, List<ParamItemDTO>> paramMap = new HashMap<>(); |
| | | final BigDecimal flowerAmount = order.getFlowerAmount();//订单商品总价 |
| | | final BigDecimal memberCouponAmount = order.getMemberCouponAmount();//使用优惠券面值 |
| | | final BigDecimal memberCouponAmount = getAmount(order.getMemberCouponAmount());//使用优惠券面值 |
| | | BigDecimal usedCouponAmount = new BigDecimal(0); |
| | | for (int i = 0; i < flowers.size(); i++) { |
| | | FlowerCartListDTO f = flowers.get(i); |
| | |
| | | private BigDecimal calculateCoupon(BigDecimal couponAmount, BigDecimal itemTotalAmount |
| | | , BigDecimal totalAmount, Integer num, BigDecimal price |
| | | , boolean isLastOne, BigDecimal usedCouponAmount){ |
| | | if(couponAmount == null){ |
| | | if(couponAmount == null || couponAmount.doubleValue() == 0){ |
| | | return new BigDecimal(0); |
| | | } |
| | | |
| | |
| | | List<OrderListDTO> ls = getOrderListBase(page, dto); |
| | | if (ls != null && ls.size() > 0) { |
| | | List<String> orderIds = new ArrayList<>(); |
| | | Map<String, OrderListDTO> orderMap = new HashMap<>(); |
| | | for (OrderListDTO o : ls) { |
| | | o.setCouldRefund(couldRefund(o.getStatusBackend(), o.getPaymentTime())); |
| | | orderIds.add(o.getId()); |
| | | orderMap.put(o.getId(), o); |
| | | } |
| | | |
| | | List<OrderItemListDTO> itemList = orderItemMapper.getOrderItems(orderIds); |
| | |
| | | List<OrderItemListDTO> ll = map.computeIfAbsent(orderId, k -> new ArrayList<>()); |
| | | OrderItemListDTO d = new OrderItemListDTO(); |
| | | BeanUtils.copyProperties(oi, d); |
| | | |
| | | OrderListDTO o = orderMap.get(orderId); |
| | | if(dto.isCustomerQuery() && o != null && StringUtils.isEmpty(o.getTransferId())){ |
| | | d.setReduceNum(0); |
| | | d.setLackNum(0); |
| | | d.setReplaceNum(0); |
| | | } |
| | | |
| | | ll.add(d); |
| | | } |
| | | |
| | |
| | | |
| | | public Page<OrderListDTO> selectCustomerOrderList(Page page, OrderQueryDTO dto) { |
| | | dto.setCreateBy(SecurityUtils.getUserId()); |
| | | dto.setCustomerQuery(true); |
| | | |
| | | return selectOrderList(page, dto); |
| | | } |
| | |
| | | |
| | | List<OrderPointGoodsListDTO> pointGoodsList = orderMapper.getPointGoodsList(id); |
| | | dto.setPointGoodsList(pointGoodsList); |
| | | |
| | | //判断优惠券ID是否为空 用户优惠券id |
| | | if(StringUtils.isNotBlank(o.getMemberCouponId())){ |
| | | CouponRecordVO couponRecordVO = couponRecordService.getCouponRecordById(o.getMemberCouponId()); |
| | | if(!ObjectUtils.isEmpty(couponRecordVO)){ |
| | | dto.setCouponDiscountType(couponRecordVO.getCouponDiscountType()); |
| | | dto.setMinOrderAmount("满"+couponRecordVO.getMinOrderAmount()); |
| | | } |
| | | } |
| | | |
| | | return dto; |
| | | } |
| | |
| | | } |
| | | |
| | | public Integer getFlowerCompleteNumToday(String userId,Long flowerId){ |
| | | Integer completeNum= orderMapper.getFlowerCompleteNumToday(userId,flowerId); |
| | | |
| | | int completeNum = 0; |
| | | // 获取当前时间 |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | // 构造今天的17:00 |
| | | LocalDateTime todayAtFivePM = LocalDateTime.of(LocalDate.now(), LocalTime.of(17, 0)); |
| | | // 定义时间区间的开始和结束时间 |
| | | LocalDateTime startTime; |
| | | LocalDateTime endTime; |
| | | |
| | | if (now.isAfter(todayAtFivePM)) { |
| | | // 当前时间大于今天的17:00,取今天17:00到明天17:00的区间 |
| | | startTime = todayAtFivePM; |
| | | endTime = todayAtFivePM.plusDays(1); // 明天的17:00 |
| | | } else { |
| | | // 当前时间小于今天的17:00,取昨天17:00到今天17:00的区间 |
| | | startTime = todayAtFivePM.minusDays(1); // 昨天的17:00 |
| | | endTime = todayAtFivePM; // 今天的17:00 |
| | | } |
| | | |
| | | // 调用Mapper方法,传递开始时间和结束时间 |
| | | completeNum = orderMapper.getFlowerCompleteNumWithinTimeRange(userId, flowerId, startTime, endTime); |
| | | |
| | | return completeNum; |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | import com.mzl.flower.dto.request.payment.TransferDetailReqDTO; |
| | | import com.mzl.flower.dto.request.payment.TransferReqDTO; |
| | | import com.mzl.flower.dto.request.payment.UserPaymentDTO; |
| | | import com.mzl.flower.entity.flower.Flower; |
| | | import com.mzl.flower.entity.payment.*; |
| | | import com.mzl.flower.entity.system.UserWechat; |
| | | import com.mzl.flower.mapper.flower.FlowerMapper; |
| | |
| | | |
| | | @Autowired |
| | | private CouponRecordService couponRecordService; |
| | | |
| | | @Autowired |
| | | private OrderService orderService; |
| | | |
| | | /** |
| | | * 微信预支付 |
| | |
| | | } |
| | | |
| | | public Map payAgain(String orderId){ |
| | | // 获取订单里面的商品是否有限购的,如果有则判断是否已经超过限购数量 |
| | | List<OrderItem> orderItemList = orderItemMapper.selectList(new QueryWrapper<OrderItem>() |
| | | .eq("order_id", orderId)); |
| | | |
| | | orderItemList.forEach(orderItem -> { |
| | | // 限购数量 鲜花数量校验 |
| | | Integer completeNumToday=orderService.getFlowerCompleteNumToday(orderItem.getCreateBy(),orderItem.getFlowerId()); |
| | | Integer tmp=completeNumToday+orderItem.getNum(); |
| | | Flower flower=flowerMapper.selectById(orderItem.getFlowerId()); |
| | | if(null!=flower.getLimited() && tmp.compareTo(flower.getLimited())>0){ |
| | | throw new ValidationException("商品:'"+flower.getName()+"' 昨天17:00到今天17:00 超过限售数量:"+flower.getLimited()+"!"); |
| | | } |
| | | |
| | | }); |
| | | |
| | | |
| | | UserPayment up = userPaymentMapper.selectOne( |
| | | new QueryWrapper<UserPayment>().eq("order_id", orderId)); |
| | | if(StringUtils.isNotEmpty(up.getStatus())){ |
| | |
| | | import com.mzl.flower.mapper.point.CustomerPointDetailMapper; |
| | | import com.mzl.flower.mapper.point.CustomerPointMapper; |
| | | import com.mzl.flower.service.BaseService; |
| | | import com.mzl.flower.utils.DateUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | } |
| | | |
| | | public Page<CustomerPointDetailDTO> queryCustomerDetails(QueryPointDetailDTO dto, Page page) { |
| | | if(StringUtils.isNotBlank(dto.getCreateTimeStartStr())){ |
| | | dto.setCreateTimeStart(DateUtils.dateTimeStringToLocalDateTime(dto.getCreateTimeStartStr())); |
| | | } |
| | | if(StringUtils.isNotBlank(dto.getCreateTimeEndStr())){ |
| | | dto.setCreateTimeEnd(DateUtils.dateTimeStringToLocalDateTime(dto.getCreateTimeEndStr())); |
| | | } |
| | | List<CustomerPointDetailDTO> list = customerPointMapper.queryCustomerDetails(dto, page); |
| | | page.setRecords(list); |
| | | |
| | |
| | | if(!Constants.POINT_GOODS_STATUS.A.name().equals(p.getStatus())){ |
| | | throw new ValidationException("商品未上架"); |
| | | } |
| | | if(p.getStock()< dto.getNum()){ |
| | | if(p.getStock() <=0 || p.getStock()< dto.getNum()){ |
| | | throw new ValidationException("商品库存不足"); |
| | | } |
| | | CustomerPoint cp = customerPointMapper.selectOne(new LambdaQueryWrapper<CustomerPoint>() |
| | |
| | | //更新库存 |
| | | p.setStock(p.getStock()- dto.getNum()); |
| | | pointGoodsMapper.updateById(p); |
| | | }catch (Exception e){ |
| | | throw new ValidationException("兑换失败"); |
| | | }finally { |
| | | lockService.releaseObjectLock(key,""); |
| | | } |
| | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "签到历史") |
| | | public ResponseEntity<ReturnDataDTO<List<CustomerPointDetailDTO>>> signList(String startDateStr, String endDateStr) { |
| | | LocalDate startDate = LocalDate.parse(startDateStr); |
| | | LocalDate endDate = LocalDate.parse(endDateStr); |
| | | LocalDate startDate = customerPointService.parseLocalDate(startDateStr); |
| | | LocalDate endDate = customerPointService.parseLocalDate(endDateStr); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), customerPointService.signList(startDate, endDate)); |
| | | } |
| | |
| | | return returnData(R.SUCCESS.getCode(), categoryService.selectCategoryTree(dto)); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "获取商品分类列表") |
| | | public ResponseEntity<ReturnDataDTO<List<FlowerCategoryTreeDTO>>> selectCategoryList(FlowerCategoryQueryDTO dto){ |
| | | return returnData(R.SUCCESS.getCode(), categoryService.selectCategoryList(dto)); |
| | | } |
| | | |
| | | @GetMapping("/tree/delete") |
| | | @ApiOperation(value = "删除商品分类") |
| | | @ApiImplicitParams({ |
| | |
| | | throw new ValidationException("用户不存在"); |
| | | } |
| | | SupplierDTO supplierDTO = supplierMapper.getCurrentSupplier(user.getId()); |
| | | if (ObjectUtils.isEmpty(supplierDTO)) { |
| | | throw new ValidationException("用户不存在"); |
| | | } |
| | | if (supplierDTO.getIsEnabled() == false) { |
| | | if (supplierDTO != null && supplierDTO.getIsEnabled() == false) { |
| | | throw new ValidationException("用户已禁用,请联系管理员"); |
| | | } |
| | | String tokenCache = stringCacheClient.get(TOKEN_KEY + SEPARATOR + user.getId()); |
| | |
| | | } |
| | | |
| | | |
| | | @PostMapping("/base/update") |
| | | @ApiOperation(value = "合伙人基本信息修改", notes = "合伙人基本信息修改") |
| | | public ResponseEntity<ReturnDataDTO> baseUpdate(@Validated @RequestBody UpdatePartnerBaseDTO dto) { |
| | | partnerService.baseUpdate(dto); |
| | | return returnData(R.SUCCESS.getCode(),null); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/addOrUpdate") |
| | | @ApiOperation(value = "合伙人信息登记、修改", notes = "合伙人信息登记、修改") |
| | | public ResponseEntity<ReturnDataDTO> addOrUpdatePartner(@Validated @RequestBody UpdatePartnerDTO dto) { |
| | |
| | | @PostMapping("/giveaway") |
| | | @ApiOperation(value = "管理端-积分赠送", notes = "管理端-积分赠送") |
| | | public ResponseEntity<ReturnDataDTO> giveawayPoint(@Validated @RequestBody ChangePointDTO dto) { |
| | | if(dto.getPoint()<=0){ |
| | | throw new ValidationException("赠送积分必须大于0"); |
| | | } |
| | | customerPointService.giveawayPoint(dto); |
| | | return returnData(R.SUCCESS.getCode(),null); |
| | | } |
| | |
| | | @PostMapping("/deduction") |
| | | @ApiOperation(value = "管理端-积分扣除", notes = "管理端-积分扣除") |
| | | public ResponseEntity<ReturnDataDTO> deductionPoint(@Validated @RequestBody ChangePointDTO dto) { |
| | | if(dto.getPoint()<=0){ |
| | | throw new ValidationException("扣除积分必须大于0"); |
| | | } |
| | | customerPointService.deductionPoint(dto); |
| | | return returnData(R.SUCCESS.getCode(),null); |
| | | } |
| | |
| | | @ApiOperation(value = "获取配送单列表") |
| | | public ResponseEntity<ReturnDataDTO<Page<DeliveryOrderListDTO>>> selectOrderList(Page page |
| | | , DeliveryOrderQueryDTO dto){ |
| | | LocalDate localDate = deliveryOrderService.parseLocalDate(dto.getDate()); |
| | | if(localDate != null){ |
| | | LocalDateTime endDate = localDate.atTime(17, 0, 0); |
| | | LocalDateTime startDate = endDate.plusDays(-1); |
| | | dto.setStartDate(startDate); |
| | | dto.setEndDate(endDate); |
| | | } |
| | | return returnData(R.SUCCESS.getCode(), deliveryOrderService.selectDeliveryOrderList(page, dto)); |
| | | } |
| | | |
| | |
| | | |
| | | private void valid(CreateCouponTemplateActivyDTO dto){ |
| | | |
| | | if (StringUtils.isNotBlank(dto.getCouponDiscountType()) |
| | | && dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType()) |
| | | && dto.getMinOrderAmount().compareTo(dto.getCouponDiscountValue()) < 0) { |
| | | throw new ValidationException("订单金额不能小于折扣金额"); |
| | | // if (StringUtils.isNotBlank(dto.getCouponDiscountType()) |
| | | // && dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType()) |
| | | // && dto.getMinOrderAmount().compareTo(dto.getCouponDiscountValue()) < 0) { |
| | | // throw new ValidationException("优惠券使用条件不能小于面值金额"); |
| | | // } |
| | | if (StringUtils.isNotBlank(dto.getCouponDiscountType()) && dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType())) { |
| | | |
| | | if(dto.getMinOrderAmount().compareTo(BigDecimal.ZERO)<=0){ |
| | | throw new ValidationException("优惠券使用条件不能小于0"); |
| | | } |
| | | if(dto.getMinOrderAmount().compareTo(dto.getCouponDiscountValue()) < 0){ |
| | | throw new ValidationException("优惠券使用条件不能小于面值金额"); |
| | | } |
| | | |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(dto.getCouponDiscountType()) |
| | | && dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType()) |
| | | && dto.getCouponDiscountValue().compareTo(BigDecimal.ZERO) <= 0) { |
| | |
| | | if(dto.getUsageEndDate()==null){ |
| | | throw new ValidationException("固定时间结束日期不能为空"); |
| | | } |
| | | |
| | | if(dto.getUsageStartDate().isAfter(dto.getUsageEndDate())){ |
| | | throw new ValidationException("固定时间开始时间不能大于结束日期"); |
| | | } |
| | | |
| | | |
| | | // 固定时间的使用开始时间必须大于领取的结束时间 |
| | | |
| | | if(null!=dto.getGetEndDate() && null!=dto.getUsageStartDate() && dto.getGetEndDate().isAfter(dto.getUsageStartDate())){ |
| | | throw new ValidationException("使用开始时间必须大于领取结束时间!"); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | // 领取后 有效时间 |
| | |
| | | } |
| | | } |
| | | |
| | | // |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | private void valid(CreateCouponTemplatePointDTO dto){ |
| | | |
| | | if (StringUtils.isNotBlank(dto.getCouponDiscountType()) |
| | | && dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType()) |
| | | && dto.getMinOrderAmount().compareTo(dto.getCouponDiscountValue()) < 0) { |
| | | throw new ValidationException("订单金额不能小于折扣金额"); |
| | | if (StringUtils.isNotBlank(dto.getCouponDiscountType()) && dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType())) { |
| | | |
| | | if(dto.getMinOrderAmount().compareTo(BigDecimal.ZERO)<=0){ |
| | | throw new ValidationException("优惠券使用条件不能小于0"); |
| | | } |
| | | if(dto.getMinOrderAmount().compareTo(dto.getCouponDiscountValue()) < 0){ |
| | | throw new ValidationException("优惠券使用条件不能小于面值金额"); |
| | | } |
| | | |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(dto.getCouponDiscountType()) |
| | | && dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType()) |
| | | && dto.getCouponDiscountValue().compareTo(BigDecimal.ZERO) <= 0) { |
| | |
| | | import com.mzl.flower.base.R; |
| | | import com.mzl.flower.base.ReturnDataDTO; |
| | | import com.mzl.flower.config.exception.ValidationException; |
| | | import com.mzl.flower.dto.request.coupon.CreateCouponTemplateActivyDTO; |
| | | import com.mzl.flower.dto.request.coupon.CreateCouponTemplateBO; |
| | | import com.mzl.flower.dto.request.coupon.CreateCouponTemplateUserDTO; |
| | | import com.mzl.flower.dto.request.coupon.QueryCouponDTO; |
| | |
| | | @ApiOperation(value = "新增", notes = "新增") |
| | | public ResponseEntity<ReturnDataDTO> create(@Validated @RequestBody CreateCouponTemplateUserDTO dto) { |
| | | |
| | | if (dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType()) && dto.getMinOrderAmount().compareTo(dto.getCouponDiscountValue()) < 0) { |
| | | throw new ValidationException("订单金额不能小于折扣金额"); |
| | | } |
| | | |
| | | if (dto.getCouponDiscountType().equals(CouponTypeEnum.ZERO.getType()) && dto.getMinOrderAmount().compareTo(BigDecimal.ZERO) != 0) { |
| | | throw new ValidationException("无门槛的订单金额必须为0"); |
| | | } |
| | | |
| | | valid(dto); |
| | | |
| | | CreateCouponTemplateBO couponTemplateBO = new CreateCouponTemplateBO(); |
| | | BeanUtils.copyProperties(dto, couponTemplateBO); |
| | |
| | | |
| | | dto.setId(id); |
| | | |
| | | if (dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType()) && dto.getMinOrderAmount().compareTo(dto.getCouponDiscountValue()) < 0) { |
| | | throw new ValidationException("订单金额不能小于折扣金额"); |
| | | } |
| | | |
| | | if (dto.getCouponDiscountType().equals(CouponTypeEnum.ZERO.getType()) && dto.getMinOrderAmount().compareTo(BigDecimal.ZERO) != 0) { |
| | | throw new ValidationException("无门槛的订单金额必须为0"); |
| | | } |
| | | |
| | | valid(dto); |
| | | |
| | | CouponTemplateDO couponTemplateDO = couponTemplateService.getById(dto.getId()); |
| | | if (null == couponTemplateDO) { |
| | |
| | | } |
| | | |
| | | |
| | | private void valid(CreateCouponTemplateUserDTO dto){ |
| | | if (StringUtils.isNotBlank(dto.getCouponDiscountType()) && dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType())) { |
| | | |
| | | if(dto.getMinOrderAmount().compareTo(BigDecimal.ZERO)<=0){ |
| | | throw new ValidationException("优惠券使用条件不能小于0"); |
| | | } |
| | | if(dto.getMinOrderAmount().compareTo(dto.getCouponDiscountValue()) < 0){ |
| | | throw new ValidationException("优惠券使用条件不能小于面值金额"); |
| | | } |
| | | |
| | | } |
| | | |
| | | if (dto.getCouponDiscountType().equals(CouponTypeEnum.ZERO.getType()) && dto.getMinOrderAmount().compareTo(BigDecimal.ZERO) != 0) { |
| | | throw new ValidationException("无门槛的订单金额必须为0"); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | throw new ValidationException("会员等级不存在"); |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(dto.getCouponDiscountType()) |
| | | && dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType()) |
| | | && dto.getMinOrderAmount().compareTo(dto.getCouponDiscountValue()) < 0) { |
| | | throw new ValidationException("订单金额不能小于折扣金额"); |
| | | if (StringUtils.isNotBlank(dto.getCouponDiscountType()) && dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType())) { |
| | | |
| | | if(dto.getMinOrderAmount().compareTo(BigDecimal.ZERO)<=0){ |
| | | throw new ValidationException("优惠券使用条件不能小于0"); |
| | | } |
| | | if(dto.getMinOrderAmount().compareTo(dto.getCouponDiscountValue()) < 0){ |
| | | throw new ValidationException("优惠券使用条件不能小于面值金额"); |
| | | } |
| | | |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(dto.getCouponDiscountType()) |
| | | && dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType()) |
| | | && dto.getCouponDiscountValue().compareTo(BigDecimal.ZERO) <= 0) { |
| | |
| | | AND customer_id = #{param.customerId} |
| | | </if> |
| | | </update> |
| | | <update id="expireCouponRecordAll"> |
| | | update t_coupon_record set `status`='expired' where `status`='unused' and effective_end < NOW() |
| | | </update> |
| | | |
| | | <select id="statisCouponTemplateCount" resultType="java.lang.Integer"> |
| | | select IFNULL(count(1),0) as cnt from t_coupon_record where deleted=false and category=#{param.category} |
| | |
| | | <update id="expireHomeActivityCouponTemplate"> |
| | | update t_coupon_template set status='expired' where category='activity' and get_type='home' and status='active' |
| | | </update> |
| | | <update id="expireActivityCouponTemplateAll"> |
| | | update t_coupon_template set status='expired' where category='activity' and get_end_date < NOW() |
| | | </update> |
| | | |
| | | <select id="getCouponTemplatePage" resultType="com.mzl.flower.dto.response.coupon.CouponTemplateVO"> |
| | | <include refid="QuerySql2"/> |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
| | | <mapper namespace="com.mzl.flower.mapper.flower.FlowerCategoryMapper"> |
| | | |
| | | <select id="selectCategoryList" resultType="com.mzl.flower.dto.response.flower.FlowerCategoryTreeDTO"> |
| | | SELECT q.* |
| | | , (select count(1) from t_flower_category f where f.parent_id = q.id) childrenCount |
| | | FROM t_flower_category q |
| | | WHERE q.deleted = 0 |
| | | <if test="condition.name != null and condition.name != ''"> |
| | | AND (q.name LIKE concat('%', #{condition.name},'%') |
| | | or exists ( |
| | | select 1 from t_flower_category sq where sq.parent_id = q.id and sq.name LIKE concat('%', #{condition.name},'%') |
| | | ) |
| | | ) |
| | | </if> |
| | | <choose> |
| | | <when test="condition.parentId != null"> |
| | | AND q.parent_id = #{condition.parentId} |
| | | </when> |
| | | <otherwise> |
| | | AND q.parent_id is null |
| | | </otherwise> |
| | | </choose> |
| | | <if test="condition.shown != null and condition.shown"> |
| | | AND (q.shown = 1 or q.shown is null) |
| | | </if> |
| | | <if test="condition.shown != null and !condition.shown"> |
| | | AND q.shown = 0 |
| | | </if> |
| | | ORDER BY q.sort_by, q.create_time Desc |
| | | </select> |
| | | |
| | | <select id="selectTreeList" resultType="com.mzl.flower.dto.response.flower.FlowerCategoryTreeDTO"> |
| | | SELECT q.* |
| | | , (select min(f.price) from t_flower f where f.category = q.id and f.status = 'UP' and f.deleted = 0) priceLow |
| | |
| | | <if test="condition.recommend != null and !condition.recommend"> |
| | | AND (f.recommend = 0 or f.recommend is null) |
| | | </if> |
| | | <if test="condition.isLimited != null and condition.isLimited"> |
| | | AND f.limited > 0 |
| | | </if> |
| | | <if test="condition.isLimited != null and !condition.isLimited"> |
| | | AND (f.limited = 0 or f.limited is null) |
| | | </if> |
| | | <if test="condition.statusList != null and condition.statusList.size > 0"> |
| | | and f.status in |
| | | <foreach collection="condition.statusList" item="item" open="(" separator="," close=")"> |
| | |
| | | , oi.flower_level, oi.flower_category, o.customer, o.customer_tel, o.customer_province, o.customer_city |
| | | , o.customer_region, o.customer_address, oi.num flowerNum, oi.supplier_name, oi.price, oi.total |
| | | , o.order_no, si.sales_no, si.title, si.num, si.reason, si.total_fee, si.status, si.create_time |
| | | , si.remarks, oi.supplier_price, oi.markup_partner, si.audit_time,si.sales_type |
| | | , si.remarks, oi.supplier_price, oi.markup_partner, si.audit_time,si.sales_type, oi.real_price, oi.real_total |
| | | FROM t_order_item_sales si |
| | | join t_order_item oi on oi.id = si.order_item_id |
| | | join t_order o on si.order_id = o.id |
| | |
| | | and (oi.status = 'reduce' or oi.status = 'abnormal') |
| | | ) |
| | | and q.transfer_id is null |
| | | and q.status in ('COLLECTION', 'SEND') |
| | | </if> |
| | | <if test="condition.billId != null and condition.billId != ''"> |
| | | AND q.bill_id = #{condition.billId} |
| | |
| | | where oi.order_id = q.id |
| | | and oi.flower_name LIKE concat('%', #{condition.flowerName},'%') |
| | | ) |
| | | </if> |
| | | <if test="condition.warehouseLocationCode != null and condition.warehouseLocationCode != ''"> |
| | | AND q.warehouse_location_code LIKE concat('%', #{condition.warehouseLocationCode},'%') |
| | | </if> |
| | | |
| | | ORDER BY q.create_time desc, q.payment_time desc |
| | |
| | | join t_order_point_goods opg on opg.goods_record_id = gr.id |
| | | where opg.order_id = #{orderId} |
| | | </select> |
| | | <select id="getFlowerCompleteNumToday" resultType="java.lang.Integer"> |
| | | <select id="getFlowerCompleteNumWithinTimeRange" resultType="java.lang.Integer"> |
| | | select IFNULL(sum(oi.num),0) as complete_num |
| | | from t_order o |
| | | left join t_order_item oi |
| | |
| | | and o.status_backend not in ('PENDING','CANCEL','REFUND') |
| | | and o.create_by=#{userId} |
| | | AND oi.flower_id=#{flowerId} |
| | | AND o.complete_time BETWEEN DATE_SUB(CURDATE(), INTERVAL 1 DAY) + INTERVAL 17 HOUR AND CURDATE() + INTERVAL 17 HOUR |
| | | AND o.payment_time BETWEEN #{startTime} AND #{endTime} |
| | | </select> |
| | | </mapper> |
| | |
| | | <mapper namespace="com.mzl.flower.mapper.payment.OrderSettlementDetailMapper"> |
| | | |
| | | <select id="selectSettlementDetailList" resultType="com.mzl.flower.dto.response.payment.OrderSettlementDetailDTO"> |
| | | SELECT s.*, oi.flower_name, oi.flower_level, o.receive_time, oi.check_time, o.order_no |
| | | SELECT s.*, oi.flower_name, oi.flower_level, o.receive_time, oi.check_time, o.order_no, s.order_id |
| | | FROM t_order_settlement_detail s |
| | | join t_order_item oi on oi.id = s.order_item_id |
| | | join t_order o on o.id = s.order_id |
| | |
| | | <if test="condition.userName != null and condition.userName != ''"> |
| | | AND (si.name LIKE CONCAT('%', #{condition.userName}, '%') OR pi.name LIKE CONCAT('%', #{condition.userName}, '%')) |
| | | </if> |
| | | ORDER BY s.create_time desc |
| | | ORDER BY s.create_time desc, userName |
| | | </select> |
| | | |
| | | <select id="getUserIncome" resultType="java.math.BigDecimal"> |
| | |
| | | AND t.record_date <= #{dto.recordDateEnd} |
| | | ]]> |
| | | </if> |
| | | <if test="dto.type!=null and dto.type != null"> |
| | | <if test="dto.type!=null and dto.type != ''"> |
| | | and t.type = #{dto.type} |
| | | </if> |
| | | <if test="dto.remarks!=null and dto.remarks != null"> |
| | | and t.remarks like CONCAT('%',#{dto.remarks},'%') |
| | | </if> |
| | | <if test="dto.createTimeStart!=null"> |
| | | <![CDATA[ |
| | | AND t.create_time >= #{dto.createTimeStart} |
| | | ]]> |
| | | </if> |
| | | <if test="dto.createTimeEnd!=null "> |
| | | <![CDATA[ |
| | | AND t.create_time <= #{dto.createTimeEnd} |
| | | ]]> |
| | | </if> |
| | | order by t.create_time desc |
| | | </select> |
| | | </mapper> |