|
|
@@ -95,7 +95,7 @@ public class ApiDriverController extends BaseController {
|
|
|
|
|
|
// 产品线毛利率数据(百分比)
|
|
|
List<Map<String, Object>> gpmList = new ArrayList<>();
|
|
|
- String[] gpmTypes ={"羊毛毯", "纯棉毯", "亚麻毯", "丝绸毯", "竹纤维毯", "涤纶毯", "腈纶毯", "混纺毯", "法兰绒毯", "珊瑚绒毯"};
|
|
|
+ String[] gpmTypes = {"羊毛毯", "纯棉毯", "亚麻毯", "丝绸毯", "竹纤维毯", "涤纶毯", "腈纶毯", "混纺毯", "法兰绒毯", "珊瑚绒毯"};
|
|
|
for (int i = 0; i < gpmTypes.length; i++) {
|
|
|
Map<String, Object> gpmMap = new HashMap<>();
|
|
|
gpmMap.put("type", gpmTypes[i]); // 产品类型
|
|
|
@@ -204,10 +204,10 @@ public class ApiDriverController extends BaseController {
|
|
|
|
|
|
// 不同的销售类型使用不同的国家组合
|
|
|
String[][] regionGroups = {
|
|
|
- {"美国", "日本", "德国", "法国", "韩国"}, // 订单销售
|
|
|
- {"沙特阿拉伯", "阿联酋", "卡塔尔", "澳大利亚", "巴西"}, // 售后服务
|
|
|
- {"美国", "德国", "法国", "澳大利亚", "巴西"}, // 金融业务
|
|
|
- {"日本", "韩国", "沙特阿拉伯", "阿联酋", "卡塔尔"} // 其他
|
|
|
+ {"美国", "日本", "德国", "法国", "韩国"}, // 订单销售
|
|
|
+ {"沙特阿拉伯", "阿联酋", "卡塔尔", "澳大利亚", "巴西"}, // 售后服务
|
|
|
+ {"美国", "德国", "法国", "澳大利亚", "巴西"}, // 金融业务
|
|
|
+ {"日本", "韩国", "沙特阿拉伯", "阿联酋", "卡塔尔"} // 其他
|
|
|
};
|
|
|
|
|
|
// 根据销售类型选择对应的国家组
|
|
|
@@ -230,7 +230,7 @@ public class ApiDriverController extends BaseController {
|
|
|
for (int j = 0; j < 12; j++) {
|
|
|
Map<String, Object> monthData = new HashMap<>();
|
|
|
double amount = j == 11 ? remaining :
|
|
|
- Math.min(random.nextDouble() * (remaining / (12 - j) * 1.5), remaining);
|
|
|
+ Math.min(random.nextDouble() * (remaining / (12 - j) * 1.5), remaining);
|
|
|
monthData.put("month", months[j]);
|
|
|
monthData.put("amount", Math.round(amount * 100) / 100.0);
|
|
|
monthlySales.add(monthData);
|
|
|
@@ -269,7 +269,167 @@ public class ApiDriverController extends BaseController {
|
|
|
@CrossOrigin(origins = "*")
|
|
|
@ResponseBody
|
|
|
public R<?> cogs() {
|
|
|
- return R.ok();
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ String n1 = "人工工资+社保+福利";
|
|
|
+ String n2 = "电+汽";
|
|
|
+ String n3 = "运营+管理";
|
|
|
+ String n4 = "机物料+修理+制版材料+染料+助剂+辅料+水";
|
|
|
+ String n5 = "折旧";
|
|
|
+ String n6 = "其他";
|
|
|
+
|
|
|
+ Map<String, Object> curr = new HashMap<>();
|
|
|
+ curr.put("total", "4.32");
|
|
|
+ curr.put("n1", n1);
|
|
|
+ curr.put("v1", 0.76);
|
|
|
+ curr.put("p1", 14.7);
|
|
|
+ curr.put("n2", n2);
|
|
|
+ curr.put("v2", 1.3);
|
|
|
+ curr.put("p2", 26.7);
|
|
|
+ curr.put("n3", n3);
|
|
|
+ curr.put("v3", 0.33);
|
|
|
+ curr.put("p3", 11.3);
|
|
|
+ curr.put("n4", n4);
|
|
|
+ curr.put("v4", 1.63);
|
|
|
+ curr.put("p4", 33.3);
|
|
|
+ curr.put("n5", n5);
|
|
|
+ curr.put("v5", 0.48);
|
|
|
+ curr.put("p5", 13.3);
|
|
|
+ curr.put("n6", n6);
|
|
|
+ curr.put("v6", 0.08);
|
|
|
+ curr.put("p6", 0.67);
|
|
|
+ result.put("curr", curr);
|
|
|
+ Map<String, Object> his = new HashMap<>();
|
|
|
+ String[] months = {"1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"};
|
|
|
+
|
|
|
+ // 生成n1-n6各月数据
|
|
|
+ List<Map<String, Object>> n1List = new ArrayList<>();
|
|
|
+ List<Map<String, Object>> n2List = new ArrayList<>();
|
|
|
+ List<Map<String, Object>> n3List = new ArrayList<>();
|
|
|
+ List<Map<String, Object>> n4List = new ArrayList<>();
|
|
|
+ List<Map<String, Object>> n5List = new ArrayList<>();
|
|
|
+ List<Map<String, Object>> n6List = new ArrayList<>();
|
|
|
+
|
|
|
+ // 模拟各月数据,保持总成本趋势一致但各项目有波动
|
|
|
+ double[] totalCosts = {4.2, 4.1, 4.3, 4.5, 4.4, 4.6, 4.8, 4.7, 4.9, 5.0, 5.2, 5.1};
|
|
|
+
|
|
|
+ for (int i = 0; i < months.length; i++) {
|
|
|
+ double total = totalCosts[i];
|
|
|
+ String month = months[i];
|
|
|
+ // 各成本项占比浮动
|
|
|
+ double p1 = 14.7 + (Math.random() * 4 - 2);
|
|
|
+ double p2 = 26.7 + (Math.random() * 4 - 2);
|
|
|
+ double p3 = 11.3 + (Math.random() * 2 - 1);
|
|
|
+ double p4 = 33.3 + (Math.random() * 4 - 2);
|
|
|
+ double p5 = 13.3 + (Math.random() * 2 - 1);
|
|
|
+ double p6 = 0.67 + (Math.random() * 0.6 - 0.3);
|
|
|
+
|
|
|
+ // 计算实际值
|
|
|
+ double v1 = total * p1 / 100;
|
|
|
+ double v2 = total * p2 / 100;
|
|
|
+ double v3 = total * p3 / 100;
|
|
|
+ double v4 = total * p4 / 100;
|
|
|
+ double v5 = total * p5 / 100;
|
|
|
+ double v6 = total * p6 / 100;
|
|
|
+
|
|
|
+ // 添加到各成本项列表
|
|
|
+ n1List.add(new HashMap<String, Object>() {{
|
|
|
+ put("month", month);
|
|
|
+ put("value", Math.round(v1 * 100) / 100.0);
|
|
|
+ }});
|
|
|
+ n2List.add(new HashMap<String, Object>() {{
|
|
|
+ put("month", month);
|
|
|
+ put("value", Math.round(v2 * 100) / 100.0);
|
|
|
+ }});
|
|
|
+ n3List.add(new HashMap<String, Object>() {{
|
|
|
+ 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);
|
|
|
+ }});
|
|
|
+ n5List.add(new HashMap<String, Object>() {{
|
|
|
+ put("month", month);
|
|
|
+ put("value", Math.round(v5 * 100) / 100.0);
|
|
|
+ }});
|
|
|
+ n6List.add(new HashMap<String, Object>() {{
|
|
|
+ put("month", month);
|
|
|
+ put("value", Math.round(v6 * 100) / 100.0);
|
|
|
+ }});
|
|
|
+ }
|
|
|
+
|
|
|
+ his.put("n1", n1List);
|
|
|
+ his.put("n2", n2List);
|
|
|
+ his.put("n3", n3List);
|
|
|
+ his.put("n4", n4List);
|
|
|
+ his.put("n5", n5List);
|
|
|
+ his.put("n6", n6List);
|
|
|
+ result.put("his", his);
|
|
|
+
|
|
|
+ // 生成成本总曲线数据(单位:万元)
|
|
|
+ List<Map<String, Object>> totalCostCurve = new ArrayList<>();
|
|
|
+ for (int i = 0; i < months.length; i++) {
|
|
|
+ Map<String, Object> monthCost = new HashMap<>();
|
|
|
+ monthCost.put("month", months[i]);
|
|
|
+ // 将单位成本转换为总成本,乘以10000倍(假设单位是元转换为万元)
|
|
|
+ monthCost.put("value", totalCosts[i] * 10000);
|
|
|
+ totalCostCurve.add(monthCost);
|
|
|
+ }
|
|
|
+ result.put("trend", totalCostCurve);
|
|
|
+
|
|
|
+ // 模拟人均单位产出数据(单位:米/人/天)
|
|
|
+ List<Map<String, Object>> productivityList = new ArrayList<>();
|
|
|
+ String[] processes = {"经编", "前整", "印染", "后整", "成品", "加弹", "剖幅"};
|
|
|
+ double[] productivityValues = {120.5, 95.3, 85.7, 78.2, 65.4, 110.2, 92.8};
|
|
|
+
|
|
|
+ for (int i = 0; i < processes.length; i++) {
|
|
|
+ Map<String, Object> productivityMap = new HashMap<>();
|
|
|
+ productivityMap.put("name", processes[i]);
|
|
|
+ productivityMap.put("value", productivityValues[i]);
|
|
|
+ productivityList.add(productivityMap);
|
|
|
+ }
|
|
|
+ result.put("prod", productivityList);
|
|
|
+ // 成本明细数据
|
|
|
+ List<Map<String, Object>> costDetails = new ArrayList<>();
|
|
|
+ String[] costItems = {"产量", "人工工资", "计时工资", "社会保险费", "职工福利费", "委外加工费", "机物料(含柴油)",
|
|
|
+ "修理费", "制版材料", "染料", "助剂", "辅料", "水", "水电费", "药剂", "其他", "折旧", "加工成本"};
|
|
|
+ String[] proc = {"加弹","经编", "前整", "印染", "后整", "成品"};
|
|
|
+
|
|
|
+ // 生成各成本项数据
|
|
|
+ for (String item : costItems) {
|
|
|
+ Map<String, Object> itemData = new HashMap<>();
|
|
|
+ itemData.put("item", item);
|
|
|
+
|
|
|
+ // 为每个工序生成随机数据
|
|
|
+ Map<String, Double> processValues = new HashMap<>();
|
|
|
+ List<Double> processValuesList = new ArrayList<>();
|
|
|
+ for (String process : proc) {
|
|
|
+ // 根据成本项类型生成不同范围的值
|
|
|
+ double value = 0;
|
|
|
+ if (item.equals("产量")) {
|
|
|
+ value = 10000 + Math.random() * 5000; // 产量在1万-1.5万之间
|
|
|
+ } else if (item.equals("人工工资") || item.equals("计时工资")) {
|
|
|
+ value = 50 + Math.random() * 50; // 50-100之间
|
|
|
+ } else if (item.equals("社会保险费") || item.equals("职工福利费")) {
|
|
|
+ value = 20 + Math.random() * 30; // 20-50之间
|
|
|
+ } else if (item.equals("折旧")) {
|
|
|
+ value = 30 + Math.random() * 20; // 30-50之间
|
|
|
+ } else {
|
|
|
+ value = 10 + Math.random() * 40; // 10-50之间
|
|
|
+ }
|
|
|
+
|
|
|
+ processValuesList.add(Math.round(value * 100) / 100.0); // 保留两位小数
|
|
|
+ }
|
|
|
+ itemData.put("values", processValuesList);
|
|
|
+ costDetails.add(itemData);
|
|
|
+ }
|
|
|
+ result.put("detail", costDetails);
|
|
|
+
|
|
|
+ return R.ok(result);
|
|
|
}
|
|
|
|
|
|
@ApiOperation("采购")
|