Merge remote-tracking branch 'remote-v2/master-v2' into master-v2
| | |
| | | |
| | | @ApiModelProperty(value = "价格排序") |
| | | private Integer typeRank; |
| | | |
| | | // 限购数量 |
| | | private Integer limited;// |
| | | } |
| | |
| | | package com.mzl.flower.dto.response.payment; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.mzl.flower.base.AbstractTransDTO; |
| | | import com.mzl.flower.base.annotation.DictTrans; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | |
| | | |
| | | @ApiModelProperty(value = "下单时间") |
| | | private LocalDateTime orderTime; |
| | | |
| | | @ApiModelProperty(value = "收货日期") |
| | | @JsonFormat(pattern="yyyy-MM-dd" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime receiveTime; |
| | | |
| | | @ApiModelProperty(value = "订单号") |
| | | private String orderNo; |
| | | } |
| | |
| | | package com.mzl.flower.dto.response.payment; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.mzl.flower.base.AbstractTransDTO; |
| | | import com.mzl.flower.base.annotation.DictTrans; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class OrderSettlementDetailDTO extends AbstractTransDTO { |
| | |
| | | @ApiModelProperty(value = "售后理赔") |
| | | private BigDecimal salesFee; |
| | | |
| | | @ApiModelProperty(value = "收货日期") |
| | | @JsonFormat(pattern="yyyy-MM-dd" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime receiveTime; |
| | | |
| | | @ApiModelProperty(value = "质检日期") |
| | | @JsonFormat(pattern="yyyy-MM-dd" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime checkTime; |
| | | |
| | | @ApiModelProperty(value = "订单号") |
| | | private String orderNo; |
| | | } |
| | |
| | | ") t2 ON t1.create_by = t2.create_by AND t1.receive_time = t2.max_time " + |
| | | "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); |
| | | } |
| | |
| | | return dto; |
| | | } |
| | | |
| | | public OrderItemCheckNumDTO getOtherCheck(String itemId, String type){ |
| | | public OrderItemCheckNumDTO getOtherCheck(String itemId, String type, boolean isSupplier){ |
| | | OrderItemCheck c = orderItemCheckMapper.selectOne(new QueryWrapper<OrderItemCheck>() |
| | | .eq("type", type) |
| | | .eq("order_item_id", itemId) |
| | |
| | | BeanUtils.copyProperties(c, dto); |
| | | User user = userMapper.selectById(c.getCreateBy()); |
| | | dto.setCreateName(user.getNickName()); |
| | | |
| | | if(Constants.CHECK_TYPE.lack.name().equals(c.getType()) && isSupplier){ |
| | | OrderItem oi = orderItemMapper.selectById(itemId); |
| | | BigDecimal lackFeeSupplier = oi.getSupplierPrice().multiply(new BigDecimal(c.getNum())); |
| | | dto.setDeductAmount(lackFeeSupplier); |
| | | } |
| | | } |
| | | |
| | | return dto; |
| | |
| | | import com.mzl.flower.dto.request.payment.*; |
| | | 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 com.mzl.flower.dto.response.flower.ParamItemDTO; |
| | | import com.mzl.flower.dto.response.partner.PartnerOrderDTO; |
| | | import com.mzl.flower.dto.response.payment.*; |
| | |
| | | import com.mzl.flower.entity.coupon.CouponRecordDO; |
| | | import com.mzl.flower.entity.customer.Address; |
| | | import com.mzl.flower.entity.customer.Customer; |
| | | import com.mzl.flower.entity.flower.Flower; |
| | | import com.mzl.flower.entity.flower.FlowerSupplierSaleNum; |
| | | import com.mzl.flower.entity.menber.Member; |
| | | import com.mzl.flower.entity.partner.Partner; |
| | |
| | | @Autowired |
| | | private CouponRecordService couponRecordService; |
| | | |
| | | |
| | | public void changeFlower2Cart(CartSaveDTO dto) { |
| | | String userId = SecurityUtils.getUserId(); |
| | | String key = userId + "_" + dto.getId(); |
| | |
| | | |
| | | cartMapper.insert(c); |
| | | } else { |
| | | // 查看是否已经超过当前商品的限购数量 |
| | | final FlowerDTO flowerDetail = flowerService.getFlowerDetail(c.getFlowerId()); |
| | | c.setNum((c.getNum()==null?0:c.getNum()) + dto.getNum()); |
| | | |
| | | // 限购 1.首先查看购物车中的数量是否已经超过限售数量 |
| | | 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(tmp.compareTo(flowerDetail.getLimited())>0){ |
| | | throw new ValidationException("当天的订单的花数量加上购物车的数量不能超过限售数量!"); |
| | | } |
| | | |
| | | c.update(userId); |
| | | if (c.getNum() <= 0) { |
| | | cartMapper.deleteById(c.getId()); |
| | |
| | | } |
| | | |
| | | public PreOrderDTO getPreOrderInfo(List<CartSaveDTO> flowers, Map<Long, PriceDTO> priceMap) { |
| | | String userId = SecurityUtils.getUserId(); |
| | | |
| | | if (flowers == null || flowers.size() == 0) { |
| | | throw new ValidationException("请选择商品"); |
| | | } |
| | |
| | | } |
| | | idNumMap.put(id, num); |
| | | } |
| | | |
| | | // 限购数量校验 鲜花数量校验 |
| | | flowers.forEach(cartSaveDTO -> { |
| | | // 限购数量 鲜花数量校验 |
| | | Integer completeNumToday=getFlowerCompleteNumToday(userId,cartSaveDTO.getId()); |
| | | Integer tmp=completeNumToday+cartSaveDTO.getNum(); |
| | | Flower flower=flowerMapper.selectById(cartSaveDTO.getId()); |
| | | if(tmp.compareTo(flower.getLimited())>0){ |
| | | throw new ValidationException("商品:'"+flower.getName()+"' 昨天17:00到今天17:00 超过限售数量:"+flower.getLimited()+"!"); |
| | | } |
| | | }); |
| | | |
| | | PreOrderDTO result = new PreOrderDTO(); |
| | | |
| | | List<FlowerCartListDTO> ls = flowerMapper.selectFlowerOrderList(ids); |
| | |
| | | } |
| | | |
| | | public Map commitOrder(OrderCommitDTO dto, PreOrderDTO p, Map<Long, PriceDTO> priceMap) { |
| | | String userId = SecurityUtils.getUserId(); |
| | | p.getFlowers().forEach(flower -> { |
| | | // 限购数量 鲜花数量校验 |
| | | Integer completeNumToday=getFlowerCompleteNumToday(userId,flower.getId()); |
| | | Integer tmp=completeNumToday+flower.getNum(); |
| | | if(tmp.compareTo(flower.getLimited())>0){ |
| | | throw new ValidationException("商品:'"+flower.getName()+"' 昨天17:00到今天17:00 超过限售数量:"+flower.getLimited()+"!"); |
| | | } |
| | | }); |
| | | |
| | | WxMaJscode2SessionResult session = null; |
| | | try { |
| | | session = weChatService.getWxMaSessionInfo(dto.getWxcode()); |
| | |
| | | deliveryName = d.getName(); |
| | | } |
| | | |
| | | String userId = SecurityUtils.getUserId(); |
| | | |
| | | Order order = new Order(); |
| | | order.setId(UUIDGenerator.getUUID()); |
| | | |
| | |
| | | BigDecimal usedCouponAmount = new BigDecimal(0); |
| | | for (int i = 0; i < flowers.size(); i++) { |
| | | FlowerCartListDTO f = flowers.get(i); |
| | | |
| | | OrderItem t = new OrderItem(); |
| | | t.setId(UUIDGenerator.getUUID()); |
| | | t.setOrderId(order.getId()); |
| | |
| | | Order o = orderMapper.getUserLastOrder(userId); |
| | | return o.getReceiveTime(); |
| | | } |
| | | |
| | | public Integer getFlowerCompleteNumToday(String userId,Long flowerId){ |
| | | Integer completeNum= orderMapper.getFlowerCompleteNumToday(userId,flowerId); |
| | | return completeNum; |
| | | } |
| | | } |
| | |
| | | } |
| | | String type = settlement.getType(); |
| | | |
| | | String name = ""; |
| | | if(Constants.SETTLEMENT_TYPE.supplier.name().equals(type)){ |
| | | Supplier s = supplierMapper.selectOne(new QueryWrapper<Supplier>() |
| | | .eq("user_id", settlement.getUserId())); |
| | | name = "供应商" + s.getName(); |
| | | } else { |
| | | Partner p = partnerMapper.selectOne(new QueryWrapper<Partner>() |
| | | .eq("user_id", settlement.getUserId())); |
| | | name = "合伙人" + p.getName(); |
| | | } |
| | | |
| | | UserWechat wechat = wechatMapper.selectOne(new QueryWrapper<UserWechat>() |
| | | .eq("user_id", settlement.getUserId())); |
| | | if(wechat == null){ |
| | | String msg; |
| | | if(Constants.SETTLEMENT_TYPE.supplier.name().equals(type)){ |
| | | Supplier s = supplierMapper.selectOne(new QueryWrapper<Supplier>() |
| | | .eq("user_id", settlement.getUserId())); |
| | | msg = "供应商" + s.getName() + "未绑定账号无法结算"; |
| | | } else { |
| | | Partner p = partnerMapper.selectOne(new QueryWrapper<Partner>() |
| | | .eq("user_id", settlement.getUserId())); |
| | | msg = "合伙人" + p.getName() + "未绑定账号无法结算"; |
| | | } |
| | | String msg = name + "未绑定账号无法结算"; |
| | | log.error(msg); |
| | | throw new ValidationException(msg); |
| | | } |
| | |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | String day = format(now, "yyyy-MM-dd"); |
| | | |
| | | String remarks = Constants.SETTLEMENT_TYPE.supplier.name().equals(type) |
| | | ? "供应商账单结算" : "合伙人账单结算"; |
| | | String remarks = name + "账单结算"; |
| | | |
| | | String appId = Constants.SETTLEMENT_TYPE.supplier.name().equals(type) |
| | | ? PyamentV3Configurer.supplier_app_id : PyamentV3Configurer.partner_app_id; |
对比新文件 |
| | |
| | | package com.mzl.flower.web.customer; |
| | | |
| | | import com.mzl.flower.base.BaseController; |
| | | import com.mzl.flower.base.R; |
| | | import com.mzl.flower.base.ReturnDataDTO; |
| | | import com.mzl.flower.constant.Constants; |
| | | import com.mzl.flower.dto.response.payment.*; |
| | | import com.mzl.flower.service.payment.DeliveryOrderService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | @RestController |
| | | @RequestMapping("/api/customer/delivery") |
| | | @Api(value = "配送管理-花店", tags = "配送管理-花店") |
| | | @Validated |
| | | @Slf4j |
| | | public class DeliveryCustomerController extends BaseController { |
| | | |
| | | @Autowired |
| | | private DeliveryOrderService deliveryOrderService; |
| | | |
| | | @GetMapping("/mine/list/check/info/reduce") |
| | | @ApiOperation(value = "降级操作详情") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "orderItemId", value = "订单商品id", required = true, dataType = "String", paramType = "query") |
| | | }) |
| | | public ResponseEntity<ReturnDataDTO<OrderItemCheckReduceDTO>> getReduceCheck(String orderItemId){ |
| | | return returnData(R.SUCCESS.getCode(), deliveryOrderService.getReduceCheck(orderItemId)); |
| | | } |
| | | |
| | | @GetMapping("/mine/list/check/info/lack") |
| | | @ApiOperation(value = "缺货操作详情") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "orderItemId", value = "订单商品id", required = true, dataType = "String", paramType = "query") |
| | | }) |
| | | public ResponseEntity<ReturnDataDTO<OrderItemCheckNumDTO>> getLackCheck(String orderItemId){ |
| | | return returnData(R.SUCCESS.getCode(), deliveryOrderService.getOtherCheck(orderItemId |
| | | , Constants.CHECK_TYPE.lack.name(), false)); |
| | | } |
| | | } |
| | |
| | | @ApiOperation(value = "补货操作详情") |
| | | public ResponseEntity<ReturnDataDTO<OrderItemCheckNumDTO>> getReplaceCheck(String orderItemId){ |
| | | return returnData(R.SUCCESS.getCode(), deliveryOrderService.getOtherCheck(orderItemId |
| | | , Constants.CHECK_TYPE.replace.name())); |
| | | , Constants.CHECK_TYPE.replace.name(), false)); |
| | | } |
| | | |
| | | @GetMapping("/check/info/lack") |
| | | @ApiOperation(value = "缺货操作详情") |
| | | public ResponseEntity<ReturnDataDTO<OrderItemCheckNumDTO>> getLackCheck(String orderItemId){ |
| | | return returnData(R.SUCCESS.getCode(), deliveryOrderService.getOtherCheck(orderItemId |
| | | , Constants.CHECK_TYPE.lack.name())); |
| | | , Constants.CHECK_TYPE.lack.name(), false)); |
| | | } |
| | | |
| | | @PostMapping("/check/info/do/reduce") |
| | |
| | | }) |
| | | public ResponseEntity<ReturnDataDTO<OrderItemCheckNumDTO>> getReplaceCheck(String orderItemId){ |
| | | return returnData(R.SUCCESS.getCode(), deliveryOrderService.getOtherCheck(orderItemId |
| | | , Constants.CHECK_TYPE.replace.name())); |
| | | , Constants.CHECK_TYPE.replace.name(), false)); |
| | | } |
| | | |
| | | @GetMapping("/list/check/info/lack") |
| | |
| | | }) |
| | | public ResponseEntity<ReturnDataDTO<OrderItemCheckNumDTO>> getLackCheck(String orderItemId){ |
| | | return returnData(R.SUCCESS.getCode(), deliveryOrderService.getOtherCheck(orderItemId |
| | | , Constants.CHECK_TYPE.lack.name())); |
| | | , Constants.CHECK_TYPE.lack.name(), false)); |
| | | } |
| | | |
| | | @GetMapping("/list/check/info/agree") |
| | |
| | | }) |
| | | public ResponseEntity<ReturnDataDTO<OrderItemCheckNumDTO>> getReplaceCheck(String orderItemId){ |
| | | return returnData(R.SUCCESS.getCode(), deliveryOrderService.getOtherCheck(orderItemId |
| | | , Constants.CHECK_TYPE.replace.name())); |
| | | , Constants.CHECK_TYPE.replace.name(), true)); |
| | | } |
| | | |
| | | @GetMapping("/mine/list/check/info/lack") |
| | |
| | | }) |
| | | public ResponseEntity<ReturnDataDTO<OrderItemCheckNumDTO>> getLackCheck(String orderItemId){ |
| | | return returnData(R.SUCCESS.getCode(), deliveryOrderService.getOtherCheck(orderItemId |
| | | , Constants.CHECK_TYPE.lack.name())); |
| | | , Constants.CHECK_TYPE.lack.name(), true)); |
| | | } |
| | | } |
| | |
| | | SELECT ois.order_item_id, oi.flower_name, oi.flower_level, oi.num, oi.supplier_price price , s.`status` |
| | | , ois.check_num, ois.check_fee, ois.replace_num, ois.replace_fee, ois.lack_num, ois.lack_fee_supplier lackFee |
| | | , ois.station_fee, ois.sales_fee_supplier salesFee, ois.service_fee_rate, ois.service_fee |
| | | , ois.income_supplier income, o.status_backend, o.create_time orderTime |
| | | , ois.income_supplier income, o.status_backend, o.create_time orderTime, o.receive_time, o.order_no |
| | | , (select count(1) from t_order_item_sales sa where sa.order_item_id = oi.id) salesNum |
| | | FROM t_delivery_order_item doi |
| | | join t_delivery_order q on q.id = doi.delivery_id |
| | |
| | | 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 IFNULL(sum(oi.num),0) as complete_num |
| | | from t_order o |
| | | left join t_order_item oi |
| | | on o.id=oi.order_id |
| | | where o.DELETEd=0 and oi.DELETEd=0 |
| | | 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 |
| | | </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 |
| | | SELECT s.*, oi.flower_name, oi.flower_level, o.receive_time, oi.check_time, o.order_no |
| | | 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 |
| | | WHERE s.deleted = 0 |
| | | AND s.settlement_id = #{settlementId} |
| | | ORDER BY s.create_time desc |
| | | ORDER BY o.receive_time desc, o.id, oi.flower_name |
| | | </select> |
| | | |
| | | </mapper> |