后台日志管理,优惠卷列表以及增加优惠卷

This commit is contained in:
liuyingfang 2024-03-21 09:20:09 +08:00
parent 42f401469a
commit 1981baeb94
15 changed files with 795 additions and 0 deletions

View File

@ -0,0 +1,30 @@
package cn.ysk.cashier.domain;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.Entity;
import java.sql.Timestamp;
/**
* @author lyf
*/
@Data
public class LogVO {
/** 请求ip */
private String requestIp;
/** 描述 */
private String description;
/** 操作用户 */
private String username;
/**
* 操作时间
*/
private Timestamp createTime;
}

View File

@ -36,4 +36,5 @@ public interface LogRepository extends JpaRepository<Log,Long>, JpaSpecification
@Modifying
@Query(value = "delete from sys_log where log_type = ?1", nativeQuery = true)
void deleteByLogType(String logType);
}

View File

@ -18,6 +18,7 @@ package cn.ysk.cashier.rest;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.service.LogService;
import cn.ysk.cashier.service.dto.LogQueryCriteria;
import cn.ysk.cashier.service.dto.LogQueryCriteriaExt;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
@ -29,6 +30,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;
/**
* @author Zheng Jie
@ -106,4 +108,16 @@ public class LogController {
logService.delAllByInfo();
return new ResponseEntity<>(HttpStatus.OK);
}
/**
*
* @param criteria
* @param pageable
* @return
*/
@GetMapping("/shopInfo")
public ResponseEntity<Object> queryShopInfoLog(LogQueryCriteriaExt criteria, Pageable pageable){
return new ResponseEntity<>(logService.shopInfoLog(criteria, pageable),HttpStatus.OK);
}
}

View File

@ -17,6 +17,7 @@ package cn.ysk.cashier.service;
import cn.ysk.cashier.service.dto.LogQueryCriteria;
import cn.ysk.cashier.domain.Log;
import cn.ysk.cashier.service.dto.LogQueryCriteriaExt;
import org.aspectj.lang.ProceedingJoinPoint;
import org.springframework.data.domain.Pageable;
import org.springframework.scheduling.annotation.Async;
@ -24,6 +25,7 @@ import org.springframework.scheduling.annotation.Async;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
* @author Zheng Jie
@ -89,4 +91,6 @@ public interface LogService {
* 删除所有INFO日志
*/
void delAllByInfo();
Map<String, Object> shopInfoLog(LogQueryCriteriaExt criteria, Pageable pageable);
}

View File

@ -37,6 +37,9 @@ public class LogQueryCriteria {
@Query
private String logType;
@Query
private Integer shopId;
@Query(type = Query.Type.BETWEEN)
private List<Timestamp> createTime;
}

View File

@ -0,0 +1,19 @@
package cn.ysk.cashier.service.dto;
import cn.ysk.cashier.annotation.Query;
import lombok.Data;
/**
* 日志查询类扩展
* @author Zheng Jie
* @date 2019-6-4 09:23:07
*/
@Data
public class LogQueryCriteriaExt {
@Query
private String logType = "INFO";
@Query
private Integer shopId;
}

View File

