物机管理大屏服务封装

dev_xd
lj7788@126.com 2025-07-11 18:19:07 +08:00
parent 5b5b506f4e
commit a84942cb55
11 changed files with 400 additions and 37 deletions

View File

@ -12,6 +12,7 @@ import aiWarning from "./aiWarning";
import planSchedule from "./planSchedule"; import planSchedule from "./planSchedule";
import labor from "./labor"; import labor from "./labor";
import bim from "./bim" import bim from "./bim"
import machMater from './machmater'
export default { export default {
http: axios, http: axios,
downFile: download, downFile: download,
@ -28,4 +29,5 @@ export default {
planSchedule, planSchedule,
labor, labor,
bim, bim,
machMater
}; };

View File

@ -0,0 +1,25 @@
import request from '@/utils/request'
const machGetManageQuota=(projectId)=>{
return request({
url: '/manage/bgscreen/machMater/machGetManageQuota',
method: 'get',
params: {
projectId: projectId
}
})
}
//时间段内工号申领情况
const materGetConcreteMaterialActQuantityBuildingNoInfoService=data=>{
return request({
url: '/manage/bgscreen/machMater/materGetConcreteMaterialActQuantityBuildingNoInfoService',
method: 'get',
params: data
})
}
export default{
machGetManageQuota,
materGetConcreteMaterialActQuantityBuildingNoInfoService
}

View File

@ -7,15 +7,10 @@
<module-one-1-1 label="设备运行动态" class="labor-base"> </module-one-1-1> <module-one-1-1 label="设备运行动态" class="labor-base"> </module-one-1-1>
</el-col> </el-col>
<el-col :span="12" class="h100"> <el-col :span="12" class="h100">
<module-one-2-2 label="项目设备分布总览" class="h77"> </module-one-2-2>
<module-one-2-2 label="项目设备分布总览" class="h77"> <module-one-2-1 label class="no-title no-border h22"> </module-one-2-1>
</module-one-2-2>
<module-one-2-1 label class="no-title no-border h22">
</module-one-2-1>
</el-col> </el-col>
<el-col :span="6" class="h100"> <el-col :span="6" class="h100">
@ -30,18 +25,16 @@
<script> <script>
import debounce from "lodash.debounce"; import debounce from "lodash.debounce";
import request from "@/utils/request";
export default { export default {
data() { data() {
return { return {
dpi: "", dpi: "",
selProject: null, selProject: null,
apiPath:'//jzgj.crfeb.com.cn' apiPath: "//jzgj.crfeb.com.cn",
}; };
}, },
mounted() { mounted() {
//https://wzxh.crfeb.com.cn/
//https://jzgj.crfeb.com.cn/
this.$store.dispatch("ChangeNav", 801); this.$store.dispatch("ChangeNav", 801);
this.$bus.$on( this.$bus.$on(
"projectChange", "projectChange",
@ -68,19 +61,12 @@ export default {
this.chartKey++; this.chartKey++;
}, },
init() { init() {
let url='//jzgj.crfeb.com.cn/largeScreen/digitalConstruction/getManageQuota' if (!this.selProject) {
request({ return;
url:url, }
method:"post", this.$api.machMater.machGetManageQuota(this.selProject.id).then((d) => {
data:{ console.log("====>", d);
deptId:1, });
projectId:1,
app_key:'',
app_secret:''
}
}).then(d=>{
console.log("====>",d)
})
}, },
}, },
}; };

View File

@ -49,18 +49,16 @@ export default {
this.chartKey++; this.chartKey++;
}, },
init() { init() {
let url='//wzxh.crfeb.com.cn/MklBaseController/getService' if (!this.selProject) {
request({ return;
url, }
method:"get", let data={
params:{ projectId:this.selProject.id,
userId:'8401', startTime:this.$dt("2025-01-01").format("YYYY-MM-DD HH:mm:ss"),
chinaKey:'135f90b1bdafccab494a937eaccdedac', endTime:this.$dt(new Date()).format("YYYY-MM-DD HH:mm:ss"),
service:'getProjectChaoHaoStatisticsRPTService', }
projectId:'547d4de15da511ee9ca5506b4b2ac6ae' this.$api.machMater.materGetConcreteMaterialActQuantityBuildingNoInfoService(data).then(d=>{
} console.log("====>",d)
}).then(d=>{
console.log("---->",d)
}) })
}, },
}, },

View File

@ -7,6 +7,18 @@
<artifactId>yanzhu-common</artifactId> <artifactId>yanzhu-common</artifactId>
<version>3.6.2</version> <version>3.6.2</version>
</parent> </parent>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>10</source>
<target>10</target>
</configuration>
</plugin>
</plugins>
</build>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>yanzhu-common-core</artifactId> <artifactId>yanzhu-common-core</artifactId>

