This commit is contained in:
PQZ 2024-09-02 17:40:24 +08:00
parent 6db2d60644
commit a313676211
15 changed files with 521 additions and 0 deletions

View File

@ -0,0 +1,84 @@
package com.fuint.business.marketingActivity.activePrice.controller;
import com.fuint.business.marketingActivity.activePrice.service.ActiveSubPriceService;
import com.fuint.business.marketingActivity.activePrice.vo.ActiveSubPriceSaveVO;
import com.fuint.framework.exception.BusinessCheckException;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* 立减营销;(active_sub_price)表控制层
* @author : pqz
* @date : 2024-9-2
*/
@RestController
@RequestMapping("business/activeSubPrice")
public class ActiveSubPriceController extends BaseController {
@Resource
private ActiveSubPriceService activeSubPriceService;
/**
* 根据id查询详细内容
* @author PQZ
* @date 17:19 2024/9/2
* @param id id
* @return com.fuint.framework.web.ResponseObject
**/
@GetMapping("{id}")
public ResponseObject selectOne(@PathVariable Integer id) {
return getSuccessResult(activeSubPriceService.getActSubPriceById(id));
}
/**
* 新增立减活动
* @author PQZ
* @date 17:19 2024/9/2
* @param saveVO ActiveSubPriceSaveVO实体
* @return com.fuint.framework.web.ResponseObject
**/
@PostMapping("/add")
public ResponseObject add(@RequestBody ActiveSubPriceSaveVO saveVO) {
try {
activeSubPriceService.saveActiveSubPrice(true, saveVO);
} catch (BusinessCheckException businessCheckException) {
return getFailureResult(businessCheckException.getMessage());
}
return getSuccessResult("保存成功", null);
}
/**
* 编辑立减活动
* @author PQZ
* @date 17:18 2024/9/2
* @param saveVO ActiveSubPriceSaveVO实体
* @return com.fuint.framework.web.ResponseObject
**/
@PostMapping("/update")
public ResponseObject update(@RequestBody ActiveSubPriceSaveVO saveVO) {
try {
activeSubPriceService.saveActiveSubPrice(true, saveVO);
} catch (BusinessCheckException businessCheckException) {
return getFailureResult(businessCheckException.getMessage());
}
return getSuccessResult("保存成功", null);
}
/**
* 根据id删除立减优惠
* @author PQZ
* @date 17:13 2024/9/2
* @param id 立减优惠id
* @return com.fuint.framework.web.ResponseObject
**/
@DeleteMapping("del")
public ResponseObject del(@RequestParam("id") Integer id) {
activeSubPriceService.removeById(id);
return getSuccessResult("删除成功", null);
}
}

View File

@ -0,0 +1,70 @@
package com.fuint.business.marketingActivity.activePrice.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 立减营销活动规则;
* @author : http://www.chiner.pro
* @date : 2024-9-2
*/
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("active_sub_price")
public class ActiveSubPrice extends Model<ActiveSubPrice> {
/** 主键id */
@TableId(type = IdType.AUTO)
private Integer id ;
/** 所属连锁店id */
private Integer chainStorId ;
/** 所属店铺id */
private Integer storeId ;
/** 活动名称 */
private String activeName ;
/** 适用时间类型1-每周|2-每月|3-时间段) */
private String timeType ;
/** 适用时间段(1、2、3、4..31代表周一、周二、周三或者1号、2号、3号)数字之间英文逗号隔开 */
private String timeSlots ;
/** 适用开始时间 */
private Date timeApplyStart ;
/** 适用结束时间 */
private Date timeApplyEnd ;
/** 可使用支付方式 0微信支付 1支付宝 2云闪付 3会员卡 4现金 5POS刷卡 */
private String paymentType ;
/** 生效起始时间 */
private Date activeStartTime ;
/** 生效截止时间 */
private Date activeEndTime ;
/** 优惠类型1立减优惠|2活动优惠 */
private String offerType ;
/** 活动类型1固定满减|2随机满减|3每满 */
private String activeType ;
/** 适用油品油号 */
private String applyOil ;
/** 活动方式1按订单金额|2按加油升数 */
private String activeManner ;
/** 适用会员等级id */
private String levelId ;
/** 会员标签ids多个以英文逗号隔开 */
private String babelIds ;
/** 每人每日参与限制次数 */
private Integer dayLimitNum ;
/** 每人每月参与限制次数 */
private Integer monthLimitNum ;
/** 每人累计参与限制次数 */
private Integer limitNum ;
/** 创建人 */
private String createBy ;
/** 创建时间 */
private Date createTime ;
/** 更新人 */
private String updateBy ;
/** 更新时间 */
private Date updateTime ;
}

