diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/orderInfo/domain/TbOrderInfo.java b/eladmin-system/src/main/java/me/zhengjie/modules/orderInfo/domain/TbOrderInfo.java new file mode 100644 index 00000000..8ff047de --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/orderInfo/domain/TbOrderInfo.java @@ -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)); + } +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/orderInfo/repository/TbOrderInfoRepository.java b/eladmin-system/src/main/java/me/zhengjie/modules/orderInfo/repository/TbOrderInfoRepository.java new file mode 100644 index 00000000..77470265 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/orderInfo/repository/TbOrderInfoRepository.java @@ -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, JpaSpecificationExecutor { +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/orderInfo/rest/TbOrderInfoController.java b/eladmin-system/src/main/java/me/zhengjie/modules/orderInfo/rest/TbOrderInfoController.java new file mode 100644 index 00000000..71b70cb5 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/orderInfo/rest/TbOrderInfoController.java @@ -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 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 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 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 deleteTbOrderInfo(@RequestBody Integer[] ids) { + tbOrderInfoService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/orderInfo/service/TbOrderInfoService.java b/eladmin-system/src/main/java/me/zhengjie/modules/orderInfo/service/TbOrderInfoService.java new file mode 100644 index 00000000..327993e0 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/orderInfo/service/TbOrderInfoService.java @@ -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 + */ + Map queryAll(TbOrderInfoQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List 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 all, HttpServletResponse response) throws IOException; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/orderInfo/service/dto/TbOrderInfoDto.java b/eladmin-system/src/main/java/me/zhengjie/modules/orderInfo/service/dto/TbOrderInfoDto.java new file mode 100644 index 00000000..5eda6930 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/orderInfo/service/dto/TbOrderInfoDto.java @@ -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; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/orderInfo/service/dto/TbOrderInfoQueryCriteria.java b/eladmin-system/src/main/java/me/zhengjie/modules/orderInfo/service/dto/TbOrderInfoQueryCriteria.java new file mode 100644 index 00000000..1c1daa5f --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/orderInfo/service/dto/TbOrderInfoQueryCriteria.java @@ -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; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/orderInfo/service/impl/TbOrderInfoServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/orderInfo/service/impl/TbOrderInfoServiceImpl.java new file mode 100644 index 00000000..5c45eb15 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/orderInfo/service/impl/TbOrderInfoServiceImpl.java @@ -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 queryAll(TbOrderInfoQueryCriteria criteria, Pageable pageable){ + Page page = tbOrderInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(tbOrderInfoMapper::toDto)); + } + + @Override + public List 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 all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (TbOrderInfoDto tbOrderInfo : all) { + Map 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); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/orderInfo/service/mapstruct/TbOrderInfoMapper.java b/eladmin-system/src/main/java/me/zhengjie/modules/orderInfo/service/mapstruct/TbOrderInfoMapper.java new file mode 100644 index 00000000..3e22c079 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/orderInfo/service/mapstruct/TbOrderInfoMapper.java @@ -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 { + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/product/domain/TbProduct.java b/eladmin-system/src/main/java/me/zhengjie/modules/product/domain/TbProduct.java new file mode 100644 index 00000000..051a62c7 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/product/domain/TbProduct.java @@ -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姝e父") + 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)); + } +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/product/repository/TbProductRepository.java b/eladmin-system/src/main/java/me/zhengjie/modules/product/repository/TbProductRepository.java new file mode 100644 index 00000000..0108c22b --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/product/repository/TbProductRepository.java @@ -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, JpaSpecificationExecutor { +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/product/rest/TbProductController.java b/eladmin-system/src/main/java/me/zhengjie/modules/product/rest/TbProductController.java new file mode 100644 index 00000000..2e96dfcc --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/product/rest/TbProductController.java @@ -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 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 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 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 deleteTbProduct(@RequestBody Integer[] ids) { + tbProductService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/product/service/TbProductService.java b/eladmin-system/src/main/java/me/zhengjie/modules/product/service/TbProductService.java new file mode 100644 index 00000000..73d4484b --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/product/service/TbProductService.java @@ -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 + */ + Map queryAll(TbProductQueryCriteria criteria, Pageable pageable); + + /** + * 鏌ヨ鎵鏈夋暟鎹笉鍒嗛〉 + * @param criteria 鏉′欢鍙傛暟 + * @return List + */ + List 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 all, HttpServletResponse response) throws IOException; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/product/service/dto/TbProductDto.java b/eladmin-system/src/main/java/me/zhengjie/modules/product/service/dto/TbProductDto.java new file mode 100644 index 00000000..20c07c77 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/product/service/dto/TbProductDto.java @@ -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姝e父 */ + private Integer showOnMallStatus; + + /** 鎻愪氦瀹℃牳鏃堕棿 */ + private Long showOnMallTime; + + /** 绾夸笂鍟嗗煄灞曠ず澶辫触鍘熷洜 */ + private String showOnMallErrorMsg; + + /** 浣跨敤鏍囩鎵撳嵃 閫夋嫨 鏄 骞跺湪 鍓嶅彴>鏈満璁剧疆 鍕鹃夋墦鍗版爣绛惧悗锛屾敹閾跺畬鎴愬悗浼氳嚜鍔ㄦ墦鍗板搴旀暟閲忕殑鏍囩鏁 */ + private Integer enableLabel; + + /** 绋庣巼 */ + private String taxConfigId; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/product/service/dto/TbProductQueryCriteria.java b/eladmin-system/src/main/java/me/zhengjie/modules/product/service/dto/TbProductQueryCriteria.java new file mode 100644 index 00000000..5d166a7f --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/product/service/dto/TbProductQueryCriteria.java @@ -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; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/product/service/impl/TbProductServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/product/service/impl/TbProductServiceImpl.java new file mode 100644 index 00000000..b84d7785 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/product/service/impl/TbProductServiceImpl.java @@ -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 queryAll(TbProductQueryCriteria criteria, Pageable pageable){ + Page page = tbProductRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(tbProductMapper::toDto)); + } + + @Override + public List 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 all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (TbProductDto tbProduct : all) { + Map 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姝e父", 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); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/product/service/mapstruct/TbProductMapper.java b/eladmin-system/src/main/java/me/zhengjie/modules/product/service/mapstruct/TbProductMapper.java new file mode 100644 index 00000000..4082e439 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/product/service/mapstruct/TbProductMapper.java @@ -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 { + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/productGroup/domain/TbProductGroup.java b/eladmin-system/src/main/java/me/zhengjie/modules/productGroup/domain/TbProductGroup.java new file mode 100644 index 00000000..85d0868c --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/productGroup/domain/TbProductGroup.java @@ -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)); + } +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/productGroup/repository/TbProductGroupRepository.java b/eladmin-system/src/main/java/me/zhengjie/modules/productGroup/repository/TbProductGroupRepository.java new file mode 100644 index 00000000..cba52ff8 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/productGroup/repository/TbProductGroupRepository.java @@ -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, JpaSpecificationExecutor { +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/productGroup/rest/TbProductGroupController.java b/eladmin-system/src/main/java/me/zhengjie/modules/productGroup/rest/TbProductGroupController.java new file mode 100644 index 00000000..68230a65 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/productGroup/rest/TbProductGroupController.java @@ -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 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 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 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 deleteTbProductGroup(@RequestBody Integer[] ids) { + tbProductGroupService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/productGroup/service/TbProductGroupService.java b/eladmin-system/src/main/java/me/zhengjie/modules/productGroup/service/TbProductGroupService.java new file mode 100644 index 00000000..4ee8a04b --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/productGroup/service/TbProductGroupService.java @@ -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 + */ + Map queryAll(TbProductGroupQueryCriteria criteria, Pageable pageable); + + /** + * 鏌ヨ鎵鏈夋暟鎹笉鍒嗛〉 + * @param criteria 鏉′欢鍙傛暟 + * @return List + */ + List 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 all, HttpServletResponse response) throws IOException; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/productGroup/service/dto/TbProductGroupDto.java b/eladmin-system/src/main/java/me/zhengjie/modules/productGroup/service/dto/TbProductGroupDto.java new file mode 100644 index 00000000..3e1617fb --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/productGroup/service/dto/TbProductGroupDto.java @@ -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; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/productGroup/service/dto/TbProductGroupQueryCriteria.java b/eladmin-system/src/main/java/me/zhengjie/modules/productGroup/service/dto/TbProductGroupQueryCriteria.java new file mode 100644 index 00000000..4816085d --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/productGroup/service/dto/TbProductGroupQueryCriteria.java @@ -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{ +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/productGroup/service/impl/TbProductGroupServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/productGroup/service/impl/TbProductGroupServiceImpl.java new file mode 100644 index 00000000..ffa0274b --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/productGroup/service/impl/TbProductGroupServiceImpl.java @@ -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 queryAll(TbProductGroupQueryCriteria criteria, Pageable pageable){ + Page page = tbProductGroupRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(tbProductGroupMapper::toDto)); + } + + @Override + public List 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 all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (TbProductGroupDto tbProductGroup : all) { + Map 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); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/productGroup/service/mapstruct/TbProductGroupMapper.java b/eladmin-system/src/main/java/me/zhengjie/modules/productGroup/service/mapstruct/TbProductGroupMapper.java new file mode 100644 index 00000000..d5f2fdb0 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/productGroup/service/mapstruct/TbProductGroupMapper.java @@ -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 { + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/register/domain/ViewRegister.java b/eladmin-system/src/main/java/me/zhengjie/modules/register/domain/ViewRegister.java new file mode 100644 index 00000000..c700c642 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/register/domain/ViewRegister.java @@ -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)); + } +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/register/repository/ViewRegisterRepository.java b/eladmin-system/src/main/java/me/zhengjie/modules/register/repository/ViewRegisterRepository.java new file mode 100644 index 00000000..3492589e --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/register/repository/ViewRegisterRepository.java @@ -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, JpaSpecificationExecutor { +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/register/rest/ViewRegisterController.java b/eladmin-system/src/main/java/me/zhengjie/modules/register/rest/ViewRegisterController.java new file mode 100644 index 00000000..76bc9b47 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/register/rest/ViewRegisterController.java @@ -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 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 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 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 deleteViewRegister(@RequestBody Integer[] ids) { + viewRegisterService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/register/service/ViewRegisterService.java b/eladmin-system/src/main/java/me/zhengjie/modules/register/service/ViewRegisterService.java new file mode 100644 index 00000000..75b6f93d --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/register/service/ViewRegisterService.java @@ -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 + */ + Map queryAll(ViewRegisterQueryCriteria criteria, Pageable pageable); + + /** + * 鏌ヨ鎵鏈夋暟鎹笉鍒嗛〉 + * @param criteria 鏉′欢鍙傛暟 + * @return List + */ + List 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 all, HttpServletResponse response) throws IOException; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/register/service/dto/ViewRegisterDto.java b/eladmin-system/src/main/java/me/zhengjie/modules/register/service/dto/ViewRegisterDto.java new file mode 100644 index 00000000..3a30361e --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/register/service/dto/ViewRegisterDto.java @@ -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; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/register/service/dto/ViewRegisterQueryCriteria.java b/eladmin-system/src/main/java/me/zhengjie/modules/register/service/dto/ViewRegisterQueryCriteria.java new file mode 100644 index 00000000..86ab0147 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/register/service/dto/ViewRegisterQueryCriteria.java @@ -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; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/register/service/impl/ViewRegisterServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/register/service/impl/ViewRegisterServiceImpl.java new file mode 100644 index 00000000..136efe35 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/register/service/impl/ViewRegisterServiceImpl.java @@ -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 queryAll(ViewRegisterQueryCriteria criteria, Pageable pageable){ + Page page = viewRegisterRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(viewRegisterMapper::toDto)); + } + + @Override + public List 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 all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (ViewRegisterDto viewRegister : all) { + Map 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); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/register/service/mapstruct/ViewRegisterMapper.java b/eladmin-system/src/main/java/me/zhengjie/modules/register/service/mapstruct/ViewRegisterMapper.java new file mode 100644 index 00000000..9438a3e6 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/register/service/mapstruct/ViewRegisterMapper.java @@ -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 { + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/userInfo/domain/TbUserInfo.java b/eladmin-system/src/main/java/me/zhengjie/modules/userInfo/domain/TbUserInfo.java new file mode 100644 index 00000000..24394382 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/userInfo/domain/TbUserInfo.java @@ -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 = "灏忕▼搴廔d") + 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 = "鍏紬鍙穙penId") + 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姝e父") + 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 = "鍏虫敞杩涘叆鐨勬椿鍔↖d") + 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)); + } +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/userInfo/repository/TbUserInfoRepository.java b/eladmin-system/src/main/java/me/zhengjie/modules/userInfo/repository/TbUserInfoRepository.java new file mode 100644 index 00000000..27c6f7b7 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/userInfo/repository/TbUserInfoRepository.java @@ -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, JpaSpecificationExecutor { +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/userInfo/rest/TbUserInfoController.java b/eladmin-system/src/main/java/me/zhengjie/modules/userInfo/rest/TbUserInfoController.java new file mode 100644 index 00000000..df594493 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/userInfo/rest/TbUserInfoController.java @@ -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 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 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 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 deleteTbUserInfo(@RequestBody Integer[] ids) { + tbUserInfoService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/userInfo/service/TbUserInfoService.java b/eladmin-system/src/main/java/me/zhengjie/modules/userInfo/service/TbUserInfoService.java new file mode 100644 index 00000000..708f22ca --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/userInfo/service/TbUserInfoService.java @@ -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 + */ + Map queryAll(TbUserInfoQueryCriteria criteria, Pageable pageable); + + /** + * 鏌ヨ鎵鏈夋暟鎹笉鍒嗛〉 + * @param criteria 鏉′欢鍙傛暟 + * @return List + */ + List 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 all, HttpServletResponse response) throws IOException; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/userInfo/service/dto/TbUserInfoDto.java b/eladmin-system/src/main/java/me/zhengjie/modules/userInfo/service/dto/TbUserInfoDto.java new file mode 100644 index 00000000..ce4c2356 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/userInfo/service/dto/TbUserInfoDto.java @@ -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; + + /** 灏忕▼搴廔d */ + private String wxMaAppId; + + /** 浼氬憳鐢熸棩 */ + private String birthDay; + + /** 0-濂 1鐢 */ + private Integer sex; + + /** 灏忕▼搴忕殑openId */ + private String miniAppOpenId; + + /** 鍏紬鍙穙penId */ + private String openId; + + /** 鑱斿悎Id */ + private String unionId; + + /** 鐢ㄦ埛缂栧彿 */ + private String code; + + /** 鐢ㄦ埛绫诲瀷-淇濈暀瀛楁 */ + private String type; + + /** 'DOCTOR'-->鍖荤敓锛'USER'->鐢ㄦ埛 */ + private Integer identify; + + /** 1姝e父 */ + private Integer status; + + /** 寮曡崘浜 */ + private String parentId; + + private String parentLevel; + + /** 涓婂绫诲紑鍨嬶紝搴楅摵-SHOP/ 涓汉- PERSON */ + private String parentType; + + /** 鍏虫敞杩涘叆鐨勬椿鍔↖d */ + 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; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/userInfo/service/dto/TbUserInfoQueryCriteria.java b/eladmin-system/src/main/java/me/zhengjie/modules/userInfo/service/dto/TbUserInfoQueryCriteria.java new file mode 100644 index 00000000..8defdd08 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/userInfo/service/dto/TbUserInfoQueryCriteria.java @@ -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; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/userInfo/service/impl/TbUserInfoServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/userInfo/service/impl/TbUserInfoServiceImpl.java new file mode 100644 index 00000000..b2839126 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/userInfo/service/impl/TbUserInfoServiceImpl.java @@ -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 queryAll(TbUserInfoQueryCriteria criteria, Pageable pageable){ + Page page = tbUserInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(tbUserInfoMapper::toDto)); + } + + @Override + public List 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 all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (TbUserInfoDto tbUserInfo : all) { + Map 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("灏忕▼搴廔d", tbUserInfo.getWxMaAppId()); + map.put("浼氬憳鐢熸棩", tbUserInfo.getBirthDay()); + map.put("0-濂 1鐢", tbUserInfo.getSex()); + map.put("灏忕▼搴忕殑openId", tbUserInfo.getMiniAppOpenId()); + map.put("鍏紬鍙穙penId", tbUserInfo.getOpenId()); + map.put("鑱斿悎Id", tbUserInfo.getUnionId()); + map.put("鐢ㄦ埛缂栧彿", tbUserInfo.getCode()); + map.put("鐢ㄦ埛绫诲瀷-淇濈暀瀛楁", tbUserInfo.getType()); + map.put("'DOCTOR'-->鍖荤敓锛'USER'->鐢ㄦ埛", tbUserInfo.getIdentify()); + map.put("1姝e父", tbUserInfo.getStatus()); + map.put("寮曡崘浜", tbUserInfo.getParentId()); + map.put(" parentLevel", tbUserInfo.getParentLevel()); + map.put("涓婂绫诲紑鍨嬶紝搴楅摵-SHOP/ 涓汉- PERSON", tbUserInfo.getParentType()); + map.put("鍏虫敞杩涘叆鐨勬椿鍔↖d", 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); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/userInfo/service/mapstruct/TbUserInfoMapper.java b/eladmin-system/src/main/java/me/zhengjie/modules/userInfo/service/mapstruct/TbUserInfoMapper.java new file mode 100644 index 00000000..cc62be98 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/userInfo/service/mapstruct/TbUserInfoMapper.java @@ -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 { + +} \ No newline at end of file diff --git a/product/group/index.vue b/product/group/index.vue new file mode 100644 index 00000000..a2f75a87 --- /dev/null +++ b/product/group/index.vue @@ -0,0 +1,101 @@ + + + + + diff --git a/product/group/tbProductGroup.js b/product/group/tbProductGroup.js new file mode 100644 index 00000000..9f9e9bff --- /dev/null +++ b/product/group/tbProductGroup.js @@ -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 }