|
@@ -8,6 +8,7 @@ import com.sky.ioc.entity.News;
|
|
|
import com.sky.ioc.entity.params.IocParam;
|
|
|
import com.sky.ioc.entity.params.IocTimeRange;
|
|
|
import com.sky.ioc.mapper.BusMapper;
|
|
|
+import com.sky.ioc.mapper.PrintMapper;
|
|
|
import com.sky.ioc.service.carbon.CarbonService;
|
|
|
import com.sky.ioc.tool.DateUtil;
|
|
|
import com.sky.ioc.tool.GeneralMethod;
|
|
@@ -37,6 +38,9 @@ public class CarbonServiceImpl implements CarbonService {
|
|
|
@Autowired
|
|
|
BusMapper busMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ PrintMapper printMapper;
|
|
|
+
|
|
|
/**
|
|
|
* TODO 智能看板 --碳配额
|
|
|
* @Description
|
|
@@ -56,36 +60,30 @@ public class CarbonServiceImpl implements CarbonService {
|
|
|
public ReturnMsg getPrintingCoreIndicators(IocParam iocParam) {
|
|
|
Indeicator indeicator = new Indeicator();
|
|
|
List<JSONObject> objects = indeicator.getList();
|
|
|
- /*ThreadLocalRandom random = ThreadLocalRandom.current();
|
|
|
- int personCost = random.nextInt(10, 100);
|
|
|
- int personPaper = random.nextInt(10,20);
|
|
|
- int personC = random.nextInt(15,100);
|
|
|
- int personNum = random.nextInt(1,20);
|
|
|
+
|
|
|
float compare = (float) Math.random();
|
|
|
DecimalFormat decimalFormat = new DecimalFormat("#.0");
|
|
|
compare = Float.parseFloat(decimalFormat.format(compare));
|
|
|
- objects.get(0).put("value",personCost);
|
|
|
+ Double avgCost = printMapper.getAvgCost(iocParam);
|
|
|
+ Double avgPaper = printMapper.getAvgPaper(iocParam);
|
|
|
+ Double avgCarbon = printMapper.getAvgCarbon(iocParam);
|
|
|
+ avgCost = avgCost==null?0: Double.valueOf(decimalFormat.format(avgCost));
|
|
|
+ avgPaper = avgPaper==null?0:Double.valueOf(decimalFormat.format(avgPaper));
|
|
|
+ avgCarbon = avgCarbon==null?0:Double.valueOf(decimalFormat.format(avgCarbon));
|
|
|
+ Integer total = printMapper.getTotal(iocParam);
|
|
|
+ total= total==null?0:total;
|
|
|
+
|
|
|
+ objects.get(0).put("value",avgCost);
|
|
|
objects.get(0).put("compare",compare);
|
|
|
|
|
|
- objects.get(1).put("value",personPaper);
|
|
|
+ objects.get(1).put("value",avgPaper);
|
|
|
objects.get(1).put("compare",compare);
|
|
|
|
|
|
- objects.get(2).put("value",personC);
|
|
|
+ objects.get(2).put("value",avgCarbon);
|
|
|
objects.get(2).put("compare",compare);
|
|
|
|
|
|
- objects.get(3).put("value",personNum);
|
|
|
- objects.get(3).put("compare",compare);*/
|
|
|
- objects.get(0).put("value",10);
|
|
|
- objects.get(0).put("compare",0.4);
|
|
|
-
|
|
|
- objects.get(1).put("value",80);
|
|
|
- objects.get(1).put("compare",0.4);
|
|
|
-
|
|
|
- objects.get(2).put("value",80);
|
|
|
- objects.get(2).put("compare",0.4);
|
|
|
-
|
|
|
- objects.get(3).put("value",80);
|
|
|
- objects.get(3).put("compare",0.4);
|
|
|
+ objects.get(3).put("value",total);
|
|
|
+ objects.get(3).put("compare",compare);
|
|
|
indeicator.setWorthAttention("今日人流高峰在9:00/17:00,记得提前做好应对喔");
|
|
|
indeicator.setList(objects);
|
|
|
return ReturnMsg.ok(indeicator);
|
|
@@ -102,8 +100,31 @@ public class CarbonServiceImpl implements CarbonService {
|
|
|
@Override
|
|
|
public ReturnMsg getConferenceRoomInfo(IocParam iocParam) {
|
|
|
String[] param = {"print","inkCartridge"};
|
|
|
- String[] labKey = {"1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"};
|
|
|
- List<Label> labels1 = GeneralMethod.getInstance().dataGeneration(param, labKey);
|
|
|
+ String startStr = iocParam.getTimeRange().getStartDate();
|
|
|
+ String endStr = iocParam.getTimeRange().getEndDate();
|
|
|
+ List<String> list = DateUtil.getBetweenDays(startStr, endStr);
|
|
|
+ String[] labKey = list.toArray(new String[0]);
|
|
|
+ List<Label> labels1 = new ArrayList<>();
|
|
|
+ DecimalFormat decimalFormat = new DecimalFormat("#.0");
|
|
|
+ for (int i = 0; i < labKey.length; i++) {
|
|
|
+ Label label = new Label();
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ IocParam iocParam1 = new IocParam();
|
|
|
+ IocTimeRange iocTimeRange = new IocTimeRange();
|
|
|
+ iocTimeRange.setStartDate(labKey[i]+" 00:00:00");
|
|
|
+ iocTimeRange.setEndDate(labKey[i]+" 23:59:00");
|
|
|
+ iocParam1.setTimeRange(iocTimeRange);
|
|
|
+ Integer totalPaper = printMapper.getTotalPaper(iocParam1);
|
|
|
+ Double totalInkbox = printMapper.getTotalInkbox(iocParam1);
|
|
|
+ totalInkbox= totalInkbox==null?0: Double.valueOf(decimalFormat.format(totalInkbox));
|
|
|
+ totalPaper = totalPaper==null?0:totalPaper;
|
|
|
+ jsonObject.put(param[0],totalPaper);
|
|
|
+ jsonObject.put(param[1],totalInkbox);
|
|
|
+
|
|
|
+ label.setJsonObject(jsonObject);
|
|
|
+ label.setLabel(labKey[i]);
|
|
|
+ labels1.add(label);
|
|
|
+ }
|
|
|
return ReturnMsg.ok(labels1);
|
|
|
}
|
|
|
|