View File

@ -1,5 +1,6 @@
package com.yanzhu.common.core.utils.http; package com.yanzhu.common.core.utils.http;
import com.alibaba.fastjson2.JSONObject;
import com.yanzhu.common.core.constant.Constants; import com.yanzhu.common.core.constant.Constants;
import com.yanzhu.common.core.utils.StringUtils; import com.yanzhu.common.core.utils.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -377,4 +378,28 @@ public class HttpUtils
} }
return result.toString(); return result.toString();
} }
/**
* JSON GET
* @param json JSON
* @return GET
*/
public static String jsonToGetParams(JSONObject json) {
if (json == null || json.isEmpty()) {
return "";
}
StringBuilder params = new StringBuilder();
for (Map.Entry<String, Object> entry : json.entrySet()) {
if (params.length() > 0) {
params.append("&");
}
String key = entry.getKey();
String value = entry.getValue() != null ? entry.getValue().toString() : "";
// 对键值进行 URL 编码
params.append(URLEncoder.encode(key, StandardCharsets.UTF_8))
.append("=")
.append(URLEncoder.encode(value, StandardCharsets.UTF_8));
}
return params.toString();
}
} }

View File

@ -2,6 +2,7 @@ package com.yanzhu.manage.mapper;
import java.util.List; import java.util.List;
import com.yanzhu.manage.domain.AttendanceCfg; import com.yanzhu.manage.domain.AttendanceCfg;
import org.apache.ibatis.annotations.Param;
/** /**
* Mapper * Mapper
@ -58,4 +59,9 @@ public interface AttendanceCfgMapper
* @return * @return
*/ */
public int deleteAttendanceCfgByIds(Long[] ids); public int deleteAttendanceCfgByIds(Long[] ids);
/**
*
*/
String getMachMaterCfg(@Param("projectId") Long projectId,@Param("cfgType") String cfgType);
} }

View File

@ -117,4 +117,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
<select id="getMachMaterCfg" resultType="String">
select param_data from pro_machmater_config where project_id=#{projectId} and cfg_type=#{cfgType} LIMIT 1
</select>
</mapper> </mapper>

View File

