Merge remote-tracking branch 'origin/master-v2' into master-v2
| | |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class DeliveryOrderInfoSpQueryDTO { |
| | |
| | | @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; |
| | | } |
| | |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class DeliveryOrderStationQueryDTO { |
| | |
| | | @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; |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private List<String> idList; |
| | | |
| | | @ApiModelProperty(value = "收货地址详细地址(拼接省市区地址)") |
| | | private String address; |
| | | } |
| | |
| | | private String flowerLevelStr; |
| | | |
| | | @ApiModelProperty(value = "订单商品状态") |
| | | @DictTrans(target = "statusStr", codeType = "CHECK_OPERATE") |
| | | @DictTrans(target = "statusStr", codeType = "ORDER_ITEM_STATUS") |
| | | private String status; |
| | | private String statusStr; |
| | | |
| | |
| | | @ApiModelProperty(value = "供应商总价") |
| | | private BigDecimal totalAmount; |
| | | |
| | | @ApiModelProperty(value = "未完成质检订单数量") |
| | | private Integer uncheckedCount; |
| | | } |
| | |
| | | public void deleteFlower(Long id){ |
| | | |
| | | final Flower flower = flowerMapper.selectById(id); |
| | | if(flower == null){ |
| | | throw new ValidationException("商品未找到"); |
| | | } |
| | | |
| | | flowerMapper.deleteById(id); |
| | | |
| | |
| | | ); |
| | | 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); |
| | | } |
| | |
| | | |
| | | //////////////////////////////////////////////////////////////新接口 |
| | | public Page<DeliveryOrderList4CheckDTO> selectSupplierDoList4Check(Page page, DeliveryOrderStationQueryDTO dto) { |
| | | dto.setStatusList(splitParam(dto.getStatus())); |
| | | List<DeliveryOrderList4CheckDTO> ls = deliveryOrderMapper.selectSupplierDoList4Check(page, dto); |
| | | |
| | | page.setRecords(ls); |
| | |
| | | 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){ |
| | |
| | | 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); |
| | | } |
| | |
| | | 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; |
| | |
| | | @Autowired |
| | | private CustomerPointDetailMapper customerPointDetailMapper; |
| | | |
| | | |
| | | @Autowired |
| | | private RedisLockService lockService; |
| | | |
| | | public Long addPointGoods(PointGoodsCreateDTO dto){ |
| | | PointGoods p = new PointGoods(); |
| | |
| | | } |
| | | } |
| | | |
| | | 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("商品未找到"); |
| | |
| | | } |
| | | 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("积分不足"); |
| | | } |
| | | //记录兑换记录 |
| | |
| | | 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()); |
| | |
| | | //更新库存 |
| | | 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) { |
| | |
| | | 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())){ |
| | |
| | | @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)); |
| | | } |
| | | |
| | |
| | | @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)); |
| | | } |
| | | |
| | |
| | | </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 |
| | |
| | | <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"> |
| | |
| | | <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"> |
| | |
| | | <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},'%') |
| | |
| | | <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> |