@ -20,9 +20,11 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import cn.ysk.cashier.domain.Log;
import cn.ysk.cashier.domain.LogVO;
import cn.ysk.cashier.repository.LogRepository;
import cn.ysk.cashier.service.LogService;
import cn.ysk.cashier.service.dto.LogQueryCriteria;
import cn.ysk.cashier.service.dto.LogQueryCriteriaExt;
import cn.ysk.cashier.service.mapstruct.LogErrorMapper;
import cn.ysk.cashier.service.mapstruct.LogSmallMapper;
import cn.ysk.cashier.utils.*;
@ -41,6 +43,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
import java.nio.charset.StandardCharsets;
import java.util.*;
/**
@ -174,4 +177,23 @@ public class LogServiceImpl implements LogService {
public void delAllByInfo() {
logRepository.deleteByLogType("INFO");
}
@Override
public Map<String, Object> shopInfoLog(LogQueryCriteriaExt criteria, Pageable pageable) {
Page<Log> page = logRepository.findAll(((root, criteriaQuery, cb) -> QueryHelp.getPredicate(root, criteria, cb)), pageable);
List<LogVO> logVOList = new ArrayList<>();
for (Log log :page.getContent()) {
LogVO logVO = new LogVO();
logVO.setDescription(log.getDescription());
logVO.setCreateTime(log.getCreateTime());
logVO.setUsername(log.getUsername());
logVO.setRequestIp(log.getRequestIp());
logVOList.add(logVO);
}
Map<String,Object> map = new LinkedHashMap<>(2);
map.put("content",logVOList);
map.put("totalElements",page.getTotalElements());
return map;
}
}

View File

@ -0,0 +1,76 @@
/*
* 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 cn.ysk.cashier.controller.shop;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.shop.TbMerchantCoupon;
import cn.ysk.cashier.service.shop.TbMerchantCouponService;
import cn.ysk.cashier.dto.shop.TbMerchantCouponQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
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 2024-03-20
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "/shop/coupon管理")
@RequestMapping("/api/tbMerchantCoupon")
public class TbMerchantCouponController {
private final TbMerchantCouponService tbMerchantCouponService;
@Log("导出数据")
@ApiOperation("导出数据")
public void exportTbMerchantCoupon(HttpServletResponse response, TbMerchantCouponQueryCriteria criteria) throws IOException {
tbMerchantCouponService.download(tbMerchantCouponService.queryAll(criteria), response);
}
@GetMapping
@Log("查询/shop/coupon")
public ResponseEntity<Object> queryTbMerchantCoupon(TbMerchantCouponQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbMerchantCouponService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping
@Log("新增/shop/coupon")
public ResponseEntity<Object> createTbMerchantCoupon(@Validated @RequestBody TbMerchantCoupon resources){
return new ResponseEntity<>(tbMerchantCouponService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改/shop/coupon")
public ResponseEntity<Object> updateTbMerchantCoupon(@Validated @RequestBody TbMerchantCoupon resources){
tbMerchantCouponService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除/shop/coupon")
public ResponseEntity<Object> deleteTbMerchantCoupon(@RequestBody Integer[] ids) {
tbMerchantCouponService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@ -0,0 +1,125 @@
/*
* 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 cn.ysk.cashier.dto.shop;
import lombok.Data;
import java.math.BigDecimal;
import java.io.Serializable;
/**
* @website https://eladmin.vip
* @description /
* @author lyf
* @date 2024-03-20
**/
@Data
public class TbMerchantCouponDto implements Serializable {
/** 自增 */
private Integer id;
/** 状态0-关闭 1 正常 */
private Integer status;
/** 优惠券名称 */
private String title;
private String templateId;
private String shopId;
private String shopSnap;
/** 开始时间 */
private Long fromTime;
/** 到期时间 */
private Long toTime;
/** 限领数量 */
private Integer limitNumber;
/** 发放数量 */
private Integer number;
/** 剩余数量 */
private Integer leftNumber;
/** 优惠金额 */
private BigDecimal amount;
/** 订单满赠金额 */
private BigDecimal limitAmount;
/** 是否显示0-不显示 1显示 */
private Integer isShow;
/** 图标 */
private String pic;
/** 0-满减 1-折扣 */
private Integer type;
/** 折扣 ,一位小数 */
private Float ratio;
/** 最大折扣金额 */
private BigDecimal maxRatioAmount;
/** 优惠券途径,首充|分销 */
private String track;
/** 品类product 商品券 ---cateogry 品类券common -通 用券 */
private String classType;
/** 有效期类型0-toTime有效 1-effectDays有效 */
private Integer effectType;
/** 领取之日有效天数 */
private Integer effectDays;
/** 关联商品Id */
private String relationIds;
private String relationList;
/** 发放人 */
private String editor;
/** 说明 */
private String note;
private Long createdAt;
private Long updatedAt;
/** 支持堂食 */
private Integer furnishMeal;
/** 支持配送 */
private Integer furnishExpress;
/** 支持自提 */
private Integer furnishDraw;
/** 支持虚拟 */
private Integer furnishVir;
private Integer disableDistribute;
/** 商户Id */
private String merchantId;
}