View File

@ -0,0 +1,47 @@
package com.fuint.business.marketingActivity.activePrice.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date;
/**
* 立减营销活动规则分时优惠/限时特价;
* @author : pqz
* @date : 2024-9-2
*/
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("active_sub_price_rule")
public class ActiveSubPriceRule extends Model<ActiveSubPriceRule> {
/** 主键id */
@TableId(type = IdType.AUTO)
private Integer id ;
/** 所属连锁店id */
private Integer chainStorId ;
/** 所属店铺id */
private Integer storeId ;
/** 价格营销活动主表id */
private Integer activeId ;
/** 活动方式1按订单金额|2按加油升数 */
private String activeManner ;
/** 订单金额加油升数满xx */
private BigDecimal full ;
/** 订单金额加油升数满xx优惠xx */
private BigDecimal sub ;
/** 创建人 */
private String createBy ;
/** 创建时间 */
private Date createTime ;
/** 更新人 */
private String updateBy ;
/** 更新时间 */
private Date updateTime ;
}

View File

@ -0,0 +1,16 @@
package com.fuint.business.marketingActivity.activePrice.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fuint.business.marketingActivity.activePrice.entity.ActivePriceOil;
import com.fuint.business.marketingActivity.activePrice.entity.ActiveSubPrice;
import org.apache.ibatis.annotations.Mapper;
/**
* 立减营销活动规则
* @author : pqz
* @date : 2024-9-2
*/
@Mapper
public interface ActiveSubPriceMapper extends BaseMapper<ActiveSubPrice> {
}

View File

@ -0,0 +1,17 @@
package com.fuint.business.marketingActivity.activePrice.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fuint.business.marketingActivity.activePrice.entity.ActivePriceOil;
import com.fuint.business.marketingActivity.activePrice.entity.ActiveSubPriceRule;
import org.apache.ibatis.annotations.Mapper;
/**
* 立减营销活动规则
*
* @author : pqz
* @date : 2024-9-2
*/
@Mapper
public interface ActiveSubPriceRuleMapper extends BaseMapper<ActiveSubPriceRule> {
}

View File

@ -0,0 +1,5 @@
<?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.fuint.business.marketingActivity.activePrice.mapper.ActiveSubPriceMapper">
</mapper>

View File

@ -0,0 +1,5 @@
<?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.fuint.business.marketingActivity.activePrice.mapper.ActiveSubPriceRuleMapper">
</mapper>

View File

@ -0,0 +1,41 @@
package com.fuint.business.marketingActivity.activePrice.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.marketingActivity.activePrice.entity.ActiveSubPriceRule;
import java.util.List;
/**
* 立减营销;
*
* @author : pqz
* @date : 2024-9-2
*/
public interface ActiveSubPriceRuleService extends IService<ActiveSubPriceRule> {
/**
* 根据活动id删除规则
* @author PQZ
* @date 17:24 2024/9/2
* @param actId Integer
**/
void removeByActId(Integer actId);
/**
* 保存立减活动规则
* @author PQZ
* @date 17:26 2024/9/2
* @param actId 活动id
* @param list List<ActiveSubPriceRule>
**/
void saveActiveSubPriceRule(Integer actId,List<ActiveSubPriceRule> list);
/**
* 根据活动id查询活动规则
* @author PQZ
* @date 17:38 2024/9/2
* @param actId 活动id
* @return java.util.List<com.fuint.business.marketingActivity.activePrice.entity.ActiveSubPriceRule>
**/
List<ActiveSubPriceRule> listByActId(Integer actId);
}

