Commit b86044b4 by 叶立庆

Merge branch 'v5.8.4.3' into 'master'

上线合并

See merge request !4
2 parents 97eb18bf 3ded18b7
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<name>rpc-scrm-shopmall-api</name> <name>rpc-scrm-shopmall-api</name>
<properties> <properties>
<deploy.scanPackage>cn.com.glsx.shopmall.remote</deploy.scanPackage> <deploy.scanPackage>cn.com.glsx.shopmall.remote</deploy.scanPackage>
<shopmall.api.version>5.8.2-SNAPSHOT</shopmall.api.version> <shopmall.api.version>5.8.4.3-SNAPSHOT</shopmall.api.version>
<stoassistant.api.version>5.6.4-SNAPSHOT</stoassistant.api.version> <stoassistant.api.version>5.6.4-SNAPSHOT</stoassistant.api.version>
</properties> </properties>
<dependencies> <dependencies>
......
...@@ -12,7 +12,6 @@ import java.io.Serializable; ...@@ -12,7 +12,6 @@ import java.io.Serializable;
public class IntegralGetBalanceDTO implements Serializable { public class IntegralGetBalanceDTO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private String channelProvider;
private String paymentEntityCode; private String paymentEntityCode;
private String levyCode; private String levyCode;
private String levyChannelCode; private String levyChannelCode;
......
...@@ -41,15 +41,22 @@ public class IntegralSettleAmountDTO implements Serializable { ...@@ -41,15 +41,22 @@ public class IntegralSettleAmountDTO implements Serializable {
@ApiModelProperty(name = "zxSettleAmount", notes = "中雄-银行卡结算总金额", dataType = "string") @ApiModelProperty(name = "zxSettleAmount", notes = "中雄-银行卡结算总金额", dataType = "string")
private String zxSettleAmount; private String zxSettleAmount;
@ApiModelProperty(notes = "身边云-银行卡合计结算总金额", dataType = "string")
private String shenBianYunSettleAmount;
@Deprecated
@ApiModelProperty(notes = "身边云-银行卡(翔禾)结算总金额", dataType = "string") @ApiModelProperty(notes = "身边云-银行卡(翔禾)结算总金额", dataType = "string")
private String shenBianYunXHSettleAmount; private String shenBianYunXHSettleAmount;
@Deprecated
@ApiModelProperty(notes = "身边云-银行卡(雅钧)结算总金额", dataType = "string") @ApiModelProperty(notes = "身边云-银行卡(雅钧)结算总金额", dataType = "string")
private String shenBianYunYJSettleAmount; private String shenBianYunYJSettleAmount;
@Deprecated
@ApiModelProperty(notes = "身边云-银行卡(博晟)结算总金额", dataType = "string") @ApiModelProperty(notes = "身边云-银行卡(博晟)结算总金额", dataType = "string")
private String shenBianYunBCSettleAmount; private String shenBianYunBCSettleAmount;
@Deprecated
@ApiModelProperty(notes = "身边云-银行卡(晨景)结算总金额", dataType = "string") @ApiModelProperty(notes = "身边云-银行卡(晨景)结算总金额", dataType = "string")
private String shenBianYunCJSettleAmount; private String shenBianYunCJSettleAmount;
......
...@@ -5,12 +5,14 @@ import cn.com.glsx.scrm.shopmall.model.IntegralTransferOut; ...@@ -5,12 +5,14 @@ import cn.com.glsx.scrm.shopmall.model.IntegralTransferOut;
import cn.com.glsx.scrm.shopmall.model.IntegralTransferOutOperation; import cn.com.glsx.scrm.shopmall.model.IntegralTransferOutOperation;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
@Data @Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true) @ToString(callSuper = true)
public class IntegralTransferOutDTO extends IntegralTransferOut implements Serializable { public class IntegralTransferOutDTO extends IntegralTransferOut implements Serializable {
private static final long serialVersionUID = 9204474587651308187L; private static final long serialVersionUID = 9204474587651308187L;
...@@ -45,10 +47,15 @@ public class IntegralTransferOutDTO extends IntegralTransferOut implements Seria ...@@ -45,10 +47,15 @@ public class IntegralTransferOutDTO extends IntegralTransferOut implements Seria
@ApiModelProperty(notes = "支付选择的付款渠道(LG-拓博灵工,TXIAT-熠轩txiat,YX-远行,XYJ-薪遇见,YUNHUO-云获(嘀加)银行卡,YUNHUO-ZY-云获(中赢)银行卡,YUNHUO-WX-云获(中赢)微信,ZX-中雄,SHENBIANYUN-身边云-银行卡)",dataType="string") @ApiModelProperty(notes = "支付选择的付款渠道(LG-拓博灵工,TXIAT-熠轩txiat,YX-远行,XYJ-薪遇见,YUNHUO-云获(嘀加)银行卡,YUNHUO-ZY-云获(中赢)银行卡,YUNHUO-WX-云获(中赢)微信,ZX-中雄,SHENBIANYUN-身边云-银行卡)",dataType="string")
private String payChannel; private String payChannel;
@ApiModelProperty(notes = "支付选择的付款渠道服务商") @ApiModelProperty(notes = "支付时选择的付款主体")
private String payChannelProvider; private String payPaymentEntityCode;
@ApiModelProperty(notes = "支付时选择的代征主体")
private String payLevyCode;
@ApiModelProperty(notes = "支付时选择的代征主体通道")
private String payLevyChannelCode;
@ApiModelProperty(name = "paymentSubject", notes = "付款主体", dataType = "String")
private String paymentSubject; private String paymentSubject;
/** /**
......
...@@ -17,12 +17,6 @@ public class IntegralTransferOutOperationDTO extends IntegralTransferOutOperatio ...@@ -17,12 +17,6 @@ public class IntegralTransferOutOperationDTO extends IntegralTransferOutOperatio
@ApiModelProperty(notes = "付款渠道(拓博:LG, 熠轩-银行卡:TXIAT, 薪遇见:XYJ, 云获-银行卡:YUNHUO, 云获-微信:YUNHUO-WX,中雄-银行卡:ZX, 身边云-银行卡: SHENBIANYUN)") @ApiModelProperty(notes = "付款渠道(拓博:LG, 熠轩-银行卡:TXIAT, 薪遇见:XYJ, 云获-银行卡:YUNHUO, 云获-微信:YUNHUO-WX,中雄-银行卡:ZX, 身边云-银行卡: SHENBIANYUN)")
private String channel; private String channel;
/**
* @see cn.com.glsx.scrm.shopmall.enums.integral.IntegralTransferOutChannelProviderEnum
*/
@ApiModelProperty(notes = "渠道服务商")
private String channelProvider;
@ApiModelProperty(notes = "付款主体编码") @ApiModelProperty(notes = "付款主体编码")
private String paymentEntityCode; private String paymentEntityCode;
......
...@@ -10,6 +10,7 @@ import java.util.Objects; ...@@ -10,6 +10,7 @@ import java.util.Objects;
/** /**
* 积分转出渠道-服务商 * 积分转出渠道-服务商
* value 要和 platform-payment 中对应,用于匹配配置好的 providerId * value 要和 platform-payment 中对应,用于匹配配置好的 providerId
* @deprecated 不再维护,服务商作为数据库配置
*/ */
@Getter @Getter
public enum IntegralTransferOutChannelProviderEnum implements BaseEnum<IntegralTransferOutChannelProviderEnum, String> { public enum IntegralTransferOutChannelProviderEnum implements BaseEnum<IntegralTransferOutChannelProviderEnum, String> {
......
...@@ -160,13 +160,6 @@ public class IntegralTransferOut implements Serializable { ...@@ -160,13 +160,6 @@ public class IntegralTransferOut implements Serializable {
@Column(name = "levy_channel_name") @Column(name = "levy_channel_name")
private String levyChannelName; private String levyChannelName;
/**
* @see cn.com.glsx.scrm.shopmall.enums.integral.IntegralTransferOutChannelProviderEnum
*/
@ApiModelProperty(notes = "渠道服务商")
@Column(name = "channel_provider")
private String channelProvider;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@Column(name = "pay_date") @Column(name = "pay_date")
......
...@@ -78,7 +78,6 @@ public class IntegralTransferSign extends BaseModel { ...@@ -78,7 +78,6 @@ public class IntegralTransferSign extends BaseModel {
item.setMobile(order.getMobile()); item.setMobile(order.getMobile());
item.setIdCardNo(order.getIdCardNo()); item.setIdCardNo(order.getIdCardNo());
item.setChannel(order.getChannel()); item.setChannel(order.getChannel());
item.setChannelProvider(order.getChannelProvider());
item.setSubjectCode(order.getPaymentEntityCode()); item.setSubjectCode(order.getPaymentEntityCode());
item.setLevyCode(order.getLevyCode()); item.setLevyCode(order.getLevyCode());
return item; return item;
......
...@@ -13,9 +13,9 @@ ...@@ -13,9 +13,9 @@
<properties> <properties>
<stoassistant.api.version>5.6.4-SNAPSHOT</stoassistant.api.version> <stoassistant.api.version>5.6.4-SNAPSHOT</stoassistant.api.version>
<shopmall.api.version>5.8.2-SNAPSHOT</shopmall.api.version> <shopmall.api.version>5.8.4.3-SNAPSHOT</shopmall.api.version>
<smartcarlife.api.version>5.6.4-SNAPSHOT</smartcarlife.api.version> <smartcarlife.api.version>5.6.4-SNAPSHOT</smartcarlife.api.version>
<platform-payment.api.version>5.6.4-SNAPSHOT</platform-payment.api.version> <platform-payment.api.version>5.8.4.3-SNAPSHOT</platform-payment.api.version>
</properties> </properties>
<dependencies> <dependencies>
......
...@@ -332,7 +332,12 @@ public class IntegralTransferOutService { ...@@ -332,7 +332,12 @@ public class IntegralTransferOutService {
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = RpcServiceException.class) @Transactional(propagation = Propagation.REQUIRED, rollbackFor = RpcServiceException.class)
public Integer updateByPrimaryKeySelective(IntegralTransferOut record) { public Integer updateByPrimaryKeySelective(IntegralTransferOut record) {
record.setErrorMessage(StringUtils.isBlank(record.getErrorMessage()) ? record.getErrorMessage() : record.getErrorMessage().replaceAll("<br/>", " ")); String errorMessage = record.getErrorMessage();
if (StringUtils.isNotBlank(errorMessage)) {
errorMessage = StringUtils.substring(errorMessage, 0, 200)
.replaceAll("<br />", " ");
record.setErrorMessage(errorMessage);
}
int res = integralTransferOutMapper.updateByPrimaryKeySelective(record); int res = integralTransferOutMapper.updateByPrimaryKeySelective(record);
Example example = new Example(IntegralTransferOut.class); Example example = new Example(IntegralTransferOut.class);
example.createCriteria().andEqualTo("deletedFlag", "N").andEqualTo("id", record.getId()); example.createCriteria().andEqualTo("deletedFlag", "N").andEqualTo("id", record.getId());
...@@ -395,7 +400,8 @@ public class IntegralTransferOutService { ...@@ -395,7 +400,8 @@ public class IntegralTransferOutService {
} }
} }
// 查询提现单关联订单号列表 // 查询提现单关联订单号列表
staffMotivationService.appendWithdrawalOrder(result); // 废弃:积分会版本后不再支持提现和订单关联
// staffMotivationService.appendWithdrawalOrder(result);
return page; return page;
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
...@@ -441,14 +447,7 @@ public class IntegralTransferOutService { ...@@ -441,14 +447,7 @@ public class IntegralTransferOutService {
*/ */
public Boolean allPay(IntegralTransferOutDTO request) { public Boolean allPay(IntegralTransferOutDTO request) {
try { try {
IntegralTransferOutDTO listReq = new IntegralTransferOutDTO(); List<IntegralTransferOutDTO> list = integralTransferOutMapper.list(request);
BeanUtils.copyProperties(request, listReq);
listReq.setChannel(null);
listReq.setChannelProvider(null);
listReq.setPaymentEntityCode(null);
listReq.setLevyCode(null);
listReq.setLevyChannelCode(null);
List<IntegralTransferOutDTO> list = integralTransferOutMapper.list(listReq);
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
throw new RpcServiceException("没有符合记录的提现记录"); throw new RpcServiceException("没有符合记录的提现记录");
} }
...@@ -459,15 +458,17 @@ public class IntegralTransferOutService { ...@@ -459,15 +458,17 @@ public class IntegralTransferOutService {
} }
List<Integer> ids = list.stream().map(IntegralTransferOut::getId).collect(Collectors.toList()); List<Integer> ids = list.stream().map(IntegralTransferOut::getId).collect(Collectors.toList());
long totalAmount = list.stream().mapToLong(IntegralTransferOut::getPayAmount).sum();
log.info("一键付款:request:{}, 总数:{}, 金额:{}", request, ids.size(), totalAmount);
IntegralTransferOutOperationDTO operationDTO = new IntegralTransferOutOperationDTO(); IntegralTransferOutOperationDTO operationDTO = new IntegralTransferOutOperationDTO();
operationDTO.setIds(ids); operationDTO.setIds(ids);
operationDTO.setRemark(request.getRemark()); operationDTO.setRemark(request.getRemark());
operationDTO.setUpdatedBy(request.getUpdatedBy()); operationDTO.setUpdatedBy(request.getUpdatedBy());
operationDTO.setChannel(request.getPayChannel()); operationDTO.setChannel(request.getPayChannel());
operationDTO.setChannelProvider(request.getPayChannelProvider()); operationDTO.setPaymentEntityCode(request.getPayPaymentEntityCode());
operationDTO.setPaymentEntityCode(request.getPaymentEntityCode()); operationDTO.setLevyCode(request.getPayLevyCode());
operationDTO.setLevyCode(request.getLevyCode()); operationDTO.setLevyChannelCode(request.getPayLevyChannelCode());
operationDTO.setLevyChannelCode(request.getLevyChannelCode());
return thiz.batchPay(operationDTO); return thiz.batchPay(operationDTO);
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
...@@ -796,7 +797,6 @@ public class IntegralTransferOutService { ...@@ -796,7 +797,6 @@ public class IntegralTransferOutService {
Long balance = IntegralTransferOutPayStrategyContext.getPayStrategyService(request.getChannel()) Long balance = IntegralTransferOutPayStrategyContext.getPayStrategyService(request.getChannel())
.getBalance(IntegralGetBalanceDTO.builder() .getBalance(IntegralGetBalanceDTO.builder()
.channelProvider(request.getChannelProvider())
.paymentEntityCode(request.getPaymentEntityCode()) .paymentEntityCode(request.getPaymentEntityCode())
.levyCode(request.getLevyCode()) .levyCode(request.getLevyCode())
.levyChannelCode(request.getLevyChannelCode()) .levyChannelCode(request.getLevyChannelCode())
...@@ -825,7 +825,6 @@ public class IntegralTransferOutService { ...@@ -825,7 +825,6 @@ public class IntegralTransferOutService {
record.setStatus(IntegralTransferOutStatusEnum.SIGNING.getValue()); record.setStatus(IntegralTransferOutStatusEnum.SIGNING.getValue());
record.setPayDate(new Date()); record.setPayDate(new Date());
record.setChannel(request.getChannel()); record.setChannel(request.getChannel());
record.setChannelProvider(request.getChannelProvider() != null ? request.getChannelProvider() : "");
IntegralChannelAccountDTO channelAccount = getChannelAccount(request); IntegralChannelAccountDTO channelAccount = getChannelAccount(request);
record.setPaymentEntityCode(channelAccount != null ? channelAccount.getPaymentEntityCode() : ""); record.setPaymentEntityCode(channelAccount != null ? channelAccount.getPaymentEntityCode() : "");
record.setPaymentEntityName(channelAccount != null ? channelAccount.getPaymentEntityName() : ""); record.setPaymentEntityName(channelAccount != null ? channelAccount.getPaymentEntityName() : "");
...@@ -1310,7 +1309,6 @@ public class IntegralTransferOutService { ...@@ -1310,7 +1309,6 @@ public class IntegralTransferOutService {
try { try {
Long balance = IntegralTransferOutPayStrategyContext.getPayStrategyService(request.getChannel()) Long balance = IntegralTransferOutPayStrategyContext.getPayStrategyService(request.getChannel())
.getBalance(IntegralGetBalanceDTO.builder() .getBalance(IntegralGetBalanceDTO.builder()
.channelProvider(request.getChannelProvider())
.paymentEntityCode(request.getPaymentEntityCode()) .paymentEntityCode(request.getPaymentEntityCode())
.levyCode(request.getLevyCode()) .levyCode(request.getLevyCode())
.levyChannelCode(request.getLevyChannelCode()) .levyChannelCode(request.getLevyChannelCode())
...@@ -1382,6 +1380,15 @@ public class IntegralTransferOutService { ...@@ -1382,6 +1380,15 @@ public class IntegralTransferOutService {
return integralChannelAccountMapper.findLevy(request); return integralChannelAccountMapper.findLevy(request);
} }
public List<IntegralChannelAccountDTO> getSilentSignEnabledAccounts(String channel) {
if (StringUtils.isBlank(channel)) {
return Collections.emptyList();
}
IntegralChannelAccountDTO query = new IntegralChannelAccountDTO();
query.setChannel(channel);
return integralChannelAccountMapper.findAll(query);
}
public List<IntegralTransferChannelConfigTreeDTO> getChannelTree(IntegralTransferChannelConfigDTO req) { public List<IntegralTransferChannelConfigTreeDTO> getChannelTree(IntegralTransferChannelConfigDTO req) {
List<IntegralTransferChannelConfigTreeDTO> tree = integralTransferChannelConfigMapper.findTree(req); List<IntegralTransferChannelConfigTreeDTO> tree = integralTransferChannelConfigMapper.findTree(req);
if (CollectionUtils.isEmpty(tree)) { if (CollectionUtils.isEmpty(tree)) {
...@@ -1572,6 +1579,14 @@ public class IntegralTransferOutService { ...@@ -1572,6 +1579,14 @@ public class IntegralTransferOutService {
private IntegralTransferSign getTransferOutSignData(IntegralTransferOut order, Map<String, IntegralTransferSign> signCache) { private IntegralTransferSign getTransferOutSignData(IntegralTransferOut order, Map<String, IntegralTransferSign> signCache) {
String key = parseSignCacheKey(order); String key = parseSignCacheKey(order);
// 是否本地存储签约结果(不用每次都触发第三方)
String envKey = env.getProperty("scrm.shopmall.integral.transfer.sign.save.ignore", String.class, "");
// 忽略存储签约结果的渠道
List<String> ignoreSaveSignChannel = Arrays.stream(envKey.split(","))
.map(String::trim)
.collect(Collectors.toList());
boolean ignoreSaveSign = CollectionUtils.isNotEmpty(ignoreSaveSignChannel) && ignoreSaveSignChannel.contains(order.getChannel());
if (MapUtils.isEmpty(signCache)) { if (MapUtils.isEmpty(signCache)) {
signCache = new HashMap<>(); signCache = new HashMap<>();
} }
...@@ -1580,11 +1595,13 @@ public class IntegralTransferOutService { ...@@ -1580,11 +1595,13 @@ public class IntegralTransferOutService {
signData = signCache.get(key); signData = signCache.get(key);
}else { }else {
IntegralTransferSign existSign = null; IntegralTransferSign existSign = null;
if (!ignoreSaveSign) {
List<IntegralTransferSign> existSignList = integralTransferSignRecordMapper.select(IntegralTransferSign.buildByOrder(order)); List<IntegralTransferSign> existSignList = integralTransferSignRecordMapper.select(IntegralTransferSign.buildByOrder(order));
if (CollectionUtils.isNotEmpty(existSignList)) { if (CollectionUtils.isNotEmpty(existSignList)) {
// 取最新一条 // 取最新一条
existSign = existSignList.get(existSignList.size() - 1); existSign = existSignList.get(existSignList.size() - 1);
} }
}
// 签约记录存在,且为成功状态,则无需触发第三方签约 (签约失败还是得发起第三方查询,防止遗漏) // 签约记录存在,且为成功状态,则无需触发第三方签约 (签约失败还是得发起第三方查询,防止遗漏)
if (Objects.nonNull(existSign) if (Objects.nonNull(existSign)
&& IntegralTransferSignStatusEnum.isSuccess(existSign.getSignStatus())) { && IntegralTransferSignStatusEnum.isSuccess(existSign.getSignStatus())) {
...@@ -1597,8 +1614,12 @@ public class IntegralTransferOutService { ...@@ -1597,8 +1614,12 @@ public class IntegralTransferOutService {
log.info("[{}] 触发第三方签约查询: cacheKey: {}, orderId: {}", order.getChannel(), key, order.getOutSettleOrderId()); log.info("[{}] 触发第三方签约查询: cacheKey: {}, orderId: {}", order.getChannel(), key, order.getOutSettleOrderId());
SignResultDTO signResult = strategy.userContract(order); SignResultDTO signResult = strategy.userContract(order);
log.info("[{}] 第三方签约查询结果: {}", order.getChannel(), signResult); log.info("[{}] 第三方签约查询结果: {}", order.getChannel(), signResult);
signData = convertSignDate(existSign, order, signResult);
// 签约数据入库 // 签约数据入库
signData = saveSignRecord(existSign, order, signResult); if (!ignoreSaveSign) {
saveSignRecord(signData);
}
} }
} }
signCache.put(key, signData); signCache.put(key, signData);
...@@ -1632,7 +1653,7 @@ public class IntegralTransferOutService { ...@@ -1632,7 +1653,7 @@ public class IntegralTransferOutService {
*/ */
private String parseSignCacheKey(IntegralTransferOut order) { private String parseSignCacheKey(IntegralTransferOut order) {
return StringUtils.join(order.getName(), order.getMobile(), order.getIdCardNo(), order.getChannel(), return StringUtils.join(order.getName(), order.getMobile(), order.getIdCardNo(), order.getChannel(),
order.getChannelProvider(), order.getPaymentEntityCode(), order.getLevyCode()); order.getPaymentEntityCode(), order.getLevyCode());
} }
/** /**
...@@ -1640,8 +1661,7 @@ public class IntegralTransferOutService { ...@@ -1640,8 +1661,7 @@ public class IntegralTransferOutService {
* *
* @return 无变更或异常返回null * @return 无变更或异常返回null
*/ */
private IntegralTransferSign saveSignRecord(IntegralTransferSign exist, IntegralTransferOut order, SignResultDTO signResult) { private IntegralTransferSign convertSignDate(IntegralTransferSign exist, IntegralTransferOut order, SignResultDTO signResult) {
try {
String message = signResult.getMessage(); String message = signResult.getMessage();
byte status = convertSignStatus(signResult.getStatus()); byte status = convertSignStatus(signResult.getStatus());
if (exist == null) { if (exist == null) {
...@@ -1650,7 +1670,6 @@ public class IntegralTransferOutService { ...@@ -1650,7 +1670,6 @@ public class IntegralTransferOutService {
exist.setMobile(order.getMobile()); exist.setMobile(order.getMobile());
exist.setIdCardNo(order.getIdCardNo()); exist.setIdCardNo(order.getIdCardNo());
exist.setChannel(order.getChannel()); exist.setChannel(order.getChannel());
exist.setChannelProvider(order.getChannelProvider());
exist.setSubjectCode(order.getPaymentEntityCode()); exist.setSubjectCode(order.getPaymentEntityCode());
exist.setLevyCode(order.getLevyCode()); exist.setLevyCode(order.getLevyCode());
exist.setCreatedBy("system"); exist.setCreatedBy("system");
...@@ -1666,15 +1685,18 @@ public class IntegralTransferOutService { ...@@ -1666,15 +1685,18 @@ public class IntegralTransferOutService {
exist.setFailMessage(StringUtils.left(message, 128)); exist.setFailMessage(StringUtils.left(message, 128));
exist.setUpdatedBy("system"); exist.setUpdatedBy("system");
exist.setUpdatedDate(new Date()); exist.setUpdatedDate(new Date());
return exist;
}
private void saveSignRecord(IntegralTransferSign exist) {
try {
if (exist.getId() == null) { if (exist.getId() == null) {
integralTransferSignRecordMapper.insertSelective(exist); integralTransferSignRecordMapper.insertSelective(exist);
} else { } else {
integralTransferSignRecordMapper.updateByPrimaryKeySelective(exist); integralTransferSignRecordMapper.updateByPrimaryKeySelective(exist);
} }
return exist;
} catch (Exception e) { } catch (Exception e) {
log.error("saveSignRecord error", e); log.error("saveSignRecord error", e);
return null;
} }
} }
......
...@@ -6,7 +6,6 @@ import cn.com.glsx.payment.modules.model.SignResultDTO; ...@@ -6,7 +6,6 @@ import cn.com.glsx.payment.modules.model.SignResultDTO;
import cn.com.glsx.scrm.shopmall.dto.integral.IntegralGetBalanceDTO; import cn.com.glsx.scrm.shopmall.dto.integral.IntegralGetBalanceDTO;
import cn.com.glsx.scrm.shopmall.enums.integral.IntegralTransferOutChannelEnum; import cn.com.glsx.scrm.shopmall.enums.integral.IntegralTransferOutChannelEnum;
import cn.com.glsx.scrm.shopmall.model.IntegralTransferOut; import cn.com.glsx.scrm.shopmall.model.IntegralTransferOut;
import org.apache.commons.lang3.StringUtils;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
...@@ -29,9 +28,6 @@ public abstract class DefaultIntegralTransferOutPayStrategyService implements In ...@@ -29,9 +28,6 @@ public abstract class DefaultIntegralTransferOutPayStrategyService implements In
if (Objects.isNull(dto)) { if (Objects.isNull(dto)) {
return getBalance(); return getBalance();
} }
if (StringUtils.isBlank(dto.getChannelProvider())) {
return getBalance();
}
throw new RpcServiceException(DefaultErrorEnum.SERVICE_ERROR, "未实现"); throw new RpcServiceException(DefaultErrorEnum.SERVICE_ERROR, "未实现");
} }
......
...@@ -7,6 +7,7 @@ import cn.com.glsx.payment.modules.model.shenbianyun.dto.*; ...@@ -7,6 +7,7 @@ import cn.com.glsx.payment.modules.model.shenbianyun.dto.*;
import cn.com.glsx.payment.modules.service.ShenBianYunApiService; import cn.com.glsx.payment.modules.service.ShenBianYunApiService;
import cn.com.glsx.scrm.shopmall.dto.integral.IntegralGetBalanceDTO; import cn.com.glsx.scrm.shopmall.dto.integral.IntegralGetBalanceDTO;
import cn.com.glsx.scrm.shopmall.enums.integral.*; import cn.com.glsx.scrm.shopmall.enums.integral.*;
import cn.com.glsx.scrm.shopmall.dto.integral.IntegralChannelAccountDTO;
import cn.com.glsx.scrm.shopmall.model.IntegralTransferOut; import cn.com.glsx.scrm.shopmall.model.IntegralTransferOut;
import cn.com.glsx.scrm.shopmall.model.IntegralTransferOutOperation; import cn.com.glsx.scrm.shopmall.model.IntegralTransferOutOperation;
import cn.com.glsx.scrm.shopmall.service.integral.IntegralTransferOutOperationService; import cn.com.glsx.scrm.shopmall.service.integral.IntegralTransferOutOperationService;
...@@ -20,6 +21,7 @@ import org.springframework.core.env.Environment; ...@@ -20,6 +21,7 @@ import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
...@@ -44,10 +46,18 @@ public class ShenBianYunPayStrategyService extends DefaultIntegralTransferOutPay ...@@ -44,10 +46,18 @@ public class ShenBianYunPayStrategyService extends DefaultIntegralTransferOutPay
@Override @Override
public void batchPay(List<IntegralTransferOut> outList) { public void batchPay(List<IntegralTransferOut> outList) {
String remark = environment.getProperty("integral.pay.shenbianyun.remark", "续保业务(身边云打款)"); String remark = environment.getProperty("integral.pay.shenbianyun.remark", "续保业务(身边云打款)");
BatchOrderTransDTO dto = new BatchOrderTransDTO(); Map<String, List<IntegralTransferOut>> groupMap = outList.stream()
String channelProvider = outList.stream().map(IntegralTransferOut::getChannelProvider).filter(StringUtils::isNotBlank).findFirst().orElse(null); .collect(Collectors.groupingBy(p ->
p.getPaymentEntityCode() + "|" + p.getLevyCode() + "|" + (p.getLevyChannelCode() != null ? p.getLevyChannelCode() : "")));
for (Map.Entry<String, List<IntegralTransferOut>> entry : groupMap.entrySet()) {
List<IntegralTransferOut> group = entry.getValue();
String paymentEntityCode = group.get(0).getPaymentEntityCode();
String levyCode = group.get(0).getLevyCode();
String levyChannelCode = group.get(0).getLevyChannelCode();
try { try {
List<PayItemsDTO> payItems = outList.stream().map(p -> { List<PayItemsDTO> payItems = group.stream().map(p -> {
PayItemsDTO item = new PayItemsDTO(); PayItemsDTO item = new PayItemsDTO();
item.setMerOrderId(p.getOutSettleOrderId()); item.setMerOrderId(p.getOutSettleOrderId());
item.setPayeeName(p.getName()); item.setPayeeName(p.getName());
...@@ -59,20 +69,25 @@ public class ShenBianYunPayStrategyService extends DefaultIntegralTransferOutPay ...@@ -59,20 +69,25 @@ public class ShenBianYunPayStrategyService extends DefaultIntegralTransferOutPay
item.setPaymentType(0); item.setPaymentType(0);
return item; return item;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
BatchOrderTransDTO dto = new BatchOrderTransDTO();
dto.setPayItems(payItems); dto.setPayItems(payItems);
dto.setChannelProvider(channelProvider); dto.setPaymentEntityCode(paymentEntityCode);
dto.setSubAccountCode(levyCode);
dto.setSubAccountChannelCode(levyChannelCode);
log.info("(身边云)请求第三方创建订单参数:{}", JSONObject.toJSONString(dto)); log.info("(身边云)请求第三方创建订单参数:{}", JSONObject.toJSONString(dto));
Result<BatchPaymentResDTO> result = apiService.createOrder(dto); Result<BatchPaymentResDTO> result = apiService.createOrder(dto);
log.info("(身边云)请求第三方创建订单返回:{}", JSONObject.toJSONString(result)); log.info("(身边云)请求第三方创建订单返回:{}", JSONObject.toJSONString(result));
if (result.isSuccess()) { if (result.isSuccess()) {
log.info("(身边云)请求第三方创建订单成功,等待后续回调处理"); log.info("(身边云)请求第三方创建订单成功,等待后续回调处理");
return; continue;
} }
log.error("(身边云)请求第三方创建订单失败"); log.error("(身边云)请求第三方创建订单失败");
// 接口调用失败/第三方未受理的状态转到未受理 // 接口调用失败/第三方未受理的状态转到未受理
handleFailOrder(outList, result.getMsg()); handleFailOrder(group, result.getMsg());
} catch (Exception e) { } catch (Exception e) {
log.error("(身边云)积分转出订单{},创建第三方订单失败", outList, e); log.error("(身边云)积分转出订单{},创建第三方订单失败", group, e);
}
} }
} }
...@@ -99,13 +114,17 @@ public class ShenBianYunPayStrategyService extends DefaultIntegralTransferOutPay ...@@ -99,13 +114,17 @@ public class ShenBianYunPayStrategyService extends DefaultIntegralTransferOutPay
public Long getBalance(IntegralGetBalanceDTO dto) { public Long getBalance(IntegralGetBalanceDTO dto) {
try { try {
log.info("(身边云)查询余额:{}", dto); log.info("(身边云)查询余额:{}", dto);
Result<QueryAccountBalanceResponseDTO> result = apiService.queryBalance(dto.getChannelProvider()); QueryAccountBalanceRequestDTO req = new QueryAccountBalanceRequestDTO();
req.setPaymentEntityCode(dto.getPaymentEntityCode());
req.setSubAccountCode(dto.getLevyCode());
req.setSubAccountChannelCode(dto.getLevyChannelCode());
Result<QueryAccountBalanceResponseDTO> result = apiService.queryBalance(req);
if (!result.isSuccess()) { if (!result.isSuccess()) {
throw new RpcServiceException(result.getMsg()); throw new RpcServiceException(result.getMsg());
} }
return result.getData().getBalance(); return result.getData().getBalance();
} catch (Exception e) { } catch (Exception e) {
log.error("(身边云)余额查询失败, channelProvider: {}", dto.getPaymentEntityCode(), e); log.error("(身边云)余额查询失败, dto: {}", dto, e);
throw new RpcServiceException("(身边云)余额查询失败,请稍后再试"); throw new RpcServiceException("(身边云)余额查询失败,请稍后再试");
} }
} }
...@@ -113,6 +132,12 @@ public class ShenBianYunPayStrategyService extends DefaultIntegralTransferOutPay ...@@ -113,6 +132,12 @@ public class ShenBianYunPayStrategyService extends DefaultIntegralTransferOutPay
@Override @Override
public boolean afterCreateOrder(List<IntegralTransferOut> orderList) { public boolean afterCreateOrder(List<IntegralTransferOut> orderList) {
try { try {
List<IntegralChannelAccountDTO> silentSignAccounts = integralTransferOutService.getSilentSignEnabledAccounts(IntegralTransferOutChannelEnum.SHENBIANYUN.getValue());
if (CollectionUtils.isEmpty(silentSignAccounts)) {
log.info("(身边云)无可用的静默签约账号");
return true;
}
// 根据三要数去重,防止重复签约 // 根据三要数去重,防止重复签约
orderList.stream() orderList.stream()
.collect(Collectors.toMap(p -> p.getName() + p.getMobile() + p.getIdCardNo(), p -> p, (p1, p2) -> p1)) .collect(Collectors.toMap(p -> p.getName() + p.getMobile() + p.getIdCardNo(), p -> p, (p1, p2) -> p1))
...@@ -121,14 +146,20 @@ public class ShenBianYunPayStrategyService extends DefaultIntegralTransferOutPay ...@@ -121,14 +146,20 @@ public class ShenBianYunPayStrategyService extends DefaultIntegralTransferOutPay
if (dto == null) { if (dto == null) {
return; return;
} }
// 所有渠道的服务商都要进行签约 // 对多服务商要进行静默签约
for (IntegralTransferOutChannelProviderEnum enumItem : IntegralTransferOutChannelProviderEnum.values()) { for (IntegralChannelAccountDTO account : silentSignAccounts) {
dto.setChannelProvider(enumItem.getValue()); if (account == null) {
log.info("(身边云)收款人签约:{}", dto); log.info("(身边云)静默签约账号异常");
continue;
}
dto.setPaymentEntityCode(account.getPaymentEntityCode());
dto.setSubAccountCode(account.getLevyCode());
dto.setSubAccountChannelCode(account.getLevyChannelCode());
log.info("(身边云)收款人静默签约:{}", dto);
SignResultDTO result = apiService.userContract(dto); SignResultDTO result = apiService.userContract(dto);
log.info("(身边云)收款人签约结果:{}", result); log.info("(身边云)收款人静默签约结果:{}", result);
if (!result.isSuccess()) { if (!result.isSuccess()) {
log.error("(身边云)收款人签约失败: {}", result); log.error("(身边云)收款人静默签约失败: {}", result);
} }
} }
}); });
...@@ -145,6 +176,11 @@ public class ShenBianYunPayStrategyService extends DefaultIntegralTransferOutPay ...@@ -145,6 +176,11 @@ public class ShenBianYunPayStrategyService extends DefaultIntegralTransferOutPay
if (dto == null) { if (dto == null) {
return SignResultDTO.fail("发起签约失败,数据异常"); return SignResultDTO.fail("发起签约失败,数据异常");
} }
if (StringUtils.isNotBlank(order.getPaymentEntityCode())) {
dto.setPaymentEntityCode(order.getPaymentEntityCode());
dto.setSubAccountCode(order.getLevyCode());
dto.setSubAccountChannelCode(order.getLevyChannelCode());
}
return apiService.userContract(dto); return apiService.userContract(dto);
} catch (Exception e) { } catch (Exception e) {
log.error("(身边云)查询签约状态异常", e); log.error("(身边云)查询签约状态异常", e);
...@@ -158,7 +194,6 @@ public class ShenBianYunPayStrategyService extends DefaultIntegralTransferOutPay ...@@ -158,7 +194,6 @@ public class ShenBianYunPayStrategyService extends DefaultIntegralTransferOutPay
dto.setIdCard(order.getIdCardNo()); dto.setIdCard(order.getIdCardNo());
dto.setMobile(order.getMobile()); dto.setMobile(order.getMobile());
dto.setCardNo(order.getRecvBankCardNo()); dto.setCardNo(order.getRecvBankCardNo());
dto.setChannelProvider(order.getChannelProvider());
if (StringUtils.isBlank(dto.getIdCard()) || StringUtils.isBlank(dto.getMobile()) || StringUtils.isBlank(dto.getName())) { if (StringUtils.isBlank(dto.getIdCard()) || StringUtils.isBlank(dto.getMobile()) || StringUtils.isBlank(dto.getName())) {
log.warn("三要素校验失败"); log.warn("三要素校验失败");
return null; return null;
......
...@@ -66,9 +66,12 @@ public class XinXiangYunPayStrategyService extends DefaultIntegralTransferOutPay ...@@ -66,9 +66,12 @@ public class XinXiangYunPayStrategyService extends DefaultIntegralTransferOutPay
} }
outs.stream() outs.stream()
.filter(p -> StringUtils.isNotBlank(p.getPaymentEntityCode())) .filter(p -> StringUtils.isNotBlank(p.getPaymentEntityCode()))
.collect(Collectors.groupingBy(p -> p.getPaymentEntityCode())) .collect(Collectors.groupingBy(p -> p.getPaymentEntityCode() + "|" + p.getLevyCode() + "|" + p.getLevyChannelCode()))
.forEach((paymentEntityCode, outList) -> { .forEach((key, outList) -> {
XinXiangYunPayReq req = new XinXiangYunPayReq(); XinXiangYunPayReq req = new XinXiangYunPayReq();
String paymentEntityCode = outList.get(0).getPaymentEntityCode();
String levyCode = outList.get(0).getLevyCode();
String levyChannelCode = outList.get(0).getLevyChannelCode();
List<XinXiangYunPayReq.PayItem> payItemList = outList.stream().map(transferOut -> { List<XinXiangYunPayReq.PayItem> payItemList = outList.stream().map(transferOut -> {
XinXiangYunPayReq.PayItem item = new XinXiangYunPayReq.PayItem(); XinXiangYunPayReq.PayItem item = new XinXiangYunPayReq.PayItem();
item.setPayeeName(transferOut.getName()); item.setPayeeName(transferOut.getName());
...@@ -86,10 +89,12 @@ public class XinXiangYunPayStrategyService extends DefaultIntegralTransferOutPay ...@@ -86,10 +89,12 @@ public class XinXiangYunPayStrategyService extends DefaultIntegralTransferOutPay
}).collect(Collectors.toList()); }).collect(Collectors.toList());
req.setMerBatchId(UUID.randomUUID().toString(true).substring(0, 30)); req.setMerBatchId(UUID.randomUUID().toString(true).substring(0, 30));
req.setSubjectCode(paymentEntityCode); req.setSubjectCode(paymentEntityCode);
req.setLevyCode(levyCode);
req.setLevyChannelCode(levyChannelCode);
req.setPayItemList(payItemList); req.setPayItemList(payItemList);
req.setTotalAmt(payItemList.stream().map(XinXiangYunPayReq.PayItem::getAmt).reduce(BigDecimal.ZERO, BigDecimal::add).toString()); req.setTotalAmt(payItemList.stream().map(XinXiangYunPayReq.PayItem::getAmt).reduce(BigDecimal.ZERO, BigDecimal::add).toString());
req.setTotalCount(payItemList.size() + ""); req.setTotalCount(payItemList.size() + "");
log.info("(薪享云)请求第三方创建订单参数{}:{}", paymentEntityCode, JSONObject.toJSONString(req)); log.info("(薪享云)请求第三方创建订单参数{}:{}", key, JSONObject.toJSONString(req));
Result<XinXiangYunPayResp> resp = apiService.createOrder(req); Result<XinXiangYunPayResp> resp = apiService.createOrder(req);
log.info("(薪享云)请求第三方创建订单返回:{}", JSONObject.toJSONString(resp)); log.info("(薪享云)请求第三方创建订单返回:{}", JSONObject.toJSONString(resp));
// 处理失败数据 // 处理失败数据
...@@ -214,13 +219,16 @@ public class XinXiangYunPayStrategyService extends DefaultIntegralTransferOutPay ...@@ -214,13 +219,16 @@ public class XinXiangYunPayStrategyService extends DefaultIntegralTransferOutPay
return; return;
} }
try { try {
accountDTOList.stream().filter(p -> StringUtils.isNotBlank(p.getLevyCode())).forEach(p -> { accountDTOList.stream()
.filter(p -> StringUtils.isNotBlank(p.getLevyCode()))
.collect(Collectors.groupingBy(p -> p.getPaymentEntityCode() + "|" + p.getLevyCode()))
.forEach((key, accountList) -> {
XinXiangYunSignReq dto = buildSignReq(order); XinXiangYunSignReq dto = buildSignReq(order);
if (dto == null) { if (dto == null) {
return; return;
} }
dto.setLevyCode(p.getLevyCode()); dto.setSubjectCode(accountList.get(0).getPaymentEntityCode());
dto.setSubjectCode(p.getPaymentEntityCode()); dto.setLevyCode(accountList.get(0).getLevyCode());
log.info("(薪享云)收款人签约[{}-{}]:{}", dto.getSubjectCode(), dto.getLevyCode(), dto); log.info("(薪享云)收款人签约[{}-{}]:{}", dto.getSubjectCode(), dto.getLevyCode(), dto);
SignResultDTO result = apiService.userContract(dto); SignResultDTO result = apiService.userContract(dto);
log.info("(薪享云)收款人签约结果[{}-{}]:{}", dto.getSubjectCode(), dto.getLevyCode(), result); log.info("(薪享云)收款人签约结果[{}-{}]:{}", dto.getSubjectCode(), dto.getLevyCode(), result);
......
...@@ -63,14 +63,14 @@ ...@@ -63,14 +63,14 @@
resultMap="TreeDTOResult"> resultMap="TreeDTOResult">
select select
c.channel, c.channel_name, c.channel, c.channel_name,
ifnull(pe.code, cp.code) as payment_entity_code, ifnull(pe.name, cp.name) as payment_entity_name, if(cp.id is null, null, 1) as payment_entity_type, pe.code as payment_entity_code,
pe.name as payment_entity_name,
ca.levy_code, ca.levy_name, ca.levy_code, ca.levy_name,
ca.levy_channel_code, ca.levy_channel_name ca.levy_channel_code, ca.levy_channel_name
from shopmall_integral_transfer_channel_config c from shopmall_integral_transfer_channel_config c
left join shopmall_integral_channel_account ca on c.channel = ca.channel and ca.deleted_flag = 'N' left join shopmall_integral_channel_account ca on c.channel = ca.channel and ca.deleted_flag = 'N'
left join shopmall_integral_channel_account_entity_rel cape on ca.id = cape.channel_account_id and cape.deleted_flag = 'N' left join shopmall_integral_channel_account_entity_rel cape on ca.id = cape.channel_account_id and cape.deleted_flag = 'N'
left join shopmall_integral_payment_entity pe on pe.id = cape.payment_entity_id and pe.deleted_flag = 'N' left join shopmall_integral_payment_entity pe on pe.id = cape.payment_entity_id and pe.deleted_flag = 'N'
left join shopmall_integral_transfer_channel_provider cp on c.channel = cp.channel and cp.deleted_flag = 'N'
<where> <where>
c.deleted_flag = 'N' c.deleted_flag = 'N'
<if test="channel != null"> <if test="channel != null">
......
...@@ -43,7 +43,6 @@ ...@@ -43,7 +43,6 @@
<result column="mode" jdbcType="TINYINT" property="mode" /> <result column="mode" jdbcType="TINYINT" property="mode" />
<result column="source" jdbcType="TINYINT" property="withdrawalSource" /> <result column="source" jdbcType="TINYINT" property="withdrawalSource" />
<result column="appid" jdbcType="VARCHAR" property="appid" /> <result column="appid" jdbcType="VARCHAR" property="appid" />
<result column="channel_provider" jdbcType="VARCHAR" property="channelProvider" />
<result column="approval_id" jdbcType="INTEGER" property="approvalId" /> <result column="approval_id" jdbcType="INTEGER" property="approvalId" />
<result column="id_card_front" jdbcType="VARCHAR" property="idCardFront" /> <result column="id_card_front" jdbcType="VARCHAR" property="idCardFront" />
<result column="id_card_back" jdbcType="VARCHAR" property="idCardBack" /> <result column="id_card_back" jdbcType="VARCHAR" property="idCardBack" />
...@@ -57,7 +56,7 @@ ...@@ -57,7 +56,7 @@
customer_open_id, customer_union_id, name, id_card_no, recv_bank_card_no, recv_bank, customer_open_id, customer_union_id, name, id_card_no, recv_bank_card_no, recv_bank,
mobile, integral_amount, pay_amount, settle_amount, out_settle_order_id, status, mobile, integral_amount, pay_amount, settle_amount, out_settle_order_id, status,
channel, payment_entity_code, payment_entity_name, pay_date, receipt_date, error_message, batch_no, created_by, created_date, channel, payment_entity_code, payment_entity_name, pay_date, receipt_date, error_message, batch_no, created_by, created_date,
updated_by, updated_date, deleted_flag, mode, source, appid, channel_provider, approval_id, updated_by, updated_date, deleted_flag, mode, source, appid, approval_id,
id_card_front, id_card_back, disclaimer_agreement_url,levy_code,levy_name,levy_channel_code,levy_channel_name, id_card_front, id_card_back, disclaimer_agreement_url,levy_code,levy_name,levy_channel_code,levy_channel_name,
reality_platform_merchant_id,reality_platform_merchant_name reality_platform_merchant_id,reality_platform_merchant_name
</sql> </sql>
...@@ -132,9 +131,6 @@ ...@@ -132,9 +131,6 @@
<if test="withdrawalSource != null"> <if test="withdrawalSource != null">
and source = #{withdrawalSource} and source = #{withdrawalSource}
</if> </if>
<if test="channelProvider != null and channelProvider != ''">
and channel_provider = #{channelProvider}
</if>
<if test="paymentEntityCode != null and paymentEntityCode != ''"> <if test="paymentEntityCode != null and paymentEntityCode != ''">
and payment_entity_code = #{paymentEntityCode} and payment_entity_code = #{paymentEntityCode}
</if> </if>
...@@ -158,7 +154,7 @@ ...@@ -158,7 +154,7 @@
select select
ito.id,ito.out_settle_order_id, ito.staff_withdrawal_id, ito.customer_name, ito.customer_open_id, ito.customer_phone,ito.merchant_name, ito.integral_amount, ito.id,ito.out_settle_order_id, ito.staff_withdrawal_id, ito.customer_name, ito.customer_open_id, ito.customer_phone,ito.merchant_name, ito.integral_amount,
ito.pay_amount, ito.name, ito.id_card_no, ito.recv_bank_card_no, ito.recv_bank, ito.mobile, ito.status, ito.pay_amount, ito.name, ito.id_card_no, ito.recv_bank_card_no, ito.recv_bank, ito.mobile, ito.status,
ito.channel, ito.channel_provider, ito.created_date, ito.error_message,ito.settle_amount,ito.receipt_date,ito.transfer_type,ito.mode, ito.source, ito.appid, ito.channel, ito.created_date, ito.error_message,ito.settle_amount,ito.receipt_date,ito.transfer_type,ito.mode, ito.source, ito.appid,
ito.approval_id, itoo.`type` as itooType, itoo.updated_date as itooCreatedDate, itoo.created_by as itooCreatedBy, itoo.remark as itooRemark, ito.approval_id, itoo.`type` as itooType, itoo.updated_date as itooCreatedDate, itoo.created_by as itooCreatedBy, itoo.remark as itooRemark,
itoo.result as itooResult, itoo.result as itooResult,
ito.reality_platform_merchant_name, ito.reality_platform_merchant_id, ito.reality_platform_merchant_name, ito.reality_platform_merchant_id,
...@@ -242,10 +238,7 @@ ...@@ -242,10 +238,7 @@
round(ifnull(sum(if(channel = 'YUNHUO',settle_amount,0)),0)/100,2) as yunHuoSettleAmount, round(ifnull(sum(if(channel = 'YUNHUO',settle_amount,0)),0)/100,2) as yunHuoSettleAmount,
round(ifnull(sum(if(channel = 'YUNHUO-ZY',settle_amount,0)),0)/100,2) as yunHuoZYSettleAmount, round(ifnull(sum(if(channel = 'YUNHUO-ZY',settle_amount,0)),0)/100,2) as yunHuoZYSettleAmount,
round(ifnull(sum(if(channel = 'YUNHUO-WX',settle_amount,0)),0)/100,2) as yunHuoWXSettleAmount, round(ifnull(sum(if(channel = 'YUNHUO-WX',settle_amount,0)),0)/100,2) as yunHuoWXSettleAmount,
round(ifnull(sum(if(channel_provider = 'SHENBIANYUN-XH',settle_amount,0)),0)/100,2) as shenBianYunXHSettleAmount, round(ifnull(sum(if(channel = 'SHENBIANYUN',settle_amount,0)),0)/100,2) as shenBianYunSettleAmount,
round(ifnull(sum(if(channel_provider = 'SHENBIANYUN-YJ',settle_amount,0)),0)/100,2) as shenBianYunYJSettleAmount,
round(ifnull(sum(if(channel_provider = 'SHENBIANYUN-BC',settle_amount,0)),0)/100,2) as shenBianYunBCSettleAmount,
round(ifnull(sum(if(channel_provider = 'SHENBIANYUN-CJ',settle_amount,0)),0)/100,2) as shenBianYunCJSettleAmount,
round(ifnull(sum(if(channel = 'ZX',settle_amount,0)),0)/100,2) as zxSettleAmount, round(ifnull(sum(if(channel = 'ZX',settle_amount,0)),0)/100,2) as zxSettleAmount,
round(ifnull(sum(if(channel = 'SHENBIANYUN_JX',settle_amount,0)),0)/100,2) as shenBianYunJXSettleAmount, round(ifnull(sum(if(channel = 'SHENBIANYUN_JX',settle_amount,0)),0)/100,2) as shenBianYunJXSettleAmount,
round(ifnull(sum(if(channel = 'BIRDWORK',settle_amount,0)),0)/100,2) as birdWorkSettleAmount, round(ifnull(sum(if(channel = 'BIRDWORK',settle_amount,0)),0)/100,2) as birdWorkSettleAmount,
...@@ -263,9 +256,6 @@ ...@@ -263,9 +256,6 @@
<if test="channel != null and channel != ''"> <if test="channel != null and channel != ''">
and channel = #{channel} and channel = #{channel}
</if> </if>
<if test="channelProvider != null and channelProvider != ''">
and channel_provider = #{channelProvider}
</if>
<if test="outSettleOrderId != null and outSettleOrderId != ''"> <if test="outSettleOrderId != null and outSettleOrderId != ''">
and out_settle_order_id like CONCAT('%',#{outSettleOrderId},'%') and out_settle_order_id like CONCAT('%',#{outSettleOrderId},'%')
</if> </if>
......
  • @wangxw1
    commented
    Owner

    一、关键问题与优化建议(Top 3)

    1. 【严重】Dubbo API 接口参数被直接删除,破坏向下兼容性(违反重要规则)

    • 问题描述:在 rpc-scrm-shopmall-api 模块中,直接删除了多个 DTO 的字段。例如 IntegralGetBalanceDTO 和 IntegralTransferOutOperationDTO 中删除了 channelProvider,IntegralTransferOutDTO 中删除了 paymentSubject。
    • 影响分析:Dubbo 服务提供者的 Remote 接口属于对外暴露的契约。直接删除请求参数或已有字段属于危险实现。如果存在未同步更新的旧版本消费者(Consumer)继续传递这些字段,可能会导致反序列化异常或因字段丢失导致业务逻辑发生不可预期的错误。
    • 优化建议:对于废弃的 API 字段,应使用 @Deprecated 注解标记,而不是直接删除;在业务逻辑中逐步解除对该字段的依赖。 java // 建议的修改方式 @Deprecated @ApiModelProperty(notes = "渠道服务商(已废弃)") private String channelProvider;

    2. 【高风险】allPay 方法查询条件逻辑变更,可能导致漏处理数据

    • 问题描述:在 IntegralTransferOutService.java 的 allPay 方法中,原逻辑会深拷贝 request 并主动将 channel、paymentEntityCode 等字段置为 null 后再去执行 integralTransferOutMapper.list()。本次修改移除了该逻辑,直接将原始 request 作为查询条件。
    • 影响分析:如果前端或调用方在 request 中传入了这些字段,修改后的代码会将它们带入 SQL 的 WHERE 条件中。这会导致原本应该被查出并执行“一键付款”的记录被过滤掉,引发严重的业务漏单 Bug。
    • 优化建议:恢复原有逻辑,或者构建一个专门用于查询的 Request 对象,确保不受非预期参数的干扰。 java // 建议恢复或优化为: IntegralTransferOutDTO queryReq = new IntegralTransferOutDTO(); // 仅拷贝需要的查询条件(如状态、时间范围等),忽略支付专属字段 BeanUtils.copyProperties(request, queryReq); queryReq.setPayChannel(null); queryReq.setPayPaymentEntityCode(null); // ... 其他需要忽略的字段 List<IntegralTransferOutDTO> list = integralTransferOutMapper.list(queryReq);

    3. 【中风险】环境变量解析逻辑存在空字符串匹配隐患

    • 问题描述:在 IntegralTransferOutService.java 的 getTransferOutSignData 方法中,解析环境变量并进行 split(",") 操作时,未判断字符串是否为空。 java String envKey = env.getProperty("scrm.shopmall.integral.transfer.sign.save.ignore", String.class, ""); List<String> ignoreSaveSignChannel = Arrays.stream(envKey.split(",")).map(String::trim).collect(Collectors.toList());
    • 影响分析:当配置项不存在或为空字符串 "" 时,"".split(",") 会返回包含一个空字符串的数组 [""]。此时 ignoreSaveSignChannel 列表中会包含一个空字符串。如果后续的 order.getChannel() 恰好为空或未赋值,contains 判断将返回 true,导致本该保存的签约结果被错误地忽略。
    • 优化建议:在进行 split 前增加对空字符串的判断。 java List<String> ignoreSaveSignChannel = new ArrayList<>(); if (StringUtils.isNotBlank(envKey)) { ignoreSaveSignChannel = Arrays.stream(envKey.split(",")) .map(String::trim) .filter(StringUtils::isNotBlank) // 过滤掉无效配置 .collect(Collectors.toList()); }

    二、评分明细

    • 功能实现的正确性与健壮性(28 / 40分):
      • 扣分原因:allPay 核心业务逻辑的查询条件发生非预期变更,存在严重的业务漏单风险;环境变量的 split 处理不够健壮。未发现 MyBatis 子查询,符合规范。
    • 安全性与潜在风险(30 / 30分):
      • 理由:未发现 SQL 注入、越权等明显安全漏洞。MyBatis 的 XML 调整规范,无越权风险。
    • 最佳实践与可维护性(10 / 20分):
      • 扣分原因:违反了 Dubbo 接口向后兼容的最佳实践,直接删除了 API 包中的 DTO 字段(扣10分)。另外,ShenBianYunPayStrategyService 中使用 + "|" 拼接可能为 null 的字段作为 Map 分组 Key,不够优雅。
    • 性能与资源利用(4 / 5分):
      • 扣分原因:在 ShenBianYunPayStrategyService 的 catch 块中直接打印整个 group 集合(log.error("...{}", group, e)),如果集合较大,会产生大量无用日志,消耗内存和 IO。建议仅打印 ID 列表。
    • 提交信息质量(5 / 5分):
      • 理由:Commit 信息使用了 refactor, fix 等规范前缀,并且详细列出了修改的点,清晰可追溯,质量很高。

    总分:77分

Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!