yjq 10 сар өмнө
parent
commit
b0deb6326d

+ 5 - 0
RuoYi-Vue-v3.8.7/ruoyi-admin/src/main/java/com/ruoyi/web/controller/pub/AssetController.java

@@ -52,4 +52,9 @@ public class AssetController extends BaseController {
         return getDataTable(list);
     }
 
+    @GetMapping("/getAssetType")
+    public AjaxResult getAssetType(){
+        return success(assetlogService.getAssetType());
+    }
+
 }

+ 63 - 0
RuoYi-Vue-v3.8.7/ruoyi-admin/src/main/resources/static/page/goods/map.html

@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
+    <title>Title</title>
+    <style type="text/css">
+        body {
+            margin: 0;
+            padding: 0;
+        }
+        #container {
+            width: 100vw;
+            height: 100vh;
+        }
+    </style>
+</head>
+<body>
+<div id="container"></div>
+</body>
+<script type="text/javascript">
+    window._AMapSecurityConfig = {
+        securityJsCode: '33429c6d95d6f74a223c075ce12d8040',
+    }
+</script>
+<script type="text/javascript"
+        src="https://webapi.amap.com/maps?v=1.4.15&key=c5bace07d7a56132f4509411619a3162"></script>
+<script type="text/javascript">
+    function markLocation(mapId, address) {
+        AMap.plugin('AMap.Geocoder', function () {
+            var geocoder = new AMap.Geocoder();
+            geocoder.getLocation(address, function (status, result) {
+                if (status === 'complete' && result.info === 'OK') {
+                    // 经纬度
+                    var lng = result.geocodes[0].location.lng;
+                    var lat = result.geocodes[0].location.lat;
+                    // 地图实例
+                    var map = new AMap.Map(mapId, {
+                        resizeEnable: true, // 允许缩放
+                        center: [lng, lat], // 设置地图的中心点
+                        zoom: 15        // 设置地图的缩放级别,0 - 20
+                    });
+                    // 添加标记
+                    var marker = new AMap.Marker({
+                        map: map,
+                        position: new AMap.LngLat(lng, lat),   // 经纬度
+                    });
+                } else {
+                    console.log('定位失败!');
+                }
+            });
+        });
+    }
+
+    window.onload = function() {
+        let addr = sessionStorage.getItem("map_addr");
+        if (addr.indexOf('重庆市') < 0) {
+            addr = '重庆市' + addr;
+        }
+        markLocation('container', addr);
+    }
+</script>
+</html>

+ 89 - 77
RuoYi-Vue-v3.8.7/ruoyi-admin/src/main/resources/static/page/goods/total.html

@@ -74,111 +74,123 @@
 </style>
 
 <body>
-	<header id="header" class="mui-bar mui-bar-nav">
-		<h1 class="mui-title">库房列表</h1>
-	</header>
-	<div class="mui-content">
-		<div style="display: flex;margin: 10px;">
-			<input type="text" placeholder="请输入关键字" id="searchInput"
-				style="width: calc(100% - 80px);height: 40px;background: #FFFFFF;border-radius: 10px 0px 0px 10px;border: none;margin-bottom: 0;">
-			</input>
-			<div class="search" id="search">
-				<img src="images/search.png"></img><span>搜索</span>
-			</div>
+<header id="header" class="mui-bar mui-bar-nav">
+	<h1 class="mui-title">库房列表</h1>
+</header>
+<div class="mui-content">
+	<div style="display: flex;margin: 10px;">
+		<input type="text" placeholder="请输入关键字" id="searchInput"
+			   style="width: calc(100% - 80px);height: 40px;background: #FFFFFF;border-radius: 10px 0px 0px 10px;border: none;margin-bottom: 0;">
+		</input>
+		<div class="search" id="search">
+			<img src="images/search.png"></img><span>搜索</span>
 		</div>
-		<div class="mui-card">
-			<ul id="kfList" class="mui-table-view mui-table-view-striped mui-table-view-condensed">
+	</div>
+	<div class="mui-card">
+		<ul id="kfList" class="mui-table-view mui-table-view-striped mui-table-view-condensed">
 
-			</ul>
-		</div>
+		</ul>
 	</div>