View File

@ -0,0 +1,36 @@
package com.fuint.business.marketingActivity.activePrice.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.marketingActivity.activePrice.entity.ActiveSubPrice;
import com.fuint.business.marketingActivity.activePrice.vo.ActiveSubPriceRespVO;
import com.fuint.business.marketingActivity.activePrice.vo.ActiveSubPriceSaveVO;
import com.fuint.framework.exception.BusinessCheckException;
/**
* 立减营销;
*
* @author : pqz
* @date : 2024-9-2
*/
public interface ActiveSubPriceService extends IService<ActiveSubPrice> {
/**
* 根据立减优惠活动id查询详细内容
*
* @param id 立减优惠活动id
* @return com.fuint.business.marketingActivity.activePrice.vo.ActiveSubPriceRespVO
* @author PQZ
* @date 17:15 2024/9/2
**/
ActiveSubPriceRespVO getActSubPriceById(Integer id);
/**
* 保存立减优惠活动
*
* @param isAdd 是否是新增
* @param saveVO ActiveSubPriceSaveVO
* @author PQZ
* @date 17:16 2024/9/2
**/
void saveActiveSubPrice(boolean isAdd, ActiveSubPriceSaveVO saveVO) throws BusinessCheckException;
}

View File

@ -0,0 +1,65 @@
package com.fuint.business.marketingActivity.activePrice.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.marketingActivity.activePrice.entity.ActiveSubPriceRule;
import com.fuint.business.marketingActivity.activePrice.mapper.ActiveSubPriceRuleMapper;
import com.fuint.business.marketingActivity.activePrice.service.ActiveSubPriceRuleService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 立减营销;
*
* @author : pqz
* @date : 2024-9-2
*/
@Service("activeOneCouponService")
public class ActiveSubPriceRuleServiceImpl extends ServiceImpl<ActiveSubPriceRuleMapper, ActiveSubPriceRule> implements ActiveSubPriceRuleService {
/**
* 根据活动id删除规则
*
* @param actId Integer
* @author PQZ
* @date 17:24 2024/9/2
**/
@Override
public void removeByActId(Integer actId) {
LambdaQueryWrapper<ActiveSubPriceRule> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(ActiveSubPriceRule::getActiveId,actId);
remove(lambdaQueryWrapper);
}
/**
* 保存立减活动规则
*
* @param actId 活动id
* @param list List<ActiveSubPriceRule>
* @author PQZ
* @date 17:26 2024/9/2
**/
@Override
public void saveActiveSubPriceRule(Integer actId,List<ActiveSubPriceRule> list) {
removeByActId(actId);
saveBatch(list);
}
/**
* 根据活动id查询活动规则
*
* @param actId 活动id
* @return java.util.List<com.fuint.business.marketingActivity.activePrice.entity.ActiveSubPriceRule>
* @author PQZ
* @date 17:38 2024/9/2
**/
@Override
public List<ActiveSubPriceRule> listByActId(Integer actId) {
LambdaQueryWrapper<ActiveSubPriceRule> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(ActiveSubPriceRule::getActiveId,actId);
return list(lambdaQueryWrapper);
}
}

View File