View File

@ -0,0 +1,37 @@
/*
* 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 cn.ysk.cashier.dto.shop;
import lombok.Data;
import java.util.List;
import cn.ysk.cashier.annotation.Query;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-03-20
**/
@Data
public class TbMerchantCouponQueryCriteria{
/** 精确 */
@Query
private String title;
/** 精确 */
@Query
private String classType;
}

View File

@ -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 cn.ysk.cashier.mapper.shop;
import cn.ysk.cashier.base.BaseMapper;
import cn.ysk.cashier.pojo.shop.TbMerchantCoupon;
import cn.ysk.cashier.dto.shop.TbMerchantCouponDto;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-03-20
**/
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface TbMerchantCouponMapper extends BaseMapper<TbMerchantCouponDto, TbMerchantCoupon> {
}

View File

@ -0,0 +1,185 @@
/*
* 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 cn.ysk.cashier.pojo.shop;
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 2024-03-20
**/
@Entity
@Data
@Table(name="tb_merchant_coupon")
public class TbMerchantCoupon implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "`id`")
@ApiModelProperty(value = "自增")
private Integer id;
@Column(name = "`status`")
@ApiModelProperty(value = "状态0-关闭 1 正常")
private Integer status;
@Column(name = "`title`")
@ApiModelProperty(value = " 优惠券名称")
private String title;
@Column(name = "`template_id`",nullable = false)
@NotBlank
@ApiModelProperty(value = "templateId")
private String templateId;
@Column(name = "`shop_id`")
@ApiModelProperty(value = "shopId")
private String shopId;
@Column(name = "`shop_snap`")
@ApiModelProperty(value = "shopSnap")
private String shopSnap;
@Column(name = "`from_time`",nullable = false)
@NotNull
@ApiModelProperty(value = "开始时间")
private Long fromTime;
@Column(name = "`to_time`",nullable = false)
@NotNull
@ApiModelProperty(value = "到期时间")
private Long toTime;
@Column(name = "`limit_number`")
@ApiModelProperty(value = "限领数量")
private Integer limitNumber;
@Column(name = "`number`")
@ApiModelProperty(value = "发放数量")
private Integer number;
@Column(name = "`left_number`",nullable = false)
@NotNull
@ApiModelProperty(value = "剩余数量")
private Integer leftNumber;
@Column(name = "`amount`")
@ApiModelProperty(value = "优惠金额")
private BigDecimal amount;
@Column(name = "`limit_amount`")
@ApiModelProperty(value = "订单满赠金额")
private BigDecimal limitAmount;
@Column(name = "`is_show`")
@ApiModelProperty(value = "是否显示0-不显示 1显示")
private Integer isShow;
@Column(name = "`pic`")
@ApiModelProperty(value = "图标")
private String pic;
@Column(name = "`type`")
@ApiModelProperty(value = "0-满减 1-折扣")
private Integer type;
@Column(name = "`ratio`")
@ApiModelProperty(value = "折扣 ,一位小数")
private Float ratio;
@Column(name = "`max_ratio_amount`")
@ApiModelProperty(value = "最大折扣金额")
private BigDecimal maxRatioAmount;
@Column(name = "`track`")
@ApiModelProperty(value = "优惠券途径,首充|分销")
private String track;
@Column(name = "`class_type`")
@ApiModelProperty(value = "品类product 商品券 ---cateogry 品类券common -通 用券")
private String classType;
@Column(name = "`effect_type`")
@ApiModelProperty(value = "有效期类型0-toTime有效 1-effectDays有效")
private Integer effectType;
@Column(name = "`effect_days`")
@ApiModelProperty(value = "领取之日有效天数")
private Integer effectDays;
@Column(name = "`relation_ids`")
@ApiModelProperty(value = "关联商品Id")
private String relationIds;
@Column(name = "`relation_list`")
@ApiModelProperty(value = "relationList")
private String relationList;
@Column(name = "`editor`")
@ApiModelProperty(value = "发放人")
private String editor;
@Column(name = "`note`")
@ApiModelProperty(value = "说明")
private String note;
@Column(name = "`created_at`",nullable = false)
@NotNull
@ApiModelProperty(value = "createdAt")
private Long createdAt;
@Column(name = "`updated_at`",nullable = false)
@NotNull
@ApiModelProperty(value = "updatedAt")
private Long updatedAt;
@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 = "`disable_distribute`")
@ApiModelProperty(value = "disableDistribute")
private Integer disableDistribute;
@Column(name = "`merchant_id`")
@ApiModelProperty(value = "商户Id")
private String merchantId;
public void copy(TbMerchantCoupon source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}

