bug处理

This commit is contained in:
wangh 2024-01-18 18:06:07 +08:00
parent d8023ecfba
commit 66910b4bf4
16 changed files with 219 additions and 49 deletions

View File

@ -83,7 +83,7 @@
</el-table-column>
<el-table-column label="采购吨数(t)" align="center" prop="purchaseWeight">
<template slot-scope="scope">
<el-input-number :disabled="numberInput" v-model="scope.row.purchaseWeight" @change="change(scope.row)" controls-position="right" :min="0" :step="1" style="max-width: 100%"></el-input-number>
<el-input-number :disabled="numberInput" v-model="scope.row.purchaseWeight" @change="change(scope.row)" controls-position="right" :min="0" :step="0.01" style="max-width: 100%"></el-input-number>
</template>
</el-table-column>
<el-table-column :disabled="numberInput" label="采购单价(元/吨)" align="center" prop="purchasePrice">
@ -416,8 +416,10 @@ export default {
getPurchaseOrderApi(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.orderList = response.data.records;
this.total = response.data.total;
console.log("response",response.data.records[0].purchaseWeight)
console.log("orderList",this.orderList)
//
this.sumMethod(response.data.records);
// this.sumMethod(response.data.records);
})
this.loading = false;
},
@ -537,6 +539,7 @@ export default {
if (data.purchaseWeight > data.canUseT) {
this.$message('不能超过油罐储存的最大值!');
data.purchaseWeight = data.canUseT
return
}
//
data.purchaseVolume = new BigNumber(data.purchaseWeight).times(1000).dividedBy(data.productDensity).toFixed(2);
@ -595,9 +598,12 @@ export default {
//
const massTons = volumeLiters.times(densityGramsPerML).times(1e-3).toFixed(2);
// const massTons = volumeLiters.times(densityGramsPerML).times(1e-3).toFixed(2);
const massTons = Math.floor(volumeLiters.times(densityGramsPerML).times(1e-3) * 100) / 100;
this.canUseT = massTons; //
// console.log("canUseT",this.tankVolume)
console.log("canUseT",this.canUseT)
},
inputPurchaseWeight() {
@ -611,10 +617,10 @@ export default {
return
}
const purchaseWeight = parseFloat(this.orderForm.purchaseWeight);
const canUseT = parseFloat(this.canUseT);
console.log("purchaseWeight",purchaseWeight)
console.log("canUseT",canUseT)
if (canUseT<=0) {
this.$message('已无可用吨数!');
this.orderForm.purchaseWeight = ''

View File

@ -168,7 +168,7 @@
<!-- <el-row>-->
<el-col :span="8">
<el-form-item label="登录密码" prop="password">
<el-input v-model="form.password" type="password" placeholder="请输入登录密码" maxlength="30"/>
<el-input v-model="form.password" type="password" placeholder="不填写默认123456" maxlength="30"/>
</el-form-item>
</el-col>
@ -176,25 +176,24 @@
<el-row>
</el-row>
<el-row :span="24">
<el-col :span="2" style="display: flex;margin-bottom: 10px">
<span style="margin-right: 10px;width: 70px">审核权限</span>
<!-- <el-row :span="24">-->
<!-- <el-col :span="2" style="display: flex;margin-bottom: 10px">-->
<!-- <span style="margin-right: 10px;width: 70px">审核权限</span>-->
</el-col>
<el-col :span="22" style="display: flex;margin-bottom: 10px">
<el-checkbox-group v-model="auditPrem" @change="getCheckbox">
<el-checkbox
v-for="dict in dict.type.shqx"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-checkbox>
</el-checkbox-group>
<!-- </el-col>-->
<!-- <el-col :span="22" style="display: flex;margin-bottom: 10px">-->
<!-- <el-checkbox-group v-model="auditPrem" @change="getCheckbox">-->
<!-- <el-checkbox-->
<!-- v-for="dict in dict.type.shqx"-->
<!-- :key="dict.value"-->
<!-- :label="dict.label"-->
<!-- :value="dict.value"-->
<!-- ></el-checkbox>-->
<!-- </el-checkbox-group>-->
</el-col>
<!-- </el-col>-->
<!-- </el-row>-->
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="一键加油" prop="isRefuel">
@ -261,6 +260,24 @@
</el-tooltip>
</el-form-item>
</el-col>
<el-col :span="8" >
<el-form-item label="审核权限">
<el-select
v-model="auditPrem"
multiple
collapse-tags
@change="getCheckbox"
placeholder="请选择">
<el-option
v-for="dict in dict.type.shqx"
:key="dict.label"
:label="dict.label"
:value="dict.label"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
@ -517,6 +534,7 @@ export default {
this.form.appletPrem = JSON.stringify(data);
},
getCheckbox(){
console.log("this.auditPrem.toString()",this.auditPrem.toString())
// this.form.writeOff = this.writeOff.toString();
// this.form.specialPrem = this.specialPrem.toString();
this.form.auditPrem = this.auditPrem.toString();
@ -596,6 +614,8 @@ export default {
this.appletPrem = '';
this.writeOff = [];
this.form.auditPrem = [];
this.auditPrem = []
this.form = {
id:'', userId:'', mobile:'', realName:'', wechat:'', merchantId:'', storeId:'', auditedStatus:'A',
auditedTime:'', description:'', isRefuel:'yc', handoverMode:'dqmdtyjb', handoverPrem:'yqx', handoverOut:'jbtc', record:'qbjl',
@ -657,7 +677,11 @@ export default {
this.open = true;
this.title = "编辑员工信息";
if (this.form.auditPrem.length > 0){
this.form.auditPrem = this.form.auditPrem.split(",");
// this.form.auditPrem = this.form.auditPrem.split(",");
this.auditPrem = []
this.auditPrem = this.form.auditPrem.split(",");
console.log("this.form.auditPrem",this.auditPrem)
}
if (this.writeOff.length > 0){
this.writeOff = this.form.writeOff.split(",");

View File

@ -2,6 +2,9 @@ package com.fuint.api.fuyou.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fuint.api.fuyou.entity.MerchantConfig;
import io.lettuce.core.dynamic.annotation.Param;
public interface MerchantConfigMapper extends BaseMapper<MerchantConfig> {
MerchantConfig getConfig(@Param("storeId") Integer storeId,@Param("mchntCd") String mchntCd);
int subtractAmount(@Param("storeId") Integer storeId,@Param("changeTheAmount") String changeTheAmount);
}

View File

@ -0,0 +1,16 @@
<?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.api.fuyou.mapper.MerchantConfigMapper">
<update id="subtractAmount">
update Merchant_config set amount = amount-#{changeTheAmount}
where store_id = #{storeId}
</update>
<select id="getConfig" resultType="com.fuint.api.fuyou.entity.MerchantConfig">
select *
from Merchant_config
where store_id = #{storeId}
and
mchnt_cd = #{mchntCd}
limit 1
</select>
</mapper>

View File

@ -2,6 +2,7 @@ package com.fuint.api.fuyou.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.api.fuyou.entity.MerchantConfig;
import io.swagger.models.auth.In;
import java.util.List;
@ -97,4 +98,6 @@ public interface MerchantConfigService extends IService<MerchantConfig> {
* @return
*/
public int deleteMerch(Integer id);
boolean subtractAmount(Integer id, String changeTheAmount, String mchntCd);
}

View File

@ -8,9 +8,12 @@ import com.fuint.api.fuyou.entity.MerchantConfig;
import com.fuint.api.fuyou.mapper.MerchantConfigMapper;
import com.fuint.api.fuyou.service.MerchantConfigService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.RedisLock;
import com.fuint.common.util.TokenUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;
/**
@ -167,4 +170,27 @@ public class MerchantConfigServiceImpl extends ServiceImpl<MerchantConfigMapper,
public int deleteMerch(Integer id) {
return baseMapper.deleteById(id);
}
@Resource
RedisLock redisLock;
public boolean subtractAmount(Integer storeId, String changeTheAmount, String mchntCd) {
String lock = "MerchantConfig"+storeId+mchntCd;
redisLock.lock(lock);
try {
MerchantConfig config = baseMapper.getConfig(storeId,mchntCd);
if (ObjectUtil.isNotEmpty(config)) {
if (new BigDecimal(changeTheAmount).compareTo(new BigDecimal(config.getAmount().toString()))<=0) {
baseMapper.subtractAmount(storeId, changeTheAmount);
}
}
}catch (Exception e){
return false;
} finally {
redisLock.unlock(lock);
}
return true;
}
}

View File

@ -69,6 +69,9 @@ public class CommissionRecordServiceImpl implements CommissionRecordService {
@Override
public CommissionRecord insert2(CommissionRecord commissionRecord) {
int insert = this.commissionRecordMapper.insert(commissionRecord);
return commissionRecord;
}

View File

@ -318,7 +318,7 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
bigDecimal = bigDecimal.add(new BigDecimal(cardValueRecordDTO.getGiftBalance()).add(new BigDecimal(cardValueRecordDTO.getRechargeBalance().toString())));
cardValueRecordDTO.setBidBalance(bigDecimal.doubleValue());
}
if (ObjectUtils.isEmpty(cardValueRecordDTO.getMtStaffId())) {
if (ObjectUtils.isEmpty(cardValueRecordDTO.getMtStaffId()) || cardValueRecordDTO.getMtStaffId() == 0) {
cardValueRecordDTO.setMtStaffId(nowAccountInfo.getStaffId());
}
baseMapper.insert(cardValueRecordDTO);
@ -472,7 +472,7 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
// 成长值变动明细
// 员工提成
if (!ObjectUtil.isEmpty(cardValueRecord.getRoyaltyType()) && !"1".equals(cardValueRecord.getRoyaltyType())) {
if (ObjectUtil.isNotEmpty(cardValueRecord.getMtStaffId()) && !ObjectUtil.isEmpty(cardValueRecord.getRoyaltyType()) && !"1".equals(cardValueRecord.getRoyaltyType())) {
CommissionRecord commissionRecord = employeeCommissions(cardValueRecord);
commissionRecordService.insert2(commissionRecord);
}
@ -529,6 +529,7 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
cardValueRecord.setStatus("1");
baseMapper.updateById(updateCardValueRecord);
redisLock.unlock(lockKey);
} else {
redisLock.unlock(lockKey);
@ -562,6 +563,7 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
if (ObjectUtil.isEmpty(ljUserVos.getPoints())) ljUserVos.setPoints(0);
if (ObjectUtil.isEmpty(ljUserVos.getGrowthValue())) ljUserVos.setGrowthValue(0);
// 计算之后修改对应余额
BigDecimal bigBidBalance = new BigDecimal(cardValueRecordDTO.getRechargeBalance());
@ -605,7 +607,7 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
commissionRecord.setAmount(cardValueRecord.getAmountCommission());
commissionRecord.setOrderNo(cardValueRecord.getPaymentNo());
commissionRecord.setDescription("余额充值提成");
commissionRecord.setType("余额充值");
commissionRecord.setType("3");
commissionRecord.setStoreId(cardValueRecord.getStoreId());
return commissionRecord;
}

View File

@ -103,6 +103,11 @@ public class HandoverRecordController extends BaseController {
return getSuccessResult(handoverRecordService.handover());
}
@GetMapping("handoverByAllOrder")
public ResponseObject handoverByAllOrder() {
return getSuccessResult(handoverRecordService.handoverByAllOrder());
}
/**
* 本地打印
* @return

View File

@ -208,9 +208,9 @@ limit 1
<select id="oilOrderStatistics" resultType="java.util.Map">
select
sum(order_amount) oilOrder,-- 油品订单
sum(if(order_status='refund',discount_amount,0)) oilRefund, -- 退款
sum(if(order_status='paid',pay_amount,0)) oilPaid,
sum(if(order_status='paid',discount_amount,0)) oilDiacount
sum(if(order_status='refund',discount_amount,0.00)) oilRefund, -- 退款
sum(if(order_status='paid',pay_amount,0.00)) oilPaid,
sum(if(order_status='paid',discount_amount,0.00)) oilDiacount
from oil_order
where store_id = #{storeId}
and create_time BETWEEN #{startTime} AND #{endTime};
@ -321,6 +321,7 @@ limit 1
left join oil_name onn on on1.oil_name = onn.id
left join oil_order oo on oo.oils = onn.id
where on1.store_id = #{storeId}
and oo.store_id = 60
and oo.create_time BETWEEN #{startTime} AND #{endTime}
GROUP BY oo.oils
</select>

View File

@ -61,6 +61,8 @@ public interface HandoverRecordService {
public Map<String, Object> handover();
public Map<String, Object> handoverByAllOrder();
public void printLocally(Map<String, Object> aa);

View File

@ -192,7 +192,7 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper,AllO
refund.put("result_msg","SUCCESS");
flag = true;
}
log.info("支付返回信息{}",refund.get("result_msg"));
log.info("支付返回信息{}",refund);
// 处理退款结果
if ("SUCCESS".equals(refund.get("result_msg"))) {
// 修改该总订单的数据
@ -222,6 +222,12 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper,AllO
if (flag) {
return 1;// 当前为现金支付
}
if (!flag) {
String mchntCd = refund.get("mchnt_cd");
merchantConfigService.subtractAmount(allOrderInfo.getStoreId(), map.get("refundAmt"),mchntCd);
}
// 修改商户配置
}else {
throw new RuntimeException("退款失败");
}

View File

@ -199,6 +199,7 @@ public class HandoverRecordServiceImpl implements HandoverRecordService {
public Map<String, Object> orderSummary(String startTime, String endTime) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Map<String, Object> allStatistics = new HashMap<>();
// 油品订单(订单) 油品订单(退款) 油品订单(实收) 油品优惠(实收) 油品交易(实收)
Map<String, Object> oilOrderStatistics = handoverRecordMapper.oilOrderStatistics(startTime, endTime, nowAccountInfo.getStoreId());
// 会员储值(订单) 会员储值(退款) 会员储值(实收) 储值赠送(订单) 储值赠送(退款) 储值赠送(实际)
@ -207,18 +208,41 @@ public class HandoverRecordServiceImpl implements HandoverRecordService {
// 普通收款(订单) 普通收款(退款) 普通收款(实收)
Map<String, Object> goodsOrderStatistics = handoverRecordMapper.goodsOrderStatistics(startTime, endTime, nowAccountInfo.getStoreId());
if (!ObjectUtil.isEmpty(oilOrderStatistics)) {
if(!ObjectUtil.isEmpty(cardOrderStatistics)) {
oilOrderStatistics.putAll(cardOrderStatistics);
}
if(!ObjectUtil.isEmpty(fuelOrderStatistics)) {
oilOrderStatistics.putAll(fuelOrderStatistics);
}
if(!ObjectUtil.isEmpty(goodsOrderStatistics)) {
oilOrderStatistics.putAll(goodsOrderStatistics);
}
allStatistics.putAll(oilOrderStatistics);
}else{
allStatistics.put("oilOrder",0.00);
allStatistics.put("oilRefund",0.00);
allStatistics.put("oilPaid",0.00);
allStatistics.put("oilDiacount",0.00);
}
if(!ObjectUtil.isEmpty(cardOrderStatistics)) {
allStatistics.putAll(cardOrderStatistics);
}else {
allStatistics.put("cardOrder",0.00);
allStatistics.put("cardRefund",0.00);
allStatistics.put("cardPaid",0.00);
allStatistics.put("cardGiftOrder",0.00);
allStatistics.put("cardGiftRefund",0.00);
allStatistics.put("cardGiftPaid",0.00);
}
if(!ObjectUtil.isEmpty(fuelOrderStatistics)) {
allStatistics.putAll(fuelOrderStatistics);
} else {
allStatistics.put("fuelOrder",0.00);
allStatistics.put("fuelRefund",0.00);
allStatistics.put("fuelPaid",0.00);
return oilOrderStatistics;
}
if(!ObjectUtil.isEmpty(goodsOrderStatistics)) {
allStatistics.putAll(goodsOrderStatistics);
}else {
allStatistics.put("goodsOrder",0.00);
allStatistics.put("goodsRefund",0.00);
allStatistics.put("goodsPaid",0.00);
}
// }
return allStatistics;
}
/**
@ -388,6 +412,47 @@ public class HandoverRecordServiceImpl implements HandoverRecordService {
return map;
}
@Override
public Map<String, Object> handoverByAllOrder() {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
MtStore mtStore = new MtStore();
try {
mtStore = storeService.queryStoreById2(nowAccountInfo.getStoreId());
} catch (BusinessCheckException e) {
e.printStackTrace();
}
// 获取当前日期
LocalDate today = LocalDate.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// 格式化当前时间
String formattedEndTime = LocalDateTime.now().format(formatter);
Map<String, Object> handoverMap = new HashMap<>();
String startTime = "2023-01-01 12:12:12";
HandoverRecord handoverRecord = selectByTime();
if (!ObjectUtil.isEmpty(handoverRecord) && !ObjectUtil.isEmpty(handoverRecord.getEndTime())) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
startTime = sdf.format(handoverRecord.getEndTime());
}
LJStaff ljStaff = iljStaffService.selectStaffById(nowAccountInfo.getStaffId());
// String handover = iSysDictDataService.selectDictLabel("handover", ljStaff.getHandoverMode());
String handoverType = "暂无";
Map<String, Object> baseInfo = new HashMap<>();
baseInfo.put("storeName", mtStore.getName());
baseInfo.put("realName", nowAccountInfo.getRealName());
baseInfo.put("handoverType", handoverType);
baseInfo.put("startTime", startTime);
baseInfo.put("endTime", formattedEndTime);
handoverMap.put("baseInfo",baseInfo);
return null;
}
private static final String LOAD_LIBRARY = "TSCLIB";
//打印机

View File

@ -131,13 +131,15 @@ public class OilTankServiceImpl implements OilTankService {
// 根据油罐id加锁 同一时间只能
String lockKey = "oilTank-"+tankId;
Boolean isLock = redisLock.tryLock(lockKey,500,5000, TimeUnit.MILLISECONDS);
if (isLock) {
OilTank oilTank = oilTankDao.queryById(tankId);
// 计算总升数
// 计算总升数(相加)
// BigDecimal tankVolumeBigDecimal = new BigDecimal(oilTank.getTankVolume().toString());
BigDecimal changeNumBigDecimal = new BigDecimal(changeNum.toString());
BigDecimal storedQuantityBigDecimal = changeNumBigDecimal.subtract(new BigDecimal(oilTank.getStoredQuantity().toString()));
BigDecimal storedQuantityBigDecimal = changeNumBigDecimal.add(new BigDecimal(oilTank.getStoredQuantity().toString()));
if (storedQuantityBigDecimal.toString().compareTo(oilTank.getTankVolume().toString())>0) {
if (storedQuantityBigDecimal.compareTo(new BigDecimal(oilTank.getTankVolume()))>0) {
redisLock.unlock(lockKey);
throw new RuntimeException(""+ oilTank.getTankName() +"”油罐中容量不足,无法进行增加!");
}

View File

@ -231,6 +231,8 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
// 所属的连锁店类型
String deptType = param.get("deptType") == null ? "0" : param.get("deptType").toString();
// 判断是否能创建站长 z001为站长的枚举值 后期需要创建一个角色的枚举类
if (!"3".equals(deptType) && "z001".equals(code) ) {
throw new RuntimeException("用户角色与组织架构不匹配!");
@ -295,9 +297,9 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
}
ljStaffMapper.insert(staff);
LJStaff staff1 = ljStaffMapper.selectById(staff.getId());
if (ObjectUtil.isNotEmpty(staff1)){
editTAccount.setStaffId(staff1.getId());
// LJStaff staff1 = ljStaffMapper.selectById(staff.getId());
if (ObjectUtil.isNotEmpty(staff.getId())){
editTAccount.setStaffId(staff.getId());
updateAccount(editTAccount);
}
@ -459,7 +461,7 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
}
if (id > 0 ) {
return this.getAccountInfoById(id);
return this.getAccountInfoById(account.getAcctId());
} else {
throw new BusinessRuntimeException("创建账号错误");
}
@ -555,7 +557,8 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
@Transactional(rollbackFor = Exception.class)
@OperationServiceLog(description = "修改后台账户")
public void updateAccount(TAccount tAccount) {
tAccountMapper.updateById(tAccount);
int i = tAccountMapper.updateById(tAccount);
System.out.println("1119"+i);
}
/**

View File

@ -370,7 +370,8 @@
<div class="app-bottom">
<el-card >
<div class="bottom-xz">
<div class="anniu" v-if="handoverList && handoverList.baseInfo && handoverList.baseInfo.handoverPrem == 'yqx'" @click="shift">交班</div>
<!-- <div class="anniu" v-if="handoverList && handoverList.baseInfo && handoverList.baseInfo.handoverPrem == 'yqx'" @click="shift">交班</div>-->
<div class="anniu" @click="shift">交班</div>
<!-- <div class="anniu-lv">云打印</div> -->
<div class="anniu-lv" @click="printLocally()">本地打印</div>
<div ><el-link type="primary" @click="recording">交班记录</el-link></div>
@ -501,7 +502,7 @@ import {removeUserId} from "@/utils/auth";
})
},
//
shift() {
async shift() {
let msg = '交班并退出系统, 是否继续?'
let flag = false
if (this.handoverList && this.handoverList.baseInfo && this.handoverList.baseInfo.handoverOut == 'jbtc') {
@ -529,7 +530,9 @@ import {removeUserId} from "@/utils/auth";
location.href = '/';
})
}
this.getHandover();
})
this.getHandover();
//
// this.$message({
// type: 'success',