@ -0,0 +1,293 @@
package com.yanzhu.manage.controller.bigscreen;
import com.alibaba.fastjson2.JSONObject;
import com.yanzhu.common.core.utils.StringUtils;
import com.yanzhu.common.core.utils.http.HttpUtils;
import com.yanzhu.common.core.web.controller.BaseController;
import com.yanzhu.common.core.web.domain.AjaxResult;
import com.yanzhu.manage.service.*;
import okhttp3.OkHttpClient;
import okhttp3.internal.http2.Http2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("/bgscreen/machMater")
public class MachMaterController extends BaseController {
public Map<String, Object> getConfig(Long projectId, String cfgType) throws Exception {
String param = attendanceCfgService.getMachMaterCfg(projectId, cfgType);
if (StringUtils.isEmpty(param)) {
throw new RuntimeException("请在后台进行物机配置");
}
JSONObject paramJson = JSONObject.parseObject(param);
String url = paramJson.getString("url");
if (StringUtils.isEmpty(url)) {
throw new RuntimeException("请在后台进行物机配置");
}
paramJson.remove("url");
Map<String, Object> map = new HashMap<>();
map.put("url", url);
map.put("obj", paramJson);
return map;
}
@Autowired
private IAttendanceCfgService attendanceCfgService;
/**
* -
*/
@GetMapping("/machGetManageQuota")
public AjaxResult machGetManageQuota(Long projectId) throws Exception {
Map<String, Object> map = getConfig(projectId, "mach");
String url = map.get("url").toString();
url += "/largeScreen/digitalConstruction/getManageQuota";
JSONObject paramJson = (JSONObject) map.get("obj");
HttpUtils httpUtils = new HttpUtils();
String result = httpUtils.sendJSONPost(url, paramJson.toString(), null);
return AjaxResult.success(JSONObject.parseObject(result));
}
/**
* -
*/
@GetMapping("/machGetEquipmentOverview")
public AjaxResult machGetEquipmentOverview(Long projectId) throws Exception {
Map<String, Object> map = getConfig(projectId, "mach");
String url = map.get("url").toString();
url += "/largeScreen/digitalConstruction/getEquipmentOverview";
JSONObject paramJson = (JSONObject) map.get("obj");
HttpUtils httpUtils = new HttpUtils();
String result = httpUtils.sendJSONPost(url, paramJson.toString(), null);
return AjaxResult.success(JSONObject.parseObject(result));
}
/**
* -
*/
@GetMapping("/machGetCertInfoData")
public AjaxResult machGetCertInfoData(Long projectId) throws Exception {
Map<String, Object> map = getConfig(projectId, "mach");
String url = map.get("url").toString();
url += "/largeScreen/digitalConstruction/getCertInfoData";
JSONObject paramJson = (JSONObject) map.get("obj");
HttpUtils httpUtils = new HttpUtils();
String result = httpUtils.sendJSONPost(url, paramJson.toString(), null);
return AjaxResult.success(JSONObject.parseObject(result));
}
/**
* -
*/
@GetMapping("/machSelectMachineMapData")
public AjaxResult machSelectMachineMapData(Long projectId) throws Exception {
Map<String, Object> map = getConfig(projectId, "mach");
String url = map.get("url").toString();
url += "/largeScreen/digitalConstruction/selectMachineMapData";
JSONObject paramJson = (JSONObject) map.get("obj");
HttpUtils httpUtils = new HttpUtils();
String result = httpUtils.sendJSONPost(url, paramJson.toString(), null);
return AjaxResult.success(JSONObject.parseObject(result));
}
/**
* -
*/
@GetMapping("/machGetMapData")
public AjaxResult machGetMapData(Long projectId) throws Exception {
Map<String, Object> map = getConfig(projectId, "mach");
String url = map.get("url").toString();
url += "/largeScreen/digitalConstruction/getMapData";
JSONObject paramJson = (JSONObject) map.get("obj");
HttpUtils httpUtils = new HttpUtils();
String result = httpUtils.sendJSONPost(url, paramJson.toString(), null);
return AjaxResult.success(JSONObject.parseObject(result));
}
/**
* -
*/
@GetMapping("/machGetClassifyWorks")
public AjaxResult machGetClassifyWorks(Long projectId) throws Exception {
Map<String, Object> map = getConfig(projectId, "mach");
String url = map.get("url").toString();
url += "/largeScreen/digitalConstruction/getClassifyWorks";
JSONObject paramJson = (JSONObject) map.get("obj");
HttpUtils httpUtils = new HttpUtils();
String result = httpUtils.sendJSONPost(url, paramJson.toString(), null);
return AjaxResult.success(JSONObject.parseObject(result));
}
/**
* -
*/
@GetMapping("/machGetClockInException")
public AjaxResult machGetClockInException(Long projectId, int pageSize) throws Exception {
Map<String, Object> map = getConfig(projectId, "mach");
String url = map.get("url").toString();
url += "/largeScreen/digitalConstruction/getClockInException";
JSONObject paramJson = (JSONObject) map.get("obj");
paramJson.put("pageSize", pageSize);
HttpUtils httpUtils = new HttpUtils();
String result = httpUtils.sendJSONPost(url, paramJson.toString(), null);
return AjaxResult.success(JSONObject.parseObject(result));
}
/**
* -
*/
@GetMapping("/machGetDeviceInfoByProjectId")
public AjaxResult machGetDeviceInfoByProjectId(Long projectId) throws Exception {
Map<String, Object> map = getConfig(projectId, "mach");
String url = map.get("url").toString();
url += "/largeScreen/digitalConstruction/getDeviceInfoByProjectId";
JSONObject paramJson = (JSONObject) map.get("obj");
HttpUtils httpUtils = new HttpUtils();
String result = httpUtils.sendJSONPost(url, paramJson.toString(), null);
return AjaxResult.success(JSONObject.parseObject(result));
}
/**
* -
*/
@GetMapping("/machGetExceptionAlert")
public AjaxResult machGetExceptionAlert(Long projectId, int size) throws Exception {
Map<String, Object> map = getConfig(projectId, "mach");
String url = map.get("url").toString();
url += "/largeScreen/digitalConstruction/getExceptionAlert";
JSONObject paramJson = (JSONObject) map.get("obj");
paramJson.put("size", size);
HttpUtils httpUtils = new HttpUtils();
String result = httpUtils.sendJSONPost(url, paramJson.toString(), null);
return AjaxResult.success(JSONObject.parseObject(result));
}
/**
* -
*/
@GetMapping("/materGetConcreteMaterialActQuantityGhInfoService")
public AjaxResult materGetConcreteMaterialActQuantityGhInfoService(Long projectId) throws Exception {
Map<String, Object> map = getConfig(projectId, "mater");
String url = map.get("url").toString();
url += "/MklBaseController/getService";
JSONObject paramJson = (JSONObject) map.get("obj");
paramJson.put("service", "getConcreteMaterialActQuantityGhInfoService");
HttpUtils httpUtils = new HttpUtils();
String result = httpUtils.sendGet(url, HttpUtils.jsonToGetParams(paramJson));
return AjaxResult.success(JSONObject.parseObject(result));
}
/**
* -
*/
@GetMapping("/materGetConcreteMaterialActQuantityBuildingNoInfoService")
public AjaxResult materGetConcreteMaterialActQuantityBuildingNoInfoService(Long projectId, String startTime, String endTime) throws Exception {
Map<String, Object> map = getConfig(projectId, "mater");
String url = map.get("url").toString();
url += "/MklBaseController/getService";
JSONObject paramJson = (JSONObject) map.get("obj");
if (StringUtils.isNotEmpty(startTime)) {
paramJson.put("startTime", startTime);
}
if (StringUtils.isNotEmpty(endTime)) {
paramJson.put("endTime", endTime);
}
paramJson.put("service", "getConcreteMaterialActQuantityBuildingNoInfoService");
HttpUtils httpUtils = new HttpUtils();
String result = httpUtils.sendGet(url, HttpUtils.jsonToGetParams(paramJson));
return AjaxResult.success(JSONObject.parseObject(result));
}
/**
* -
*/
@GetMapping("/materGetProjectChaoHaoStatisticsRPTService")
public AjaxResult materGetProjectChaoHaoStatisticsRPTService(Long projectId) throws Exception {
Map<String, Object> map = getConfig(projectId, "mater");
String url = map.get("url").toString();
url += "/MklBaseController/getService";
JSONObject paramJson = (JSONObject) map.get("obj");
paramJson.put("service", "getProjectChaoHaoStatisticsRPTService");
HttpUtils httpUtils = new HttpUtils();
String result = httpUtils.sendGet(url, HttpUtils.jsonToGetParams(paramJson));
return AjaxResult.success(JSONObject.parseObject(result));
}
/**
* -()
*/
@GetMapping("/materGetReportConcreteExceedReasonService")
public AjaxResult materGetReportConcreteExceedReasonService(Long projectId) throws Exception {
Map<String, Object> map = getConfig(projectId, "mater");
String url = map.get("url").toString();
url += "/MklBaseController/getService";
JSONObject paramJson = (JSONObject) map.get("obj");
paramJson.put("service", "getReportConcreteExceedReasonService");
HttpUtils httpUtils = new HttpUtils();
String result = httpUtils.sendGet(url, HttpUtils.jsonToGetParams(paramJson));
return AjaxResult.success(JSONObject.parseObject(result));
}
/**
* top5
*/
@GetMapping("/materGetReportConcreteExceedMaterielTopService")
public AjaxResult materGetReportConcreteExceedMaterielTopService(Long projectId, int top) throws Exception {
Map<String, Object> map = getConfig(projectId, "mater");
String url = map.get("url").toString();
url += "/MklBaseController/getService";
JSONObject paramJson = (JSONObject) map.get("obj");
paramJson.put("service", "getReportConcreteExceedMaterielTopService");
HttpUtils httpUtils = new HttpUtils();
if (top < 1) {
top = 5;
}
paramJson.put("top", top);
String result = httpUtils.sendGet(url, HttpUtils.jsonToGetParams(paramJson));
return AjaxResult.success(JSONObject.parseObject(result));
}
/**
* -
*/
@GetMapping("/materGetConcreteOrderDetailsInfoService")
public AjaxResult materGetConcreteOrderDetailsInfoService(Long projectId, String startTime, String endTime) throws Exception {
Map<String, Object> map = getConfig(projectId, "mater");
String url = map.get("url").toString();
url += "/MklBaseController/getService";
JSONObject paramJson = (JSONObject) map.get("obj");
if (StringUtils.isNotEmpty(startTime)) {
paramJson.put("startTime", startTime);
}
if (StringUtils.isNotEmpty(endTime)) {
paramJson.put("endTime", endTime);
}
paramJson.put("service", "getConcreteOrderDetailsInfoService");
HttpUtils httpUtils = new HttpUtils();
String result = httpUtils.sendGet(url, HttpUtils.jsonToGetParams(paramJson));
return AjaxResult.success(JSONObject.parseObject(result));
}
}

View File

@ -58,4 +58,9 @@ public interface IAttendanceCfgService
* @return * @return
*/ */
public int deleteAttendanceCfgById(Long id); public int deleteAttendanceCfgById(Long id);
/**
*
*/
String getMachMaterCfg(Long projectId, String cfgType);
} }

View File

@ -104,4 +104,12 @@ public class AttendanceCfgServiceImpl implements IAttendanceCfgService
{ {
return attendanceCfgMapper.deleteAttendanceCfgById(id); return attendanceCfgMapper.deleteAttendanceCfgById(id);
} }
/**
*
*/
@Override
public String getMachMaterCfg(Long projectId, String cfgType) {
return attendanceCfgMapper.getMachMaterCfg(projectId,cfgType);
}
} }