@ -0,0 +1,70 @@
package com.fuint.business.marketingActivity.activePrice.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.marketingActivity.activePrice.entity.ActiveSubPrice;
import com.fuint.business.marketingActivity.activePrice.mapper.ActiveSubPriceMapper;
import com.fuint.business.marketingActivity.activePrice.service.ActiveSubPriceRuleService;
import com.fuint.business.marketingActivity.activePrice.service.ActiveSubPriceService;
import com.fuint.business.marketingActivity.activePrice.util.ActPriceUtil;
import com.fuint.business.marketingActivity.activePrice.vo.ActiveSubPriceRespVO;
import com.fuint.business.marketingActivity.activePrice.vo.ActiveSubPriceSaveVO;
import com.fuint.quartz.util.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import static com.fuint.common.constant.ActConstants.*;
/**
* 立减营销;
*
* @author : pqz
* @date : 2024-9-2
*/
@Service("activeOneCouponService")
public class ActiveSubPriceServiceImpl extends ServiceImpl<ActiveSubPriceMapper, ActiveSubPrice> implements ActiveSubPriceService {
@Resource
private ActiveSubPriceRuleService activeSubPriceRuleService;
@Resource
private ActPriceUtil actPriceUtil;
/**
* 根据立减优惠活动id查询详细内容
*
* @param id 立减优惠活动id
* @return com.fuint.business.marketingActivity.activePrice.vo.ActiveSubPriceRespVO
* @author PQZ
* @date 17:15 2024/9/2
**/
@Override
public ActiveSubPriceRespVO getActSubPriceById(Integer id) {
ActiveSubPriceRespVO result = new ActiveSubPriceRespVO();
ActiveSubPrice activeSubPrice = getById(id);
BeanUtils.copyProperties(activeSubPrice, result);
result.setRuleList(activeSubPriceRuleService.listByActId(id));
return null;
}
/**
* 保存立减优惠活动
*
* @param isAdd 是否是新增
* @param saveVO ActiveSubPriceSaveVO
* @author PQZ
* @date 17:16 2024/9/2
**/
@Override
public void saveActiveSubPrice(boolean isAdd, ActiveSubPriceSaveVO saveVO) {
ActiveSubPrice activeSubPrice = new ActiveSubPrice();
BeanUtils.copyProperties(saveVO, activeSubPrice);
//保存主表信息
saveOrUpdate(activeSubPrice);
//保存子表信息
activeSubPriceRuleService.saveActiveSubPriceRule(activeSubPrice.getId(),saveVO.getRuleList());
//转换日志保存内容
String content = actPriceUtil.transActLogContent(isAdd ? LOG_OPERATE_ADD : LOG_OPERATE_UPDATE,
LOG_SYSTEM_MODULE_LJYH,
saveVO.getActiveName());
actPriceUtil.saveActLog(LOG_SYSTEM_NAME_SIGN, LOG_SYSTEM_MODULE_ACTIVE, content);
}
}

View File

@ -0,0 +1,22 @@
package com.fuint.business.marketingActivity.activePrice.vo;
import com.fuint.business.marketingActivity.activePrice.entity.ActiveSubPrice;
import com.fuint.business.marketingActivity.activePrice.entity.ActiveSubPriceRule;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* 立减优惠扩展类
*
* @author : pqz
* @date : 2024-9-2
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class ActiveSubPriceReqVO extends ActiveSubPrice {
/**立减优惠规则*/
List<ActiveSubPriceRule> ruleList;
}

View File

@ -0,0 +1,20 @@
package com.fuint.business.marketingActivity.activePrice.vo;
import com.fuint.business.marketingActivity.activePrice.entity.ActiveSubPrice;
import com.fuint.business.marketingActivity.activePrice.entity.ActiveSubPriceRule;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* 立减优惠扩展类
* @author : pqz
* @date : 2024-9-2
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class ActiveSubPriceRespVO extends ActiveSubPrice {
/**立减优惠规则*/
List<ActiveSubPriceRule> ruleList;
}

View File

@ -0,0 +1,21 @@
package com.fuint.business.marketingActivity.activePrice.vo;
import com.fuint.business.marketingActivity.activePrice.entity.ActiveSubPrice;
import com.fuint.business.marketingActivity.activePrice.entity.ActiveSubPriceRule;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* 立减优惠扩展类
* @author : pqz
* @date : 2024-9-2
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class ActiveSubPriceSaveVO extends ActiveSubPrice {
/**立减优惠规则*/
List<ActiveSubPriceRule> ruleList;
}

View File

@ -19,6 +19,8 @@ public class ActConstants {
public static final String LOG_OPERATE_UPDATE = "更新";
/**日志记录操作常量-删除*/
public static final String LOG_OPERATE_DEL = "删除";
/**立减优惠*/
public static final String LOG_SYSTEM_MODULE_LJYH = "立减优惠";
}