|
@@ -1,12 +1,17 @@
|
|
|
package com.jjt.biz.controller;
|
|
|
|
|
|
+import com.jjt.biz.vo.CostVO;
|
|
|
+import com.jjt.biz.vo.GlobalRevenueVO;
|
|
|
+import com.jjt.biz.vo.SalesVO;
|
|
|
import com.jjt.common.core.controller.BaseController;
|
|
|
import com.jjt.common.core.domain.R;
|
|
|
+import com.jjt.common.core.redis.RedisCache;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
@@ -19,6 +24,9 @@ import java.util.*;
|
|
|
@RequestMapping("/api/driver")
|
|
|
@Slf4j
|
|
|
public class ApiDriverController extends BaseController {
|
|
|
+ @Resource
|
|
|
+ private RedisCache redisCache;
|
|
|
+
|
|
|
@ApiOperation("全球营收")
|
|
|
@GetMapping("/rev")
|
|
|
@CrossOrigin(origins = "*")
|
|
@@ -139,7 +147,21 @@ public class ApiDriverController extends BaseController {
|
|
|
forecastList.add(forecastMap);
|
|
|
}
|
|
|
result.put("forecastList", forecastList);
|
|
|
- return R.ok(result);
|
|
|
+ Object obj = redisCache.getCacheObject("driver:rev");
|
|
|
+ if (obj != null) {
|
|
|
+ return R.ok(obj);
|
|
|
+ } else {
|
|
|
+ return R.ok(result);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("全球营收")
|
|
|
+ @PostMapping("/rev")
|
|
|
+ @CrossOrigin(origins = "*")
|
|
|
+ @ResponseBody
|
|
|
+ public R<?> saveRev(@RequestBody GlobalRevenueVO vo) {
|
|
|
+ redisCache.setCacheObject("driver:rev", vo);
|
|
|
+ return R.ok();
|
|
|
}
|
|
|
|
|
|
@ApiOperation("销售")
|
|
@@ -260,8 +282,21 @@ public class ApiDriverController extends BaseController {
|
|
|
specRanking.add(specData);
|
|
|
}
|
|
|
result.put("bom", specRanking);
|
|
|
+ Object obj = redisCache.getCacheObject("driver:sales");
|
|
|
+ if (obj != null) {
|
|
|
+ return R.ok(obj);
|
|
|
+ } else {
|
|
|
+ return R.ok(result);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- return R.ok(result);
|
|
|
+ @ApiOperation("销售")
|
|
|
+ @PostMapping("/sales")
|
|
|
+ @CrossOrigin(origins = "*")
|
|
|
+ @ResponseBody
|
|
|
+ public R<?> saveSales(@RequestBody SalesVO vo) {
|
|
|
+ redisCache.setCacheObject("driver:sales", vo);
|
|
|
+ return R.ok();
|
|
|
}
|
|
|
|
|
|
@ApiOperation("成本")
|
|
@@ -344,10 +379,6 @@ public class ApiDriverController extends BaseController {
|
|
|
put("month", month);
|
|
|
put("value", Math.round(v3 * 100) / 100.0);
|
|
|
}});
|
|
|
- n3List.add(new HashMap<String, Object>() {{
|
|
|
- put("month", month);
|
|
|
- put("value", Math.round(v3 * 100) / 100.0);
|
|
|
- }});
|
|
|
n4List.add(new HashMap<String, Object>() {{
|
|
|
put("month", month);
|
|
|
put("value", Math.round(v4 * 100) / 100.0);
|
|
@@ -396,8 +427,8 @@ public class ApiDriverController extends BaseController {
|
|
|
// 成本明细数据
|
|
|
List<Map<String, Object>> costDetails = new ArrayList<>();
|
|
|
String[] costItems = {"产量", "人工工资", "计时工资", "社会保险费", "职工福利费", "委外加工费", "机物料(含柴油)",
|
|
|
- "修理费", "制版材料", "染料", "助剂", "辅料", "水", "水电费", "药剂", "其他", "折旧", "加工成本"};
|
|
|
- String[] proc = {"加弹","经编", "前整", "印染", "后整", "成品"};
|
|
|
+ "修理费", "制版材料", "染料", "助剂", "辅料", "水", "水电费", "药剂", "其他", "折旧", "加工成本"};
|
|
|
+ String[] proc = {"加弹", "经编", "前整", "印染", "后整", "成品"};
|
|
|
|
|
|
// 生成各成本项数据
|
|
|
for (String item : costItems) {
|
|
@@ -429,7 +460,21 @@ public class ApiDriverController extends BaseController {
|
|
|
}
|
|
|
result.put("detail", costDetails);
|
|
|
|
|
|
- return R.ok(result);
|
|
|
+ Object obj = redisCache.getCacheObject("driver:cogs");
|
|
|
+ if (obj != null) {
|
|
|
+ return R.ok(obj);
|
|
|
+ } else {
|
|
|
+ return R.ok(result);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("成本")
|
|
|
+ @PostMapping("/cogs")
|
|
|
+ @CrossOrigin(origins = "*")
|
|
|
+ @ResponseBody
|
|
|
+ public R<?> saveCogs(@RequestBody CostVO vo) {
|
|
|
+ redisCache.setCacheObject("driver:cogs", vo);
|
|
|
+ return R.ok();
|
|
|
}
|
|
|
|
|
|
@ApiOperation("采购")
|