|
@@ -23,6 +23,7 @@ import org.springframework.stereotype.Component;
|
|
|
import java.io.FileReader;
|
|
|
import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
import java.util.Date;
|
|
|
@Component
|
|
|
@Configuration //1.主要用于标记配置类,兼备Component的效果。
|
|
@@ -34,12 +35,12 @@ public class AspenController extends AbstractController {
|
|
|
@Autowired
|
|
|
private TDailyProductionReportDao tDailyProductionReportDao;
|
|
|
|
|
|
- @Scheduled(cron = "0 */1 * * * ?")
|
|
|
-// @Scheduled(cron = "0 */15 * * * ?")
|
|
|
+// @Scheduled(cron = "0 */1 * * * ?")
|
|
|
+ @Scheduled(cron = "0 */15 * * * ?")
|
|
|
public void getExcelData(){
|
|
|
logger.info("实时获取数据");
|
|
|
- String csvFile = "D://ssyFile/wuliao.csv";
|
|
|
-// String csvFile = "C://dashboardAspen/wuliao.csv";
|
|
|
+// String csvFile = "D://ssyFile/wuliao.csv";
|
|
|
+ String csvFile = "C://dashboardAspen/wuliao.csv";
|
|
|
TDashboarddataEntity dashboarddataEntity = new TDashboarddataEntity();
|
|
|
CSVReader reader = null;
|
|
|
try {
|
|
@@ -554,23 +555,23 @@ public class AspenController extends AbstractController {
|
|
|
.last("where REPORT_DATE = (select max(t2.REPORT_DATE) from t_daily_production_report t2)")
|
|
|
);
|
|
|
logger.info("TDailyProductionReport:" + JSON.toJSONString(report));
|
|
|
- dashboarddataEntity.setNapOne(rounding0(report.getSctfStorageCltf1621()));
|
|
|
- dashboarddataEntity.setNapTwo(rounding0(report.getSctfStorageCltf1622()));
|
|
|
- dashboarddataEntity.setNapThree(rounding0(report.getSctfStorageCltf1623()));
|
|
|
- dashboarddataEntity.setEhtOne(rounding0(report.getSctfStorageTk1061()));
|
|
|
- dashboarddataEntity.setEhtTwo(rounding0(report.getSctfStorageTk1062()));
|
|
|
- dashboarddataEntity.setEhtThree(rounding0(report.getSctfStorageTk1063()));
|
|
|
- dashboarddataEntity.setEhtFour(rounding0(report.getSctfStorageTk1064()));
|
|
|
- dashboarddataEntity.setEhtFive(rounding0(report.getSctfStorageTk1065Off()));
|
|
|
- dashboarddataEntity.setAcrOne(rounding0(report.getSctfStorageTk1011()));
|
|
|
- dashboarddataEntity.setAcrTwo(rounding0(report.getSctfStorageTk1012()));
|
|
|
- dashboarddataEntity.setAcrThree(rounding0(report.getSctfStorageTk1013()));
|
|
|
- dashboarddataEntity.setAcrFour(rounding0(report.getSctfStorageTk1014()));
|
|
|
- dashboarddataEntity.setAcrZero(rounding0(report.getSctfStorageTk1040Off()));
|
|
|
- dashboarddataEntity.setProTwo(rounding0(report.getSctfStorageTk1520Rpg()));
|
|
|
- dashboarddataEntity.setProOne(rounding0(report.getSctfStorageTk1510B()));
|
|
|
- dashboarddataEntity.setProThree(rounding0(report.getSctfStorageTk1360T()));
|
|
|
- dashboarddataEntity.setProFour(rounding0(report.getSctfStorageTk1410X()));
|
|
|
+ dashboarddataEntity.setNapOne(rounding0(report.getSctfStorageCltf1621(), "33000" ));
|
|
|
+ dashboarddataEntity.setNapTwo(rounding0(report.getSctfStorageCltf1622(), "33000" ));
|
|
|
+ dashboarddataEntity.setNapThree(rounding0(report.getSctfStorageCltf1623(), "33000" ));
|
|
|
+ dashboarddataEntity.setEhtOne(rounding0(report.getSctfStorageTk1061(), "517" ));
|
|
|
+ dashboarddataEntity.setEhtTwo(rounding0(report.getSctfStorageTk1062(), "517" ));
|
|
|
+ dashboarddataEntity.setEhtThree(rounding0(report.getSctfStorageTk1063(), "517" ));
|
|
|
+ dashboarddataEntity.setEhtFour(rounding0(report.getSctfStorageTk1064(), "517" ));
|
|
|
+ dashboarddataEntity.setEhtFive(rounding0(report.getSctfStorageTk1065Off(), "517" ));
|
|
|
+ dashboarddataEntity.setAcrOne(rounding0(report.getSctfStorageTk1011(), "1200" ));
|
|
|
+ dashboarddataEntity.setAcrTwo(rounding0(report.getSctfStorageTk1012(), "1200" ));
|
|
|
+ dashboarddataEntity.setAcrThree(rounding0(report.getSctfStorageTk1013(), "1200" ));
|
|
|
+ dashboarddataEntity.setAcrFour(rounding0(report.getSctfStorageTk1014(), "1200" ));
|
|
|
+ dashboarddataEntity.setAcrZero(rounding0(report.getSctfStorageTk1040Off(), "1200" ));
|
|
|
+ dashboarddataEntity.setProTwo(rounding0(report.getSctfStorageTk1520Rpg(), "13500" ));
|
|
|
+ dashboarddataEntity.setProOne(rounding0(report.getSctfStorageTk1510B(), "3900" ));
|
|
|
+ dashboarddataEntity.setProThree(rounding0(report.getSctfStorageTk1360T(), "3800" ));
|
|
|
+ dashboarddataEntity.setProFour(rounding0(report.getSctfStorageTk1410X(), "1560" ));
|
|
|
|
|
|
logger.info("dashboardData:" + dashboarddataEntity);
|
|
|
tDashboarddataService.save(dashboarddataEntity);
|
|
@@ -589,23 +590,23 @@ public class AspenController extends AbstractController {
|
|
|
TDashboarddataEntity data = tDashboarddataService.getOne( new QueryWrapper<TDashboarddataEntity>()
|
|
|
.eq("id" , "811")
|
|
|
);
|
|
|
- data.setNapOne(rounding0(report.getSctfStorageCltf1621()));
|
|
|
- data.setNapTwo(rounding0(report.getSctfStorageCltf1622()));
|
|
|
- data.setNapThree(rounding0(report.getSctfStorageCltf1623()));
|
|
|
- data.setEhtOne(rounding0(report.getSctfStorageTk1061()));
|
|
|
- data.setEhtTwo(rounding0(report.getSctfStorageTk1062()));
|
|
|
- data.setEhtThree(rounding0(report.getSctfStorageTk1063()));
|
|
|
- data.setEhtFour(rounding0(report.getSctfStorageTk1064()));
|
|
|
- data.setEhtFive(rounding0(report.getSctfStorageTk1065Off()));
|
|
|
- data.setAcrOne(rounding0(report.getSctfStorageTk1011()));
|
|
|
- data.setAcrTwo(rounding0(report.getSctfStorageTk1012()));
|
|
|
- data.setAcrThree(rounding0(report.getSctfStorageTk1013()));
|
|
|
- data.setAcrFour(rounding0(report.getSctfStorageTk1014()));
|
|
|
- data.setAcrZero(rounding0(report.getSctfStorageTk1040Off()));
|
|
|
- data.setProTwo(rounding0(report.getSctfStorageTk1520Rpg()));
|
|
|
- data.setProOne(rounding0(report.getSctfStorageTk1510B()));
|
|
|
- data.setProThree(rounding0(report.getSctfStorageTk1360T()));
|
|
|
- data.setProFour(rounding0(report.getSctfStorageTk1410X()));
|
|
|
+ data.setNapOne(rounding0(report.getSctfStorageCltf1621(), "33000" ));
|
|
|
+ data.setNapTwo(rounding0(report.getSctfStorageCltf1622(), "33000" ));
|
|
|
+ data.setNapThree(rounding0(report.getSctfStorageCltf1623(), "33000" ));
|
|
|
+ data.setEhtOne(rounding0(report.getSctfStorageTk1061(), "517" ));
|
|
|
+ data.setEhtTwo(rounding0(report.getSctfStorageTk1062(), "517" ));
|
|
|
+ data.setEhtThree(rounding0(report.getSctfStorageTk1063(), "517" ));
|
|
|
+ data.setEhtFour(rounding0(report.getSctfStorageTk1064(), "517" ));
|
|
|
+ data.setEhtFive(rounding0(report.getSctfStorageTk1065Off(), "517" ));
|
|
|
+ data.setAcrOne(rounding0(report.getSctfStorageTk1011(), "1200" ));
|
|
|
+ data.setAcrTwo(rounding0(report.getSctfStorageTk1012(), "1200" ));
|
|
|
+ data.setAcrThree(rounding0(report.getSctfStorageTk1013(), "1200" ));
|
|
|
+ data.setAcrFour(rounding0(report.getSctfStorageTk1014(), "1200" ));
|
|
|
+ data.setAcrZero(rounding0(report.getSctfStorageTk1040Off(), "1200" ));
|
|
|
+ data.setProTwo(rounding0(report.getSctfStorageTk1520Rpg(), "13500" ));
|
|
|
+ data.setProOne(rounding0(report.getSctfStorageTk1510B(), "3900" ));
|
|
|
+ data.setProThree(rounding0(report.getSctfStorageTk1360T(), "3800" ));
|
|
|
+ data.setProFour(rounding0(report.getSctfStorageTk1410X(), "1560" ));
|
|
|
tDashboarddataService.saveOrUpdate(data);
|
|
|
}
|
|
|
|
|
@@ -636,22 +637,25 @@ public class AspenController extends AbstractController {
|
|
|
return "0.0";
|
|
|
}
|
|
|
};
|
|
|
- public String rounding0(String lineNum) {
|
|
|
+ public String rounding0(String lineNum , String allNum) {
|
|
|
try {
|
|
|
logger.info("读数:" + lineNum);
|
|
|
+ lineNum = new BigDecimal(lineNum).divide(new BigDecimal(allNum),4, RoundingMode.CEILING).multiply(new BigDecimal("100")).toString();
|
|
|
if (lineNum.equals("")) {
|
|
|
lineNum = "0.0";
|
|
|
}else {
|
|
|
if (!Character.isDigit(lineNum.charAt(0))) {
|
|
|
if ("-".equals(lineNum.substring(0,1))){
|
|
|
- int b = new BigDecimal(Double.parseDouble(lineNum)).intValue();
|
|
|
- lineNum = String.valueOf(b);
|
|
|
+ BigDecimal b = new BigDecimal(Double.parseDouble(lineNum));
|
|
|
+ double f = b.setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
+ lineNum = String.valueOf(f);
|
|
|
}else {
|
|
|
lineNum = "0.0";
|
|
|
}
|
|
|
}else {
|
|
|
- int b = new BigDecimal(Double.parseDouble(lineNum)).intValue();
|
|
|
- lineNum = String.valueOf(b);
|
|
|
+ BigDecimal b = new BigDecimal(Double.parseDouble(lineNum));
|
|
|
+ double f = b.setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
+ lineNum = String.valueOf(f);
|
|
|
}
|
|
|
}
|
|
|
logger.info(lineNum);
|