Merge branch 'master' of https://gitee.com/nny_1/oilSystem
This commit is contained in:
commit
f2aa5c9533
@ -0,0 +1,47 @@
|
|||||||
|
<?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.activeConsumption.mapper.ActiveConsumptionMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.fuint.business.petrolStationManagement.entity.OilGun" id="OilGunMap">
|
||||||
|
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||||
|
<result property="gunName" column="gun_name" jdbcType="VARCHAR"/>
|
||||||
|
<result property="tankId" column="tank_id" jdbcType="INTEGER"/>
|
||||||
|
<result property="status" column="status" jdbcType="VARCHAR"/>
|
||||||
|
<result property="storeId" column="store_id" jdbcType="INTEGER"/>
|
||||||
|
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||||
|
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||||
|
<result property="createBy" column="create_by" jdbcType="INTEGER"/>
|
||||||
|
<result property="updateBy" column="update_by" jdbcType="INTEGER"/>
|
||||||
|
<result property="numberId" column="number_id" jdbcType="INTEGER"/>
|
||||||
|
<result property="tankName" column="tank_name" jdbcType="VARCHAR"/>
|
||||||
|
<result property="oilNumber" column="oil_number" jdbcType="VARCHAR"/>
|
||||||
|
<result property="oilMachineGunNumber" column="oil_machine_gun_number" jdbcType="VARCHAR"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="getAllList" resultMap="OilGunMap">
|
||||||
|
select
|
||||||
|
og.id, og.gun_name, og.tank_id, og.status, og.store_id, og.create_time, og.update_time, og.create_by, og.update_by, og.number_id, ot.tank_name,
|
||||||
|
og.oil_machine_gun_number
|
||||||
|
from oil_gun og left join oil_tank ot on og.tank_id = ot.id
|
||||||
|
<where>
|
||||||
|
<if test="oilGun.id != null">
|
||||||
|
and og.id = #{oilGun.id}
|
||||||
|
</if>
|
||||||
|
<if test="oilGun.gunName != null and oilGun.gunName != ''">
|
||||||
|
and og.gun_name = #{oilGun.gunName}
|
||||||
|
</if>
|
||||||
|
<if test="oilGun.tankId != null">
|
||||||
|
and og.tank_id = #{oilGun.tankId}
|
||||||
|
</if>
|
||||||
|
<if test="oilGun.status != null and oilGun.status != ''">
|
||||||
|
and og.status = #{oilGun.status}
|
||||||
|
</if>
|
||||||
|
<if test="oilGun.storeId != null">
|
||||||
|
and og.store_id = #{oilGun.storeId}
|
||||||
|
</if>
|
||||||
|
<if test="oilGun.updateBy != null">
|
||||||
|
and og.update_by = #{oilGun.updateBy}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
@ -15,6 +15,7 @@ import com.fuint.business.marketingActivity.activeConsumption.vo.ActiveConsumpti
|
|||||||
import com.fuint.business.marketingActivity.activeConsumption.vo.ActiveConsumptionVO;
|
import com.fuint.business.marketingActivity.activeConsumption.vo.ActiveConsumptionVO;
|
||||||
import com.fuint.business.petrolStationManagement.service.OilNameService;
|
import com.fuint.business.petrolStationManagement.service.OilNameService;
|
||||||
import com.fuint.business.store.service.StoreService;
|
import com.fuint.business.store.service.StoreService;
|
||||||
|
import com.fuint.business.userManager.entity.LJUserGrade;
|
||||||
import com.fuint.business.userManager.service.LJUserGradeService;
|
import com.fuint.business.userManager.service.LJUserGradeService;
|
||||||
import com.fuint.common.util.TokenUtil;
|
import com.fuint.common.util.TokenUtil;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
@ -131,8 +132,9 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl<ActiveConsumptionM
|
|||||||
String str = "";
|
String str = "";
|
||||||
if (ObjectUtils.isNotEmpty(s.getDieselUserLevel())){
|
if (ObjectUtils.isNotEmpty(s.getDieselUserLevel())){
|
||||||
for (String gradeId : s.getDieselUserLevel().split(",")) {
|
for (String gradeId : s.getDieselUserLevel().split(",")) {
|
||||||
if (ObjectUtils.isNotEmpty(userGradeService.selectUserGradeById(Integer.parseInt(gradeId)))){
|
LJUserGrade ljUserGrade = userGradeService.selectUserGradeById(Integer.parseInt(gradeId));
|
||||||
str += userGradeService.selectUserGradeById(Integer.parseInt(gradeId)).getName() + ",";
|
if (ObjectUtils.isNotEmpty(ljUserGrade)){
|
||||||
|
str += ljUserGrade.getName() + ",";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
activeConsumptionVO.setDieselUserLevel(str.split(","));
|
activeConsumptionVO.setDieselUserLevel(str.split(","));
|
||||||
|
@ -83,8 +83,6 @@ public class ActiveExchangeController extends BaseController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询所有数据
|
* 分页查询所有数据
|
||||||
* @param pageNo
|
|
||||||
* @param pageSize
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("applet")
|
@GetMapping("applet")
|
||||||
|
@ -264,7 +264,6 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 分页查询所有数据
|
* 分页查询所有数据
|
||||||
* @param page
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,24 +2,15 @@ package com.fuint.business.marketingActivity.cardFule.controller;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel;
|
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel;
|
||||||
import com.fuint.business.marketingActivity.cardFule.service.CardFuelDieselService;
|
import com.fuint.business.marketingActivity.cardFule.service.CardFuelDieselService;
|
||||||
import com.fuint.business.marketingActivity.cardGift.entity.CardGift;
|
|
||||||
import com.fuint.business.petrolStationManagement.entity.OilName;
|
|
||||||
import com.fuint.business.petrolStationManagement.service.OilNameService;
|
|
||||||
import com.fuint.business.store.service.StoreService;
|
import com.fuint.business.store.service.StoreService;
|
||||||
import com.fuint.common.dto.AccountInfo;
|
|
||||||
import com.fuint.common.util.TokenUtil;
|
import com.fuint.common.util.TokenUtil;
|
||||||
import com.fuint.framework.web.BaseController;
|
import com.fuint.framework.web.BaseController;
|
||||||
import com.fuint.framework.web.ResponseObject;
|
import com.fuint.framework.web.ResponseObject;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@ -43,8 +34,6 @@ public class CardFuelDieselController extends BaseController {
|
|||||||
private CardFuelDieselService cardFuelDieselService;
|
private CardFuelDieselService cardFuelDieselService;
|
||||||
@Resource
|
@Resource
|
||||||
private StoreService storeService;
|
private StoreService storeService;
|
||||||
@Autowired
|
|
||||||
private OilNameService oilNameService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询所有数据
|
* 分页查询所有数据
|
||||||
@ -58,39 +47,7 @@ public class CardFuelDieselController extends BaseController {
|
|||||||
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
|
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
|
||||||
@Param("cardFuelDiesel") CardFuelDiesel cardFuelDiesel) {
|
@Param("cardFuelDiesel") CardFuelDiesel cardFuelDiesel) {
|
||||||
Page page = new Page(pageNo, pageSize);
|
Page page = new Page(pageNo, pageSize);
|
||||||
//构建查询条件
|
return getSuccessResult(this.cardFuelDieselService.select(page, cardFuelDiesel));
|
||||||
LambdaQueryWrapper<CardFuelDiesel> queryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
if(ObjectUtils.isNotEmpty(cardFuelDiesel.getOilType())){
|
|
||||||
queryWrapper.eq(CardFuelDiesel::getOilType,cardFuelDiesel.getOilType());
|
|
||||||
}
|
|
||||||
if (ObjectUtils.isNotEmpty(cardFuelDiesel.getActiveStatus())){
|
|
||||||
queryWrapper.eq(CardFuelDiesel::getActiveStatus,cardFuelDiesel.getActiveStatus());
|
|
||||||
}
|
|
||||||
if(ObjectUtils.isNotEmpty(cardFuelDiesel.getType())) {
|
|
||||||
queryWrapper.eq(CardFuelDiesel::getType,cardFuelDiesel.getType());
|
|
||||||
}
|
|
||||||
queryWrapper.eq(CardFuelDiesel::getStoreId, TokenUtil.getNowAccountInfo().getStoreId());
|
|
||||||
queryWrapper.orderByDesc(CardFuelDiesel::getCreateTime);
|
|
||||||
IPage page1 = this.cardFuelDieselService.page(page, queryWrapper);
|
|
||||||
List<CardFuelDiesel> records = page1.getRecords();
|
|
||||||
//返回囤油卡状态
|
|
||||||
for (CardFuelDiesel record : records) {
|
|
||||||
record.setOilType(oilNameService.selectOilNameById(Integer.parseInt(record.getOilType())).getOilName());
|
|
||||||
record.setStatus(record.getStatus().equals("1") ? "true" : "false");
|
|
||||||
if(ObjectUtils.isNotEmpty(record.getActiveTime()) && "1".equals(record.getActiveTime())){
|
|
||||||
record.setActivityProgress("1");
|
|
||||||
}
|
|
||||||
//活动进度状态
|
|
||||||
if (ObjectUtils.isNotEmpty(record.getStartTime()) &&
|
|
||||||
ObjectUtils.isNotEmpty(record.getEndTime()) &&
|
|
||||||
record.getActiveTime().equals("2")){
|
|
||||||
record.setActivityProgress(record.getStartTime().getTime() > new Date().getTime() ? "0" : "");
|
|
||||||
if(ObjectUtils.isEmpty(record.getActivityProgress())){
|
|
||||||
record.setActivityProgress(record.getEndTime().getTime() > new Date().getTime() ? "1" : "2");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return getSuccessResult(page1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -117,7 +74,6 @@ public class CardFuelDieselController extends BaseController {
|
|||||||
cardFuelDiesel.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
|
cardFuelDiesel.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
|
||||||
cardFuelDiesel.setChainStorId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId());
|
cardFuelDiesel.setChainStorId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId());
|
||||||
}
|
}
|
||||||
|
|
||||||
cardFuelDiesel.setStartTime(new Date());
|
cardFuelDiesel.setStartTime(new Date());
|
||||||
cardFuelDiesel.setEndTime(new Date());
|
cardFuelDiesel.setEndTime(new Date());
|
||||||
cardFuelDiesel.setStatus(cardFuelDiesel.getStatus().equals("true") ? "1" : "2");
|
cardFuelDiesel.setStatus(cardFuelDiesel.getStatus().equals("true") ? "1" : "2");
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.fuint.business.marketingActivity.cardFule.service;
|
package com.fuint.business.marketingActivity.cardFule.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel;
|
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel;
|
||||||
|
|
||||||
@ -15,5 +17,12 @@ public interface CardFuelDieselService extends IService<CardFuelDiesel> {
|
|||||||
|
|
||||||
List<CardFuelDiesel> countOilType();
|
List<CardFuelDiesel> countOilType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询所有数据
|
||||||
|
* @param page
|
||||||
|
* @param cardFuelDiesel
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
IPage select(Page page, CardFuelDiesel cardFuelDiesel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,14 +1,21 @@
|
|||||||
package com.fuint.business.marketingActivity.cardFule.service.impl;
|
package com.fuint.business.marketingActivity.cardFule.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.fuint.business.marketingActivity.cardFule.mapper.CardFuelDieselMapper;
|
import com.fuint.business.marketingActivity.cardFule.mapper.CardFuelDieselMapper;
|
||||||
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel;
|
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel;
|
||||||
import com.fuint.business.marketingActivity.cardFule.service.CardFuelDieselService;
|
import com.fuint.business.marketingActivity.cardFule.service.CardFuelDieselService;
|
||||||
|
import com.fuint.business.petrolStationManagement.service.OilNameService;
|
||||||
import com.fuint.common.dto.AccountInfo;
|
import com.fuint.common.dto.AccountInfo;
|
||||||
import com.fuint.common.util.TokenUtil;
|
import com.fuint.common.util.TokenUtil;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -22,11 +29,56 @@ public class CardFuelDieselServiceImpl extends ServiceImpl<CardFuelDieselMapper,
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
CardFuelDieselMapper cardFuelDieselMapper;
|
CardFuelDieselMapper cardFuelDieselMapper;
|
||||||
|
@Autowired
|
||||||
|
private OilNameService oilNameService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CardFuelDiesel> countOilType() {
|
public List<CardFuelDiesel> countOilType() {
|
||||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||||
return cardFuelDieselMapper.countOilType(nowAccountInfo.getStoreId());
|
return cardFuelDieselMapper.countOilType(nowAccountInfo.getStoreId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询所有数据
|
||||||
|
* @param page
|
||||||
|
* @param cardFuelDiesel
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public IPage select(Page page, CardFuelDiesel cardFuelDiesel) {
|
||||||
|
//构建查询条件
|
||||||
|
LambdaQueryWrapper<CardFuelDiesel> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if(ObjectUtils.isNotEmpty(cardFuelDiesel.getOilType())){
|
||||||
|
queryWrapper.eq(CardFuelDiesel::getOilType,cardFuelDiesel.getOilType());
|
||||||
|
}
|
||||||
|
if (ObjectUtils.isNotEmpty(cardFuelDiesel.getActiveStatus())){
|
||||||
|
queryWrapper.eq(CardFuelDiesel::getActiveStatus,cardFuelDiesel.getActiveStatus());
|
||||||
|
}
|
||||||
|
if(ObjectUtils.isNotEmpty(cardFuelDiesel.getType())) {
|
||||||
|
queryWrapper.eq(CardFuelDiesel::getType,cardFuelDiesel.getType());
|
||||||
|
}
|
||||||
|
queryWrapper.eq(CardFuelDiesel::getStoreId, TokenUtil.getNowAccountInfo().getStoreId());
|
||||||
|
queryWrapper.orderByDesc(CardFuelDiesel::getCreateTime);
|
||||||
|
IPage page1 = page(page, queryWrapper);
|
||||||
|
List<CardFuelDiesel> records = page1.getRecords();
|
||||||
|
//返回囤油卡状态
|
||||||
|
for (CardFuelDiesel record : records) {
|
||||||
|
record.setOilType(oilNameService.selectOilNameById(Integer.parseInt(record.getOilType())).getOilName());
|
||||||
|
record.setStatus(record.getStatus().equals("1") ? "true" : "false");
|
||||||
|
if(ObjectUtils.isNotEmpty(record.getActiveTime()) && "1".equals(record.getActiveTime())){
|
||||||
|
record.setActivityProgress("1");
|
||||||
|
}
|
||||||
|
//活动进度状态
|
||||||
|
if (ObjectUtils.isNotEmpty(record.getStartTime()) &&
|
||||||
|
ObjectUtils.isNotEmpty(record.getEndTime()) &&
|
||||||
|
record.getActiveTime().equals("2")){
|
||||||
|
record.setActivityProgress(record.getStartTime().getTime() > new Date().getTime() ? "0" : "");
|
||||||
|
if(ObjectUtils.isEmpty(record.getActivityProgress())){
|
||||||
|
record.setActivityProgress(record.getEndTime().getTime() > new Date().getTime() ? "1" : "2");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return page1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,19 +1,11 @@
|
|||||||
package com.fuint.business.marketingActivity.cardGift.controller;
|
package com.fuint.business.marketingActivity.cardGift.controller;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.fuint.business.marketingActivity.cardGift.entity.CardGift;
|
import com.fuint.business.marketingActivity.cardGift.entity.CardGift;
|
||||||
import com.fuint.business.marketingActivity.cardGift.service.CardGiftService;
|
import com.fuint.business.marketingActivity.cardGift.service.CardGiftService;
|
||||||
import com.fuint.business.marketingActivity.cardValue.entity.CardValue;
|
|
||||||
import com.fuint.common.util.TokenUtil;
|
|
||||||
import com.fuint.framework.web.BaseController;
|
import com.fuint.framework.web.BaseController;
|
||||||
import com.fuint.framework.web.ResponseObject;
|
import com.fuint.framework.web.ResponseObject;
|
||||||
import com.fuint.utils.ObjectUtil;
|
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@ -48,23 +40,7 @@ public class CardGiftController extends BaseController {
|
|||||||
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
|
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
|
||||||
@Param("cardGift") CardGift cardGift) {
|
@Param("cardGift") CardGift cardGift) {
|
||||||
Page page = new Page(pageNo, pageSize);
|
Page page = new Page(pageNo, pageSize);
|
||||||
LambdaQueryWrapper<CardGift> queryWrapper = new LambdaQueryWrapper<>();
|
return getSuccessResult(this.cardGiftService.select(page, cardGift));
|
||||||
//构建查询条件
|
|
||||||
if(ObjectUtils.isNotEmpty(cardGift.getNumber())){
|
|
||||||
queryWrapper.like(CardGift::getNumber,cardGift.getNumber());
|
|
||||||
}
|
|
||||||
if(ObjectUtils.isNotEmpty(cardGift.getRemark())){
|
|
||||||
queryWrapper.like(CardGift::getRemark,cardGift.getRemark());
|
|
||||||
}
|
|
||||||
if(ObjectUtils.isNotEmpty(cardGift.getActivateStatus())) {
|
|
||||||
queryWrapper.eq(CardGift::getActivateStatus,cardGift.getActivateStatus());
|
|
||||||
}
|
|
||||||
if(ObjectUtils.isNotEmpty(cardGift.getStatus())) {
|
|
||||||
queryWrapper.eq(CardGift::getStatus,cardGift.getStatus());
|
|
||||||
}
|
|
||||||
queryWrapper.eq(CardGift::getStoreId, TokenUtil.getNowAccountInfo().getStoreId());
|
|
||||||
queryWrapper.orderByDesc(CardGift::getCreateTime);
|
|
||||||
return getSuccessResult(this.cardGiftService.page(page, queryWrapper));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.fuint.business.marketingActivity.cardGift.service;
|
package com.fuint.business.marketingActivity.cardGift.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.fuint.business.marketingActivity.cardGift.entity.CardGift;
|
import com.fuint.business.marketingActivity.cardGift.entity.CardGift;
|
||||||
import com.fuint.business.petrolStationManagement.entity.OilGun;
|
import com.fuint.business.petrolStationManagement.entity.OilGun;
|
||||||
@ -27,5 +29,13 @@ public interface CardGiftService extends IService<CardGift> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Map<String, Long> selectStatistics(Integer storeId);
|
Map<String, Long> selectStatistics(Integer storeId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询所有数据
|
||||||
|
* @param page
|
||||||
|
* @param cardGift
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
IPage select(Page page, CardGift cardGift);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.fuint.business.marketingActivity.cardGift.service.impl;
|
package com.fuint.business.marketingActivity.cardGift.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.fuint.business.marketingActivity.cardGift.mapper.CardGiftMapper;
|
import com.fuint.business.marketingActivity.cardGift.mapper.CardGiftMapper;
|
||||||
import com.fuint.business.marketingActivity.cardGift.entity.CardGift;
|
import com.fuint.business.marketingActivity.cardGift.entity.CardGift;
|
||||||
@ -102,5 +104,32 @@ public class CardGiftServiceImpl extends ServiceImpl<CardGiftMapper, CardGift> i
|
|||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询所有数据
|
||||||
|
* @param page
|
||||||
|
* @param cardGift
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public IPage select(Page page, CardGift cardGift) {
|
||||||
|
LambdaQueryWrapper<CardGift> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
//构建查询条件
|
||||||
|
if(ObjectUtils.isNotEmpty(cardGift.getNumber())){
|
||||||
|
queryWrapper.like(CardGift::getNumber,cardGift.getNumber());
|
||||||
|
}
|
||||||
|
if(ObjectUtils.isNotEmpty(cardGift.getRemark())){
|
||||||
|
queryWrapper.like(CardGift::getRemark,cardGift.getRemark());
|
||||||
|
}
|
||||||
|
if(ObjectUtils.isNotEmpty(cardGift.getActivateStatus())) {
|
||||||
|
queryWrapper.eq(CardGift::getActivateStatus,cardGift.getActivateStatus());
|
||||||
|
}
|
||||||
|
if(ObjectUtils.isNotEmpty(cardGift.getStatus())) {
|
||||||
|
queryWrapper.eq(CardGift::getStatus,cardGift.getStatus());
|
||||||
|
}
|
||||||
|
queryWrapper.eq(CardGift::getStoreId, TokenUtil.getNowAccountInfo().getStoreId());
|
||||||
|
queryWrapper.orderByDesc(CardGift::getCreateTime);
|
||||||
|
return page(page, queryWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,33 +1,18 @@
|
|||||||
package com.fuint.business.marketingActivity.cardValue.controller;
|
package com.fuint.business.marketingActivity.cardValue.controller;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
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.plugins.pagination.Page;
|
||||||
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable;
|
|
||||||
import com.fuint.business.marketingActivity.cardValue.dto.CardValueDTO;
|
import com.fuint.business.marketingActivity.cardValue.dto.CardValueDTO;
|
||||||
import com.fuint.business.marketingActivity.cardValue.entity.CardValue;
|
import com.fuint.business.marketingActivity.cardValue.entity.CardValue;
|
||||||
import com.fuint.business.marketingActivity.cardValue.entity.CardValueChild;
|
|
||||||
import com.fuint.business.marketingActivity.cardValue.service.CardValueChildService;
|
|
||||||
import com.fuint.business.marketingActivity.cardValue.service.CardValueService;
|
import com.fuint.business.marketingActivity.cardValue.service.CardValueService;
|
||||||
import com.fuint.business.marketingActivity.cardValue.vo.CardValueVO;
|
|
||||||
import com.fuint.business.store.service.StoreService;
|
|
||||||
import com.fuint.common.util.TokenUtil;
|
|
||||||
import com.fuint.framework.web.BaseController;
|
import com.fuint.framework.web.BaseController;
|
||||||
import com.fuint.framework.web.ResponseObject;
|
import com.fuint.framework.web.ResponseObject;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.beans.BeanUtils;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 储值卡表(CardValue)表控制层
|
* 储值卡表(CardValue)表控制层
|
||||||
@ -44,12 +29,6 @@ public class CardValueController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CardValueService cardValueService;
|
private CardValueService cardValueService;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private StoreService storeService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CardValueChildService cardValueChildService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询所有数据
|
* 分页查询所有数据
|
||||||
* @param pageNo
|
* @param pageNo
|
||||||
@ -62,33 +41,7 @@ public class CardValueController extends BaseController {
|
|||||||
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
|
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
|
||||||
@Param("cardValue") CardValue cardValue) {
|
@Param("cardValue") CardValue cardValue) {
|
||||||
Page page = new Page(pageNo, pageSize);
|
Page page = new Page(pageNo, pageSize);
|
||||||
LambdaQueryWrapper<CardValue> queryWrapper = new LambdaQueryWrapper<>();
|
return getSuccessResult(this.cardValueService.select(page, cardValue));
|
||||||
//构建查询条件
|
|
||||||
if (ObjectUtils.isNotEmpty(cardValue.getIsonline())){
|
|
||||||
queryWrapper.eq(CardValue::getIsonline,cardValue.getIsonline());
|
|
||||||
}
|
|
||||||
if (ObjectUtils.isNotEmpty(cardValue.getActiveStatus())){
|
|
||||||
queryWrapper.eq(CardValue::getActiveStatus,cardValue.getActiveStatus());
|
|
||||||
}
|
|
||||||
queryWrapper.eq(CardValue::getStoreId,TokenUtil.getNowAccountInfo().getStoreId());
|
|
||||||
queryWrapper.orderByDesc(CardValue::getCreateTime);
|
|
||||||
IPage page1 = this.cardValueService.page(page, queryWrapper);
|
|
||||||
List<CardValue> records = page1.getRecords();
|
|
||||||
//返回储值卡活动进度状态
|
|
||||||
for (CardValue record : records) {
|
|
||||||
if(ObjectUtils.isNotEmpty(record.getActiveTime()) && record.getActiveTime().equals("1")){
|
|
||||||
record.setActivityProgress("1");
|
|
||||||
}
|
|
||||||
if (ObjectUtils.isNotEmpty(record.getStartTime()) &&
|
|
||||||
ObjectUtils.isNotEmpty(record.getEndTime()) &&
|
|
||||||
record.getActiveTime().equals("2")){
|
|
||||||
record.setActivityProgress(record.getStartTime().getTime() > new Date().getTime() ? "0" : "");
|
|
||||||
if(ObjectUtils.isEmpty(record.getActivityProgress())){
|
|
||||||
record.setActivityProgress(record.getEndTime().getTime() > new Date().getTime() ? "1" : "2");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return getSuccessResult(page1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -110,27 +63,7 @@ public class CardValueController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/selectById/{id}")
|
@GetMapping("/selectById/{id}")
|
||||||
public ResponseObject selectById(@PathVariable Serializable id) {
|
public ResponseObject selectById(@PathVariable Serializable id) {
|
||||||
CardValueVO cardValueVO = new CardValueVO();
|
return getSuccessResult(this.cardValueService.getOneById(id));
|
||||||
if (ObjectUtils.isNotEmpty(id)){
|
|
||||||
//获取新人有礼活动信息
|
|
||||||
CardValue cardValue = this.cardValueService.getById(id);
|
|
||||||
//获取兑换物品信息
|
|
||||||
LambdaQueryWrapper<CardValueChild> queryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
queryWrapper.eq(CardValueChild::getCardValueId,id);
|
|
||||||
queryWrapper.orderByDesc(CardValueChild::getCreateTime);
|
|
||||||
List<CardValueChild> activeNewlywedsChildList = cardValueChildService.list(queryWrapper);
|
|
||||||
BeanUtils.copyProperties(cardValue,cardValueVO);
|
|
||||||
cardValueVO.setMembershipLevel(cardValue.getMembershipLevel().split(","));
|
|
||||||
if (CollectionUtils.isNotEmpty(activeNewlywedsChildList)){
|
|
||||||
//封装VO返回
|
|
||||||
cardValueVO.setCardValueChildList(activeNewlywedsChildList);
|
|
||||||
}else {
|
|
||||||
cardValueVO.setCardValueChildList(new ArrayList<>());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return getSuccessResult(cardValueVO);
|
|
||||||
|
|
||||||
//return getSuccessResult(this.cardValueService.getById(id));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -141,39 +74,7 @@ public class CardValueController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public ResponseObject insert(@RequestBody CardValueDTO cardValueDTO) {
|
public ResponseObject insert(@RequestBody CardValueDTO cardValueDTO) {
|
||||||
boolean save = false;
|
return getSuccessResult(this.cardValueService.add(cardValueDTO));
|
||||||
//获取当前店铺的id和连锁店id
|
|
||||||
if (ObjectUtils.isNotEmpty(TokenUtil.getNowAccountInfo().getStoreId())) {
|
|
||||||
cardValueDTO.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
|
|
||||||
cardValueDTO.setChainStoreId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId());
|
|
||||||
}
|
|
||||||
//新增折扣营销活动模板
|
|
||||||
CardValue cardValue = new CardValue();
|
|
||||||
cardValue.setStartTime(new Date());
|
|
||||||
cardValue.setEndTime(new Date());
|
|
||||||
//柴油会员等级
|
|
||||||
cardValue.setMembershipLevel(arrayToString(cardValueDTO.getMembershipLevel()));
|
|
||||||
if (ObjectUtils.isNotEmpty(cardValueDTO)){
|
|
||||||
BeanUtils.copyProperties(cardValueDTO,cardValue);
|
|
||||||
save = this.cardValueService.save(cardValue);
|
|
||||||
}
|
|
||||||
//新增兑换物品
|
|
||||||
List<CardValueChild> cardValueChildList = cardValueDTO.getCardValueChildList();
|
|
||||||
cardValueChildList.stream().map(s ->{
|
|
||||||
s.setCardValueId(cardValue.getId());
|
|
||||||
return s;
|
|
||||||
}).collect(Collectors.toList());
|
|
||||||
save = cardValueChildService.saveBatch(cardValueChildList);
|
|
||||||
return getSuccessResult(save);
|
|
||||||
|
|
||||||
/*//获取当前店铺的id和连锁店id
|
|
||||||
if (ObjectUtils.isNotEmpty(TokenUtil.getNowAccountInfo().getStoreId())) {
|
|
||||||
cardValue.setStartTime(new Date());
|
|
||||||
cardValue.setEndTime(new Date());
|
|
||||||
cardValue.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
|
|
||||||
cardValue.setChainStoreId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId());
|
|
||||||
}
|
|
||||||
return getSuccessResult(this.cardValueService.save(cardValue));*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -184,31 +85,7 @@ public class CardValueController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public ResponseObject update(@RequestBody CardValueDTO cardValueDTO) {
|
public ResponseObject update(@RequestBody CardValueDTO cardValueDTO) {
|
||||||
|
return getSuccessResult(this.cardValueService.updateOneById(cardValueDTO));
|
||||||
boolean update = false;
|
|
||||||
//更新新人有礼活动
|
|
||||||
CardValue cardValue = new CardValue();
|
|
||||||
BeanUtils.copyProperties(cardValueDTO,cardValue);
|
|
||||||
if (cardValueDTO.getIsonline().equals("1")){
|
|
||||||
cardValue.setActiveStatus("2");
|
|
||||||
}
|
|
||||||
update =this.cardValueService.updateById(cardValue);
|
|
||||||
//更新子表数据
|
|
||||||
LambdaQueryWrapper<CardValueChild> queryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
queryWrapper.eq(CardValueChild::getCardValueId,cardValueDTO.getId());
|
|
||||||
cardValueChildService.remove(queryWrapper);
|
|
||||||
//新增兑换物品
|
|
||||||
List<CardValueChild> cardValueChildList = cardValueDTO.getCardValueChildList();
|
|
||||||
if (CollectionUtils.isNotEmpty(cardValueChildList)){
|
|
||||||
cardValueChildList.stream().map(s ->{
|
|
||||||
s.setCardValueId(cardValue.getId());
|
|
||||||
return s;
|
|
||||||
}).collect(Collectors.toList());
|
|
||||||
update = cardValueChildService.saveBatch(cardValueChildList);
|
|
||||||
}
|
|
||||||
return getSuccessResult(update);
|
|
||||||
|
|
||||||
//return getSuccessResult(this.cardValueService.updateById(cardValue));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -221,18 +98,5 @@ public class CardValueController extends BaseController {
|
|||||||
public ResponseObject delete(@RequestParam("idList") List<Long> idList) {
|
public ResponseObject delete(@RequestParam("idList") List<Long> idList) {
|
||||||
return getSuccessResult(this.cardValueService.removeByIds(idList));
|
return getSuccessResult(this.cardValueService.removeByIds(idList));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 数组转字符串
|
|
||||||
* @param array
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String arrayToString(String[] array){
|
|
||||||
String result = "";
|
|
||||||
for (String s : array) {
|
|
||||||
result += s + ",";
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,13 @@
|
|||||||
package com.fuint.business.marketingActivity.cardValue.service;
|
package com.fuint.business.marketingActivity.cardValue.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.fuint.business.marketingActivity.cardValue.dto.CardValueDTO;
|
||||||
import com.fuint.business.marketingActivity.cardValue.entity.CardValue;
|
import com.fuint.business.marketingActivity.cardValue.entity.CardValue;
|
||||||
|
import com.fuint.business.marketingActivity.cardValue.vo.CardValueVO;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 储值卡表(CardValue)表服务接口
|
* 储值卡表(CardValue)表服务接口
|
||||||
@ -11,5 +17,33 @@ import com.fuint.business.marketingActivity.cardValue.entity.CardValue;
|
|||||||
*/
|
*/
|
||||||
public interface CardValueService extends IService<CardValue> {
|
public interface CardValueService extends IService<CardValue> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询所有数据
|
||||||
|
* @param page
|
||||||
|
* @param cardValue
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
IPage select(Page page, CardValue cardValue);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过主键查询单条数据(充值)
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
CardValueVO getOneById(Serializable id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
* @param cardValueDTO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean add(CardValueDTO cardValueDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据
|
||||||
|
* @param cardValueDTO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean updateOneById(CardValueDTO cardValueDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,30 @@
|
|||||||
package com.fuint.business.marketingActivity.cardValue.service.impl;
|
package com.fuint.business.marketingActivity.cardValue.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.fuint.business.marketingActivity.cardValue.dto.CardValueDTO;
|
||||||
|
import com.fuint.business.marketingActivity.cardValue.entity.CardValueChild;
|
||||||
import com.fuint.business.marketingActivity.cardValue.mapper.CardValueMapper;
|
import com.fuint.business.marketingActivity.cardValue.mapper.CardValueMapper;
|
||||||
import com.fuint.business.marketingActivity.cardValue.entity.CardValue;
|
import com.fuint.business.marketingActivity.cardValue.entity.CardValue;
|
||||||
|
import com.fuint.business.marketingActivity.cardValue.service.CardValueChildService;
|
||||||
import com.fuint.business.marketingActivity.cardValue.service.CardValueService;
|
import com.fuint.business.marketingActivity.cardValue.service.CardValueService;
|
||||||
|
import com.fuint.business.marketingActivity.cardValue.vo.CardValueVO;
|
||||||
|
import com.fuint.business.store.service.StoreService;
|
||||||
|
import com.fuint.common.util.TokenUtil;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 储值卡表(CardValue)表服务实现类
|
* 储值卡表(CardValue)表服务实现类
|
||||||
*
|
*
|
||||||
@ -15,5 +34,150 @@ import org.springframework.stereotype.Service;
|
|||||||
@Service("cardValueService")
|
@Service("cardValueService")
|
||||||
public class CardValueServiceImpl extends ServiceImpl<CardValueMapper, CardValue> implements CardValueService {
|
public class CardValueServiceImpl extends ServiceImpl<CardValueMapper, CardValue> implements CardValueService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CardValueChildService cardValueChildService;
|
||||||
|
@Resource
|
||||||
|
private StoreService storeService;
|
||||||
|
/**
|
||||||
|
* 分页查询所有数据
|
||||||
|
* @param page
|
||||||
|
* @param cardValue
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public IPage select(Page page, CardValue cardValue) {
|
||||||
|
LambdaQueryWrapper<CardValue> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
//构建查询条件
|
||||||
|
if (ObjectUtils.isNotEmpty(cardValue.getIsonline())){
|
||||||
|
queryWrapper.eq(CardValue::getIsonline,cardValue.getIsonline());
|
||||||
|
}
|
||||||
|
if (ObjectUtils.isNotEmpty(cardValue.getActiveStatus())){
|
||||||
|
queryWrapper.eq(CardValue::getActiveStatus,cardValue.getActiveStatus());
|
||||||
|
}
|
||||||
|
queryWrapper.eq(CardValue::getStoreId, TokenUtil.getNowAccountInfo().getStoreId());
|
||||||
|
queryWrapper.orderByDesc(CardValue::getCreateTime);
|
||||||
|
IPage page1 = page(page, queryWrapper);
|
||||||
|
List<CardValue> records = page1.getRecords();
|
||||||
|
//返回储值卡活动进度状态
|
||||||
|
for (CardValue record : records) {
|
||||||
|
if(ObjectUtils.isNotEmpty(record.getActiveTime()) && record.getActiveTime().equals("1")){
|
||||||
|
record.setActivityProgress("1");
|
||||||
|
}
|
||||||
|
if (ObjectUtils.isNotEmpty(record.getStartTime()) &&
|
||||||
|
ObjectUtils.isNotEmpty(record.getEndTime()) &&
|
||||||
|
record.getActiveTime().equals("2")){
|
||||||
|
record.setActivityProgress(record.getStartTime().getTime() > new Date().getTime() ? "0" : "");
|
||||||
|
if(ObjectUtils.isEmpty(record.getActivityProgress())){
|
||||||
|
record.setActivityProgress(record.getEndTime().getTime() > new Date().getTime() ? "1" : "2");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return page1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过主键查询单条数据(充值)
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public CardValueVO getOneById(Serializable id) {
|
||||||
|
CardValueVO cardValueVO = new CardValueVO();
|
||||||
|
if (ObjectUtils.isNotEmpty(id)){
|
||||||
|
//获取新人有礼活动信息
|
||||||
|
CardValue cardValue = getById(id);
|
||||||
|
//获取兑换物品信息
|
||||||
|
LambdaQueryWrapper<CardValueChild> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(CardValueChild::getCardValueId,id);
|
||||||
|
queryWrapper.orderByDesc(CardValueChild::getCreateTime);
|
||||||
|
List<CardValueChild> activeNewlywedsChildList = cardValueChildService.list(queryWrapper);
|
||||||
|
BeanUtils.copyProperties(cardValue,cardValueVO);
|
||||||
|
cardValueVO.setMembershipLevel(cardValue.getMembershipLevel().split(","));
|
||||||
|
if (CollectionUtils.isNotEmpty(activeNewlywedsChildList)){
|
||||||
|
//封装VO返回
|
||||||
|
cardValueVO.setCardValueChildList(activeNewlywedsChildList);
|
||||||
|
}else {
|
||||||
|
cardValueVO.setCardValueChildList(new ArrayList<>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cardValueVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
* @param cardValueDTO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean add(CardValueDTO cardValueDTO) {
|
||||||
|
boolean save = false;
|
||||||
|
//获取当前店铺的id和连锁店id
|
||||||
|
if (ObjectUtils.isNotEmpty(TokenUtil.getNowAccountInfo().getStoreId())) {
|
||||||
|
cardValueDTO.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
|
||||||
|
cardValueDTO.setChainStoreId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId());
|
||||||
|
}
|
||||||
|
//新增折扣营销活动模板
|
||||||
|
CardValue cardValue = new CardValue();
|
||||||
|
cardValue.setStartTime(new Date());
|
||||||
|
cardValue.setEndTime(new Date());
|
||||||
|
//柴油会员等级
|
||||||
|
cardValue.setMembershipLevel(arrayToString(cardValueDTO.getMembershipLevel()));
|
||||||
|
if (ObjectUtils.isNotEmpty(cardValueDTO)){
|
||||||
|
BeanUtils.copyProperties(cardValueDTO,cardValue);
|
||||||
|
save = save(cardValue);
|
||||||
|
}
|
||||||
|
//新增兑换物品
|
||||||
|
List<CardValueChild> cardValueChildList = cardValueDTO.getCardValueChildList();
|
||||||
|
cardValueChildList.stream().map(s ->{
|
||||||
|
s.setCardValueId(cardValue.getId());
|
||||||
|
return s;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
save = cardValueChildService.saveBatch(cardValueChildList);
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据
|
||||||
|
* @param cardValueDTO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean updateOneById(CardValueDTO cardValueDTO) {
|
||||||
|
boolean update = false;
|
||||||
|
//更新新人有礼活动
|
||||||
|
CardValue cardValue = new CardValue();
|
||||||
|
BeanUtils.copyProperties(cardValueDTO,cardValue);
|
||||||
|
if (cardValueDTO.getIsonline().equals("1")){
|
||||||
|
cardValue.setActiveStatus("2");
|
||||||
|
}
|
||||||
|
update =updateById(cardValue);
|
||||||
|
//更新子表数据
|
||||||
|
LambdaQueryWrapper<CardValueChild> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(CardValueChild::getCardValueId,cardValueDTO.getId());
|
||||||
|
cardValueChildService.remove(queryWrapper);
|
||||||
|
//新增兑换物品
|
||||||
|
List<CardValueChild> cardValueChildList = cardValueDTO.getCardValueChildList();
|
||||||
|
if (CollectionUtils.isNotEmpty(cardValueChildList)){
|
||||||
|
cardValueChildList.stream().map(s ->{
|
||||||
|
s.setCardValueId(cardValue.getId());
|
||||||
|
return s;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
update = cardValueChildService.saveBatch(cardValueChildList);
|
||||||
|
}
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数组转字符串
|
||||||
|
* @param array
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String arrayToString(String[] array){
|
||||||
|
String result = "";
|
||||||
|
for (String s : array) {
|
||||||
|
result += s + ",";
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,10 +28,12 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="box-hui">
|
<view class="box-hui">
|
||||||
<view style="margin-bottom: 15px;">充值{{text}}元权益</view>
|
<view style="margin-bottom: 15px;">充值{{text}}元权益</view>
|
||||||
<view class="huisize" v-if="fringeBenefit">{{1}}.{{fringeBenefit}}</view>
|
<view class="huisize" v-for="(item,index) in shuomingList" :key="index">
|
||||||
<view class="huisize" v-if="giftBalance">{{2}}.赠送金额{{giftBalance}}</view>
|
{{index+1}}.{{item || "" }}
|
||||||
<view class="huisize" v-if="points">{{3}}.赠送积分{{points}}</view>
|
</view>
|
||||||
<view class="huisize" v-if="growthValue">{{4}}.赠送成长值{{growthValue}}</view>
|
<!-- <view class="huisize" v-if="giftBalance">2.赠送金额{{giftBalance}}</view>
|
||||||
|
<view class="huisize" v-if="points">3.赠送积分{{points}}</view>
|
||||||
|
<view class="huisize" v-if="growthValue">4.赠送成长值{{growthValue}}</view> -->
|
||||||
<!-- <view class="huisize" v-if="fringeBenefit">{{index + 1}}.{{fringeBenefit}}</view> -->
|
<!-- <view class="huisize" v-if="fringeBenefit">{{index + 1}}.{{fringeBenefit}}</view> -->
|
||||||
</view>
|
</view>
|
||||||
<view class="box-gang">
|
<view class="box-gang">
|
||||||
@ -94,6 +96,7 @@
|
|||||||
points: "",
|
points: "",
|
||||||
growthValue: "",
|
growthValue: "",
|
||||||
show: false,
|
show: false,
|
||||||
|
shuomingList: [],
|
||||||
columns: [
|
columns: [
|
||||||
['员工一', '员工二', '员工三']
|
['员工一', '员工二', '员工三']
|
||||||
],
|
],
|
||||||
@ -118,6 +121,7 @@
|
|||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.getValueCars();
|
this.getValueCars();
|
||||||
|
// this.xzindex(index, text, fringeBenefit, giftBalance, points, growthValue)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
confirm(e) {
|
confirm(e) {
|
||||||
@ -127,12 +131,31 @@
|
|||||||
this.show = false
|
this.show = false
|
||||||
},
|
},
|
||||||
xzindex(index, text, fringeBenefit, giftBalance, points, growthValue) {
|
xzindex(index, text, fringeBenefit, giftBalance, points, growthValue) {
|
||||||
this.actindex = index
|
this.shuomingList = []
|
||||||
|
console.log(this.shuomingList);
|
||||||
|
if (text) {
|
||||||
this.text = text
|
this.text = text
|
||||||
this.fringeBenefit = fringeBenefit
|
}
|
||||||
this.giftBalance = giftBalance
|
if (fringeBenefit) {
|
||||||
this.points = points
|
this.shuomingList.push(fringeBenefit)
|
||||||
this.growthValue = growthValue
|
}
|
||||||
|
if (giftBalance) {
|
||||||
|
this.shuomingList.push('赠送' + giftBalance + '金额')
|
||||||
|
}
|
||||||
|
if (points) {
|
||||||
|
this.shuomingList.push('赠送' + points + '积分')
|
||||||
|
}
|
||||||
|
if (growthValue) {
|
||||||
|
this.shuomingList.push('赠送' + growthValue + '成长值')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
this.actindex = index
|
||||||
|
// this.text = text
|
||||||
|
// this.fringeBenefit = fringeBenefit
|
||||||
|
// this.giftBalance = giftBalance
|
||||||
|
// this.points = points
|
||||||
|
// this.growthValue = growthValue
|
||||||
},
|
},
|
||||||
getindex(index) {
|
getindex(index) {
|
||||||
this.actinput = index
|
this.actinput = index
|
||||||
@ -148,7 +171,15 @@
|
|||||||
activeStatus: '1'
|
activeStatus: '1'
|
||||||
},
|
},
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
|
this.cardValueList = []
|
||||||
|
if (res.code == 200) {
|
||||||
this.cardValueList = res.data.records
|
this.cardValueList = res.data.records
|
||||||
|
this.xzindex(0, this.cardValueList[0].rechargeBalance, this.cardValueList[0].fringeBenefit,
|
||||||
|
this.cardValueList[0].giftBalance, this.cardValueList[0].points, this
|
||||||
|
.cardValueList[0].growthValue)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import config from '@/config'
|
import config from '@/config'
|
||||||
import request from '../../utils/request'
|
import request from '../../utils/request'
|
||||||
import BigNumber from 'bignumber.js';
|
/* import BigNumber from 'bignumber.js'; */
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user