提交 8a754972 authored 作者: 李瑞鑫's avatar 李瑞鑫

Merge branch 'bug_sonar_20240426' into dev

...@@ -19,8 +19,8 @@ public enum BreakContractOwnerRecordEnum { ...@@ -19,8 +19,8 @@ public enum BreakContractOwnerRecordEnum {
private final Integer code; private final Integer code;
private final String msg; private final String msg;
public static Optional<PayStatus> getByCode(int code) { public static Optional<PayStatus> getByCode(Integer code) {
return Arrays.stream(values()).filter(e -> e.code == code).findFirst(); return Arrays.stream(values()).filter(e -> e.code.equals(code)).findFirst();
} }
public static String getMsgByCode(int code) { public static String getMsgByCode(int code) {
...@@ -38,8 +38,8 @@ public enum BreakContractOwnerRecordEnum { ...@@ -38,8 +38,8 @@ public enum BreakContractOwnerRecordEnum {
private final Integer code; private final Integer code;
private final String msg; private final String msg;
public static Optional<CompensationStatusStatus> getByCode(int code) { public static Optional<CompensationStatusStatus> getByCode(Integer code) {
return Arrays.stream(values()).filter(e -> e.code == code).findFirst(); return Arrays.stream(values()).filter(e -> e.code.equals(code)).findFirst();
} }
public static String getMsgByCode(int code) { public static String getMsgByCode(int code) {
...@@ -58,8 +58,8 @@ public enum BreakContractOwnerRecordEnum { ...@@ -58,8 +58,8 @@ public enum BreakContractOwnerRecordEnum {
private final Integer code; private final Integer code;
private final String msg; private final String msg;
public static Optional<ConfirmStatus> getByCode(int code) { public static Optional<ConfirmStatus> getByCode(Integer code) {
return Arrays.stream(values()).filter(e -> e.code == code).findFirst(); return Arrays.stream(values()).filter(e -> e.code.equals(code)).findFirst();
} }
public static String getMsgByCode(int code) { public static String getMsgByCode(int code) {
......
...@@ -19,8 +19,8 @@ public enum BreakContractRecordEnum { ...@@ -19,8 +19,8 @@ public enum BreakContractRecordEnum {
private final Integer code; private final Integer code;
private final String msg; private final String msg;
public static Optional<TriggerType> getByCode(int code) { public static Optional<TriggerType> getByCode(Integer code) {
return Arrays.stream(values()).filter(e -> e.code == code).findFirst(); return Arrays.stream(values()).filter(e -> e.code.equals(code)).findFirst();
} }
} }
@Getter @Getter
...@@ -34,8 +34,8 @@ public enum BreakContractRecordEnum { ...@@ -34,8 +34,8 @@ public enum BreakContractRecordEnum {
private final Integer code; private final Integer code;
private final String msg; private final String msg;
public static Optional<BreakContractPartyType> getByCode(int code) { public static Optional<BreakContractPartyType> getByCode(Integer code) {
return Arrays.stream(values()).filter(e -> e.code == code).findFirst(); return Arrays.stream(values()).filter(e -> e.code.equals(code)).findFirst();
} }
} }
......
...@@ -20,8 +20,8 @@ public enum BreakContractSettlementDriverEnum { ...@@ -20,8 +20,8 @@ public enum BreakContractSettlementDriverEnum {
private final Integer code; private final Integer code;
private final String msg; private final String msg;
public static Optional<BreakContractPartyType> getByCode(int code) { public static Optional<BreakContractPartyType> getByCode(Integer code) {
return Arrays.stream(values()).filter(e -> e.code == code).findFirst(); return Arrays.stream(values()).filter(e -> e.code.equals(code)).findFirst();
} }
public static String getMsgByCode(int code) { public static String getMsgByCode(int code) {
...@@ -39,8 +39,8 @@ public enum BreakContractSettlementDriverEnum { ...@@ -39,8 +39,8 @@ public enum BreakContractSettlementDriverEnum {
private final Integer code; private final Integer code;
private final String msg; private final String msg;
public static Optional<SettleStatus> getByCode(int code) { public static Optional<SettleStatus> getByCode(Integer code) {
return Arrays.stream(values()).filter(e -> e.code == code).findFirst(); return Arrays.stream(values()).filter(e -> e.code.equals(code)).findFirst();
} }
public static String getMsgByCode(int code) { public static String getMsgByCode(int code) {
...@@ -57,8 +57,8 @@ public enum BreakContractSettlementDriverEnum { ...@@ -57,8 +57,8 @@ public enum BreakContractSettlementDriverEnum {
private final Integer code; private final Integer code;
private final String msg; private final String msg;
public static Optional<SettlePlatform> getByCode(int code) { public static Optional<SettlePlatform> getByCode(Integer code) {
return Arrays.stream(values()).filter(e -> e.code == code).findFirst(); return Arrays.stream(values()).filter(e -> e.code.equals(code)).findFirst();
} }
public static String getMsgByCode(int code) { public static String getMsgByCode(int code) {
......
...@@ -21,8 +21,8 @@ public enum OrderGoodsPendingVehicleUsageEnum { ...@@ -21,8 +21,8 @@ public enum OrderGoodsPendingVehicleUsageEnum {
private final Integer code; private final Integer code;
private final String name; private final String name;
public static Optional<Status> getByCode(String c) { public static Optional<Status> getByCode(Integer code) {
return Arrays.stream(values()).filter(e -> e.code.equals(c)).findFirst(); return Arrays.stream(values()).filter(e -> e.code.equals(code)).findFirst();
} }
} }
......
...@@ -27,7 +27,7 @@ public enum OrderGoodsStatusEnum { ...@@ -27,7 +27,7 @@ public enum OrderGoodsStatusEnum {
private final String name; private final String name;
public static Optional<Status> getByCode(Integer code) { public static Optional<Status> getByCode(Integer code) {
return Arrays.stream(values()).filter(e -> e.code == code).findFirst(); return Arrays.stream(values()).filter(e -> e.code.equals(code)).findFirst();
} }
} }
......
...@@ -22,7 +22,7 @@ public enum OrderGoodsStopEnum { ...@@ -22,7 +22,7 @@ public enum OrderGoodsStopEnum {
private final String name; private final String name;
public static Optional<Status> getByCode(Integer code) { public static Optional<Status> getByCode(Integer code) {
return Arrays.stream(values()).filter(e -> e.code == code).findFirst(); return Arrays.stream(values()).filter(e -> e.code.equals(code)).findFirst();
} }
} }
......
...@@ -22,7 +22,7 @@ public enum PendingOrderWayStatusEnum { ...@@ -22,7 +22,7 @@ public enum PendingOrderWayStatusEnum {
private final String name; private final String name;
public static Optional<Status> getByCode(Integer code) { public static Optional<Status> getByCode(Integer code) {
return Arrays.stream(values()).filter(e -> e.code == code).findFirst(); return Arrays.stream(values()).filter(e -> e.code.equals(code)).findFirst();
} }
} }
......
...@@ -108,10 +108,13 @@ public class SendMessageMachineCheckComponent { ...@@ -108,10 +108,13 @@ public class SendMessageMachineCheckComponent {
InetAddress inet = null; InetAddress inet = null;
try { try {
inet = InetAddress.getLocalHost(); inet = InetAddress.getLocalHost();
if (inet != null) {
ip = inet.getHostAddress();
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
ip = inet.getHostAddress();
} }
} }
// 多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割 // 多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割
......
...@@ -14,19 +14,19 @@ import java.math.BigDecimal; ...@@ -14,19 +14,19 @@ import java.math.BigDecimal;
*/ */
public class WalletResidueDTO { public class WalletResidueDTO {
//余额
@ApiModelProperty(value = "余额", dataType = "double", example = "11.10") @ApiModelProperty(value = "余额", dataType = "double", example = "11.10")
private Long residue; private Long residue;
//冻结的资金
@ApiModelProperty(value = "冻结的资金", dataType = "double", example = "11.10") @ApiModelProperty(value = "冻结的资金", dataType = "double", example = "11.10")
private Long frozen; private Long frozen;
//保证金
@ApiModelProperty(value = "保证金", dataType = "double", example = "11.10") @ApiModelProperty(value = "保证金", dataType = "double", example = "11.10")
private Double deposit; private Double deposit;
//状态0锁定1正常2异常
@ApiModelProperty(value = "状态0锁定1正常2异常", dataType = "int", example = "1") @ApiModelProperty(value = "状态0锁定1正常2异常", dataType = "int", example = "1")
private Integer status; private Integer status;
//是否设置交易密码0没有1有
@ApiModelProperty(value = "是否设置交易密码0没有1有", dataType = "String", example = "1") @ApiModelProperty(value = "是否设置交易密码0没有1有", dataType = "String", example = "1")
private String pwd; private String pwd;
...@@ -56,7 +56,7 @@ public class WalletResidueDTO { ...@@ -56,7 +56,7 @@ public class WalletResidueDTO {
} }
@JsonGetter(value="frozen") @JsonGetter(value="frozen")
public BigDecimal frozenFormat() { public BigDecimal frozenFormat() {
return new BigDecimal(new Double(this.frozen)/100); return BigDecimal.valueOf(new Double(this.frozen)/100);
} }
@JsonGetter(value="residue") @JsonGetter(value="residue")
public Double residueFormat() { public Double residueFormat() {
...@@ -64,7 +64,7 @@ public class WalletResidueDTO { ...@@ -64,7 +64,7 @@ public class WalletResidueDTO {
} }
@JsonGetter(value="deposit") @JsonGetter(value="deposit")
public Double depositFormat() { public Double depositFormat() {
return new Double(this.deposit)/100; return this.deposit/100;
} }
public Double getDeposit() { public Double getDeposit() {
......
...@@ -46,7 +46,7 @@ public class NetworkDriverAccountSyncJob { ...@@ -46,7 +46,7 @@ public class NetworkDriverAccountSyncJob {
param.setMobile(vo.getMobile()); param.setMobile(vo.getMobile());
try { try {
Thread.sleep(2000L); Thread.sleep(2000L);
} catch (InterruptedException e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
networkDriverAccountService.createNetworkDriverAccount(param); networkDriverAccountService.createNetworkDriverAccount(param);
......
...@@ -38,7 +38,7 @@ public class OrderNoGenerateJob implements InitializingBean { ...@@ -38,7 +38,7 @@ public class OrderNoGenerateJob implements InitializingBean {
* 提前生成订单号 * 提前生成订单号
*/ */
@XxlJob("generateOrderNo") @XxlJob("generateOrderNo")
public void generateOrderNo()throws InterruptedException { public void generateOrderNo(){
LocalDateTime today = LocalDateTime.now(); LocalDateTime today = LocalDateTime.now();
//检验今天的订单池有没有,没有就生成一套 //检验今天的订单池有没有,没有就生成一套
String todayKey = RedisConstants.CARRIER_ORDER_NUM_POOL_KEY.replace("{date}", today.format(DateTimeFormatter.BASIC_ISO_DATE)); String todayKey = RedisConstants.CARRIER_ORDER_NUM_POOL_KEY.replace("{date}", today.format(DateTimeFormatter.BASIC_ISO_DATE));
...@@ -150,14 +150,14 @@ public class OrderNoGenerateJob implements InitializingBean { ...@@ -150,14 +150,14 @@ public class OrderNoGenerateJob implements InitializingBean {
*/ */
@Override @Override
public void afterPropertiesSet() throws Exception { public void afterPropertiesSet(){
//初始化redis中的订单池 //初始化redis中的订单池
executor.execute(new Runnable() { executor.execute(new Runnable() {
@Override @Override
public void run() { public void run() {
try { try {
generateOrderNo(); generateOrderNo();
} catch (InterruptedException e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
......
...@@ -89,8 +89,10 @@ public class PaymentServiceImpl implements PaymentService { ...@@ -89,8 +89,10 @@ public class PaymentServiceImpl implements PaymentService {
log.info("发起支付请求日志 {}", JSON.toJSONString(payUserDTO)); log.info("发起支付请求日志 {}", JSON.toJSONString(payUserDTO));
Result<Object> notify = (Result<Object>) postRequest(mslPaymentConfig.getHost()+ PERFORMANCE_PAY_CLX_PAYMENT.getUrl(), JSON.toJSONString(payUserDTO)); Result<Object> notify = (Result<Object>) postRequest(mslPaymentConfig.getHost()+ PERFORMANCE_PAY_CLX_PAYMENT.getUrl(), JSON.toJSONString(payUserDTO));
log.info("支付返回日志 {}", notify); log.info("支付返回日志 {}", notify);
if (notify == null || notify.getCode() != 0) { if (notify == null) {
//FEGIN返回null throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR);
}
if (notify.getCode() != 0) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, notify.getMsg()); throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, notify.getMsg());
} }
return notify; return notify;
...@@ -130,8 +132,10 @@ public class PaymentServiceImpl implements PaymentService { ...@@ -130,8 +132,10 @@ public class PaymentServiceImpl implements PaymentService {
log.info("发起支付请求日志 {}", payUserDTO); log.info("发起支付请求日志 {}", payUserDTO);
Result<Object> notify = (Result<Object>) postRequest(mslPaymentConfig.getHost()+ PERFORMANCE_PAY_CLX_PAYMENT.getUrl(), JSON.toJSONString(payUserDTO)); Result<Object> notify = (Result<Object>) postRequest(mslPaymentConfig.getHost()+ PERFORMANCE_PAY_CLX_PAYMENT.getUrl(), JSON.toJSONString(payUserDTO));
log.info("支付返回日志 {}", notify); log.info("支付返回日志 {}", notify);
if (notify == null || notify.getCode() != 0) { if (notify == null) {
//FEGIN返回null throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR);
}
if (notify.getCode() != 0) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, notify.getMsg()); throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, notify.getMsg());
} }
return notify; return notify;
......
...@@ -67,16 +67,20 @@ public class NbBankThirdpartyServiceImpl implements NbBankThirdpartyService { ...@@ -67,16 +67,20 @@ public class NbBankThirdpartyServiceImpl implements NbBankThirdpartyService {
*/ */
private static void downloadUsingStream(String urlStr, String file) throws IOException { private static void downloadUsingStream(String urlStr, String file) throws IOException {
URL url = new URL(urlStr); URL url = new URL(urlStr);
BufferedInputStream bis = new BufferedInputStream(url.openStream()); BufferedInputStream bis = null;
FileOutputStream fis = new FileOutputStream(file); FileOutputStream fis = null;
byte[] buffer = new byte[1024]; try {
int count=0; bis = new BufferedInputStream(url.openStream());
while((count = bis.read(buffer,0,1024)) != -1) fis = new FileOutputStream(file);
{ byte[] buffer = new byte[1024];
fis.write(buffer, 0, count); int count = 0;
while ((count = bis.read(buffer, 0, 1024)) != -1) {
fis.write(buffer, 0, count);
}
}finally {
if (fis != null){fis.close();}
if (bis != null){bis.close();}
} }
fis.close();
bis.close();
} }
......
...@@ -21,6 +21,7 @@ import org.springframework.amqp.rabbit.core.RabbitTemplate; ...@@ -21,6 +21,7 @@ import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -85,14 +86,13 @@ public abstract class GoodsOrderStrategy { ...@@ -85,14 +86,13 @@ public abstract class GoodsOrderStrategy {
LocalDateTime sendLazyTime = goodsOrderProcess(orderGoodsParams, orderInfo, now); LocalDateTime sendLazyTime = goodsOrderProcess(orderGoodsParams, orderInfo, now);
Message message = MessageBuilder.withBody(orderNo.getBytes()).build(); Message message = MessageBuilder.withBody(orderNo.getBytes()).build();
long epochMilli = 0L; BigDecimal epochMilli = null;
if (sendLazyTime.isAfter(now)) { if (sendLazyTime.isAfter(now)) {
epochMilli = sendLazyTime.minusMinutes(now.getMinute()).getMinute() * 60 * 1000; epochMilli = new BigDecimal(sendLazyTime.minusMinutes(now.getMinute()).getMinute() * 60 * 1000);
log.info("执行订单状态更改,选择时间在当前时间之后,则设置延迟队列时间,时间为:{}", epochMilli); log.info("执行订单状态更改,选择时间在当前时间之后,则设置延迟队列时间,时间为:{}", epochMilli);
} }
if (epochMilli == 0L) { if (epochMilli == null) {
log.info("执行订单状态更改,epochMilli时间为0,时间为:{}", epochMilli); log.info("执行订单状态更改,epochMilli时间为0,时间为:{}", epochMilli);
rabbitTemplate.send( rabbitTemplate.send(
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论