修复:代理商产品设置问题

This commit is contained in:
liu
2025-07-14 18:57:16 +08:00
parent 8f808926bc
commit c9fe60511c
3 changed files with 36 additions and 19 deletions

View File

@ -232,6 +232,7 @@ public class BusChannelVo implements Serializable {
private Long createUnitId;
private String createUnitNo;
private String operatorNo;
public String getVerifyStatusName() {

View File

@ -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<BusChannelProductVo> 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<BusChannelProductVo> queryList(BusChannelProductBo bo) {
LambdaQueryWrapper<BusChannelProduct> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
return busChannelProductMapper.selectVoList(lqw);
}
private LambdaQueryWrapper<BusChannelProduct> 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<BusChannelProductVo> 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<BusChannelProductBo> 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;
}
}

View File

@ -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
<if test="bo.busType != null"> and t1.bus_type = #{bo.busType} </if>
</select>