Merge remote-tracking branch 'origin/master-v2'
| | |
| | | |
| | | @ApiModelProperty(value = "级别限制") |
| | | private String levelLimit; |
| | | |
| | | private Integer childrenCount; |
| | | } |
| | |
| | | |
| | | @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); |
| | |
| | | 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); |
| | |
| | | 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,""); |
| | | } |
| | |
| | | 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); |
| | | } |
| | | |
| | |
| | | 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({ |
| | |
| | | <!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 |