bug修改

This commit is contained in:
wangh 2024-01-09 12:02:40 +08:00
parent a3ed2f8b2d
commit 3f857268a6
24 changed files with 263 additions and 86 deletions

View File

@ -340,7 +340,8 @@ import {cleanTankApi} from "@/api/oilConfig/oilTank";
}
.cardboxb{
position: absolute;
width: 50px;
/*width: 50px;*/
width: auto;
height: 20px;
display: flex;
align-items: center;
@ -349,6 +350,7 @@ import {cleanTankApi} from "@/api/oilConfig/oilTank";
font-size: 14px;
left: 0px;
bottom: 0px;
padding-right: 5px;
background: #409eff;
}

View File

@ -44,23 +44,27 @@
<el-table-column
prop="presetId"
label="任务id"
align="center"
width="100">
</el-table-column>
<!-- prop="presetGbPrice"-->
<el-table-column
prop="oilNameT"
align="center"
label="预设油号"
>
</el-table-column>
<el-table-column label="当前数据" style="width: 100%">
<el-table-column
prop="currentPetrolPrices"
align="center"
label="油站价"
>
</el-table-column>
<el-table-column
prop="presetOilPrices"
align="center"
label="国标价"
>
</el-table-column>
@ -68,17 +72,20 @@
<el-table-column label="预设新数据" style="width: 100%">
<el-table-column
prop="currentPetrolPrices"
align="center"
label="油站价"
>
</el-table-column>
<el-table-column
prop="presetGbPrice"
align="center"
label="国标价"
>
</el-table-column>
</el-table-column>
<el-table-column
prop="effectiveTime"
align="center"
label="预设时间"
>
</el-table-column>
@ -87,30 +94,33 @@
<!-- label="处理状态"-->
<!-- >-->
<el-table-column label="状态">
<!-- <template slot-scope="scope">-->
<!-- {{ getStatusText(scope.row.state) }}-->
<!-- </template>-->
<el-table-column label="状态" align="center">
<template slot-scope="scope">
<dict-tag :options="dict.type.jobState" :value="scope.row.state"/>
<!-- <dict-tag :options="dict.type.jobState" :value="scope.row.state"/>-->
<el-tag v-if="scope.row.state == 'occur'" type="success">已生效</el-tag>
<el-tag v-else-if="scope.row.state == 'wait'">等待中</el-tag>
<el-tag v-else type="info">已失效</el-tag>
</template>
</el-table-column>
<el-table-column
prop="createTime"
align="center"
label="创建时间"
>
</el-table-column>
<el-table-column
fixed="right"
align="center"
label="操作"
width="120">
<template slot-scope="scope">
<el-button
<el-button v-if="scope.row.state == 'wait'"
@click.native.prevent="deleteRow(scope.$index, scope.row)"
type="text"
size="small">
停止
</el-button>
<span v-else> -- </span>
</template>
</el-table-column>
@ -336,6 +346,8 @@
type="datetime"
placeholder="选择日期时间"
style="width: 217px"
:default-value="defaultDateTime"
:picker-options="pickerOptions"
value-format="yyyy-MM-dd HH:mm:ss">
</el-date-picker>
</el-form-item>
@ -383,7 +395,13 @@ import {
return {
defaultDateTime: new Date(), //
pickerOptions: {
disabledDate(time) {
//
return time.getTime() < Date.now();
},
},
oilPresetPricesRules: {
numberId:[
@ -472,7 +490,8 @@ import {
presetGbPrice:null ,
createTime:'',
updateTime:'',
effectiveTime:null,
// effectiveTime:new date(),
effectiveTime:'',
ifDelete:'',
numberId:'',
},

View File

@ -58,7 +58,7 @@
<el-card style="margin-top: 20px" >
<el-row :gutter="10" class="mb8">
<el-col :span="1.5" >
<el-button
<el-button
v-if="state =='await'"
type="primary"
icon="el-icon-plus"
@ -150,7 +150,17 @@
:value="option.id"
></el-option>
</el-select>
<!-- :title="'该油罐总容量'+tankVolume+unit+',可用约'+canUseVolume+unit+ '&#45;&#45; 可用约'+canUseT+'吨'"-->
<el-alert
v-if="orderForm.tankId"
style="height: 25px;line-height: 16px;"
:title='tTitle'
type="warning"
:closable="false">
</el-alert>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
@ -170,7 +180,7 @@
<el-row :gutter="24">
<el-col :span="22">
<el-form-item label="油品密度" prop="productDensity">
<el-input v-model.number="orderForm.productDensity" placeholder="请输入油品密度" >
<el-input v-model="orderForm.productDensity" placeholder="请输入油品密度" >
<template slot="append">g/ml</template>
</el-input>
</el-form-item>
@ -179,7 +189,7 @@
<el-row :gutter="24">
<el-col :span="22">
<el-form-item label="采购吨数" prop="purchaseWeight">
<el-input v-model.number="orderForm.purchaseWeight" placeholder="请输入采购吨数" >
<el-input v-model="orderForm.purchaseWeight" placeholder="请输入采购吨数" @input="inputPurchaseWeight()">
<template slot="append"></template>
</el-input>
</el-form-item>
@ -188,7 +198,7 @@
<el-row :gutter="24">
<el-col :span="22">
<el-form-item label="采购单价" prop="purchasePrice">
<el-input v-model.number="orderForm.purchasePrice" placeholder="请输入采购单价" >
<el-input v-model="orderForm.purchasePrice" placeholder="请输入采购单价" >
<template slot="append">/</template>
</el-input>
</el-form-item>
@ -222,7 +232,18 @@ import {getAuditPremApi} from "@/api/oilConfig/staff";
export default {
name: "purchaseOrder",
data() {
var valiNumberPass = (rule, value, callback) => {//
let reg = /^[+-]?(0|([1-9]\d*))(\.\d{1,2})?$/;
if (value === '') {
callback(new Error('请输入内容'));
} else if (!reg.test(value)) {
callback(new Error('请输入数字,最多保留两位小数'));
} else {
callback();
}
};
return {
orderList:[],
orderForm:{
@ -240,6 +261,16 @@ export default {
preInboundInventory: null,
discountedPrice: null
},
//
tankVolume: 0, //
nowVolume: 0, //
canUseVolume: 0,//
canUseT: 0,//
unit:'L',//
// tTitle:'',
purchaseId: null,
numberInput: false,
@ -289,17 +320,13 @@ export default {
//
rules: {
productDensity: [
{required: true, message: "密度不能为空", trigger: "blur"},
{ type: 'number', message: '价格必须为数字值'}
{ required: true, validator:valiNumberPass, trigger: "blur" }
],
purchaseWeight: [
{required: true, message: "重量不能为空", trigger: "blur"},
{ type: 'number', message: '价格必须为数字值'}
{ required: true, validator:valiNumberPass, trigger: "blur" },
],
purchasePrice: [
{required: true, message: "价格不能为空", trigger: "blur"},
{ type: 'number', message: '价格必须为数字值'}
{ required: true, validator:valiNumberPass, trigger: "blur" }
],
numberId: [
{required: true, message: "请选择采购油品", trigger: "blur"}
@ -377,12 +404,17 @@ export default {
await this.getList();
},
computed: {
tTitle() {
// return ""+this.tankVolume+' '+this.unit+"" + this.canUseVolume+' '+this.unit +"-- "+this.canUseT+""
return "油罐总容量"+this.tankVolume+' '+this.unit+"-- 可用约"+this.canUseT+"吨"
}
},
methods: {
getList(){
this.loading = true;
getPurchaseOrderApi(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.orderList = response.data.records;
console.log("this.tankList",this.orderList)
this.total = response.data.total;
//
this.sumMethod(response.data.records);
@ -465,10 +497,12 @@ export default {
"tankId": this.orderForm.tankId,
"tankName": tankName.tankName,
"totalAmount": this.orderForm.totalAmount,
"canUseT": this.canUseT,
}
this.orderList.push(addFrom)
this.open = false;
this.sumMethod(this.orderList)
@ -497,7 +531,11 @@ export default {
},
//
change(data) {
console.log()
if (data.purchaseWeight > data.canUseT) {
this.$message('不能超过油罐储存的最大值!');
data.purchaseWeight = data.canUseT
}
//
data.purchaseVolume = new BigNumber(data.purchaseWeight).times(1000).dividedBy(data.productDensity).toFixed(2);
//
@ -532,9 +570,57 @@ export default {
this.tankList.forEach(su=>{
if (data == su.id) {
this.orderForm.productDensity = su.oilDensity
console.log("su",su)
this.tankVolume = su.tankVolume
this.nowVolume = su.storedQuantity
this.unit = su.unit
this.densityCalculations();
// tankVolume:'0', //
// nowVolume:'0', //
// canUseVolume:'0',//
// canUseT:'0',//
// unit:'L',//
//
}
})
},
//
densityCalculations() {
this.canUseVolume = this.tankVolume - this.nowVolume
//
const volumeLiters = new BigNumber(this.canUseVolume); //
const densityGramsPerML = new BigNumber(this.orderForm.productDensity); // /
//
const massTons = volumeLiters.times(densityGramsPerML).times(1e-3).toFixed(2);
this.canUseT = massTons; //
// console.log("canUseT",this.tankVolume)
},
inputPurchaseWeight() {
if (!this.orderForm.purchaseWeight) {
this.orderForm.purchaseWeight = ''
return
}
if (!this.canUseT) {
this.$message('请先选择油罐!');
this.orderForm.purchaseWeight = ''
return
}
const purchaseWeight = parseFloat(this.orderForm.purchaseWeight);
const canUseT = parseFloat(this.canUseT);
console.log("purchaseWeight",purchaseWeight)
if (canUseT<=0) {
this.$message('已无可用吨数!');
this.orderForm.purchaseWeight = ''
return
}else if (purchaseWeight>canUseT) {
this.orderForm.purchaseWeight = canUseT
}
},
//
getOilNameList() {
let this_=this
@ -556,7 +642,6 @@ export default {
this.suppliersList = response.data;
});
},
//
refresh() {
var timestamp = new Date().getTime();
@ -597,11 +682,11 @@ export default {
purchaseDate : this.purchaseForm.purchaseDate,
theDocumentAmount : this.totalAmountPurchased,
}
await unifiedProcessingApi({oilPurchase:from,oilPurchaseOrders:this.orderList}).then(res=>{
if (res.code === 200) {
this.purchaseId = res.data.id
this.$router.push({ path: '/oilConfig/oilPurchase/list'});
}else {
return -1;
@ -644,7 +729,7 @@ export default {
// })
// })
// }
//
// if (this.queryParams.purchaseId < 0) {
@ -709,7 +794,6 @@ export default {
this.voidFlag=true
}
},
//
async judgmentPermissions(data) {
let fil ={
@ -719,7 +803,6 @@ export default {
return res.data
});
},
//
async audit(){
//
@ -822,7 +905,6 @@ export default {
},
//
goToAbout() {
this.$router.push('/oilConfig/oilPurchase/list');

View File

@ -26,8 +26,8 @@
/>
</el-form-item>
<el-form-item label="状态" v-model="queryParams.status" prop="status" clearable>
<el-select v-model="queryParams.status" placeholder="" style="width:100%">
<el-form-item label-width="120px" label="库存统计状态" v-model="queryParams.inventoryStatistics" prop="inventoryStatistics" clearable>
<el-select v-model="queryParams.inventoryStatistics" placeholder="" style="width:100%">
<el-option label="全部" value=""></el-option>
<el-option
v-for="dict in dict.type.zhzt"
@ -198,7 +198,8 @@ export default {
//
queryParams: {
numberId:'',
status:'',
status:'启用',
inventoryStatistics:'',
tankName: '',
page:null,
pageSize:null
@ -289,7 +290,8 @@ export default {
//
this.queryParams= {
numberId:'',
status:'',
status:'启用',
inventoryStatistics:'',
tankName: '',
page:null,
pageSize:null

View File

@ -11,7 +11,7 @@ VUE_APP_BASE_API = '/dev-api'
VUE_APP_PUBLIC_PATH = '/'
# 后端接口地址
VUE_APP_SERVER_URL = 'http://192.168.0.121:8080/'
VUE_APP_SERVER_URL = 'http://192.168.0.178:8008/'
# cp端地址
VUE_PC_SERVER_URL = 'http://192.168.0.178:82/'

View File

@ -47,7 +47,8 @@ Vue.prototype.addDateRange = addDateRange
Vue.prototype.getName = getName
Vue.prototype.download = download
Vue.prototype.handleTree = handleTree
Vue.prototype.pcUrl = 'http://192.168.0.121:82/'
// Vue.prototype.pcUrl = 'http://192.168.0.121:82/'
Vue.prototype.pcUrl = 'http://192.168.0.178:82/'
// 全局组件挂载
Vue.component('DictTag', DictTag)

View File

@ -63,7 +63,8 @@
<div class="box-wrap">
<div class="zong-box" v-for="(items,index) in item.storeList" :key="index" >
<div class="pur-box" @click="godetails(items.id)">
<el-tag type="success">{{items.status=='qy'?'启用':'禁用'}}</el-tag>
<el-tag type="success" v-if="items.status=='qy'">启用</el-tag>
<el-tag type="danger" v-else>禁用</el-tag>
<div class="disper-box">
<div class="box-img">
<img v-if="items.logo" :src="imagePath + items.logo" style="width: 96px;height: 96px">

View File

@ -165,12 +165,16 @@
</el-col>
<el-col :span="10">
<el-form-item label="油站状态" prop="status" :label-width="formLabelWidth">
<el-tooltip class="item" effect="dark" content="油站状态在组织架构中设置" placement="top-start">
<el-switch
disabled
v-model="from.status"
@change="getswitch"
active-value="qy"
inactive-value="jy"
></el-switch>
</el-tooltip>
</el-form-item>
</el-col>
</el-row>
@ -448,7 +452,7 @@
enterThePetrolStation() {
if (this.from.status == 'jy') {
if (this.from.status === 'jy') {
this.$message('该油站已被禁用');
return

View File

@ -21,6 +21,13 @@ public interface OilPresetPricesMapper extends BaseMapper<OilPresetPrices> {
*/
public IPage<OilPresetPrices> selectOilPresetPricesList(Page page, @Param("presetPrices") OilPresetPrices presetPrices);
/**
* 将过期等待任务全部标为已失效
* @return
*/
int editWaitByTime();
/**
* 根据id查询员工信息
* @param id

View File

@ -100,5 +100,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateJobId">
update oil_preset_prices set job_id = #{jobId} where preset_id = #{presetId}
</update>
<update id="editWaitByTime">
update oil_preset_prices set state = 'lose' where state = 'wait' and effective_time &lt; now()
</update>
</mapper>

View File

@ -43,9 +43,19 @@ public class OilPresetPricesServiceImpl extends ServiceImpl<OilPresetPricesMappe
public IPage<OilPresetPrices> selectOilPresetPricesList(Page page, OilPresetPrices presetPrices) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
presetPrices.setStoreId(nowAccountInfo.getStoreId());
editWaitByTime();
return baseMapper.selectOilPresetPricesList(page, presetPrices);
}
/**
* 将过期等待任务全部标为已失效
* @return
*/
public boolean editWaitByTime() {
return baseMapper.editWaitByTime()>0;
}
@Override
public OilPresetPrices selectOilPresetPricesById(Integer id) {
return baseMapper.selectOilPresetPricesById(id);
@ -66,8 +76,6 @@ public class OilPresetPricesServiceImpl extends ServiceImpl<OilPresetPricesMappe
presetPrices.setState("wait");
baseMapper.insertOilPresetPrices(presetPrices);
// AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
// System.out.println("nowAccountInfo"+nowAccountInfo);
String coreTime = changeCore(presetPrices.getEffectiveTime());
// 创建定时任务
SysJob sysJob = new SysJob();
@ -152,6 +160,7 @@ public class OilPresetPricesServiceImpl extends ServiceImpl<OilPresetPricesMappe
oilNumber.setOilPrice(oilPresetPrices.getPresetOilPrices());
oilNumber.setGbPrice(oilPresetPrices.getPresetGbPrice());
oilNumberMapper.updateOilNumber(oilNumber);
editWaitByTime();
// 将状态调整为开始
baseMapper.editStart(id, "occur");

View File

@ -84,15 +84,19 @@ public class OilTankServiceImpl implements OilTankService {
oilTank.setCreateBy(nowAccountInfo.getStaffId().toString());
this.oilTankDao.insert(oilTank);
// 添加到库存跟踪 初始化时
OilTracking oilTracking = new OilTracking();
oilTracking.setStoreId(nowAccountInfo.getStoreId());
oilTracking.setCreateBy(nowAccountInfo.getStaffId().toString());
oilTracking.setDocument("油罐库存初始化");
oilTracking.setQuantityChange(oilTank.getStoredQuantity());
oilTracking.setTankId(oilTank.getId());
oilTracking.setOrderNumber("-");
oilTrackingMapper.insert(oilTracking);
if ("启用".equals(oilTank.getInventoryStatistics())) {
// 添加到库存跟踪 初始化时 -- 当启用库存统计时
OilTracking oilTracking = new OilTracking();
oilTracking.setStoreId(nowAccountInfo.getStoreId());
oilTracking.setCreateBy(nowAccountInfo.getStaffId().toString());
oilTracking.setDocument("油罐库存初始化");
oilTracking.setQuantityChange(oilTank.getStoredQuantity());
oilTracking.setTankId(oilTank.getId());
oilTracking.setOrderNumber("-");
oilTrackingMapper.insert(oilTracking);
}
return oilTank;
}

View File

@ -11,6 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
inner join sys_dept sd on sd.dept_id = csi.contract_dept_id
inner join mt_store ms on ms.chain_store_id = csi.id
where sd.ancestors like concat(#{ownDeptStr},'%')
and csi.status = 'qy'
<if test="chainStoreInfo.storeName !=null and chainStoreInfo.storeName !=''">
and (csi.store_name like concat('%',#{chainStoreInfo.storeName},'%') or ms.name like concat('%',#{chainStoreInfo.storeName},'%'))
</if>

View File

@ -403,8 +403,8 @@ public class StoreServiceImpl extends ServiceImpl<MtStoreMapper, MtStore> implem
res.put(flag,false);
return res;
}
// if (redisTemplate.hasKey(flag)) {
if (true) {
if (redisTemplate.hasKey(flag)) {
// if (true) {
// 找到站长的
Map<String, Object> param = new HashMap();
@ -445,13 +445,8 @@ public class StoreServiceImpl extends ServiceImpl<MtStoreMapper, MtStore> implem
return res;
}
// mtStoreMapper.getAccountByRole(12);
// 生成token
// 返回token
// redisTemplate.delete(flag);
redisTemplate.delete(flag);
return res;
} else {

View File

@ -128,6 +128,7 @@ public class LJStoreServiceImpl extends ServiceImpl<LJStoreMapper, LJStore> impl
// 查询店铺列表信息
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("status","qy");
queryWrapper.eq("if_delete","0");
queryWrapper.eq("chain_store_id",chainStoreId);
List<LJStore> list = baseMapper.selectList(queryWrapper);
double earthRadius = 6371; // 地球半径单位为公里

View File

@ -94,9 +94,9 @@ public class QRCodeServiceImpl extends ServiceImpl<QRCodeMapper, QRCode> impleme
if (ObjectUtil.isEmpty(qrCode1)){
qrCode.setStoreId(store.getId());
qrCode.setChainStoreId(store.getChainStoreId());
// 带有店铺id 跳转首页
// 带有店铺id 跳转首页
qrCode.setCollection("https://www.tuofeng.cc/oilIndex?storeId="+store.getChainStoreId());
// 带有店铺id 跳转一键加油页面
// 带有店铺id 跳转一键加油页面
qrCode.setPayment("https://www.tuofeng.cc/oilRefuel?storeId="+store.getChainStoreId());
row = baseMapper.insert(qrCode);
IndexBanner indexBanner = new IndexBanner();

View File

@ -85,26 +85,6 @@ public class SysDeptController extends BaseController
return getFailureResult("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
}
int row = deptService.insertDept(dept);
SysDept sysDept = deptService.selectSysDeptByName(dept.getDeptName());
if (ObjectUtil.isNotEmpty(sysDept)){
LJStore store = storeService.selectStoreByDeptId(sysDept.getDeptId());
QRCode qrCode = new QRCode();
iqrCodeService.insertQRCode(qrCode,store.getId());
LJUserGrade userGrade = new LJUserGrade();
userGrade.setStoreId(store.getId());
userGrade.setGrade(1);
userGrade.setName("普通会员");
userGrade.setStatus("qy");
userGrade.setGrowthValue(1);
userGrade.setPreferential("自定义优惠");
userGrade.setGasolineDiscount("无优惠");
userGrade.setGasolineRule("[{\"gasolineRule1\":1,\"gasolineRule2\":1,\"gasolineRule3\":1}]");
userGrade.setDieselDiscount("无优惠");
userGrade.setDieselRule("[{\"dieselRule1\":1,\"dieselRule2\":1,\"dieselRule3\":1}]");
userGrade.setNaturalGasDiscount("无优惠");
userGrade.setNaturalGasRule("[{\"naturalGas1\":1,\"naturalGas2\":1,\"naturalGas3\":1}]");
userGradeService.insertUserGrade(userGrade,store.getId());
}
return getSuccessResult(row);
}
@ -115,6 +95,7 @@ public class SysDeptController extends BaseController
public ResponseObject edit(@Validated @RequestBody SysDept dept)
{
Long deptId = dept.getDeptId();
Long parentId = dept.getParentId();
if (!deptService.checkDeptNameUnique(dept))
{
return getFailureResult("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
@ -127,6 +108,9 @@ public class SysDeptController extends BaseController
{
return getFailureResult("该部门包含未停用的子部门!");
}
else if (StringUtils.equals(UserConstants.DEPT_NORMAL, dept.getStatus()) && deptService.selectStatusByParentId(parentId) > 0) {
return getFailureResult("该部门的父级部门未启用!");
}
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
dept.setCreateBy(nowAccountInfo.getId().toString());
return getSuccessResult(deptService.updateDept(dept));

View File

@ -54,6 +54,9 @@ public interface SysDeptMapper extends BaseMapper<SysDept>
*/
public int selectNormalChildrenDeptById(Long deptId);
int selectStatusByParentId(Long parentId);
/**
* 是否存在子节点
*

View File

@ -64,7 +64,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
select count(*) from sys_dept where status = 'jy' and find_in_set(#{deptId}, ancestors)
select count(*) from sys_dept where status = 'qy' and find_in_set(#{deptId}, ancestors) and if_delete = 0
</select>
<select id="selectStatusByParentId" resultType="java.lang.Integer">
select count(*) from sys_dept where status = 'jy' and dept_id= #{parentId} and if_delete = 0
</select>
<select id="checkDeptNameUnique" resultType="com.fuint.system.dept.entity.SysDept">
@ -87,7 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</update>
<update id="updateDeptStatusNormal" parameterType="Long">
<update id="updateDeptStatusNormal" parameterType="String">
update sys_dept set status = 'jy' where ancestors like concat(#{ancestor},'%')
</update>
@ -99,6 +103,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<update id="updateStatusByTurnoverTime" >
update sys_dept set status = 'jy' where turnover_time > NOW() and turnoverType = 2
</update>

View File

@ -63,6 +63,12 @@ public interface ISysDeptService extends IService<SysDept>
*/
public int selectNormalChildrenDeptById(Long deptId);
/**
* 查询是否有父级部门未启用
* @param parentId
* @return
*/
int selectStatusByParentId(Long parentId);
/**
* 是否存在部门子节点
*

View File

@ -9,12 +9,19 @@ import com.fuint.business.store.entity.ChainStoreInfo;
import com.fuint.business.store.entity.MtStore;
import com.fuint.business.store.service.ChainStoreInfoService;
import com.fuint.business.store.service.StoreService;
import com.fuint.business.storeInformation.entity.LJStore;
import com.fuint.business.storeInformation.entity.QRCode;
import com.fuint.business.storeInformation.service.ILJStoreService;
import com.fuint.business.storeInformation.service.IQRCodeService;
import com.fuint.business.userManager.entity.LJUserGrade;
import com.fuint.business.userManager.service.LJUserGradeService;
import com.fuint.common.constant.UserConstants;
import com.fuint.common.domain.TreeSelect;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.Convert;
import com.fuint.common.util.StringUtils;
import com.fuint.common.util.TokenUtil;
import com.fuint.framework.exception.BusinessCheckException;
import com.fuint.system.dept.entity.SysDept;
import com.fuint.system.dept.mapper.SysDeptMapper;
import com.fuint.system.dept.service.ISysDeptService;
@ -26,6 +33,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
/**
@ -140,6 +148,16 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper,SysDept> imple
return baseMapper.selectNormalChildrenDeptById(deptId);
}
/**
* 查询是否有父级部门未启用
* @param parentId
* @return
*/
@Override
public int selectStatusByParentId(Long parentId) {
return baseMapper.selectStatusByParentId(parentId);
}
/**
* 是否存在子节点
*
@ -192,7 +210,10 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper,SysDept> imple
return baseMapper.selectOne(queryWrapper);
}
@Autowired
private IQRCodeService iqrCodeService;
@Autowired
private LJUserGradeService userGradeService;
/**
* 新增保存部门信息
*
@ -228,6 +249,25 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper,SysDept> imple
store.setChainStoreId(chainStoreInfo.getId());
store.setContractDeptId(dept.getDeptId());
storeService.save(store);
QRCode qrCode = new QRCode();
iqrCodeService.insertQRCode(qrCode,store.getId());
LJUserGrade userGrade = new LJUserGrade();
userGrade.setStoreId(store.getId());
userGrade.setGrade(1);
userGrade.setName("普通会员");
userGrade.setStatus("qy");
userGrade.setGrowthValue(1);
userGrade.setPreferential("自定义优惠");
userGrade.setGasolineDiscount("无优惠");
userGrade.setGasolineRule("[{\"gasolineRule1\":1,\"gasolineRule2\":1,\"gasolineRule3\":1}]");
userGrade.setDieselDiscount("无优惠");
userGrade.setDieselRule("[{\"dieselRule1\":1,\"dieselRule2\":1,\"dieselRule3\":1}]");
userGrade.setNaturalGasDiscount("无优惠");
userGrade.setNaturalGasRule("[{\"naturalGas1\":1,\"naturalGas2\":1,\"naturalGas3\":1}]");
userGradeService.insertUserGrade(userGrade,store.getId());
}else {
throw new Exception("数据有误,请联系管理员");
}
@ -269,6 +309,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper,SysDept> imple
* @return 结果
*/
@Override
@Transactional
public int updateDept(SysDept dept)
{
SysDept newParentDept = baseMapper.selectDeptById(dept.getParentId());
@ -285,12 +326,17 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper,SysDept> imple
queryWrapper.eq(ChainStoreInfo::getContractDeptId,dept.getDeptId());
ChainStoreInfo chainStoreInfo = chainStoreService.getOne(queryWrapper);
chainStoreInfo.setStoreName(dept.getDeptName());
chainStoreInfo.setStatus(dept.getStatus());
chainStoreService.updateById(chainStoreInfo);
}else if (dept.getDeptType().equals("3")){
LambdaQueryWrapper<MtStore> queryWrapper =new LambdaQueryWrapper<>();
queryWrapper.eq(MtStore::getContractDeptId,dept.getDeptId());
MtStore store = storeService.getOne(queryWrapper);
if (ObjectUtil.isEmpty(store)) {
throw new RuntimeException("该油站不存在!");
}
store.setName(dept.getDeptName());
store.setStatus(dept.getStatus());
storeService.updateById(store);
}
int result = baseMapper.updateById(dept);
@ -309,7 +355,9 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper,SysDept> imple
*/
private void updateParentDeptStatusNormal(SysDept dept)
{
baseMapper.updateDeptStatusNormal(dept.getAncestors());
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(dept.getAncestors()).append(",").append(dept.getDeptId());
baseMapper.updateDeptStatusNormal(stringBuilder.toString());
}
/**

View File

@ -2,7 +2,7 @@
server.port=8008
env.profile=dev
#env.properties.path=D:/workspaces/oilSystem/fuintBackend/configure/
env.properties.path=D:/oil/oil/oilSystem/fuintBackend/configure/
env.properties.path=D:/code/oilSystem/fuintBackend/configure/

Binary file not shown.

View File

@ -70,8 +70,8 @@
<view class="dred"> <text class="xred"></text> {{oilInfo.oilPrice}}</view>
</view>
<view class="c-box-box3">
<view class="xblck"></view>
<view class="dblck"> <text class="xblck"></text> {{oilInfo.oilPrice}}</view>
<view class="xblck"></view>
<view class="dblck"> <text class="xblck"></text> {{oilInfo.gbPrice}}</view>
</view>
</view>