-	<script src="js/jquery.min.js"></script>
-	<script src="js/mui.min.js"></script>
-	<script>
-		function getDatalist(departmentName) {
-			mui.ajax({
-				// url: window.location.origin +'/wzglxtht/system/goods/getOpenKuFangList?userId=' + params.get('id'),
-				// url:  window.location.origin+'/system/dept/getDepartments',
-				url: 'http://58.144.199.81:9081/system/dept/getDepartments',
-				type: 'get',
-				data: {
-					departmentName: departmentName ? departmentName : "",
-				},
-				success: function (json) {
-					$('#kfList').empty();
-					if (json.data && json.data.length) {
-						let html = ''
-						for (let i = 0; i < json.data.length; i++) {
-							html += `<li class="mui-table-view-cell">
+</div>
+<script src="js/jquery.min.js"></script>
+<script src="js/mui.min.js"></script>
+<script>
+	function getDatalist(departmentName) {
+		mui.ajax({
+			// url: window.location.origin +'/wzglxtht/system/goods/getOpenKuFangList?userId=' + params.get('id'),
+			// url:  window.location.origin+'/system/dept/getDepartments',
+			url: 'http://58.144.199.81:9081/system/dept/getDepartments',
+			type: 'get',
+			data: {
+				departmentName: departmentName ? departmentName : "",
+			},
+			success: function (json) {
+				$('#kfList').empty();
+				if (json.data && json.data.length) {
+					let html = ''
+					for (let i = 0; i < json.data.length; i++) {
+						html += `<li class="mui-table-view-cell">
 									<div class="mui-table">
 										<div class="mui-table-cell mui-col-xs-10">
 											<div class="mui-ellipsis" data-id="${json.data[i].DepartMentDto.companyId}" data-departmentId="${json.data[i].DepartMentDto.departmentId}" data-name="${json.data[i].DepartMentDto.name}"
 							data-kgyIds="${json.data[i].kgyIds}"><img src="images/logo.png"></img>${json.data[i].DepartMentDto.name ? json.data[i].DepartMentDto.name : ""}</div>
 											<div style="padding:10px;">
 											<div class="list" id="list">
-											<img src="images/kufanimg.png" style="width:140px;border-radius: 10px;"></img>
+											<img src="images/kufang1.png" style="width:140px;border-radius: 10px;"></img>
 											<div style="color:#333;display: flex;flex-direction: column;justify-content: flex-start;">`
-							var data = json.data[i].kgyNames;
-							for (var j = 0; j < data.length; j++) {
-								var tephone = json.data[i].phones[j];
-								html += `<div style="display:flex;margin-bottom:15px;">
+						var data = json.data[i].kgyNames;
+						for (var j = 0; j < data.length; j++) {
+							var tephone = json.data[i].phones[j];
+							html += `<div style="display:flex;margin-bottom:15px;">
 									<div class="listTitle">管理员:</div>
 									<div>${data[j]}</div>
 									<div class='telclick' data-tel='${tephone}'>${tephone ? tephone : '-'}</div>
 									</div>
 													`
-							}
-							html +=`<div style="display:flex;"><div class="listTitle">资产汇总:</div><div>234件</div></div>
+						}
+						html +=`<div style="display:flex;"><div class="listTitle">资产汇总:</div><div>${json.data[i].DepartMentDto.assetNum ? json.data[i].DepartMentDto.assetNum : '-'} &nbsp;件</div></div>
 									</div></div></div>
 									<div class="list" style="display: flex;justify-content: space-between;padding:10px;"><div style="color: #333;">${json.data[i].DepartMentDto.location ? json.data[i].DepartMentDto.location : ""}</div>
-									<div style="display: flex;align-items: flex-end;">`
-							html+=`<img src="images/address.png" style="width: 22px;height: 18px;"></img>
+									<div class="btn-map" data-addr="${json.data[i].DepartMentDto.location ? json.data[i].DepartMentDto.location : ""}" style="display: flex;align-items: flex-end;">`
+						html+=`<img src="images/address.png" style="width: 22px;height: 18px;"></img>
 									<div style="color: #1484FE;text-shadow: 3px 4px 4px rgba(20,132,254,0.33);">地图</div>
 									</div>
 									</div>
 									</div>
 									</div>
 								</li>`
+					}
+					$('#kfList').append(html)
+					$(".telclick").on('click', function (e) {
+						if ((e.target).getAttribute("data-tel")) {
+							var link = document.createElement('a');
+							link.href = 'tel:' + $(".telclick").attr("data-tel")
+							link.click();
 						}
-						$('#kfList').append(html)
-						$(".telclick").on('click', function (e) {
-							if ((e.target).getAttribute("data-tel")) {
-								var link = document.createElement('a');
-								link.href = 'tel:' + $(".telclick").attr("data-tel")
-								link.click();
-							}
-						})
+					})
+
+					$(".btn-map").on("click", function(e) {
+						sessionStorage.removeItem("map_addr")
+						let addr = $(this).attr("data-addr");
+						if (addr) {
+							sessionStorage.setItem("map_addr", addr);
+							mui.openWindow({
+								id: 'map',
+								url: 'map.html'
+							});
+						}
+					})
 
-					}
 				}
-			})
-			mui("#kfList").on('click', '.mui-ellipsis', function (e) {
-				document.getElementById('searchInput').value = "";
-				getDatalist();
-				const dutyId = this.getAttribute('data-kgyIds')
-				const id = this.getAttribute('data-id')
-				const name = this.getAttribute('data-name')
-				const departmentId = this.getAttribute('data-departmentId')
-				mui.openWindow({
-					id: 'goods',
-					url: 'goods.html?type=1&id=' + id + '&name=' + name + '&departmentId=' + departmentId + '&dutyId=' + dutyId
-				});
-			})
-		}
-		mui.init({
-			statusBarBackground: '#f7f7f7'
-		});
-		mui.ready(() => {
-			// const params = new URLSearchParams(window.location.search);
+			}
+		})
+		mui("#kfList").on('click', '.mui-ellipsis', function (e) {
+			document.getElementById('searchInput').value = "";
 			getDatalist();
+			const dutyId = this.getAttribute('data-kgyIds')
+			const id = this.getAttribute('data-id')
+			const name = this.getAttribute('data-name')
+			const departmentId = this.getAttribute('data-departmentId')
+			mui.openWindow({
+				id: 'goods',
+				url: 'goods.html?type=1&id=' + id + '&name=' + name + '&departmentId=' + departmentId + '&dutyId=' + dutyId
+			});
 		})
-		var node = document.getElementById("search");
-		// 绑定点击事件
-		node.onclick = function () {
-			var searchInput = document.getElementById('searchInput').value;
-			getDatalist(searchInput);
-		};
-	</script>
+	}
+	mui.init({
+		statusBarBackground: '#f7f7f7'
+	});
+	mui.ready(() => {
+		// const params = new URLSearchParams(window.location.search);
+		getDatalist();
+	})
+	var node = document.getElementById("search");
+	// 绑定点击事件
+	node.onclick = function () {
+		var searchInput = document.getElementById('searchInput').value;
+		getDatalist(searchInput);
+	};
+</script>
 </body>
 
 </html>

+ 9 - 0
RuoYi-Vue-v3.8.7/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/DepartMentDto.java

@@ -15,6 +15,7 @@ public class DepartMentDto {
     private String location;
 
     private String telPhone;
+    private Long assetNum;
 
     public String getTelPhone() {
         return telPhone;
@@ -79,4 +80,12 @@ public class DepartMentDto {
     public void setLocation(String location) {
         this.location = location;
     }
+
+    public Long getAssetNum() {
+        return assetNum;
+    }
+
+    public void setAssetNum(Long assetNum) {
+        this.assetNum = assetNum;
+    }
 }

+ 9 - 0
RuoYi-Vue-v3.8.7/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/AssetVo.java

@@ -13,6 +13,7 @@ public class AssetVo extends BaseEntity {
     private Integer companyId;
     private Integer codeId;
     private String dutyId;
+    private String assetType;
 
     public String getAssetName() {
         return assetName;
@@ -53,4 +54,12 @@ public class AssetVo extends BaseEntity {
     public void setDutyId(String dutyId) {
         this.dutyId = dutyId;
     }
+
+    public String getAssetType() {
+        return assetType;
+    }
+
+    public void setAssetType(String assetType) {
+        this.assetType = assetType;
+    }
 }

+ 7 - 0
RuoYi-Vue-v3.8.7/ruoyi-system/src/main/java/com/ruoyi/system/mapper/AssetlogMapper.java

@@ -5,6 +5,7 @@ import com.ruoyi.system.domain.vo.AssetVo;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.data.domain.Pageable;
 import java.util.List;
+import java.util.Map;
 
 /**
  * (Assetlog)表数据库访问层
@@ -41,5 +42,11 @@ public interface AssetlogMapper {
 
 
     List<Assetlog> list(@Param("assetVo") AssetVo assetVo,@Param("item") Integer[] dutyids);
+
+    /**
+     * 按照资产类型统计数量
+     * @return
+     */
+    List<Map<String, Object>> getAssetType();
 }
 

+ 8 - 0
RuoYi-Vue-v3.8.7/ruoyi-system/src/main/java/com/ruoyi/system/mapper/DepartmentMapper.java

@@ -44,6 +44,14 @@ public interface DepartmentMapper {
 
     List<DepartMentDto> getDepartments(String departmentName);
 
+    /**
+     * @Author: Yujianq
+     * @Date: 2024/6/12 15:37
+     * @Description: 通过部门ID查询资产总数
+     * @param departmentId
+     * @return: java.lang.Long
+     */
+    Long getDepartmentAssetNum(Integer departmentId);
 
 }
 

+ 7 - 0
RuoYi-Vue-v3.8.7/ruoyi-system/src/main/java/com/ruoyi/system/service/AssetlogService.java

@@ -7,6 +7,7 @@ import org.springframework.data.domain.Page;
 import org.springframework.data.domain.PageRequest;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * (Assetlog)表服务接口
@@ -35,4 +36,10 @@ public interface AssetlogService {
 
 
     List<Assetlog> list(AssetVo assetVo);
+
+    /**
+     * 按照资产类型统计数量
+     * @return
+     */
+    List<Map<String, Object>> getAssetType();
 }

+ 6 - 0
RuoYi-Vue-v3.8.7/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/AssetlogServiceImpl.java

@@ -14,6 +14,7 @@ import org.springframework.data.domain.PageRequest;
 import javax.annotation.Resource;
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 
 /**
  * (Assetlog)表服务实现类
@@ -55,4 +56,9 @@ public class AssetlogServiceImpl implements AssetlogService {
 
         return assetlogMapper.list(assetVo, Convert.toIntArray(assetVo.getDutyId()));
     }
+
+    @Override
+    public List<Map<String, Object>> getAssetType() {
+        return assetlogMapper.getAssetType();
+    }
 }

+ 1 - 0
RuoYi-Vue-v3.8.7/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DepartmentServiceImpl.java

@@ -54,6 +54,7 @@ public class DepartmentServiceImpl implements DepartmentService {
                 names = new ArrayList<>();
                 phones = new ArrayList<>();
             }
+            department.setAssetNum(departmentDao.getDepartmentAssetNum(department.getDepartmentId()));
             copy.add(department);
             ids.add(Convert.toStr(department.getDutyId()));
             names.add(department.getPersonName());

+ 9 - 0
RuoYi-Vue-v3.8.7/ruoyi-system/src/main/resources/mapper/system/AssetlogMapper.xml

@@ -867,9 +867,18 @@
             <if test="assetVo.assetName != null and assetVo.assetName != ''">
                AND Name LIKE '%'+#{assetVo.assetName}+'%'
             </if>
+            <if test="assetVo.assetType != null and assetVo.assetType != ''">
+                AND AssetType = #{assetVo.assetType}
+            </if>
         </where>
 
     </select>
 
+    <select id="getAssetType" resultType="java.util.Map">
+        SELECT AssetType, COUNT(1) AS num
+        FROM AssetLog
+        GROUP BY AssetType
+    </select>
+
 </mapper>
 

+ 6 - 0
RuoYi-Vue-v3.8.7/ruoyi-system/src/main/resources/mapper/system/DepartmentMapper.xml

@@ -211,5 +211,11 @@
         order by vudmt.DepartmentId DESC
     </select>
 
+    <select id="getDepartmentAssetNum" resultType="Long" parameterType="Integer">
+        SELECT COUNT (1) AS total
+        FROM AssetLog
+        WHERE SaveDepartmentId = #{departmentId}
+    </select>
+
 </mapper>