src/main/java/com/mzl/flower/config/PyamentV3Configurer.java
@@ -20,7 +20,7 @@ public static String merchantId = "1661512517"; /** 商户API私钥路径 */ public static String privateKeyPath = "E:\\huamanyuan\\apiclient_key.pem"; public static String privateKeyPath = "/opt/pay/wx/v3/apiclient_key.pem"; /** 商户证书序列号 */ public static String merchantSerialNumber = "37A08A552943EF34883614DBC8DE281598148757"; src/main/java/com/mzl/flower/config/ResourceServerConfig.java
@@ -51,6 +51,7 @@ .antMatchers("/api/customer/flower/list/view").permitAll() .antMatchers("/api/customer/flower/up/stock").permitAll() .antMatchers("api/pub/customer/home/**").permitAll() .antMatchers("/api/customer/point/goods/**").permitAll() .antMatchers("/api/upload/oss/file").permitAll() .antMatchers("/api/flower/zone/list").permitAll() .antMatchers("/api/config/content/list/view").permitAll() src/main/java/com/mzl/flower/constant/Constants.java
@@ -430,6 +430,21 @@ } } public enum POINT_GOODS_STATUS { A("上架"), I("下架"); POINT_GOODS_STATUS(String desc) { this.desc = desc; } private String desc; public String getDesc() { return desc; } } public enum POINT_GOOD_STATUS { up("上架"), off("下架"); src/main/java/com/mzl/flower/dto/request/point/ChangePointDTO.java
对比新文件 @@ -0,0 +1,20 @@ package com.mzl.flower.dto.request.point; import lombok.Data; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; @Data public class ChangePointDTO { @NotNull(message = "积分不能为空") private Integer point; @NotBlank(message = "备注不能为空") private String remarks; @NotNull(message = "商户ID不能为空") private Long customerId; } src/main/java/com/mzl/flower/dto/request/point/PointGoodsCreateDTO.java
对比新文件 @@ -0,0 +1,28 @@ package com.mzl.flower.dto.request.point; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.List; @Data public class PointGoodsCreateDTO { @ApiModelProperty(value = "商品名称") private String name; @ApiModelProperty(value = "商品描述") private String description; @ApiModelProperty(value = "库存") private Integer stock; @ApiModelProperty(value = "封面图") private String cover; @ApiModelProperty(value = "商品图片") private List<String> pictureList; @ApiModelProperty(value = "兑换积分") private Integer point; } src/main/java/com/mzl/flower/dto/request/point/PointGoodsQueryDTO.java
对比新文件 @@ -0,0 +1,28 @@ package com.mzl.flower.dto.request.point; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.List; @Data public class PointGoodsQueryDTO { @ApiModelProperty(value = "商品名称") private String name; @ApiModelProperty(value = "状态") private String status; @ApiModelProperty(value = "库存-下限") private Integer stockLower; @ApiModelProperty(value = "库存-上限") private Integer stockUpper; @ApiModelProperty(value = "兑换积分-下限") private Integer pointLower; @ApiModelProperty(value = "兑换积分-上限") private Integer pointUpper; } src/main/java/com/mzl/flower/dto/request/point/PointGoodsUpdateDTO.java
对比新文件 @@ -0,0 +1,11 @@ package com.mzl.flower.dto.request.point; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data public class PointGoodsUpdateDTO extends PointGoodsCreateDTO{ @ApiModelProperty(value = "id") private Long id; } src/main/java/com/mzl/flower/dto/request/point/QueryCustomerPointDTO.java
对比新文件 @@ -0,0 +1,12 @@ package com.mzl.flower.dto.request.point; import lombok.Data; @Data public class QueryCustomerPointDTO { private String customerName; private String customerTel; } src/main/java/com/mzl/flower/dto/request/point/QueryPointDetailDTO.java
对比新文件 @@ -0,0 +1,28 @@ package com.mzl.flower.dto.request.point; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.time.LocalDate; @Data public class QueryPointDetailDTO { @ApiModelProperty("客户ID") private Long customerId; @ApiModelProperty("记录日期") private LocalDate recordDateStart; @ApiModelProperty("记录日期") private LocalDate recordDateEnd; @ApiModelProperty("积分类型-point_type") private String type; @ApiModelProperty("备注") private String remarks; @ApiModelProperty(hidden = true) private String userId; } src/main/java/com/mzl/flower/dto/response/point/CustomerPointDTO.java
对比新文件 @@ -0,0 +1,32 @@ package com.mzl.flower.dto.response.point; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data public class CustomerPointDTO { private Long id; @ApiModelProperty("用户DI") private String userId; @ApiModelProperty("商户ID") private Long customerId; @ApiModelProperty("商户名称") private String customerName; @ApiModelProperty("商户联系电话") private String customerTel; @ApiModelProperty("总积分") private String totalPoint; @ApiModelProperty("使用积分") private String usedPoint; @ApiModelProperty("过期积分") private String expiredPoint; } src/main/java/com/mzl/flower/dto/response/point/CustomerPointDetailDTO.java
对比新文件 @@ -0,0 +1,39 @@ package com.mzl.flower.dto.response.point; import com.mzl.flower.base.AbstractTransDTO; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.time.LocalDate; @Data public class CustomerPointDetailDTO extends AbstractTransDTO { @ApiModelProperty("记录日期") private LocalDate recordDate; @ApiModelProperty("用户ID") private String userId; @ApiModelProperty("商户ID") private Long customerId; @ApiModelProperty("积分变更类型-point_change_type") private String changeType; @ApiModelProperty("积分类型-point_type") private String type; @ApiModelProperty("积分") private String point; @ApiModelProperty("使用积分") private String usePoint; @ApiModelProperty("过期积分") private String expiredPoint; @ApiModelProperty("积分备注") private String remarks; } src/main/java/com/mzl/flower/dto/response/point/PointGoodsDTO.java
对比新文件 @@ -0,0 +1,12 @@ package com.mzl.flower.dto.response.point; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.List; @Data public class PointGoodsDTO extends PointGoodsListDTO { @ApiModelProperty(value = "商品图片") private List<String> pictureList; } src/main/java/com/mzl/flower/dto/response/point/PointGoodsListDTO.java
对比新文件 @@ -0,0 +1,31 @@ package com.mzl.flower.dto.response.point; import com.mzl.flower.base.AbstractTransDTO; import com.mzl.flower.base.annotation.DictTrans; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data public class PointGoodsListDTO extends AbstractTransDTO { private Long id; @ApiModelProperty(value = "商品名称") private String name; @ApiModelProperty(value = "商品描述") private String description; @ApiModelProperty(value = "库存") private Integer stock; @ApiModelProperty(value = "封面图") private String cover; @ApiModelProperty(value = "兑换积分") private Integer point; @ApiModelProperty(value = "状态") @DictTrans(target = "statusStr", codeType = "POINT_GOODS_STATUS") private String status; private String statusStr; } src/main/java/com/mzl/flower/entity/customer/Customer.java
@@ -42,4 +42,6 @@ @ApiModelProperty("店铺简介") private String description; @ApiModelProperty("等级id") private Long levelId; } src/main/java/com/mzl/flower/entity/point/CustomerPoint.java
@@ -12,18 +12,18 @@ @TableName("t_customer_point") public class CustomerPoint extends BaseAutoEntity { @ApiModelProperty("名称") @ApiModelProperty("用户ID") private String userId; @ApiModelProperty("联系人") @ApiModelProperty("商户ID") private Long customerId; @ApiModelProperty("总积分") private String totalPoint; private Integer totalPoint; @ApiModelProperty("使用积分") private String usedPoint; private Integer usedPoint; @ApiModelProperty("过期积分") private String expiredPoint; private Integer expiredPoint; } src/main/java/com/mzl/flower/entity/point/CustomerPointDetail.java
@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.time.LocalDate; import java.util.Date; @@ -22,7 +23,7 @@ public class CustomerPointDetail extends BaseAutoEntity { @ApiModelProperty("记录日期") private Date recordDate; private LocalDate recordDate; @ApiModelProperty("用户ID") private String userId; src/main/java/com/mzl/flower/entity/point/PointGoods.java
对比新文件 @@ -0,0 +1,33 @@ package com.mzl.flower.entity.point; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.mzl.flower.base.BaseAutoEntity; import lombok.Data; @Data @TableName("t_point_goods") public class PointGoods extends BaseAutoEntity { @TableField("name") private String name;//商品名称 @TableField("description") private String description;//商品描述 @TableField("stock") private Integer stock;//库存 @TableField("cover") private String cover;//封面图 @TableField("pictures") private String pictures;//商品图片 @TableField("point") private Integer point;//兑换积分 @TableField("status") private String status;//状态 } src/main/java/com/mzl/flower/entity/point/PointGoodsRecord.java
对比新文件 @@ -0,0 +1,50 @@ package com.mzl.flower.entity.point; import com.baomidou.mybatisplus.annotation.TableName; import com.mzl.flower.base.BaseAutoEntity; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data @TableName("t_point_goods_record") public class PointGoodsRecord extends BaseAutoEntity { @ApiModelProperty(value = "用户ID") private String userId; @ApiModelProperty(value = "商户ID") private Long customerId; @ApiModelProperty(value = "兑换单号") private String recordNo; @ApiModelProperty(value = "兑换码") private String redeemCode; @ApiModelProperty(value = "积分商品ID") private Long goodsId; @ApiModelProperty(value = "商品名称") private String name; @ApiModelProperty(value = "商品描述") private String description; @ApiModelProperty(value = "商品封面图") private String cover; @ApiModelProperty(value = "商品图片") private String pictures; @ApiModelProperty(value = "兑换积分数") private String point; @ApiModelProperty(value = "兑换数量") private String num; @ApiModelProperty(value = "兑换总积分") private String totalPoint; @ApiModelProperty(value = "兑换状态") private String status; } src/main/java/com/mzl/flower/mapper/point/CustomerPointMapper.java
@@ -1,11 +1,22 @@ package com.mzl.flower.mapper.point; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.mzl.flower.dto.request.point.QueryCustomerPointDTO; import com.mzl.flower.dto.request.point.QueryPointDetailDTO; import com.mzl.flower.dto.response.point.CustomerPointDTO; import com.mzl.flower.dto.response.point.CustomerPointDetailDTO; import com.mzl.flower.entity.point.CustomerPoint; import com.mzl.flower.entity.supplier.Station; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface CustomerPointMapper extends BaseMapper<CustomerPoint> { List<CustomerPointDTO> queryPage(@Param(value = "dto") QueryCustomerPointDTO dto, Page page); List<CustomerPointDetailDTO> queryCustomerDetails(@Param(value = "dto")QueryPointDetailDTO dto, Page page); } src/main/java/com/mzl/flower/mapper/point/PointGoodsMapper.java
对比新文件 @@ -0,0 +1,16 @@ package com.mzl.flower.mapper.point; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.mzl.flower.dto.request.point.PointGoodsQueryDTO; import com.mzl.flower.dto.response.point.PointGoodsListDTO; import com.mzl.flower.entity.point.PointGoods; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface PointGoodsMapper extends BaseMapper<PointGoods> { List<PointGoodsListDTO> selectGoodsList(Page page, @Param("condition") PointGoodsQueryDTO dto); } src/main/java/com/mzl/flower/mapper/point/PointGoodsRecordMapper.java
对比新文件 @@ -0,0 +1,9 @@ package com.mzl.flower.mapper.point; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.mzl.flower.entity.point.CustomerPointDetail; import org.springframework.stereotype.Repository; @Repository public interface PointGoodsRecordMapper extends BaseMapper<CustomerPointDetail> { } src/main/java/com/mzl/flower/service/BaseService.java
@@ -459,6 +459,16 @@ return p; } protected Customer getCustomer(Long id){ Customer p = customerMapper.selectById(id); if(p == null){ throw new ValidationException("商户不存在"); } return p; } public Partner getCurrentPartner(){ String userId = SecurityUtils.getUserId(); Partner p = partnerMapper.selectOne(new QueryWrapper<Partner>() src/main/java/com/mzl/flower/service/point/CustomerPointDetailService.java
文件已删除 src/main/java/com/mzl/flower/service/point/CustomerPointService.java
@@ -1,9 +1,121 @@ package com.mzl.flower.service.point; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.mzl.flower.config.security.SecurityUtils; import com.mzl.flower.dto.request.point.ChangePointDTO; import com.mzl.flower.dto.request.point.QueryCustomerPointDTO; import com.mzl.flower.dto.request.point.QueryPointDetailDTO; import com.mzl.flower.dto.response.point.CustomerPointDTO; import com.mzl.flower.dto.response.point.CustomerPointDetailDTO; import com.mzl.flower.entity.customer.Customer; import com.mzl.flower.entity.point.CustomerPoint; import com.mzl.flower.entity.point.CustomerPointDetail; import com.mzl.flower.mapper.point.CustomerPointDetailMapper; import com.mzl.flower.mapper.point.CustomerPointMapper; import com.mzl.flower.service.BaseService; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.time.LocalDate; import java.util.List; import com.mzl.flower.constant.Constants.*; @Service @Transactional public class CustomerPointService { public class CustomerPointService extends BaseService { private final CustomerPointMapper customerPointMapper; private final CustomerPointDetailMapper customerPointDetailMapper; public CustomerPointService(CustomerPointMapper customerPointMapper, CustomerPointDetailMapper customerPointDetailMapper) { this.customerPointMapper = customerPointMapper; this.customerPointDetailMapper = customerPointDetailMapper; } public Page<CustomerPointDTO> queryPage(QueryCustomerPointDTO dto, Page page) { List<CustomerPointDTO> list = customerPointMapper.queryPage(dto, page); page.setRecords(list); return page; } public Page<CustomerPointDetailDTO> queryCustomerDetails(QueryPointDetailDTO dto, Page page) { List<CustomerPointDetailDTO> list = customerPointMapper.queryCustomerDetails(dto, page); page.setRecords(list); return page; } public void giveawayPoint(ChangePointDTO dto) { CustomerPointDetail detail = new CustomerPointDetail(); Customer customer = getCustomer(dto.getCustomerId()); detail.setCustomerId(customer.getId()); detail.setUserId(customer.getUserId()); detail.setPoint(dto.getPoint()); detail.setRemarks(dto.getRemarks()); detail.setRecordDate(LocalDate.now()); detail.setChangeType(POINT_CHANGE_TYPE.add.name()); detail.setType(POINT_TYPE.giveaway.name()); detail.create(SecurityUtils.getUserId()); customerPointDetailMapper.insert(detail); //更新汇总表 updateCustomerPoint(detail); } public void updateCustomerPoint(CustomerPointDetail detail) { CustomerPoint point = customerPointMapper.selectOne(new LambdaQueryWrapper<CustomerPoint>() .eq(CustomerPoint::getCustomerId, detail.getCustomerId())); boolean isAdd = false; if(point == null){ isAdd = true; point = new CustomerPoint(); point.setCustomerId(detail.getCustomerId()); point.setUserId(detail.getUserId()); point.setTotalPoint(0); point.setUsedPoint(0); point.setExpiredPoint(0); point.create(SecurityUtils.getUserId()); } if(POINT_CHANGE_TYPE.add.name().equals(detail.getChangeType())){ point.setTotalPoint(point.getTotalPoint() + detail.getPoint()); point.setUsedPoint(point.getUsedPoint() + detail.getUsePoint()); point.setExpiredPoint(point.getExpiredPoint() + detail.getExpiredPoint()); }else if(POINT_CHANGE_TYPE.reduce.name().equals(detail.getChangeType())){ // if(point.getTotalPoint()!= null && point.getTotalPoint()!=0 && point.getTotalPoint()>= detail.getPoint()){ // point.setTotalPoint(point.getTotalPoint() - detail.getPoint()); // }else{ // //积分不足,直接清0 // point.setTotalPoint(0); // } point.setTotalPoint(point.getTotalPoint() - detail.getPoint()); } if(isAdd){ customerPointMapper.insert(point); }else{ customerPointMapper.updateById(point); } } public void deductionPoint(ChangePointDTO dto) { CustomerPointDetail detail = new CustomerPointDetail(); Customer customer = getCustomer(dto.getCustomerId()); detail.setCustomerId(customer.getId()); detail.setUserId(customer.getUserId()); detail.setPoint(dto.getPoint()); detail.setRemarks(dto.getRemarks()); detail.setRecordDate(LocalDate.now()); detail.setChangeType(POINT_CHANGE_TYPE.reduce.name()); detail.setType(POINT_TYPE.deduction.name()); detail.create(SecurityUtils.getUserId()); customerPointDetailMapper.insert(detail); //更新汇总表 updateCustomerPoint(detail); } } src/main/java/com/mzl/flower/service/point/PointGoodService.java
文件已删除 src/main/java/com/mzl/flower/service/point/PointGoodsService.java
对比新文件 @@ -0,0 +1,89 @@ package com.mzl.flower.service.point; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.mzl.flower.config.exception.ValidationException; import com.mzl.flower.config.security.SecurityUtils; import com.mzl.flower.constant.Constants; import com.mzl.flower.dto.request.point.PointGoodsCreateDTO; import com.mzl.flower.dto.request.point.PointGoodsQueryDTO; import com.mzl.flower.dto.request.point.PointGoodsUpdateDTO; import com.mzl.flower.dto.response.point.PointGoodsDTO; import com.mzl.flower.dto.response.point.PointGoodsListDTO; import com.mzl.flower.entity.point.PointGoods; import com.mzl.flower.mapper.point.PointGoodsMapper; import com.mzl.flower.service.BaseService; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; @Service @Transactional public class PointGoodsService extends BaseService { @Autowired private PointGoodsMapper pointGoodsMapper; public Long addPointGoods(PointGoodsCreateDTO dto){ PointGoods p = new PointGoods(); BeanUtils.copyProperties(dto, p); p.setPictures(toJSONString(dto.getPictureList())); p.setStatus(Constants.POINT_GOODS_STATUS.I.name()); p.create(SecurityUtils.getUserId()); pointGoodsMapper.insert(p); return p.getId(); } public Long updatePointGoods(PointGoodsUpdateDTO dto){ PointGoods p = pointGoodsMapper.selectById(dto.getId()); if(p == null){ throw new ValidationException("商品未找到"); } BeanUtils.copyProperties(dto, p); p.setPictures(toJSONString(dto.getPictureList())); p.update(SecurityUtils.getUserId()); pointGoodsMapper.updateById(p); return p.getId(); } public void deletePointGoods(Long id){ pointGoodsMapper.deleteById(id); } public Page<PointGoodsListDTO> selectGoodsList(Page page, PointGoodsQueryDTO dto){ List<PointGoodsListDTO> ls = pointGoodsMapper.selectGoodsList(page, dto); page.setRecords(ls); return page; } public PointGoodsDTO getGoodsInfo(Long id){ PointGoods p = pointGoodsMapper.selectById(id); if(p == null){ throw new ValidationException("商品未找到"); } PointGoodsDTO dto = new PointGoodsDTO(); BeanUtils.copyProperties(p, dto); dto.setPictureList(parseArray(p.getPictures(), String.class)); return dto; } public void updateStatus(Long id, String status){ PointGoods p = pointGoodsMapper.selectById(id); if(p == null){ throw new ValidationException("商品未找到"); } p.setStatus(status); p.update(SecurityUtils.getUserId()); pointGoodsMapper.updateById(p); } } src/main/java/com/mzl/flower/service/point/impl/CustomerPointDetailServiceImpl.java
文件已删除 src/main/java/com/mzl/flower/service/point/impl/PointGoodServiceImpl.java
文件已删除 src/main/java/com/mzl/flower/web/customer/PointGoodsCustomerController.java
对比新文件 @@ -0,0 +1,50 @@ package com.mzl.flower.web.customer; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.mzl.flower.base.BaseController; import com.mzl.flower.base.R; import com.mzl.flower.base.ReturnDataDTO; import com.mzl.flower.constant.Constants; import com.mzl.flower.dto.request.point.PointGoodsCreateDTO; import com.mzl.flower.dto.request.point.PointGoodsQueryDTO; import com.mzl.flower.dto.request.point.PointGoodsUpdateDTO; import com.mzl.flower.dto.response.point.PointGoodsDTO; import com.mzl.flower.dto.response.point.PointGoodsListDTO; import com.mzl.flower.service.point.PointGoodsService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/api/customer/point/goods") @Api(value = "积分商品-花店", tags = "积分商品-花店") @Validated @Slf4j public class PointGoodsCustomerController extends BaseController { @Autowired private PointGoodsService pointGoodsService; @GetMapping("/list") @ApiOperation(value = "商品列表") public ResponseEntity<ReturnDataDTO<Page<PointGoodsListDTO>>> selectGoodsList(Page page, PointGoodsQueryDTO dto){ dto.setStatus(Constants.POINT_GOODS_STATUS.A.name()); return returnData(R.SUCCESS.getCode(), pointGoodsService.selectGoodsList(page, dto)); } @GetMapping("/list/view") @ApiOperation(value = "商品详情") @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "商品id", required = true, dataType = "Long", paramType = "query") }) public ResponseEntity<ReturnDataDTO<PointGoodsDTO>> getGoodsInfo(Long id) { return returnData(R.SUCCESS.getCode(), pointGoodsService.getGoodsInfo(id)); } } src/main/java/com/mzl/flower/web/point/CustomerPointController.java
@@ -1,16 +1,82 @@ package com.mzl.flower.web.point; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.mzl.flower.base.BaseController; import com.mzl.flower.base.R; import com.mzl.flower.base.ReturnDataDTO; import com.mzl.flower.config.security.SecurityUtils; import com.mzl.flower.dto.request.point.ChangePointDTO; import com.mzl.flower.dto.request.point.QueryCustomerPointDTO; import com.mzl.flower.dto.request.point.QueryPointDetailDTO; import com.mzl.flower.dto.request.supplier.UpdateSupplierDTO; import com.mzl.flower.dto.response.content.AdvertisementDTO; import com.mzl.flower.dto.response.point.CustomerPointDTO; import com.mzl.flower.dto.response.point.CustomerPointDetailDTO; import com.mzl.flower.service.point.CustomerPointService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.*; import javax.validation.ValidationException; import javax.validation.constraints.NotNull; import java.util.List; @RestController @RequestMapping("/api/customer/point") @Api(value = "会员积分", tags = "会员积分") @Validated @Slf4j public class CustomerPointController { public class CustomerPointController extends BaseController { private final CustomerPointService customerPointService; public CustomerPointController(CustomerPointService customerPointService) { this.customerPointService = customerPointService; } @GetMapping("/page/list") @ApiOperation(value = "管理端-积分详细记录列表", notes = "管理端-商户积分详细记录列表") public ResponseEntity<ReturnDataDTO<Page<CustomerPointDetailDTO>>> queryCustomerDetails(QueryPointDetailDTO dto, Page page) { if(dto.getCustomerId() == null || dto.getCustomerId() == 0){ throw new ValidationException("商户ID不能为空"); } return returnData(R.SUCCESS.getCode(),customerPointService.queryCustomerDetails(dto, page)); } @GetMapping("/page") @ApiOperation(value = "管理端-积分查询", notes = "用户端-积分查询") public ResponseEntity<ReturnDataDTO<Page<CustomerPointDTO>>> queryPage(QueryCustomerPointDTO dto, Page page) { return returnData(R.SUCCESS.getCode(), customerPointService.queryPage(dto, page)); } @PostMapping("/giveaway") @ApiOperation(value = "管理端-积分赠送", notes = "管理端-积分赠送") public ResponseEntity<ReturnDataDTO> giveawayPoint(@Validated @RequestBody ChangePointDTO dto) { customerPointService.giveawayPoint(dto); return returnData(R.SUCCESS.getCode(),null); } @PostMapping("/deduction") @ApiOperation(value = "管理端-积分扣除", notes = "管理端-积分扣除") public ResponseEntity<ReturnDataDTO> deductionPoint(@Validated @RequestBody ChangePointDTO dto) { customerPointService.deductionPoint(dto); return returnData(R.SUCCESS.getCode(),null); } @GetMapping("/list") @ApiOperation(value = "用户端-积分列表(花店积分列表)", notes = "管理端-积分列表(花店积分列表)") public ResponseEntity<ReturnDataDTO<Page<CustomerPointDetailDTO>>> myPointDetails(QueryPointDetailDTO dto, Page page) { dto.setUserId(SecurityUtils.getUserId()); return returnData(R.SUCCESS.getCode(),customerPointService.queryCustomerDetails(dto, page)); } } src/main/java/com/mzl/flower/web/point/CustomerPointDetailController.java
文件已删除 src/main/java/com/mzl/flower/web/point/PointGoodController.java
文件已删除 src/main/java/com/mzl/flower/web/point/PointGoodsController.java
对比新文件 @@ -0,0 +1,90 @@ package com.mzl.flower.web.point; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.mzl.flower.base.BaseController; import com.mzl.flower.base.R; import com.mzl.flower.base.ReturnDataDTO; import com.mzl.flower.constant.Constants; import com.mzl.flower.dto.request.point.PointGoodsCreateDTO; import com.mzl.flower.dto.request.point.PointGoodsQueryDTO; import com.mzl.flower.dto.request.point.PointGoodsUpdateDTO; import com.mzl.flower.dto.response.point.PointGoodsDTO; import com.mzl.flower.dto.response.point.PointGoodsListDTO; import com.mzl.flower.service.point.PointGoodsService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/api/point/goods") @Api(value = "积分商品管理-运营端", tags = "积分商品管理-运营端") @Validated @Slf4j public class PointGoodsController extends BaseController { @Autowired private PointGoodsService pointGoodsService; @PostMapping("/list/new") @ApiOperation(value = "新增商品") public ResponseEntity<ReturnDataDTO> addPointGoods(@RequestBody PointGoodsCreateDTO dto) { return returnData(R.SUCCESS.getCode(), pointGoodsService.addPointGoods(dto)); } @PostMapping("/list/edit") @ApiOperation(value = "编辑商品") public ResponseEntity<ReturnDataDTO> updatePointGoods(@RequestBody PointGoodsUpdateDTO dto) { return returnData(R.SUCCESS.getCode(), pointGoodsService.updatePointGoods(dto)); } @GetMapping("/list") @ApiOperation(value = "商品列表") public ResponseEntity<ReturnDataDTO<Page<PointGoodsListDTO>>> selectGoodsList(Page page, PointGoodsQueryDTO dto){ return returnData(R.SUCCESS.getCode(), pointGoodsService.selectGoodsList(page, dto)); } @GetMapping("/list/view") @ApiOperation(value = "商品详情") @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "商品id", required = true, dataType = "Long", paramType = "query") }) public ResponseEntity<ReturnDataDTO<PointGoodsDTO>> getGoodsInfo(Long id) { return returnData(R.SUCCESS.getCode(), pointGoodsService.getGoodsInfo(id)); } @GetMapping("/list/delete") @ApiOperation(value = "商品删除") @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "商品id", required = true, dataType = "Long", paramType = "query") }) public ResponseEntity<ReturnDataDTO<?>> deletePointGoods(Long id) { pointGoodsService.deletePointGoods(id); return returnData(R.SUCCESS.getCode(), null); } @GetMapping("/list/on") @ApiOperation(value = "商品上架") @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "商品id", required = true, dataType = "Long", paramType = "query") }) public ResponseEntity<ReturnDataDTO<?>> upGoods(Long id) { pointGoodsService.updateStatus(id, Constants.POINT_GOODS_STATUS.A.name()); return returnData(R.SUCCESS.getCode(), null); } @GetMapping("/list/off") @ApiOperation(value = "商品下架") @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "商品id", required = true, dataType = "Long", paramType = "query") }) public ResponseEntity<ReturnDataDTO<?>> offGoods(Long id) { pointGoodsService.updateStatus(id, Constants.POINT_GOODS_STATUS.I.name()); return returnData(R.SUCCESS.getCode(), null); } } src/main/resources/mapper/point/CustomerPointMapper.xml
对比新文件 @@ -0,0 +1,50 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <mapper namespace="com.mzl.flower.mapper.point.CustomerPointMapper"> <select id="queryPage" resultType="com.mzl.flower.dto.response.point.CustomerPointDTO"> SELECT p.*, c.`name` as customerName, t.tel as customerTel FROM t_customer_point p LEFT JOIN t_customer_info c ON c.id = p.customer_id LEFT JOIN t_user t on p.user_id = t.id WHERE p.deleted = 0 <if test="dto.customerName!= null and dto.customerName != ''"> AND c.`name` LIKE CONCAT('%',#{dto.customerName},'%') </if> <if test="dto.customerTel!= null and dto.customerTel != ''"> and t.tel like CONCAT('%',#{dto.customerTel},'%') </if> order by p.create_time desc </select> <select id="queryCustomerDetails" resultType="com.mzl.flower.dto.response.point.CustomerPointDetailDTO"> SELECT * from t_customer_point_detail t where t.deleted= 0 <if test="dto.customerId!= null and dto.customerId != 0"> and t.customer_id = #{dto.customerId} </if> <if test="dto.userId!= null and dto.userId != 0"> and t.user_id = #{dto.userId} </if> <if test="dto.recordDateStart!=null "> <![CDATA[ AND t.record_date >= #{dto.createDateBegin} ]]> </if> <if test="dto.recordDateEnd!=null "> <![CDATA[ AND t.record_date <= #{dto.createDateEnd} ]]> </if> <if test="dto.type!=null and dto.type != null"> and t.type = #{dto.type} </if> <if test="dto.remarks!=null and dto.remarks != null"> and t.remarks like CONCAT('%',#{dto.remarks},'%') </if> order by t.create_time desc </select> </mapper> src/main/resources/mapper/point/PointGoodsMapper.xml
对比新文件 @@ -0,0 +1,30 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <mapper namespace="com.mzl.flower.mapper.point.PointGoodsMapper"> <select id="selectGoodsList" resultType="com.mzl.flower.dto.response.point.PointGoodsListDTO"> SELECT p.* FROM t_point_goods p WHERE p.deleted = 0 <if test="condition.name != null and condition.name != ''"> AND p.name LIKE concat('%', #{condition.name},'%') </if> <if test="condition.status != null and condition.status != ''"> AND p.status = #{condition.status} </if> <if test="condition.stockLower != null"> AND p.stock > #{condition.stockLower} </if> <if test="condition.stockUpper != null"> AND p.stock <= #{condition.stockUpper} </if> <if test="condition.pointLower != null"> AND p.point > #{condition.pointLower} </if> <if test="condition.pointUpper != null"> AND p.point <= #{condition.pointUpper} </if> ORDER BY p.create_time desc </select> </mapper> src/main/表设计-二期.xlsxBinary files differ
src/main/表设计.xlsxBinary files differ