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

Merge branch 'bug_sonar_20240426' into dev

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