Commit 8909822d authored by liwenbin's avatar liwenbin

增加日志

parent a5406afd
...@@ -38,7 +38,10 @@ public class AssetController { ...@@ -38,7 +38,10 @@ public class AssetController {
String authKey = request.getHeader("as_auth_key"); String authKey = request.getHeader("as_auth_key");
log.info("资产入库分发开始, assetForm : {}, authKey : {}", JSON.toJSONString(assetForm), authKey); log.info("资产入库分发开始, assetForm : {}, authKey : {}", JSON.toJSONString(assetForm), authKey);
boolean check = assetService.checkAssetForm(assetForm); boolean check = assetService.checkAssetForm(assetForm);
if (!check) { return GlobalResponse.create( AssetResponse.ASSET_FORM_IS_ERROR); } if (!check) {
log.info("资产入库入参错误, assetForm : {}, authKey : {}, 耗时 : {}", JSON.toJSONString(assetForm), authKey, stopwatch.stop().elapsed(TimeUnit.MILLISECONDS));
return GlobalResponse.create( AssetResponse.ASSET_FORM_IS_ERROR);
}
assetService.assetsIn(assetForm); assetService.assetsIn(assetForm);
log.info("资产入库分发结束, assetForm : {}, authKey : {}, response : {}, 耗时 : {}", JSON.toJSONString(assetForm), authKey, JSON.toJSONString(AssetResponse.SUCCESS), stopwatch.stop().elapsed(TimeUnit.MILLISECONDS)); log.info("资产入库分发结束, assetForm : {}, authKey : {}, response : {}, 耗时 : {}", JSON.toJSONString(assetForm), authKey, JSON.toJSONString(AssetResponse.SUCCESS), stopwatch.stop().elapsed(TimeUnit.MILLISECONDS));
return GlobalResponse.create(AssetResponse.SUCCESS); return GlobalResponse.create(AssetResponse.SUCCESS);
......
...@@ -94,10 +94,14 @@ public class AssetServiceImpl implements IAssetService{ ...@@ -94,10 +94,14 @@ public class AssetServiceImpl implements IAssetService{
@Override @Override
public boolean checkAssetForm(AssetForm assetForm) { public boolean checkAssetForm(AssetForm assetForm) {
// auditResult和deadLine必填 // auditResult和deadLine必填
if (StringUtils.isEmpty(assetForm.getAuditResult()) || StringUtils.isEmpty(assetForm.getDeadLine())) { return false; } if (StringUtils.isEmpty(assetForm.getAuditResult()) || StringUtils.isEmpty(assetForm.getDeadLine())) {
log.info("资产入库auditResult或deadLine为空, uuid : {}, bizNo : {}", assetForm.getUuid(), assetForm.getBizNo());
return false;
}
if ("true".equals(assetForm.getAuditResult())) { if ("true".equals(assetForm.getAuditResult())) {
if (StringUtils.isEmpty(assetForm.getFinanceProducts()) || StringUtils.isEmpty(assetForm.getAmount())) { if (StringUtils.isEmpty(assetForm.getFinanceProducts()) || StringUtils.isEmpty(assetForm.getAmount())) {
// auditResult为true,金融产品集和amount不能为空 // auditResult为true,金融产品集和amount不能为空
log.info("资产入库auditResult为true时, 金融产品集或amount为空, uuid : {}, bizNo : {}", assetForm.getUuid(), assetForm.getBizNo());
return false; return false;
} }
BigDecimal amount = new BigDecimal(assetForm.getAmount()); BigDecimal amount = new BigDecimal(assetForm.getAmount());
...@@ -110,6 +114,7 @@ public class AssetServiceImpl implements IAssetService{ ...@@ -110,6 +114,7 @@ public class AssetServiceImpl implements IAssetService{
BigDecimal cha = max.subtract(min); BigDecimal cha = max.subtract(min);
// 0 <= max - min <= 1 // 0 <= max - min <= 1
if (!(cha.compareTo(BigDecimal.ZERO) > -1 && cha.compareTo(BigDecimal.ONE) < 1)) { if (!(cha.compareTo(BigDecimal.ZERO) > -1 && cha.compareTo(BigDecimal.ONE) < 1)) {
log.info("资产入库,金融产品集不符合(0 <= max - min <= 1)规则, uuid : {}, bizNo : {}", assetForm.getUuid(), assetForm.getBizNo());
return false; return false;
} }
if (floor == null || min.compareTo(floor) < 0) { if (floor == null || min.compareTo(floor) < 0) {
...@@ -117,7 +122,8 @@ public class AssetServiceImpl implements IAssetService{ ...@@ -117,7 +122,8 @@ public class AssetServiceImpl implements IAssetService{
} }
} }
// amount >= floor // amount >= floor
if (amount.compareTo(floor) < 1) { if (amount.compareTo(floor) < 0) {
log.info("资产入库,金融产品及不符合(amount >= floor)规则, uuid : {}, bizNo : {}", assetForm.getUuid(), assetForm.getBizNo());
return false; return false;
} }
} }
...@@ -133,5 +139,9 @@ public class AssetServiceImpl implements IAssetService{ ...@@ -133,5 +139,9 @@ public class AssetServiceImpl implements IAssetService{
} else { } else {
System.out.println(false); System.out.println(false);
} }
BigDecimal amount = new BigDecimal("10000");
BigDecimal floor = new BigDecimal("9999");
System.out.println(amount.compareTo(floor));
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment