收银后台跟进
This commit is contained in:
@@ -0,0 +1,219 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.orderInfo.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description /
|
||||
* @author lyf
|
||||
* @date 2023-11-22
|
||||
**/
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name="tb_order_info")
|
||||
public class TbOrderInfo implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "`id`")
|
||||
@ApiModelProperty(value = "id")
|
||||
private Integer id;
|
||||
|
||||
@Column(name = "`order_no`")
|
||||
@ApiModelProperty(value = "订单编号")
|
||||
private String orderNo;
|
||||
|
||||
@Column(name = "`settlement_amount`")
|
||||
@ApiModelProperty(value = "商户结算金额")
|
||||
private BigDecimal settlementAmount;
|
||||
|
||||
@Column(name = "`pack_fee`")
|
||||
@ApiModelProperty(value = "包装费")
|
||||
private BigDecimal packFee;
|
||||
|
||||
@Column(name = "`origin_amount`")
|
||||
@ApiModelProperty(value = "订单原金额")
|
||||
private BigDecimal originAmount;
|
||||
|
||||
@Column(name = "`product_amount`")
|
||||
@ApiModelProperty(value = "商品售价")
|
||||
private BigDecimal productAmount;
|
||||
|
||||
@Column(name = "`amount`")
|
||||
@ApiModelProperty(value = "最终金额---退单后,金额变动")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Column(name = "`refund_amount`")
|
||||
@ApiModelProperty(value = "退单金额")
|
||||
private BigDecimal refundAmount;
|
||||
|
||||
@Column(name = "`pay_amount`")
|
||||
@ApiModelProperty(value = "支付金额")
|
||||
private BigDecimal payAmount;
|
||||
|
||||
@Column(name = "`freight_amount`")
|
||||
@ApiModelProperty(value = "订单邮递费用")
|
||||
private BigDecimal freightAmount;
|
||||
|
||||
@Column(name = "`cash_paid_amount`")
|
||||
@ApiModelProperty(value = "现金支付金额")
|
||||
private BigDecimal cashPaidAmount;
|
||||
|
||||
@Column(name = "`wx_paid_amount`")
|
||||
@ApiModelProperty(value = "微信支付金额")
|
||||
private BigDecimal wxPaidAmount;
|
||||
|
||||
@Column(name = "`ali_paid_amount`")
|
||||
@ApiModelProperty(value = "支付宝支付金额")
|
||||
private BigDecimal aliPaidAmount;
|
||||
|
||||
@Column(name = "`deposit_paid_amount`")
|
||||
@ApiModelProperty(value = "储值支付金额")
|
||||
private BigDecimal depositPaidAmount;
|
||||
|
||||
@Column(name = "`bank_paid_amount`")
|
||||
@ApiModelProperty(value = "银联支付金额")
|
||||
private BigDecimal bankPaidAmount;
|
||||
|
||||
@Column(name = "`virtual_paid_amount`")
|
||||
@ApiModelProperty(value = "虚拟支付金额")
|
||||
private BigDecimal virtualPaidAmount;
|
||||
|
||||
@Column(name = "`other_paid_amount`")
|
||||
@ApiModelProperty(value = "其他支付金额")
|
||||
private BigDecimal otherPaidAmount;
|
||||
|
||||
@Column(name = "`discount_amount`")
|
||||
@ApiModelProperty(value = "折扣金额")
|
||||
private BigDecimal discountAmount;
|
||||
|
||||
@Column(name = "`table_id`")
|
||||
@ApiModelProperty(value = "台桌Id")
|
||||
private String tableId;
|
||||
|
||||
@Column(name = "`small_change`")
|
||||
@ApiModelProperty(value = "订单抹零")
|
||||
private BigDecimal smallChange;
|
||||
|
||||
@Column(name = "`send_type`")
|
||||
@ApiModelProperty(value = "发货类型")
|
||||
private String sendType;
|
||||
|
||||
@Column(name = "`order_type`")
|
||||
@ApiModelProperty(value = "订单类型-cash收银-miniapp小程序-offline线下")
|
||||
private String orderType;
|
||||
|
||||
@Column(name = "`product_type`")
|
||||
@ApiModelProperty(value = "订单里面商品的类型")
|
||||
private String productType;
|
||||
|
||||
@Column(name = "`status`")
|
||||
@ApiModelProperty(value = "状态: unpaid 待支付unsend待发货 closed 订单完成 send 已发refunding申请退单refund退单cancelled取消订单merge合台")
|
||||
private String status;
|
||||
|
||||
@Column(name = "`billing_id`")
|
||||
@ApiModelProperty(value = "orderType为union-minor时,parentId生效,为其上级合单id")
|
||||
private String billingId;
|
||||
|
||||
@Column(name = "`merchant_id`")
|
||||
@ApiModelProperty(value = "对于平台订单,是收款商户Id")
|
||||
private String merchantId;
|
||||
|
||||
@Column(name = "`shop_id`")
|
||||
@ApiModelProperty(value = "店铺Id")
|
||||
private String shopId;
|
||||
|
||||
@Column(name = "`is_vip`")
|
||||
@ApiModelProperty(value = "是否vip订单")
|
||||
private Integer isVip;
|
||||
|
||||
@Column(name = "`member_id`")
|
||||
@ApiModelProperty(value = "商户会员Id")
|
||||
private String memberId;
|
||||
|
||||
@Column(name = "`user_id`")
|
||||
@ApiModelProperty(value = "用户Id")
|
||||
private String userId;
|
||||
|
||||
@Column(name = "`product_score`")
|
||||
@ApiModelProperty(value = "该订单商品赠送的积分")
|
||||
private Integer productScore;
|
||||
|
||||
@Column(name = "`deduct_score`")
|
||||
@ApiModelProperty(value = "抵扣积分")
|
||||
private Integer deductScore;
|
||||
|
||||
@Column(name = "`user_coupon_id`")
|
||||
@ApiModelProperty(value = "用户使用的卡券")
|
||||
private String userCouponId;
|
||||
|
||||
@Column(name = "`user_coupon_amount`")
|
||||
@ApiModelProperty(value = "优惠券抵扣金额")
|
||||
private BigDecimal userCouponAmount;
|
||||
|
||||
@Column(name = "`is_master`")
|
||||
@ApiModelProperty(value = "是否主单")
|
||||
private Integer isMaster;
|
||||
|
||||
@Column(name = "`master_id`")
|
||||
@ApiModelProperty(value = "如果为退单时,主单号")
|
||||
private String masterId;
|
||||
|
||||
@Column(name = "`refund_able`")
|
||||
@ApiModelProperty(value = "是否支持退款,1支持退单, 0不支持退单")
|
||||
private Integer refundAble;
|
||||
|
||||
@Column(name = "`paid_time`")
|
||||
@ApiModelProperty(value = "支付时间")
|
||||
private Long paidTime;
|
||||
|
||||
@Column(name = "`is_effect`")
|
||||
@ApiModelProperty(value = "是否生效,若订单合单之后,则原订单不会生效")
|
||||
private Integer isEffect;
|
||||
|
||||
@Column(name = "`is_group`")
|
||||
@ApiModelProperty(value = "是否合台")
|
||||
private Integer isGroup;
|
||||
|
||||
@Column(name = "`updated_at`")
|
||||
@ApiModelProperty(value = "updatedAt")
|
||||
private Long updatedAt;
|
||||
|
||||
@Column(name = "`system_time`")
|
||||
@ApiModelProperty(value = "系统时间")
|
||||
private Long systemTime;
|
||||
|
||||
@Column(name = "`created_at`")
|
||||
@ApiModelProperty(value = "createdAt")
|
||||
private Long createdAt;
|
||||
|
||||
@Column(name = "`is_accepted`")
|
||||
@ApiModelProperty(value = "收银台是否已接单")
|
||||
private Integer isAccepted;
|
||||
|
||||
public void copy(TbOrderInfo source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.orderInfo.repository;
|
||||
|
||||
import me.zhengjie.modules.orderInfo.domain.TbOrderInfo;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2023-11-22
|
||||
**/
|
||||
public interface TbOrderInfoRepository extends JpaRepository<TbOrderInfo, Integer>, JpaSpecificationExecutor<TbOrderInfo> {
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.orderInfo.rest;
|
||||
|
||||
import me.zhengjie.annotation.Log;
|
||||
import me.zhengjie.modules.orderInfo.domain.TbOrderInfo;
|
||||
import me.zhengjie.modules.orderInfo.service.TbOrderInfoService;
|
||||
import me.zhengjie.modules.orderInfo.service.dto.TbOrderInfoQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2023-11-22
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "/orderInfo管理")
|
||||
@RequestMapping("/api/tbOrderInfo")
|
||||
public class TbOrderInfoController {
|
||||
|
||||
private final TbOrderInfoService tbOrderInfoService;
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('tbOrderInfo:list')")
|
||||
public void exportTbOrderInfo(HttpServletResponse response, TbOrderInfoQueryCriteria criteria) throws IOException {
|
||||
tbOrderInfoService.download(tbOrderInfoService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询/orderInfo")
|
||||
@ApiOperation("查询/orderInfo")
|
||||
@PreAuthorize("@el.check('tbOrderInfo:list')")
|
||||
public ResponseEntity<Object> queryTbOrderInfo(TbOrderInfoQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(tbOrderInfoService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增/orderInfo")
|
||||
@ApiOperation("新增/orderInfo")
|
||||
@PreAuthorize("@el.check('tbOrderInfo:add')")
|
||||
public ResponseEntity<Object> createTbOrderInfo(@Validated @RequestBody TbOrderInfo resources){
|
||||
return new ResponseEntity<>(tbOrderInfoService.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改/orderInfo")
|
||||
@ApiOperation("修改/orderInfo")
|
||||
@PreAuthorize("@el.check('tbOrderInfo:edit')")
|
||||
public ResponseEntity<Object> updateTbOrderInfo(@Validated @RequestBody TbOrderInfo resources){
|
||||
tbOrderInfoService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除/orderInfo")
|
||||
@ApiOperation("删除/orderInfo")
|
||||
@PreAuthorize("@el.check('tbOrderInfo:del')")
|
||||
public ResponseEntity<Object> deleteTbOrderInfo(@RequestBody Integer[] ids) {
|
||||
tbOrderInfoService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.orderInfo.service;
|
||||
|
||||
import me.zhengjie.modules.orderInfo.domain.TbOrderInfo;
|
||||
import me.zhengjie.modules.orderInfo.service.dto.TbOrderInfoDto;
|
||||
import me.zhengjie.modules.orderInfo.service.dto.TbOrderInfoQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务接口
|
||||
* @author lyf
|
||||
* @date 2023-11-22
|
||||
**/
|
||||
public interface TbOrderInfoService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param criteria 条件
|
||||
* @param pageable 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(TbOrderInfoQueryCriteria criteria, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param criteria 条件参数
|
||||
* @return List<TbOrderInfoDto>
|
||||
*/
|
||||
List<TbOrderInfoDto> queryAll(TbOrderInfoQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param id ID
|
||||
* @return TbOrderInfoDto
|
||||
*/
|
||||
TbOrderInfoDto findById(Integer id);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param resources /
|
||||
* @return TbOrderInfoDto
|
||||
*/
|
||||
TbOrderInfoDto create(TbOrderInfo resources);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param resources /
|
||||
*/
|
||||
void update(TbOrderInfo resources);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Integer[] ids);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
* @param all 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<TbOrderInfoDto> all, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.orderInfo.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description /
|
||||
* @author lyf
|
||||
* @date 2023-11-22
|
||||
**/
|
||||
@Data
|
||||
public class TbOrderInfoDto implements Serializable {
|
||||
|
||||
private Integer id;
|
||||
|
||||
/** 订单编号 */
|
||||
private String orderNo;
|
||||
|
||||
/** 商户结算金额 */
|
||||
private BigDecimal settlementAmount;
|
||||
|
||||
/** 包装费 */
|
||||
private BigDecimal packFee;
|
||||
|
||||
/** 订单原金额 */
|
||||
private BigDecimal originAmount;
|
||||
|
||||
/** 商品售价 */
|
||||
private BigDecimal productAmount;
|
||||
|
||||
/** 最终金额---退单后,金额变动 */
|
||||
private BigDecimal amount;
|
||||
|
||||
/** 退单金额 */
|
||||
private BigDecimal refundAmount;
|
||||
|
||||
/** 支付金额 */
|
||||
private BigDecimal payAmount;
|
||||
|
||||
/** 订单邮递费用 */
|
||||
private BigDecimal freightAmount;
|
||||
|
||||
/** 现金支付金额 */
|
||||
private BigDecimal cashPaidAmount;
|
||||
|
||||
/** 微信支付金额 */
|
||||
private BigDecimal wxPaidAmount;
|
||||
|
||||
/** 支付宝支付金额 */
|
||||
private BigDecimal aliPaidAmount;
|
||||
|
||||
/** 储值支付金额 */
|
||||
private BigDecimal depositPaidAmount;
|
||||
|
||||
/** 银联支付金额 */
|
||||
private BigDecimal bankPaidAmount;
|
||||
|
||||
/** 虚拟支付金额 */
|
||||
private BigDecimal virtualPaidAmount;
|
||||
|
||||
/** 其他支付金额 */
|
||||
private BigDecimal otherPaidAmount;
|
||||
|
||||
/** 折扣金额 */
|
||||
private BigDecimal discountAmount;
|
||||
|
||||
/** 台桌Id */
|
||||
private String tableId;
|
||||
|
||||
/** 订单抹零 */
|
||||
private BigDecimal smallChange;
|
||||
|
||||
/** 发货类型 */
|
||||
private String sendType;
|
||||
|
||||
/** 订单类型-cash收银-miniapp小程序-offline线下 */
|
||||
private String orderType;
|
||||
|
||||
/** 订单里面商品的类型 */
|
||||
private String productType;
|
||||
|
||||
/** 状态: unpaid 待支付unsend待发货 closed 订单完成 send 已发refunding申请退单refund退单cancelled取消订单merge合台 */
|
||||
private String status;
|
||||
|
||||
/** orderType为union-minor时,parentId生效,为其上级合单id */
|
||||
private String billingId;
|
||||
|
||||
/** 对于平台订单,是收款商户Id */
|
||||
private String merchantId;
|
||||
|
||||
/** 店铺Id */
|
||||
private String shopId;
|
||||
|
||||
/** 是否vip订单 */
|
||||
private Integer isVip;
|
||||
|
||||
/** 商户会员Id */
|
||||
private String memberId;
|
||||
|
||||
/** 用户Id */
|
||||
private String userId;
|
||||
|
||||
/** 该订单商品赠送的积分 */
|
||||
private Integer productScore;
|
||||
|
||||
/** 抵扣积分 */
|
||||
private Integer deductScore;
|
||||
|
||||
/** 用户使用的卡券 */
|
||||
private String userCouponId;
|
||||
|
||||
/** 优惠券抵扣金额 */
|
||||
private BigDecimal userCouponAmount;
|
||||
|
||||
/** 是否主单 */
|
||||
private Integer isMaster;
|
||||
|
||||
/** 如果为退单时,主单号 */
|
||||
private String masterId;
|
||||
|
||||
/** 是否支持退款,1支持退单, 0不支持退单 */
|
||||
private Integer refundAble;
|
||||
|
||||
/** 支付时间 */
|
||||
private Long paidTime;
|
||||
|
||||
/** 是否生效,若订单合单之后,则原订单不会生效 */
|
||||
private Integer isEffect;
|
||||
|
||||
/** 是否合台 */
|
||||
private Integer isGroup;
|
||||
|
||||
private Long updatedAt;
|
||||
|
||||
/** 系统时间 */
|
||||
private Long systemTime;
|
||||
|
||||
private Long createdAt;
|
||||
|
||||
/** 收银台是否已接单 */
|
||||
private Integer isAccepted;
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.orderInfo.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import me.zhengjie.annotation.Query;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2023-11-22
|
||||
**/
|
||||
@Data
|
||||
public class TbOrderInfoQueryCriteria{
|
||||
|
||||
/** ¾«È· */
|
||||
@Query
|
||||
private Integer id;
|
||||
|
||||
/** ¾«È· */
|
||||
@Query
|
||||
private String orderNo;
|
||||
|
||||
/** ¾«È· */
|
||||
@Query
|
||||
private BigDecimal productAmount;
|
||||
|
||||
/** ¾«È· */
|
||||
@Query
|
||||
private BigDecimal payAmount;
|
||||
|
||||
/** ¾«È· */
|
||||
@Query
|
||||
private BigDecimal cashPaidAmount;
|
||||
|
||||
/** ¾«È· */
|
||||
@Query
|
||||
private BigDecimal wxPaidAmount;
|
||||
|
||||
/** ¾«È· */
|
||||
@Query
|
||||
private BigDecimal aliPaidAmount;
|
||||
|
||||
/** ¾«È· */
|
||||
@Query
|
||||
private BigDecimal depositPaidAmount;
|
||||
|
||||
/** ¾«È· */
|
||||
@Query
|
||||
private BigDecimal bankPaidAmount;
|
||||
|
||||
/** ¾«È· */
|
||||
@Query
|
||||
private BigDecimal virtualPaidAmount;
|
||||
|
||||
/** ¾«È· */
|
||||
@Query
|
||||
private BigDecimal otherPaidAmount;
|
||||
|
||||
/** ¾«È· */
|
||||
@Query
|
||||
private String sendType;
|
||||
|
||||
/** ¾«È· */
|
||||
@Query
|
||||
private String status;
|
||||
|
||||
/** ¾«È· */
|
||||
@Query
|
||||
private String shopId;
|
||||
|
||||
/** ¾«È· */
|
||||
@Query
|
||||
private String memberId;
|
||||
|
||||
/** ¾«È· */
|
||||
@Query
|
||||
private String userId;
|
||||
|
||||
/** ¾«È· */
|
||||
@Query
|
||||
private Long paidTime;
|
||||
|
||||
/** ¾«È· */
|
||||
@Query
|
||||
private Long createdAt;
|
||||
|
||||
/** ¾«È· */
|
||||
@Query
|
||||
private Integer isAccepted;
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.orderInfo.service.impl;
|
||||
|
||||
import me.zhengjie.modules.orderInfo.domain.TbOrderInfo;
|
||||
import me.zhengjie.utils.ValidationUtil;
|
||||
import me.zhengjie.utils.FileUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.zhengjie.modules.orderInfo.repository.TbOrderInfoRepository;
|
||||
import me.zhengjie.modules.orderInfo.service.TbOrderInfoService;
|
||||
import me.zhengjie.modules.orderInfo.service.dto.TbOrderInfoDto;
|
||||
import me.zhengjie.modules.orderInfo.service.dto.TbOrderInfoQueryCriteria;
|
||||
import me.zhengjie.modules.orderInfo.service.mapstruct.TbOrderInfoMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import me.zhengjie.utils.PageUtil;
|
||||
import me.zhengjie.utils.QueryHelp;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务实现
|
||||
* @author lyf
|
||||
* @date 2023-11-22
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
||||
|
||||
private final TbOrderInfoRepository tbOrderInfoRepository;
|
||||
private final TbOrderInfoMapper tbOrderInfoMapper;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(TbOrderInfoQueryCriteria criteria, Pageable pageable){
|
||||
Page<TbOrderInfo> page = tbOrderInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
return PageUtil.toPage(page.map(tbOrderInfoMapper::toDto));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbOrderInfoDto> queryAll(TbOrderInfoQueryCriteria criteria){
|
||||
return tbOrderInfoMapper.toDto(tbOrderInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public TbOrderInfoDto findById(Integer id) {
|
||||
TbOrderInfo tbOrderInfo = tbOrderInfoRepository.findById(id).orElseGet(TbOrderInfo::new);
|
||||
ValidationUtil.isNull(tbOrderInfo.getId(),"TbOrderInfo","id",id);
|
||||
return tbOrderInfoMapper.toDto(tbOrderInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public TbOrderInfoDto create(TbOrderInfo resources) {
|
||||
return tbOrderInfoMapper.toDto(tbOrderInfoRepository.save(resources));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(TbOrderInfo resources) {
|
||||
TbOrderInfo tbOrderInfo = tbOrderInfoRepository.findById(resources.getId()).orElseGet(TbOrderInfo::new);
|
||||
ValidationUtil.isNull( tbOrderInfo.getId(),"TbOrderInfo","id",resources.getId());
|
||||
tbOrderInfo.copy(resources);
|
||||
tbOrderInfoRepository.save(tbOrderInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Integer[] ids) {
|
||||
for (Integer id : ids) {
|
||||
tbOrderInfoRepository.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<TbOrderInfoDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (TbOrderInfoDto tbOrderInfo : all) {
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("订单编号", tbOrderInfo.getOrderNo());
|
||||
map.put("商户结算金额", tbOrderInfo.getSettlementAmount());
|
||||
map.put("包装费", tbOrderInfo.getPackFee());
|
||||
map.put("订单原金额", tbOrderInfo.getOriginAmount());
|
||||
map.put("商品售价", tbOrderInfo.getProductAmount());
|
||||
map.put("最终金额---退单后,金额变动", tbOrderInfo.getAmount());
|
||||
map.put("退单金额", tbOrderInfo.getRefundAmount());
|
||||
map.put("支付金额", tbOrderInfo.getPayAmount());
|
||||
map.put("订单邮递费用", tbOrderInfo.getFreightAmount());
|
||||
map.put("现金支付金额", tbOrderInfo.getCashPaidAmount());
|
||||
map.put("微信支付金额", tbOrderInfo.getWxPaidAmount());
|
||||
map.put("支付宝支付金额", tbOrderInfo.getAliPaidAmount());
|
||||
map.put("储值支付金额", tbOrderInfo.getDepositPaidAmount());
|
||||
map.put("银联支付金额", tbOrderInfo.getBankPaidAmount());
|
||||
map.put("虚拟支付金额", tbOrderInfo.getVirtualPaidAmount());
|
||||
map.put("其他支付金额", tbOrderInfo.getOtherPaidAmount());
|
||||
map.put("折扣金额", tbOrderInfo.getDiscountAmount());
|
||||
map.put("台桌Id", tbOrderInfo.getTableId());
|
||||
map.put("订单抹零", tbOrderInfo.getSmallChange());
|
||||
map.put("发货类型", tbOrderInfo.getSendType());
|
||||
map.put("订单类型-cash收银-miniapp小程序-offline线下", tbOrderInfo.getOrderType());
|
||||
map.put("订单里面商品的类型", tbOrderInfo.getProductType());
|
||||
map.put("状态: unpaid 待支付unsend待发货 closed 订单完成 send 已发refunding申请退单refund退单cancelled取消订单merge合台", tbOrderInfo.getStatus());
|
||||
map.put("orderType为union-minor时,parentId生效,为其上级合单id", tbOrderInfo.getBillingId());
|
||||
map.put("对于平台订单,是收款商户Id", tbOrderInfo.getMerchantId());
|
||||
map.put("店铺Id", tbOrderInfo.getShopId());
|
||||
map.put("是否vip订单", tbOrderInfo.getIsVip());
|
||||
map.put("商户会员Id", tbOrderInfo.getMemberId());
|
||||
map.put("用户Id", tbOrderInfo.getUserId());
|
||||
map.put("该订单商品赠送的积分", tbOrderInfo.getProductScore());
|
||||
map.put("抵扣积分", tbOrderInfo.getDeductScore());
|
||||
map.put("用户使用的卡券", tbOrderInfo.getUserCouponId());
|
||||
map.put("优惠券抵扣金额", tbOrderInfo.getUserCouponAmount());
|
||||
map.put("是否主单", tbOrderInfo.getIsMaster());
|
||||
map.put("如果为退单时,主单号", tbOrderInfo.getMasterId());
|
||||
map.put("是否支持退款,1支持退单, 0不支持退单", tbOrderInfo.getRefundAble());
|
||||
map.put("支付时间", tbOrderInfo.getPaidTime());
|
||||
map.put("是否生效,若订单合单之后,则原订单不会生效", tbOrderInfo.getIsEffect());
|
||||
map.put("是否合台", tbOrderInfo.getIsGroup());
|
||||
map.put(" updatedAt", tbOrderInfo.getUpdatedAt());
|
||||
map.put("系统时间", tbOrderInfo.getSystemTime());
|
||||
map.put(" createdAt", tbOrderInfo.getCreatedAt());
|
||||
map.put("收银台是否已接单", tbOrderInfo.getIsAccepted());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.orderInfo.service.mapstruct;
|
||||
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import me.zhengjie.modules.orderInfo.domain.TbOrderInfo;
|
||||
import me.zhengjie.modules.orderInfo.service.dto.TbOrderInfoDto;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2023-11-22
|
||||
**/
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface TbOrderInfoMapper extends BaseMapper<TbOrderInfoDto, TbOrderInfo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,299 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.product.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description /
|
||||
* @author lyf
|
||||
* @date 2023-12-11
|
||||
**/
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name="tb_product")
|
||||
public class TbProduct implements Serializable {
|
||||
|
||||
@Id
|
||||
@Column(name = "`id`")
|
||||
@ApiModelProperty(value = "id")
|
||||
private Integer id;
|
||||
|
||||
@Column(name = "`source_path`")
|
||||
@ApiModelProperty(value = "商品来源 NORMAL普通商品 --,SCORE积分商品")
|
||||
private String sourcePath;
|
||||
|
||||
@Column(name = "`merchant_id`")
|
||||
@ApiModelProperty(value = "商户Id")
|
||||
private String merchantId;
|
||||
|
||||
@Column(name = "`shop_id`")
|
||||
@ApiModelProperty(value = "店铺id")
|
||||
private String shopId;
|
||||
|
||||
@Column(name = "`name`")
|
||||
@ApiModelProperty(value = "商品名称")
|
||||
private String name;
|
||||
|
||||
@Column(name = "`type`")
|
||||
@ApiModelProperty(value = "商品类型(属性):REAL- 实物商品 VIR---虚拟商品")
|
||||
private String type;
|
||||
|
||||
@Column(name = "`pack_fee`")
|
||||
@ApiModelProperty(value = "包装费")
|
||||
private BigDecimal packFee;
|
||||
|
||||
@Column(name = "`low_price`",nullable = false)
|
||||
@NotNull
|
||||
@ApiModelProperty(value = "商品最低价")
|
||||
private BigDecimal lowPrice;
|
||||
|
||||
@Column(name = "`unit_id`")
|
||||
@ApiModelProperty(value = "单位Id")
|
||||
private String unitId;
|
||||
|
||||
@Column(name = "`cover_img`")
|
||||
@ApiModelProperty(value = "商品封面图")
|
||||
private String coverImg;
|
||||
|
||||
@Column(name = "`category_id`")
|
||||
@ApiModelProperty(value = "categoryId")
|
||||
private String categoryId;
|
||||
|
||||
@Column(name = "`spec_id`")
|
||||
@ApiModelProperty(value = "商品规格")
|
||||
private Integer specId;
|
||||
|
||||
@Column(name = "`brand_id`")
|
||||
@ApiModelProperty(value = "品牌Id")
|
||||
private Integer brandId;
|
||||
|
||||
@Column(name = "`short_title`")
|
||||
@ApiModelProperty(value = "短标题--促销语")
|
||||
private String shortTitle;
|
||||
|
||||
@Column(name = "`low_member_price`")
|
||||
@ApiModelProperty(value = "lowMemberPrice")
|
||||
private BigDecimal lowMemberPrice;
|
||||
|
||||
@Column(name = "`unit_snap`")
|
||||
@ApiModelProperty(value = "单位镜像")
|
||||
private String unitSnap;
|
||||
|
||||
@Column(name = "`share_img`")
|
||||
@ApiModelProperty(value = "商品分享图")
|
||||
private String shareImg;
|
||||
|
||||
@Column(name = "`images`")
|
||||
@ApiModelProperty(value = "商品图片(第一张为缩略图,其他为详情)")
|
||||
private String images;
|
||||
|
||||
@Column(name = "`video`")
|
||||
@ApiModelProperty(value = "商品视频URL地址")
|
||||
private String video;
|
||||
|
||||
@Column(name = "`video_cover_img`")
|
||||
@ApiModelProperty(value = "视频封面图")
|
||||
private String videoCoverImg;
|
||||
|
||||
@Column(name = "`sort`")
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@Column(name = "`limit_number`")
|
||||
@ApiModelProperty(value = "0-不限购")
|
||||
private Integer limitNumber;
|
||||
|
||||
@Column(name = "`product_score`")
|
||||
@ApiModelProperty(value = "商品赚送积分")
|
||||
private Integer productScore;
|
||||
|
||||
@Column(name = "`status`",nullable = false)
|
||||
@NotNull
|
||||
@ApiModelProperty(value = "0--待审核 1审核通过 -1审核失败 -2违规下架")
|
||||
private Integer status;
|
||||
|
||||
@Column(name = "`fail_msg`")
|
||||
@ApiModelProperty(value = "审核失败原因")
|
||||
private String failMsg;
|
||||
|
||||
@Column(name = "`is_recommend`")
|
||||
@ApiModelProperty(value = "是否推荐,店铺推荐展示")
|
||||
private Integer isRecommend;
|
||||
|
||||
@Column(name = "`is_hot`")
|
||||
@ApiModelProperty(value = "是否热销")
|
||||
private Integer isHot;
|
||||
|
||||
@Column(name = "`is_new`")
|
||||
@ApiModelProperty(value = "是否新品")
|
||||
private Integer isNew;
|
||||
|
||||
@Column(name = "`is_on_sale`")
|
||||
@ApiModelProperty(value = "是否促销1-是0-否")
|
||||
private Integer isOnSale;
|
||||
|
||||
@Column(name = "`is_show`")
|
||||
@ApiModelProperty(value = "是否展示0-下架 1上架---废弃")
|
||||
private Integer isShow;
|
||||
|
||||
@Column(name = "`type_enum`")
|
||||
@ApiModelProperty(value = "商品规格:0-单规格 1多规格")
|
||||
private String typeEnum;
|
||||
|
||||
@Column(name = "`is_distribute`")
|
||||
@ApiModelProperty(value = "是否独立分销")
|
||||
private Integer isDistribute;
|
||||
|
||||
@Column(name = "`is_del`",nullable = false)
|
||||
@NotNull
|
||||
@ApiModelProperty(value = "是否回收站 0-否,1回收站")
|
||||
private Integer isDel;
|
||||
|
||||
@Column(name = "`is_stock`")
|
||||
@ApiModelProperty(value = "是否开启库存")
|
||||
private Integer isStock;
|
||||
|
||||
@Column(name = "`is_pause_sale`")
|
||||
@ApiModelProperty(value = "是否暂停销售")
|
||||
private Integer isPauseSale;
|
||||
|
||||
@Column(name = "`is_free_freight`",nullable = false)
|
||||
@NotNull
|
||||
@ApiModelProperty(value = "是否免邮1-是 0-否")
|
||||
private Integer isFreeFreight;
|
||||
|
||||
@Column(name = "`freight_id`")
|
||||
@ApiModelProperty(value = "邮费模版")
|
||||
private Long freightId;
|
||||
|
||||
@Column(name = "`strategy_type`")
|
||||
@ApiModelProperty(value = "商品当前生效策略")
|
||||
private String strategyType;
|
||||
|
||||
@Column(name = "`strategy_id`")
|
||||
@ApiModelProperty(value = "策略Id")
|
||||
private Integer strategyId;
|
||||
|
||||
@Column(name = "`is_vip`")
|
||||
@ApiModelProperty(value = "vip专属")
|
||||
private Integer isVip;
|
||||
|
||||
@Column(name = "`is_delete`",nullable = false)
|
||||
@NotNull
|
||||
@ApiModelProperty(value = "是否删除")
|
||||
private Integer isDelete;
|
||||
|
||||
@Column(name = "`notice`")
|
||||
@ApiModelProperty(value = "购买须知")
|
||||
private String notice;
|
||||
|
||||
@Column(name = "`created_at`")
|
||||
@ApiModelProperty(value = "createdAt")
|
||||
private Long createdAt;
|
||||
|
||||
@Column(name = "`updated_at`")
|
||||
@ApiModelProperty(value = "updatedAt")
|
||||
private Long updatedAt;
|
||||
|
||||
@Column(name = "`base_sales_number`")
|
||||
@ApiModelProperty(value = "基础出售数量")
|
||||
private Double baseSalesNumber;
|
||||
|
||||
@Column(name = "`real_sales_number`")
|
||||
@ApiModelProperty(value = "实际销量")
|
||||
private Integer realSalesNumber;
|
||||
|
||||
@Column(name = "`sales_number`")
|
||||
@ApiModelProperty(value = "合计销量")
|
||||
private Integer salesNumber;
|
||||
|
||||
@Column(name = "`thumb_count`")
|
||||
@ApiModelProperty(value = "点赞次数")
|
||||
private Integer thumbCount;
|
||||
|
||||
@Column(name = "`store_count`")
|
||||
@ApiModelProperty(value = "收藏次数")
|
||||
private Integer storeCount;
|
||||
|
||||
@Column(name = "`furnish_meal`")
|
||||
@ApiModelProperty(value = "支持堂食")
|
||||
private Integer furnishMeal;
|
||||
|
||||
@Column(name = "`furnish_express`")
|
||||
@ApiModelProperty(value = "支持配送")
|
||||
private Integer furnishExpress;
|
||||
|
||||
@Column(name = "`furnish_draw`")
|
||||
@ApiModelProperty(value = "支持自提")
|
||||
private Integer furnishDraw;
|
||||
|
||||
@Column(name = "`furnish_vir`")
|
||||
@ApiModelProperty(value = "支持虚拟")
|
||||
private Integer furnishVir;
|
||||
|
||||
@Column(name = "`is_combo`")
|
||||
@ApiModelProperty(value = "是否套餐")
|
||||
private Integer isCombo;
|
||||
|
||||
@Column(name = "`group_snap`")
|
||||
@ApiModelProperty(value = "套餐内容")
|
||||
private String groupSnap;
|
||||
|
||||
@Column(name = "`is_show_cash`")
|
||||
@ApiModelProperty(value = "isShowCash")
|
||||
private Integer isShowCash;
|
||||
|
||||
@Column(name = "`is_show_mall`")
|
||||
@ApiModelProperty(value = "isShowMall")
|
||||
private Integer isShowMall;
|
||||
|
||||
@Column(name = "`is_need_examine`")
|
||||
@ApiModelProperty(value = "是否需要审核")
|
||||
private Integer isNeedExamine;
|
||||
|
||||
@Column(name = "`show_on_mall_status`")
|
||||
@ApiModelProperty(value = "线上商城展示状态0待审核 -1 异常 1正常")
|
||||
private Integer showOnMallStatus;
|
||||
|
||||
@Column(name = "`show_on_mall_time`")
|
||||
@ApiModelProperty(value = "提交审核时间")
|
||||
private Long showOnMallTime;
|
||||
|
||||
@Column(name = "`show_on_mall_error_msg`")
|
||||
@ApiModelProperty(value = "线上商城展示失败原因")
|
||||
private String showOnMallErrorMsg;
|
||||
|
||||
@Column(name = "`enable_label`")
|
||||
@ApiModelProperty(value = "使用标签打印 选择 是 并在 前台>本机设置 勾选打印标签后,收银完成后会自动打印对应数量的标签数")
|
||||
private Integer enableLabel;
|
||||
|
||||
@Column(name = "`tax_config_id`")
|
||||
@ApiModelProperty(value = "税率")
|
||||
private String taxConfigId;
|
||||
|
||||
public void copy(TbProduct source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.product.repository;
|
||||
|
||||
import me.zhengjie.modules.product.domain.TbProduct;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2023-12-11
|
||||
**/
|
||||
public interface TbProductRepository extends JpaRepository<TbProduct, Integer>, JpaSpecificationExecutor<TbProduct> {
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.product.rest;
|
||||
|
||||
import me.zhengjie.annotation.Log;
|
||||
import me.zhengjie.modules.product.domain.TbProduct;
|
||||
import me.zhengjie.modules.product.service.TbProductService;
|
||||
import me.zhengjie.modules.product.service.dto.TbProductQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2023-12-11
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "/product管理")
|
||||
@RequestMapping("/api/tbProduct")
|
||||
public class TbProductController {
|
||||
|
||||
private final TbProductService tbProductService;
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('tbProduct:list')")
|
||||
public void exportTbProduct(HttpServletResponse response, TbProductQueryCriteria criteria) throws IOException {
|
||||
tbProductService.download(tbProductService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询/product")
|
||||
@ApiOperation("查询/product")
|
||||
@PreAuthorize("@el.check('tbProduct:list')")
|
||||
public ResponseEntity<Object> queryTbProduct(TbProductQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(tbProductService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增/product")
|
||||
@ApiOperation("新增/product")
|
||||
@PreAuthorize("@el.check('tbProduct:add')")
|
||||
public ResponseEntity<Object> createTbProduct(@Validated @RequestBody TbProduct resources){
|
||||
return new ResponseEntity<>(tbProductService.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改/product")
|
||||
@ApiOperation("修改/product")
|
||||
@PreAuthorize("@el.check('tbProduct:edit')")
|
||||
public ResponseEntity<Object> updateTbProduct(@Validated @RequestBody TbProduct resources){
|
||||
tbProductService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除/product")
|
||||
@ApiOperation("删除/product")
|
||||
@PreAuthorize("@el.check('tbProduct:del')")
|
||||
public ResponseEntity<Object> deleteTbProduct(@RequestBody Integer[] ids) {
|
||||
tbProductService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.product.service;
|
||||
|
||||
import me.zhengjie.modules.product.domain.TbProduct;
|
||||
import me.zhengjie.modules.product.service.dto.TbProductDto;
|
||||
import me.zhengjie.modules.product.service.dto.TbProductQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务接口
|
||||
* @author lyf
|
||||
* @date 2023-12-11
|
||||
**/
|
||||
public interface TbProductService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param criteria 条件
|
||||
* @param pageable 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(TbProductQueryCriteria criteria, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param criteria 条件参数
|
||||
* @return List<TbProductDto>
|
||||
*/
|
||||
List<TbProductDto> queryAll(TbProductQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param id ID
|
||||
* @return TbProductDto
|
||||
*/
|
||||
TbProductDto findById(Integer id);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param resources /
|
||||
* @return TbProductDto
|
||||
*/
|
||||
TbProductDto create(TbProduct resources);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param resources /
|
||||
*/
|
||||
void update(TbProduct resources);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Integer[] ids);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
* @param all 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<TbProductDto> all, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
@@ -0,0 +1,213 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.product.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description /
|
||||
* @author lyf
|
||||
* @date 2023-12-11
|
||||
**/
|
||||
@Data
|
||||
public class TbProductDto implements Serializable {
|
||||
|
||||
/** id */
|
||||
private Integer id;
|
||||
|
||||
/** 商品来源 NORMAL普通商品 --,SCORE积分商品 */
|
||||
private String sourcePath;
|
||||
|
||||
/** 商户Id */
|
||||
private String merchantId;
|
||||
|
||||
/** 店铺id */
|
||||
private String shopId;
|
||||
|
||||
/** 商品名称 */
|
||||
private String name;
|
||||
|
||||
/** 商品类型(属性):REAL- 实物商品 VIR---虚拟商品 */
|
||||
private String type;
|
||||
|
||||
/** 包装费 */
|
||||
private BigDecimal packFee;
|
||||
|
||||
/** 商品最低价 */
|
||||
private BigDecimal lowPrice;
|
||||
|
||||
/** 单位Id */
|
||||
private String unitId;
|
||||
|
||||
/** 商品封面图 */
|
||||
private String coverImg;
|
||||
|
||||
private String categoryId;
|
||||
|
||||
/** 商品规格 */
|
||||
private Integer specId;
|
||||
|
||||
/** 品牌Id */
|
||||
private Integer brandId;
|
||||
|
||||
/** 短标题--促销语 */
|
||||
private String shortTitle;
|
||||
|
||||
private BigDecimal lowMemberPrice;
|
||||
|
||||
/** 单位镜像 */
|
||||
private String unitSnap;
|
||||
|
||||
/** 商品分享图 */
|
||||
private String shareImg;
|
||||
|
||||
/** 商品图片(第一张为缩略图,其他为详情) */
|
||||
private String images;
|
||||
|
||||
/** 商品视频URL地址 */
|
||||
private String video;
|
||||
|
||||
/** 视频封面图 */
|
||||
private String videoCoverImg;
|
||||
|
||||
/** 排序 */
|
||||
private Integer sort;
|
||||
|
||||
/** 0-不限购 */
|
||||
private Integer limitNumber;
|
||||
|
||||
/** 商品赚送积分 */
|
||||
private Integer productScore;
|
||||
|
||||
/** 0--待审核 1审核通过 -1审核失败 -2违规下架 */
|
||||
private Integer status;
|
||||
|
||||
/** 审核失败原因 */
|
||||
private String failMsg;
|
||||
|
||||
/** 是否推荐,店铺推荐展示 */
|
||||
private Integer isRecommend;
|
||||
|
||||
/** 是否热销 */
|
||||
private Integer isHot;
|
||||
|
||||
/** 是否新品 */
|
||||
private Integer isNew;
|
||||
|
||||
/** 是否促销1-是0-否 */
|
||||
private Integer isOnSale;
|
||||
|
||||
/** 是否展示0-下架 1上架---废弃 */
|
||||
private Integer isShow;
|
||||
|
||||
/** 商品规格:0-单规格 1多规格 */
|
||||
private String typeEnum;
|
||||
|
||||
/** 是否独立分销 */
|
||||
private Integer isDistribute;
|
||||
|
||||
/** 是否回收站 0-否,1回收站 */
|
||||
private Integer isDel;
|
||||
|
||||
/** 是否开启库存 */
|
||||
private Integer isStock;
|
||||
|
||||
/** 是否暂停销售 */
|
||||
private Integer isPauseSale;
|
||||
|
||||
/** 是否免邮1-是 0-否 */
|
||||
private Integer isFreeFreight;
|
||||
|
||||
/** 邮费模版 */
|
||||
private Long freightId;
|
||||
|
||||
/** 商品当前生效策略 */
|
||||
private String strategyType;
|
||||
|
||||
/** 策略Id */
|
||||
private Integer strategyId;
|
||||
|
||||
/** vip专属 */
|
||||
private Integer isVip;
|
||||
|
||||
/** 是否删除 */
|
||||
private Integer isDelete;
|
||||
|
||||
/** 购买须知 */
|
||||
private String notice;
|
||||
|
||||
private Long createdAt;
|
||||
|
||||
private Long updatedAt;
|
||||
|
||||
/** 基础出售数量 */
|
||||
private Double baseSalesNumber;
|
||||
|
||||
/** 实际销量 */
|
||||
private Integer realSalesNumber;
|
||||
|
||||
/** 合计销量 */
|
||||
private Integer salesNumber;
|
||||
|
||||
/** 点赞次数 */
|
||||
private Integer thumbCount;
|
||||
|
||||
/** 收藏次数 */
|
||||
private Integer storeCount;
|
||||
|
||||
/** 支持堂食 */
|
||||
private Integer furnishMeal;
|
||||
|
||||
/** 支持配送 */
|
||||
private Integer furnishExpress;
|
||||
|
||||
/** 支持自提 */
|
||||
private Integer furnishDraw;
|
||||
|
||||
/** 支持虚拟 */
|
||||
private Integer furnishVir;
|
||||
|
||||
/** 是否套餐 */
|
||||
private Integer isCombo;
|
||||
|
||||
/** 套餐内容 */
|
||||
private String groupSnap;
|
||||
|
||||
private Integer isShowCash;
|
||||
|
||||
private Integer isShowMall;
|
||||
|
||||
/** 是否需要审核 */
|
||||
private Integer isNeedExamine;
|
||||
|
||||
/** 线上商城展示状态0待审核 -1 异常 1正常 */
|
||||
private Integer showOnMallStatus;
|
||||
|
||||
/** 提交审核时间 */
|
||||
private Long showOnMallTime;
|
||||
|
||||
/** 线上商城展示失败原因 */
|
||||
private String showOnMallErrorMsg;
|
||||
|
||||
/** 使用标签打印 选择 是 并在 前台>本机设置 勾选打印标签后,收银完成后会自动打印对应数量的标签数 */
|
||||
private Integer enableLabel;
|
||||
|
||||
/** 税率 */
|
||||
private String taxConfigId;
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.product.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import me.zhengjie.annotation.Query;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2023-12-11
|
||||
**/
|
||||
@Data
|
||||
public class TbProductQueryCriteria{
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private Integer id;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private String shopId;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private String name;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private BigDecimal packFee;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private BigDecimal lowPrice;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private String unitId;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private String coverImg;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private Integer specId;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private Integer brandId;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private String images;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private String videoCoverImg;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private Integer status;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private Integer isDel;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private Integer isFreeFreight;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private Integer isDelete;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private Double baseSalesNumber;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private Integer realSalesNumber;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private Integer salesNumber;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private Integer thumbCount;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private Integer storeCount;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private Integer furnishMeal;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private Integer furnishExpress;
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.product.service.impl;
|
||||
|
||||
import me.zhengjie.modules.product.domain.TbProduct;
|
||||
import me.zhengjie.utils.ValidationUtil;
|
||||
import me.zhengjie.utils.FileUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.zhengjie.modules.product.repository.TbProductRepository;
|
||||
import me.zhengjie.modules.product.service.TbProductService;
|
||||
import me.zhengjie.modules.product.service.dto.TbProductDto;
|
||||
import me.zhengjie.modules.product.service.dto.TbProductQueryCriteria;
|
||||
import me.zhengjie.modules.product.service.mapstruct.TbProductMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import me.zhengjie.utils.PageUtil;
|
||||
import me.zhengjie.utils.QueryHelp;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务实现
|
||||
* @author lyf
|
||||
* @date 2023-12-11
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class TbProductServiceImpl implements TbProductService {
|
||||
|
||||
private final TbProductRepository tbProductRepository;
|
||||
private final TbProductMapper tbProductMapper;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(TbProductQueryCriteria criteria, Pageable pageable){
|
||||
Page<TbProduct> page = tbProductRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
return PageUtil.toPage(page.map(tbProductMapper::toDto));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbProductDto> queryAll(TbProductQueryCriteria criteria){
|
||||
return tbProductMapper.toDto(tbProductRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public TbProductDto findById(Integer id) {
|
||||
TbProduct tbProduct = tbProductRepository.findById(id).orElseGet(TbProduct::new);
|
||||
ValidationUtil.isNull(tbProduct.getId(),"TbProduct","id",id);
|
||||
return tbProductMapper.toDto(tbProduct);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public TbProductDto create(TbProduct resources) {
|
||||
return tbProductMapper.toDto(tbProductRepository.save(resources));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(TbProduct resources) {
|
||||
TbProduct tbProduct = tbProductRepository.findById(resources.getId()).orElseGet(TbProduct::new);
|
||||
ValidationUtil.isNull( tbProduct.getId(),"TbProduct","id",resources.getId());
|
||||
tbProduct.copy(resources);
|
||||
tbProductRepository.save(tbProduct);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Integer[] ids) {
|
||||
for (Integer id : ids) {
|
||||
tbProductRepository.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<TbProductDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (TbProductDto tbProduct : all) {
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("商品来源 NORMAL普通商品 --,SCORE积分商品", tbProduct.getSourcePath());
|
||||
map.put("商户Id", tbProduct.getMerchantId());
|
||||
map.put("店铺id", tbProduct.getShopId());
|
||||
map.put("商品名称", tbProduct.getName());
|
||||
map.put("商品类型(属性):REAL- 实物商品 VIR---虚拟商品", tbProduct.getType());
|
||||
map.put("包装费", tbProduct.getPackFee());
|
||||
map.put("商品最低价", tbProduct.getLowPrice());
|
||||
map.put("单位Id", tbProduct.getUnitId());
|
||||
map.put("商品封面图", tbProduct.getCoverImg());
|
||||
map.put(" categoryId", tbProduct.getCategoryId());
|
||||
map.put("商品规格", tbProduct.getSpecId());
|
||||
map.put("品牌Id", tbProduct.getBrandId());
|
||||
map.put("短标题--促销语", tbProduct.getShortTitle());
|
||||
map.put(" lowMemberPrice", tbProduct.getLowMemberPrice());
|
||||
map.put("单位镜像", tbProduct.getUnitSnap());
|
||||
map.put("商品分享图", tbProduct.getShareImg());
|
||||
map.put("商品图片(第一张为缩略图,其他为详情)", tbProduct.getImages());
|
||||
map.put("商品视频URL地址", tbProduct.getVideo());
|
||||
map.put("视频封面图", tbProduct.getVideoCoverImg());
|
||||
map.put("排序", tbProduct.getSort());
|
||||
map.put("0-不限购", tbProduct.getLimitNumber());
|
||||
map.put("商品赚送积分", tbProduct.getProductScore());
|
||||
map.put("0--待审核 1审核通过 -1审核失败 -2违规下架", tbProduct.getStatus());
|
||||
map.put("审核失败原因", tbProduct.getFailMsg());
|
||||
map.put("是否推荐,店铺推荐展示", tbProduct.getIsRecommend());
|
||||
map.put("是否热销", tbProduct.getIsHot());
|
||||
map.put("是否新品", tbProduct.getIsNew());
|
||||
map.put("是否促销1-是0-否", tbProduct.getIsOnSale());
|
||||
map.put("是否展示0-下架 1上架---废弃", tbProduct.getIsShow());
|
||||
map.put("商品规格:0-单规格 1多规格", tbProduct.getTypeEnum());
|
||||
map.put("是否独立分销", tbProduct.getIsDistribute());
|
||||
map.put("是否回收站 0-否,1回收站", tbProduct.getIsDel());
|
||||
map.put("是否开启库存", tbProduct.getIsStock());
|
||||
map.put("是否暂停销售", tbProduct.getIsPauseSale());
|
||||
map.put("是否免邮1-是 0-否", tbProduct.getIsFreeFreight());
|
||||
map.put("邮费模版", tbProduct.getFreightId());
|
||||
map.put("商品当前生效策略", tbProduct.getStrategyType());
|
||||
map.put("策略Id", tbProduct.getStrategyId());
|
||||
map.put("vip专属", tbProduct.getIsVip());
|
||||
map.put("是否删除", tbProduct.getIsDelete());
|
||||
map.put("购买须知", tbProduct.getNotice());
|
||||
map.put(" createdAt", tbProduct.getCreatedAt());
|
||||
map.put(" updatedAt", tbProduct.getUpdatedAt());
|
||||
map.put("基础出售数量", tbProduct.getBaseSalesNumber());
|
||||
map.put("实际销量", tbProduct.getRealSalesNumber());
|
||||
map.put("合计销量", tbProduct.getSalesNumber());
|
||||
map.put("点赞次数", tbProduct.getThumbCount());
|
||||
map.put("收藏次数", tbProduct.getStoreCount());
|
||||
map.put("支持堂食", tbProduct.getFurnishMeal());
|
||||
map.put("支持配送", tbProduct.getFurnishExpress());
|
||||
map.put("支持自提", tbProduct.getFurnishDraw());
|
||||
map.put("支持虚拟", tbProduct.getFurnishVir());
|
||||
map.put("是否套餐", tbProduct.getIsCombo());
|
||||
map.put("套餐内容", tbProduct.getGroupSnap());
|
||||
map.put(" isShowCash", tbProduct.getIsShowCash());
|
||||
map.put(" isShowMall", tbProduct.getIsShowMall());
|
||||
map.put("是否需要审核", tbProduct.getIsNeedExamine());
|
||||
map.put("线上商城展示状态0待审核 -1 异常 1正常", tbProduct.getShowOnMallStatus());
|
||||
map.put("提交审核时间", tbProduct.getShowOnMallTime());
|
||||
map.put("线上商城展示失败原因", tbProduct.getShowOnMallErrorMsg());
|
||||
map.put("使用标签打印 选择 是 并在 前台>本机设置 勾选打印标签后,收银完成后会自动打印对应数量的标签数", tbProduct.getEnableLabel());
|
||||
map.put("税率", tbProduct.getTaxConfigId());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.product.service.mapstruct;
|
||||
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import me.zhengjie.modules.product.domain.TbProduct;
|
||||
import me.zhengjie.modules.product.service.dto.TbProductDto;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2023-12-11
|
||||
**/
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface TbProductMapper extends BaseMapper<TbProductDto, TbProduct> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.productGroup.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description /
|
||||
* @author lyf
|
||||
* @date 2023-12-16
|
||||
**/
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name="tb_product_group")
|
||||
public class TbProductGroup implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "`id`")
|
||||
@ApiModelProperty(value = "id")
|
||||
private Integer id;
|
||||
|
||||
@Column(name = "`name`",nullable = false)
|
||||
@NotBlank
|
||||
@ApiModelProperty(value = "分组名称")
|
||||
private String name;
|
||||
|
||||
@Column(name = "`merchant_id`")
|
||||
@ApiModelProperty(value = "商户Id")
|
||||
private String merchantId;
|
||||
|
||||
@Column(name = "`shop_id`")
|
||||
@ApiModelProperty(value = "店铺Id")
|
||||
private String shopId;
|
||||
|
||||
@Column(name = "`pic`")
|
||||
@ApiModelProperty(value = "图标")
|
||||
private String pic;
|
||||
|
||||
@Column(name = "`is_show`",nullable = false)
|
||||
@NotNull
|
||||
@ApiModelProperty(value = "是否显示")
|
||||
private Integer isShow;
|
||||
|
||||
@Column(name = "`detail`")
|
||||
@ApiModelProperty(value = "分类描述")
|
||||
private String detail;
|
||||
|
||||
@Column(name = "`style`")
|
||||
@ApiModelProperty(value = "style")
|
||||
private String style;
|
||||
|
||||
@Column(name = "`sort`")
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@Column(name = "`product_ids`")
|
||||
@ApiModelProperty(value = "商品列表")
|
||||
private String productIds;
|
||||
|
||||
@Column(name = "`created_at`")
|
||||
@ApiModelProperty(value = "createdAt")
|
||||
private Long createdAt;
|
||||
|
||||
@Column(name = "`updated_at`")
|
||||
@ApiModelProperty(value = "updatedAt")
|
||||
private Long updatedAt;
|
||||
|
||||
public void copy(TbProductGroup source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.productGroup.repository;
|
||||
|
||||
import me.zhengjie.modules.productGroup.domain.TbProductGroup;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2023-12-16
|
||||
**/
|
||||
public interface TbProductGroupRepository extends JpaRepository<TbProductGroup, Integer>, JpaSpecificationExecutor<TbProductGroup> {
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.productGroup.rest;
|
||||
|
||||
import me.zhengjie.annotation.Log;
|
||||
import me.zhengjie.modules.productGroup.domain.TbProductGroup;
|
||||
import me.zhengjie.modules.productGroup.service.TbProductGroupService;
|
||||
import me.zhengjie.modules.productGroup.service.dto.TbProductGroupQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2023-12-16
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "product/group管理")
|
||||
@RequestMapping("/api/tbProductGroup")
|
||||
public class TbProductGroupController {
|
||||
|
||||
private final TbProductGroupService tbProductGroupService;
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('tbProductGroup:list')")
|
||||
public void exportTbProductGroup(HttpServletResponse response, TbProductGroupQueryCriteria criteria) throws IOException {
|
||||
tbProductGroupService.download(tbProductGroupService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询product/group")
|
||||
@ApiOperation("查询product/group")
|
||||
@PreAuthorize("@el.check('tbProductGroup:list')")
|
||||
public ResponseEntity<Object> queryTbProductGroup(TbProductGroupQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(tbProductGroupService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增product/group")
|
||||
@ApiOperation("新增product/group")
|
||||
@PreAuthorize("@el.check('tbProductGroup:add')")
|
||||
public ResponseEntity<Object> createTbProductGroup(@Validated @RequestBody TbProductGroup resources){
|
||||
return new ResponseEntity<>(tbProductGroupService.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改product/group")
|
||||
@ApiOperation("修改product/group")
|
||||
@PreAuthorize("@el.check('tbProductGroup:edit')")
|
||||
public ResponseEntity<Object> updateTbProductGroup(@Validated @RequestBody TbProductGroup resources){
|
||||
tbProductGroupService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除product/group")
|
||||
@ApiOperation("删除product/group")
|
||||
@PreAuthorize("@el.check('tbProductGroup:del')")
|
||||
public ResponseEntity<Object> deleteTbProductGroup(@RequestBody Integer[] ids) {
|
||||
tbProductGroupService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.productGroup.service;
|
||||
|
||||
import me.zhengjie.modules.productGroup.domain.TbProductGroup;
|
||||
import me.zhengjie.modules.productGroup.service.dto.TbProductGroupDto;
|
||||
import me.zhengjie.modules.productGroup.service.dto.TbProductGroupQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务接口
|
||||
* @author lyf
|
||||
* @date 2023-12-16
|
||||
**/
|
||||
public interface TbProductGroupService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param criteria 条件
|
||||
* @param pageable 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(TbProductGroupQueryCriteria criteria, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param criteria 条件参数
|
||||
* @return List<TbProductGroupDto>
|
||||
*/
|
||||
List<TbProductGroupDto> queryAll(TbProductGroupQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param id ID
|
||||
* @return TbProductGroupDto
|
||||
*/
|
||||
TbProductGroupDto findById(Integer id);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param resources /
|
||||
* @return TbProductGroupDto
|
||||
*/
|
||||
TbProductGroupDto create(TbProductGroup resources);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param resources /
|
||||
*/
|
||||
void update(TbProductGroup resources);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Integer[] ids);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
* @param all 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<TbProductGroupDto> all, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.productGroup.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description /
|
||||
* @author lyf
|
||||
* @date 2023-12-16
|
||||
**/
|
||||
@Data
|
||||
public class TbProductGroupDto implements Serializable {
|
||||
|
||||
/** id */
|
||||
private Integer id;
|
||||
|
||||
/** 分组名称 */
|
||||
private String name;
|
||||
|
||||
/** 商户Id */
|
||||
private String merchantId;
|
||||
|
||||
/** 店铺Id */
|
||||
private String shopId;
|
||||
|
||||
/** 图标 */
|
||||
private String pic;
|
||||
|
||||
/** 是否显示 */
|
||||
private Integer isShow;
|
||||
|
||||
/** 分类描述 */
|
||||
private String detail;
|
||||
|
||||
private String style;
|
||||
|
||||
/** 排序 */
|
||||
private Integer sort;
|
||||
|
||||
/** 商品列表 */
|
||||
private String productIds;
|
||||
|
||||
private Long createdAt;
|
||||
|
||||
private Long updatedAt;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.productGroup.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
import me.zhengjie.annotation.Query;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2023-12-16
|
||||
**/
|
||||
@Data
|
||||
public class TbProductGroupQueryCriteria{
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.productGroup.service.impl;
|
||||
|
||||
import me.zhengjie.modules.productGroup.domain.TbProductGroup;
|
||||
import me.zhengjie.utils.ValidationUtil;
|
||||
import me.zhengjie.utils.FileUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.zhengjie.modules.productGroup.repository.TbProductGroupRepository;
|
||||
import me.zhengjie.modules.productGroup.service.TbProductGroupService;
|
||||
import me.zhengjie.modules.productGroup.service.dto.TbProductGroupDto;
|
||||
import me.zhengjie.modules.productGroup.service.dto.TbProductGroupQueryCriteria;
|
||||
import me.zhengjie.modules.productGroup.service.mapstruct.TbProductGroupMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import me.zhengjie.utils.PageUtil;
|
||||
import me.zhengjie.utils.QueryHelp;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务实现
|
||||
* @author lyf
|
||||
* @date 2023-12-16
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class TbProductGroupServiceImpl implements TbProductGroupService {
|
||||
|
||||
private final TbProductGroupRepository tbProductGroupRepository;
|
||||
private final TbProductGroupMapper tbProductGroupMapper;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(TbProductGroupQueryCriteria criteria, Pageable pageable){
|
||||
Page<TbProductGroup> page = tbProductGroupRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
return PageUtil.toPage(page.map(tbProductGroupMapper::toDto));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbProductGroupDto> queryAll(TbProductGroupQueryCriteria criteria){
|
||||
return tbProductGroupMapper.toDto(tbProductGroupRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public TbProductGroupDto findById(Integer id) {
|
||||
TbProductGroup tbProductGroup = tbProductGroupRepository.findById(id).orElseGet(TbProductGroup::new);
|
||||
ValidationUtil.isNull(tbProductGroup.getId(),"TbProductGroup","id",id);
|
||||
return tbProductGroupMapper.toDto(tbProductGroup);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public TbProductGroupDto create(TbProductGroup resources) {
|
||||
return tbProductGroupMapper.toDto(tbProductGroupRepository.save(resources));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(TbProductGroup resources) {
|
||||
TbProductGroup tbProductGroup = tbProductGroupRepository.findById(resources.getId()).orElseGet(TbProductGroup::new);
|
||||
ValidationUtil.isNull( tbProductGroup.getId(),"TbProductGroup","id",resources.getId());
|
||||
tbProductGroup.copy(resources);
|
||||
tbProductGroupRepository.save(tbProductGroup);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Integer[] ids) {
|
||||
for (Integer id : ids) {
|
||||
tbProductGroupRepository.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<TbProductGroupDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (TbProductGroupDto tbProductGroup : all) {
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("分组名称", tbProductGroup.getName());
|
||||
map.put("商户Id", tbProductGroup.getMerchantId());
|
||||
map.put("店铺Id", tbProductGroup.getShopId());
|
||||
map.put("图标", tbProductGroup.getPic());
|
||||
map.put("是否显示", tbProductGroup.getIsShow());
|
||||
map.put("分类描述", tbProductGroup.getDetail());
|
||||
map.put(" style", tbProductGroup.getStyle());
|
||||
map.put("排序", tbProductGroup.getSort());
|
||||
map.put("商品列表", tbProductGroup.getProductIds());
|
||||
map.put(" createdAt", tbProductGroup.getCreatedAt());
|
||||
map.put(" updatedAt", tbProductGroup.getUpdatedAt());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.productGroup.service.mapstruct;
|
||||
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import me.zhengjie.modules.productGroup.domain.TbProductGroup;
|
||||
import me.zhengjie.modules.productGroup.service.dto.TbProductGroupDto;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2023-12-16
|
||||
**/
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface TbProductGroupMapper extends BaseMapper<TbProductGroupDto, TbProductGroup> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.register.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description /
|
||||
* @author lyf
|
||||
* @date 2023-11-27
|
||||
**/
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name="view_register")
|
||||
public class ViewRegister implements Serializable {
|
||||
|
||||
@Id
|
||||
@Column(name = "`id`")
|
||||
@ApiModelProperty(value = "id")
|
||||
private Integer id;
|
||||
|
||||
@Column(name = "`register_code`")
|
||||
@ApiModelProperty(value = "激活码")
|
||||
private String registerCode;
|
||||
|
||||
@Column(name = "`shop_name`")
|
||||
@ApiModelProperty(value = "店铺名称")
|
||||
private String shopName;
|
||||
|
||||
@Column(name = "`type`")
|
||||
@ApiModelProperty(value = "版本类型")
|
||||
private String type;
|
||||
|
||||
@Column(name = "`amount`")
|
||||
@ApiModelProperty(value = "激活码金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Column(name = "`period_year`")
|
||||
@ApiModelProperty(value = "激活时长(月)")
|
||||
private Integer periodYear;
|
||||
|
||||
@Column(name = "`status`")
|
||||
@ApiModelProperty(value = "状态0未使用1已使用")
|
||||
private Integer status;
|
||||
|
||||
@Column(name = "`created_at`")
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Long createdAt;
|
||||
|
||||
public void copy(ViewRegister source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.register.repository;
|
||||
|
||||
import me.zhengjie.modules.register.domain.ViewRegister;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2023-11-27
|
||||
**/
|
||||
public interface ViewRegisterRepository extends JpaRepository<ViewRegister, Integer>, JpaSpecificationExecutor<ViewRegister> {
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.register.rest;
|
||||
|
||||
import me.zhengjie.annotation.Log;
|
||||
import me.zhengjie.modules.register.domain.ViewRegister;
|
||||
import me.zhengjie.modules.register.service.ViewRegisterService;
|
||||
import me.zhengjie.modules.register.service.dto.ViewRegisterQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2023-11-27
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "/register管理")
|
||||
@RequestMapping("/api/viewRegister")
|
||||
public class ViewRegisterController {
|
||||
|
||||
private final ViewRegisterService viewRegisterService;
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('viewRegister:list')")
|
||||
public void exportViewRegister(HttpServletResponse response, ViewRegisterQueryCriteria criteria) throws IOException {
|
||||
viewRegisterService.download(viewRegisterService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询/register")
|
||||
@ApiOperation("查询/register")
|
||||
@PreAuthorize("@el.check('viewRegister:list')")
|
||||
public ResponseEntity<Object> queryViewRegister(ViewRegisterQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(viewRegisterService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增/register")
|
||||
@ApiOperation("新增/register")
|
||||
@PreAuthorize("@el.check('viewRegister:add')")
|
||||
public ResponseEntity<Object> createViewRegister(@Validated @RequestBody ViewRegister resources){
|
||||
return new ResponseEntity<>(viewRegisterService.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改/register")
|
||||
@ApiOperation("修改/register")
|
||||
@PreAuthorize("@el.check('viewRegister:edit')")
|
||||
public ResponseEntity<Object> updateViewRegister(@Validated @RequestBody ViewRegister resources){
|
||||
viewRegisterService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除/register")
|
||||
@ApiOperation("删除/register")
|
||||
@PreAuthorize("@el.check('viewRegister:del')")
|
||||
public ResponseEntity<Object> deleteViewRegister(@RequestBody Integer[] ids) {
|
||||
viewRegisterService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.register.service;
|
||||
|
||||
import me.zhengjie.modules.register.domain.ViewRegister;
|
||||
import me.zhengjie.modules.register.service.dto.ViewRegisterDto;
|
||||
import me.zhengjie.modules.register.service.dto.ViewRegisterQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务接口
|
||||
* @author lyf
|
||||
* @date 2023-11-27
|
||||
**/
|
||||
public interface ViewRegisterService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param criteria 条件
|
||||
* @param pageable 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(ViewRegisterQueryCriteria criteria, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param criteria 条件参数
|
||||
* @return List<ViewRegisterDto>
|
||||
*/
|
||||
List<ViewRegisterDto> queryAll(ViewRegisterQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param id ID
|
||||
* @return ViewRegisterDto
|
||||
*/
|
||||
ViewRegisterDto findById(Integer id);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param resources /
|
||||
* @return ViewRegisterDto
|
||||
*/
|
||||
ViewRegisterDto create(ViewRegister resources);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param resources /
|
||||
*/
|
||||
void update(ViewRegister resources);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Integer[] ids);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
* @param all 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<ViewRegisterDto> all, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.register.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description /
|
||||
* @author lyf
|
||||
* @date 2023-11-27
|
||||
**/
|
||||
@Data
|
||||
public class ViewRegisterDto implements Serializable {
|
||||
|
||||
private Integer id;
|
||||
|
||||
/** 激活码 */
|
||||
private String registerCode;
|
||||
|
||||
/** 店铺名称 */
|
||||
private String shopName;
|
||||
|
||||
/** 版本类型 */
|
||||
private String type;
|
||||
|
||||
/** 激活码金额 */
|
||||
private BigDecimal amount;
|
||||
|
||||
/** 激活时长(月) */
|
||||
private Integer periodYear;
|
||||
|
||||
/** 状态0未使用1已使用 */
|
||||
private Integer status;
|
||||
|
||||
/** 创建时间 */
|
||||
private Long createdAt;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.register.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import me.zhengjie.annotation.Query;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2023-11-27
|
||||
**/
|
||||
@Data
|
||||
public class ViewRegisterQueryCriteria{
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private Integer id;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private String registerCode;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private String shopName;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private String type;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private BigDecimal amount;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private Integer periodYear;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private Integer status;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private Long createdAt;
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.register.service.impl;
|
||||
|
||||
import me.zhengjie.modules.register.domain.ViewRegister;
|
||||
import me.zhengjie.utils.ValidationUtil;
|
||||
import me.zhengjie.utils.FileUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.zhengjie.modules.register.repository.ViewRegisterRepository;
|
||||
import me.zhengjie.modules.register.service.ViewRegisterService;
|
||||
import me.zhengjie.modules.register.service.dto.ViewRegisterDto;
|
||||
import me.zhengjie.modules.register.service.dto.ViewRegisterQueryCriteria;
|
||||
import me.zhengjie.modules.register.service.mapstruct.ViewRegisterMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import me.zhengjie.utils.PageUtil;
|
||||
import me.zhengjie.utils.QueryHelp;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务实现
|
||||
* @author lyf
|
||||
* @date 2023-11-27
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ViewRegisterServiceImpl implements ViewRegisterService {
|
||||
|
||||
private final ViewRegisterRepository viewRegisterRepository;
|
||||
private final ViewRegisterMapper viewRegisterMapper;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(ViewRegisterQueryCriteria criteria, Pageable pageable){
|
||||
Page<ViewRegister> page = viewRegisterRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
return PageUtil.toPage(page.map(viewRegisterMapper::toDto));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ViewRegisterDto> queryAll(ViewRegisterQueryCriteria criteria){
|
||||
return viewRegisterMapper.toDto(viewRegisterRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public ViewRegisterDto findById(Integer id) {
|
||||
ViewRegister viewRegister = viewRegisterRepository.findById(id).orElseGet(ViewRegister::new);
|
||||
ValidationUtil.isNull(viewRegister.getId(),"ViewRegister","id",id);
|
||||
return viewRegisterMapper.toDto(viewRegister);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ViewRegisterDto create(ViewRegister resources) {
|
||||
return viewRegisterMapper.toDto(viewRegisterRepository.save(resources));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(ViewRegister resources) {
|
||||
ViewRegister viewRegister = viewRegisterRepository.findById(resources.getId()).orElseGet(ViewRegister::new);
|
||||
ValidationUtil.isNull( viewRegister.getId(),"ViewRegister","id",resources.getId());
|
||||
viewRegister.copy(resources);
|
||||
viewRegisterRepository.save(viewRegister);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Integer[] ids) {
|
||||
for (Integer id : ids) {
|
||||
viewRegisterRepository.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<ViewRegisterDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (ViewRegisterDto viewRegister : all) {
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("激活码", viewRegister.getRegisterCode());
|
||||
map.put("店铺名称", viewRegister.getShopName());
|
||||
map.put("版本类型", viewRegister.getType());
|
||||
map.put("激活码金额", viewRegister.getAmount());
|
||||
map.put("激活时长(月)", viewRegister.getPeriodYear());
|
||||
map.put("状态0未使用1已使用", viewRegister.getStatus());
|
||||
map.put("创建时间", viewRegister.getCreatedAt());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.register.service.mapstruct;
|
||||
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import me.zhengjie.modules.register.domain.ViewRegister;
|
||||
import me.zhengjie.modules.register.service.dto.ViewRegisterDto;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2023-11-27
|
||||
**/
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface ViewRegisterMapper extends BaseMapper<ViewRegisterDto, ViewRegister> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.userInfo.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description /
|
||||
* @author lyf
|
||||
* @date 2023-11-13
|
||||
**/
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name="tb_user_info")
|
||||
public class TbUserInfo implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "`id`")
|
||||
@ApiModelProperty(value = "id")
|
||||
private Integer id;
|
||||
|
||||
@Column(name = "`amount`")
|
||||
@ApiModelProperty(value = "钱包余额")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Column(name = "`charge_amount`")
|
||||
@ApiModelProperty(value = "累计充值")
|
||||
private BigDecimal chargeAmount;
|
||||
|
||||
@Column(name = "`line_of_credit`")
|
||||
@ApiModelProperty(value = "授信额度")
|
||||
private BigDecimal lineOfCredit;
|
||||
|
||||
@Column(name = "`consume_amount`")
|
||||
@ApiModelProperty(value = "consumeAmount")
|
||||
private BigDecimal consumeAmount;
|
||||
|
||||
@Column(name = "`consume_number`")
|
||||
@ApiModelProperty(value = "消费次数累计")
|
||||
private Integer consumeNumber;
|
||||
|
||||
@Column(name = "`total_score`")
|
||||
@ApiModelProperty(value = "总积分")
|
||||
private Integer totalScore;
|
||||
|
||||
@Column(name = "`lock_score`")
|
||||
@ApiModelProperty(value = "锁定积分")
|
||||
private Integer lockScore;
|
||||
|
||||
@Column(name = "`card_no`")
|
||||
@ApiModelProperty(value = "会员卡号")
|
||||
private String cardNo;
|
||||
|
||||
@Column(name = "`card_password`")
|
||||
@ApiModelProperty(value = "会员密码")
|
||||
private String cardPassword;
|
||||
|
||||
@Column(name = "`level_id`")
|
||||
@ApiModelProperty(value = "等级")
|
||||
private String levelId;
|
||||
|
||||
@Column(name = "`head_img`")
|
||||
@ApiModelProperty(value = "用户头像")
|
||||
private String headImg;
|
||||
|
||||
@Column(name = "`nick_name`")
|
||||
@ApiModelProperty(value = "用户昵称")
|
||||
private String nickName;
|
||||
|
||||
@Column(name = "`telephone`")
|
||||
@ApiModelProperty(value = "电话号码")
|
||||
private String telephone;
|
||||
|
||||
@Column(name = "`wx_ma_app_id`")
|
||||
@ApiModelProperty(value = "小程序Id")
|
||||
private String wxMaAppId;
|
||||
|
||||
@Column(name = "`birth_day`")
|
||||
@ApiModelProperty(value = "会员生日")
|
||||
private String birthDay;
|
||||
|
||||
@Column(name = "`sex`")
|
||||
@ApiModelProperty(value = "0-女 1男")
|
||||
private Integer sex;
|
||||
|
||||
@Column(name = "`mini_app_open_id`")
|
||||
@ApiModelProperty(value = "小程序的openId")
|
||||
private String miniAppOpenId;
|
||||
|
||||
@Column(name = "`open_id`")
|
||||
@ApiModelProperty(value = "公众号openId")
|
||||
private String openId;
|
||||
|
||||
@Column(name = "`union_id`")
|
||||
@ApiModelProperty(value = "联合Id")
|
||||
private String unionId;
|
||||
|
||||
@Column(name = "`code`")
|
||||
@ApiModelProperty(value = "用户编号")
|
||||
private String code;
|
||||
|
||||
@Column(name = "`type`")
|
||||
@ApiModelProperty(value = "用户类型-保留字段")
|
||||
private String type;
|
||||
|
||||
@Column(name = "`identify`")
|
||||
@ApiModelProperty(value = "'DOCTOR'-->医生,'USER'->用户")
|
||||
private Integer identify;
|
||||
|
||||
@Column(name = "`status`")
|
||||
@ApiModelProperty(value = "1正常")
|
||||
private Integer status;
|
||||
|
||||
@Column(name = "`parent_id`")
|
||||
@ApiModelProperty(value = "引荐人")
|
||||
private String parentId;
|
||||
|
||||
@Column(name = "`parent_level`")
|
||||
@ApiModelProperty(value = "parentLevel")
|
||||
private String parentLevel;
|
||||
|
||||
@Column(name = "`parent_type`")
|
||||
@ApiModelProperty(value = "上家类开型,店铺-SHOP/ 个人- PERSON")
|
||||
private String parentType;
|
||||
|
||||
@Column(name = "`project_id`")
|
||||
@ApiModelProperty(value = "关注进入的活动Id")
|
||||
private String projectId;
|
||||
|
||||
@Column(name = "`merchant_id`")
|
||||
@ApiModelProperty(value = "商户Id")
|
||||
private String merchantId;
|
||||
|
||||
@Column(name = "`is_resource`")
|
||||
@ApiModelProperty(value = "0未认证,1认证")
|
||||
private Integer isResource;
|
||||
|
||||
@Column(name = "`is_online`")
|
||||
@ApiModelProperty(value = "是否在线")
|
||||
private Integer isOnline;
|
||||
|
||||
@Column(name = "`is_vip`")
|
||||
@ApiModelProperty(value = "isVip")
|
||||
private Integer isVip;
|
||||
|
||||
@Column(name = "`vip_effect_at`")
|
||||
@ApiModelProperty(value = "vipEffectAt")
|
||||
private Integer vipEffectAt;
|
||||
|
||||
@Column(name = "`tips`")
|
||||
@ApiModelProperty(value = "tips")
|
||||
private String tips;
|
||||
|
||||
@Column(name = "`source_path`")
|
||||
@ApiModelProperty(value = "用户来源:公众号 WECHAT 小程序 WECHAT-APP 手机注册 TELEPHONE")
|
||||
private String sourcePath;
|
||||
|
||||
@Column(name = "`is_sales_person`")
|
||||
@ApiModelProperty(value = "是否推广员 1 是 0不是")
|
||||
private Integer isSalesPerson;
|
||||
|
||||
@Column(name = "`is_attention_mp`")
|
||||
@ApiModelProperty(value = "是否关注公众号")
|
||||
private Integer isAttentionMp;
|
||||
|
||||
@Column(name = "`city`")
|
||||
@ApiModelProperty(value = "城市")
|
||||
private String city;
|
||||
|
||||
@Column(name = "`search_word`")
|
||||
@ApiModelProperty(value = "searchWord")
|
||||
private String searchWord;
|
||||
|
||||
@Column(name = "`last_log_in_at`")
|
||||
@ApiModelProperty(value = "最近登陆时间")
|
||||
private Long lastLogInAt;
|
||||
|
||||
@Column(name = "`last_leave_at`")
|
||||
@ApiModelProperty(value = "lastLeaveAt")
|
||||
private Long lastLeaveAt;
|
||||
|
||||
@Column(name = "`created_at`")
|
||||
@ApiModelProperty(value = "createdAt")
|
||||
private Long createdAt;
|
||||
|
||||
@Column(name = "`updated_at`")
|
||||
@ApiModelProperty(value = "updatedAt")
|
||||
private Long updatedAt;
|
||||
|
||||
@Column(name = "`bind_parent_at`")
|
||||
@ApiModelProperty(value = "绑定时间")
|
||||
private Long bindParentAt;
|
||||
|
||||
@Column(name = "`grand_parent_id`")
|
||||
@ApiModelProperty(value = "上上家")
|
||||
private String grandParentId;
|
||||
|
||||
public void copy(TbUserInfo source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.userInfo.repository;
|
||||
|
||||
import me.zhengjie.modules.userInfo.domain.TbUserInfo;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2023-11-13
|
||||
**/
|
||||
public interface TbUserInfoRepository extends JpaRepository<TbUserInfo, Integer>, JpaSpecificationExecutor<TbUserInfo> {
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.userInfo.rest;
|
||||
|
||||
import me.zhengjie.annotation.Log;
|
||||
import me.zhengjie.modules.userInfo.domain.TbUserInfo;
|
||||
import me.zhengjie.modules.userInfo.service.TbUserInfoService;
|
||||
import me.zhengjie.modules.userInfo.service.dto.TbUserInfoQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2023-11-13
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "/userInfo/list管理")
|
||||
@RequestMapping("/api/tbUserInfo")
|
||||
public class TbUserInfoController {
|
||||
|
||||
private final TbUserInfoService tbUserInfoService;
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('tbUserInfo:list')")
|
||||
public void exportTbUserInfo(HttpServletResponse response, TbUserInfoQueryCriteria criteria) throws IOException {
|
||||
tbUserInfoService.download(tbUserInfoService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询/userInfo/list")
|
||||
@ApiOperation("查询/userInfo/list")
|
||||
@PreAuthorize("@el.check('tbUserInfo:list')")
|
||||
public ResponseEntity<Object> queryTbUserInfo(TbUserInfoQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(tbUserInfoService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增/userInfo/list")
|
||||
@ApiOperation("新增/userInfo/list")
|
||||
@PreAuthorize("@el.check('tbUserInfo:add')")
|
||||
public ResponseEntity<Object> createTbUserInfo(@Validated @RequestBody TbUserInfo resources){
|
||||
return new ResponseEntity<>(tbUserInfoService.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改/userInfo/list")
|
||||
@ApiOperation("修改/userInfo/list")
|
||||
@PreAuthorize("@el.check('tbUserInfo:edit')")
|
||||
public ResponseEntity<Object> updateTbUserInfo(@Validated @RequestBody TbUserInfo resources){
|
||||
tbUserInfoService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除/userInfo/list")
|
||||
@ApiOperation("删除/userInfo/list")
|
||||
@PreAuthorize("@el.check('tbUserInfo:del')")
|
||||
public ResponseEntity<Object> deleteTbUserInfo(@RequestBody Integer[] ids) {
|
||||
tbUserInfoService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.userInfo.service;
|
||||
|
||||
import me.zhengjie.modules.userInfo.domain.TbUserInfo;
|
||||
import me.zhengjie.modules.userInfo.service.dto.TbUserInfoDto;
|
||||
import me.zhengjie.modules.userInfo.service.dto.TbUserInfoQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务接口
|
||||
* @author lyf
|
||||
* @date 2023-11-13
|
||||
**/
|
||||
public interface TbUserInfoService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param criteria 条件
|
||||
* @param pageable 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(TbUserInfoQueryCriteria criteria, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param criteria 条件参数
|
||||
* @return List<TbUserInfoDto>
|
||||
*/
|
||||
List<TbUserInfoDto> queryAll(TbUserInfoQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param id ID
|
||||
* @return TbUserInfoDto
|
||||
*/
|
||||
TbUserInfoDto findById(Integer id);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param resources /
|
||||
* @return TbUserInfoDto
|
||||
*/
|
||||
TbUserInfoDto create(TbUserInfo resources);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param resources /
|
||||
*/
|
||||
void update(TbUserInfo resources);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Integer[] ids);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
* @param all 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<TbUserInfoDto> all, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.userInfo.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description /
|
||||
* @author lyf
|
||||
* @date 2023-11-13
|
||||
**/
|
||||
@Data
|
||||
public class TbUserInfoDto implements Serializable {
|
||||
|
||||
/** id */
|
||||
private Integer id;
|
||||
|
||||
/** 钱包余额 */
|
||||
private BigDecimal amount;
|
||||
|
||||
/** 累计充值 */
|
||||
private BigDecimal chargeAmount;
|
||||
|
||||
/** 授信额度 */
|
||||
private BigDecimal lineOfCredit;
|
||||
|
||||
private BigDecimal consumeAmount;
|
||||
|
||||
/** 消费次数累计 */
|
||||
private Integer consumeNumber;
|
||||
|
||||
/** 总积分 */
|
||||
private Integer totalScore;
|
||||
|
||||
/** 锁定积分 */
|
||||
private Integer lockScore;
|
||||
|
||||
/** 会员卡号 */
|
||||
private String cardNo;
|
||||
|
||||
/** 会员密码 */
|
||||
private String cardPassword;
|
||||
|
||||
/** 等级 */
|
||||
private String levelId;
|
||||
|
||||
/** 用户头像 */
|
||||
private String headImg;
|
||||
|
||||
/** 用户昵称 */
|
||||
private String nickName;
|
||||
|
||||
/** 电话号码 */
|
||||
private String telephone;
|
||||
|
||||
/** 小程序Id */
|
||||
private String wxMaAppId;
|
||||
|
||||
/** 会员生日 */
|
||||
private String birthDay;
|
||||
|
||||
/** 0-女 1男 */
|
||||
private Integer sex;
|
||||
|
||||
/** 小程序的openId */
|
||||
private String miniAppOpenId;
|
||||
|
||||
/** 公众号openId */
|
||||
private String openId;
|
||||
|
||||
/** 联合Id */
|
||||
private String unionId;
|
||||
|
||||
/** 用户编号 */
|
||||
private String code;
|
||||
|
||||
/** 用户类型-保留字段 */
|
||||
private String type;
|
||||
|
||||
/** 'DOCTOR'-->医生,'USER'->用户 */
|
||||
private Integer identify;
|
||||
|
||||
/** 1正常 */
|
||||
private Integer status;
|
||||
|
||||
/** 引荐人 */
|
||||
private String parentId;
|
||||
|
||||
private String parentLevel;
|
||||
|
||||
/** 上家类开型,店铺-SHOP/ 个人- PERSON */
|
||||
private String parentType;
|
||||
|
||||
/** 关注进入的活动Id */
|
||||
private String projectId;
|
||||
|
||||
/** 商户Id */
|
||||
private String merchantId;
|
||||
|
||||
/** 0未认证,1认证 */
|
||||
private Integer isResource;
|
||||
|
||||
/** 是否在线 */
|
||||
private Integer isOnline;
|
||||
|
||||
private Integer isVip;
|
||||
|
||||
private Integer vipEffectAt;
|
||||
|
||||
private String tips;
|
||||
|
||||
/** 用户来源:公众号 WECHAT 小程序 WECHAT-APP 手机注册 TELEPHONE */
|
||||
private String sourcePath;
|
||||
|
||||
/** 是否推广员 1 是 0不是 */
|
||||
private Integer isSalesPerson;
|
||||
|
||||
/** 是否关注公众号 */
|
||||
private Integer isAttentionMp;
|
||||
|
||||
/** 城市 */
|
||||
private String city;
|
||||
|
||||
private String searchWord;
|
||||
|
||||
/** 最近登陆时间 */
|
||||
private Long lastLogInAt;
|
||||
|
||||
private Long lastLeaveAt;
|
||||
|
||||
private Long createdAt;
|
||||
|
||||
private Long updatedAt;
|
||||
|
||||
/** 绑定时间 */
|
||||
private Long bindParentAt;
|
||||
|
||||
/** 上上家 */
|
||||
private String grandParentId;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.userInfo.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import me.zhengjie.annotation.Query;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2023-11-13
|
||||
**/
|
||||
@Data
|
||||
public class TbUserInfoQueryCriteria{
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private Integer id;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private BigDecimal amount;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private String levelId;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private String headImg;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private String nickName;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private String telephone;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private Long lastLogInAt;
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.userInfo.service.impl;
|
||||
|
||||
import me.zhengjie.modules.userInfo.domain.TbUserInfo;
|
||||
import me.zhengjie.utils.ValidationUtil;
|
||||
import me.zhengjie.utils.FileUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.zhengjie.modules.userInfo.repository.TbUserInfoRepository;
|
||||
import me.zhengjie.modules.userInfo.service.TbUserInfoService;
|
||||
import me.zhengjie.modules.userInfo.service.dto.TbUserInfoDto;
|
||||
import me.zhengjie.modules.userInfo.service.dto.TbUserInfoQueryCriteria;
|
||||
import me.zhengjie.modules.userInfo.service.mapstruct.TbUserInfoMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import me.zhengjie.utils.PageUtil;
|
||||
import me.zhengjie.utils.QueryHelp;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务实现
|
||||
* @author lyf
|
||||
* @date 2023-11-13
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class TbUserInfoServiceImpl implements TbUserInfoService {
|
||||
|
||||
private final TbUserInfoRepository tbUserInfoRepository;
|
||||
private final TbUserInfoMapper tbUserInfoMapper;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(TbUserInfoQueryCriteria criteria, Pageable pageable){
|
||||
Page<TbUserInfo> page = tbUserInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
return PageUtil.toPage(page.map(tbUserInfoMapper::toDto));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbUserInfoDto> queryAll(TbUserInfoQueryCriteria criteria){
|
||||
return tbUserInfoMapper.toDto(tbUserInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public TbUserInfoDto findById(Integer id) {
|
||||
TbUserInfo tbUserInfo = tbUserInfoRepository.findById(id).orElseGet(TbUserInfo::new);
|
||||
ValidationUtil.isNull(tbUserInfo.getId(),"TbUserInfo","id",id);
|
||||
return tbUserInfoMapper.toDto(tbUserInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public TbUserInfoDto create(TbUserInfo resources) {
|
||||
return tbUserInfoMapper.toDto(tbUserInfoRepository.save(resources));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(TbUserInfo resources) {
|
||||
TbUserInfo tbUserInfo = tbUserInfoRepository.findById(resources.getId()).orElseGet(TbUserInfo::new);
|
||||
ValidationUtil.isNull( tbUserInfo.getId(),"TbUserInfo","id",resources.getId());
|
||||
tbUserInfo.copy(resources);
|
||||
tbUserInfoRepository.save(tbUserInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Integer[] ids) {
|
||||
for (Integer id : ids) {
|
||||
tbUserInfoRepository.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<TbUserInfoDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (TbUserInfoDto tbUserInfo : all) {
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("钱包余额", tbUserInfo.getAmount());
|
||||
map.put("累计充值", tbUserInfo.getChargeAmount());
|
||||
map.put("授信额度", tbUserInfo.getLineOfCredit());
|
||||
map.put(" consumeAmount", tbUserInfo.getConsumeAmount());
|
||||
map.put("消费次数累计", tbUserInfo.getConsumeNumber());
|
||||
map.put("总积分", tbUserInfo.getTotalScore());
|
||||
map.put("锁定积分", tbUserInfo.getLockScore());
|
||||
map.put("会员卡号", tbUserInfo.getCardNo());
|
||||
map.put("会员密码", tbUserInfo.getCardPassword());
|
||||
map.put("等级", tbUserInfo.getLevelId());
|
||||
map.put("用户头像", tbUserInfo.getHeadImg());
|
||||
map.put("用户昵称", tbUserInfo.getNickName());
|
||||
map.put("电话号码", tbUserInfo.getTelephone());
|
||||
map.put("小程序Id", tbUserInfo.getWxMaAppId());
|
||||
map.put("会员生日", tbUserInfo.getBirthDay());
|
||||
map.put("0-女 1男", tbUserInfo.getSex());
|
||||
map.put("小程序的openId", tbUserInfo.getMiniAppOpenId());
|
||||
map.put("公众号openId", tbUserInfo.getOpenId());
|
||||
map.put("联合Id", tbUserInfo.getUnionId());
|
||||
map.put("用户编号", tbUserInfo.getCode());
|
||||
map.put("用户类型-保留字段", tbUserInfo.getType());
|
||||
map.put("'DOCTOR'-->医生,'USER'->用户", tbUserInfo.getIdentify());
|
||||
map.put("1正常", tbUserInfo.getStatus());
|
||||
map.put("引荐人", tbUserInfo.getParentId());
|
||||
map.put(" parentLevel", tbUserInfo.getParentLevel());
|
||||
map.put("上家类开型,店铺-SHOP/ 个人- PERSON", tbUserInfo.getParentType());
|
||||
map.put("关注进入的活动Id", tbUserInfo.getProjectId());
|
||||
map.put("商户Id", tbUserInfo.getMerchantId());
|
||||
map.put("0未认证,1认证", tbUserInfo.getIsResource());
|
||||
map.put("是否在线", tbUserInfo.getIsOnline());
|
||||
map.put(" isVip", tbUserInfo.getIsVip());
|
||||
map.put(" vipEffectAt", tbUserInfo.getVipEffectAt());
|
||||
map.put(" tips", tbUserInfo.getTips());
|
||||
map.put("用户来源:公众号 WECHAT 小程序 WECHAT-APP 手机注册 TELEPHONE", tbUserInfo.getSourcePath());
|
||||
map.put("是否推广员 1 是 0不是", tbUserInfo.getIsSalesPerson());
|
||||
map.put("是否关注公众号", tbUserInfo.getIsAttentionMp());
|
||||
map.put("城市", tbUserInfo.getCity());
|
||||
map.put(" searchWord", tbUserInfo.getSearchWord());
|
||||
map.put("最近登陆时间", tbUserInfo.getLastLogInAt());
|
||||
map.put(" lastLeaveAt", tbUserInfo.getLastLeaveAt());
|
||||
map.put(" createdAt", tbUserInfo.getCreatedAt());
|
||||
map.put(" updatedAt", tbUserInfo.getUpdatedAt());
|
||||
map.put("绑定时间", tbUserInfo.getBindParentAt());
|
||||
map.put("上上家", tbUserInfo.getGrandParentId());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.userInfo.service.mapstruct;
|
||||
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import me.zhengjie.modules.userInfo.domain.TbUserInfo;
|
||||
import me.zhengjie.modules.userInfo.service.dto.TbUserInfoDto;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2023-11-13
|
||||
**/
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface TbUserInfoMapper extends BaseMapper<TbUserInfoDto, TbUserInfo> {
|
||||
|
||||
}
|
||||
101
product/group/index.vue
Normal file
101
product/group/index.vue
Normal file
@@ -0,0 +1,101 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission" />
|
||||
<!--表单组件-->
|
||||
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
|
||||
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
|
||||
<el-form-item label="分组名称" prop="name">
|
||||
<el-input v-model="form.name" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="图标">
|
||||
<el-input v-model="form.pic" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否显示:1显示 0不显示" prop="isShow">
|
||||
<el-input v-model="form.isShow" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="分类描述">
|
||||
<el-input v-model="form.detail" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="商品Id列表">
|
||||
<el-input v-model="form.productIds" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="createdAt">
|
||||
<el-input v-model="form.createdAt" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||
<el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--表格渲染-->
|
||||
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="name" label="分组名称" />
|
||||
<el-table-column prop="pic" label="图标" />
|
||||
<el-table-column prop="isShow" label="是否显示:1显示 0不显示" />
|
||||
<el-table-column prop="detail" label="分类描述" />
|
||||
<el-table-column prop="productIds" label="商品Id列表" />
|
||||
<el-table-column prop="createdAt" label="createdAt" />
|
||||
<el-table-column v-if="checkPer(['admin','tbProductGroup:edit','tbProductGroup:del'])" label="操作" width="150px" align="center">
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
:data="scope.row"
|
||||
:permission="permission"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudTbProductGroup from '@/api/tbProductGroup'
|
||||
import CRUD, { presenter, header, form, crud } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
|
||||
const defaultForm = { id: null, name: null, merchantId: null, shopId: null, pic: null, isShow: null, detail: null, style: null, sort: null, productIds: null, createdAt: null, updatedAt: null }
|
||||
export default {
|
||||
name: 'TbProductGroup',
|
||||
components: { pagination, crudOperation, rrOperation, udOperation },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({ title: 'product/group', url: 'api/tbProductGroup', idField: 'id', sort: 'id,desc', crudMethod: { ...crudTbProductGroup }})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
permission: {
|
||||
add: ['admin', 'tbProductGroup:add'],
|
||||
edit: ['admin', 'tbProductGroup:edit'],
|
||||
del: ['admin', 'tbProductGroup:del']
|
||||
},
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: '分组名称不能为空', trigger: 'blur' }
|
||||
],
|
||||
isShow: [
|
||||
{ required: true, message: '是否显示:1显示 0不显示不能为空', trigger: 'blur' }
|
||||
]
|
||||
} }
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
27
product/group/tbProductGroup.js
Normal file
27
product/group/tbProductGroup.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/tbProductGroup',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/tbProductGroup/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/tbProductGroup',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del }
|
||||
Reference in New Issue
Block a user