bug
This commit is contained in:
parent
446cab6fb5
commit
eba53ae473
@ -0,0 +1,83 @@
|
||||
package com.fuint.business.marketingActivity.activeApplet.controller;
|
||||
|
||||
import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet;
|
||||
import com.fuint.business.marketingActivity.activeApplet.service.ActiveAppletService;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 小程序端活动表(ActiveApplet)表控制层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-03-11 15:28:10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("business/marketingActivity/activeApplet")
|
||||
public class ActiveAppletController extends BaseController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private ActiveAppletService activeAppletService;
|
||||
|
||||
/**
|
||||
* 查询所有数据
|
||||
*
|
||||
* @param activeApplet 查询实体
|
||||
* @return 所有数据
|
||||
*/
|
||||
@GetMapping("/applet")
|
||||
public ResponseObject selectAll(ActiveApplet activeApplet) {
|
||||
return getSuccessResult(this.activeAppletService.applet(activeApplet));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@GetMapping("{id}")
|
||||
public ResponseObject selectOne(@PathVariable Serializable id) {
|
||||
return getSuccessResult(this.activeAppletService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param activeApplet 实体对象
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseObject insert(@RequestBody ActiveApplet activeApplet) {
|
||||
return getSuccessResult(this.activeAppletService.save(activeApplet));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param activeApplet 实体对象
|
||||
* @return 修改结果
|
||||
*/
|
||||
@PutMapping
|
||||
public ResponseObject update(@RequestBody ActiveApplet activeApplet) {
|
||||
return getSuccessResult(this.activeAppletService.updateById(activeApplet));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param idList 主键结合
|
||||
* @return 删除结果
|
||||
*/
|
||||
@DeleteMapping
|
||||
public ResponseObject delete(@RequestParam("idList") List<Long> idList) {
|
||||
return getSuccessResult(this.activeAppletService.removeByIds(idList));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,211 @@
|
||||
package com.fuint.business.marketingActivity.activeApplet.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 小程序端活动表(ActiveApplet)表实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-03-11 15:28:10
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class ActiveApplet extends Model<ActiveApplet> {
|
||||
//主键id
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
//所属连锁店id
|
||||
private Integer chainStoreId;
|
||||
//店铺id
|
||||
private Integer storeId;
|
||||
//是否在线 0:在线 1: 下线
|
||||
private String isonline;
|
||||
//活动状态 1:启用 2:禁用
|
||||
private String activeStatus;
|
||||
//适用会员
|
||||
private String adaptUserType;
|
||||
//活动描述
|
||||
private String discountActiveDescribe;
|
||||
//成长值
|
||||
private Integer growaValue;
|
||||
//适用油品
|
||||
private String oilName;
|
||||
//积分
|
||||
private Integer points;
|
||||
//时间
|
||||
private String time;
|
||||
//类型
|
||||
private String type;
|
||||
//活动时间
|
||||
private String name;
|
||||
//活动id
|
||||
private Integer activeId;
|
||||
//创建者
|
||||
private String createBy;
|
||||
//创建时间
|
||||
private Date createTime;
|
||||
//更新者
|
||||
private String updateBy;
|
||||
//更新时间
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getChainStoreId() {
|
||||
return chainStoreId;
|
||||
}
|
||||
|
||||
public void setChainStoreId(Integer chainStoreId) {
|
||||
this.chainStoreId = chainStoreId;
|
||||
}
|
||||
|
||||
public Integer getStoreId() {
|
||||
return storeId;
|
||||
}
|
||||
|
||||
public void setStoreId(Integer storeId) {
|
||||
this.storeId = storeId;
|
||||
}
|
||||
|
||||
public String getIsonline() {
|
||||
return isonline;
|
||||
}
|
||||
|
||||
public void setIsonline(String isonline) {
|
||||
this.isonline = isonline;
|
||||
}
|
||||
|
||||
public String getActiveStatus() {
|
||||
return activeStatus;
|
||||
}
|
||||
|
||||
public void setActiveStatus(String activeStatus) {
|
||||
this.activeStatus = activeStatus;
|
||||
}
|
||||
|
||||
public String getAdaptUserType() {
|
||||
return adaptUserType;
|
||||
}
|
||||
|
||||
public void setAdaptUserType(String adaptUserType) {
|
||||
this.adaptUserType = adaptUserType;
|
||||
}
|
||||
|
||||
public String getDiscountActiveDescribe() {
|
||||
return discountActiveDescribe;
|
||||
}
|
||||
|
||||
public void setDiscountActiveDescribe(String discountActiveDescribe) {
|
||||
this.discountActiveDescribe = discountActiveDescribe;
|
||||
}
|
||||
|
||||
public Integer getGrowaValue() {
|
||||
return growaValue;
|
||||
}
|
||||
|
||||
public void setGrowaValue(Integer growaValue) {
|
||||
this.growaValue = growaValue;
|
||||
}
|
||||
|
||||
public String getOilName() {
|
||||
return oilName;
|
||||
}
|
||||
|
||||
public void setOilName(String oilName) {
|
||||
this.oilName = oilName;
|
||||
}
|
||||
|
||||
public Integer getPoints() {
|
||||
return points;
|
||||
}
|
||||
|
||||
public void setPoints(Integer points) {
|
||||
this.points = points;
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getActiveId() {
|
||||
return activeId;
|
||||
}
|
||||
|
||||
public void setActiveId(Integer activeId) {
|
||||
this.activeId = activeId;
|
||||
}
|
||||
|
||||
public String getCreateBy() {
|
||||
return createBy;
|
||||
}
|
||||
|
||||
public void setCreateBy(String createBy) {
|
||||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getUpdateBy() {
|
||||
return updateBy;
|
||||
}
|
||||
|
||||
public void setUpdateBy(String updateBy) {
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主键值
|
||||
*
|
||||
* @return 主键值
|
||||
*/
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
package com.fuint.business.marketingActivity.activeApplet.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet;
|
||||
|
||||
/**
|
||||
* 小程序端活动表(ActiveApplet)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-03-11 15:28:10
|
||||
*/
|
||||
public interface ActiveAppletMapper extends BaseMapper<ActiveApplet> {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.fuint.business.marketingActivity.activeApplet.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 小程序端活动表(ActiveApplet)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-03-11 15:28:11
|
||||
*/
|
||||
public interface ActiveAppletService extends IService<ActiveApplet> {
|
||||
|
||||
List<ActiveApplet> applet(ActiveApplet activeApplet);
|
||||
}
|
||||
|
@ -0,0 +1,25 @@
|
||||
package com.fuint.business.marketingActivity.activeApplet.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.business.marketingActivity.activeApplet.mapper.ActiveAppletMapper;
|
||||
import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet;
|
||||
import com.fuint.business.marketingActivity.activeApplet.service.ActiveAppletService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 小程序端活动表(ActiveApplet)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-03-11 15:28:11
|
||||
*/
|
||||
@Service("activeAppletService")
|
||||
public class ActiveAppletServiceImpl extends ServiceImpl<ActiveAppletMapper, ActiveApplet> implements ActiveAppletService {
|
||||
|
||||
@Override
|
||||
public List<ActiveApplet> applet(ActiveApplet activeApplet) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet;
|
||||
import com.fuint.business.marketingActivity.activeConsumption.dto.ActiveConsumptionDTO;
|
||||
import com.fuint.business.marketingActivity.activeConsumption.entity.ActiveConsumptionChild;
|
||||
import com.fuint.business.marketingActivity.activeConsumption.mapper.ActiveConsumptionMapper;
|
||||
@ -26,6 +27,7 @@ import com.fuint.business.marketingActivity.cardFavorable.mapper.CardFavorableMa
|
||||
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableService;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.vo.CardFavorableVO;
|
||||
import com.fuint.business.marketingActivity.cardValue.entity.CardValueChild;
|
||||
import com.fuint.business.member.entity.LJStaff;
|
||||
import com.fuint.business.member.service.ILJStaffService;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilName;
|
||||
@ -105,6 +107,8 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl<ActiveConsumptionM
|
||||
@Transactional
|
||||
public Boolean add(ActiveConsumptionDTO activeConsumptionDTO) {
|
||||
boolean save = false;
|
||||
ActiveApplet activeApplet = new ActiveApplet();
|
||||
activeApplet.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
|
||||
//获取当前店铺的id和连锁店id
|
||||
if (ObjectUtils.isNotEmpty(TokenUtil.getNowAccountInfo().getStoreId())) {
|
||||
activeConsumptionDTO.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
|
||||
@ -130,6 +134,42 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl<ActiveConsumptionM
|
||||
activeConsumption.setMoneyType(activeConsumptionDTO.getMoneyType());
|
||||
save = save(activeConsumption);
|
||||
}
|
||||
activeApplet.setActiveId(activeConsumption.getId());
|
||||
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd");
|
||||
String formatSt = dateFormat.format(activeConsumption.getActiveStartTime());
|
||||
String formatEd = dateFormat.format(activeConsumption.getActiveEndTime());
|
||||
activeApplet.setTime(formatSt+"-" + formatEd+"");
|
||||
|
||||
//获取会员等级
|
||||
String str = "";
|
||||
if (ObjectUtils.isNotEmpty(activeConsumptionDTO.getDieselUserLevel())){
|
||||
for (String gradeId : activeConsumptionDTO.getDieselUserLevel()) {
|
||||
if (ObjectUtils.isNotEmpty(userGradeService.selectUserGradeById(Integer.parseInt(gradeId)))){
|
||||
str += userGradeService.selectUserGradeById(Integer.parseInt(gradeId)).getName() + ",";
|
||||
}
|
||||
}
|
||||
}else {
|
||||
str = "普通群体";
|
||||
}
|
||||
activeApplet.setAdaptUserType(str);
|
||||
|
||||
String oilName = "";
|
||||
//油品名称
|
||||
String[] adaptOil = activeConsumptionDTO.getAdaptOil();
|
||||
for (String oilType : adaptOil) {
|
||||
OilName oilName1 = oilNameService.selectOilNameById(Integer.parseInt(oilType));
|
||||
oilName += oilName1.getOilType() + "-"+oilName1.getOilName() + ",";
|
||||
}
|
||||
activeApplet.setOilName(oilName);
|
||||
//赠送优惠券兑换券实物
|
||||
String card = "";
|
||||
if (CollectionUtils.isNotEmpty(activeConsumptionDTO.getActiveConsumptionChildList())) {
|
||||
for (ActiveConsumptionChild activeConsumptionChild : activeConsumptionDTO.getActiveConsumptionChildList()) {
|
||||
card += activeConsumptionChild.getGiftCardDetail() + "的券,";
|
||||
}
|
||||
}
|
||||
|
||||
//新增兑换物品
|
||||
List<ActiveConsumptionChild> list = activeConsumptionDTO.getActiveConsumptionChildList();
|
||||
if (CollectionUtils.isNotEmpty(list)){
|
||||
|
@ -2,11 +2,15 @@ package com.fuint.business.marketingActivity.activeDiscount.controller;
|
||||
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet;
|
||||
import com.fuint.business.marketingActivity.activeApplet.service.ActiveAppletService;
|
||||
import com.fuint.business.marketingActivity.activeDiscount.dto.ActiveDiscountDTO;
|
||||
import com.fuint.business.marketingActivity.activeDiscount.entity.ActiveDiscount;
|
||||
import com.fuint.business.marketingActivity.activeDiscount.service.ActiveDiscountChildService;
|
||||
import com.fuint.business.marketingActivity.activeDiscount.service.ActiveDiscountService;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@ -33,6 +37,8 @@ public class ActiveDiscountController extends BaseController {
|
||||
private ActiveDiscountService activeDiscountService;
|
||||
@Resource
|
||||
private ActiveDiscountChildService activeDiscountChildService;
|
||||
@Resource
|
||||
private ActiveAppletService activeAppletService;
|
||||
|
||||
/**
|
||||
* 分页查询所有数据
|
||||
@ -123,6 +129,11 @@ public class ActiveDiscountController extends BaseController {
|
||||
*/
|
||||
@DeleteMapping("delById/{ids}")
|
||||
public ResponseObject delete(@PathVariable Integer ids) {
|
||||
LambdaQueryWrapper<ActiveApplet> queryWrapper1 = new LambdaQueryWrapper<>();
|
||||
queryWrapper1.eq(ActiveApplet::getStoreId, TokenUtil.getNowAccountInfo().getStoreId());
|
||||
queryWrapper1.eq(ActiveApplet::getActiveId,ids);
|
||||
queryWrapper1.eq(ActiveApplet::getType,"3");
|
||||
activeAppletService.remove(queryWrapper1);
|
||||
return getSuccessResult(this.activeDiscountService.removeById(ids));
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet;
|
||||
import com.fuint.business.marketingActivity.activeApplet.service.ActiveAppletService;
|
||||
import com.fuint.business.marketingActivity.activeConsumption.entity.ActiveConsumption;
|
||||
import com.fuint.business.marketingActivity.activeConsumption.entity.ActiveConsumptionChild;
|
||||
import com.fuint.business.marketingActivity.activeConsumption.vo.ActiveConsumptionVO;
|
||||
@ -23,6 +25,7 @@ import com.fuint.business.petrolStationManagement.service.OilNameService;
|
||||
import com.fuint.business.store.service.StoreService;
|
||||
import com.fuint.business.userManager.entity.LJUserGrade;
|
||||
import com.fuint.business.userManager.service.LJUserGradeService;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.service.AccountService;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import com.fuint.repository.model.TAccount;
|
||||
@ -61,6 +64,8 @@ public class ActiveDiscountServiceImpl extends ServiceImpl<ActiveDiscountMapper,
|
||||
private ActiveDiscountMapper activeDiscountMapper;
|
||||
@Resource
|
||||
private AccountService accountService;
|
||||
@Resource
|
||||
private ActiveAppletService activeAppletService;
|
||||
/**
|
||||
* 新增数据
|
||||
* @param activeDiscountDTO
|
||||
@ -70,8 +75,11 @@ public class ActiveDiscountServiceImpl extends ServiceImpl<ActiveDiscountMapper,
|
||||
@Transactional
|
||||
public Boolean add(ActiveDiscountDTO activeDiscountDTO) {
|
||||
boolean save = false;
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
ActiveApplet activeApplet = new ActiveApplet();
|
||||
activeApplet.setStoreId(nowAccountInfo.getStoreId());
|
||||
//获取当前店铺的id和连锁店id
|
||||
if (ObjectUtils.isNotEmpty(TokenUtil.getNowAccountInfo().getStoreId())) {
|
||||
if (ObjectUtils.isNotEmpty(nowAccountInfo.getStoreId())) {
|
||||
activeDiscountDTO.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
|
||||
activeDiscountDTO.setChainStoreId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId());
|
||||
}
|
||||
@ -92,6 +100,61 @@ public class ActiveDiscountServiceImpl extends ServiceImpl<ActiveDiscountMapper,
|
||||
activeDiscount.setNaturalUserLevel(arrayToString(activeDiscountDTO.getNaturalUserLevel()));
|
||||
save = save(activeDiscount);
|
||||
}
|
||||
activeApplet.setActiveId(activeDiscount.getId());
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd");
|
||||
String formatSt = dateFormat.format(activeDiscount.getActiveStartTime());
|
||||
String formatEd = dateFormat.format(activeDiscount.getActiveEndTime());
|
||||
activeApplet.setTime(formatSt+"-" + formatEd+"");
|
||||
|
||||
//获取会员等级
|
||||
String str = "";
|
||||
if (ObjectUtils.isNotEmpty(activeDiscountDTO.getDieselUserLevel())){
|
||||
for (String gradeId : activeDiscountDTO.getDieselUserLevel()) {
|
||||
if (ObjectUtils.isNotEmpty(userGradeService.selectUserGradeById(Integer.parseInt(gradeId)))){
|
||||
str += userGradeService.selectUserGradeById(Integer.parseInt(gradeId)).getName() + ",";
|
||||
}
|
||||
}
|
||||
}else {
|
||||
str = "普通群体";
|
||||
}
|
||||
activeApplet.setAdaptUserType(str);
|
||||
|
||||
String oilName = "";
|
||||
//油品名称
|
||||
String[] adaptOil = activeDiscountDTO.getAdaptOil();
|
||||
for (String oilType : adaptOil) {
|
||||
OilName oilName1 = oilNameService.selectOilNameById(Integer.parseInt(oilType));
|
||||
oilName += oilName1.getOilType() + "-"+oilName1.getOilName() + ",";
|
||||
}
|
||||
activeApplet.setOilName(oilName);
|
||||
|
||||
String describ = "";
|
||||
//活动规则满足金额
|
||||
double amount = 0.0;
|
||||
//折扣
|
||||
double discount = 0.0;
|
||||
if (CollectionUtils.isNotEmpty(activeDiscountDTO.getActiveDiscountChildList())) {
|
||||
for (ActiveDiscountChild activeDiscountChild : activeDiscountDTO.getActiveDiscountChildList()) {
|
||||
amount = activeDiscountChild.getAmount();
|
||||
discount = activeDiscountChild.getDiscount();
|
||||
describ += "满" +
|
||||
amount + "元,打" + discount + "折;";
|
||||
}
|
||||
}
|
||||
if (activeDiscountDTO.getMemberDayType().equals("0")){
|
||||
activeApplet.setDiscountActiveDescribe("参加此项折扣营销活动,享受优惠为:" +
|
||||
describ + "快来参与吧。");
|
||||
}else if (activeDiscountDTO.getMemberDayType().equals("2")){
|
||||
activeApplet.setDiscountActiveDescribe("参加此项折扣营销活动,享受优惠为:" +
|
||||
describ + "本活动的会员日为每周的"+activeDiscountDTO.getWeekDay()+"快来参与吧。");
|
||||
}else {
|
||||
activeApplet.setDiscountActiveDescribe("参加此项折扣营销活动,享受优惠为:" +
|
||||
describ + "本活动的会员日为每月的"+activeDiscountDTO.getMonthDay()+"号,快来参与吧。");
|
||||
}
|
||||
|
||||
activeApplet.setName("折扣营销活动");
|
||||
activeApplet.setType("3");
|
||||
activeAppletService.save(activeApplet);
|
||||
//新增兑换物品
|
||||
List<ActiveDiscountChild> list = activeDiscountDTO.getActiveDiscountChildList();
|
||||
if (CollectionUtils.isNotEmpty(list)){
|
||||
@ -104,6 +167,110 @@ public class ActiveDiscountServiceImpl extends ServiceImpl<ActiveDiscountMapper,
|
||||
return save;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
* @param activeDiscountDTO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateOneById(ActiveDiscountDTO activeDiscountDTO) {
|
||||
boolean update = false;
|
||||
LambdaQueryWrapper<ActiveApplet> queryWrapper1 = new LambdaQueryWrapper<>();
|
||||
queryWrapper1.eq(ActiveApplet::getStoreId,TokenUtil.getNowAccountInfo().getStoreId());
|
||||
queryWrapper1.eq(ActiveApplet::getType,"3");
|
||||
queryWrapper1.eq(ActiveApplet::getActiveId,activeDiscountDTO.getId());
|
||||
ActiveApplet activeApplet = activeAppletService.getOne(queryWrapper1);
|
||||
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd");
|
||||
String formatSt = dateFormat.format(activeDiscountDTO.getActiveStartTime());
|
||||
String formatEd = dateFormat.format(activeDiscountDTO.getActiveEndTime());
|
||||
activeApplet.setTime(formatSt+"-" + formatEd+"");
|
||||
|
||||
//获取会员等级
|
||||
String str = "";
|
||||
if (ObjectUtils.isNotEmpty(activeDiscountDTO.getDieselUserLevel())){
|
||||
for (String gradeId : activeDiscountDTO.getDieselUserLevel()) {
|
||||
if (ObjectUtils.isNotEmpty(userGradeService.selectUserGradeById(Integer.parseInt(gradeId)))){
|
||||
str += userGradeService.selectUserGradeById(Integer.parseInt(gradeId)).getName() + ",";
|
||||
}
|
||||
}
|
||||
}else {
|
||||
str = "普通群体";
|
||||
}
|
||||
activeApplet.setAdaptUserType(str);
|
||||
|
||||
String oilName = "";
|
||||
//油品名称
|
||||
String[] adaptOil = activeDiscountDTO.getAdaptOil();
|
||||
for (String oilType : adaptOil) {
|
||||
OilName oilName1 = oilNameService.selectOilNameById(Integer.parseInt(oilType));
|
||||
oilName += oilName1.getOilType() + "-"+oilName1.getOilName() + ",";
|
||||
}
|
||||
activeApplet.setOilName(oilName);
|
||||
|
||||
String describ = "";
|
||||
//活动规则满足金额
|
||||
double amount = 0.0;
|
||||
//折扣
|
||||
double discount = 0.0;
|
||||
if (CollectionUtils.isNotEmpty(activeDiscountDTO.getActiveDiscountChildList())) {
|
||||
for (ActiveDiscountChild activeDiscountChild : activeDiscountDTO.getActiveDiscountChildList()) {
|
||||
amount = activeDiscountChild.getAmount();
|
||||
discount = activeDiscountChild.getDiscount();
|
||||
describ += "满" +
|
||||
amount + "元,打" + discount + "折;";
|
||||
}
|
||||
}
|
||||
if (activeDiscountDTO.getMemberDayType().equals("0")){
|
||||
activeApplet.setDiscountActiveDescribe("参加此项折扣营销活动,享受优惠为:" +
|
||||
describ + "快来参与吧。");
|
||||
}else if (activeDiscountDTO.getMemberDayType().equals("2")){
|
||||
activeApplet.setDiscountActiveDescribe("参加此项折扣营销活动,享受优惠为:" +
|
||||
describ + "本活动的会员日为每周的"+activeDiscountDTO.getWeekDay()+"快来参与吧。");
|
||||
}else {
|
||||
activeApplet.setDiscountActiveDescribe("参加此项折扣营销活动,享受优惠为:" +
|
||||
describ + "本活动的会员日为每月的"+activeDiscountDTO.getMonthDay()+"号,快来参与吧。");
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(activeDiscountDTO.getIsonline())){
|
||||
activeApplet.setIsonline(activeDiscountDTO.getIsonline());
|
||||
}
|
||||
activeAppletService.updateById(activeApplet);
|
||||
|
||||
|
||||
//更新折扣营销
|
||||
ActiveDiscount activeDiscount = new ActiveDiscount();
|
||||
BeanUtils.copyProperties(activeDiscountDTO,activeDiscount);
|
||||
|
||||
TAccount accountInfoById = accountService.getAccountInfoById(TokenUtil.getNowAccountInfo().getId());
|
||||
if (ObjectUtil.isNotEmpty(accountInfoById)) activeDiscount.setCreateBy(accountInfoById.getRealName());
|
||||
//柴油会员等级
|
||||
activeDiscount.setDieselUserLevel(arrayToString(activeDiscountDTO.getDieselUserLevel()));
|
||||
//汽油会员等级
|
||||
activeDiscount.setGasolineUserLevel(arrayToString(activeDiscountDTO.getGasolineUserLevel()));
|
||||
//天然气会员等级
|
||||
activeDiscount.setNaturalUserLevel(arrayToString(activeDiscountDTO.getNaturalUserLevel()));
|
||||
activeDiscount.setAdaptOil(arrayToString(activeDiscountDTO.getAdaptOil()));
|
||||
|
||||
if (activeDiscountDTO.getIsonline().equals("1")){
|
||||
activeDiscount.setStatus("1");
|
||||
}
|
||||
update = updateById(activeDiscount);
|
||||
//更新子表数据
|
||||
LambdaQueryWrapper<ActiveDiscountChild> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ActiveDiscountChild::getActiveDiscountId,activeDiscountDTO.getId());
|
||||
activeDiscountChildService.remove(queryWrapper);
|
||||
//新增兑换物品
|
||||
List<ActiveDiscountChild> activeDiscountChildList = activeDiscountDTO.getActiveDiscountChildList();
|
||||
if (CollectionUtils.isNotEmpty(activeDiscountChildList)){
|
||||
activeDiscountChildList.stream().map(s ->{
|
||||
s.setActiveDiscountId(activeDiscount.getId());
|
||||
return s;
|
||||
}).collect(Collectors.toList());
|
||||
update = activeDiscountChildService.saveBatch(activeDiscountChildList);
|
||||
}
|
||||
return update;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询所有数据
|
||||
* @param page
|
||||
@ -209,47 +376,6 @@ public class ActiveDiscountServiceImpl extends ServiceImpl<ActiveDiscountMapper,
|
||||
return activeDiscountVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
* @param activeDiscountDTO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateOneById(ActiveDiscountDTO activeDiscountDTO) {
|
||||
boolean update = false;
|
||||
//更新折扣营销
|
||||
ActiveDiscount activeDiscount = new ActiveDiscount();
|
||||
BeanUtils.copyProperties(activeDiscountDTO,activeDiscount);
|
||||
|
||||
TAccount accountInfoById = accountService.getAccountInfoById(TokenUtil.getNowAccountInfo().getId());
|
||||
if (ObjectUtil.isNotEmpty(accountInfoById)) activeDiscount.setCreateBy(accountInfoById.getRealName());
|
||||
//柴油会员等级
|
||||
activeDiscount.setDieselUserLevel(arrayToString(activeDiscountDTO.getDieselUserLevel()));
|
||||
//汽油会员等级
|
||||
activeDiscount.setGasolineUserLevel(arrayToString(activeDiscountDTO.getGasolineUserLevel()));
|
||||
//天然气会员等级
|
||||
activeDiscount.setNaturalUserLevel(arrayToString(activeDiscountDTO.getNaturalUserLevel()));
|
||||
activeDiscount.setAdaptOil(arrayToString(activeDiscountDTO.getAdaptOil()));
|
||||
|
||||
if (activeDiscountDTO.getIsonline().equals("1")){
|
||||
activeDiscount.setStatus("1");
|
||||
}
|
||||
update = updateById(activeDiscount);
|
||||
//更新子表数据
|
||||
LambdaQueryWrapper<ActiveDiscountChild> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ActiveDiscountChild::getActiveDiscountId,activeDiscountDTO.getId());
|
||||
activeDiscountChildService.remove(queryWrapper);
|
||||
//新增兑换物品
|
||||
List<ActiveDiscountChild> activeDiscountChildList = activeDiscountDTO.getActiveDiscountChildList();
|
||||
if (CollectionUtils.isNotEmpty(activeDiscountChildList)){
|
||||
activeDiscountChildList.stream().map(s ->{
|
||||
s.setActiveDiscountId(activeDiscount.getId());
|
||||
return s;
|
||||
}).collect(Collectors.toList());
|
||||
update = activeDiscountChildService.saveBatch(activeDiscountChildList);
|
||||
}
|
||||
return update;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateIsOnline(Integer id, String isonline) {
|
||||
@ -260,6 +386,13 @@ public class ActiveDiscountServiceImpl extends ServiceImpl<ActiveDiscountMapper,
|
||||
activeDiscount.setIsonline(isonline);
|
||||
row = baseMapper.updateById(activeDiscount);
|
||||
}
|
||||
LambdaQueryWrapper<ActiveApplet> queryWrapper1 = new LambdaQueryWrapper<>();
|
||||
queryWrapper1.eq(ActiveApplet::getStoreId, TokenUtil.getNowAccountInfo().getStoreId());
|
||||
queryWrapper1.eq(ActiveApplet::getActiveId,id);
|
||||
queryWrapper1.eq(ActiveApplet::getType,"3");
|
||||
ActiveApplet activeApplet = activeAppletService.getOne(queryWrapper1);
|
||||
activeApplet.setIsonline(isonline);
|
||||
activeAppletService.updateById(activeApplet);
|
||||
return row==1;
|
||||
}
|
||||
|
||||
|
@ -2,12 +2,16 @@ package com.fuint.business.marketingActivity.activeFullminus.controller;
|
||||
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet;
|
||||
import com.fuint.business.marketingActivity.activeApplet.service.ActiveAppletService;
|
||||
import com.fuint.business.marketingActivity.activeDiscount.entity.ActiveDiscount;
|
||||
import com.fuint.business.marketingActivity.activeDiscount.service.ActiveDiscountChildService;
|
||||
import com.fuint.business.marketingActivity.activeFullminus.dto.ActiveFullminusDTO;
|
||||
import com.fuint.business.marketingActivity.activeFullminus.entity.ActiveFullminus;
|
||||
import com.fuint.business.marketingActivity.activeFullminus.service.ActiveFullminusService;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@ -34,6 +38,8 @@ public class ActiveFullminusController extends BaseController {
|
||||
private ActiveFullminusService activeFullminusService;
|
||||
@Resource
|
||||
private ActiveDiscountChildService activeDiscountChildService;
|
||||
@Resource
|
||||
private ActiveAppletService activeAppletService;
|
||||
|
||||
/**
|
||||
* 分页查询所有数据
|
||||
@ -123,6 +129,11 @@ public class ActiveFullminusController extends BaseController {
|
||||
*/
|
||||
@DeleteMapping("delById/{ids}")
|
||||
public ResponseObject delete(@PathVariable Integer ids) {
|
||||
LambdaQueryWrapper<ActiveApplet> queryWrapper1 = new LambdaQueryWrapper<>();
|
||||
queryWrapper1.eq(ActiveApplet::getStoreId, TokenUtil.getNowAccountInfo().getStoreId());
|
||||
queryWrapper1.eq(ActiveApplet::getActiveId,ids);
|
||||
queryWrapper1.eq(ActiveApplet::getType,"4");
|
||||
activeAppletService.remove(queryWrapper1);
|
||||
return getSuccessResult(this.activeFullminusService.removeById(ids));
|
||||
}
|
||||
/**
|
||||
|
@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet;
|
||||
import com.fuint.business.marketingActivity.activeApplet.service.ActiveAppletService;
|
||||
import com.fuint.business.marketingActivity.activeDiscount.entity.ActiveDiscount;
|
||||
import com.fuint.business.marketingActivity.activeDiscount.entity.ActiveDiscountChild;
|
||||
import com.fuint.business.marketingActivity.activeDiscount.service.ActiveDiscountChildService;
|
||||
@ -22,6 +24,7 @@ import com.fuint.business.petrolStationManagement.service.OilNameService;
|
||||
import com.fuint.business.store.service.StoreService;
|
||||
import com.fuint.business.userManager.entity.LJUserGrade;
|
||||
import com.fuint.business.userManager.service.LJUserGradeService;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.service.AccountService;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import com.fuint.repository.model.TAccount;
|
||||
@ -29,6 +32,7 @@ import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.Serializable;
|
||||
@ -57,16 +61,22 @@ public class ActiveFullminusServiceImpl extends ServiceImpl<ActiveFullminusMappe
|
||||
private OilNameService oilNameService;
|
||||
@Resource
|
||||
private AccountService accountService;
|
||||
@Resource
|
||||
private ActiveAppletService activeAppletService;
|
||||
/**
|
||||
* 新增数据
|
||||
* @param activeFullminusDTO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public Boolean add(ActiveFullminusDTO activeFullminusDTO) {
|
||||
boolean save = false;
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
ActiveApplet activeApplet = new ActiveApplet();
|
||||
activeApplet.setStoreId(nowAccountInfo.getStoreId());
|
||||
//获取当前店铺的id和连锁店id
|
||||
if (ObjectUtils.isNotEmpty(TokenUtil.getNowAccountInfo().getStoreId())) {
|
||||
if (ObjectUtils.isNotEmpty(nowAccountInfo.getStoreId())) {
|
||||
activeFullminusDTO.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
|
||||
activeFullminusDTO.setChainStoreId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId());
|
||||
}
|
||||
@ -86,6 +96,63 @@ public class ActiveFullminusServiceImpl extends ServiceImpl<ActiveFullminusMappe
|
||||
activeFullminus.setNaturalUserLevel(arrayToString(activeFullminusDTO.getNaturalUserLevel()));
|
||||
save = save(activeFullminus);
|
||||
}
|
||||
|
||||
activeApplet.setActiveId(activeFullminus.getId());
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd");
|
||||
String formatSt = dateFormat.format(activeFullminus.getActiveStartTime());
|
||||
String formatEd = dateFormat.format(activeFullminus.getActiveEndTime());
|
||||
activeApplet.setTime(formatSt+"-" + formatEd+"");
|
||||
|
||||
//获取会员等级
|
||||
String str = "";
|
||||
if (ObjectUtils.isNotEmpty(activeFullminusDTO.getDieselUserLevel())){
|
||||
for (String gradeId : activeFullminusDTO.getDieselUserLevel()) {
|
||||
if (ObjectUtils.isNotEmpty(userGradeService.selectUserGradeById(Integer.parseInt(gradeId)))){
|
||||
str += userGradeService.selectUserGradeById(Integer.parseInt(gradeId)).getName() + ",";
|
||||
}
|
||||
}
|
||||
}else {
|
||||
str = "普通群体";
|
||||
}
|
||||
activeApplet.setAdaptUserType(str);
|
||||
|
||||
String oilName = "";
|
||||
//油品名称
|
||||
String[] adaptOil = activeFullminusDTO.getAdaptOil();
|
||||
for (String oilType : adaptOil) {
|
||||
OilName oilName1 = oilNameService.selectOilNameById(Integer.parseInt(oilType));
|
||||
oilName += oilName1.getOilType() + "-"+oilName1.getOilName() + ",";
|
||||
}
|
||||
activeApplet.setOilName(oilName);
|
||||
|
||||
String describ = "";
|
||||
//活动规则满足金额
|
||||
double amount = 0.0;
|
||||
//折扣
|
||||
double discount = 0.0;
|
||||
if (CollectionUtils.isNotEmpty(activeFullminusDTO.getActiveDiscountChildList())) {
|
||||
for (ActiveDiscountChild activeDiscountChild : activeFullminusDTO.getActiveDiscountChildList()) {
|
||||
amount = activeDiscountChild.getDeductionAmount();
|
||||
discount = activeDiscountChild.getDeductionAmount();
|
||||
describ += "满" +
|
||||
amount + "元,减" + discount + "元;";
|
||||
}
|
||||
}
|
||||
if (activeFullminusDTO.getMemberDayType().equals("0")){
|
||||
activeApplet.setDiscountActiveDescribe("参加此项满减营销活动,享受优惠为:" +
|
||||
describ + "快来参与吧。");
|
||||
}else if (activeFullminusDTO.getMemberDayType().equals("2")){
|
||||
activeApplet.setDiscountActiveDescribe("参加此项满减营销活动,享受优惠为:" +
|
||||
describ + "本活动的会员日为每周的"+activeFullminusDTO.getWeekDay()+"快来参与吧。");
|
||||
}else {
|
||||
activeApplet.setDiscountActiveDescribe("参加此项满减营销活动,享受优惠为:" +
|
||||
describ + "本活动的会员日为每月的"+activeFullminusDTO.getMonthDay()+"号,快来参与吧。");
|
||||
}
|
||||
|
||||
activeApplet.setName("满减营销活动");
|
||||
activeApplet.setType("4");
|
||||
activeAppletService.save(activeApplet);
|
||||
|
||||
//新增兑换物品
|
||||
List<ActiveDiscountChild> list = activeFullminusDTO.getActiveDiscountChildList();
|
||||
if (CollectionUtils.isNotEmpty(list)){
|
||||
@ -201,8 +268,69 @@ public class ActiveFullminusServiceImpl extends ServiceImpl<ActiveFullminusMappe
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Boolean updateOneById(ActiveFullminusDTO activeFullminusDTO) {
|
||||
boolean update = false;
|
||||
LambdaQueryWrapper<ActiveApplet> queryWrapper1 = new LambdaQueryWrapper<>();
|
||||
queryWrapper1.eq(ActiveApplet::getStoreId,TokenUtil.getNowAccountInfo().getStoreId());
|
||||
queryWrapper1.eq(ActiveApplet::getType,"4");
|
||||
queryWrapper1.eq(ActiveApplet::getActiveId,activeFullminusDTO.getId());
|
||||
ActiveApplet activeApplet = activeAppletService.getOne(queryWrapper1);
|
||||
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd");
|
||||
String formatSt = dateFormat.format(activeFullminusDTO.getActiveStartTime());
|
||||
String formatEd = dateFormat.format(activeFullminusDTO.getActiveEndTime());
|
||||
activeApplet.setTime(formatSt+"-" + formatEd+"");
|
||||
|
||||
//获取会员等级
|
||||
String str = "";
|
||||
if (ObjectUtils.isNotEmpty(activeFullminusDTO.getDieselUserLevel())){
|
||||
for (String gradeId : activeFullminusDTO.getDieselUserLevel()) {
|
||||
if (ObjectUtils.isNotEmpty(userGradeService.selectUserGradeById(Integer.parseInt(gradeId)))){
|
||||
str += userGradeService.selectUserGradeById(Integer.parseInt(gradeId)).getName() + ",";
|
||||
}
|
||||
}
|
||||
}else {
|
||||
str = "普通群体";
|
||||
}
|
||||
activeApplet.setAdaptUserType(str);
|
||||
|
||||
String oilName = "";
|
||||
//油品名称
|
||||
String[] adaptOil = activeFullminusDTO.getAdaptOil();
|
||||
for (String oilType : adaptOil) {
|
||||
OilName oilName1 = oilNameService.selectOilNameById(Integer.parseInt(oilType));
|
||||
oilName += oilName1.getOilType() + "-"+oilName1.getOilName() + ",";
|
||||
}
|
||||
activeApplet.setOilName(oilName);
|
||||
|
||||
String describ = "";
|
||||
//活动规则满足金额
|
||||
double amount = 0.0;
|
||||
//折扣
|
||||
double discount = 0.0;
|
||||
if (CollectionUtils.isNotEmpty(activeFullminusDTO.getActiveDiscountChildList())) {
|
||||
for (ActiveDiscountChild activeDiscountChild : activeFullminusDTO.getActiveDiscountChildList()) {
|
||||
amount = activeDiscountChild.getAmount();
|
||||
discount = activeDiscountChild.getDeductionAmount();
|
||||
describ += "满" +
|
||||
amount + "元,减" + discount + "元;";
|
||||
}
|
||||
}
|
||||
if (activeFullminusDTO.getMemberDayType().equals("0")){
|
||||
activeApplet.setDiscountActiveDescribe("参加此项折满减销活动,享受优惠为:" +
|
||||
describ + "快来参与吧。");
|
||||
}else if (activeFullminusDTO.getMemberDayType().equals("2")){
|
||||
activeApplet.setDiscountActiveDescribe("参加此项满减营销活动,享受优惠为:" +
|
||||
describ + "本活动的会员日为每周的"+activeFullminusDTO.getWeekDay()+"快来参与吧。");
|
||||
}else {
|
||||
activeApplet.setDiscountActiveDescribe("参加此项满减营销活动,享受优惠为:" +
|
||||
describ + "本活动的会员日为每月的"+activeFullminusDTO.getMonthDay()+"号,快来参与吧。");
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(activeFullminusDTO.getIsonline())){
|
||||
activeApplet.setIsonline(activeFullminusDTO.getIsonline());
|
||||
}
|
||||
activeAppletService.updateById(activeApplet);
|
||||
//更新折扣营销
|
||||
ActiveFullminus activeFullminus = new ActiveFullminus();
|
||||
BeanUtils.copyProperties(activeFullminusDTO,activeFullminus);
|
||||
@ -246,6 +374,13 @@ public class ActiveFullminusServiceImpl extends ServiceImpl<ActiveFullminusMappe
|
||||
activeFullminus.setIsonline(isonline);
|
||||
row = baseMapper.updateById(activeFullminus);
|
||||
}
|
||||
LambdaQueryWrapper<ActiveApplet> queryWrapper1 = new LambdaQueryWrapper<>();
|
||||
queryWrapper1.eq(ActiveApplet::getStoreId, TokenUtil.getNowAccountInfo().getStoreId());
|
||||
queryWrapper1.eq(ActiveApplet::getActiveId,id);
|
||||
queryWrapper1.eq(ActiveApplet::getType,"4");
|
||||
ActiveApplet activeApplet = activeAppletService.getOne(queryWrapper1);
|
||||
activeApplet.setIsonline(isonline);
|
||||
activeAppletService.updateById(activeApplet);
|
||||
return row == 1;
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@ import com.fuint.business.userManager.service.LJUserService;
|
||||
import com.fuint.business.userManager.service.UserBalanceService;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -44,6 +45,7 @@ import java.util.stream.Collectors;
|
||||
* @since 2023-12-20 14:13:16
|
||||
*/
|
||||
@Service("activeRecommendRecordsService")
|
||||
@Slf4j
|
||||
public class ActiveRecommendRecordsServiceImpl extends ServiceImpl<ActiveRecommendRecordsMapper, ActiveRecommendRecords> implements ActiveRecommendRecordsService {
|
||||
|
||||
@Resource
|
||||
@ -154,6 +156,7 @@ public class ActiveRecommendRecordsServiceImpl extends ServiceImpl<ActiveRecomme
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean add(ActiveRecommendRecordsDTO activeRecommendRecordsDTO) {
|
||||
log.info("新增邀请记录接口:"+activeRecommendRecordsDTO);
|
||||
if (ObjectUtils.isNotEmpty(activeRecommendRecordsDTO) && activeRecommendRecordsDTO.getType().equals("yaoqingyouli")){
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
Integer userId = nowAccountInfo.getId();
|
||||
|
@ -5,8 +5,12 @@ package com.fuint.business.marketingActivity.cardFule.controller;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet;
|
||||
import com.fuint.business.marketingActivity.activeApplet.service.ActiveAppletService;
|
||||
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel;
|
||||
import com.fuint.business.marketingActivity.cardFule.service.CardFuelDieselService;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilName;
|
||||
import com.fuint.business.petrolStationManagement.service.OilNameService;
|
||||
import com.fuint.business.store.service.StoreService;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
@ -14,10 +18,12 @@ import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.Serializable;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@ -37,6 +43,10 @@ public class CardFuelDieselController extends BaseController {
|
||||
private CardFuelDieselService cardFuelDieselService;
|
||||
@Resource
|
||||
private StoreService storeService;
|
||||
@Autowired
|
||||
private OilNameService oilNameService;
|
||||
@Resource
|
||||
private ActiveAppletService activeAppletService;
|
||||
|
||||
/**
|
||||
* 分页查询所有数据
|
||||
@ -98,7 +108,11 @@ public class CardFuelDieselController extends BaseController {
|
||||
@PostMapping
|
||||
public ResponseObject insert(@RequestBody CardFuelDiesel cardFuelDiesel) {
|
||||
|
||||
ActiveApplet activeApplet = new ActiveApplet();
|
||||
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
activeApplet.setStoreId(nowAccountInfo.getStoreId());
|
||||
|
||||
//根据油品id和油站id查询
|
||||
LambdaQueryWrapper<CardFuelDiesel> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CardFuelDiesel::getStoreId, nowAccountInfo.getStoreId());
|
||||
@ -112,10 +126,51 @@ public class CardFuelDieselController extends BaseController {
|
||||
cardFuelDiesel.setStoreId(nowAccountInfo.getStoreId());
|
||||
cardFuelDiesel.setChainStorId(storeService.getById(nowAccountInfo.getStoreId()).getChainStoreId());
|
||||
}
|
||||
/*cardFuelDiesel.setStartTime(new Date());
|
||||
cardFuelDiesel.setEndTime(new Date());*/
|
||||
cardFuelDiesel.setStatus(cardFuelDiesel.getStatus().equals("true") ? "1" : "2");
|
||||
return getSuccessResult(this.cardFuelDieselService.save(cardFuelDiesel));
|
||||
boolean save = this.cardFuelDieselService.save(cardFuelDiesel);
|
||||
activeApplet.setActiveId(cardFuelDiesel.getId());
|
||||
//活动时间
|
||||
if (cardFuelDiesel.getActiveTime().equals("1")){
|
||||
activeApplet.setTime("不限时间");
|
||||
}else {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd");
|
||||
String formatSt = dateFormat.format(cardFuelDiesel.getStartTime());
|
||||
String formatEd = dateFormat.format(cardFuelDiesel.getEndTime());
|
||||
activeApplet.setTime(formatSt+"-" + formatEd+"");
|
||||
}
|
||||
|
||||
//油品名称
|
||||
String type = cardFuelDiesel.getType();
|
||||
String oilType = cardFuelDiesel.getOilType();
|
||||
OilName oilName1 = oilNameService.selectOilNameById(Integer.parseInt(oilType));
|
||||
String oilName = oilName1.getOilName();
|
||||
activeApplet.setOilName(type+"-"+oilName);
|
||||
//时间
|
||||
String startFormat= "";
|
||||
String endFormat = "";
|
||||
if (cardFuelDiesel.getActiveTime().equals("1")){
|
||||
activeApplet.setTime("不限时间!");
|
||||
//描述
|
||||
activeApplet.setDiscountActiveDescribe("本充值活动,充值满"+
|
||||
cardFuelDiesel.getRechargeBalance()+"元可以参加,所参与油品类型为:"+activeApplet.getOilName()+",锁价单价为:"+
|
||||
cardFuelDiesel.getLockupPrice()+"元/L,总升数为:"+cardFuelDiesel.getIncomeLitres()+"L,活动时间为:不限时间!");
|
||||
}else {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
startFormat = simpleDateFormat.format(cardFuelDiesel.getStartTime());
|
||||
endFormat = simpleDateFormat.format(cardFuelDiesel.getEndTime());
|
||||
activeApplet.setTime(startFormat+"-"+endFormat);
|
||||
//描述
|
||||
activeApplet.setDiscountActiveDescribe("本充值活动,充值满"+
|
||||
cardFuelDiesel.getRechargeBalance()+"元可以参加,所参与油品类型为:"+activeApplet.getOilName()+",锁价单价为:"+
|
||||
cardFuelDiesel.getLockupPrice()+"元/L,总升数为:"+cardFuelDiesel.getIncomeLitres()+"L,活动时间为:"+startFormat+"-"+endFormat);
|
||||
}
|
||||
|
||||
|
||||
activeApplet.setPoints(cardFuelDiesel.getPoints());
|
||||
activeApplet.setName("囤油卡充值活动");
|
||||
activeApplet.setType("2");
|
||||
activeAppletService.save(activeApplet);
|
||||
return getSuccessResult(save);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -131,6 +186,49 @@ public class CardFuelDieselController extends BaseController {
|
||||
String substring = cardFuelDiesel.getType().substring(0, 3);
|
||||
cardFuelDiesel.setType(substring);
|
||||
}
|
||||
LambdaQueryWrapper<ActiveApplet> queryWrapper1 = new LambdaQueryWrapper<>();
|
||||
queryWrapper1.eq(ActiveApplet::getStoreId,TokenUtil.getNowAccountInfo().getStoreId());
|
||||
queryWrapper1.eq(ActiveApplet::getType,"2");
|
||||
queryWrapper1.eq(ActiveApplet::getActiveId,cardFuelDiesel.getId());
|
||||
ActiveApplet activeApplet = activeAppletService.getOne(queryWrapper1);
|
||||
//活动时间
|
||||
if (cardFuelDiesel.getActiveTime().equals("1")){
|
||||
activeApplet.setTime("不限时间");
|
||||
}else {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd");
|
||||
String formatSt = dateFormat.format(cardFuelDiesel.getStartTime());
|
||||
String formatEd = dateFormat.format(cardFuelDiesel.getEndTime());
|
||||
activeApplet.setTime(formatSt+"-" + formatEd+"");
|
||||
}
|
||||
|
||||
//油品名称
|
||||
String type = cardFuelDiesel.getType();
|
||||
String oilType = cardFuelDiesel.getOilType();
|
||||
OilName oilName1 = oilNameService.selectOilNameById(Integer.parseInt(oilType));
|
||||
String oilName = oilName1.getOilName();
|
||||
activeApplet.setOilName(type+"-"+oilName);
|
||||
//时间
|
||||
String startFormat= "";
|
||||
String endFormat = "";
|
||||
if (cardFuelDiesel.getActiveTime().equals("1")){
|
||||
activeApplet.setTime("不限时间!");
|
||||
//描述
|
||||
activeApplet.setDiscountActiveDescribe("本充值活动,充值满"+
|
||||
cardFuelDiesel.getRechargeBalance()+"元可以参加,所参与油品类型为:"+activeApplet.getOilName()+",锁价单价为:"+
|
||||
cardFuelDiesel.getLockupPrice()+"元/L,总升数为:"+cardFuelDiesel.getIncomeLitres()+"L,活动时间为:不限时间!");
|
||||
}else {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
startFormat = simpleDateFormat.format(cardFuelDiesel.getStartTime());
|
||||
endFormat = simpleDateFormat.format(cardFuelDiesel.getEndTime());
|
||||
activeApplet.setTime(startFormat+"-"+endFormat);
|
||||
//描述
|
||||
activeApplet.setDiscountActiveDescribe("本充值活动,充值满"+
|
||||
cardFuelDiesel.getRechargeBalance()+"元可以参加,所参与油品类型为:"+activeApplet.getOilName()+",锁价单价为:"+
|
||||
cardFuelDiesel.getLockupPrice()+"元/L,总升数为:"+cardFuelDiesel.getIncomeLitres()+"L,活动时间为:"+startFormat+"-"+endFormat);
|
||||
}
|
||||
|
||||
activeApplet.setPoints(cardFuelDiesel.getPoints());
|
||||
activeAppletService.updateById(activeApplet);
|
||||
return getSuccessResult(this.cardFuelDieselService.updateById(cardFuelDiesel));
|
||||
}
|
||||
|
||||
@ -142,7 +240,14 @@ public class CardFuelDieselController extends BaseController {
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
public ResponseObject delete(@PathVariable Integer id) {
|
||||
|
||||
LambdaQueryWrapper<ActiveApplet> queryWrapper1 = new LambdaQueryWrapper<>();
|
||||
queryWrapper1.eq(ActiveApplet::getStoreId,TokenUtil.getNowAccountInfo().getStoreId());
|
||||
queryWrapper1.eq(ActiveApplet::getActiveId,id);
|
||||
queryWrapper1.eq(ActiveApplet::getType,"2");
|
||||
activeAppletService.remove(queryWrapper1);
|
||||
return getSuccessResult(this.cardFuelDieselService.removeById(id));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5,6 +5,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet;
|
||||
import com.fuint.business.marketingActivity.activeApplet.mapper.ActiveAppletMapper;
|
||||
import com.fuint.business.marketingActivity.activeApplet.service.ActiveAppletService;
|
||||
import com.fuint.business.marketingActivity.activeConsumption.entity.ActiveConsumptionChild;
|
||||
import com.fuint.business.marketingActivity.activeConsumption.vo.ActiveConsumptionAppletVO;
|
||||
import com.fuint.business.marketingActivity.activeConsumption.vo.ActiveConsumptionVO;
|
||||
@ -31,6 +34,7 @@ import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.Serializable;
|
||||
@ -61,6 +65,9 @@ public class CardValueServiceImpl extends ServiceImpl<CardValueMapper, CardValue
|
||||
|
||||
@Resource
|
||||
private CardExchangeMapper cardExchangeMapper;
|
||||
|
||||
@Resource
|
||||
private ActiveAppletService activeAppletService;
|
||||
/**
|
||||
* 分页查询所有数据
|
||||
* @param page
|
||||
@ -207,6 +214,7 @@ public class CardValueServiceImpl extends ServiceImpl<CardValueMapper, CardValue
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public CardValueVO getOneById(Serializable id) {
|
||||
CardValueVO cardValueVO = new CardValueVO();
|
||||
if (ObjectUtils.isNotEmpty(id)){
|
||||
@ -267,13 +275,16 @@ public class CardValueServiceImpl extends ServiceImpl<CardValueMapper, CardValue
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean add(CardValueDTO cardValueDTO) {
|
||||
ActiveApplet activeApplet = new ActiveApplet();
|
||||
boolean save = false;
|
||||
//获取当前店铺的id和连锁店id
|
||||
if (ObjectUtils.isNotEmpty(TokenUtil.getNowAccountInfo().getStoreId())) {
|
||||
cardValueDTO.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
|
||||
cardValueDTO.setChainStoreId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId());
|
||||
}
|
||||
activeApplet.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
|
||||
cardValueDTO.setCreateBy(TokenUtil.getNowAccountInfo().getRealName());
|
||||
//新增折扣营销活动模板
|
||||
CardValue cardValue = new CardValue();
|
||||
@ -285,6 +296,44 @@ public class CardValueServiceImpl extends ServiceImpl<CardValueMapper, CardValue
|
||||
BeanUtils.copyProperties(cardValueDTO,cardValue);
|
||||
save = save(cardValue);
|
||||
}
|
||||
activeApplet.setActiveId(cardValue.getId());
|
||||
|
||||
//获取会员等级
|
||||
String str = "";
|
||||
if (ObjectUtils.isNotEmpty(cardValueDTO.getMembershipLevel())){
|
||||
for (String gradeId : cardValueDTO.getMembershipLevel()) {
|
||||
if (ObjectUtils.isNotEmpty(userGradeService.selectUserGradeById(Integer.parseInt(gradeId)))){
|
||||
str += userGradeService.selectUserGradeById(Integer.parseInt(gradeId)).getName() + ",";
|
||||
}
|
||||
}
|
||||
}else {
|
||||
str = "普通群体";
|
||||
}
|
||||
//活动时间
|
||||
if (cardValue.getActiveTime().equals("1")){
|
||||
activeApplet.setTime("不限时间");
|
||||
}else {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd");
|
||||
String formatSt = dateFormat.format(cardValue.getStartTime());
|
||||
String formatEd = dateFormat.format(cardValue.getEndTime());
|
||||
activeApplet.setTime(formatSt+"-" + formatEd+"");
|
||||
}
|
||||
|
||||
//赠送优惠券兑换券实物
|
||||
String card = "";
|
||||
if (CollectionUtils.isNotEmpty(cardValueDTO.getCardValueChildList())) {
|
||||
for (CardValueChild cardValueChild : cardValueDTO.getCardValueChildList()) {
|
||||
card += cardValueChild.getGiftCardDetail() + "的券,";
|
||||
}
|
||||
}
|
||||
|
||||
activeApplet.setAdaptUserType(str);
|
||||
activeApplet.setGrowaValue(cardValue.getGrowthValue());
|
||||
activeApplet.setPoints(cardValue.getPoints());
|
||||
activeApplet.setType("1");
|
||||
activeApplet.setName("储值卡充值活动");
|
||||
activeApplet.setDiscountActiveDescribe("本充值活动,充值满"+
|
||||
cardValue.getRechargeBalance()+"元,赠送金额为:"+cardValue.getGiftBalance()+"元,赠送券:"+card+"。");
|
||||
//新增兑换物品
|
||||
List<CardValueChild> cardValueChildList = cardValueDTO.getCardValueChildList();
|
||||
cardValueChildList.stream().map(s ->{
|
||||
@ -292,6 +341,7 @@ public class CardValueServiceImpl extends ServiceImpl<CardValueMapper, CardValue
|
||||
return s;
|
||||
}).collect(Collectors.toList());
|
||||
save = cardValueChildService.saveBatch(cardValueChildList);
|
||||
activeAppletService.save(activeApplet);
|
||||
return save;
|
||||
}
|
||||
|
||||
@ -302,6 +352,7 @@ public class CardValueServiceImpl extends ServiceImpl<CardValueMapper, CardValue
|
||||
*/
|
||||
@Override
|
||||
public boolean updateOneById(CardValueDTO cardValueDTO) {
|
||||
ActiveApplet activeApplet = new ActiveApplet();
|
||||
boolean update = false;
|
||||
//更新活动
|
||||
CardValue cardValue = new CardValue();
|
||||
@ -327,6 +378,50 @@ public class CardValueServiceImpl extends ServiceImpl<CardValueMapper, CardValue
|
||||
}).collect(Collectors.toList());
|
||||
update = cardValueChildService.saveBatch(cardValueChildList);
|
||||
}
|
||||
LambdaQueryWrapper<ActiveApplet> queryWrapper1 = new LambdaQueryWrapper<>();
|
||||
queryWrapper1.eq(ActiveApplet::getStoreId,TokenUtil.getNowAccountInfo().getStoreId());
|
||||
queryWrapper1.eq(ActiveApplet::getType,"1");
|
||||
queryWrapper1.eq(ActiveApplet::getActiveId,cardValueDTO.getId());
|
||||
ActiveApplet one = activeAppletService.getOne(queryWrapper1);
|
||||
|
||||
//获取会员等级
|
||||
String str = "";
|
||||
if (ObjectUtils.isNotEmpty(cardValueDTO.getMembershipLevel())){
|
||||
for (String gradeId : cardValueDTO.getMembershipLevel()) {
|
||||
if (ObjectUtils.isNotEmpty(userGradeService.selectUserGradeById(Integer.parseInt(gradeId)))){
|
||||
str += userGradeService.selectUserGradeById(Integer.parseInt(gradeId)).getName() + ",";
|
||||
}
|
||||
}
|
||||
}else {
|
||||
str = "普通群体";
|
||||
}
|
||||
//活动时间
|
||||
if (cardValue.getActiveTime().equals("1")){
|
||||
activeApplet.setTime("不限时间");
|
||||
}else {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd");
|
||||
String formatSt = dateFormat.format(cardValue.getStartTime());
|
||||
String formatEd = dateFormat.format(cardValue.getEndTime());
|
||||
activeApplet.setTime(formatSt+"-" + formatEd+"");
|
||||
}
|
||||
|
||||
//赠送优惠券兑换券实物
|
||||
String card = "";
|
||||
if (CollectionUtils.isNotEmpty(cardValueDTO.getCardValueChildList())) {
|
||||
for (CardValueChild cardValueChild : cardValueDTO.getCardValueChildList()) {
|
||||
card += cardValueChild.getGiftCardDetail() + "的券,";
|
||||
}
|
||||
}
|
||||
|
||||
activeApplet.setAdaptUserType(str);
|
||||
activeApplet.setId(one.getId());
|
||||
activeApplet.setGrowaValue(cardValue.getGrowthValue());
|
||||
activeApplet.setPoints(cardValue.getPoints());
|
||||
activeApplet.setType("1");
|
||||
activeApplet.setName("储值卡充值活动");
|
||||
activeApplet.setDiscountActiveDescribe("本充值活动,充值满"+
|
||||
cardValue.getRechargeBalance()+"元,赠送金额为:"+cardValue.getGiftBalance()+"元,赠送券:"+card+"。");
|
||||
activeAppletService.updateById(activeApplet);
|
||||
return update;
|
||||
}
|
||||
|
||||
@ -382,6 +477,7 @@ public class CardValueServiceImpl extends ServiceImpl<CardValueMapper, CardValue
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean delById(Long id) {
|
||||
boolean flag = false;
|
||||
//1.先删除对应的优惠券兑换券
|
||||
@ -391,6 +487,11 @@ public class CardValueServiceImpl extends ServiceImpl<CardValueMapper, CardValue
|
||||
flag = cardValueChildService.remove(queryWrapper);
|
||||
//2.删除储值卡
|
||||
flag = removeById(id);
|
||||
LambdaQueryWrapper<ActiveApplet> queryWrapper1 = new LambdaQueryWrapper<>();
|
||||
queryWrapper1.eq(ActiveApplet::getStoreId,TokenUtil.getNowAccountInfo().getStoreId());
|
||||
queryWrapper1.eq(ActiveApplet::getActiveId,id);
|
||||
queryWrapper1.eq(ActiveApplet::getType,"1");
|
||||
activeAppletService.remove(queryWrapper1);
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user