View File

@ -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 cn.ysk.cashier.repository.shop;
import cn.ysk.cashier.pojo.shop.TbMerchantCoupon;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-03-20
**/
public interface TbMerchantCouponRepository extends JpaRepository<TbMerchantCoupon, Integer>, JpaSpecificationExecutor<TbMerchantCoupon> {
}

View File

@ -0,0 +1,136 @@
/*
* 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 cn.ysk.cashier.service.impl.shopimpl;
import cn.ysk.cashier.pojo.shop.TbMerchantCoupon;
import cn.ysk.cashier.utils.ValidationUtil;
import cn.ysk.cashier.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.repository.shop.TbMerchantCouponRepository;
import cn.ysk.cashier.service.shop.TbMerchantCouponService;
import cn.ysk.cashier.dto.shop.TbMerchantCouponDto;
import cn.ysk.cashier.dto.shop.TbMerchantCouponQueryCriteria;
import cn.ysk.cashier.mapper.shop.TbMerchantCouponMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import cn.ysk.cashier.utils.PageUtil;
import cn.ysk.cashier.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 2024-03-20
**/
@Service
@RequiredArgsConstructor
public class TbMerchantCouponServiceImpl implements TbMerchantCouponService {
private final TbMerchantCouponRepository tbMerchantCouponRepository;
private final TbMerchantCouponMapper tbMerchantCouponMapper;
@Override
public Map<String,Object> queryAll(TbMerchantCouponQueryCriteria criteria, Pageable pageable){
Page<TbMerchantCoupon> page = tbMerchantCouponRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(tbMerchantCouponMapper::toDto));
}
@Override
public List<TbMerchantCouponDto> queryAll(TbMerchantCouponQueryCriteria criteria){
return tbMerchantCouponMapper.toDto(tbMerchantCouponRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
@Transactional
public TbMerchantCouponDto findById(Integer id) {
TbMerchantCoupon tbMerchantCoupon = tbMerchantCouponRepository.findById(id).orElseGet(TbMerchantCoupon::new);
ValidationUtil.isNull(tbMerchantCoupon.getId(),"TbMerchantCoupon","id",id);
return tbMerchantCouponMapper.toDto(tbMerchantCoupon);
}
@Override
@Transactional(rollbackFor = Exception.class)
public TbMerchantCouponDto create(TbMerchantCoupon resources) {
return tbMerchantCouponMapper.toDto(tbMerchantCouponRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TbMerchantCoupon resources) {
TbMerchantCoupon tbMerchantCoupon = tbMerchantCouponRepository.findById(resources.getId()).orElseGet(TbMerchantCoupon::new);
ValidationUtil.isNull( tbMerchantCoupon.getId(),"TbMerchantCoupon","id",resources.getId());
tbMerchantCoupon.copy(resources);
tbMerchantCouponRepository.save(tbMerchantCoupon);
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer id : ids) {
tbMerchantCouponRepository.deleteById(id);
}
}
@Override
public void download(List<TbMerchantCouponDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbMerchantCouponDto tbMerchantCoupon : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("状态0-关闭 1 正常", tbMerchantCoupon.getStatus());
map.put(" 优惠券名称", tbMerchantCoupon.getTitle());
map.put(" templateId", tbMerchantCoupon.getTemplateId());
map.put(" shopId", tbMerchantCoupon.getShopId());
map.put(" shopSnap", tbMerchantCoupon.getShopSnap());
map.put("开始时间", tbMerchantCoupon.getFromTime());
map.put("到期时间", tbMerchantCoupon.getToTime());
map.put("限领数量", tbMerchantCoupon.getLimitNumber());
map.put("发放数量", tbMerchantCoupon.getNumber());
map.put("剩余数量", tbMerchantCoupon.getLeftNumber());
map.put("优惠金额", tbMerchantCoupon.getAmount());
map.put("订单满赠金额", tbMerchantCoupon.getLimitAmount());
map.put("是否显示0-不显示 1显示", tbMerchantCoupon.getIsShow());
map.put("图标", tbMerchantCoupon.getPic());
map.put("0-满减 1-折扣", tbMerchantCoupon.getType());
map.put("折扣 ,一位小数", tbMerchantCoupon.getRatio());
map.put("最大折扣金额", tbMerchantCoupon.getMaxRatioAmount());
map.put("优惠券途径,首充|分销", tbMerchantCoupon.getTrack());
map.put("品类product 商品券 ---cateogry 品类券common -通 用券", tbMerchantCoupon.getClassType());
map.put("有效期类型0-toTime有效 1-effectDays有效", tbMerchantCoupon.getEffectType());
map.put("领取之日有效天数", tbMerchantCoupon.getEffectDays());
map.put("关联商品Id", tbMerchantCoupon.getRelationIds());
map.put(" relationList", tbMerchantCoupon.getRelationList());
map.put("发放人", tbMerchantCoupon.getEditor());
map.put("说明", tbMerchantCoupon.getNote());
map.put(" createdAt", tbMerchantCoupon.getCreatedAt());
map.put(" updatedAt", tbMerchantCoupon.getUpdatedAt());
map.put("支持堂食", tbMerchantCoupon.getFurnishMeal());
map.put("支持配送", tbMerchantCoupon.getFurnishExpress());
map.put("支持自提", tbMerchantCoupon.getFurnishDraw());
map.put("支持虚拟", tbMerchantCoupon.getFurnishVir());
map.put(" disableDistribute", tbMerchantCoupon.getDisableDistribute());
map.put("商户Id", tbMerchantCoupon.getMerchantId());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@ -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 cn.ysk.cashier.service.shop;
import cn.ysk.cashier.pojo.shop.TbMerchantCoupon;
import cn.ysk.cashier.dto.shop.TbMerchantCouponDto;
import cn.ysk.cashier.dto.shop.TbMerchantCouponQueryCriteria;
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 2024-03-20
**/
public interface TbMerchantCouponService {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(TbMerchantCouponQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<TbMerchantCouponDto>
*/
List<TbMerchantCouponDto> queryAll(TbMerchantCouponQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return TbMerchantCouponDto
*/
TbMerchantCouponDto findById(Integer id);
/**
* 创建
* @param resources /
* @return TbMerchantCouponDto
*/
TbMerchantCouponDto create(TbMerchantCoupon resources);
/**
* 编辑
* @param resources /
*/
void update(TbMerchantCoupon resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Integer[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<TbMerchantCouponDto> all, HttpServletResponse response) throws IOException;
}