Commit 3359a3f6 by 吕明尚

优惠券领取记录表增加门店类型字段

parent dfb678c4
package share.web.controller.system;
import java.util.Arrays;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -16,6 +19,8 @@ import share.common.annotation.Log;
import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.enums.BusinessType;
import share.common.enums.RoomType;
import share.common.enums.StoreType;
import share.system.domain.SConsumerCoupon;
import share.system.service.ISConsumerCouponService;
import share.common.utils.poi.ExcelUtil;
......@@ -77,6 +82,12 @@ public class SConsumerCouponController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody SConsumerCoupon sConsumerCoupon)
{
if (StringUtils.isNotBlank(sConsumerCoupon.getRoomType())){
sConsumerCoupon.setRoomType(String.valueOf(RoomType.getCodeList()));
}
if (StringUtils.isNotBlank(sConsumerCoupon.getStoreType())){
sConsumerCoupon.setStoreType(String.valueOf(StoreType.getCodeList()));
}
return toAjax(sConsumerCouponService.insertSConsumerCoupon(sConsumerCoupon));
}
......
package share.common.enums;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public enum RoomType {
//1:标间,2:豪华间,3:总统套房,4:商务套房,5:行政套房,6:其他
STANDARD("1", "标准间"),
HIGH("2", "豪华间"),
TOTAL("3", "总统套房"),
BUSINESS("4", "商务套房"),
ADMINISTRATIVE("5", "行政套房"),
OTHER("6", "其他"),
;
private String code;
private String name;
//所有枚举code
RoomType(String code, String name) {
this.code = code;
this.name = name;
}
public static List<String> getCodeList() {
return Arrays.stream(RoomType.values()).map(RoomType::getCode).collect(Collectors.toList());
}
public String getCode() {
return code;
}
public String getName() {
return name;
}
}
package share.common.enums;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public enum StoreType {
//1:标准店,2:外卖店,3:酒店,4:其他
STANDARD("1", "标准店"),
OUT_DELIVERY("2", "外卖店"),
HOTEL("3", "酒店"),
OTHER("4", "其他")
;
private String code;
private String name;
StoreType(String code, String name) {
this.code = code;
this.name = name;
}
public static List<String> getCodeList() {
return Arrays.stream(StoreType.values()).map(StoreType::getCode).collect(Collectors.toList());
}
public String getCode() {
return code;
}
public String getName() {
return name;
}
}
package share.web.controller.system;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import share.common.annotation.Log;
import share.system.service.MTService;
@RestController
@RequestMapping("/front/certificate")
@Api(tags = "首页-验券")
public class MTController {
@Autowired
private MTService mtService;
@GetMapping("/verificationVouchers")
@Log(title = "执行验券")
public String verificationVouchers(String code, int num){
return mtService.verificationVouchers(code, num);
}
@GetMapping("/revoke")
@Log(title = "撤销验券")
public String revoke(String ERPId ,String ERPName ,String couponCode){
return mtService.revoke(ERPId, ERPName, couponCode);
}
@GetMapping("/preparation")
@Log(title = "验券准备")
public String preparation(String code){
return mtService.preparation(code);
}
@GetMapping("/consume")
@Log(title = "已验券码查询")
public String verified(String code){
return mtService.verified(code);
}
}
package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo;
import share.system.domain.SConsumerCoupon;
import share.system.service.ISConsumerCouponService;
import java.util.List;
/**
* 优惠券领取记录Controller
*
* @author wuwenlong
* @date 2023-10-12
*/
@RestController
@RequestMapping("/front/consumerCoupon")
public class SConsumerCouponController extends BaseController
{
@Autowired
private ISConsumerCouponService sConsumerCouponService;
/**
* 查询优惠券领取记录列表
*/
@PreAuthorize("@ss.hasPermi('system:coupon:list')")
@GetMapping("/list")
public TableDataInfo list(SConsumerCoupon sConsumerCoupon)
{
startPage();
List<SConsumerCoupon> list = sConsumerCouponService.selectSConsumerCouponList(sConsumerCoupon);
return getDataTable(list);
}
/**
* 获取优惠券领取记录详细信息
*/
@PreAuthorize("@ss.hasPermi('system:coupon:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(sConsumerCouponService.selectSConsumerCouponById(id));
}
}
......@@ -44,6 +44,16 @@ public class SConsumerCoupon extends BaseEntity
@Excel(name = "优惠券类型(1:折扣券,2,满减券,3:时长券)")
private String couponType;
//门店类型
@Excel(name = "门店类型(1:标准店,2:外卖店,3:酒店,4:其他)")
private String storeType;
//房间类型
@Excel(name = "房间类型(1:标间,2:豪华间,3:总统套房,4:商务套房,5:行政套房,6:其他)")
private String roomType;
/** 折扣最大时长 */
@Excel(name = "折扣最大时长")
private String maxDuration;
......
......@@ -7,5 +7,5 @@ public interface MTService {
String preparation (String code);
String Verified (String code);
String verified (String code);
}
......@@ -96,7 +96,7 @@ public class MTServiceImpl implements MTService {
//已验券码查询
@Override
public String Verified(String code) {
public String verified(String code) {
MeituanClient meituanClient = DefaultMeituanClient.builder(developerId, signKey).build();
QueryCouponByIdRequest queryCouponByIdRequest = new QueryCouponByIdRequest();
queryCouponByIdRequest.setCouponCode(code);
......
......@@ -16,6 +16,8 @@
<result property="minPrice" column="min_price" />
<result property="subPrice" column="sub_price" />
<result property="sourceType" column="source_type" />
<result property="roomType" column="room_type" />
<result property="storeType" column="store_type" />
<result property="platformType" column="platform_type" />
<result property="startDate" column="start_date" />
<result property="endDate" column="end_date" />
......@@ -32,7 +34,7 @@
</resultMap>
<sql id="selectSConsumerCouponVo">
select id, consumer_id, coupon_id, coupon_code, name, coupon_type, max_duration, duration, min_price, sub_price, source_type, platform_type, start_date, end_date, use_date, use_status, is_delete, create_by, create_time, update_by, update_time, delete_by, delete_time, remark from s_consumer_coupon
select id, consumer_id, coupon_id, coupon_code, name, coupon_type, max_duration, duration, min_price, sub_price, source_type, platform_type, start_date, end_date, use_date, use_status, is_delete, create_by, create_time, update_by, update_time, delete_by, delete_time, remark,room_type,store_type from s_consumer_coupon
</sql>
<select id="selectSConsumerCouponList" parameterType="SConsumerCoupon" resultMap="SConsumerCouponResult">
......@@ -90,6 +92,8 @@
<if test="deleteBy != null">delete_by,</if>
<if test="deleteTime != null">delete_time,</if>
<if test="remark != null">remark,</if>
<if test="roomType != null">room_type,</if>
<if test="storeType != null">store_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="consumerId != null">#{consumerId},</if>
......@@ -115,6 +119,8 @@
<if test="deleteBy != null">#{deleteBy},</if>
<if test="deleteTime != null">#{deleteTime},</if>
<if test="remark != null">#{remark},</if>
<if test="roomType != null">#{roomType},</if>
<if test="storeType != null">#{storeType},</if>
</trim>
</insert>
......@@ -144,6 +150,8 @@
<if test="deleteBy != null">delete_by = #{deleteBy},</if>
<if test="deleteTime != null">delete_time = #{deleteTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="roomType != null">room_type = #{roomType},</if>
<if test="storeType != null">store_type = #{storeType},</if>
</trim>
where id = #{id}
</update>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment