积分
This commit is contained in:
parent
42b625266d
commit
b1b4e1c94d
@ -76,15 +76,15 @@
|
||||
|
||||
<template v-if="dataForm.refuelSceneRules == 0">
|
||||
<el-row>
|
||||
<el-form-item label="消费金额" prop="refuelConsumptionAmount" label-width="90px">
|
||||
<el-input style="width: 500px;" v-model="dataForm.refuelConsumptionAmount" placeholder="???">
|
||||
<el-form-item label="消费金额" prop="refuelFuelAmount" label-width="90px">
|
||||
<el-input style="width: 500px;" v-model="dataForm.refuelFuelAmount" placeholder="???">
|
||||
<template slot="append">元</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-form-item label="积多少分" prop="refuelPoints" label-width="90px">
|
||||
<el-input style="width: 500px;" v-model="dataForm.refuelPoints" placeholder="???">
|
||||
<el-input style="width: 500px;" v-model.number="dataForm.refuelPoints" placeholder="???">
|
||||
<template slot="append">元</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
@ -94,16 +94,18 @@
|
||||
<div class="conten-bottom">
|
||||
<div v-for="(item, index) in dataForm.refuelConsumptionAmount" class="cardbox">
|
||||
<div style="height:40px; ">
|
||||
<span>92#汽油</span>
|
||||
<span>{{ item.oilName }}</span>
|
||||
</div>
|
||||
<div style=" width: 99%;height: 99%;">
|
||||
<el-form-item label="消费金额" prop="refuelPointsRules" label-width="90px">
|
||||
<el-input style="width: 200px;" v-model="dataForm.refuelPointsRules" placeholder="???">
|
||||
<el-form-item label="消费金额" prop="amount" label-width="90px">
|
||||
<el-input style="width: 200px;" v-model="item.amount" placeholder="???">
|
||||
<!-- {{ item.amount }} -->
|
||||
<template slot="append">元</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="积多少分" prop="refuelPointsRules" label-width="90px">
|
||||
<el-input style="width: 200px;" v-model="dataForm.refuelPointsRules" placeholder="???">
|
||||
<el-form-item label="积多少分" prop="points" label-width="90px">
|
||||
<el-input style="width: 200px;" v-model.number="item.integral" placeholder="???">
|
||||
<!-- {{ parseInt(item.integral) }} -->
|
||||
<template slot="append">积分</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
@ -118,14 +120,14 @@
|
||||
</el-form>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="充值积分" name="second">
|
||||
<!-- <el-tab-pane label="充值积分" name="second">
|
||||
<div>
|
||||
<el-alert
|
||||
title="充值赠送积分详细规则请在充值活动对应规则内配置"
|
||||
type="warning"
|
||||
show-icon>
|
||||
</el-alert>
|
||||
<el-form :model="refuelForm" ref="refuelForm" :rules="rules" size="small" :inline="true" label-width="100px">
|
||||
<el-form :model="dataForm" ref="dataForm" :rules="rules" size="small" :inline="true" label-width="100px">
|
||||
<el-row>
|
||||
<el-form-item label="充值赠送" prop="rechargeGive" >
|
||||
<el-radio-group v-model="dataForm.rechargeGive">
|
||||
@ -136,7 +138,7 @@
|
||||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tab-pane> -->
|
||||
<el-tab-pane label="邀请用户" name="third">
|
||||
<div>
|
||||
<el-alert
|
||||
@ -144,7 +146,7 @@
|
||||
type="info"
|
||||
show-icon>
|
||||
</el-alert>
|
||||
<el-form :model="refuelForm" ref="refuelForm" :rules="rules" size="small" :inline="true" label-width="100px">
|
||||
<el-form :model="dataForm" ref="dataForm" :rules="rules" size="small" :inline="true" label-width="100px">
|
||||
<el-row>
|
||||
<el-form-item label="邀请赠送" prop="inviteGive" >
|
||||
<el-radio-group v-model="dataForm.inviteGive">
|
||||
@ -154,8 +156,8 @@
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-form-item label="充值赠送" prop="inviteGiveRules" >
|
||||
<el-input v-model="dataForm.inviteGiveRules" placeholder="???">
|
||||
<el-form-item label="充值赠送" prop="rechargeGive" >
|
||||
<el-input v-model.number="dataForm.rechargeGive" placeholder="???">
|
||||
<template slot="prepend">每邀请一人赠送</template>
|
||||
<template slot="append">积分</template>
|
||||
|
||||
@ -178,7 +180,7 @@
|
||||
<div style="width: 100%; margin-top: 20px;">
|
||||
|
||||
<el-form-item style="width: 24%" v-for="item, index in dataForm.pointsObtained" :key="index" :prop="'pointsObtained' + index" :label="item.day">
|
||||
<el-input v-model="item.integral" placeholder="???">
|
||||
<el-input v-model.number="item.integral" placeholder="???">
|
||||
<template slot="append">积分</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
@ -207,16 +209,17 @@
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="积分规则" name="five">
|
||||
<div>
|
||||
<el-form :model="refuelForm" ref="refuelForm" :rules="rules" size="small" :inline="true" label-width="100px">
|
||||
<el-form :model="dataForm" ref="dataForm" :rules="rules" size="small" :inline="true" label-width="100px">
|
||||
<!-- <el-row> -->
|
||||
<span style="margin-bottom: 20px;">积分说明</span>
|
||||
<Editor style="margin-top: 20px;"></Editor>
|
||||
<editor style="margin-top: 20px;" @input="handleChildValue" :value.default="dataForm.pointsRules" :height.default="500"></editor>
|
||||
|
||||
<!-- </el-row> -->
|
||||
</el-form>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<div style="float: right; margin-bottom: 20px;">
|
||||
<div style="float: right;margin-top: 20px; margin-bottom: 20px;">
|
||||
<el-button type="primary" @click="submit">确 定</el-button>
|
||||
</div>
|
||||
</div>
|
||||
@ -225,19 +228,69 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getSettingsApi,insertSettingsApi } from "@/api/integral/settings";
|
||||
import Editor from '@/components/Editor/index'
|
||||
import {getSettingsApi,updateSettingsApi } from "@/api/integral/settings";
|
||||
import editor from '@/components/Editor/index'
|
||||
|
||||
export default {
|
||||
name: "index",
|
||||
components: {Editor},
|
||||
// components: {Editor},
|
||||
|
||||
data() {
|
||||
var valiNumberPass = (rule, value, callback) => {//包含小数的数字
|
||||
parseFloat(value).toFixed(2)
|
||||
let reg = /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g;
|
||||
if (value === '') {
|
||||
callback(new Error('请输入内容'));
|
||||
} else if (!reg.test(value)) {
|
||||
callback(new Error('请输入数字'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
return {
|
||||
|
||||
|
||||
activeName: 'first',
|
||||
|
||||
|
||||
rules:{},
|
||||
rules:{
|
||||
refuelPointsRules:[
|
||||
{ required: true, message: '请选择积分规则', trigger: 'change' }
|
||||
],
|
||||
refuelSceneType:[
|
||||
{ required: true, message: '请选择场景类型', trigger: 'change' }
|
||||
],
|
||||
refuelAmountType:[
|
||||
{ required: true, message: '请选择金额类型', trigger: 'change' }
|
||||
],
|
||||
refuelValueParticipation:[
|
||||
{ required: true, message: '请选择储值参与', trigger: 'change' }
|
||||
],
|
||||
refuelSceneRules:[
|
||||
{ required: true, message: '请选择场景规则', trigger: 'change' }
|
||||
],
|
||||
refuelFuelAmount: [
|
||||
{ required: true, validator:valiNumberPass, trigger: "blur" }
|
||||
],
|
||||
refuelPoints: [
|
||||
{ required: true, message: '输入积分', trigger: "blur" },
|
||||
{ type: 'number', message: '积分必须为数字值'}
|
||||
],
|
||||
// amount:[
|
||||
// {required: true,
|
||||
// validator: (rule, value, callback) => this.valiNumberPass(rule, value, callback, 'amount'),
|
||||
// trigger: 'blur'
|
||||
// }
|
||||
// ],
|
||||
|
||||
rechargeGive:[
|
||||
{ required: true, message: '输入积分', trigger: "blur" },
|
||||
{ type: 'number', message: '积分必须为数字值'}
|
||||
],
|
||||
// points: [
|
||||
// { required: true}
|
||||
// ],
|
||||
},
|
||||
dataForm: {
|
||||
// 积分设置ID
|
||||
id: null,
|
||||
@ -312,11 +365,6 @@ export default {
|
||||
|
||||
},
|
||||
|
||||
|
||||
refuelForm:{
|
||||
refuelPointsRules:'',
|
||||
},
|
||||
signInForm: {}
|
||||
|
||||
|
||||
}
|
||||
@ -325,29 +373,54 @@ export default {
|
||||
this.getData()
|
||||
},
|
||||
methods: {
|
||||
handleChildValue(value) {
|
||||
console.log("vale",value)
|
||||
this.dataForm.pointsRules = value
|
||||
},
|
||||
|
||||
|
||||
getData() {
|
||||
this.dataForm.pointsObtained = JSON.stringify(this.dataForm.pointsObtained);
|
||||
let file = this.dataForm
|
||||
file.pointsObtained = JSON.stringify(file.pointsObtained);
|
||||
file.refuelConsumptionAmount = JSON.stringify(file.refuelConsumptionAmount);
|
||||
|
||||
getSettingsApi(this.dataForm).then(res=>{
|
||||
this.dataForm = res.data
|
||||
this.dataForm.pointsObtained = JSON.parse(this.dataForm.pointsObtained)
|
||||
this.dataForm.refuelConsumptionAmount = JSON.parse(res.data.refuelConsumptionAmount)
|
||||
})
|
||||
},
|
||||
submit() {
|
||||
this.dataForm.pointsObtained = JSON.stringify(this.dataForm.pointsObtained);
|
||||
insertSettingsApi(this.dataForm).then(res=>{
|
||||
let file = this.dataForm
|
||||
file.pointsObtained = JSON.stringify(file.pointsObtained);
|
||||
file.refuelConsumptionAmount = JSON.stringify(file.refuelConsumptionAmount);
|
||||
this.dataForm = {}
|
||||
updateSettingsApi(file).then(res=>{
|
||||
this.$modal.msgSuccess("添加成功");
|
||||
|
||||
this.dataForm = {}
|
||||
res.data.pointsObtained = JSON.parse(res.data.pointsObtained)
|
||||
res.data.refuelConsumptionAmount = JSON.parse(res.data.refuelConsumptionAmount)
|
||||
this.dataForm = res.data
|
||||
}).catch(res=>{
|
||||
this.$modal.msgSuccess("添加失败");
|
||||
|
||||
})
|
||||
// this.getData()
|
||||
|
||||
},
|
||||
cancel() {},
|
||||
handleClick(tab, event) {
|
||||
console.log(tab, event);
|
||||
}
|
||||
}
|
||||
},
|
||||
valiNumberPass(rule, value, callback, fieldName) {
|
||||
this.$nextTick(() => {
|
||||
// 在这里进行自定义验证逻辑,value 应该在这时候被正确设置
|
||||
console.log(`Validating ${fieldName}:`, value);
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -3,6 +3,7 @@ package com.fuint.business.convenienceSore.controller;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.convenienceSore.dto.LJGoodsDto;
|
||||
import com.fuint.business.convenienceSore.entity.LJGoods;
|
||||
import com.fuint.business.convenienceSore.service.LJGoodsService;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
@ -117,4 +118,15 @@ public class LJGoodsController extends BaseController {
|
||||
public ResponseObject edit(@Validated @RequestBody LJGoods goods){
|
||||
return getSuccessResult(goodsService.updateLJGoods(goods));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改该商品库存
|
||||
* @param goods
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("editGoodsInventory")
|
||||
public ResponseObject editGoodsInventory(@RequestBody LJGoodsDto goods){
|
||||
return getSuccessResult(goodsService.editGoodsInventory(goods));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,16 @@
|
||||
package com.fuint.business.convenienceSore.dto;
|
||||
|
||||
import com.fuint.business.convenienceSore.entity.LJGoods;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class LJGoodsDto extends LJGoods {
|
||||
|
||||
// 库存变动
|
||||
private Integer numberOfChanges;
|
||||
private Integer stockId;
|
||||
// 变动原因
|
||||
private String document;
|
||||
|
||||
|
||||
}
|
@ -15,4 +15,6 @@ public interface LJGoodsMapper extends BaseMapper<LJGoods> {
|
||||
* @return
|
||||
*/
|
||||
public IPage<LJGoods> selectLJGoodsList(Page page, @Param("goods") LJGoods goods);
|
||||
|
||||
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fuint.business.convenienceSore.dto.LJGoodsDto;
|
||||
import com.fuint.business.convenienceSore.entity.LJGoods;
|
||||
|
||||
import java.util.List;
|
||||
@ -70,4 +71,7 @@ public interface LJGoodsService extends IService<LJGoods> {
|
||||
* @return
|
||||
*/
|
||||
public int updateLJGoods(LJGoods goods);
|
||||
|
||||
|
||||
boolean editGoodsInventory(LJGoodsDto goods);
|
||||
}
|
||||
|
@ -53,4 +53,8 @@ public interface StockStatisticService extends IService<StockStatistic> {
|
||||
* @return
|
||||
*/
|
||||
public void deleteStock(Integer goodsId);
|
||||
|
||||
public int editStock(StockStatistic stock);
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,11 +1,13 @@
|
||||
package com.fuint.business.convenienceSore.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
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.service.impl.ServiceImpl;
|
||||
import com.fuint.business.convenienceSore.dto.LJGoodsDto;
|
||||
import com.fuint.business.convenienceSore.entity.LJGoods;
|
||||
import com.fuint.business.convenienceSore.entity.StockStatistic;
|
||||
import com.fuint.business.convenienceSore.entity.StockTrack;
|
||||
@ -14,12 +16,19 @@ import com.fuint.business.convenienceSore.service.LJGoodsService;
|
||||
import com.fuint.business.convenienceSore.service.StockStatisticService;
|
||||
import com.fuint.business.convenienceSore.service.StockTrackService;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.StringUtils;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.TransactionDefinition;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
/**
|
||||
* 商品信息 业务层
|
||||
@ -174,4 +183,77 @@ public class LJGoodsServiceImpl extends ServiceImpl<LJGoodsMapper, LJGoods> impl
|
||||
int row = baseMapper.updateById(goods);
|
||||
return row;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean editGoodsInventory(LJGoodsDto goods) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
Integer storeId = nowAccountInfo.getStoreId();
|
||||
goods.setStoreId(storeId);
|
||||
|
||||
QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("id",goods.getId());
|
||||
queryWrapper.eq("store_id",goods.getStoreId());
|
||||
LJGoods ljGoods = baseMapper.selectOne(queryWrapper);
|
||||
// 变动库存
|
||||
if (ObjectUtil.isEmpty(ljGoods)) {
|
||||
return false;
|
||||
}
|
||||
goods.setBuyingPrice(ljGoods.getBuyingPrice());
|
||||
if (!ObjectUtil.isEmpty(ljGoods.getStock()) && !ObjectUtil.isEmpty(goods.getNumberOfChanges())) {
|
||||
goods.setStock(ljGoods.getStock() + goods.getNumberOfChanges());
|
||||
if (goods.getStock()>0) {
|
||||
// 修改该库存
|
||||
int i = baseMapper.updateById(goods);
|
||||
if (i>0) {
|
||||
// 添加统计信息
|
||||
StockStatistic stockStatistic = stockService.selectStockByGoodsId(goods.getId().intValue());
|
||||
goods.setStockId(stockStatistic.getId());
|
||||
boolean b = addStockStatistic(goods);
|
||||
|
||||
if (!ObjectUtil.isEmpty(stockStatistic)) {
|
||||
// 添加库存跟踪信息
|
||||
if (!ObjectUtil.isEmpty(stockStatistic.getId())){
|
||||
goods.setStockId(stockStatistic.getId());
|
||||
addStockTrack(goods);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
throw new Exception("剩余库存已小于0");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return false;
|
||||
}
|
||||
|
||||
// 添加统计信息
|
||||
public boolean addStockStatistic(LJGoodsDto goods) {
|
||||
StockStatistic stock = new StockStatistic();
|
||||
stock.setId(goods.getId());
|
||||
BigDecimal Price = new BigDecimal(goods.getBuyingPrice());
|
||||
BigDecimal Stock = new BigDecimal(goods.getStock());
|
||||
BigDecimal multiply = Price.multiply(Stock);
|
||||
stock.setCostAmount(multiply.doubleValue());
|
||||
int i = stockService.editStock(stock);
|
||||
|
||||
return i>0;
|
||||
}
|
||||
|
||||
// 添加库存跟踪信息
|
||||
public boolean addStockTrack(LJGoodsDto goods) {
|
||||
StockTrack stockTrack = new StockTrack();
|
||||
stockTrack.setStockId(goods.getStockId());
|
||||
stockTrack.setStoreId(goods.getStoreId());
|
||||
stockTrack.setDocument(goods.getDocument());
|
||||
stockTrack.setChangeNumber(goods.getNumberOfChanges());
|
||||
int i = trackService.insertStockTrack(stockTrack);
|
||||
return i>0;
|
||||
}
|
||||
}
|
||||
|
@ -91,4 +91,11 @@ public class StockStatisticServiceImpl extends ServiceImpl<StockStatisticMapper,
|
||||
queryWrapper.eq("goods_id",goodsId);
|
||||
baseMapper.delete(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int editStock(StockStatistic stock) {
|
||||
return baseMapper.updateById(stock);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.fuint.business.convenienceSore.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -8,6 +9,7 @@ import com.fuint.business.convenienceSore.entity.StockTrack;
|
||||
import com.fuint.business.convenienceSore.mapper.StockTrackMapper;
|
||||
import com.fuint.business.convenienceSore.service.StockTrackService;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.StringUtils;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -43,7 +45,7 @@ public class StockTrackServiceImpl extends ServiceImpl<StockTrackMapper, StockTr
|
||||
*/
|
||||
@Override
|
||||
public int insertStockTrack(StockTrack stockTrack) {
|
||||
if (stockTrack.getOddNumber()!=null && stockTrack.getOddNumber()!=""){
|
||||
if (StringUtils.isEmpty(stockTrack.getOddNumber())){
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
String timestamp = dateFormat.format(new Date());
|
||||
String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6);
|
||||
|
@ -0,0 +1,93 @@
|
||||
package com.fuint.business.integral.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.integral.entity.IntegralDetail;
|
||||
import com.fuint.business.integral.service.IntegralDetailService;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.lettuce.core.dynamic.annotation.Param;
|
||||
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 积分明细表(IntegralDetail)表控制层
|
||||
*
|
||||
* @author wangh
|
||||
* @since 2023-11-10 17:52:32
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("integralDetail")
|
||||
public class IntegralDetailController extends BaseController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private IntegralDetailService integralDetailService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param integralDetail 筛选条件
|
||||
* @param pageNo 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
@GetMapping("queryByPage")
|
||||
public ResponseObject queryByPage(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
|
||||
@Param("integralDetail") IntegralDetail integralDetail) {
|
||||
Page page = new Page(pageNo, pageSize);
|
||||
IPage< IntegralDetail> iPageList = this.integralDetailService.queryByPage(page, integralDetail);
|
||||
return getSuccessResult(iPageList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@GetMapping("{id}")
|
||||
public ResponseObject queryById(@PathVariable("id") Integer id) {
|
||||
return getSuccessResult(this.integralDetailService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param integralDetail 实体
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseObject add(@RequestBody IntegralDetail integralDetail) {
|
||||
return getSuccessResult(this.integralDetailService.insert(integralDetail));
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑数据
|
||||
*
|
||||
* @param integralDetail 实体
|
||||
* @return 编辑结果
|
||||
*/
|
||||
@PutMapping
|
||||
public ResponseObject edit(@RequestBody IntegralDetail integralDetail) {
|
||||
return getSuccessResult(this.integralDetailService.update(integralDetail));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 删除是否成功
|
||||
*/
|
||||
@DeleteMapping
|
||||
public ResponseObject deleteById(Integer id) {
|
||||
return getSuccessResult(this.integralDetailService.deleteById(id));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -110,5 +110,29 @@ public class IntegralOrdersController extends BaseController {
|
||||
public ResponseObject statistics() {
|
||||
return getSuccessResult(this.integralOrdersService.statistics());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 礼品订单
|
||||
*
|
||||
* 判断积分是否足够
|
||||
*
|
||||
* 增加订单之前首先判断是否还存在 库存
|
||||
*
|
||||
* 增加积分订单
|
||||
*
|
||||
* 减去积分商城库存
|
||||
*
|
||||
* 减去商品库存
|
||||
*
|
||||
* 减去用户积分
|
||||
*
|
||||
*/
|
||||
@PostMapping("integralOrdersProcessing")
|
||||
public ResponseObject integralOrdersProcessing(@RequestBody IntegralOrders integralOrders) {
|
||||
return getSuccessResult(this.integralOrdersService.integralOrdersProcessing(integralOrders));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,74 @@
|
||||
package com.fuint.business.integral.entity;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fuint.repository.model.base.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 积分明细表(IntegralDetail)实体类
|
||||
*
|
||||
* @author wangh
|
||||
* @since 2023-11-10 17:52:33
|
||||
*/
|
||||
@Data
|
||||
public class IntegralDetail extends BaseEntity {
|
||||
private static final long serialVersionUID = 263718830208700746L;
|
||||
/**
|
||||
* 积分明细ID
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 用户ID,表示积分变动的用户
|
||||
*/
|
||||
private Integer userId;
|
||||
/**
|
||||
* 积分变动的数量,可以是正数表示增加,负数表示减少
|
||||
*/
|
||||
private Integer pointsChange;
|
||||
/**
|
||||
* 变动后用户的当前积分总数
|
||||
*/
|
||||
private Integer currentPoints;
|
||||
/**
|
||||
* 变动类型
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 积分变动的原因,用于记录变动的具体原因或业务场景
|
||||
*/
|
||||
private String changeReason;
|
||||
/**
|
||||
* 店铺ID
|
||||
*/
|
||||
private Integer storeId;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String updateBy;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public class IntegralSettings extends BaseEntity {
|
||||
/**
|
||||
* 加油消费金额
|
||||
*/
|
||||
private Double refuelConsumptionAmount;
|
||||
private String refuelConsumptionAmount;
|
||||
/**
|
||||
* 加油积分
|
||||
*/
|
||||
|
@ -0,0 +1,85 @@
|
||||
package com.fuint.business.integral.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.integral.entity.IntegralDetail;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 积分明细表(IntegralDetail)表数据库访问层
|
||||
*
|
||||
* @author wangh
|
||||
* @since 2023-11-10 17:52:33
|
||||
*/
|
||||
public interface IntegralDetailMapper {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
IntegralDetail queryById(Integer id);
|
||||
|
||||
/**
|
||||
* 查询指定行数据
|
||||
*
|
||||
* @param integralDetail 查询条件
|
||||
* @param page 分页对象
|
||||
* @return 对象列表
|
||||
*/
|
||||
IPage<IntegralDetail> queryAllByLimit(@Param("page") Page page, IntegralDetail integralDetail);
|
||||
|
||||
/**
|
||||
* 统计总行数
|
||||
*
|
||||
* @param integralDetail 查询条件
|
||||
* @return 总行数
|
||||
*/
|
||||
long count(IntegralDetail integralDetail);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param integralDetail 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insert(IntegralDetail integralDetail);
|
||||
|
||||
/**
|
||||
* 批量新增数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<IntegralDetail> 实例对象列表
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insertBatch(@Param("entities") List<IntegralDetail> entities);
|
||||
|
||||
/**
|
||||
* 批量新增或按主键更新数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<IntegralDetail> 实例对象列表
|
||||
* @return 影响行数
|
||||
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
|
||||
*/
|
||||
int insertOrUpdateBatch(@Param("entities") List<IntegralDetail> entities);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param integralDetail 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(IntegralDetail integralDetail);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 影响行数
|
||||
*/
|
||||
int deleteById(Integer id);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,185 @@
|
||||
<?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.integral.mapper.IntegralDetailMapper">
|
||||
|
||||
<resultMap type="com.fuint.business.integral.entity.IntegralDetail" id="IntegralDetailMap">
|
||||
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="userId" column="user_id" jdbcType="INTEGER"/>
|
||||
<result property="pointsChange" column="points_change" jdbcType="INTEGER"/>
|
||||
<result property="currentPoints" column="current_points" jdbcType="INTEGER"/>
|
||||
<result property="type" column="type" jdbcType="VARCHAR"/>
|
||||
<result property="changeReason" column="change_reason" 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="VARCHAR"/>
|
||||
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="IntegralDetailMap">
|
||||
select
|
||||
id, user_id, points_change, current_points, type, change_reason, store_id, create_time, update_time, create_by, update_by
|
||||
from integral_detail
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
<select id="queryAllByLimit" resultMap="IntegralDetailMap">
|
||||
select
|
||||
id, user_id, points_change, current_points, type, change_reason, store_id, create_time, update_time, create_by, update_by
|
||||
from integral_detail
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
and user_id = #{userId}
|
||||
</if>
|
||||
<if test="pointsChange != null">
|
||||
and points_change = #{pointsChange}
|
||||
</if>
|
||||
<if test="currentPoints != null">
|
||||
and current_points = #{currentPoints}
|
||||
</if>
|
||||
<if test="type != null and type != ''">
|
||||
and type = #{type}
|
||||
</if>
|
||||
<if test="changeReason != null and changeReason != ''">
|
||||
and change_reason = #{changeReason}
|
||||
</if>
|
||||
<if test="storeId != null">
|
||||
and store_id = #{storeId}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
and create_by = #{createBy}
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
and update_by = #{updateBy}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!--统计总行数-->
|
||||
<select id="count" resultType="java.lang.Long">
|
||||
select count(1)
|
||||
from integral_detail
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
and user_id = #{userId}
|
||||
</if>
|
||||
<if test="pointsChange != null">
|
||||
and points_change = #{pointsChange}
|
||||
</if>
|
||||
<if test="currentPoints != null">
|
||||
and current_points = #{currentPoints}
|
||||
</if>
|
||||
<if test="type != null and type != ''">
|
||||
and type = #{type}
|
||||
</if>
|
||||
<if test="changeReason != null and changeReason != ''">
|
||||
and change_reason = #{changeReason}
|
||||
</if>
|
||||
<if test="storeId != null">
|
||||
and store_id = #{storeId}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
and create_by = #{createBy}
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
and update_by = #{updateBy}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into integral_detail(user_id, points_change, current_points, type, change_reason, store_id, create_time, update_time, create_by, update_by)
|
||||
values (#{userId}, #{pointsChange}, #{currentPoints}, #{type}, #{changeReason}, #{storeId}, #{createTime}, #{createTime}, #{createBy}, #{updateBy})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into integral_detail(user_id, points_change, current_points, type, change_reason, store_id, create_time, update_time, create_by, update_by)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.userId}, #{entity.pointsChange}, #{entity.currentPoints}, #{entity.type}, #{entity.changeReason}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into integral_detail(user_id, points_change, current_points, type, change_reason, store_id, create_time, update_time, create_by, update_by)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.userId}, #{entity.pointsChange}, #{entity.currentPoints}, #{entity.type}, #{entity.changeReason}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
user_id = values(user_id),
|
||||
points_change = values(points_change),
|
||||
current_points = values(current_points),
|
||||
type = values(type),
|
||||
change_reason = values(change_reason),
|
||||
store_id = values(store_id),
|
||||
create_time = values(create_time),
|
||||
update_time = values(update_time),
|
||||
create_by = values(create_by),
|
||||
update_by = values(update_by)
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update integral_detail
|
||||
<set>
|
||||
<if test="userId != null">
|
||||
user_id = #{userId},
|
||||
</if>
|
||||
<if test="pointsChange != null">
|
||||
points_change = #{pointsChange},
|
||||
</if>
|
||||
<if test="currentPoints != null">
|
||||
current_points = #{currentPoints},
|
||||
</if>
|
||||
<if test="type != null and type != ''">
|
||||
type = #{type},
|
||||
</if>
|
||||
<if test="changeReason != null and changeReason != ''">
|
||||
change_reason = #{changeReason},
|
||||
</if>
|
||||
<if test="storeId != null">
|
||||
store_id = #{storeId},
|
||||
</if>
|
||||
|
||||
<if test="updateTime != null">
|
||||
update_time = NOW(),
|
||||
</if>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
create_by = #{createBy},
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
update_by = #{updateBy},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
delete from integral_detail where id = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
@ -10,7 +10,7 @@
|
||||
<result property="refuelAmountType" column="refuel_amount_type" jdbcType="VARCHAR"/>
|
||||
<result property="refuelValueParticipation" column="refuel_value_participation" jdbcType="VARCHAR"/>
|
||||
<result property="refuelSceneRules" column="refuel_scene_rules" jdbcType="VARCHAR"/>
|
||||
<result property="refuelConsumptionAmount" column="refuel_consumption_amount" jdbcType="NUMERIC"/>
|
||||
<result property="refuelConsumptionAmount" column="refuel_consumption_amount" jdbcType="VARCHAR"/>
|
||||
<result property="refuelPoints" column="refuel_points" jdbcType="INTEGER"/>
|
||||
<result property="refuelFuelAmount" column="refuel_fuel_amount" jdbcType="NUMERIC"/>
|
||||
<result property="refuelFuelVolume" column="refuel_fuel_volume" jdbcType="NUMERIC"/>
|
||||
@ -125,7 +125,7 @@
|
||||
<!--查询指定行数据-->
|
||||
<select id="getSettings" resultMap="IntegralSettingsMap">
|
||||
select
|
||||
id, refuel_points_rules, refuel_points_function, refuel_scene_type, refuel_amount_type, refuel_value_participation, refuel_scene_rules, refuel_consumption_amount, refuel_points, refuel_fuel_amount, refuel_fuel_volume, recharge_give, invite_give, invite_give_rules, sign_in_function, sign_in_rules, points_obtained, points_rules, store_id, create_time, update_time, create_by, update_by
|
||||
id, refuel_points_rules, refuel_points_function, refuel_scene_type, refuel_amount_type, refuel_value_participation, refuel_scene_rules, refuel_consumption_amount, refuel_points, refuel_fuel_amount, refuel_fuel_volume, recharge_give, invite_give, invite_give_rules, sign_in_function, sign_in_rules, points_obtained, points_rules, store_id, create_by, update_by
|
||||
from integral_settings
|
||||
<where>
|
||||
store_id = #{integralSettings.storeId}
|
||||
@ -180,22 +180,22 @@
|
||||
<update id="update">
|
||||
update integral_settings
|
||||
<set>
|
||||
<if test="refuelPointsRules != null and refuelPointsRules != ''">
|
||||
<if test="refuelPointsRules != null and refuelPointsRules != '' or refuelPointsRules == 0">
|
||||
refuel_points_rules = #{refuelPointsRules},
|
||||
</if>
|
||||
<if test="refuelPointsFunction != null and refuelPointsFunction != ''">
|
||||
<if test="refuelPointsFunction != null and refuelPointsFunction != '' or refuelAmountType == 0">
|
||||
refuel_points_function = #{refuelPointsFunction},
|
||||
</if>
|
||||
<if test="refuelSceneType != null and refuelSceneType != ''">
|
||||
<if test="refuelSceneType != null and refuelSceneType != '' or refuelSceneType == 0">
|
||||
refuel_scene_type = #{refuelSceneType},
|
||||
</if>
|
||||
<if test="refuelAmountType != null and refuelAmountType != ''">
|
||||
<if test="refuelAmountType != null and refuelAmountType != '' or refuelAmountType == 0">
|
||||
refuel_amount_type = #{refuelAmountType},
|
||||
</if>
|
||||
<if test="refuelValueParticipation != null and refuelValueParticipation != ''">
|
||||
<if test="refuelValueParticipation != null and refuelValueParticipation != '' or refuelValueParticipation == 0">
|
||||
refuel_value_participation = #{refuelValueParticipation},
|
||||
</if>
|
||||
<if test="refuelSceneRules != null and refuelSceneRules != ''">
|
||||
<if test="refuelSceneRules != null and refuelSceneRules != '' or refuelValueParticipation == 0">
|
||||
refuel_scene_rules = #{refuelSceneRules},
|
||||
</if>
|
||||
<if test="refuelConsumptionAmount != null">
|
||||
@ -216,29 +216,26 @@
|
||||
<if test="inviteGive != null">
|
||||
invite_give = #{inviteGive},
|
||||
</if>
|
||||
<if test="inviteGiveRules != null and inviteGiveRules != ''">
|
||||
<if test="inviteGiveRules != null ">
|
||||
invite_give_rules = #{inviteGiveRules},
|
||||
</if>
|
||||
<if test="signInFunction != null and signInFunction != ''">
|
||||
<if test="signInFunction != null">
|
||||
sign_in_function = #{signInFunction},
|
||||
</if>
|
||||
<if test="signInRules != null and signInRules != ''">
|
||||
<if test="signInRules != null">
|
||||
sign_in_rules = #{signInRules},
|
||||
</if>
|
||||
<if test="pointsObtained != null and pointsObtained != ''">
|
||||
<if test="pointsObtained != null">
|
||||
points_obtained = #{pointsObtained},
|
||||
</if>
|
||||
<if test="pointsRules != null and pointsRules != ''">
|
||||
<if test="pointsRules != null">
|
||||
points_rules = #{pointsRules},
|
||||
</if>
|
||||
<if test="storeId != null">
|
||||
store_id = #{storeId},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
update_time = NOW(),
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
create_by = #{createBy},
|
||||
|
@ -0,0 +1,58 @@
|
||||
package com.fuint.business.integral.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.integral.entity.IntegralDetail;
|
||||
import io.lettuce.core.dynamic.annotation.Param;
|
||||
|
||||
|
||||
/**
|
||||
* 积分明细表(IntegralDetail)表服务接口
|
||||
*
|
||||
* @author wangh
|
||||
* @since 2023-11-10 17:52:52
|
||||
*/
|
||||
public interface IntegralDetailService {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
IntegralDetail queryById(Integer id);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param integralDetail 筛选条件
|
||||
* @param page 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
IPage<IntegralDetail> queryByPage(@Param("page") Page page, IntegralDetail integralDetail);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param integralDetail 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
IntegralDetail insert(IntegralDetail integralDetail);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param integralDetail 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
IntegralDetail update(IntegralDetail integralDetail);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deleteById(Integer id);
|
||||
|
||||
}
|
@ -41,6 +41,7 @@ public interface IntegralOrdersService {
|
||||
* @return 实例对象
|
||||
*/
|
||||
IntegralOrders insert(IntegralOrders integralOrders);
|
||||
IntegralOrders integralOrdersProcessing(IntegralOrders integralOrders);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
|
@ -0,0 +1,92 @@
|
||||
package com.fuint.business.integral.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.integral.entity.IntegralDetail;
|
||||
import com.fuint.business.integral.mapper.IntegralDetailMapper;
|
||||
import com.fuint.business.integral.service.IntegralDetailService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import io.lettuce.core.dynamic.annotation.Param;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
|
||||
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 积分明细表(IntegralDetail)表服务实现类
|
||||
*
|
||||
* @author wangh
|
||||
* @since 2023-11-10 17:52:52
|
||||
*/
|
||||
@Service("integralDetailService")
|
||||
public class IntegralDetailServiceImpl implements IntegralDetailService {
|
||||
@Resource
|
||||
private IntegralDetailMapper integralDetailMapper;
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public IntegralDetail queryById(Integer id) {
|
||||
return this.integralDetailMapper.queryById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param integralDetail 筛选条件
|
||||
* @param page 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
@Override
|
||||
public IPage<IntegralDetail> queryByPage(@Param("page") Page page, IntegralDetail integralDetail) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
integralDetail.setStoreId(nowAccountInfo.getStoreId());
|
||||
return this.integralDetailMapper.queryAllByLimit(page, integralDetail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param integralDetail 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public IntegralDetail insert(IntegralDetail integralDetail) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
integralDetail.setStoreId(nowAccountInfo.getStoreId());
|
||||
|
||||
|
||||
|
||||
this.integralDetailMapper.insert(integralDetail);
|
||||
return integralDetail;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param integralDetail 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public IntegralDetail update(IntegralDetail integralDetail) {
|
||||
this.integralDetailMapper.update(integralDetail);
|
||||
return this.queryById(integralDetail.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteById(Integer id) {
|
||||
return this.integralDetailMapper.deleteById(id) > 0;
|
||||
}
|
||||
}
|
@ -67,6 +67,11 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
|
||||
return integralOrders;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IntegralOrders integralOrdersProcessing(IntegralOrders integralOrders) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
|
@ -1,11 +1,17 @@
|
||||
package com.fuint.business.integral.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fuint.business.integral.entity.IntegralGift;
|
||||
import com.fuint.business.integral.entity.IntegralSettings;
|
||||
import com.fuint.business.integral.mapper.IntegralSettingsMapper;
|
||||
import com.fuint.business.integral.service.IntegralSettingsService;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilNumber;
|
||||
import com.fuint.business.petrolStationManagement.mapper.OilNumberMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import io.lettuce.core.dynamic.annotation.Param;
|
||||
@ -14,6 +20,10 @@ import com.fuint.common.dto.AccountInfo;
|
||||
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 积分设置表(IntegralSettings)表服务实现类
|
||||
@ -26,6 +36,8 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService {
|
||||
@Resource
|
||||
private IntegralSettingsMapper integralSettingsMapper;
|
||||
|
||||
@Resource
|
||||
private OilNumberMapper oilNumberMapper;
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
@ -51,16 +63,41 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService {
|
||||
return integralSettingsMapper.queryAllByLimit(page,integralSettings);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询店铺的数据
|
||||
*
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public IntegralSettings getSettings(IntegralSettings integralSettings) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
integralSettings.setStoreId(nowAccountInfo.getStoreId());
|
||||
IntegralSettings settings = this.integralSettingsMapper.getSettings(integralSettings);
|
||||
if (settings != null) {
|
||||
return settings;
|
||||
if (ObjectUtil.isEmpty(settings)) {
|
||||
// 查询店铺所有的存油
|
||||
List<OilNumber> oilName = oilNumberMapper.getOilName(nowAccountInfo.getStoreId());
|
||||
if (!CollUtil.isEmpty(oilName)) {
|
||||
List<Map<String, Object>> refuelConsumptionAmountList = new ArrayList<>();
|
||||
for (OilNumber oilNumber : oilName) {
|
||||
Map<String, Object> refuelConsumptionAmountMap = new HashMap<>();
|
||||
refuelConsumptionAmountMap.put("oilName",oilNumber.getOilName()+oilNumber.getOilType());
|
||||
refuelConsumptionAmountMap.put("amount",0);
|
||||
refuelConsumptionAmountMap.put("integral",0);
|
||||
refuelConsumptionAmountList.add(refuelConsumptionAmountMap);
|
||||
}
|
||||
String refuelConsumptionAmount = JSON.toJSONString(refuelConsumptionAmountList);
|
||||
integralSettings.setRefuelConsumptionAmount(refuelConsumptionAmount);
|
||||
|
||||
}
|
||||
insert(integralSettings);
|
||||
return integralSettings;
|
||||
|
||||
}
|
||||
insert(integralSettings);
|
||||
return integralSettings;
|
||||
|
||||
return settings;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -74,8 +111,10 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
integralSettings.setStoreId(nowAccountInfo.getStoreId());
|
||||
integralSettings.setCreateBy(nowAccountInfo.getStaffId().toString());
|
||||
|
||||
this.integralSettingsMapper.insert(integralSettings);
|
||||
IntegralSettings settings = this.integralSettingsMapper.getSettings(integralSettings);
|
||||
if (ObjectUtil.isEmpty(settings)) {
|
||||
this.integralSettingsMapper.insert(integralSettings);
|
||||
}
|
||||
return integralSettings;
|
||||
}
|
||||
|
||||
|
@ -21,37 +21,37 @@ public interface OilNumberMapper extends BaseMapper<OilNumber> {
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
public IPage<OilNumber> selectOilNumberList(Page page, @Param("oilNumber") OilNumber oilNumber);
|
||||
IPage<OilNumber> selectOilNumberList(Page page, @Param("oilNumber") OilNumber oilNumber);
|
||||
|
||||
/**
|
||||
* 根据id查询员工信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public OilNumber selectOilNumberById(@Param("id") int id);
|
||||
OilNumber selectOilNumberById(@Param("id") int id);
|
||||
|
||||
/**
|
||||
* 根据id删除员工信息
|
||||
* @return
|
||||
*/
|
||||
public int deleteOilNumberById(@Param("id") int id);
|
||||
int deleteOilNumberById(@Param("id") int id);
|
||||
|
||||
/**
|
||||
* 添加员工信息
|
||||
* @return
|
||||
*/
|
||||
public int insertOilNumber(OilNumber oilNumber);
|
||||
int insertOilNumber(OilNumber oilNumber);
|
||||
|
||||
/**
|
||||
* 修改员工信息
|
||||
* @return
|
||||
*/
|
||||
public int updateOilNumber(OilNumber oilNumber);
|
||||
int updateOilNumber(OilNumber oilNumber);
|
||||
|
||||
public List<OilNumber> getOilName(@Param("storeId") Integer storeId);
|
||||
List<OilNumber> getOilName(@Param("storeId") Integer storeId);
|
||||
|
||||
// 根据店铺和油号查询是否存在重复
|
||||
public int selectOilNameByStore(OilNumber oilNumber);
|
||||
int selectOilNameByStore(OilNumber oilNumber);
|
||||
|
||||
|
||||
|
||||
|
@ -92,7 +92,6 @@
|
||||
<if test=" updateBy != null and updateBy != ''">update_by= #{updateBy},</if>
|
||||
<if test=" unit != null and unit != ''">unit= #{unit},</if>
|
||||
update_time= NOW()
|
||||
|
||||
</set>
|
||||
where number_id = #{numberId}
|
||||
</update>
|
||||
@ -105,11 +104,10 @@
|
||||
from oil_number onm
|
||||
left join oil_name name on onm.oil_name = name.id
|
||||
<where>
|
||||
<if test="storeId != null">
|
||||
onm.store_id = #{storeId}
|
||||
</if>
|
||||
onm.store_id = #{storeId}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectOilNameByStore" resultType="java.lang.Integer">
|
||||
select count(*)
|
||||
from oil_number
|
||||
@ -118,33 +116,4 @@
|
||||
oil_name = #{oilName}
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<!-- oilType-->
|
||||
<!-- oilName-->
|
||||
<!-- oilPrice-->
|
||||
<!-- gbPrice-->
|
||||
<!-- receivingUni-->
|
||||
<!-- createTime-->
|
||||
<!-- updateTime-->
|
||||
<!-- state-->
|
||||
<!-- sort-->
|
||||
<!-- remark-->
|
||||
<!-- ifDelete-->
|
||||
|
||||
<!-- oil_type-->
|
||||
<!-- oil_name-->
|
||||
<!-- oil_price-->
|
||||
<!-- gb_price-->
|
||||
<!-- receiving_units-->
|
||||
<!-- create_time-->
|
||||
<!-- update_time-->
|
||||
<!-- state-->
|
||||
<!-- sort-->
|
||||
<!-- remark-->
|
||||
<!-- if_delete-->
|
||||
|
||||
|
||||
|
||||
</mapper>
|
@ -49,9 +49,9 @@ public interface OilNumberService extends IService<OilNumber> {
|
||||
public int updateOilNumber(OilNumber oilNumber);
|
||||
|
||||
|
||||
public List<OilNumber> getOilName();
|
||||
List<OilNumber> getOilName();
|
||||
|
||||
public OilNumber selectOilNameByStore(OilNumber oilNumber);
|
||||
OilNumber selectOilNameByStore(OilNumber oilNumber);
|
||||
|
||||
|
||||
|
||||
|
@ -126,10 +126,9 @@ public class OilPresetPricesServiceImpl extends ServiceImpl<OilPresetPricesMappe
|
||||
|
||||
@Override
|
||||
public int updateOilPresetPrices(OilPresetPrices presetPrices) {
|
||||
// Date date = new Date();
|
||||
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
|
||||
// String format = sdf.format(date);
|
||||
// presetPrices.setUpdateTime(format);
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
presetPrices.setStoreId(nowAccountInfo.getStoreId());
|
||||
|
||||
return baseMapper.insertOilPresetPrices(presetPrices);
|
||||
}
|
||||
|
||||
@ -143,9 +142,7 @@ public class OilPresetPricesServiceImpl extends ServiceImpl<OilPresetPricesMappe
|
||||
*/
|
||||
@Override
|
||||
public void timingAdjustment(Integer id) {
|
||||
System.out.println("ssssssssssssssssssssssssssssssssssssss");
|
||||
System.out.println("aaaaaaaaa"+id);
|
||||
// // 通过id查出这一条的数据
|
||||
// 通过id查出这一条的数据
|
||||
OilPresetPrices oilPresetPrices = baseMapper.selectOilPresetPricesById(id);
|
||||
// 关联价格将number中的数据修改掉
|
||||
OilNumber oilNumber = new OilNumber();
|
||||
|
Loading…
Reference in New Issue
Block a user