diff --git a/fuintAdmin_zt/src/views/components/Service/payment.vue b/fuintAdmin_zt/src/views/components/Service/payment.vue index 8724bdda0..b72a13eed 100644 --- a/fuintAdmin_zt/src/views/components/Service/payment.vue +++ b/fuintAdmin_zt/src/views/components/Service/payment.vue @@ -97,6 +97,29 @@ :data="tableData1" style="width: 100%;margin-bottom: 20px;" border> + + + + + + + + + {{ scope.row.proportion }}% + + + + + 会员充值, + 便利店, + 积分商城, + {{ scope.row.oilGunName }} + 油品+便利店组合付款 + + + + + - - 规则名称 - + + + - + @@ -249,10 +272,10 @@ + v-for="(item1,i) in merchantList" + :key="item1.id" + :label="item1.remark ? (item1.merchantName+'('+item1.remark+')') : (item1.merchantName+'(--)')" + :value="item1.id"> @@ -275,10 +298,10 @@ + v-for="(item1,i) in merchantList" + :key="item1.id" + :label="item1.remark ? (item1.merchantName+'('+item1.remark+')') : (item1.merchantName+'(--)')" + :value="item1.id"> @@ -286,20 +309,21 @@ style="width: 300px" disabled> - + + - - + + + v-for="item1 in oilGunList" + :key="item1.id" + :label="item1.oilNumber+'-'+item1.gunName" + :value="item1.id+''"> @@ -697,6 +721,9 @@ export default { deptId: [ {required: true, message: '请选择机构信息', trigger: 'blur'}, ], + ruleName: [ + {required: true, message: '请输入规则名称', trigger: 'blur'}, + ], } } }, @@ -721,7 +748,49 @@ export default { // 确定信息 submitAddRule(){ this.$refs["formRule"].validate(valid => { + if (this.formRule.ruleType == 2) { + let typeList = [] + let oilGunIds = [] + this.formRule.ruleList.forEach(item => { + if (item.oilGunId) { + oilGunIds.push(...item.oilGunId) + } + if (item.transactionType) { + typeList.push(...item.transactionType) + } + }) + typeList = typeList.filter((item, index, arr) => arr.indexOf(item) === index); + oilGunIds = oilGunIds.filter((item, index, arr) => arr.indexOf(item) === index); + if (typeList.length < 5) { + this.$message.error("请确保交易类型全部选择") + return + } + if (oilGunIds.length < this.oilGunList.length) { + this.$message.error("请确保油枪号全部选择") + return; + } + }else { + let proportion = 0 + this.formRule.ruleList.forEach(item => { + if (item.proportion) { + proportion += Number(item.proportion) + } + }) + console.log(proportion) + if (proportion!=100){ + this.$message.error("请确保交易占比相加为百分之百") + return; + } + } if (valid) { + this.formRule.ruleList.forEach(item => { + if (item.oilGunId){ + item.oilGunId = item.oilGunId.toString() + } + if (item.transactionType){ + item.transactionType = item.transactionType.toString() + } + }) if (this.formRule.id) { editRuleConfig(this.formRule).then(res => { if (res.data === 1) { @@ -798,6 +867,14 @@ export default { this.Ruletitle = '修改商户信息' this.addRule = true this.formRule = res.data + this.formRule.ruleList.forEach(item => { + if (item.oilGunId){ + item.oilGunId = item.oilGunId.split(",") + } + if (item.transactionType){ + item.transactionType = item.transactionType.split(",") + } + }) }) }, EnableRule(data){ diff --git a/fuintAdmin_zt/src/views/components/Service/staff.vue b/fuintAdmin_zt/src/views/components/Service/staff.vue index c5ce29c78..7bcd27f95 100644 --- a/fuintAdmin_zt/src/views/components/Service/staff.vue +++ b/fuintAdmin_zt/src/views/components/Service/staff.vue @@ -49,7 +49,9 @@ diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/controller/FyPayController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/controller/FyPayController.java index 03990cce7..c89b0f3a1 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/controller/FyPayController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/controller/FyPayController.java @@ -81,8 +81,31 @@ public class FyPayController { allOrderInfo.setPayTime(new Date()); allOrderInfoService.updateAllOrderInfo(allOrderInfo); + String transactionType = null; + String oilGunId = null; + OilOrder oilOrder = orderService.selectOilOrderByOrderNo(orderNo); + if (allOrderInfo.getType().equals("1")){ + transactionType = "4"; + oilGunId = oilOrder.getOilGunNum(); + }else if (allOrderInfo.getType().equals("2")){ + transactionType = "2"; + }else if (allOrderInfo.getType().equals("3") || allOrderInfo.getType().equals("5")){ + transactionType = "1"; + }else if (allOrderInfo.getType().equals("4")){ + transactionType = "3"; + }else if (allOrderInfo.getType().equals("6")){ + transactionType = "5"; + }else if (allOrderInfo.getType().equals("8")){ + if (ObjectUtil.isNotEmpty(oilOrder)){ + transactionType = "4"; + oilGunId = oilOrder.getOilGunNum(); + }else { + transactionType = "1"; + } + } + // 修改配置收款账户余额信息 - MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(allOrderInfo.getStoreId()); + MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(allOrderInfo.getStoreId(),transactionType,oilGunId); Double beforeAmount = merchantConfig.getAmount(); Double afterAmount = beforeAmount + allOrderInfo.getPayMoney(); merchantConfig.setAmount(afterAmount); @@ -114,17 +137,17 @@ public class FyPayController { } } - @GetMapping("/test") - public String test() throws Exception { - ReceiveParameterPos receiveParameterPos = new ReceiveParameterPos(); - receiveParameterPos.setPayType("WECHAT"); - receiveParameterPos.setContent("ceshi"); - receiveParameterPos.setOrderNo("20240509fdskjhv003"); - receiveParameterPos.setStoreId(141); - receiveParameterPos.setGoodsMoney(0.01); - fyPayService.mainScan(receiveParameterPos); - return "succse"; - } +// @GetMapping("/test") +// public String test() throws Exception { +// ReceiveParameterPos receiveParameterPos = new ReceiveParameterPos(); +// receiveParameterPos.setPayType("WECHAT"); +// receiveParameterPos.setContent("ceshi"); +// receiveParameterPos.setOrderNo("20240509fdskjhv003"); +// receiveParameterPos.setStoreId(141); +// receiveParameterPos.setGoodsMoney(0.01); +// fyPayService.mainScan(receiveParameterPos); +// return "succse"; +// } // 接收支付平台异步通知的接口 @PostMapping("/notifyScan") @@ -148,8 +171,31 @@ public class FyPayController { allOrderInfo.setPayTime(new Date()); allOrderInfoService.updateAllOrderInfo(allOrderInfo); + String transactionType = null; + String oilGunId = null; + OilOrder oilOrder = orderService.selectOilOrderByOrderNo(orderNo); + if (allOrderInfo.getType().equals("1")){ + transactionType = "4"; + oilGunId = oilOrder.getOilGunNum(); + }else if (allOrderInfo.getType().equals("2")){ + transactionType = "2"; + }else if (allOrderInfo.getType().equals("3") || allOrderInfo.getType().equals("5")){ + transactionType = "1"; + }else if (allOrderInfo.getType().equals("4")){ + transactionType = "3"; + }else if (allOrderInfo.getType().equals("6")){ + transactionType = "5"; + }else if (allOrderInfo.getType().equals("8")){ + if (ObjectUtil.isNotEmpty(oilOrder)){ + transactionType = "4"; + oilGunId = oilOrder.getOilGunNum(); + }else { + transactionType = "1"; + } + } + // 修改配置收款账户余额信息 - MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(allOrderInfo.getStoreId()); + MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(allOrderInfo.getStoreId(),transactionType,oilGunId); Double beforeAmount = merchantConfig.getAmount(); Double afterAmount = beforeAmount + allOrderInfo.getPayMoney(); merchantConfig.setAmount(afterAmount); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/entity/PaymentRuleConfig.java b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/entity/PaymentRuleConfig.java index 258969365..770cf8a29 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/entity/PaymentRuleConfig.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/entity/PaymentRuleConfig.java @@ -78,6 +78,10 @@ public class PaymentRuleConfig extends BaseEntity implements Serializable { * 修改用户 */ private String updateBy; + /** + * 是否手动启用 + */ + private String handEnable; @TableField(exist = false) private List ruleList; diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/entity/ReceiveParameter.java b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/entity/ReceiveParameter.java index 8b185b904..5b27b4626 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/entity/ReceiveParameter.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/entity/ReceiveParameter.java @@ -35,4 +35,8 @@ public class ReceiveParameter { * 订单描述 */ private String content; + /** + * 油枪id + */ + private String oilGunId; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/entity/ReceiveParameterPos.java b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/entity/ReceiveParameterPos.java index 3f7594fc3..b854d140b 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/entity/ReceiveParameterPos.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/entity/ReceiveParameterPos.java @@ -43,4 +43,8 @@ public class ReceiveParameterPos { * 订单描述 */ private Double oilCardAmount; + /** + * 油枪id + */ + private String oilGunId; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/mapper/MerchantConfigMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/mapper/MerchantConfigMapper.java index afc5ce287..1c7ad9d8f 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/mapper/MerchantConfigMapper.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/mapper/MerchantConfigMapper.java @@ -11,5 +11,5 @@ public interface MerchantConfigMapper extends BaseMapper { MerchantConfig getConfig(@Param("storeId") Integer storeId, @Param("mchntCd") String mchntCd); int subtractAmount(@Param("id") Integer id,@Param("changeTheAmount") Double changeTheAmount); - List selectList(@Param("merchantConfig") MerchantConfigVo merchantConfig); + List selectList1(@Param("merchantConfig") MerchantConfigVo merchantConfig); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/mapper/xml/MerchantConfigMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/mapper/xml/MerchantConfigMapper.xml index 646792ca2..185fbba9b 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/mapper/xml/MerchantConfigMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/mapper/xml/MerchantConfigMapper.xml @@ -14,7 +14,7 @@ mchnt_cd = #{mchntCd} limit 1 - SELECT mc.*,sd.dept_name,ta.real_name FROM `merchant_config` mc LEFT JOIN sys_dept sd ON mc.dept_id = sd.dept_id diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/MerchantConfigService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/MerchantConfigService.java index bb9ae2e77..d21a35ac7 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/MerchantConfigService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/MerchantConfigService.java @@ -20,10 +20,19 @@ public interface MerchantConfigService extends IService { /** * 根据店铺id查询正在使用的商户信息 + * @param storeId 店铺id + * @param transactionType 交易类型 1、会员充值;2、便利店;3、积分商城;4、油品;5、油品+便利店组合付款 + * @param oilGunId 油枪id 不是油品付款传null + * @return + */ + public MerchantConfig selectMeChByIdIsUse(Integer storeId,String transactionType,String oilGunId); + + /** + * 根据店铺id查询正在使用的商户信息(备份) * @param storeId * @return */ - public MerchantConfig selectMeChByIdIsUse(int storeId); + public MerchantConfig selectMeChByIdIsUse1(int storeId); /** * 根据storeId修改消费后的金额信息 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/OilConfigService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/OilConfigService.java index 9e7af5cef..d89fd1a0f 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/OilConfigService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/OilConfigService.java @@ -14,6 +14,15 @@ public interface OilConfigService extends IService { * 规则配置 */ public void oilRule(Integer storeId); + /** + * 规则配置 交易占比 + */ + public void oilRule1(Integer storeId,Integer ruleConfigId); + + /** + * 规则配置 交易类型 + */ + public void oilRule2(Integer storeId,Integer ruleConfigId,String transactionType,String oilGunId); /** * 判断占比相加是否为100% 是返回1 不是返回0 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/PaymentRuleConfigService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/PaymentRuleConfigService.java index eb45eb66b..05b169a50 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/PaymentRuleConfigService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/PaymentRuleConfigService.java @@ -56,6 +56,13 @@ public interface PaymentRuleConfigService extends IService { */ int enablePaymentRuleConfig(PaymentRuleConfig ruleConfig); + /** + * 根据店铺id查询正在使用的规则信息 + * @param storeId + * @return + */ + PaymentRuleConfig selectInfoByStoreId(Integer storeId); + /** * 判断规则是否到启用时间 */ diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/FyPayServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/FyPayServiceImpl.java index 2dfd96ae0..bdeeceaba 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/FyPayServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/FyPayServiceImpl.java @@ -190,7 +190,23 @@ public class FyPayServiceImpl implements FyPayService { List list = oilOrderService.selectOilOrder(orderNo); LJOrder goodsOrder = goodsOrderService.selectGoodsOrder(orderNo); CashierOrder cashierOrder = cashierOrderService.selectCashierOrder(orderNo); - MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(storeId1); + String transactionType = null; + String oilGunId = null; + if (ObjectUtil.isNotEmpty(oilOrder) && ObjectUtil.isNotEmpty(goodsOrder)){ + transactionType = "5"; + }else if (ObjectUtil.isNotEmpty(oilOrder)) { + transactionType = "4"; + oilGunId = oilOrder.getOilGunNum(); + }else if (ObjectUtil.isNotEmpty(goodsOrder)) { + transactionType = "2"; + } + if ("CVR".equals(type) || "CFR".equals(type)) { + transactionType = "1"; + } + if ("IOS".equals(type)) { + transactionType = "3"; + } + MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(storeId1,transactionType,oilGunId); List returnRecords = returnRecordService.selectReturnRecordByOrderNo(orderNo); Date date = new Date(); if (reqMap.get("trans_stat").equals("SUCCESS")) { @@ -466,8 +482,22 @@ public class FyPayServiceImpl implements FyPayService { public Map applet(ReceiveParameter receiveParameter) { Map res = new HashMap<>(); try { + String transactionType = null; + String oilGunId = null; + if (receiveParameter.getType().equals("1")){ + transactionType = "4"; + oilGunId = receiveParameter.getOilGunId(); + } else if (receiveParameter.getType().equals("2")){ + transactionType = "2"; + } else if (receiveParameter.getType().equals("3") || receiveParameter.getType().equals("5")){ + transactionType = "1"; + } else if (receiveParameter.getType().equals("4")){ + transactionType = "3"; + } else if (receiveParameter.getType().equals("6")){ + transactionType = "5"; + } // 查询商户配置信息 - MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(receiveParameter.getStoreId()); + MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(receiveParameter.getStoreId(),transactionType,oilGunId); if (ObjectUtil.isEmpty(merchantConfig)) { res.put("code", "error"); res.put("msg", "暂未配置商户信息"); @@ -659,8 +689,22 @@ public class FyPayServiceImpl implements FyPayService { public Map posPay(ReceiveParameterPos receiveParameterPos) { Map res = new HashMap<>(); try { + String transactionType = null; + String oilGunId = null; + if (receiveParameterPos.getType().equals("1")){ + transactionType = "4"; + oilGunId = receiveParameterPos.getOilGunId(); + } else if (receiveParameterPos.getType().equals("2")){ + transactionType = "2"; + } else if (receiveParameterPos.getType().equals("3") || receiveParameterPos.getType().equals("5")){ + transactionType = "1"; + } else if (receiveParameterPos.getType().equals("4")){ + transactionType = "3"; + } else if (receiveParameterPos.getType().equals("6")){ + transactionType = "5"; + } // 查询商户配置信息 - MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(receiveParameterPos.getStoreId()); + MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(receiveParameterPos.getStoreId(),transactionType,oilGunId); if (ObjectUtil.isEmpty(merchantConfig)) { res.put("code", "error"); res.put("msg", "暂未配置商户信息"); @@ -746,7 +790,21 @@ public class FyPayServiceImpl implements FyPayService { String str = reqMap.get("sign"); if (Utils.verifySign(reqMap, str)) { OilOrder oilOrder = oilOrderService.selectOilOrderByOrderNo(receiveParameterPos.getOrderNo()); - MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(receiveParameterPos.getStoreId()); + String transactionType = null; + String oilGunId = null; + if (receiveParameterPos.getType().equals("1")){ + transactionType = "4"; + oilGunId = receiveParameterPos.getOilGunId(); + } else if (receiveParameterPos.getType().equals("2")){ + transactionType = "2"; + } else if (receiveParameterPos.getType().equals("3") || receiveParameterPos.getType().equals("5")){ + transactionType = "1"; + } else if (receiveParameterPos.getType().equals("4")){ + transactionType = "3"; + } else if (receiveParameterPos.getType().equals("6")){ + transactionType = "5"; + } + MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(receiveParameterPos.getStoreId(),transactionType,oilGunId); ReceiveParameter receiveParameter = new ReceiveParameter(); BeanUtils.copyProperties(receiveParameterPos, receiveParameter); Double discountAmount = 0.0; @@ -825,8 +883,23 @@ public class FyPayServiceImpl implements FyPayService { @Override public Map mainScan(ReceiveParameterPos receiveParameterPos) throws Exception { Map res = new HashMap<>(); + + String transactionType = null; + String oilGunId = null; + if (receiveParameterPos.getType().equals("1")){ + transactionType = "4"; + oilGunId = receiveParameterPos.getOilGunId(); + } else if (receiveParameterPos.getType().equals("2")){ + transactionType = "2"; + } else if (receiveParameterPos.getType().equals("3") || receiveParameterPos.getType().equals("5")){ + transactionType = "1"; + } else if (receiveParameterPos.getType().equals("4")){ + transactionType = "3"; + } else if (receiveParameterPos.getType().equals("6")){ + transactionType = "5"; + } // 查询商户配置信息 - MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(receiveParameterPos.getStoreId()); + MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(receiveParameterPos.getStoreId(),transactionType,oilGunId); if (ObjectUtil.isEmpty(merchantConfig)) { res.put("code", "error"); res.put("msg", "暂未配置商户信息"); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/MerchantConfigServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/MerchantConfigServiceImpl.java index 8cd9a22b1..93d62a216 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/MerchantConfigServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/MerchantConfigServiceImpl.java @@ -5,9 +5,11 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.fuint.api.fuyou.entity.FuYouPublicMerchant; import com.fuint.api.fuyou.entity.MerchantConfig; +import com.fuint.api.fuyou.entity.PaymentRuleConfig; import com.fuint.api.fuyou.mapper.MerchantConfigMapper; import com.fuint.api.fuyou.service.MerchantConfigService; import com.fuint.api.fuyou.service.OilConfigService; +import com.fuint.api.fuyou.service.PaymentRuleConfigService; import com.fuint.api.fuyou.vo.MerchantConfigVo; import com.fuint.common.dto.AccountInfo; import com.fuint.common.util.RedisLock; @@ -30,6 +32,10 @@ public class MerchantConfigServiceImpl extends ServiceImpl(); @@ -39,23 +45,48 @@ public class MerchantConfigServiceImpl extends ServiceImpl(); queryWrapper.eq("is_use","1"); queryWrapper.eq("store_id",storeId); MerchantConfig merchantConfig = baseMapper.selectOne(queryWrapper); - if (ObjectUtil.isNotEmpty(merchantConfig) && merchantConfig.getIsOpenRule().equals("1")){ - List list = this.selectMeChByIsOpen(storeId); - if (list.size()>0){ - oilConfigService.oilRule(storeId); +// if (ObjectUtil.isNotEmpty(merchantConfig) && merchantConfig.getIsOpenRule().equals("1")){ +// List list = this.selectMeChByIsOpen(storeId); +// if (list.size()>0){ +// oilConfigService.oilRule(storeId); +// } +// } + PaymentRuleConfig paymentRuleConfig = paymentRuleConfigService.selectInfoByStoreId(storeId); + if (ObjectUtil.isNotEmpty(paymentRuleConfig)){ +// 按比例分账 + if (paymentRuleConfig.getRuleType().equals("1")){ + oilConfigService.oilRule1(storeId,paymentRuleConfig.getId()); + }else { +// 按交易类型分账 + oilConfigService.oilRule2(storeId,paymentRuleConfig.getId(),transactionType,oilGunId); } } return baseMapper.selectOne(queryWrapper); } + @Override + public MerchantConfig selectMeChByIdIsUse1(int storeId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_use","1"); + queryWrapper.eq("store_id",storeId); +// MerchantConfig merchantConfig = baseMapper.selectOne(queryWrapper); +// if (ObjectUtil.isNotEmpty(merchantConfig) && merchantConfig.getIsOpenRule().equals("1")){ +// List list = this.selectMeChByIsOpen(storeId); +// if (list.size()>0){ +// oilConfigService.oilRule(storeId); +// } +// } + return baseMapper.selectOne(queryWrapper); + } + @Override public void updateMeChAmountByStoreId(Integer storeId,Double amount) { - MerchantConfig merchantConfig = this.selectMeChByIdIsUse(storeId); + MerchantConfig merchantConfig = this.selectMeChByIdIsUse1(storeId); if (ObjectUtil.isNotEmpty(merchantConfig)){ Double amount1 = merchantConfig.getAmount(); merchantConfig.setAmount(amount1); @@ -86,7 +117,7 @@ public class MerchantConfigServiceImpl extends ServiceImpl selectMerchList(Integer storeId) { MerchantConfigVo merchantConfigVo = new MerchantConfigVo(); merchantConfigVo.setStoreId(storeId); - return baseMapper.selectList(merchantConfigVo); + return baseMapper.selectList1(merchantConfigVo); } @Override @@ -105,7 +136,7 @@ public class MerchantConfigServiceImpl extends ServiceImpl(); + QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("is_use","1"); queryWrapper.eq("store_id",storeId); List list = baseMapper.selectList(queryWrapper); @@ -187,7 +218,7 @@ public class MerchantConfigServiceImpl extends ServiceImpl(); + queryWrapper.eq("store_id",storeId); + queryWrapper.eq("rule_config_id",ruleConfigId); + List list = baseMapper.selectList(queryWrapper); + Double amountAll = 0.0; +// 百分占比 + List proList = new ArrayList<>(); +// radio + List radioList = new ArrayList<>(); +// 距离 + List distanceList = new ArrayList<>(); + for (int i = 0; i < list.size(); i++) { + MerchantConfig merchantConfig = merchantConfigService.selectMerchById(list.get(i).getMerchConfigId()); + if (ObjectUtil.isNotEmpty(merchantConfig)){ + amountAll += merchantConfig.getAmount(); + proList.add(list.get(i).getProportion()/100.0); + radioList.add(merchantConfig.getAmount()/amountAll); + distanceList.add(proList.get(i) - radioList.get(i)); + + } + + } + int index = 0; + Double max = Collections.max(distanceList); + for (int i = 0; i(); + queryWrapper.eq("store_id",storeId); + queryWrapper.eq("rule_config_id",ruleConfigId); + List list = baseMapper.selectList(queryWrapper); + for (OilConfig oilConfig : list) { + if (oilConfig.getTransactionType().contains(transactionType)){ + if (transactionType.equals("4")){ + String[] split = oilConfig.getOilGunId().split(","); + for (String id : split) { + if (oilGunId.equals(id)){ + // 将其他使用的账户关掉 + merchantConfigService.updateMerchOrter(storeId); + // 改变目前使用账户 + MerchantConfig merchantConfig = merchantConfigService.selectMerchById(oilConfig.getMerchConfigId()); + merchantConfig.setIsUse("1"); + merchantConfigService.updateMerch(merchantConfig); + } + } + }else { + // 将其他使用的账户关掉 + merchantConfigService.updateMerchOrter(storeId); + // 改变目前使用账户 + MerchantConfig merchantConfig = merchantConfigService.selectMerchById(oilConfig.getMerchConfigId()); + merchantConfig.setIsUse("1"); + merchantConfigService.updateMerch(merchantConfig); + } + } + } + } + @Override public int judgmentProportion(Integer storeId) { int result = 0; @@ -195,7 +267,7 @@ public class OilConfigServiceImpl extends ServiceImpl records = oilGunService.queryByPage(new Page(1, 10000), oilGun1).getRecords(); for (OilGun record : records) { for (String gunId : split) { - if (gunId.equals(record.getId())){ + if (gunId.equals(record.getId().toString())){ oilGunName += record.getOilNumber() + "-" + record.getGunName() + ","; } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/PaymentRuleConfigServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/PaymentRuleConfigServiceImpl.java index 52c1f6a62..ca4e55e94 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/PaymentRuleConfigServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/PaymentRuleConfigServiceImpl.java @@ -102,6 +102,7 @@ public class PaymentRuleConfigServiceImpl extends ServiceImpl list = baseMapper.selectList(queryWrapper); for (PaymentRuleConfig paymentRuleConfig : list) { paymentRuleConfig.setStatus("jy"); + ruleConfig.setHandEnable("0"); baseMapper.updateById(paymentRuleConfig); } int i = 1; @@ -111,6 +112,7 @@ public class PaymentRuleConfigServiceImpl extends ServiceImpl(); + queryWrapper.eq("store_id",storeId); + queryWrapper.eq("status","qy"); + return baseMapper.selectOne(queryWrapper); + } + /** * 判断规则是否到启用时间 */ @@ -131,8 +141,13 @@ public class PaymentRuleConfigServiceImpl extends ServiceImpl list = baseMapper.selectList(queryWrapper); + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("store_id",storeId); + queryWrapper1.eq("hand_enable","1"); + PaymentRuleConfig paymentRuleConfig1 = baseMapper.selectOne(queryWrapper1); for (PaymentRuleConfig paymentRuleConfig : list) { - if (ObjectUtil.isNotEmpty(paymentRuleConfig.getStartTime()) && paymentRuleConfig.getStartTime().before(new Date())) { + if (ObjectUtil.isNotEmpty(paymentRuleConfig.getStartTime()) && paymentRuleConfig.getStartTime().before(new Date()) + && paymentRuleConfig.getStartTime().before(paymentRuleConfig1.getUpdateTime())) { int i = 1; if (paymentRuleConfig.getRuleType().equals("1")){ i = oilConfigService.judgmentProportion1(paymentRuleConfig.getStoreId(), paymentRuleConfig.getId()); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralOrdersServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralOrdersServiceImpl.java index e5fe2c10d..8b9846b4b 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralOrdersServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralOrdersServiceImpl.java @@ -238,7 +238,7 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService { // Integer allAmount = (int) (integralOrdersList.getAllAmout()*100); System.out.println("金额" + (int) (integralOrdersList.getAllAmout() * 100)); Integer allAmount = (int) (0.01 * 100); - MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(nowAccountInfo.getStoreId()); + MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(nowAccountInfo.getStoreId(),"3",null); // 处理支付需要的数据 Map map = new HashMap<>(); map.put("authCode", integralOrdersList.getAuthCode()); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/service/impl/CardFuelRecordServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/service/impl/CardFuelRecordServiceImpl.java index 3e442ec69..9f1543590 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/service/impl/CardFuelRecordServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/service/impl/CardFuelRecordServiceImpl.java @@ -299,7 +299,7 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService { Integer allAmount = (int) (theAmountToBePaid*100); System.out.println("allAmount1:"+allAmount); - MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(nowAccountInfo.getStoreId()); + MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(nowAccountInfo.getStoreId(),"1",null); // 处理支付需要的数据 Map map = new HashMap<>(); map.put("authCode", cardFuelRecordDTO.getAuthCode()); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueRecordServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueRecordServiceImpl.java index 72676d945..b00dd1b51 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueRecordServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueRecordServiceImpl.java @@ -419,7 +419,7 @@ public class CardValueRecordServiceImpl extends ServiceImpl map = new HashMap<>(); map.put("authCode",cardValueRecordDTO.getAuthCode()); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/AllOrderInfoServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/AllOrderInfoServiceImpl.java index 1444f5214..3bf6285cc 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/AllOrderInfoServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/AllOrderInfoServiceImpl.java @@ -335,7 +335,30 @@ public class AllOrderInfoServiceImpl extends ServiceImpl getMerchantConfig(AllOrderInfo allOrderInfo){ Map map = new HashMap<>(); // 商户机构查询 - MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(allOrderInfo.getStoreId()); + String transactionType = null; + String oilGunId = null; + OilOrder oilOrder = orderService.selectOilOrderByOrderNo(allOrderInfo.getOrderNo()); + if (allOrderInfo.getType().equals("1")){ + transactionType = "4"; + oilGunId = oilOrder.getOilGunNum(); + }else if (allOrderInfo.getType().equals("2")){ + transactionType = "2"; + }else if (allOrderInfo.getType().equals("3") || allOrderInfo.getType().equals("5")){ + transactionType = "1"; + }else if (allOrderInfo.getType().equals("4")){ + transactionType = "3"; + }else if (allOrderInfo.getType().equals("6")){ + transactionType = "5"; + }else if (allOrderInfo.getType().equals("8")){ + if (ObjectUtil.isNotEmpty(oilOrder)){ + transactionType = "4"; + oilGunId = oilOrder.getOilGunNum(); + }else { + transactionType = "1"; + } + } + + MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(allOrderInfo.getStoreId(),transactionType,oilGunId); if (ObjectUtil.isEmpty(merchantConfig)) { throw new RuntimeException("未配置商户号"); } @@ -530,7 +553,31 @@ public class AllOrderInfoServiceImpl extends ServiceImpl pageList = allOrderInfoMapper.getTradingPage(page, allOrderInfo); for (AllOrderInfoVo record : pageList.getRecords()) { MtStore mtStore = storeService.queryStoreById3(record.getStoreId()); - MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(record.getStoreId()); + + String transactionType = null; + String oilGunId = null; + OilOrder oilOrder = orderService.selectOilOrderByOrderNo(record.getOrderNo()); + if (record.getType().equals("1")){ + transactionType = "4"; + oilGunId = oilOrder.getOilGunNum(); + }else if (record.getType().equals("2")){ + transactionType = "2"; + }else if (record.getType().equals("3") || record.getType().equals("5")){ + transactionType = "1"; + }else if (record.getType().equals("4")){ + transactionType = "3"; + }else if (record.getType().equals("6")){ + transactionType = "5"; + }else if (record.getType().equals("8")){ + if (ObjectUtil.isNotEmpty(oilOrder)){ + transactionType = "4"; + oilGunId = oilOrder.getOilGunNum(); + }else { + transactionType = "1"; + } + } + + MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(record.getStoreId(),transactionType,oilGunId); record.setStoreName(mtStore.getName()); if(ObjectUtil.isNotEmpty(merchantConfig)) { record.setMchntCd(merchantConfig.getMchntCd()); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/HangBillServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/HangBillServiceImpl.java index 156f38fe8..468738ec5 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/HangBillServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/HangBillServiceImpl.java @@ -12,15 +12,9 @@ import com.fuint.api.fuyou.entity.MerchantConfig; import com.fuint.api.fuyou.service.FyPayService; import com.fuint.api.fuyou.service.MerchantConfigService; import com.fuint.api.fuyou.service.OilConfigService; -import com.fuint.business.order.entity.AllOrderInfo; -import com.fuint.business.order.entity.CreditUnit; -import com.fuint.business.order.entity.HangBill; -import com.fuint.business.order.entity.ReturnRecord; +import com.fuint.business.order.entity.*; import com.fuint.business.order.mapper.HangBillMapper; -import com.fuint.business.order.service.AllOrderInfoService; -import com.fuint.business.order.service.CreditUnitService; -import com.fuint.business.order.service.HangBillService; -import com.fuint.business.order.service.ReturnRecordService; +import com.fuint.business.order.service.*; import com.fuint.business.order.vo.Excel.CashierOrderExcel; import com.fuint.business.order.vo.Excel.HangBillExcel; import com.fuint.business.order.vo.HangBillVo; @@ -40,6 +34,8 @@ import java.util.*; public class HangBillServiceImpl extends ServiceImpl implements HangBillService { @Autowired private CreditUnitService creditUnitService; + @Autowired + private OilOrderService orderService; @Override public IPage selectHangBillList(Page page, HangBillVo hangBill) { @@ -347,12 +343,13 @@ public class HangBillServiceImpl extends ServiceImpl i if (!map.get("repaidAmount").equals("0") && !payType.equals("CASH")){ Integer allAmount = (int) (Double.valueOf(map.get("repaidAmount"))*100); // 判断是否开启支付规则 - List list = merchantConfigService.selectMeChByIsOpen(storeId); - if (list.size()>0){ - oilConfigService.oilRule(storeId); - } +// List list = merchantConfigService.selectMeChByIsOpen(storeId); +// if (list.size()>0){ +// oilConfigService.oilRule(storeId); +// } // 根据店铺id查询商户配置信息 - MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(storeId); + OilOrder oilOrder = orderService.selectOilOrderByOrderNo(orderNo); + MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(storeId,"1",oilOrder.getOilGunNum()); // 处理支付需要的数据 Map map1 = new HashMap<>(); map1.put("authCode",map.get("authCode")); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java index d8a9c32b8..f310afa88 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java @@ -297,6 +297,8 @@ public class OilOrderServiceImpl extends ServiceImpl i Double goodsActualPay = Double.valueOf(map.get("goodsActualPay")); // 找零金额 Double seekZero = Double.valueOf(map.get("seekZero")); +// 油枪id + String oilGunId = map.get("oilGunId"); log.info("11111111111111111111111285:", map.get("levelAmount")); Double levelAmount = Double.valueOf(map.get("levelAmount")); Double activeAmount = Double.valueOf(map.get("activeAmount")); @@ -382,8 +384,17 @@ public class OilOrderServiceImpl extends ServiceImpl i OilOrder oilOrder1 = null; LJOrder ljOrder1 = null; + String transactionType = null; + if (oilAmount>0 && goodsAmount>0){ + transactionType = "5"; + }else if (oilAmount>0) { + transactionType = "4"; + }else if (goodsAmount>0) { + transactionType = "2"; + } + // 根据店铺id查询商户配置信息 - MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(storeId); + MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(storeId,transactionType,oilGunId); if (ObjectUtil.isEmpty(merchantConfig) && !payType.equals("CASH") && !payType.equals("credit") && !map.get("allAmount").equals("0")) { @@ -554,10 +565,10 @@ public class OilOrderServiceImpl extends ServiceImpl i if (!map.get("allAmount").equals("0") && !map.get("payType").equals("CASH") && !payType.equals("credit")) { Integer allAmount = (int) (Double.valueOf(map.get("allAmount")) * 100); // 判断是否开启支付规则 - List list = merchantConfigService.selectMeChByIsOpen(storeId); - if (list.size() > 0) { - oilConfigService.oilRule(storeId); - } +// List list = merchantConfigService.selectMeChByIsOpen(storeId); +// if (list.size() > 0) { +// oilConfigService.oilRule(storeId); +// } // 处理支付需要的数据 Map map1 = new HashMap<>(); @@ -1643,6 +1654,7 @@ public class OilOrderServiceImpl extends ServiceImpl i receiveParameter.setStoreId(oilOrder.getStoreId()); receiveParameter.setPayType(oilOrder.getPayType()); receiveParameter.setUserId(oilOrder.getUserId()); + receiveParameter.setOilGunId(oilOrder.getOilGunNum()); // 调用支付接口 try { applet = fyPayService.applet(receiveParameter); @@ -2399,6 +2411,7 @@ public class OilOrderServiceImpl extends ServiceImpl i receiveParameterPos.setAuthCode(oilOrderVo.getAuthCode()); receiveParameterPos.setUserId(oilOrderVo.getUserId()); receiveParameterPos.setOilCardAmount(oilOrderVo.getOilCardAmount1()); + receiveParameterPos.setOilGunId(oilOrderVo.getOilGunNum()); if (ObjectUtil.isNotEmpty(oilOrderVo.getAuthCode()) && oilOrderVo.getPayAmount() > 0) { try { fyPayService.posPay(receiveParameterPos); @@ -2470,6 +2483,7 @@ public class OilOrderServiceImpl extends ServiceImpl i receiveParameterPos.setUserId(oilOrderVo.getUserId()); receiveParameterPos.setGoodsMoney(oilOrderVo.getPayAmount()); receiveParameterPos.setOilCardAmount(oilOrderVo.getOilCardAmount1()); + receiveParameterPos.setOilGunId(oilOrderVo.getOilGunNum()); Map mainScan = fyPayService.mainScan(receiveParameterPos); res.put("oilOrder",this.selectOilOrderByOrderNo(orderNo)); res.put("scanCode",mainScan); diff --git a/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue b/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue index af51b36b3..a9a0b5fb6 100644 --- a/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue +++ b/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue @@ -1364,6 +1364,7 @@ consumeRefuelMoney:0, // 满减优惠 fullReduction:0, + oilGunId:null, // 囤油卡信息 refuelMoney:null, refuelMoney1:[], @@ -4023,7 +4024,6 @@ {value:"¥300"}, ]; this.amount = 0 - this.dialogVisibleamount = true; let result = false this.isExistOilOrder = false; // 判断是否存在此油品的数据 @@ -4038,6 +4038,11 @@ if (result){ return; } + if (this.oilOrder.length==1){ + this.$message.error("只能选择一个油枪信息") + return; + } + this.dialogVisibleamount = true; getOilNumberById(data.numberId).then( response => { this.form = response.data; this.form.tankId = data.tankId @@ -4045,6 +4050,7 @@ if (item.id==data.id){ this.form.id = item.id this.form.gunName = item.id + this.oilGunId = item.id this.form.gunNames = item.gunName } }) @@ -4097,6 +4103,7 @@ this.map.payUser = this.member.mobile this.map.levelAmount = this.oilDiscount this.map.activeAmount = this.fullReduction + this.map.oilGunId = this.oilGunId let _this = this; diff --git a/gasStation-uni/config.js b/gasStation-uni/config.js index d68600944..6bf960d99 100644 --- a/gasStation-uni/config.js +++ b/gasStation-uni/config.js @@ -3,9 +3,9 @@ module.exports = { // baseUrl: 'https://vue.ruoyi.vip/prod-api', // baseUrl: 'http://192.168.0.196:8081/', // baseUrl: 'https://www.tuofeng.cc/oilAdmin/', - baseUrl: 'https://oilapi.youkerr.com/oilAdmin/', + // baseUrl: 'https://oilapi.youkerr.com/oilAdmin/', // baseUrl: 'https://8q4f124343.yicp.fun/', - // baseUrl: 'http://192.168.31.96:8080/', + baseUrl: 'http://192.168.31.96:8080/', // baseUrl: 'http://192.168.1.5:8002/cdJdc', imagesUrl: 'http://www.nuoyunr.com/lananRsc', // 应用信息