|
@@ -4,11 +4,17 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.sky.ioc.entity.Indeicator;
|
|
|
import com.sky.ioc.entity.Label;
|
|
|
import com.sky.ioc.entity.Cake;
|
|
|
+import com.sky.ioc.entity.domain.operation.Asset;
|
|
|
+import com.sky.ioc.entity.domain.operation.Investment;
|
|
|
import com.sky.ioc.entity.params.IocParam;
|
|
|
+import com.sky.ioc.mapper.operation.AssetMapper;
|
|
|
+import com.sky.ioc.mapper.operation.InvestmentMapper;
|
|
|
import com.sky.ioc.service.assets.AssetService;
|
|
|
import com.sky.ioc.tool.DateUtil;
|
|
|
import com.sky.ioc.tool.GeneralMethod;
|
|
|
+import com.sky.ioc.tool.MathUtils;
|
|
|
import com.sky.ioc.tool.ReturnMsg;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.text.DecimalFormat;
|
|
@@ -27,6 +33,13 @@ import java.util.concurrent.ThreadLocalRandom;
|
|
|
|
|
|
@Service
|
|
|
public class AssetServiceImpl implements AssetService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ AssetMapper assetMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ InvestmentMapper investmentMapper;
|
|
|
+
|
|
|
@Override
|
|
|
public ReturnMsg getInvestmentDistribution() {
|
|
|
String[] param = {"investment1","investment2","investment3","investment4","rateReturn"};
|
|
@@ -163,26 +176,35 @@ public class AssetServiceImpl implements AssetService {
|
|
|
|
|
|
@Override
|
|
|
public ReturnMsg getOperAssetCoreIndicators(IocParam iocParam) {
|
|
|
+
|
|
|
Indeicator indeicator = new Indeicator();
|
|
|
List<JSONObject> objects = indeicator.getList();
|
|
|
ThreadLocalRandom random = ThreadLocalRandom.current();
|
|
|
DecimalFormat decimalFormat = new DecimalFormat("#.0");
|
|
|
- double totalAsset = random.nextDouble(1,10);
|
|
|
- totalAsset = Double.parseDouble(decimalFormat.format(totalAsset));
|
|
|
- int assetCount = random.nextInt(100, 1000);
|
|
|
+ double totalAsset = assetMapper.getTotalWorth(iocParam);
|
|
|
+ int assetCount = assetMapper.getTotalCount(iocParam);
|
|
|
float compare = (float) Math.random();
|
|
|
compare = Float.parseFloat(decimalFormat.format(compare));
|
|
|
-
|
|
|
- objects.get(0).put("value",totalAsset);
|
|
|
+ List<Asset> assets = assetMapper.topList(iocParam);
|
|
|
+ String assetName = "";
|
|
|
+ if(assets.size()>0){
|
|
|
+ assetName = assets.get(0).getName();
|
|
|
+ }
|
|
|
+ String investmentName = "";
|
|
|
+ Investment investment = investmentMapper.getTopOne(iocParam);
|
|
|
+ if(investment!=null){
|
|
|
+ investmentName = investment.getField();
|
|
|
+ }
|
|
|
+ objects.get(0).put("value", MathUtils.division(totalAsset,1,2));
|
|
|
objects.get(0).put("compare",compare);
|
|
|
|
|
|
objects.get(1).put("value",assetCount);
|
|
|
objects.get(1).put("compare",compare);
|
|
|
|
|
|
- objects.get(2).put("value","项目1");
|
|
|
+ objects.get(2).put("value",assetName);
|
|
|
objects.get(2).put("compare",60);
|
|
|
|
|
|
- objects.get(3).put("value","工业互联网");
|
|
|
+ objects.get(3).put("value",investmentName);
|
|
|
objects.get(3).put("compare",60);
|
|
|
indeicator.setWorthAttention("13笔记本即将到报废年限");
|
|
|
indeicator.setList(objects);
|