From c9fe60511c5e328a1c7d58bae25ce6ab0421c242 Mon Sep 17 00:00:00 2001 From: liu <1085918938@qq.com> Date: Mon, 14 Jul 2025 18:57:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E4=BB=A3=E7=90=86?= =?UTF-8?q?=E5=95=86=E4=BA=A7=E5=93=81=E8=AE=BE=E7=BD=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../channel/domain/vo/BusChannelVo.java | 1 + .../impl/BusChannelProductServiceImpl.java | 52 ++++++++++++------- .../channel/BusChannelProductMapper.xml | 2 +- 3 files changed, 36 insertions(+), 19 deletions(-) diff --git a/ruoyi-modules/ruoyi-payment/src/main/java/org/dromara/payment/channel/domain/vo/BusChannelVo.java b/ruoyi-modules/ruoyi-payment/src/main/java/org/dromara/payment/channel/domain/vo/BusChannelVo.java index 70b2cd2..d2226c2 100644 --- a/ruoyi-modules/ruoyi-payment/src/main/java/org/dromara/payment/channel/domain/vo/BusChannelVo.java +++ b/ruoyi-modules/ruoyi-payment/src/main/java/org/dromara/payment/channel/domain/vo/BusChannelVo.java @@ -232,6 +232,7 @@ public class BusChannelVo implements Serializable { private Long createUnitId; private String createUnitNo; + private String operatorNo; public String getVerifyStatusName() { diff --git a/ruoyi-modules/ruoyi-payment/src/main/java/org/dromara/payment/channel/service/impl/BusChannelProductServiceImpl.java b/ruoyi-modules/ruoyi-payment/src/main/java/org/dromara/payment/channel/service/impl/BusChannelProductServiceImpl.java index 8b91d82..968551e 100644 --- a/ruoyi-modules/ruoyi-payment/src/main/java/org/dromara/payment/channel/service/impl/BusChannelProductServiceImpl.java +++ b/ruoyi-modules/ruoyi-payment/src/main/java/org/dromara/payment/channel/service/impl/BusChannelProductServiceImpl.java @@ -16,7 +16,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import lombok.RequiredArgsConstructor; import org.dromara.common.satoken.utils.LoginHelper; -import org.dromara.payment.merchant.domain.BusMerchantProduct; +import org.dromara.payment.channel.domain.BusChannel; +import org.dromara.payment.channel.mapper.BusChannelMapper; import org.dromara.payment.merchant.domain.bo.BusMerchantProductBo; import org.dromara.payment.merchant.mapper.BusMerchantProductMapper; import org.slf4j.Logger; @@ -43,16 +44,17 @@ import java.util.*; public class BusChannelProductServiceImpl extends BaseService implements IBusChannelProductService { private static final Logger log = LoggerFactory.getLogger(BusChannelProductServiceImpl.class); - private final BusChannelProductMapper baseMapper; + private final BusChannelProductMapper busChannelProductMapper; private final BusMerchantProductMapper busMerchantProductMapper; + private final BusChannelMapper busChannelMapper; /** * 查询代理商产品 */ @Override public BusChannelProductVo queryById(Long id){ - return baseMapper.selectVoById(id); + return busChannelProductMapper.selectVoById(id); } /** @@ -71,11 +73,13 @@ public class BusChannelProductServiceImpl extends BaseService implements IBusCha Page result = null; if(burRole == BusRole.AGENT.getId()){ - result = baseMapper.selectAgentProList(bo,pageQuery.build()); + result = busChannelProductMapper.selectAgentProList(bo,pageQuery.build()); }else if(burRole == BusRole.OPERATOR.getId()){ - result = baseMapper.selectOperAgentProList(bo,pageQuery.build()); + result = busChannelProductMapper.selectOperAgentProList(bo,pageQuery.build()); }else if(LoginHelper.isSuperAdmin()){ - result = baseMapper.selectOperAgentProList(bo,pageQuery.build()); + BusChannel busChannel = busChannelMapper.selectById(bo.getChId()); + bo.setOpNo(busChannel.getOperatorNo()); + result = busChannelProductMapper.selectOperAgentProList(bo,pageQuery.build()); } if (result != null) { result.getRecords().forEach(item -> { @@ -91,7 +95,7 @@ public class BusChannelProductServiceImpl extends BaseService implements IBusCha @Override public List queryList(BusChannelProductBo bo) { LambdaQueryWrapper lqw = buildQueryWrapper(bo); - return baseMapper.selectVoList(lqw); + return busChannelProductMapper.selectVoList(lqw); } private LambdaQueryWrapper buildQueryWrapper(BusChannelProductBo bo) { @@ -145,21 +149,33 @@ public class BusChannelProductServiceImpl extends BaseService implements IBusCha } Map paraMap = new HashMap(); - paraMap.put("channel_no", LoginHelper.getNo()); + paraMap.put("bus_type",busType); List agentList = new ArrayList(); int busRole = LoginHelper.getLoginUser().getBusRole(); if(busRole == BusRole.AGENT.getId()){ - agentList = this.baseMapper.selectAgentProInfos(paraMap); + paraMap.put("channel_no", chNo); + agentList = this.busChannelProductMapper.selectAgentProInfos(paraMap); if(agentList.size() == 0){ this.invalidationParamsException("当前代理商未配置产品"); } - }else if(busRole == BusRole.OPERATOR.getId()){ - agentList = this.baseMapper.selectOperProInfos(paraMap); + }else{ + BusChannel busChannel = busChannelMapper.selectById(chId); + String operatorNo = busChannel.getOperatorNo(); + paraMap.put("channel_no", operatorNo); + agentList = this.busChannelProductMapper.selectOperProInfos(paraMap); if(agentList.size() == 0){ this.invalidationParamsException("当前运营商未配置产品"); } - } + }/*else { + BusChannel busChannel = busChannelMapper.selectById(chId); + String operatorNo = busChannel.getOperatorNo(); + paraMap.put("op_no", operatorNo); + agentList = this.busChannelProductMapper.selectOperProInfos(paraMap); + if(agentList.size() == 0){ + this.invalidationParamsException("当前运营商未配置产品"); + } + }*/ List voList = JSONUtil.toList(bo.getJSONArray("boList").toJSONString(), BusChannelProductBo.class); @@ -197,7 +213,7 @@ public class BusChannelProductServiceImpl extends BaseService implements IBusCha pMap.put("channelNo",chNo+"-"); pMap.put("channelId",chId); - BigDecimal chMinCharge = this.baseMapper.selMinChargeFromChannelProByAgentInfo(pMap); + BigDecimal chMinCharge = this.busChannelProductMapper.selMinChargeFromChannelProByAgentInfo(pMap); BigDecimal min = merMinCharge; if(min != null && chMinCharge != null && chMinCharge.compareTo(min) < 0){ @@ -223,11 +239,11 @@ public class BusChannelProductServiceImpl extends BaseService implements IBusCha if(bp.getProStatus() == 1){ updateList.add(bp); } - }else{ + }else if(vo1.getProStatus() != null && vo1.getProStatus() == 1){ insertList.add(bp); } } - this.baseMapper.insertOrUpdateBatch(insertList); + this.busChannelProductMapper.insertOrUpdateBatch(insertList); for(BusChannelProduct pro : updateList){ BusMerchantProductBo proBo = new BusMerchantProductBo(); @@ -247,7 +263,7 @@ public class BusChannelProductServiceImpl extends BaseService implements IBusCha bpBo.setChannelId(chId); bpBo.setChannelNo(chNo); - this.baseMapper.updateBusChannelCost(bpBo); + this.busChannelProductMapper.updateBusChannelCost(bpBo); } return true; @@ -260,7 +276,7 @@ public class BusChannelProductServiceImpl extends BaseService implements IBusCha public Boolean updateByBo(BusChannelProductBo bo) { BusChannelProduct update = MapstructUtils.convert(bo, BusChannelProduct.class); validEntityBeforeSave(update); - return baseMapper.updateById(update) > 0; + return busChannelProductMapper.updateById(update) > 0; } /** @@ -278,6 +294,6 @@ public class BusChannelProductServiceImpl extends BaseService implements IBusCha if(isValid){ //TODO 做一些业务上的校验,判断是否需要校验 } - return baseMapper.deleteBatchIds(ids) > 0; + return busChannelProductMapper.deleteBatchIds(ids) > 0; } } diff --git a/ruoyi-modules/ruoyi-payment/src/main/resources/mapper/payment/channel/BusChannelProductMapper.xml b/ruoyi-modules/ruoyi-payment/src/main/resources/mapper/payment/channel/BusChannelProductMapper.xml index 50a345a..8a518a1 100644 --- a/ruoyi-modules/ruoyi-payment/src/main/resources/mapper/payment/channel/BusChannelProductMapper.xml +++ b/ruoyi-modules/ruoyi-payment/src/main/resources/mapper/payment/channel/BusChannelProductMapper.xml @@ -108,7 +108,7 @@ LEFT JOIN sys_syd_product t3 ON t1.pro_id = t3.id LEFT JOIN sys_syd t4 ON t1.syd_id = t4.id inner join bus_operator t5 on t1.op_id = t5.id - where t1.op_id = #{bo.channelId} and t3.pro_status = 1 and t1.pro_status = 1 + where t1.op_no = #{bo.opNo} and t3.pro_status = 1 and t1.pro_status = 1 and t1.bus_type = #{bo.busType}