This commit is contained in:
cun-nan 2024-10-12 11:43:08 +08:00
parent db50b79180
commit 5ec65bef7b
7 changed files with 399 additions and 378 deletions

View File

@ -120,7 +120,8 @@ public class FyPayServiceImpl implements FyPayService {
String str = resMap.get("sign");
String resultCode = resMap.get("result_code");
if (!resultCode.equals("000000")) {
throw new RuntimeException(resMap.get("result_msg"));
// throw new RuntimeException(resMap.get("result_msg"));
log.error(resMap.get("result_msg"));
}
if (Utils.verifySign(resMap, str)) {
ThreadUtil.execAsync(() -> {
@ -199,8 +200,6 @@ public class FyPayServiceImpl implements FyPayService {
//响应报文验签
Map<String, String> reqMap = Utils.xmlStr2Map(rspXml);
String str = reqMap.get("sign");
//查询总订单
AllOrderInfo allOrderInfo = allOrderInfoService.selectAllOrderInfoByOrderNo(orderNo);
if (Utils.verifySign(reqMap, str)) {
//油品订单
OilOrder oilOrder = oilOrderService.selectOilOrderByOrderNo(orderNo);
@ -237,29 +236,10 @@ public class FyPayServiceImpl implements FyPayService {
oilOrder.setPayTime(date);
oilOrderService.updateCardAndActiveById(oilOrder.getStoreId(), oilOrder.getUserId(), oilOrder.getId());
oilOrderService.insertFavorable(oilOrder, Double.valueOf(map1.get("oilCardAmount")));
if (ObjectUtil.isNotEmpty(oilOrder.getStaffId()))
staffCommissionService.countStaffCommission(oilOrder.getStaffId(), oilOrder.getStoreId(), oilOrder.getOrderAmount(), oilOrder.getPayAmount(), "1", orderNo);
// 修改油罐容量
oilOrderService.addOilTracks(oilOrder, oilOrder.getStoreId());
if (ObjectUtil.isNotEmpty(oilOrder.getUserId())) integralSettingsService.refuelPoints(oilOrder);
//修改优惠券使用状态
//新表
CardCouponUser cardCouponUser = cardCouponUserMapper.selectOne(new LambdaQueryWrapper<CardCouponUser>()
.eq(CardCouponUser::getOrderId, allOrderInfo.getId()));
if (ObjectUtil.isNotEmpty(cardCouponUser)) {
cardCouponUser.setStatus("1");
cardCouponUser.setUpdateTime(date);
cardCouponUser.setUpdateBy(TokenUtil.getNowAccountInfo().getId().toString());
cardCouponUserMapper.updateById(cardCouponUser);
}
// if (oilOrder.getCouponId() != null) {
// CardFavorableRecord byId = cardFavorableRecordService.getById(oilOrder.getCouponId());
// if (!ObjectUtil.isEmpty(byId)) {
// byId.setStatus("1");
// cardFavorableRecordService.updateById(byId);
// }
// }
}
if (!ObjectUtil.isEmpty(goodsOrder)) {
// 商品订单
@ -270,8 +250,6 @@ public class FyPayServiceImpl implements FyPayService {
if (goodsOrder.getUserId() != null) {
isMember = true;
}
if (ObjectUtil.isNotEmpty(goodsOrder.getStaffId()))
staffCommissionService.countStaffCommission(goodsOrder.getStaffId(), goodsOrder.getStoreId(), goodsOrder.getAmount(), goodsOrder.getPayAmount(), "2", orderNo);
if (!map1.get("goodsOrder").equals("[]")) {
List<JSONObject> goods = JSONArray.parseArray(map1.get("goodsOrder"), JSONObject.class);
OrderGoods orderGoods = new OrderGoods();
@ -425,10 +403,28 @@ public class FyPayServiceImpl implements FyPayService {
}
receiveParameter.setContent("积分订单");
}
// 往总表添加信息
AllOrderInfo allOrderInfo = null;
if (!reqMap.get("trans_stat").equals("USERPAYING")) {
String payChannel = "cashier";
if (ObjectUtil.isNotEmpty(map1.get("payChannel"))) payChannel = map1.get("payChannel");
this.insertAllOrderInfo(receiveParameter, payStatus, discountAmount, payChannel, merchantConfig);
if (payStatus.equals("paid")){
//查询总订单
allOrderInfo = allOrderInfoService.selectAllOrderInfoByOrderNo(orderNo);
// 添加提成记录信息
staffCommissionService.countStaffCommission(null,null, null, null, null, orderNo);
//修改优惠券使用状态
//新表
CardCouponUser cardCouponUser = cardCouponUserMapper.selectOne(new LambdaQueryWrapper<CardCouponUser>()
.eq(CardCouponUser::getOrderId, allOrderInfo.getId()));
if (ObjectUtil.isNotEmpty(cardCouponUser)) {
cardCouponUser.setStatus("1");
cardCouponUser.setUpdateTime(date);
cardCouponUser.setUpdateBy(TokenUtil.getNowAccountInfo().getId().toString());
cardCouponUserMapper.updateById(cardCouponUser);
}
}
}
if (ObjectUtil.isNotEmpty(merchantConfig)) {
//添加配置记录信息
@ -448,6 +444,8 @@ public class FyPayServiceImpl implements FyPayService {
//推荐会员充值有礼
activeRecommendRecordsService.recommendMembersRechargePolite(allOrderInfo.getStoreId(), allOrderInfo.getUserId(), allOrderInfo.getPayType());
}else {
//查询总订单
AllOrderInfo allOrderInfo = allOrderInfoService.selectAllOrderInfoByOrderNo(orderNo);
//删除会员折扣记录
UserDiscountRecord userDiscountRecord = userDiscountRecordService.queryByOrderId(allOrderInfo.getId());
if (ObjectUtil.isNotEmpty(userDiscountRecord)) {

View File

@ -235,7 +235,8 @@ public class CommissionRecordServiceImpl implements CommissionRecordService {
//根据员工id查询用户角色
NewMtStaff newMtStaff = newMtStaffMapper.selectById(staffId);
if (ObjectUtil.isNull(newMtStaff)) {
throw new RuntimeException("员工不存在");
// throw new RuntimeException("员工不存在");
return;
}
String roleId = newMtStaff.getRoleId();
//查询对应的提成策略

View File

@ -21,7 +21,7 @@ import java.util.List;
* @since 2023-11-07 15:04:17
*/
@Data
@TableName("lj_order")
@TableName("mt_order")
@ApiModel(value = "LJOrder对象", description = "商品订单表")
public class LJOrder extends BaseEntity implements Serializable {

View File

@ -15,7 +15,7 @@ import java.io.Serializable;
* 订单商品表(OrderGoods)实体类
*/
@Data
@TableName("lj_order_goods")
@TableName("mt_order_goods")
@ApiModel(value = "OrderGoods对象", description = "订单商品表")
public class OrderGoods extends BaseEntity implements Serializable {

View File

@ -395,9 +395,9 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
// 商品订单信息商品订单列表
String goodsOrder = map.get("goodsOrder");
// 储值卡消费金额 没有默认传0
String balanceAmount = map.get("balanceAmount");
String balanceAmount = ObjectUtil.isNotEmpty(map.get("balanceAmount")) ? map.get("balanceAmount") : "0";
// 囤油卡消费升数 没有默认传0
String oilCardAmount = map.get("oilCardAmount");
String oilCardAmount = ObjectUtil.isNotEmpty(map.get("oilCardAmount")) ? map.get("oilCardAmount") : "0";
// 支付类型
String payType = map.get("payType");
// 油品订单金额
@ -413,7 +413,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
// 油枪id
String oilGunId = map.get("oilGunId");
// 活动营销优惠金额
Double activeAmount = Double.valueOf(map.get("activeAmount"));
Double activeAmount = Double.valueOf(ObjectUtil.isNotEmpty(map.get("activeAmount")) ? map.get("activeAmount") : "0.0");
// 优惠券 用户 id
Integer couponUserId = null;
if (StringUtils.isNotEmpty(map.get("couponUserId"))) {
@ -454,9 +454,9 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
isMember = true;
}
// 使用积分数量
Integer usePoint = Integer.valueOf(map.get("usePoint"));
Integer usePoint = Integer.valueOf(ObjectUtil.isNotEmpty(map.get("usePoint")) ? map.get("usePoint") :"0");
// 积分金额
Double pointAmount = Double.valueOf(map.get("pointAmount"));
Double pointAmount = Double.valueOf(ObjectUtil.isNotEmpty(map.get("pointAmount")) ? map.get("pointAmount") : "0.0");
// 终端
String terminal = map.get("terminal");
// 商品id列表
@ -507,11 +507,8 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
ljOrder.setDiscount(goodsDiscount);
ljOrder.setStaffId(staffId);
ljOrder.setStatus(payStatus);
if (couponType.equals("5")) ljOrder.setCouponUserId(couponUserId);
if (ObjectUtil.isNotEmpty(couponType) && couponType.equals("5")) ljOrder.setCouponUserId(couponUserId);
if (payType.equals("CASH")) {
// 计算提成
if (ObjectUtil.isNotEmpty(staffId))
staffCommissionService.countStaffCommission(staffId, storeId, goodsAmount, goodsActualPay, "2", orderNo);
ljOrder.setPayTime(new Date());
}
// 将商品订单的json数据转换为数组
@ -554,16 +551,13 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
order.setDiscountAmount(oilDiscount);
order.setBalanceAmount(Double.valueOf(balanceAmount));
order.setOilCardAmount(Double.valueOf(oilCardAmount));
if (payType.equals("CASH") && ObjectUtil.isNotEmpty(staffId)) {
staffCommissionService.countStaffCommission(staffId, storeId, oilAmount, oilActualPay, "1", orderNo);
}
order.setActiveAmount(activeAmount);
order.setStoreId(storeId);
order.setUserId(userId);
order.setStaffId(staffId);
order.setTerminal(terminal);
order.setOils((String) jsonObject.get("oils"));
order.setOils(jsonObject.get("oils").toString());
order.setOilGunNum(jsonObject.get("oilGunNum").toString());
order.setOilNum(oilNum);
order.setPayUser(payUser);
@ -571,7 +565,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
order.setInvoicing("未开票");
order.setOrderStatus(payStatus);
order.setTankId(Integer.valueOf(jsonObject.get("tankId").toString()));
if (!couponType.equals("5")) order.setCouponId(couponUserId);
if (ObjectUtil.isNotEmpty(couponType) && !couponType.equals("5")) order.setCouponId(couponUserId);
if (ObjectUtil.isNotEmpty(jsonObject.get("activeId"))) {
order.setActiveId(Integer.valueOf(jsonObject.get("activeId").toString()));
}
@ -581,8 +575,8 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
if (payType.equals("CASH") || payType.equals("after_pay") || payType.equals("card_value")) {
order.setPayTime(new Date());
order.setOrderStatus("paid");
this.insertCardBalance(consumeAmount, userId, storeId, orderNo);
this.addOilTrack(jsonObject, storeId);
if(ObjectUtil.isNotEmpty(userId)) this.insertCardBalance(consumeAmount, userId, storeId, orderNo);
this.addOilTracks(order, storeId);
if (ObjectUtil.isNotEmpty(userId)) {
this.updateGrowthValue(oilAmount, oilActualPay, userId, Integer.valueOf(jsonObject.get("oils").toString()), storeId, orderNo);
}
@ -614,7 +608,6 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
cashierOrder.setPayAmount(0.0);
}
cashierOrder.setPayTime(new Date());
this.insertAllOrderInfo(orderNo, storeId, oilAmount + goodsAmount, Double.valueOf(map.get("allAmount")), oilDiscount, payType, userId, "PC", "6", "paid");
} else {
cashierOrder.setPayAmount(oilActualPay + goodsActualPay);
}
@ -657,6 +650,10 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
}
} else {
this.insertAllOrderInfo(orderNo, storeId, oilAmount + goodsAmount, Double.valueOf(map.get("allAmount")), oilDiscount, payType, userId, "PC", "6", "paid");
// 计算提成
if (ObjectUtil.isNotEmpty(staffId))
staffCommissionService.countStaffCommission(staffId, storeId, goodsAmount, goodsActualPay, "6", orderNo);
}
OilOrder oilOrder2 = this.selectOilOrderByOrderNo(orderNo);

File diff suppressed because it is too large Load Diff

View File

@ -67,7 +67,7 @@ export default {
console.log(`ruleForm.amount 的类型是:`, typeof this.ruleForm.amount);
this.$emit('fatherMethod', this.ruleForm.amount.toFixed(2))
this.$emit('fatherMethod', this.ruleForm.amount)
} else {
console.log('error submit!!')
return false
@ -97,7 +97,7 @@ export default {
<div>{{ goodsItem.oilPrice }}/L</div>
</div>
<el-form-item prop="amount" label="" class="item10086">
<el-input v-model.number="ruleForm.amount" placeholder="请输入加油金额" >
<el-input v-model="ruleForm.amount" placeholder="请输入加油金额" >
<template slot="append"></template>
</el-input>
</el-form-item>